[PE] Send placeholder object when insert image/table/chart to placeholder

This commit is contained in:
Julia Radzhabova 2019-11-26 13:54:37 +03:00
parent 14c27ee0a7
commit 1660ae4e52
3 changed files with 23 additions and 9 deletions

View file

@ -88,6 +88,11 @@ define([
this.$window.find('.dlg-btn').on('click', _.bind(this.onDlgBtnClick, this)); 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) { setChartData: function(data) {
this._chartData = data; this._chartData = data;
if (this._isExternalDocReady) if (this._isExternalDocReady)
@ -143,6 +148,14 @@ define([
} }
}, },
setPlaceholder: function(placeholder) {
this._placeholder = placeholder;
},
getPlaceholder: function() {
return this._placeholder;
},
textSave: 'Save & Exit', textSave: 'Save & Exit',
textClose: 'Close', textClose: 'Close',
textTitle: 'Chart Editor' textTitle: 'Chart Editor'

View file

@ -112,7 +112,7 @@ define([
if (this.api) { if (this.api) {
( diagramEditor.isEditMode() ) ( diagramEditor.isEditMode() )
? this.api.asc_editChartDrawingObject(data) ? this.api.asc_editChartDrawingObject(data)
: this.api.asc_addChartDrawingObject(data); : this.api.asc_addChartDrawingObject(data, diagramEditor.getPlaceholder());
} }
}, this)); }, this));
diagramEditor.on('hide', _.bind(function(cmp, message) { diagramEditor.on('hide', _.bind(function(cmp, message) {

View file

@ -1698,7 +1698,7 @@ define([
} }
}, },
/** coauthoring end **/ /** coauthoring end **/
editChartClick: function(chart){ editChartClick: function(chart, placeholder){
if (this.mode.isEdit && !this._isDisabled) { if (this.mode.isEdit && !this._isDisabled) {
var diagramEditor = PE.getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); var diagramEditor = PE.getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor');
@ -1708,6 +1708,7 @@ define([
if (typeof chart !== 'object') if (typeof chart !== 'object')
chart = this.api.asc_getChartObject(chart); chart = this.api.asc_getChartObject(chart);
diagramEditor.setChartData(new Asc.asc_CChartBinary(chart)); diagramEditor.setChartData(new Asc.asc_CChartBinary(chart));
diagramEditor.setPlaceholder(placeholder);
} }
} }
}, },
@ -3428,11 +3429,11 @@ define([
var checkUrl = value.replace(/ /g, ''); var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) { if (!_.isEmpty(checkUrl)) {
if (placeholder) if (placeholder)
me.api.AddImageUrl(checkUrl); me.api.AddImageUrl(checkUrl, obj);
else { else {
var props = new Asc.asc_CImgProperty(); var props = new Asc.asc_CImgProperty();
props.put_ImageUrl(checkUrl); props.put_ImageUrl(checkUrl);
me.api.ImgApply(props); me.api.ImgApply(props, obj);
} }
} }
} }
@ -3477,7 +3478,7 @@ define([
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>') itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')
}); });
picker.on('item:click', function (picker, item, record, e) { 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}); menuContainer.css({left: x, top : y});
@ -3525,7 +3526,7 @@ define([
maxColumns: 10 maxColumns: 10
}); });
picker.on('select', function(picker, columns, rows){ picker.on('select', function(picker, columns, rows){
me.api.put_Table(columns, rows); me.api.put_Table(columns, rows, obj);
me.fireEvent('editcomplete', me); me.fireEvent('editcomplete', me);
}); });
menu.on('item:click', function(menu, item, e){ menu.on('item:click', function(menu, item, e){
@ -3533,7 +3534,7 @@ define([
(new Common.Views.InsertTableDialog({ (new Common.Views.InsertTableDialog({
handler: function(result, value) { handler: function(result, value) {
if (result == 'ok') if (result == 'ok')
me.api.put_Table(value.columns, value.rows); me.api.put_Table(value.columns, value.rows, obj);
me.fireEvent('editcomplete', me); me.fireEvent('editcomplete', me);
} }
})).show(); })).show();
@ -3559,9 +3560,9 @@ define([
onClickPlaceholder: function(type, obj, x, y) { onClickPlaceholder: function(type, obj, x, y) {
if (!this.api) return; if (!this.api) return;
if (type == AscCommon.PlaceholderButtonType.Video) { if (type == AscCommon.PlaceholderButtonType.Video) {
// this.api.addVideo(); // this.api.addVideo(obj);
} else if (type == AscCommon.PlaceholderButtonType.Audio) { } else if (type == AscCommon.PlaceholderButtonType.Audio) {
// this.api.addAudio(); // this.api.addAudio(obj);
} }
this.fireEvent('editcomplete', this); this.fireEvent('editcomplete', this);
}, },