Commit 9297531d authored by Julia Radzhabova's avatar Julia Radzhabova

Update copy/cut/paste from toolbar and context menu.

parent c964e8a8
......@@ -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) {
......
......@@ -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() {
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment