Merge pull request #1670 from ONLYOFFICE/feature/sse-edit-ole

Feature/sse edit ole
This commit is contained in:
Julia Radzhabova 2022-03-31 18:25:43 +03:00 committed by GitHub
commit 4341ea35c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 80 additions and 7 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(true);
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(true);
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

@ -165,6 +165,7 @@ require([
'Common.Controllers.Chat',
'Common.Controllers.Comments',
'Common.Controllers.Plugins'
,'Common.Controllers.ExternalOleEditor'
,'Common.Controllers.ReviewChanges'
,'Common.Controllers.Protection'
]
@ -203,6 +204,7 @@ require([
'common/main/lib/controller/Comments',
'common/main/lib/controller/Chat',
'common/main/lib/controller/Plugins'
,'common/main/lib/controller/ExternalOleEditor'
,'common/main/lib/controller/ReviewChanges'
,'common/main/lib/controller/Protection'
,'common/main/lib/controller/Themes'

View file

@ -256,6 +256,28 @@ define([
view.tableTotalMenu.on('item:click', _.bind(me.onTotalMenuClick, me));
view.menuImgMacro.on('click', _.bind(me.onImgMacro, me));
view.menuImgEditPoints.on('click', _.bind(me.onImgEditPoints, me));
if (!me.permissions.isEditMailMerge && !me.permissions.isEditDiagram && !me.permissions.isEditOle) {
var oleEditor = me.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
if (oleEditor) {
oleEditor.on('internalmessage', _.bind(function(cmp, message) {
var command = message.data.command;
var data = message.data.data;
if (me.api) {
if (oleEditor.isEditMode())
me.api.asc_editTableOleObject(data);
}
}, me));
oleEditor.on('hide', _.bind(function(cmp, message) {
if (me.api) {
me.api.asc_enableKeyEvents(true);
}
setTimeout(function(){
view.fireEvent('editcomplete', view);
}, 10);
}, me));
}
}
} else {
view.menuViewCopy.on('click', _.bind(me.onCopyPaste, me));
view.menuViewUndo.on('click', _.bind(me.onUndo, me));
@ -342,6 +364,8 @@ define([
this.api.asc_registerCallback('asc_onInputMessage', _.bind(this.onInputMessage, this));
this.api.asc_registerCallback('asc_onTableTotalMenu', _.bind(this.onTableTotalMenu, this));
this.api.asc_registerCallback('asc_onShowPivotGroupDialog', _.bind(this.onShowPivotGroupDialog, this));
if (!this.permissions.isEditMailMerge && !this.permissions.isEditDiagram && !this.permissions.isEditOle)
this.api.asc_registerCallback('asc_doubleClickOnTableOleObject', _.bind(this.onDoubleClickOnTableOleObject, this));
}
this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this));
this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this));
@ -3954,6 +3978,17 @@ define([
}
},
onDoubleClickOnTableOleObject: function(obj) {
if (this.permissions.isEdit && !this._isDisabled) {
var oleEditor = SSE.getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
if (oleEditor && obj) {
oleEditor.setEditMode(true);
oleEditor.show();
oleEditor.setOleData(Asc.asc_putBinaryDataToFrameFromTableOleObject(obj));
}
}
},
getUserName: function(id){
var usersStore = SSE.getCollection('Common.Collections.Users');
if (usersStore){

View file

@ -915,6 +915,7 @@ define([
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle) {
pluginsController.setApi(me.api);
this.api && this.api.asc_setFrozenPaneBorderType(Common.localStorage.getBool('sse-freeze-shadow', true) ? Asc.c_oAscFrozenPaneBorderType.shadow : Asc.c_oAscFrozenPaneBorderType.line);
application.getController('Common.Controllers.ExternalOleEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization});
}
leftMenuView.disableMenu('all',false);
@ -2565,7 +2566,7 @@ define([
setOleData: function(obj) {
if (typeof obj === 'object' && this.api) {
this.api.asc_addTableOleObject(obj);
this.api.asc_addTableOleObjectInOleEditor(obj);
this.isFrameClosed = false;
}
},

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(true);
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);
}

View file

@ -155,6 +155,7 @@ require([
'Common.Controllers.Chat',
'Common.Controllers.Comments',
'Common.Controllers.Plugins'
,'Common.Controllers.ExternalOleEditor'
,'Common.Controllers.ReviewChanges'
,'Common.Controllers.Protection'
]
@ -193,6 +194,7 @@ require([
'common/main/lib/controller/Comments',
'common/main/lib/controller/Chat',
'common/main/lib/controller/Plugins'
,'common/main/lib/controller/ExternalOleEditor'
,'common/main/lib/controller/ReviewChanges'
,'common/main/lib/controller/Protection'
,'common/main/lib/controller/Themes'