diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 29b3c36fa..cab9218ad 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -76,10 +76,10 @@ define([ initialize: function() { this._state = { activated: false, - // bullets: { - // type: undefined, - // subtype: undefined - // }, + bullets: { + format: Asc.c_oAscNumberingFormat.None, + numberingInfo: '' + }, prstyle: undefined, prcontrolsdisable:undefined, dropcap: Asc.c_oAscDropCap.None, @@ -539,21 +539,15 @@ define([ if (listId !== null) { var numLvl = this.api.asc_GetNumberingPr(listId).get_Lvl(this.api.asc_GetCurrentNumberingLvl()), format = numLvl.get_Format(); - this.toolbar.mnuNumberSettings && this.toolbar.mnuNumberSettings.setDisabled(format === Asc.c_oAscNumberingFormat.Bullet); - this.toolbar.mnuNumberChangeLevel && this.toolbar.mnuNumberChangeLevel.setDisabled(format === Asc.c_oAscNumberingFormat.Bullet); - this.toolbar.mnuMarkerSettings && this.toolbar.mnuMarkerSettings.setDisabled(format !== Asc.c_oAscNumberingFormat.Bullet); - this.toolbar.mnuMarkerChangeLevel && this.toolbar.mnuMarkerChangeLevel.setDisabled(format !== Asc.c_oAscNumberingFormat.Bullet); - this.toolbar.mnuMultilevelSettings && this.toolbar.mnuMultilevelSettings.setDisabled(false); - this.toolbar.mnuMultiChangeLevel && this.toolbar.mnuMultiChangeLevel.setDisabled(false); + this._state.bullets.format = format; + this._state.bullets.numberingInfo = v; // must be json - custom list type } else { - this.toolbar.mnuNumberSettings && this.toolbar.mnuNumberSettings.setDisabled(true); - this.toolbar.mnuNumberChangeLevel && this.toolbar.mnuNumberChangeLevel.setDisabled(true); - this.toolbar.mnuMarkerSettings && this.toolbar.mnuMarkerSettings.setDisabled(true); - this.toolbar.mnuMarkerChangeLevel && this.toolbar.mnuMarkerChangeLevel.setDisabled(true); - this.toolbar.mnuMultilevelSettings && this.toolbar.mnuMultilevelSettings.setDisabled(true); - this.toolbar.mnuMultiChangeLevel && this.toolbar.mnuMultiChangeLevel.setDisabled(true); + this._state.bullets.format = Asc.c_oAscNumberingFormat.None; } + this.toolbar.btnMarkers.toggle(this._state.bullets.format===Asc.c_oAscNumberingFormat.Bullet, true); + this.toolbar.btnNumbers.toggle(this._state.bullets.format!==Asc.c_oAscNumberingFormat.None && this._state.bullets.format!==Asc.c_oAscNumberingFormat.Bullet, true); // TODO: compare v with numberingInfo from dataview store + return; var type = v.get_ListType(); @@ -626,6 +620,34 @@ define([ } }, + showSelectedBulletOnOpen: function(type, picker) { + var format = this._state.bullets.format, + numberingInfo = (format !== Asc.c_oAscNumberingFormat.None) ? JSON.stringify(this._state.bullets.numberingInfo) : '{"Type":"remove"}'; + picker.deselectAll(true); + + if (type===2) { // multilevel + (format === Asc.c_oAscNumberingFormat.None) && picker.selectByIndex(0, true); + this.toolbar.mnuMultilevelSettings && this.toolbar.mnuMultilevelSettings.setDisabled(format === Asc.c_oAscNumberingFormat.None); + this.toolbar.mnuMultiChangeLevel && this.toolbar.mnuMultiChangeLevel.setDisabled(format === Asc.c_oAscNumberingFormat.None); + } else { + var store = picker.store; + for (var i=0; i