[SSE] Fix special paste for tables

This commit is contained in:
Julia Radzhabova 2020-03-03 14:01:20 +03:00
parent 7a875c8df1
commit 11bd243b0a
2 changed files with 14 additions and 16 deletions

View file

@ -2248,7 +2248,8 @@ define([
documentHolderView = me.documentHolder, documentHolderView = me.documentHolder,
coord = specialPasteShowOptions.asc_getCellCoord(), coord = specialPasteShowOptions.asc_getCellCoord(),
pasteContainer = documentHolderView.cmpEl.find('#special-paste-container'), pasteContainer = documentHolderView.cmpEl.find('#special-paste-container'),
pasteItems = specialPasteShowOptions.asc_getOptions(); pasteItems = specialPasteShowOptions.asc_getOptions(),
isTable = !!specialPasteShowOptions.asc_getContainTables();
if (!pasteItems) return; if (!pasteItems) return;
// Prepare menu container // Prepare menu container
@ -2372,15 +2373,16 @@ define([
value: 'special' value: 'special'
}).on('click', function(item, e) { }).on('click', function(item, e) {
(new SSE.Views.SpecialPasteDialog({ (new SSE.Views.SpecialPasteDialog({
props: specialPasteShowOptions, props: pasteItems,
isTable: isTable,
handler: function (result, settings) { handler: function (result, settings) {
if (result == 'ok') { if (result == 'ok') {
if (me && me.api) {
me.api.asc_SpecialPaste(settings);
}
me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(false, true); 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 = settings && me._arrSpecialPaste[settings.asc_getProps()] ? me._arrSpecialPaste[settings.asc_getProps()][2] : null;
me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true); me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true);
if (me && me.api) {
me.api.asc_SpecialPaste(settings);
}
} }
} }
})).show(); })).show();

View file

@ -168,7 +168,7 @@ define([
this.handler = options.handler; this.handler = options.handler;
this.props = options.props; this.props = options.props;
this._changedProps = null; this._changedProps = null;
this.isTable = false; this.isTable = !!options.isTable;
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
}, },
@ -183,7 +183,6 @@ define([
name: 'asc-radio-paste', name: 'asc-radio-paste',
labelText: this.textAll, labelText: this.textAll,
value: Asc.c_oSpecialPasteProps.paste, value: Asc.c_oSpecialPasteProps.paste,
checked: true,
disabled: true disabled: true
}); });
this.radioAll.on('change', _.bind(this.onRadioPasteChange, this)); this.radioAll.on('change', _.bind(this.onRadioPasteChange, this));
@ -361,18 +360,15 @@ define([
}, },
_setDefaults: function (props) { _setDefaults: function (props) {
if (props) {
var me = this; var me = this;
var pasteItems = props.asc_getOptions(); props && _.each(props, function(menuItem, index) {
pasteItems && _.each(pasteItems, function(menuItem, index) {
me.propControls[menuItem] && me.propControls[menuItem].setDisabled(false); me.propControls[menuItem] && me.propControls[menuItem].setDisabled(false);
}); });
this.isTable = !!props.asc_getContainTables();
}
this._changedProps = new Asc.SpecialPasteProps(); this._changedProps = new Asc.SpecialPasteProps();
this._changedProps.asc_setProps(Asc.c_oSpecialPasteProps.paste); this._changedProps.asc_setProps(Asc.c_oSpecialPasteProps.paste);
this._changedProps.asc_setOperation(Asc.c_oSpecialPasteOperation.none); this._changedProps.asc_setOperation(Asc.c_oSpecialPasteOperation.none);
this.radioAll.setValue(true);
}, },
getSettings: function () { getSettings: function () {