From 7a875c8df1662d7395410aad260368f940a8bcdf Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 3 Mar 2020 12:42:06 +0300 Subject: [PATCH] [SSE] Special paste for tables --- .../main/app/controller/DocumentHolder.js | 2 +- .../main/app/view/SpecialPasteDialog.js | 28 ++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 4ad902e1f..df9ada125 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -2372,7 +2372,7 @@ define([ value: 'special' }).on('click', function(item, e) { (new SSE.Views.SpecialPasteDialog({ - props: pasteItems, + props: specialPasteShowOptions, handler: function (result, settings) { if (result == 'ok') { if (me && me.api) { diff --git a/apps/spreadsheeteditor/main/app/view/SpecialPasteDialog.js b/apps/spreadsheeteditor/main/app/view/SpecialPasteDialog.js index 6c5995602..e1b2137af 100644 --- a/apps/spreadsheeteditor/main/app/view/SpecialPasteDialog.js +++ b/apps/spreadsheeteditor/main/app/view/SpecialPasteDialog.js @@ -168,6 +168,7 @@ define([ this.handler = options.handler; this.props = options.props; this._changedProps = null; + this.isTable = false; Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); }, @@ -360,10 +361,14 @@ define([ }, _setDefaults: function (props) { - var me = this; - props && _.each(props, function(menuItem, index) { - me.propControls[menuItem] && me.propControls[menuItem].setDisabled(false); - }); + if (props) { + var me = this; + var pasteItems = props.asc_getOptions(); + pasteItems && _.each(pasteItems, function(menuItem, index) { + me.propControls[menuItem] && me.propControls[menuItem].setDisabled(false); + }); + this.isTable = !!props.asc_getContainTables(); + } this._changedProps = new Asc.SpecialPasteProps(); this._changedProps.asc_setProps(Asc.c_oSpecialPasteProps.paste); @@ -396,12 +401,15 @@ define([ if (newValue && this._changedProps) { this._changedProps.asc_setProps(field.options.value); var disable = field.options.value == Asc.c_oSpecialPasteProps.pasteOnlyFormating || field.options.value == Asc.c_oSpecialPasteProps.comments || - field.options.value == Asc.c_oSpecialPasteProps.columnWidth; - this.radioNone.setDisabled(disable); - this.radioAdd.setDisabled(disable); - this.radioDiv.setDisabled(disable); - this.radioSub.setDisabled(disable); - this.radioMult.setDisabled(disable); + field.options.value == Asc.c_oSpecialPasteProps.columnWidth, + disableTable = this.isTable && !!this._changedProps.asc_getTableAllowed(); + this.radioNone.setDisabled(disable || disableTable); + this.radioAdd.setDisabled(disable || disableTable); + this.radioDiv.setDisabled(disable || disableTable); + this.radioSub.setDisabled(disable || disableTable); + this.radioMult.setDisabled(disable || disableTable); + this.chBlanks.setDisabled(disableTable); + this.chTranspose.setDisabled(disableTable); } },