From 6b50bfd01cbd5021972649ec8037bd1005651674 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Tue, 3 Feb 2026 12:12:40 +0300 Subject: [PATCH 01/10] base sources --- .../main/app/controller/Toolbar.js | 170 ++++++++++++++++++ .../main/app/template/Toolbar.template | 1 + .../main/app/view/Toolbar.js | 16 +- apps/spreadsheeteditor/main/locale/en.json | 26 +++ 4 files changed, 212 insertions(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index c67af1422e..ea816275f3 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -438,6 +438,7 @@ define([ toolbar.btnWrap.on('click', _.bind(this.onWrap, this)); toolbar.btnTextOrient.menu.on('item:click', _.bind(this.onTextOrientationMenu, this)); toolbar.btnInsertTable.on('click', _.bind(this.onBtnInsertTableClick, this)); + toolbar.btnPasteOptions.on('click', _.bind(this.onBtnPasteOptionsClick, this)); toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageMenu, this)); toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlink, this)); toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this)); @@ -1050,6 +1051,175 @@ define([ Common.component.Analytics.trackEvent('ToolBar', 'Table'); }, + onBtnPasteOptionsClick: function (btn, e) { + var me = this; + this.api.asc_getPasteOptions(function (options) { + me.handlePasteOptions(options) + }) + }, + + handlePasteOptions: function (options) { + var me = this; + var pasteItems = options.asc_getOptions(), + isTable = !!options.asc_getContainTables(); + console.log(options, 'OPTIONS') + 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]; + + if (pasteItems.length>0) { + var menu = me.toolbar.btnPasteOptions.menu; + for (var i = 0; i < menu.items.length; i++) { + menu.removeItem(menu.items[i]); + i--; + } + + 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], + 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); + }); + } + } + + (menu.items.length>0) && menu.items[0].setChecked(true, true); + me._state.lastSpecPasteChecked = (menu.items.length>0) ? menu.items[0] : null; + + if (importText) { + menu.addItem(new Common.UI.MenuItem({ caption: '--' })); + menu.addItem(importText); + } + console.log(options.asc_getShowPasteSpecial(), 'SPECIAL') + 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') { + me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(false, true); + me._state.lastSpecPasteChecked = settings && me._arrSpecialPaste[settings.asc_getProps()] ? me._arrSpecialPaste[settings.asc_getProps()][2] : null; + me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true); + if (me && me.api) { + me.api.asc_SpecialPaste(settings); + } + } + } + })).show(); + setTimeout(function(){menu.hide();}, 100); + }); + menu.addItem(mnu); + } + } + }, + + onSpecialPasteItemClick: function (item, e) { + var me = this, + menu = this.toolbar.btnPasteOptions.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, + 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); + } + me._state.lastSpecPasteChecked = item; + } else if (item.cmpEl) { + item.setChecked(false, true); + // me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true); + } + } + })).show(); + setTimeout(function(){menu.hide();}, 100); + } else { + me._state.lastSpecPasteChecked = item; + var props = new Asc.SpecialPasteProps(); + props.asc_setProps(item.value); + me.api.asc_SpecialPaste(props); + setTimeout(function(){menu.hide();}, 100); + } + if (!item.cmpEl && me._state.lastSpecPasteChecked) { + for (var i = 0; i < menu.items.length; i++) { + menu.items[i].setChecked(menu.items[i].value===me._state.lastSpecPasteChecked.value, true); + if (menu.items[i].value===me._state.lastSpecPasteChecked.value) + me._state.lastSpecPasteChecked = menu.items[i]; + } + } + return false; + }, + onInsertImageMenu: function(menu, item, e) { var me = this; if (item.value === 'file') { diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 3a552dab98..0666c340f9 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -144,6 +144,7 @@
+
diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 7076bc0f17..958b2d9010 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1554,6 +1554,18 @@ define([ dataHintOffset: 'small' }); + me.btnPasteOptions = new Common.UI.Button({ + id : 'tlbtn-inserttable', + cls : 'btn-toolbar x-huge icon-top', + iconCls : 'toolbar__icon btn-freeze-panes', + caption : me.capPasteOptions, + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.ruleMerge, _set.editPivot, _set.wsLock, _set.userProtected], + menu : new Common.UI.Menu({items: []}), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.listStyles = new Common.UI.ComboDataView({ cls : 'combo-cell-styles', enableKeyEvents : true, @@ -2453,7 +2465,7 @@ define([ me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnChangeCase, me.btnBold, me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnAlignLeft, me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnAlignTop, - me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable, + me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable, me.btnPasteOptions, me.btnMerge, me.btnTextDir, me.btnInsertFormula, me.btnNamedRange, me.btnFillNumbers, me.btnIncDecimal, me.btnInsertShape, me.btnInsertSmartArt, me.btnInsertEquation, me.btnInsertSymbol, me.btnInsertSlicer, me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, me.btnTableTemplate, me.btnCellStyle, me.btnPercentStyle, me.btnCommaStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.btnFormatCell, me.btnCondFormat, @@ -2623,6 +2635,7 @@ define([ _injectComponent('#slot-btn-text-orient', this.btnTextOrient); _injectComponent('#slot-btn-insimage', this.btnInsertImage); _injectComponent('#slot-btn-instable', this.btnInsertTable); + _injectComponent('#slot-btn-paste-options', this.btnPasteOptions); _injectComponent('#slot-btn-inshyperlink', this.btnInsertHyperlink); _injectComponent('#slot-btn-insshape', this.btnInsertShape); _injectComponent('#slot-btn-instext', this.btnInsertText); @@ -2711,6 +2724,7 @@ define([ _updateHint(this.btnWrap, this.tipWrap); _updateHint(this.btnTextOrient, this.tipTextOrientation); _updateHint(this.btnInsertTable, this.tipInsertTable); + _updateHint(this.btnPasteOptions, this.tipPasteOptions); _updateHint(this.btnInsertImage, this.tipInsertImage); _updateHint(this.btnInsertChart, this.tipInsertChartSpark); _updateHint(this.btnInsertChartRecommend, this.tipInsertChartRecommend); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index fd2c65bc39..3bb8377c6d 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2416,6 +2416,30 @@ "SSE.Controllers.Toolbar.warnLongOperation": "The operation you are about to perform might take rather much time to complete.
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.
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.
If you have names for the rows and columns and you'd like use them as labels, include them in your selection.", + "SSE.Controllers.Toolbar.txtKeepTextOnly": "Keep text only", + "SSE.Controllers.Toolbar.txtUseTextImport": "Use text import", + "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.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", + "SSE.Controllers.Toolbar.txtOther": "Other", + "SSE.Controllers.Toolbar.txtFormula": "Formula", + "SSE.Controllers.Toolbar.txtValue": "Value", + "SSE.Controllers.Toolbar.textPasteSpecial": "Paste special", + "SSE.Controllers.Toolbar.txtImportWizard": "Text Import", "SSE.Controllers.Viewport.textFreezePanes": "Freeze panes", "SSE.Controllers.Viewport.textFreezePanesShadow": "Show Frozen Panes Shadow", "SSE.Controllers.Viewport.textHideFBar": "Hide Formula Bar", @@ -4778,6 +4802,7 @@ "SSE.Views.Toolbar.capInsertShape": "Shape", "SSE.Views.Toolbar.capInsertSpark": "Sparkline", "SSE.Views.Toolbar.capInsertTable": "Table", + "SSE.Views.Toolbar.capPasteOptions": "Paste Options", "SSE.Views.Toolbar.capInsertText": "Text Box", "SSE.Views.Toolbar.capInsertTextart": "Text Art", "SSE.Views.Toolbar.capShapesMerge": "Merge Shapes", @@ -5005,6 +5030,7 @@ "SSE.Views.Toolbar.tipInsertSpark": "Insert sparkline", "SSE.Views.Toolbar.tipInsertSymbol": "Insert symbol", "SSE.Views.Toolbar.tipInsertTable": "Insert table", + "SSE.Views.Toolbar.tipPasteOptions": "Paste options", "SSE.Views.Toolbar.tipInsertText": "Insert text box", "SSE.Views.Toolbar.tipInsertTextart": "Insert Text Art", "SSE.Views.Toolbar.tipInsertVerticalText": "Insert vertical text box", From 1d558d217ea5873f498a95115facc1f490908d00 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Fri, 6 Feb 2026 18:55:44 +0300 Subject: [PATCH 02/10] refactored --- .../main/app/controller/DocumentHolderExt.js | 23 ++++++++++++++++++ .../main/app/controller/Toolbar.js | 24 +++---------------- .../main/app/template/Toolbar.template | 3 +-- .../main/app/view/Toolbar.js | 18 +++----------- apps/spreadsheeteditor/main/locale/en.json | 2 -- 5 files changed, 30 insertions(+), 40 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js index 291e36e4a5..05ce3451c6 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js @@ -3961,6 +3961,8 @@ define([], function () { }; dh.onShowSpecialPasteOptions = function(specialPasteShowOptions) { + console.log(specialPasteShowOptions) + console.log(specialPasteShowOptions.asc_getLastSelectedPasteProperty()) if (this.permissions && !this.permissions.isEdit) return; var me = this, @@ -3969,6 +3971,26 @@ define([], function () { pasteContainer = documentHolderView.cmpEl.find('#special-paste-container'), pasteItems = specialPasteShowOptions.asc_getOptions(), isTable = !!specialPasteShowOptions.asc_getContainTables(); + + var lastSelected = specialPasteShowOptions.asc_getLastSelectedPasteProperty(); + 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); + // me._state.lastSpecPasteChecked = foundItem; + } + } if (!pasteItems) return; // Prepare menu container @@ -4177,6 +4199,7 @@ define([], function () { setTimeout(function(){menu.hide();}, 100); } else { me._state.lastSpecPasteChecked = item; + console.log(me._state.lastSpecPasteChecked) var props = new Asc.SpecialPasteProps(); props.asc_setProps(item.value); me.api.asc_SpecialPaste(props); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index ea816275f3..0c274550a1 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -438,7 +438,6 @@ define([ toolbar.btnWrap.on('click', _.bind(this.onWrap, this)); toolbar.btnTextOrient.menu.on('item:click', _.bind(this.onTextOrientationMenu, this)); toolbar.btnInsertTable.on('click', _.bind(this.onBtnInsertTableClick, this)); - toolbar.btnPasteOptions.on('click', _.bind(this.onBtnPasteOptionsClick, this)); toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageMenu, this)); toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlink, this)); toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this)); @@ -483,6 +482,7 @@ define([ toolbar.cmbNumberFormat.cmpEl.on('click', '#id-toolbar-mnu-item-more-formats a', _.bind(this.onNumberFormatSelect, this)); toolbar.btnCurrencyStyle.menu.on('item:click', _.bind(this.onNumberFormatMenu, this)); $('#id-toolbar-menu-new-bordercolor').on('click', _.bind(this.onNewBorderColor, this)); + $('#slot-btn-paste').on('click','.dropdown-toggle', _.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)); @@ -1062,7 +1062,6 @@ define([ var me = this; var pasteItems = options.asc_getOptions(), isTable = !!options.asc_getContainTables(); - console.log(options, 'OPTIONS') if (!pasteItems) return; me._arrSpecialPaste = []; @@ -1087,7 +1086,7 @@ define([ me._arrSpecialPaste[Asc.c_oSpecialPasteProps.useTextImport] = [me.txtUseTextImport, 3]; if (pasteItems.length>0) { - var menu = me.toolbar.btnPasteOptions.menu; + var menu = me.toolbar.btnPaste.menu; for (var i = 0; i < menu.items.length; i++) { menu.removeItem(menu.items[i]); i--; @@ -1142,14 +1141,10 @@ define([ } } - (menu.items.length>0) && menu.items[0].setChecked(true, true); - me._state.lastSpecPasteChecked = (menu.items.length>0) ? menu.items[0] : null; - if (importText) { menu.addItem(new Common.UI.MenuItem({ caption: '--' })); menu.addItem(importText); } - console.log(options.asc_getShowPasteSpecial(), 'SPECIAL') if (menu.items.length>0 && options.asc_getShowPasteSpecial()) { menu.addItem(new Common.UI.MenuItem({ caption: '--' })); var mnu = new Common.UI.MenuItem({ @@ -1161,9 +1156,6 @@ define([ isTable: isTable, handler: function (result, settings) { if (result == 'ok') { - me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(false, true); - me._state.lastSpecPasteChecked = settings && me._arrSpecialPaste[settings.asc_getProps()] ? me._arrSpecialPaste[settings.asc_getProps()][2] : null; - me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true); if (me && me.api) { me.api.asc_SpecialPaste(settings); } @@ -1179,7 +1171,7 @@ define([ onSpecialPasteItemClick: function (item, e) { var me = this, - menu = this.toolbar.btnPasteOptions.menu; + menu = this.toolbar.btnPaste.menu; if (item.value == Asc.c_oSpecialPasteProps.useTextImport) { (new Common.Views.OpenDialog({ title: me.txtImportWizard, @@ -1195,28 +1187,18 @@ define([ props.asc_setAdvancedOptions(settings.textOptions); me.api.asc_SpecialPaste(props); } - me._state.lastSpecPasteChecked = item; } else if (item.cmpEl) { item.setChecked(false, true); - // me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true); } } })).show(); setTimeout(function(){menu.hide();}, 100); } else { - me._state.lastSpecPasteChecked = item; var props = new Asc.SpecialPasteProps(); props.asc_setProps(item.value); me.api.asc_SpecialPaste(props); setTimeout(function(){menu.hide();}, 100); } - if (!item.cmpEl && me._state.lastSpecPasteChecked) { - for (var i = 0; i < menu.items.length; i++) { - menu.items[i].setChecked(menu.items[i].value===me._state.lastSpecPasteChecked.value, true); - if (menu.items[i].value===me._state.lastSpecPasteChecked.value) - me._state.lastSpecPasteChecked = menu.items[i]; - } - } return false; }, diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 0666c340f9..88e36a3d8e 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -18,7 +18,7 @@
- +
@@ -144,7 +144,6 @@
-
diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 958b2d9010..3a338af393 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -231,6 +231,8 @@ define([ iconCls : 'toolbar__icon btn-paste', lock : [/*_set.editCell,*/ _set.coAuth, _set.lostConnect, _set.editVisibleArea, _set.userProtected, _set.externalChartProtected], dataHint : '1', + menu: new Common.UI.Menu({items: []}), + split: true, dataHintDirection: (config.isEditDiagram || config.isEditMailMerge || config.isEditOle) ? 'bottom' : 'top', dataHintTitle: 'V' }); @@ -1554,18 +1556,6 @@ define([ dataHintOffset: 'small' }); - me.btnPasteOptions = new Common.UI.Button({ - id : 'tlbtn-inserttable', - cls : 'btn-toolbar x-huge icon-top', - iconCls : 'toolbar__icon btn-freeze-panes', - caption : me.capPasteOptions, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.ruleMerge, _set.editPivot, _set.wsLock, _set.userProtected], - menu : new Common.UI.Menu({items: []}), - dataHint: '1', - dataHintDirection: 'bottom', - dataHintOffset: 'small' - }); - me.listStyles = new Common.UI.ComboDataView({ cls : 'combo-cell-styles', enableKeyEvents : true, @@ -2465,7 +2455,7 @@ define([ me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnChangeCase, me.btnBold, me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnAlignLeft, me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnAlignTop, - me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable, me.btnPasteOptions, + me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable, me.btnMerge, me.btnTextDir, me.btnInsertFormula, me.btnNamedRange, me.btnFillNumbers, me.btnIncDecimal, me.btnInsertShape, me.btnInsertSmartArt, me.btnInsertEquation, me.btnInsertSymbol, me.btnInsertSlicer, me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, me.btnTableTemplate, me.btnCellStyle, me.btnPercentStyle, me.btnCommaStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.btnFormatCell, me.btnCondFormat, @@ -2635,7 +2625,6 @@ define([ _injectComponent('#slot-btn-text-orient', this.btnTextOrient); _injectComponent('#slot-btn-insimage', this.btnInsertImage); _injectComponent('#slot-btn-instable', this.btnInsertTable); - _injectComponent('#slot-btn-paste-options', this.btnPasteOptions); _injectComponent('#slot-btn-inshyperlink', this.btnInsertHyperlink); _injectComponent('#slot-btn-insshape', this.btnInsertShape); _injectComponent('#slot-btn-instext', this.btnInsertText); @@ -2724,7 +2713,6 @@ define([ _updateHint(this.btnWrap, this.tipWrap); _updateHint(this.btnTextOrient, this.tipTextOrientation); _updateHint(this.btnInsertTable, this.tipInsertTable); - _updateHint(this.btnPasteOptions, this.tipPasteOptions); _updateHint(this.btnInsertImage, this.tipInsertImage); _updateHint(this.btnInsertChart, this.tipInsertChartSpark); _updateHint(this.btnInsertChartRecommend, this.tipInsertChartRecommend); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 3bb8377c6d..eb2cb59a82 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -4802,7 +4802,6 @@ "SSE.Views.Toolbar.capInsertShape": "Shape", "SSE.Views.Toolbar.capInsertSpark": "Sparkline", "SSE.Views.Toolbar.capInsertTable": "Table", - "SSE.Views.Toolbar.capPasteOptions": "Paste Options", "SSE.Views.Toolbar.capInsertText": "Text Box", "SSE.Views.Toolbar.capInsertTextart": "Text Art", "SSE.Views.Toolbar.capShapesMerge": "Merge Shapes", @@ -5030,7 +5029,6 @@ "SSE.Views.Toolbar.tipInsertSpark": "Insert sparkline", "SSE.Views.Toolbar.tipInsertSymbol": "Insert symbol", "SSE.Views.Toolbar.tipInsertTable": "Insert table", - "SSE.Views.Toolbar.tipPasteOptions": "Paste options", "SSE.Views.Toolbar.tipInsertText": "Insert text box", "SSE.Views.Toolbar.tipInsertTextart": "Insert Text Art", "SSE.Views.Toolbar.tipInsertVerticalText": "Insert vertical text box", From 163781561c749951fffa3c22be943081cfce6780 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Wed, 11 Feb 2026 03:22:44 +0300 Subject: [PATCH 03/10] added hotkeys --- .../main/app/controller/DocumentHolderExt.js | 52 +++++++-------- .../main/app/controller/Toolbar.js | 65 +++++++++++++++++-- .../main/app/view/Toolbar.js | 10 ++- 3 files changed, 94 insertions(+), 33 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js index 05ce3451c6..23cc1b7375 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js @@ -3961,8 +3961,6 @@ define([], function () { }; dh.onShowSpecialPasteOptions = function(specialPasteShowOptions) { - console.log(specialPasteShowOptions) - console.log(specialPasteShowOptions.asc_getLastSelectedPasteProperty()) if (this.permissions && !this.permissions.isEdit) return; var me = this, @@ -3972,25 +3970,6 @@ define([], function () { pasteItems = specialPasteShowOptions.asc_getOptions(), isTable = !!specialPasteShowOptions.asc_getContainTables(); - var lastSelected = specialPasteShowOptions.asc_getLastSelectedPasteProperty(); - 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); - // me._state.lastSpecPasteChecked = foundItem; - } - } if (!pasteItems) return; // Prepare menu container @@ -4083,8 +4062,26 @@ define([], function () { }); } } - (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); me._state.lastSpecPasteChecked = (menu.items.length>0) ? menu.items[0] : null; + 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); + // me._state.lastSpecPasteChecked = foundItem; + } + } if (importText) { menu.addItem(new Common.UI.MenuItem({ caption: '--' })); @@ -4199,7 +4196,6 @@ define([], function () { setTimeout(function(){menu.hide();}, 100); } else { me._state.lastSpecPasteChecked = item; - console.log(me._state.lastSpecPasteChecked) var props = new Asc.SpecialPasteProps(); props.asc_setProps(item.value); me.api.asc_SpecialPaste(props); @@ -4248,7 +4244,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)) { @@ -4257,14 +4253,16 @@ 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); var pasteContainer = me.documentHolder.cmpEl.find('#special-paste-container'); 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'); pasteContainer.addClass('has-open-menu'); }).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); pasteContainer.removeClass('has-open-menu'); }); }; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 0c274550a1..c0429aa8c8 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1085,6 +1085,8 @@ define([ 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; for (var i = 0; i < menu.items.length; i++) { @@ -1102,7 +1104,7 @@ define([ _.each(pasteItems, function(menuItem, index) { if (me._arrSpecialPaste[menuItem]) { var mnu = new Common.UI.MenuItem({ - caption: me._arrSpecialPaste[menuItem][0], + caption: me._arrSpecialPaste[menuItem][0] + (me.hkSpecPaste[menuItem] ? ' (' + me.hkSpecPaste[menuItem] + ')' : ''), value: menuItem, checkable: true, toggleGroup: 'specialPasteGroup' @@ -1157,7 +1159,7 @@ define([ handler: function (result, settings) { if (result == 'ok') { if (me && me.api) { - me.api.asc_SpecialPaste(settings); + me.api.asc_SpecialPaste(settings, true); } } } @@ -1185,7 +1187,7 @@ define([ var props = new Asc.SpecialPasteProps(); props.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport); props.asc_setAdvancedOptions(settings.textOptions); - me.api.asc_SpecialPaste(props); + me.api.asc_SpecialPaste(props, true); } } else if (item.cmpEl) { item.setChecked(false, true); @@ -1196,12 +1198,67 @@ define([ } else { var props = new Asc.SpecialPasteProps(); props.asc_setProps(item.value); - me.api.asc_SpecialPaste(props); + 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'); + + me.toolbar.btnPaste.menu.on('show:after', function(menu) { + window.key.setScope('special-paste-toolbar'); + Common.util.Shortcuts.resumeEvents(str); + }).on('hide:after', function(menu) { + window.key.setScope('all'); + Common.util.Shortcuts.suspendEvents(str, undefined, true); + }); + this.specialPasteEventsInited = true; + }, + onInsertImageMenu: function(menu, item, e) { var me = this; if (item.value === 'file') { diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 3a338af393..d166bfa6f6 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -203,6 +203,8 @@ define([ applyLayout: function (config) { var me = this; + me.config = config; + function dummyCmp() { return { isDummy : true, @@ -231,8 +233,8 @@ define([ iconCls : 'toolbar__icon btn-paste', lock : [/*_set.editCell,*/ _set.coAuth, _set.lostConnect, _set.editVisibleArea, _set.userProtected, _set.externalChartProtected], dataHint : '1', - menu: new Common.UI.Menu({items: []}), - split: true, + menu: config.isDesktopApp ? new Common.UI.Menu({items: []}) : false, + split: config.isDesktopApp, dataHintDirection: (config.isEditDiagram || config.isEditMailMerge || config.isEditOle) ? 'bottom' : 'top', dataHintTitle: 'V' }); @@ -2591,6 +2593,10 @@ define([ Common.Utils.injectComponent($host.find(id), cmp); }; + if (!this.config || !this.config.isDesktopApp) { + $host.find('#slot-btn-paste').removeClass('split'); + } + _injectComponent('#slot-field-fontname', this.cmbFontName); _injectComponent('#slot-field-fontsize', this.cmbFontSize); _injectComponent('#slot-btn-print', this.btnPrint); From abb70935203031dce4881d5e6794f99551226699 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Thu, 12 Feb 2026 01:46:57 +0300 Subject: [PATCH 04/10] removed redundant --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index c0429aa8c8..45a13a5265 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1189,8 +1189,6 @@ define([ props.asc_setAdvancedOptions(settings.textOptions); me.api.asc_SpecialPaste(props, true); } - } else if (item.cmpEl) { - item.setChecked(false, true); } } })).show(); @@ -1206,7 +1204,9 @@ define([ 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'; From 9a7a9c60201fe57a023fd8f1246d16e8cd43f958 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Thu, 12 Feb 2026 02:28:26 +0300 Subject: [PATCH 05/10] added menu hiding after window blur --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 45a13a5265..053f6b7b71 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1249,12 +1249,21 @@ define([ 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; }, From 9e78151c8561391e277a316a55a7a83146331b9c Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Thu, 12 Feb 2026 12:59:38 +0300 Subject: [PATCH 06/10] menu getting ready on show:before --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 053f6b7b71..60ed2d478b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -482,7 +482,8 @@ define([ toolbar.cmbNumberFormat.cmpEl.on('click', '#id-toolbar-mnu-item-more-formats a', _.bind(this.onNumberFormatSelect, this)); toolbar.btnCurrencyStyle.menu.on('item:click', _.bind(this.onNumberFormatMenu, this)); $('#id-toolbar-menu-new-bordercolor').on('click', _.bind(this.onNewBorderColor, this)); - $('#slot-btn-paste').on('click','.dropdown-toggle', _.bind(this.onBtnPasteOptionsClick, this)); + // $('#slot-btn-paste').on('click','.dropdown-toggle', _.bind(this.onBtnPasteOptionsClick, this)); + 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)); From 97633cf74d7e4f79032a3d378fe8070136f30514 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Thu, 12 Feb 2026 13:32:49 +0300 Subject: [PATCH 07/10] clearing menu before handle options --- .../main/app/controller/Toolbar.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 60ed2d478b..2f580b1877 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1054,9 +1054,17 @@ define([ 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) { @@ -1090,10 +1098,6 @@ define([ if (pasteItems.length>0) { var menu = me.toolbar.btnPaste.menu; - for (var i = 0; i < menu.items.length; i++) { - menu.removeItem(menu.items[i]); - i--; - } var groups = []; for (var i = 0; i < 3; i++) { From c8719dda2c08b7fbab3fdb628b9592ab9c473c9c Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Thu, 12 Feb 2026 13:44:15 +0300 Subject: [PATCH 08/10] fix for web editors --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 2f580b1877..8c7eb31afc 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -483,7 +483,7 @@ define([ toolbar.btnCurrencyStyle.menu.on('item:click', _.bind(this.onNumberFormatMenu, this)); $('#id-toolbar-menu-new-bordercolor').on('click', _.bind(this.onNewBorderColor, this)); // $('#slot-btn-paste').on('click','.dropdown-toggle', _.bind(this.onBtnPasteOptionsClick, this)); - toolbar.btnPaste.menu.on('show:before', _.bind(this.onBtnPasteOptionsClick, 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)); From 1c7ca88f1b924e9f514976b37fae30559090371b Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Thu, 12 Feb 2026 16:49:30 +0300 Subject: [PATCH 09/10] fix for empty buffer --- .../main/app/controller/Toolbar.js | 13 +++++++++++++ apps/spreadsheeteditor/main/locale/en.json | 1 + 2 files changed, 14 insertions(+) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 8c7eb31afc..10120b3df7 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1069,6 +1069,19 @@ define([ 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) + return + } + var pasteItems = options.asc_getOptions(), isTable = !!options.asc_getContainTables(); if (!pasteItems) return; diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index eb2cb59a82..d585977c2f 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2419,6 +2419,7 @@ "SSE.Controllers.Toolbar.txtKeepTextOnly": "Keep text only", "SSE.Controllers.Toolbar.txtUseTextImport": "Use text import", "SSE.Controllers.Toolbar.txtPaste": "Paste", + "SSE.Controllers.Toolbar.txtPasteNoOptions": "Paste (P)", "SSE.Controllers.Toolbar.txtPasteBorders": "Formula without borders", "SSE.Controllers.Toolbar.txtPasteColWidths": "Formula + column width", "SSE.Controllers.Toolbar.txtPasteDestFormat": "Destination formatting", From 176cde39b2e42be1d76bca50aae1c5aaefe5bd66 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Fri, 13 Feb 2026 04:17:02 +0300 Subject: [PATCH 10/10] fixed empty menu flicking --- .../main/app/controller/Toolbar.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 10120b3df7..4ade32a8a7 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -482,8 +482,20 @@ define([ toolbar.cmbNumberFormat.cmpEl.on('click', '#id-toolbar-mnu-item-more-formats a', _.bind(this.onNumberFormatSelect, this)); toolbar.btnCurrencyStyle.menu.on('item:click', _.bind(this.onNumberFormatMenu, this)); $('#id-toolbar-menu-new-bordercolor').on('click', _.bind(this.onNewBorderColor, this)); - // $('#slot-btn-paste').on('click','.dropdown-toggle', _.bind(this.onBtnPasteOptionsClick, this)); - toolbar.btnPaste.menu && toolbar.btnPaste.menu.on('show:before', _.bind(this.onBtnPasteOptionsClick, this)); + $('#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.onBtnPasteOptionsClick(); + }, 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)); @@ -1079,6 +1091,7 @@ define([ }); menu.addItem(mnu) + menu.show(); return } @@ -1186,6 +1199,7 @@ define([ }); menu.addItem(mnu); } + menu.show(); } },