[SSE] Fix list settings

This commit is contained in:
Julia Radzhabova 2020-06-25 17:28:38 +03:00
parent baa4065363
commit 260ab8b283
2 changed files with 50 additions and 46 deletions

View file

@ -62,8 +62,8 @@ define([
}, },
initialize : function(options) { initialize : function(options) {
this.type = options.type || 0; this.type = (options.type>0) ? 1 : 0;
this.subtype = options.subtype || 1; this.subtype = (options.subtype>=0) ? options.subtype : 1;
_.extend(this.options, { _.extend(this.options, {
title: this.txtTitle title: this.txtTitle
@ -123,6 +123,7 @@ define([
this.props = options.props; this.props = options.props;
this.options.tpl = _.template(this.template)(this.options); this.options.tpl = _.template(this.template)(this.options);
this.color = '000000';
Common.UI.Window.prototype.initialize.call(this, this.options); Common.UI.Window.prototype.initialize.call(this, this.options);
}, },
@ -169,14 +170,10 @@ define([
}); });
this.cmbNumFormat.on('selected', _.bind(function (combo, record) { this.cmbNumFormat.on('selected', _.bind(function (combo, record) {
if (this._changedProps) { if (this._changedProps) {
if (record.value == -1) { this._changedProps.asc_putListType(1, record.value);
this._changedProps.asc_putSymbol(undefined);
} else {
this._changedProps.asc_putSymbol(undefined);
this._changedProps.asc_putAutoNumType(record.value);
}
} }
}, this)); }, this));
this.cmbNumFormat.setValue(this.subtype);
var itemsTemplate = var itemsTemplate =
[ [
@ -225,6 +222,7 @@ define([
formcontrol[0].innerHTML = ''; formcontrol[0].innerHTML = '';
} }
}); });
this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.at(1));
this.cmbBulletFormat.on('selected', _.bind(function (combo, record) { this.cmbBulletFormat.on('selected', _.bind(function (combo, record) {
if (this._changedProps) { if (this._changedProps) {
if (record.value === 1) { if (record.value === 1) {
@ -259,7 +257,7 @@ define([
win.show(); win.show();
win.on('symbol:dblclick', handler); win.on('symbol:dblclick', handler);
} else if (record.value == -1) { } else if (record.value == -1) {
this._changedProps.asc_putSymbol(undefined); this._changedProps.asc_putListType(0, record.value);
} else { } else {
this.bulletProps.changed = true; this.bulletProps.changed = true;
this.bulletProps.code = record.code; this.bulletProps.code = record.code;
@ -291,7 +289,8 @@ define([
this.btnColor = new Common.UI.ColorButton({ this.btnColor = new Common.UI.ColorButton({
parentEl: $window.find('#id-dlg-list-color'), parentEl: $window.find('#id-dlg-list-color'),
style: "width:45px;", style: "width:45px;",
additionalAlign: this.menuAddAlign additionalAlign: this.menuAddAlign,
color: this.color
}); });
this.btnColor.on('color:select', _.bind(this.onColorsSelect, this)); this.btnColor.on('color:select', _.bind(this.onColorsSelect, this));
this.colors = this.btnColor.getPicker(); this.colors = this.btnColor.getPicker();
@ -329,6 +328,7 @@ define([
}, },
onColorsSelect: function(btn, color) { onColorsSelect: function(btn, color) {
this.color = color;
if (this._changedProps) { if (this._changedProps) {
this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(color)); this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(color));
} }
@ -336,25 +336,6 @@ define([
onListTypeClick: function(type, btn, event) { onListTypeClick: function(type, btn, event) {
this.ShowHideElem(type); this.ShowHideElem(type);
if (this._changedProps) {
if (type==0) {//markers
if (this.cmbBulletFormat.getValue()==-1) {
this._changedProps.asc_putSymbol(undefined);
} else {
this._changedProps.asc_putFont(this.bulletProps.font);
this._changedProps.asc_putSymbol(this.bulletProps.symbol);
}
} else {
var value = this.cmbNumFormat.getValue();
if (value==-1) {
this._changedProps.asc_putSymbol(undefined);
} else {
this._changedProps.asc_putSymbol(undefined);
this._changedProps.asc_putAutoNumType(value);
}
}
}
this.type = type;
}, },
ShowHideElem: function(value) { ShowHideElem: function(value) {
@ -364,9 +345,24 @@ define([
}, },
_handleInput: function(state) { _handleInput: function(state) {
if (this.options.handler) { if (this.options.handler)
var listtype = (this.type==0) ? this.cmbBulletFormat.getValue() : this.cmbNumFormat.getValue(); {
this.options.handler.call(this, state, (listtype==-1) ? -1 : this._changedProps); var type = this.btnBullet.pressed ? 0 : 1;
if (this._changedProps && (this.type !== type)) {
if (type==0) {//markers
if (this.cmbBulletFormat.getValue()==-1) {
this._changedProps.asc_putListType(0, -1);
} else {
this._changedProps.asc_putFont(this.bulletProps.font);
this._changedProps.asc_putSymbol(this.bulletProps.symbol);
}
} else {
var value = this.cmbNumFormat.getValue();
this._changedProps.asc_putListType(1, value);
this._changedProps.asc_putNumStartAt(this.spnStart.getNumberValue());
}
}
this.options.handler.call(this, state, this._changedProps);
} }
this.close(); this.close();
}, },
@ -423,18 +419,30 @@ define([
this.spnStart.setValue(value || '', true); this.spnStart.setValue(value || '', true);
this.spnStart.setDisabled(value===null); this.spnStart.setDisabled(value===null);
} else { } else {
this.bulletProps = {symbol: symbol, font: bullet.asc_getFont()}; this.bulletProps = {symbol: (symbol!==null) ? symbol : '', font: bullet.asc_getFont()};
if (!this.cmbBulletFormat.store.findWhere({value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font})) if (symbol!==null) {
this.cmbBulletFormat.store.add({ displayValue: this.txtSymbol + ': ', value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font }, {at: this.cmbBulletFormat.store.length-1}); if (!this.cmbBulletFormat.store.findWhere({value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font}))
this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models); this.cmbBulletFormat.store.add({ displayValue: this.txtSymbol + ': ', value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font }, {at: this.cmbBulletFormat.store.length-1});
this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font})); this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models);
this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font}));
} else
this.cmbBulletFormat.setValue('');
this.cmbNumFormat.setValue(1); this.cmbNumFormat.setValue(1);
} }
this._changedProps = bullet; this._changedProps = bullet;
} }
} }
if (!this._changedProps) if (!this._changedProps) {
this._changedProps = new Asc.asc_CBullet(); this._changedProps = new Asc.asc_CBullet();
this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.color));
this._changedProps.asc_putSize(this.spnSize.getNumberValue());
if (this.type==0) {
this._changedProps.asc_putListType(0, this.cmbBulletFormat.getValue());
} else {
this._changedProps.asc_putListType(1, this.cmbNumFormat.getValue());
this._changedProps.asc_putNumStartAt(this.spnStart.getNumberValue());
}
}
}, },
txtTitle: 'List Settings', txtTitle: 'List Settings',

View file

@ -759,7 +759,7 @@ define([
onSelectBulletMenu: function(menu, item) { onSelectBulletMenu: function(menu, item) {
if (this.api) { if (this.api) {
if (item.options.value == -1) { if (item.options.value == -1) {
this.api.asc_setListType(item.options.value); this.api.asc_setListType(0, item.options.value);
Common.NotificationCenter.trigger('edit:complete', this.documentHolder); Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
Common.component.Analytics.trackEvent('DocumentHolder', 'List Type'); Common.component.Analytics.trackEvent('DocumentHolder', 'List Type');
} else if (item.options.value == 'settings') { } else if (item.options.value == 'settings') {
@ -783,12 +783,8 @@ define([
handler: function(result, value) { handler: function(result, value) {
if (result == 'ok') { if (result == 'ok') {
if (me.api) { if (me.api) {
if (value==-1) props.asc_putBullet(value);
me.api.asc_setListType(-1); me.api.asc_setGraphicObjectProps(props);
else {
props.asc_putBullet(value);
me.api.asc_setGraphicObjectProps(props);
}
} }
} }
Common.NotificationCenter.trigger('edit:complete', me.documentHolder); Common.NotificationCenter.trigger('edit:complete', me.documentHolder);
@ -1790,7 +1786,7 @@ define([
documentHolder.menuParagraphDirect270.setChecked(direct == Asc.c_oAscVertDrawingText.vert270); documentHolder.menuParagraphDirect270.setChecked(direct == Asc.c_oAscVertDrawingText.vert270);
documentHolder.menuParagraphBulletNone.setChecked(listtype.get_ListType() == -1); documentHolder.menuParagraphBulletNone.setChecked(listtype.get_ListType() == -1);
documentHolder.mnuListSettings.setDisabled(listtype.get_ListType() == -1); // documentHolder.mnuListSettings.setDisabled(listtype.get_ListType() == -1);
var rec = documentHolder.paraBulletsPicker.store.findWhere({ type: listtype.get_ListType(), subtype: listtype.get_ListSubType() }); var rec = documentHolder.paraBulletsPicker.store.findWhere({ type: listtype.get_ListType(), subtype: listtype.get_ListSubType() });
documentHolder.paraBulletsPicker.selectRecord(rec, true); documentHolder.paraBulletsPicker.selectRecord(rec, true);
} else if (elType == Asc.c_oAscTypeSelectElement.Paragraph) { } else if (elType == Asc.c_oAscTypeSelectElement.Paragraph) {