Fix Bug 76462

This commit is contained in:
Julia.Radzhabova
2025-08-28 12:00:09 +03:00
parent f5e9d6ba41
commit 082ca598d1
5 changed files with 50 additions and 26 deletions

View File

@ -795,8 +795,9 @@ define([
} else
if (!this.$window.is(':visible')) {
this.$window.css({opacity: 0});
(_.isNumber(x) && _.isNumber(y)) && this.setPosition(x, y);
_setVisible.call(this);
this.$window.show()
this.$window.show();
}
$(document).on('keydown.' + this.cid, this.binding.keydown);
@ -952,7 +953,7 @@ define([
},
setWidth: function(width) {
if (width >= 0) {
if (this.$window && width >= 0) {
var min = parseInt(this.$window.css('min-width'));
width < min && (width = min);
width -= (parseInt(this.$window.css('border-left-width')) + parseInt(this.$window.css('border-right-width')));
@ -961,11 +962,11 @@ define([
},
getWidth: function() {
return parseInt(this.$window.css('width'));
return this.$window ? parseInt(this.$window.css('width')) : undefined;
},
setHeight: function(height) {
if (height >= 0) {
if (this.$window && height >= 0) {
var min = parseInt(this.$window.css('min-height'));
height < min && (height = min);
height -= (parseInt(this.$window.css('border-bottom-width')) + parseInt(this.$window.css('border-top-width')));
@ -979,7 +980,7 @@ define([
},
getHeight: function() {
return parseInt(this.$window.css('height'));
return this.$window ? parseInt(this.$window.css('height')) : undefined;
},
setSize: function(w, h) {

View File

@ -44,10 +44,10 @@ define([
_.extend(_options, {
id: 'id-external-diagram-editor',
title: this.textTitle,
storageName: 'diagram-editor',
// storageName: 'diagram-editor',
sdkplaceholder: 'id-diagram-editor-placeholder',
initwidth: 900,
initheight: 700,
initwidth: 730,
initheight: 275,
minwidth: 730,
minheight: 275,
footer: false,

View File

@ -42,19 +42,23 @@ define([], function () {
initialize : function(options) {
var filter = Common.localStorage.getKeysFilter(),
appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
this.storageName = appPrefix + (options.storageName || 'external-editor');
this.storageName = options.storageName ? appPrefix + options.storageName : null;
var _options = {},
width = options.initwidth || 900,
height = options.initheight || 700,
footer = options.footer !== undefined ? options.footer : true;
var value = Common.localStorage.getItem(this.storageName + '-width');
value && (width = parseFloat(value));
value = Common.localStorage.getItem(this.storageName + '-height');
value && (height = parseFloat(value));
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName + '-width');
value && (width = parseFloat(value));
value = Common.localStorage.getItem(this.storageName + '-height');
value && (height = parseFloat(value));
}
_.extend(_options, {
width: width,
height: height,
cls: 'advanced-settings-dlg',
header: true,
toolclose: 'hide',
@ -64,10 +68,9 @@ define([], function () {
}, options);
!footer && (_options.cls += ' no-footer');
_options.contentHeight = height;
this.template = [
'<div id="id-editor-container" class="box" style="height:' + _options.contentHeight + 'px; padding: 0 5px;">',
'<div id="id-editor-container" class="box" style="padding: 0 5px;">',
'<div id="' + (_options.sdkplaceholder || '') + '" style="width: 100%;height: 100%;"></div>',
'</div>',
'<% if (footer) { %>',
@ -98,11 +101,7 @@ define([], function () {
if (resizeborder.length>0)
this._headerFooterHeight += $(resizeborder[0]).height()-2;
var _inner_height = Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top');
if (_inner_height < this.initConfig.contentHeight + this._headerFooterHeight) {
this.initConfig.contentHeight = _inner_height - this._headerFooterHeight;
this.boxEl.css('height', this.initConfig.contentHeight);
}
this.boxEl.css('height', this.getHeight() - this._headerFooterHeight);
this.btnSave = new Common.UI.Button({
el: this.$window.find('#id-btn-editor-apply'),
@ -150,7 +149,7 @@ define([], function () {
},
setHeight: function(height) {
if (height >= 0) {
if (this.$window && height >= 0) {
var min = parseInt(this.$window.css('min-height'));
height < min && (height = min);
this.$window.height(height);
@ -196,8 +195,10 @@ define([], function () {
onWindowResize: function (args) {
if (args && args[1]=='end') {
var value = this.getSize();
Common.localStorage.setItem(this.storageName + '-width', value[0]);
Common.localStorage.setItem(this.storageName + '-height', value[1]);
if (this.storageName) {
Common.localStorage.setItem(this.storageName + '-width', value[0]);
Common.localStorage.setItem(this.storageName + '-height', value[1]);
}
}
},

View File

@ -51,7 +51,7 @@ define([
initwidth: 1030,
initheight: 700,
minwidth: 1030,
minheight: 275
minheight: 310
}, options);
this._oleData = null;

View File

@ -1205,7 +1205,8 @@ define([], function () {
var me = this,
documentHolderView = me.documentHolder,
chartContainer = documentHolderView.cmpEl.find('#chart-element-container');
me._state.currentChartRect = asc_CRect;
me.getCurrentChartProps = function() {
var selectedObjects = this.api.getSelectedElements();
for (var i = 0; i < selectedObjects.length; i++) {
@ -1419,8 +1420,29 @@ define([], function () {
if (this.mode.isEdit && !(this._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) {
var diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor');
if (diagramEditor && chart) {
let x, y;
if (this._state.currentChartRect) {
diagramEditor.setSize(diagramEditor.initConfig.initwidth, diagramEditor.initConfig.initheight);
let dlgW = diagramEditor.getWidth() || diagramEditor.initConfig.initwidth,
dlgH = diagramEditor.getHeight() || diagramEditor.initConfig.initheight,
rect_x = this._state.currentChartRect.asc_getX(),
rect_y = this._state.currentChartRect.asc_getY(),
w = this._state.currentChartRect.asc_getWidth(),
h = this._state.currentChartRect.asc_getHeight();
y = this._XY[1] + rect_y + h;
if (y + dlgH > Common.Utils.innerHeight()) {
y = this._XY[1] + rect_y - dlgH;
if (y<0) {
y = Common.Utils.innerHeight() - dlgH;
}
}
x = this._XY[0] + rect_x - (dlgW - w)/2;
if (x + dlgW > Common.Utils.innerWidth())
x = Common.Utils.innerWidth() - dlgW;
}
diagramEditor.setEditMode(true);
diagramEditor.show();
diagramEditor.show(x, y);
diagramEditor.setChartData(chart);
}
}