diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js
index 06ad245548..eaff31f1f7 100644
--- a/apps/common/main/lib/component/Window.js
+++ b/apps/common/main/lib/component/Window.js
@@ -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) {
diff --git a/apps/common/main/lib/view/ExternalDiagramEditor.js b/apps/common/main/lib/view/ExternalDiagramEditor.js
index 8d42d19189..350a72f522 100644
--- a/apps/common/main/lib/view/ExternalDiagramEditor.js
+++ b/apps/common/main/lib/view/ExternalDiagramEditor.js
@@ -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,
diff --git a/apps/common/main/lib/view/ExternalEditor.js b/apps/common/main/lib/view/ExternalEditor.js
index a37153c75c..b2d7c4705b 100644
--- a/apps/common/main/lib/view/ExternalEditor.js
+++ b/apps/common/main/lib/view/ExternalEditor.js
@@ -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 = [
- '
',
+ '
',
'<% 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]);
+ }
}
},
diff --git a/apps/common/main/lib/view/ExternalOleEditor.js b/apps/common/main/lib/view/ExternalOleEditor.js
index e5bb83a6e2..a45c30960c 100644
--- a/apps/common/main/lib/view/ExternalOleEditor.js
+++ b/apps/common/main/lib/view/ExternalOleEditor.js
@@ -51,7 +51,7 @@ define([
initwidth: 1030,
initheight: 700,
minwidth: 1030,
- minheight: 275
+ minheight: 310
}, options);
this._oleData = null;
diff --git a/apps/documenteditor/main/app/controller/DocumentHolderExt.js b/apps/documenteditor/main/app/controller/DocumentHolderExt.js
index f1552ebb25..b0bafd42b3 100644
--- a/apps/documenteditor/main/app/controller/DocumentHolderExt.js
+++ b/apps/documenteditor/main/app/controller/DocumentHolderExt.js
@@ -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);
}
}