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

This commit is contained in:
Julia Radzhabova 2016-07-26 17:46:42 +03:00
parent c964e8a89d
commit 9297531dff
6 changed files with 26 additions and 66 deletions

View file

@ -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) {

View file

@ -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() {

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {