[SSE] Special paste for tables

This commit is contained in:
Julia Radzhabova 2020-03-03 12:42:06 +03:00
parent da988c609b
commit 7a875c8df1
2 changed files with 19 additions and 11 deletions

View file

@ -2372,7 +2372,7 @@ define([
value: 'special' value: 'special'
}).on('click', function(item, e) { }).on('click', function(item, e) {
(new SSE.Views.SpecialPasteDialog({ (new SSE.Views.SpecialPasteDialog({
props: pasteItems, props: specialPasteShowOptions,
handler: function (result, settings) { handler: function (result, settings) {
if (result == 'ok') { if (result == 'ok') {
if (me && me.api) { if (me && me.api) {

View file

@ -168,6 +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;
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
}, },
@ -360,10 +361,14 @@ define([
}, },
_setDefaults: function (props) { _setDefaults: function (props) {
var me = this; if (props) {
props && _.each(props, function(menuItem, index) { var me = this;
me.propControls[menuItem] && me.propControls[menuItem].setDisabled(false); 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 = new Asc.SpecialPasteProps();
this._changedProps.asc_setProps(Asc.c_oSpecialPasteProps.paste); this._changedProps.asc_setProps(Asc.c_oSpecialPasteProps.paste);
@ -396,12 +401,15 @@ define([
if (newValue && this._changedProps) { if (newValue && this._changedProps) {
this._changedProps.asc_setProps(field.options.value); this._changedProps.asc_setProps(field.options.value);
var disable = field.options.value == Asc.c_oSpecialPasteProps.pasteOnlyFormating || field.options.value == Asc.c_oSpecialPasteProps.comments || var disable = field.options.value == Asc.c_oSpecialPasteProps.pasteOnlyFormating || field.options.value == Asc.c_oSpecialPasteProps.comments ||
field.options.value == Asc.c_oSpecialPasteProps.columnWidth; field.options.value == Asc.c_oSpecialPasteProps.columnWidth,
this.radioNone.setDisabled(disable); disableTable = this.isTable && !!this._changedProps.asc_getTableAllowed();
this.radioAdd.setDisabled(disable); this.radioNone.setDisabled(disable || disableTable);
this.radioDiv.setDisabled(disable); this.radioAdd.setDisabled(disable || disableTable);
this.radioSub.setDisabled(disable); this.radioDiv.setDisabled(disable || disableTable);
this.radioMult.setDisabled(disable); this.radioSub.setDisabled(disable || disableTable);
this.radioMult.setDisabled(disable || disableTable);
this.chBlanks.setDisabled(disableTable);
this.chTranspose.setDisabled(disableTable);
} }
}, },