From a298d8f28bf2a9addadb88377f9f259e003ca719 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 8 Sep 2020 15:48:05 +0300 Subject: [PATCH] [SSE] Fix Bug 46338 --- .../spreadsheeteditor/main/app/view/CellRangeDialog.js | 10 +++++++--- .../main/app/view/TableOptionsDialog.js | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js index de07e7116..8bc2fa066 100644 --- a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js @@ -111,10 +111,12 @@ define([ if (settings.api) { me.api = settings.api; + me.wrapEvents = { + onApiRangeChanged: _.bind(me.onApiRangeChanged, me) + }; me.api.asc_setSelectionDialogMode(settings.type, settings.range ? settings.range : ''); - me.api.asc_unregisterCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me)); - me.api.asc_registerCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me)); + me.api.asc_registerCallback('asc_onSelectionRangeChanged', me.wrapEvents.onApiRangeChanged); Common.NotificationCenter.trigger('cells:range', settings.type); } @@ -177,8 +179,10 @@ define([ }, onClose: function(event) { - if (this.api) + if (this.api) { this.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None); + this.api.asc_unregisterCallback('asc_onSelectionRangeChanged', this.wrapEvents.onApiRangeChanged); + } Common.NotificationCenter.trigger('cells:range', Asc.c_oAscSelectionDialogType.None); SSE.getController('RightMenu').SetDisabled(false); diff --git a/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js b/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js index 7bd19eb9f..72090c8b6 100644 --- a/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js @@ -133,8 +133,10 @@ define([ if (settings.selectionType) me.selectionType = settings.selectionType; - me.api.asc_unregisterCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me)); - me.api.asc_registerCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me)); + me.wrapEvents = { + onApiRangeChanged: _.bind(me.onApiRangeChanged, me) + }; + me.api.asc_registerCallback('asc_onSelectionRangeChanged', me.wrapEvents.onApiRangeChanged); Common.NotificationCenter.trigger('cells:range', Asc.c_oAscSelectionDialogType.FormatTable); } @@ -190,8 +192,10 @@ define([ }, onClose: function(event) { - if (this.api) + if (this.api) { this.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None); + this.api.asc_unregisterCallback('asc_onSelectionRangeChanged', this.wrapEvents.onApiRangeChanged); + } Common.NotificationCenter.trigger('cells:range', Asc.c_oAscSelectionDialogType.None); Common.NotificationCenter.trigger('edit:complete', this);