diff --git a/apps/common/main/lib/view/ExternalDiagramEditor.js b/apps/common/main/lib/view/ExternalDiagramEditor.js index c5f26a44c..280f002a5 100644 --- a/apps/common/main/lib/view/ExternalDiagramEditor.js +++ b/apps/common/main/lib/view/ExternalDiagramEditor.js @@ -88,6 +88,11 @@ define([ this.$window.find('.dlg-btn').on('click', _.bind(this.onDlgBtnClick, this)); }, + show: function() { + this.setPlaceholder(); + Common.UI.Window.prototype.show.apply(this, arguments); + }, + setChartData: function(data) { this._chartData = data; if (this._isExternalDocReady) @@ -143,6 +148,14 @@ define([ } }, + setPlaceholder: function(placeholder) { + this._placeholder = placeholder; + }, + + getPlaceholder: function() { + return this._placeholder; + }, + textSave: 'Save & Exit', textClose: 'Close', textTitle: 'Chart Editor' diff --git a/apps/presentationeditor/main/app/controller/DocumentHolder.js b/apps/presentationeditor/main/app/controller/DocumentHolder.js index e5bd95ede..b1cef7f39 100644 --- a/apps/presentationeditor/main/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/main/app/controller/DocumentHolder.js @@ -112,7 +112,7 @@ define([ if (this.api) { ( diagramEditor.isEditMode() ) ? this.api.asc_editChartDrawingObject(data) - : this.api.asc_addChartDrawingObject(data); + : this.api.asc_addChartDrawingObject(data, diagramEditor.getPlaceholder()); } }, this)); diagramEditor.on('hide', _.bind(function(cmp, message) { diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index adf8cee6e..3528e3ec0 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -1698,7 +1698,7 @@ define([ } }, /** coauthoring end **/ - editChartClick: function(chart){ + editChartClick: function(chart, placeholder){ if (this.mode.isEdit && !this._isDisabled) { var diagramEditor = PE.getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); @@ -1708,6 +1708,7 @@ define([ if (typeof chart !== 'object') chart = this.api.asc_getChartObject(chart); diagramEditor.setChartData(new Asc.asc_CChartBinary(chart)); + diagramEditor.setPlaceholder(placeholder); } } }, @@ -3428,11 +3429,11 @@ define([ var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { if (placeholder) - me.api.AddImageUrl(checkUrl); + me.api.AddImageUrl(checkUrl, obj); else { var props = new Asc.asc_CImgProperty(); props.put_ImageUrl(checkUrl); - me.api.ImgApply(props); + me.api.ImgApply(props, obj); } } } @@ -3477,7 +3478,7 @@ define([ itemTemplate: _.template('
') }); picker.on('item:click', function (picker, item, record, e) { - me.editChartClick(record.get('type')); + me.editChartClick(record.get('type'), obj); }); } menuContainer.css({left: x, top : y}); @@ -3525,7 +3526,7 @@ define([ maxColumns: 10 }); picker.on('select', function(picker, columns, rows){ - me.api.put_Table(columns, rows); + me.api.put_Table(columns, rows, obj); me.fireEvent('editcomplete', me); }); menu.on('item:click', function(menu, item, e){ @@ -3533,7 +3534,7 @@ define([ (new Common.Views.InsertTableDialog({ handler: function(result, value) { if (result == 'ok') - me.api.put_Table(value.columns, value.rows); + me.api.put_Table(value.columns, value.rows, obj); me.fireEvent('editcomplete', me); } })).show(); @@ -3559,9 +3560,9 @@ define([ onClickPlaceholder: function(type, obj, x, y) { if (!this.api) return; if (type == AscCommon.PlaceholderButtonType.Video) { - // this.api.addVideo(); + // this.api.addVideo(obj); } else if (type == AscCommon.PlaceholderButtonType.Audio) { - // this.api.addAudio(); + // this.api.addAudio(obj); } this.fireEvent('editcomplete', this); },