diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 13255b9e1..b6ee10f33 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -873,29 +873,21 @@ define([ onCopyPaste: function(copy, e) { var me = this; if (me.api) { - if (typeof window['AscDesktopEditor'] === 'object') { // AscDesktopEditor object may exists in desktop version - copy ? me.api.Copy() : me.api.Paste(); -// window['AscDesktopEditor'][copy ? 'Copy' : 'Paste'](); // desktop editor's methods - } else { + var res = (copy) ? me.api.Copy() : me.api.Paste(); + if (!res) { var value = Common.localStorage.getItem("de-hide-copywarning"); if (!(value && parseInt(value) == 1)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { - copy ? me.api.Copy() : me.api.Paste(); if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1); Common.NotificationCenter.trigger('edit:complete', me.toolbar); } })).show(); - } else { - copy ? me.api.Copy() : me.api.Paste(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar); } - } - - Common.component.Analytics.trackEvent('ToolBar', 'Copy Warning'); - } else { - Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } else + Common.component.Analytics.trackEvent('ToolBar', 'Copy Warning'); } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); }, onIncrease: function(e) { diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 1ba435080..1dc58890b 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -1663,26 +1663,20 @@ define([ onCutCopyPaste: function(item, e) { var me = this; if (me.api) { - if (typeof window['AscDesktopEditor'] === 'object') { - (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); - } else { + var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); + if (!res) { var value = Common.localStorage.getItem("de-hide-copywarning"); if (!(value && parseInt(value) == 1)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { - (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1); me.fireEvent('editcomplete', me); } })).show(); - } else { - (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); - me.fireEvent('editcomplete', me); } - } - } else { - me.fireEvent('editcomplete', me); + } } + me.fireEvent('editcomplete', me); }, createDelayedElements: function() { diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 92962ebef..a7062bf86 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -879,29 +879,21 @@ define([ onCopyPaste: function(copy, e) { var me = this; if (me.api) { - if (typeof window['AscDesktopEditor'] === 'object') { - copy ? me.api.Copy() : me.api.Paste(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar); - } else { + var res = (copy) ? me.api.Copy() : me.api.Paste(); + if (!res) { var value = Common.localStorage.getItem("pe-hide-copywarning"); if (!(value && parseInt(value) == 1)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { - copy ? me.api.Copy() : me.api.Paste(); if (dontshow) Common.localStorage.setItem("pe-hide-copywarning", 1); Common.NotificationCenter.trigger('edit:complete', me.toolbar); } })).show(); - } else { - copy ? me.api.Copy() : me.api.Paste(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar); } - } - - Common.component.Analytics.trackEvent('ToolBar', 'Copy Warning'); - } else { - Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } else + Common.component.Analytics.trackEvent('ToolBar', 'Copy Warning'); } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); }, onBold: function(btn, e) { diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index 8fd721f57..b9c9fea48 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -834,26 +834,20 @@ define([ onCutCopyPaste: function(item, e) { var me = this; if (me.api) { - if (typeof window['AscDesktopEditor'] === 'object') { - (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); - } else { + var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); + if (!res) { var value = Common.localStorage.getItem("pe-hide-copywarning"); if (!(value && parseInt(value) == 1)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { - (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); if (dontshow) Common.localStorage.setItem("pe-hide-copywarning", 1); me.fireEvent('editcomplete', me); } })).show(); - } else { - (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); - me.fireEvent('editcomplete', me); } } - } else { - me.fireEvent('editcomplete', me); } + me.fireEvent('editcomplete', me); }, fullScreen: function(element) { diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 3c1b21899..db4dac223 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -265,25 +265,21 @@ define([ onCopyPaste: function(item) { var me = this; if (me.api) { - if (typeof window['AscDesktopEditor'] === 'object') { - (item.value == 'cut') ? me.api.asc_Cut() : ((item.value == 'copy') ? me.api.asc_Copy() : me.api.asc_Paste()); - } else { + var res = (item.value == 'cut') ? me.api.asc_Cut() : ((item.value == 'copy') ? me.api.asc_Copy() : me.api.asc_Paste()); + if (!res) { var value = Common.localStorage.getItem("sse-hide-copywarning"); if (!(value && parseInt(value) == 1)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { - (item.value == 'cut') ? me.api.asc_Cut() : ((item.value == 'copy') ? me.api.asc_Copy() : me.api.asc_Paste()); if (dontshow) Common.localStorage.setItem("sse-hide-copywarning", 1); Common.NotificationCenter.trigger('edit:complete', me.documentHolder); } })).show(); - } else { - (item.value == 'cut') ? me.api.asc_Cut() : ((item.value == 'copy') ? me.api.asc_Copy() : me.api.asc_Paste()); - Common.NotificationCenter.trigger('edit:complete', me.documentHolder); } + } else Common.component.Analytics.trackEvent('ToolBar', 'Copy Warning'); - } } + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); }, onInsertEntire: function(item) { diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 96ed9d121..71a88481b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -327,29 +327,21 @@ define([ onCopyPaste: function(copy, e) { var me = this; if (me.api) { - if (typeof window['AscDesktopEditor'] === 'object') { - copy ? me.api.asc_Copy() : me.api.asc_Paste(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar); - } else { + var res = (copy) ? me.api.asc_Copy() : me.api.asc_Paste(); + if (!res) { var value = Common.localStorage.getItem("sse-hide-copywarning"); if (!(value && parseInt(value) == 1)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { - copy ? me.api.asc_Copy() : me.api.asc_Paste(); if (dontshow) Common.localStorage.setItem("sse-hide-copywarning", 1); Common.NotificationCenter.trigger('edit:complete', me.toolbar); } })).show(); - } else { - copy ? me.api.asc_Copy() : me.api.asc_Paste(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar); } - } - - Common.component.Analytics.trackEvent('ToolBar', 'Copy Warning'); - } else { - Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } else + Common.component.Analytics.trackEvent('ToolBar', 'Copy Warning'); } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); }, onIncreaseFontSize: function(e) {