Edit sse ole object from right panel

This commit is contained in:
Julia Radzhabova 2022-03-28 21:02:21 +03:00
parent ac0e61182b
commit 7268073d19
3 changed files with 39 additions and 6 deletions

View file

@ -181,7 +181,18 @@ define([
this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this));
this.btnEditObject.on('click', _.bind(function(btn){
if (this.api) this.api.asc_startEditCurrentOleObject();
if (this.api) {
var oleobj = this.api.asc_canEditTableOleObject();
if (oleobj) {
var oleEditor = DE.getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
if (oleEditor) {
oleEditor.setEditMode(true);
oleEditor.show();
oleEditor.setOleData(Asc.asc_putBinaryDataToFrameFromTableOleObject(oleobj));
}
} else
this.api.asc_startEditCurrentOleObject();
}
this.fireEvent('editcomplete', this);
}, this));
this.btnFitMargins.on('click', _.bind(this.setFitMargins, this));
@ -424,7 +435,7 @@ define([
if (this._state.isOleObject) {
var plugin = DE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid});
this.btnEditObject.setDisabled(plugin===null || plugin ===undefined || this._locked);
this.btnEditObject.setDisabled(!this.api.asc_canEditTableOleObject() && (plugin===null || plugin ===undefined) || this._locked);
} else {
this.btnSelectImage.setDisabled(pluginGuid===null || this._locked);
}

View file

@ -148,7 +148,18 @@ define([
this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this));
this.btnEditObject.on('click', _.bind(function(btn){
if (this.api) this.api.asc_startEditCurrentOleObject();
if (this.api) {
var oleobj = this.api.asc_canEditTableOleObject();
if (oleobj) {
var oleEditor = PE.getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
if (oleEditor) {
oleEditor.setEditMode(true);
oleEditor.show();
oleEditor.setOleData(Asc.asc_putBinaryDataToFrameFromTableOleObject(oleobj));
}
} else
this.api.asc_startEditCurrentOleObject();
}
this.fireEvent('editcomplete', this);
}, this));
@ -348,7 +359,7 @@ define([
if (this._state.isOleObject) {
var plugin = PE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid});
this.btnEditObject.setDisabled(plugin===null || plugin ===undefined || this._locked);
this.btnEditObject.setDisabled(!this.api.asc_canEditTableOleObject() && (plugin===null || plugin ===undefined) || this._locked);
} else {
this.btnSelectImage.setDisabled(pluginGuid===null || this._locked);
}

View file

@ -215,7 +215,18 @@ define([
this.spnHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this));
this.btnEditObject.on('click', _.bind(function(btn){
if (this.api) this.api.asc_startEditCurrentOleObject();
if (this.api) {
var oleobj = this.api.asc_canEditTableOleObject();
if (oleobj) {
var oleEditor = SSE.getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
if (oleEditor) {
oleEditor.setEditMode(true);
oleEditor.show();
oleEditor.setOleData(Asc.asc_putBinaryDataToFrameFromTableOleObject(oleobj));
}
} else
this.api.asc_startEditCurrentOleObject();
}
Common.NotificationCenter.trigger('edit:complete', this);
}, this));
@ -448,7 +459,7 @@ define([
if (this._state.isOleObject) {
var plugin = SSE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid});
this.btnEditObject.setDisabled(plugin===null || plugin ===undefined || this._locked);
this.btnEditObject.setDisabled(!this.api.asc_canEditTableOleObject() && (plugin===null || plugin ===undefined) || this._locked);
} else {
this.btnSelectImage.setDisabled(pluginGuid===null || this._locked);
}