From 7090bd8ed632549d25ae49c2221100dfeaa8eb96 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 8 Sep 2022 17:20:13 +0300 Subject: [PATCH] Send data between external editors and general editor --- .../main/lib/controller/ExternalDiagramEditor.js | 8 ++++++++ .../main/lib/controller/ExternalMergeEditor.js | 8 ++++++++ .../main/lib/controller/ExternalOleEditor.js | 8 ++++++++ .../main/app/controller/Main.js | 16 ++++++++++++++-- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/apps/common/main/lib/controller/ExternalDiagramEditor.js b/apps/common/main/lib/controller/ExternalDiagramEditor.js index 70170e8ab..a17384b3c 100644 --- a/apps/common/main/lib/controller/ExternalDiagramEditor.js +++ b/apps/common/main/lib/controller/ExternalDiagramEditor.js @@ -142,6 +142,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onCloseChartEditor', _.bind(this.onDiagrammEditingDisabled, this)); + this.api.asc_registerCallback('asc_sendFromGeneralToFrameEditor', _.bind(this.onSendFromGeneralToFrameEditor, this)); return this; }, @@ -232,6 +233,9 @@ define([ y = parseInt(this.diagramEditorView.$window.css('top')) + eventData.data.pagey + 34; this.diagramEditorView.binding.drag({pageX:x, pageY:y}); } + } else + if (eventData.type == "frameToGeneralData") { + this.api && this.api.asc_getInformationBetweenFrameAndGeneralEditor(eventData.data); } else this.diagramEditorView.fireEvent('internalmessage', this.diagramEditorView, eventData); } @@ -243,6 +247,10 @@ define([ } }, + onSendFromGeneralToFrameEditor: function(data) { + externalEditor && externalEditor.serviceCommand('generalToFrameData', data); + }, + warningTitle: 'Warning', warningText: 'The object is disabled because of editing by another user.', textClose: 'Close', diff --git a/apps/common/main/lib/controller/ExternalMergeEditor.js b/apps/common/main/lib/controller/ExternalMergeEditor.js index 89017051a..fc4e57c84 100644 --- a/apps/common/main/lib/controller/ExternalMergeEditor.js +++ b/apps/common/main/lib/controller/ExternalMergeEditor.js @@ -134,6 +134,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onCloseMergeEditor', _.bind(this.onMergeEditingDisabled, this)); + this.api.asc_registerCallback('asc_sendFromGeneralToFrameEditor', _.bind(this.onSendFromGeneralToFrameEditor, this)); return this; }, @@ -216,6 +217,9 @@ define([ y = parseInt(this.mergeEditorView.$window.css('top')) + eventData.data.pagey + 34; this.mergeEditorView.binding.drag({pageX:x, pageY:y}); } + } else + if (eventData.type == "frameToGeneralData") { + this.api && this.api.asc_getInformationBetweenFrameAndGeneralEditor(eventData.data); } else this.mergeEditorView.fireEvent('internalmessage', this.mergeEditorView, eventData); } @@ -227,6 +231,10 @@ define([ } }, + onSendFromGeneralToFrameEditor: function(data) { + externalEditor && externalEditor.serviceCommand('generalToFrameData', data); + }, + warningTitle: 'Warning', warningText: 'The object is disabled because of editing by another user.', textClose: 'Close', diff --git a/apps/common/main/lib/controller/ExternalOleEditor.js b/apps/common/main/lib/controller/ExternalOleEditor.js index 2345dc754..3d60a5e6b 100644 --- a/apps/common/main/lib/controller/ExternalOleEditor.js +++ b/apps/common/main/lib/controller/ExternalOleEditor.js @@ -142,6 +142,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onCloseOleEditor', _.bind(this.onOleEditingDisabled, this)); + this.api.asc_registerCallback('asc_sendFromGeneralToFrameEditor', _.bind(this.onSendFromGeneralToFrameEditor, this)); return this; }, @@ -233,6 +234,9 @@ define([ y = parseInt(this.oleEditorView.$window.css('top')) + eventData.data.pagey + 34; this.oleEditorView.binding.drag({pageX:x, pageY:y}); } + } else + if (eventData.type == "frameToGeneralData") { + this.api && this.api.asc_getInformationBetweenFrameAndGeneralEditor(eventData.data); } else this.oleEditorView.fireEvent('internalmessage', this.oleEditorView, eventData); } @@ -244,6 +248,10 @@ define([ } }, + onSendFromGeneralToFrameEditor: function(data) { + externalEditor && externalEditor.serviceCommand('generalToFrameData', data); + }, + warningTitle: 'Warning', warningText: 'The object is disabled because of editing by another user.', textClose: 'Close', diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index e24801076..923a2bd05 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1434,8 +1434,11 @@ define([ var printController = app.getController('Print'); printController && this.api && printController.setApi(this.api).setMode(this.appOptions); - } else if (this.appOptions.isEditOle) - this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); + } else { + this.api.asc_registerCallback('asc_sendFromFrameToGeneralEditor', _.bind(this.onSendFromFrameToGeneralEditor, this)); + if (this.appOptions.isEditOle) + this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); + } var celleditorController = this.getApplication().getController('CellEditor'); celleditorController && celleditorController.setApi(this.api).setMode(this.appOptions); @@ -2598,6 +2601,9 @@ define([ document.documentElement.className.replace(/theme-\w+\s?/, data.data); this.api.asc_setSkin(data.data == "theme-dark" ? 'flatDark' : "flat"); break; + case 'generalToFrameData': + this.api.asc_getInformationBetweenFrameAndGeneralEditor(data.data); + break; } } }, @@ -2678,6 +2684,12 @@ define([ } }, + onSendFromFrameToGeneralEditor: function(data) { + Common.Gateway.internalMessage('frameToGeneralData', { + data: data + }); + }, + unitsChanged: function(m) { var value = Common.localStorage.getItem("sse-settings-unit"); value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();