mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-23 20:20:30 +08:00
Merge pull request 'feature/paste-options-btn' (#1043) from feature/paste-options-btn into release/v9.4.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/web-apps/pulls/1043
This commit is contained in:
369
apps/common/main/lib/controller/PasteOptions.js
Normal file
369
apps/common/main/lib/controller/PasteOptions.js
Normal file
@ -0,0 +1,369 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2024
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* PasteOptions.js
|
||||
*
|
||||
* Created on 26.02.2026
|
||||
*
|
||||
*/
|
||||
define([
|
||||
'core',
|
||||
], function () {
|
||||
'use strict';
|
||||
Common.Controllers.PasteOptions = Backbone.Controller.extend(_.extend({
|
||||
models : [],
|
||||
collections : [
|
||||
],
|
||||
sdkViewName : '#id_main',
|
||||
initialize: function () {
|
||||
|
||||
this.addListeners({
|
||||
'Toolbar': {
|
||||
'paste:options': _.bind(this.onBtnPasteOptionsClick, this)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
setApi: function(api) {
|
||||
if (api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
|
||||
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
|
||||
this.api.asc_registerCallback('asc_onAddChartStylesPreview', _.bind(this.onAddChartStylesPreview, this));
|
||||
this.api.asc_registerCallback('asc_onUpdateChartStyles', _.bind(this._onUpdateChartStyles, this));
|
||||
this.api.asc_registerCallback('asc_onStartUpdateExternalReference', _.bind(this.onStartUpdateExternalReference, this));
|
||||
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
|
||||
Common.NotificationCenter.on('uitheme:changed', _.bind(this.onThemeChanged, this));
|
||||
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
setMode: function(mode) {
|
||||
this.appConfig = mode;
|
||||
return this;
|
||||
},
|
||||
|
||||
onBtnPasteOptionsClick: function (btn, api, isSSE) {
|
||||
this.api = api;
|
||||
this.btn = btn;
|
||||
this.isSSE = isSSE;
|
||||
var me = this;
|
||||
var menu = btn.menu;
|
||||
if (menu && menu.items && menu.items.length > 0) {
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
menu.removeItem(menu.items[i]);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
this.api.asc_getPasteOptions(function (options) {
|
||||
me.handlePasteOptions(options)
|
||||
});
|
||||
},
|
||||
|
||||
handlePasteOptions: function(options) {
|
||||
var me = this;
|
||||
|
||||
if (options === null) {
|
||||
var menu = me.btn.menu;
|
||||
|
||||
var mnu = new Common.UI.MenuItem({
|
||||
caption: 'Paste',
|
||||
disabled: true
|
||||
});
|
||||
|
||||
menu.addItem(mnu)
|
||||
menu.show();
|
||||
return
|
||||
}
|
||||
|
||||
var pasteItems = options.asc_getOptions(),
|
||||
isTable = !!options.asc_getContainTables();
|
||||
|
||||
if (!pasteItems) return;
|
||||
|
||||
me._arrSpecialPaste = [];
|
||||
if (!me.isSSE) {
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste] = me.textPaste;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting] = me.txtPasteSourceFormat;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = me.txtKeepTextOnly;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.insertAsNestedTable] = me.textNest;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.overwriteCells] = me.txtOverwriteCells;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceFormattingEmbedding] = me.txtSourceEmbed;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormattingEmbedding] = me.txtDestEmbed;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceFormattingLink] = me.txtSourceLink;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormattingLink] = me.txtDestLink;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture] = me.txtPastePicture;
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting] = me.txtPasteDestFormat;
|
||||
} else {
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste] = [me.txtPaste, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula] = [me.txtPasteFormulas, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat] = [me.txtPasteFormulaNumFormat, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting] = [me.txtPasteKeepSourceFormat, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders] = [me.txtPasteBorders, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth] = [me.txtPasteColWidths, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating] = [me.txtPasteMerge, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues] = [me.txtPasteValues, 1];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueNumberFormat] = [me.txtPasteValNumFormat, 1];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueAllFormating] = [me.txtPasteValFormat, 1];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating] = [me.txtPasteFormat, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.link] = [me.txtPasteLink, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.transpose] = [me.txtPasteTranspose, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture] = [me.txtPastePicture, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.linkedPicture] = [me.txtPasteLinkPicture, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting] = [me.txtPasteSourceFormat, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting] = [me.txtPasteDestFormat, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = [me.txtKeepTextOnly, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.useTextImport] = [me.txtUseTextImport, 3];
|
||||
}
|
||||
|
||||
me.initSpecialPasteEvents();
|
||||
|
||||
if (pasteItems.length>0) {
|
||||
var menu = me.btn.menu;
|
||||
|
||||
if (me.isSSE) {
|
||||
var groups = [];
|
||||
for (var i = 0; i < 3; i++) {
|
||||
groups[i] = [];
|
||||
}
|
||||
|
||||
var importText, pasteItem;
|
||||
}
|
||||
|
||||
_.each(pasteItems, function(menuItem, index) {
|
||||
if (me._arrSpecialPaste[menuItem]) {
|
||||
var mnu = new Common.UI.MenuItem({
|
||||
caption: !me.isSSE ? me._arrSpecialPaste[menuItem] + ' (' + me.hkSpecPaste[menuItem] + ')' :
|
||||
me._arrSpecialPaste[menuItem][0] + (me.hkSpecPaste[menuItem] ? ' (' + me.hkSpecPaste[menuItem] + ')' : ''),
|
||||
value: menuItem,
|
||||
checkable: true,
|
||||
toggleGroup : 'specialPasteGroup'
|
||||
}).on('click', _.bind(me.onSpecialPasteItemClick, me));
|
||||
|
||||
if (!me.isSSE) {
|
||||
menu.addItem(mnu);
|
||||
} else {
|
||||
if (menuItem == Asc.c_oSpecialPasteProps.paste) {
|
||||
pasteItem = mnu;
|
||||
} else if (menuItem == Asc.c_oSpecialPasteProps.useTextImport) {
|
||||
importText = mnu;
|
||||
} else {
|
||||
groups[me._arrSpecialPaste[menuItem][1]].push(mnu);
|
||||
}
|
||||
|
||||
me._arrSpecialPaste[menuItem][2] = mnu;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (me.isSSE) {
|
||||
var groupTitles = [me.txtFormula, me.txtValue, me.txtOther];
|
||||
|
||||
if (pasteItem) {
|
||||
menu.addItem(pasteItem);
|
||||
}
|
||||
|
||||
for (var i = 0; i < 3; i++) {
|
||||
if (groups[i].length > 0) {
|
||||
if (menu.items.length > 0) {
|
||||
menu.addItem(new Common.UI.MenuItem({ caption: '--' }));
|
||||
}
|
||||
menu.addItem(new Common.UI.MenuItem({
|
||||
header: groupTitles[i],
|
||||
disabled: true,
|
||||
cls: 'menu-header'
|
||||
}));
|
||||
_.each(groups[i], function (menuItem, index) {
|
||||
menu.addItem(menuItem);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (importText) {
|
||||
menu.addItem(new Common.UI.MenuItem({ caption: '--' }));
|
||||
menu.addItem(importText);
|
||||
}
|
||||
if (menu.items.length>0 && options.asc_getShowPasteSpecial()) {
|
||||
menu.addItem(new Common.UI.MenuItem({ caption: '--' }));
|
||||
var mnu = new Common.UI.MenuItem({
|
||||
caption: me.textPasteSpecial,
|
||||
value: 'special'
|
||||
}).on('click', function(item, e) {
|
||||
(new SSE.Views.SpecialPasteDialog({
|
||||
props: pasteItems,
|
||||
isTable: isTable,
|
||||
handler: function (result, settings) {
|
||||
if (result == 'ok') {
|
||||
if (me && me.api) {
|
||||
me.api.asc_SpecialPaste(settings, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
setTimeout(function(){menu.hide();}, 100);
|
||||
});
|
||||
menu.addItem(mnu);
|
||||
}
|
||||
}
|
||||
|
||||
menu.show();
|
||||
}
|
||||
},
|
||||
|
||||
initSpecialPasteEvents: function() {
|
||||
if (this.specialPasteEventsInited) return
|
||||
|
||||
var me = this;
|
||||
me.hkSpecPaste = [];
|
||||
|
||||
if (!me.isSSE) {
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.paste] = 'P';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.sourceformatting] = 'K';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = 'T';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.insertAsNestedTable] = 'N';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.overwriteCells] = 'O';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.destinationFormatting] = 'H';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.sourceFormattingEmbedding] = 'K';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.destinationFormattingEmbedding] = 'H';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.sourceFormattingLink] = 'F';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.destinationFormattingLink] = 'L';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.picture] = 'U';
|
||||
} else {
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.paste] = 'P';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula] = 'F';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat] = 'O';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting] = 'K';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders] = 'B';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth] = 'W';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating] = 'G';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.transpose] = 'T';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues] = 'V';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.valueNumberFormat] = 'A';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.valueAllFormating] = 'E';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating] = 'R';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.link] = 'N';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.picture] = 'U';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.linkedPicture] = 'I';
|
||||
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.sourceformatting] = 'K';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.destinationFormatting] = 'M';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = 'T';
|
||||
// me.hkSpecPaste[Asc.c_oSpecialPasteProps.useTextImport] = '';
|
||||
}
|
||||
|
||||
var str = '';
|
||||
for(var key in me.hkSpecPaste){
|
||||
if(me.hkSpecPaste.hasOwnProperty(key)){
|
||||
if (str.indexOf(me.hkSpecPaste[key])<0)
|
||||
str += me.hkSpecPaste[key] + ',';
|
||||
}
|
||||
}
|
||||
str = str.substring(0, str.length-1)
|
||||
var keymap = {};
|
||||
keymap[str + ' ' + 'special-paste-toolbar'] = _.bind(function(e) {
|
||||
var menu = this.btn.menu;
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
if (this.hkSpecPaste[menu.items[i].value] === String.fromCharCode(e.keyCode)) {
|
||||
return me.onSpecialPasteItemClick({value: menu.items[i].value});
|
||||
}
|
||||
}
|
||||
}, me);
|
||||
Common.util.Shortcuts.delegateShortcuts({shortcuts:keymap});
|
||||
window.key.setScope('special-paste-toolbar');
|
||||
|
||||
var closeMenuOnWindowBlur = function() {
|
||||
if (me.btn.menu.$el && me.btn.menu.$el.is(':visible')) {
|
||||
me.btn.menu.hide();
|
||||
}
|
||||
};
|
||||
$(window).on('blur.pastemenuhide', closeMenuOnWindowBlur);
|
||||
|
||||
me.btn.menu.on('show:after', function(menu) {
|
||||
window.key.setScope('special-paste-toolbar');
|
||||
Common.util.Shortcuts.resumeEvents(str);
|
||||
$(window).on('blur.pastemenuhide', closeMenuOnWindowBlur);
|
||||
}).on('hide:after', function(menu) {
|
||||
window.key.setScope('all');
|
||||
Common.util.Shortcuts.suspendEvents(str, undefined, true);
|
||||
$(window).off('blur.pastemenuhide', closeMenuOnWindowBlur);
|
||||
});
|
||||
|
||||
this.specialPasteEventsInited = true;
|
||||
},
|
||||
|
||||
onSpecialPasteItemClick: function(item, e) {
|
||||
var me = this;
|
||||
|
||||
if (this.api) {
|
||||
var menu = this.btn.menu;
|
||||
if (!this.isSSE) {
|
||||
this.api.asc_SpecialPaste(item.value, true);
|
||||
setTimeout(function(){
|
||||
menu.hide();
|
||||
}, 100);
|
||||
} else {
|
||||
if (item.value == Asc.c_oSpecialPasteProps.useTextImport) {
|
||||
(new Common.Views.OpenDialog({
|
||||
title: me.txtImportWizard,
|
||||
closable: true,
|
||||
type: Common.Utils.importTextType.Paste,
|
||||
preview: true,
|
||||
api: me.api,
|
||||
fromToolbar: true,
|
||||
handler: function (result, settings) {
|
||||
if (result == 'ok') {
|
||||
if (me && me.api) {
|
||||
var props = new Asc.SpecialPasteProps();
|
||||
props.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport);
|
||||
props.asc_setAdvancedOptions(settings.textOptions);
|
||||
me.api.asc_SpecialPaste(props, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
setTimeout(function(){menu.hide();}, 100);
|
||||
} else {
|
||||
var props = new Asc.SpecialPasteProps();
|
||||
props.asc_setProps(item.value);
|
||||
me.api.asc_SpecialPaste(props, true);
|
||||
setTimeout(function(){menu.hide();}, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
}, Common.Controllers.PasteOptions || {}));
|
||||
});
|
||||
@ -164,6 +164,7 @@ require([
|
||||
,'Common.Controllers.ReviewChanges'
|
||||
,'Common.Controllers.Protection'
|
||||
,'Common.Controllers.Shortcuts'
|
||||
,'Common.Controllers.PasteOptions'
|
||||
]
|
||||
});
|
||||
|
||||
@ -210,6 +211,7 @@ require([
|
||||
,'common/main/lib/controller/Protection'
|
||||
,'common/main/lib/controller/Shortcuts'
|
||||
,'common/main/lib/controller/Draw'
|
||||
,'common/main/lib/controller/PasteOptions'
|
||||
], function() {
|
||||
const code_path = !window.isIEBrowser ?
|
||||
'documenteditor/main/code' : 'documenteditor/main/ie/code';
|
||||
|
||||
@ -1424,7 +1424,25 @@ define([], function () {
|
||||
}).on('click', _.bind(me.onSpecialPasteItemClick, me));
|
||||
menu.addItem(mnu);
|
||||
});
|
||||
(menu.items.length>0) && menu.items[0].setChecked(true, true);
|
||||
var lastSelected = specialPasteShowOptions.asc_getLastSelectedPasteProperty();
|
||||
(menu.items.length>0) && !lastSelected && menu.items[0].setChecked(true, true);
|
||||
|
||||
if (lastSelected) {
|
||||
var foundItem = null;
|
||||
if (me.btnSpecialPaste && me.btnSpecialPaste.menu && me.btnSpecialPaste.menu.items.length > 0) {
|
||||
for (var i = 0; i < me.btnSpecialPaste.menu.items.length; i++) {
|
||||
var menuItem = me.btnSpecialPaste.menu.items[i];
|
||||
if (menuItem.value === lastSelected) {
|
||||
foundItem = menuItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundItem) {
|
||||
foundItem.setChecked(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var showPoint = [coord.asc_getX() + coord.asc_getWidth() + 3, coord.asc_getY() + coord.asc_getHeight() + 3];
|
||||
@ -1492,7 +1510,7 @@ define([], function () {
|
||||
}
|
||||
str = str.substring(0, str.length-1)
|
||||
var keymap = {};
|
||||
keymap[str] = _.bind(function(e) {
|
||||
keymap[str + ' ' + 'special-paste-context'] = _.bind(function(e) {
|
||||
var menu = this.btnSpecialPaste.menu;
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
if (this.hkSpecPaste[menu.items[i].value] === String.fromCharCode(e.keyCode)) {
|
||||
@ -1501,12 +1519,14 @@ define([], function () {
|
||||
}
|
||||
}, me);
|
||||
Common.util.Shortcuts.delegateShortcuts({shortcuts:keymap});
|
||||
Common.util.Shortcuts.suspendEvents(str, undefined, true);
|
||||
Common.util.Shortcuts.suspendEvents(str, 'special-paste-context', true);
|
||||
|
||||
me.btnSpecialPaste.menu.on('show:after', function(menu) {
|
||||
Common.util.Shortcuts.resumeEvents(str);
|
||||
window.key.setScope('special-paste-context');
|
||||
Common.util.Shortcuts.resumeEvents(str, 'special-paste-context');
|
||||
}).on('hide:after', function(menu) {
|
||||
Common.util.Shortcuts.suspendEvents(str, undefined, true);
|
||||
window.key.setScope('all');
|
||||
Common.util.Shortcuts.suspendEvents(str, 'special-paste-context', true);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -335,6 +335,19 @@ define([
|
||||
toolbar.btnRedo.on('disabled', _.bind(this.onBtnChangeState, this, 'redo:disabled'));
|
||||
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, 'copy'));
|
||||
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, 'paste'));
|
||||
$('#slot-btn-paste').on('click', '.dropdown-toggle', _.bind(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
var menu = this.toolbar.btnPaste.menu;
|
||||
|
||||
if (menu && menu.isVisible && menu.isVisible()) {
|
||||
menu.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
this.toolbar.fireEvent('paste:options', [toolbar.btnPaste, this.api]);
|
||||
}, this));
|
||||
toolbar.btnCut.on('click', _.bind(this.onCopyPaste, this, 'cut'));
|
||||
toolbar.btnSelectAll.on('click', _.bind(this.onSelectAll, this));
|
||||
toolbar.btnReplace.on('click', _.bind(this.onReplace, this));
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<div class="group small">
|
||||
<div class="elset">
|
||||
<span class="btn-slot split" id="slot-btn-copy"></span>
|
||||
<span class="btn-slot" id="slot-btn-paste"></span>
|
||||
<span class="btn-slot split" id="slot-btn-paste"></span>
|
||||
</div>
|
||||
<div class="elset">
|
||||
<span class="btn-slot split" id="slot-btn-undo"></span>
|
||||
|
||||
@ -170,6 +170,7 @@ define([
|
||||
applyLayout: function (config) {
|
||||
var me = this;
|
||||
me.lockControls = [];
|
||||
me.config = config;
|
||||
var _set = Common.enumLock;
|
||||
if ( config.isEdit ) {
|
||||
Common.UI.Mixtbar.prototype.initialize.call(this, {
|
||||
@ -279,6 +280,8 @@ define([
|
||||
iconCls: 'toolbar__icon btn-paste',
|
||||
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockViewIns, _set.docLockCommentsIns, _set.viewMode],
|
||||
dataHint: '1',
|
||||
menu: config.isDesktopApp ? new Common.UI.Menu({items: []}) : false,
|
||||
split: config.isDesktopApp,
|
||||
dataHintDirection: 'top',
|
||||
dataHintTitle: 'V'
|
||||
});
|
||||
@ -2232,6 +2235,10 @@ define([
|
||||
_injectComponent('#slot-lbl-space-after', this.lblSpacingAfter);
|
||||
_injectComponent('#slot-btn-pagecolor', this.btnPageColor);
|
||||
|
||||
if (!this.config || !this.config.isDesktopApp) {
|
||||
$host.find('#slot-btn-paste').removeClass('split');
|
||||
}
|
||||
|
||||
this.btnsPageBreak = Common.Utils.injectButtons($host.find('.btn-slot.btn-pagebreak'), '', 'toolbar__icon btn-pagebreak', this.capBtnInsPagebreak,
|
||||
[Common.enumLock.paragraphLock, Common.enumLock.headerLock, Common.enumLock.richEditLock, Common.enumLock.plainEditLock, Common.enumLock.inEquation, Common.enumLock.richDelLock,
|
||||
Common.enumLock.plainDelLock, Common.enumLock.inHeader, Common.enumLock.inFootnote, Common.enumLock.cantPageBreak, Common.enumLock.previewReviewMode,
|
||||
|
||||
@ -154,6 +154,7 @@ require([
|
||||
,'Common.Controllers.ReviewChanges'
|
||||
,'Common.Controllers.Protection'
|
||||
,'Common.Controllers.Shortcuts'
|
||||
,'Common.Controllers.PasteOptions'
|
||||
]
|
||||
});
|
||||
|
||||
@ -200,6 +201,7 @@ require([
|
||||
,'common/main/lib/controller/Protection'
|
||||
,'common/main/lib/controller/Shortcuts'
|
||||
,'common/main/lib/controller/Draw'
|
||||
,'common/main/lib/controller/PasteOptions'
|
||||
], function() {
|
||||
app.postLaunchScripts = [
|
||||
'common/main/lib/controller/ScreenReaderFocus',
|
||||
|
||||
@ -394,6 +394,16 @@
|
||||
"Common.Controllers.Shortcuts.txtLabelZoom100": "Zoom100",
|
||||
"Common.Controllers.Shortcuts.txtLabelZoomIn": "ZoomIn",
|
||||
"Common.Controllers.Shortcuts.txtLabelZoomOut": "ZoomOut",
|
||||
"Common.Controllers.PasteOptions.textPaste": "Paste",
|
||||
"Common.Controllers.PasteOptions.txtPasteSourceFormat": "Keep source formatting",
|
||||
"Common.Controllers.PasteOptions.txtKeepTextOnly": "Keep text only",
|
||||
"Common.Controllers.PasteOptions.textNest": "Nest table",
|
||||
"Common.Controllers.PasteOptions.txtOverwriteCells": "Overwrite cells",
|
||||
"Common.Controllers.PasteOptions.txtSourceEmbed": "Keep source formatting & Embed workbook",
|
||||
"Common.Controllers.PasteOptions.txtDestEmbed": "Use destination theme & Embed workbook",
|
||||
"Common.Controllers.PasteOptions.txtSourceLink": "Keep source formatting & Link data",
|
||||
"Common.Controllers.PasteOptions.txtDestLink": "Use destination theme & Link data",
|
||||
"Common.Controllers.PasteOptions.txtPastePicture": "Picture",
|
||||
"Common.define.chartData.textArea": "Area",
|
||||
"Common.define.chartData.textAreaStacked": "Stacked area",
|
||||
"Common.define.chartData.textAreaStackedPer": "100% Stacked area",
|
||||
|
||||
@ -157,6 +157,7 @@ require([
|
||||
,'Common.Controllers.ReviewChanges'
|
||||
,'Common.Controllers.Protection'
|
||||
,'Common.Controllers.Shortcuts'
|
||||
,'Common.Controllers.PasteOptions'
|
||||
,'Transitions'
|
||||
,'Animation'
|
||||
]
|
||||
@ -206,6 +207,7 @@ require([
|
||||
,'common/main/lib/controller/Protection'
|
||||
,'common/main/lib/controller/Shortcuts'
|
||||
,'common/main/lib/controller/Draw'
|
||||
,'common/main/lib/controller/PasteOptions'
|
||||
,'presentationeditor/main/app/controller/Transitions'
|
||||
,'presentationeditor/main/app/controller/Animation'
|
||||
], function() {
|
||||
|
||||
@ -1366,7 +1366,25 @@ define([], function () {
|
||||
}).on('click', _.bind(me.onSpecialPasteItemClick, me));
|
||||
menu.addItem(mnu);
|
||||
});
|
||||
(menu.items.length>0) && menu.items[0].setChecked(true, true);
|
||||
var lastSelected = specialPasteShowOptions.asc_getLastSelectedPasteProperty();
|
||||
(menu.items.length>0) && !lastSelected && menu.items[0].setChecked(true, true);
|
||||
|
||||
if (lastSelected) {
|
||||
var foundItem = null;
|
||||
if (me.btnSpecialPaste && me.btnSpecialPaste.menu && me.btnSpecialPaste.menu.items.length > 0) {
|
||||
for (var i = 0; i < me.btnSpecialPaste.menu.items.length; i++) {
|
||||
var menuItem = me.btnSpecialPaste.menu.items[i];
|
||||
if (menuItem.value === lastSelected) {
|
||||
foundItem = menuItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundItem) {
|
||||
foundItem.setChecked(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (coord.asc_getX()<0 || coord.asc_getY()<0) {
|
||||
if (pasteContainer.is(':visible')) pasteContainer.hide();
|
||||
@ -1438,7 +1456,7 @@ define([], function () {
|
||||
}
|
||||
str = str.substring(0, str.length-1)
|
||||
var keymap = {};
|
||||
keymap[str] = _.bind(function(e) {
|
||||
keymap[str + ' ' + 'special-paste-context'] = _.bind(function(e) {
|
||||
var menu = this.btnSpecialPaste.menu;
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
if (this.hkSpecPaste[menu.items[i].value] === String.fromCharCode(e.keyCode)) {
|
||||
@ -1447,12 +1465,14 @@ define([], function () {
|
||||
}
|
||||
}, me);
|
||||
Common.util.Shortcuts.delegateShortcuts({shortcuts:keymap});
|
||||
Common.util.Shortcuts.suspendEvents(str, undefined, true);
|
||||
Common.util.Shortcuts.suspendEvents(str, 'special-paste-context', true);
|
||||
|
||||
me.btnSpecialPaste.menu.on('show:after', function(menu) {
|
||||
Common.util.Shortcuts.resumeEvents(str);
|
||||
window.key.setScope('special-paste-context');
|
||||
Common.util.Shortcuts.resumeEvents(str, 'special-paste-context');
|
||||
}).on('hide:after', function(menu) {
|
||||
Common.util.Shortcuts.suspendEvents(str, undefined, true);
|
||||
window.key.setScope('all');
|
||||
Common.util.Shortcuts.suspendEvents(str, 'special-paste-context', true);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -340,6 +340,19 @@ define([
|
||||
toolbar.btnRedo.on('disabled', _.bind(this.onBtnChangeState, this, 'redo:disabled'));
|
||||
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, 'copy'));
|
||||
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, 'paste'));
|
||||
$('#slot-btn-paste').on('click', '.dropdown-toggle', _.bind(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
var menu = this.toolbar.btnPaste.menu;
|
||||
|
||||
if (menu && menu.isVisible && menu.isVisible()) {
|
||||
menu.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
this.toolbar.fireEvent('paste:options', [toolbar.btnPaste, this.api]);
|
||||
}, this));
|
||||
toolbar.btnCut.on('click', _.bind(this.onCopyPaste, this, 'cut'));
|
||||
toolbar.btnSelectAll.on('click', _.bind(this.onSelectAll, this));
|
||||
toolbar.btnReplace.on('click', _.bind(this.onReplace, this));
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<div class="group small">
|
||||
<div class="elset">
|
||||
<span class="btn-slot split" id="slot-btn-copy"></span>
|
||||
<span class="btn-slot" id="slot-btn-paste"></span>
|
||||
<span class="btn-slot split" id="slot-btn-paste"></span>
|
||||
</div>
|
||||
<div class="elset">
|
||||
<span class="btn-slot split" id="slot-btn-undo"></span>
|
||||
|
||||
@ -145,6 +145,7 @@ define([
|
||||
|
||||
applyLayout: function (config) {
|
||||
var me = this;
|
||||
me.config = config;
|
||||
me.lockControls = [];
|
||||
me.nolockControls = [];
|
||||
if ( config.isEdit ) {
|
||||
@ -263,6 +264,8 @@ define([
|
||||
cls: 'btn-toolbar',
|
||||
iconCls: 'toolbar__icon btn-paste',
|
||||
lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides],
|
||||
menu: config.isDesktopApp ? new Common.UI.Menu({items: []}) : false,
|
||||
split: config.isDesktopApp,
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'top',
|
||||
dataHintTitle: 'V'
|
||||
@ -1566,6 +1569,10 @@ define([
|
||||
_injectComponent('#slot-btn-datetime', this.btnInsDateTime);
|
||||
_injectComponent('#slot-btn-slidenum', this.btnInsSlideNum);
|
||||
|
||||
if (!this.config || !this.config.isDesktopApp) {
|
||||
$host.find('#slot-btn-paste').removeClass('split');
|
||||
}
|
||||
|
||||
this.cmbsInsertShape = [];
|
||||
$host.find('.slot-combo-insertshape').each(function (index, el) {
|
||||
var cmb = new Common.UI.ComboDataViewShape({
|
||||
|
||||
@ -148,6 +148,7 @@ require([
|
||||
,'Common.Controllers.ReviewChanges'
|
||||
,'Common.Controllers.Protection'
|
||||
,'Common.Controllers.Shortcuts'
|
||||
,'Common.Controllers.PasteOptions'
|
||||
,'Transitions'
|
||||
,'Animation'
|
||||
]
|
||||
@ -196,6 +197,7 @@ require([
|
||||
,'common/main/lib/controller/ReviewChanges'
|
||||
,'common/main/lib/controller/Protection'
|
||||
,'common/main/lib/controller/Shortcuts'
|
||||
,'common/main/lib/controller/PasteOptions'
|
||||
,'common/main/lib/controller/Draw'
|
||||
,'presentationeditor/main/app/controller/Transitions'
|
||||
,'presentationeditor/main/app/controller/Animation'
|
||||
|
||||
@ -283,6 +283,15 @@
|
||||
"Common.Controllers.Shortcuts.txtLabelZoom100": "Zoom100",
|
||||
"Common.Controllers.Shortcuts.txtLabelZoomIn": "ZoomIn",
|
||||
"Common.Controllers.Shortcuts.txtLabelZoomOut": "ZoomOut",
|
||||
"Common.Controllers.PasteOptions.textPaste": "Paste",
|
||||
"Common.Controllers.PasteOptions.txtPasteSourceFormat": "Keep source formatting",
|
||||
"Common.Controllers.PasteOptions.txtKeepTextOnly": "Keep text only",
|
||||
"Common.Controllers.PasteOptions.txtSourceEmbed": "Keep source formatting & Embed workbook",
|
||||
"Common.Controllers.PasteOptions.txtDestEmbed": "Use destination theme & Embed workbook",
|
||||
"Common.Controllers.PasteOptions.txtSourceLink": "Keep source formatting & Link data",
|
||||
"Common.Controllers.PasteOptions.txtDestLink": "Use destination theme & Link data",
|
||||
"Common.Controllers.PasteOptions.txtPastePicture": "Picture",
|
||||
"Common.Controllers.PasteOptions.txtPasteDestFormat": "Use destination theme",
|
||||
"Common.define.chartData.textArea": "Area",
|
||||
"Common.define.chartData.textAreaStacked": "Stacked area",
|
||||
"Common.define.chartData.textAreaStackedPer": "100% Stacked area",
|
||||
|
||||
@ -161,6 +161,7 @@ require([
|
||||
,'Common.Controllers.ReviewChanges'
|
||||
,'Common.Controllers.Protection'
|
||||
,'Common.Controllers.Shortcuts'
|
||||
,'Common.Controllers.PasteOptions'
|
||||
]
|
||||
});
|
||||
|
||||
@ -210,6 +211,7 @@ require([
|
||||
,'common/main/lib/controller/Protection'
|
||||
,'common/main/lib/controller/Shortcuts'
|
||||
,'common/main/lib/controller/Draw'
|
||||
,'common/main/lib/controller/PasteOptions'
|
||||
], function() {
|
||||
const code_path = !window.isIEBrowser ? 'spreadsheeteditor/main/code' : 'spreadsheeteditor/main/ie/code';
|
||||
app.postLaunchScripts = [
|
||||
|
||||
@ -500,9 +500,8 @@ define([
|
||||
return;
|
||||
}
|
||||
|
||||
this.onBtnPasteOptionsClick();
|
||||
this.toolbar.fireEvent('paste:options', [toolbar.btnPaste, this.api, true]);
|
||||
}, this));
|
||||
// toolbar.btnPaste.menu && toolbar.btnPaste.menu.on('show:before', _.bind(this.onBtnPasteOptionsClick, this));
|
||||
toolbar.btnPageOrient.menu.on('item:click', _.bind(this.onPageOrientSelect, this));
|
||||
toolbar.btnPageMargins.menu.on('item:click', _.bind(this.onPageMarginsSelect, this));
|
||||
toolbar.mnuPageSize.on('item:click', _.bind(this.onPageSizeClick, this));
|
||||
@ -1071,243 +1070,6 @@ define([
|
||||
Common.component.Analytics.trackEvent('ToolBar', 'Table');
|
||||
},
|
||||
|
||||
onBtnPasteOptionsClick: function (btn, e) {
|
||||
var me = this;
|
||||
var menu = me.toolbar.btnPaste.menu;
|
||||
if (menu && menu.items && menu.items.length > 0) {
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
menu.removeItem(menu.items[i]);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
this.api.asc_getPasteOptions(function (options) {
|
||||
me.handlePasteOptions(options)
|
||||
});
|
||||
},
|
||||
|
||||
handlePasteOptions: function (options) {
|
||||
var me = this;
|
||||
|
||||
if (options === null) {
|
||||
var menu = me.toolbar.btnPaste.menu;
|
||||
|
||||
var mnu = new Common.UI.MenuItem({
|
||||
caption: me.txtPasteNoOptions,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
menu.addItem(mnu)
|
||||
menu.show();
|
||||
return
|
||||
}
|
||||
|
||||
var pasteItems = options.asc_getOptions(),
|
||||
isTable = !!options.asc_getContainTables();
|
||||
if (!pasteItems) return;
|
||||
|
||||
me._arrSpecialPaste = [];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste] = [me.txtPaste, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula] = [me.txtPasteFormulas, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat] = [me.txtPasteFormulaNumFormat, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting] = [me.txtPasteKeepSourceFormat, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders] = [me.txtPasteBorders, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth] = [me.txtPasteColWidths, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating] = [me.txtPasteMerge, 0];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues] = [me.txtPasteValues, 1];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueNumberFormat] = [me.txtPasteValNumFormat, 1];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueAllFormating] = [me.txtPasteValFormat, 1];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating] = [me.txtPasteFormat, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.link] = [me.txtPasteLink, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.transpose] = [me.txtPasteTranspose, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture] = [me.txtPastePicture, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.linkedPicture] = [me.txtPasteLinkPicture, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting] = [me.txtPasteSourceFormat, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting] = [me.txtPasteDestFormat, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = [me.txtKeepTextOnly, 2];
|
||||
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.useTextImport] = [me.txtUseTextImport, 3];
|
||||
|
||||
me.initSpecialPasteEvents();
|
||||
|
||||
if (pasteItems.length>0) {
|
||||
var menu = me.toolbar.btnPaste.menu;
|
||||
|
||||
var groups = [];
|
||||
for (var i = 0; i < 3; i++) {
|
||||
groups[i] = [];
|
||||
}
|
||||
|
||||
var importText, pasteItem;
|
||||
|
||||
_.each(pasteItems, function(menuItem, index) {
|
||||
if (me._arrSpecialPaste[menuItem]) {
|
||||
var mnu = new Common.UI.MenuItem({
|
||||
caption: me._arrSpecialPaste[menuItem][0] + (me.hkSpecPaste[menuItem] ? ' (' + me.hkSpecPaste[menuItem] + ')' : ''),
|
||||
value: menuItem,
|
||||
checkable: true,
|
||||
toggleGroup: 'specialPasteGroup'
|
||||
}).on('click', _.bind(me.onSpecialPasteItemClick, me));
|
||||
|
||||
if (menuItem == Asc.c_oSpecialPasteProps.paste) {
|
||||
pasteItem = mnu;
|
||||
} else if (menuItem == Asc.c_oSpecialPasteProps.useTextImport) {
|
||||
importText = mnu;
|
||||
} else {
|
||||
groups[me._arrSpecialPaste[menuItem][1]].push(mnu);
|
||||
}
|
||||
|
||||
me._arrSpecialPaste[menuItem][2] = mnu;
|
||||
}
|
||||
});
|
||||
var groupTitles = [me.txtFormula, me.txtValue, me.txtOther];
|
||||
|
||||
if (pasteItem) {
|
||||
menu.addItem(pasteItem);
|
||||
}
|
||||
|
||||
for (var i = 0; i < 3; i++) {
|
||||
if (groups[i].length > 0) {
|
||||
if (menu.items.length > 0) {
|
||||
menu.addItem(new Common.UI.MenuItem({ caption: '--' }));
|
||||
}
|
||||
menu.addItem(new Common.UI.MenuItem({
|
||||
header: groupTitles[i],
|
||||
disabled: true,
|
||||
cls: 'menu-header'
|
||||
}));
|
||||
_.each(groups[i], function (menuItem, index) {
|
||||
menu.addItem(menuItem);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (importText) {
|
||||
menu.addItem(new Common.UI.MenuItem({ caption: '--' }));
|
||||
menu.addItem(importText);
|
||||
}
|
||||
if (menu.items.length>0 && options.asc_getShowPasteSpecial()) {
|
||||
menu.addItem(new Common.UI.MenuItem({ caption: '--' }));
|
||||
var mnu = new Common.UI.MenuItem({
|
||||
caption: me.textPasteSpecial,
|
||||
value: 'special'
|
||||
}).on('click', function(item, e) {
|
||||
(new SSE.Views.SpecialPasteDialog({
|
||||
props: pasteItems,
|
||||
isTable: isTable,
|
||||
handler: function (result, settings) {
|
||||
if (result == 'ok') {
|
||||
if (me && me.api) {
|
||||
me.api.asc_SpecialPaste(settings, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
setTimeout(function(){menu.hide();}, 100);
|
||||
});
|
||||
menu.addItem(mnu);
|
||||
}
|
||||
menu.show();
|
||||
}
|
||||
},
|
||||
|
||||
onSpecialPasteItemClick: function (item, e) {
|
||||
var me = this,
|
||||
menu = this.toolbar.btnPaste.menu;
|
||||
if (item.value == Asc.c_oSpecialPasteProps.useTextImport) {
|
||||
(new Common.Views.OpenDialog({
|
||||
title: me.txtImportWizard,
|
||||
closable: true,
|
||||
type: Common.Utils.importTextType.Paste,
|
||||
preview: true,
|
||||
api: me.api,
|
||||
fromToolbar: true,
|
||||
handler: function (result, settings) {
|
||||
if (result == 'ok') {
|
||||
if (me && me.api) {
|
||||
var props = new Asc.SpecialPasteProps();
|
||||
props.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport);
|
||||
props.asc_setAdvancedOptions(settings.textOptions);
|
||||
me.api.asc_SpecialPaste(props, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
setTimeout(function(){menu.hide();}, 100);
|
||||
} else {
|
||||
var props = new Asc.SpecialPasteProps();
|
||||
props.asc_setProps(item.value);
|
||||
me.api.asc_SpecialPaste(props, true);
|
||||
setTimeout(function(){menu.hide();}, 100);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
initSpecialPasteEvents: function() {
|
||||
if (this.specialPasteEventsInited) return
|
||||
|
||||
var me = this;
|
||||
|
||||
me.hkSpecPaste = [];
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.paste] = 'P';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula] = 'F';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat] = 'O';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting] = 'K';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders] = 'B';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth] = 'W';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating] = 'G';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.transpose] = 'T';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues] = 'V';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.valueNumberFormat] = 'A';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.valueAllFormating] = 'E';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating] = 'R';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.link] = 'N';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.picture] = 'U';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.linkedPicture] = 'I';
|
||||
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.sourceformatting] = 'K';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.destinationFormatting] = 'M';
|
||||
me.hkSpecPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = 'T';
|
||||
// me.hkSpecPaste[Asc.c_oSpecialPasteProps.useTextImport] = '';
|
||||
|
||||
var str = '';
|
||||
for(var key in me.hkSpecPaste){
|
||||
if(me.hkSpecPaste.hasOwnProperty(key)){
|
||||
if (str.indexOf(me.hkSpecPaste[key])<0)
|
||||
str += me.hkSpecPaste[key] + ',';
|
||||
}
|
||||
}
|
||||
str = str.substring(0, str.length-1)
|
||||
var keymap = {};
|
||||
keymap[str + ' ' + 'special-paste-toolbar'] = _.bind(function(e) {
|
||||
var menu = this.toolbar.btnPaste.menu;
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
if (this.hkSpecPaste[menu.items[i].value] === String.fromCharCode(e.keyCode)) {
|
||||
return me.onSpecialPasteItemClick({value: menu.items[i].value});
|
||||
}
|
||||
}
|
||||
}, me);
|
||||
Common.util.Shortcuts.delegateShortcuts({shortcuts:keymap});
|
||||
window.key.setScope('special-paste-toolbar');
|
||||
|
||||
var closeMenuOnWindowBlur = function() {
|
||||
if (me.toolbar.btnPaste.menu.$el && me.toolbar.btnPaste.menu.$el.is(':visible')) {
|
||||
me.toolbar.btnPaste.menu.hide();
|
||||
}
|
||||
};
|
||||
$(window).on('blur.pastemenuhide', closeMenuOnWindowBlur);
|
||||
|
||||
me.toolbar.btnPaste.menu.on('show:after', function(menu) {
|
||||
window.key.setScope('special-paste-toolbar');
|
||||
Common.util.Shortcuts.resumeEvents(str);
|
||||
$(window).on('blur.pastemenuhide', closeMenuOnWindowBlur);
|
||||
}).on('hide:after', function(menu) {
|
||||
window.key.setScope('all');
|
||||
Common.util.Shortcuts.suspendEvents(str, undefined, true);
|
||||
$(window).off('blur.pastemenuhide', closeMenuOnWindowBlur);
|
||||
});
|
||||
this.specialPasteEventsInited = true;
|
||||
},
|
||||
|
||||
onInsertImageMenu: function(menu, item, e) {
|
||||
var me = this;
|
||||
if (item.value === 'file') {
|
||||
|
||||
@ -151,6 +151,7 @@ require([
|
||||
,'Common.Controllers.ReviewChanges'
|
||||
,'Common.Controllers.Protection'
|
||||
,'Common.Controllers.Shortcuts'
|
||||
,'Common.Controllers.PasteOptions'
|
||||
]
|
||||
});
|
||||
|
||||
@ -201,6 +202,7 @@ require([
|
||||
,'common/main/lib/controller/Protection'
|
||||
,'common/main/lib/controller/Shortcuts'
|
||||
,'common/main/lib/controller/Draw'
|
||||
,'common/main/lib/controller/PasteOptions'
|
||||
], function() {
|
||||
app.postLaunchScripts = [
|
||||
'common/main/lib/controller/ScreenReaderFocus',
|
||||
|
||||
@ -375,6 +375,31 @@
|
||||
"Common.Controllers.Shortcuts.txtLabelZoom100": "Zoom100",
|
||||
"Common.Controllers.Shortcuts.txtLabelZoomIn": "ZoomIn",
|
||||
"Common.Controllers.Shortcuts.txtLabelZoomOut": "ZoomOut",
|
||||
"Common.Controllers.PasteOptions.txtOther": "Other",
|
||||
"Common.Controllers.PasteOptions.txtPaste": "Paste",
|
||||
"Common.Controllers.PasteOptions.txtPasteBorders": "Formula without borders",
|
||||
"Common.Controllers.PasteOptions.txtPasteColWidths": "Formula + column width",
|
||||
"Common.Controllers.PasteOptions.txtPasteDestFormat": "Destination formatting",
|
||||
"Common.Controllers.PasteOptions.txtPasteFormat": "Paste only formatting",
|
||||
"Common.Controllers.PasteOptions.txtPasteFormulaNumFormat": "Formula + number format",
|
||||
"Common.Controllers.PasteOptions.txtPasteFormulas": "Paste only formula",
|
||||
"Common.Controllers.PasteOptions.txtPasteKeepSourceFormat": "Formula + all formatting",
|
||||
"Common.Controllers.PasteOptions.txtPasteLink": "Paste link",
|
||||
"Common.Controllers.PasteOptions.txtPasteLinkPicture": "Linked picture",
|
||||
"Common.Controllers.PasteOptions.txtPasteMerge": "Merge conditional formatting",
|
||||
"Common.Controllers.PasteOptions.txtPasteNoOptions": "Paste (P)",
|
||||
"Common.Controllers.PasteOptions.txtPastePicture": "Picture",
|
||||
"Common.Controllers.PasteOptions.txtPasteSourceFormat": "Source formatting",
|
||||
"Common.Controllers.PasteOptions.txtPasteTranspose": "Transpose",
|
||||
"Common.Controllers.PasteOptions.txtPasteValFormat": "Value + all formatting",
|
||||
"Common.Controllers.PasteOptions.txtPasteValNumFormat": "Value + number format",
|
||||
"Common.Controllers.PasteOptions.txtPasteValues": "Paste only value",
|
||||
"Common.Controllers.PasteOptions.txtKeepTextOnly": "Keep text only",
|
||||
"Common.Controllers.PasteOptions.txtUseTextImport": "Use text import",
|
||||
"Common.Controllers.PasteOptions.txtFormula": "Formula",
|
||||
"Common.Controllers.PasteOptions.txtValue": "Value",
|
||||
"Common.Controllers.PasteOptions.textPasteSpecial": "Paste special",
|
||||
"Common.Controllers.PasteOptions.txtImportWizard": "Text Import",
|
||||
"Common.define.chartData.textArea": "Area",
|
||||
"Common.define.chartData.textAreaStacked": "Stacked area",
|
||||
"Common.define.chartData.textAreaStackedPer": "100% Stacked area",
|
||||
@ -2103,7 +2128,7 @@
|
||||
"SSE.Controllers.Toolbar.textLongOperation": "Long operation",
|
||||
"SSE.Controllers.Toolbar.textMatrix": "Matrices",
|
||||
"SSE.Controllers.Toolbar.textOperator": "Operators",
|
||||
"SSE.Controllers.Toolbar.textPasteSpecial": "Paste special",
|
||||
"del_SSE.Controllers.Toolbar.textPasteSpecial": "Paste special",
|
||||
"SSE.Controllers.Toolbar.textPivot": "Pivot Table",
|
||||
"SSE.Controllers.Toolbar.textRadical": "Radicals",
|
||||
"SSE.Controllers.Toolbar.textRating": "Ratings",
|
||||
@ -2183,7 +2208,7 @@
|
||||
"SSE.Controllers.Toolbar.txtDeleteCells": "Delete cells",
|
||||
"SSE.Controllers.Toolbar.txtExpand": "Expand and sort",
|
||||
"SSE.Controllers.Toolbar.txtExpandSort": "The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?",
|
||||
"SSE.Controllers.Toolbar.txtFormula": "Formula",
|
||||
"del_SSE.Controllers.Toolbar.txtFormula": "Formula",
|
||||
"SSE.Controllers.Toolbar.txtFractionDiagonal": "Skewed fraction",
|
||||
"SSE.Controllers.Toolbar.txtFractionDifferential_1": "dx over dy",
|
||||
"SSE.Controllers.Toolbar.txtFractionDifferential_2": "cap delta y over cap delta x",
|
||||
@ -2231,7 +2256,7 @@
|
||||
"SSE.Controllers.Toolbar.txtGroupTable_Dark": "Dark",
|
||||
"SSE.Controllers.Toolbar.txtGroupTable_Light": "Light",
|
||||
"SSE.Controllers.Toolbar.txtGroupTable_Medium": "Medium",
|
||||
"SSE.Controllers.Toolbar.txtImportWizard": "Text Import",
|
||||
"del_SSE.Controllers.Toolbar.txtImportWizard": "Text Import",
|
||||
"SSE.Controllers.Toolbar.txtInsertCells": "Insert cells",
|
||||
"SSE.Controllers.Toolbar.txtIntegral": "Integral",
|
||||
"SSE.Controllers.Toolbar.txtIntegral_dtheta": "Differential theta",
|
||||
@ -2255,7 +2280,7 @@
|
||||
"SSE.Controllers.Toolbar.txtIntegralTripleCenterSubSup": "Triple integral with stacked limits",
|
||||
"SSE.Controllers.Toolbar.txtIntegralTripleSubSup": "Triple integral with limits",
|
||||
"SSE.Controllers.Toolbar.txtInvalidRange": "ERROR! Invalid cell range",
|
||||
"SSE.Controllers.Toolbar.txtKeepTextOnly": "Keep text only",
|
||||
"del_SSE.Controllers.Toolbar.txtKeepTextOnly": "Keep text only",
|
||||
"SSE.Controllers.Toolbar.txtLargeOperator_Conjunction": "Logical And",
|
||||
"SSE.Controllers.Toolbar.txtLargeOperator_Conjunction_CenterSub": "Logical And with lower limit",
|
||||
"SSE.Controllers.Toolbar.txtLargeOperator_Conjunction_CenterSubSup": "Logical And with limits",
|
||||
@ -2348,25 +2373,25 @@
|
||||
"SSE.Controllers.Toolbar.txtOperator_MinusEquals": "Minus equal",
|
||||
"SSE.Controllers.Toolbar.txtOperator_PlusEquals": "Plus equal",
|
||||
"SSE.Controllers.Toolbar.txtOperator_UnitOfMeasure": "Measured by",
|
||||
"SSE.Controllers.Toolbar.txtOther": "Other",
|
||||
"SSE.Controllers.Toolbar.txtPaste": "Paste",
|
||||
"SSE.Controllers.Toolbar.txtPasteBorders": "Formula without borders",
|
||||
"SSE.Controllers.Toolbar.txtPasteColWidths": "Formula + column width",
|
||||
"SSE.Controllers.Toolbar.txtPasteDestFormat": "Destination formatting",
|
||||
"SSE.Controllers.Toolbar.txtPasteFormat": "Paste only formatting",
|
||||
"SSE.Controllers.Toolbar.txtPasteFormulaNumFormat": "Formula + number format",
|
||||
"SSE.Controllers.Toolbar.txtPasteFormulas": "Paste only formula",
|
||||
"SSE.Controllers.Toolbar.txtPasteKeepSourceFormat": "Formula + all formatting",
|
||||
"SSE.Controllers.Toolbar.txtPasteLink": "Paste link",
|
||||
"SSE.Controllers.Toolbar.txtPasteLinkPicture": "Linked picture",
|
||||
"SSE.Controllers.Toolbar.txtPasteMerge": "Merge conditional formatting",
|
||||
"SSE.Controllers.Toolbar.txtPasteNoOptions": "Paste (P)",
|
||||
"SSE.Controllers.Toolbar.txtPastePicture": "Picture",
|
||||
"SSE.Controllers.Toolbar.txtPasteSourceFormat": "Source formatting",
|
||||
"SSE.Controllers.Toolbar.txtPasteTranspose": "Transpose",
|
||||
"SSE.Controllers.Toolbar.txtPasteValFormat": "Value + all formatting",
|
||||
"SSE.Controllers.Toolbar.txtPasteValNumFormat": "Value + number format",
|
||||
"SSE.Controllers.Toolbar.txtPasteValues": "Paste only value",
|
||||
"del_SSE.Controllers.Toolbar.txtOther": "Other",
|
||||
"del_SSE.Controllers.Toolbar.txtPaste": "Paste",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteBorders": "Formula without borders",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteColWidths": "Formula + column width",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteDestFormat": "Destination formatting",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteFormat": "Paste only formatting",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteFormulaNumFormat": "Formula + number format",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteFormulas": "Paste only formula",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteKeepSourceFormat": "Formula + all formatting",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteLink": "Paste link",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteLinkPicture": "Linked picture",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteMerge": "Merge conditional formatting",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteNoOptions": "Paste (P)",
|
||||
"del_SSE.Controllers.Toolbar.txtPastePicture": "Picture",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteSourceFormat": "Source formatting",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteTranspose": "Transpose",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteValFormat": "Value + all formatting",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteValNumFormat": "Value + number format",
|
||||
"del_SSE.Controllers.Toolbar.txtPasteValues": "Paste only value",
|
||||
"SSE.Controllers.Toolbar.txtRadicalCustom_1": "Right hand side of quadratic formula",
|
||||
"SSE.Controllers.Toolbar.txtRadicalCustom_2": "Square root of a squared plus b squared",
|
||||
"SSE.Controllers.Toolbar.txtRadicalRoot_2": "Square root with degree",
|
||||
@ -2472,8 +2497,8 @@
|
||||
"SSE.Controllers.Toolbar.txtTable_TableStyleDark": "Table style Dark",
|
||||
"SSE.Controllers.Toolbar.txtTable_TableStyleLight": "Table style Light",
|
||||
"SSE.Controllers.Toolbar.txtTable_TableStyleMedium": "Table style Medium",
|
||||
"SSE.Controllers.Toolbar.txtUseTextImport": "Use text import",
|
||||
"SSE.Controllers.Toolbar.txtValue": "Value",
|
||||
"del_SSE.Controllers.Toolbar.txtUseTextImport": "Use text import",
|
||||
"del_SSE.Controllers.Toolbar.txtValue": "Value",
|
||||
"SSE.Controllers.Toolbar.warnLongOperation": "The operation you are about to perform might take rather much time to complete.<br>Are you sure you want to continue?",
|
||||
"SSE.Controllers.Toolbar.warnMergeLostData": "Only the data from the upper-left cell will remain in the merged cell. <br>Are you sure you want to continue?",
|
||||
"SSE.Controllers.Toolbar.warnNoRecommended": "To create a chart, select the cells that contain the data you'd like to use.<br>If you have names for the rows and columns and you'd like use them as labels, include them in your selection.",
|
||||
|
||||
Reference in New Issue
Block a user