From 24dec9d75265fdf35080026ca401595b486d0c0a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 12 Apr 2017 13:00:17 +0300 Subject: [PATCH] [DE] Bugs with document without styles: update from style, create new style, delete all styles. --- apps/common/main/lib/component/ComboDataView.js | 4 ++++ apps/documenteditor/main/app/controller/Toolbar.js | 7 ++++--- apps/documenteditor/main/app/view/StyleTitleDialog.js | 9 +++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/apps/common/main/lib/component/ComboDataView.js b/apps/common/main/lib/component/ComboDataView.js index e51f05f27..421f85653 100644 --- a/apps/common/main/lib/component/ComboDataView.js +++ b/apps/common/main/lib/component/ComboDataView.js @@ -456,6 +456,10 @@ define([ } }, + clearComboView: function() { + this.fieldPicker.store.reset([]); + }, + selectByIndex: function(index) { if (index < 0) this.fieldPicker.deselectAll(); diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 00f454c44..83f7b915a 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -729,7 +729,7 @@ define([ var styleRec = listStyle.menuPicker.store.findWhere({ title: name }); - this._state.prstyle = (listStyle.menuPicker.store.length>0) ? name : undefined; + this._state.prstyle = (listStyle.menuPicker.store.length>0 || window.styles_loaded) ? name : undefined; listStyle.menuPicker.selectRecord(styleRec); listStyle.resumeEvents(); @@ -1881,7 +1881,7 @@ define([ me._state.prstyle = title; style.put_Name(title); characterStyle.put_Name(title + '_character'); - style.put_Next(nextStyle.asc_getName()); + style.put_Next((nextStyle) ? nextStyle.asc_getName() : null); me.api.asc_AddNewStyle(style); } Common.NotificationCenter.trigger('edit:complete', me.toolbar); @@ -2619,7 +2619,8 @@ define([ if (self._state.prstyle) styleRec = listStyles.menuPicker.store.findWhere({title: self._state.prstyle}); listStyles.fillComboView((styleRec) ? styleRec : listStyles.menuPicker.store.at(0), true); Common.NotificationCenter.trigger('edit:complete', this); - } + } else if (listStyles.rendered) + listStyles.clearComboView(); window.styles_loaded = true; }, diff --git a/apps/documenteditor/main/app/view/StyleTitleDialog.js b/apps/documenteditor/main/app/view/StyleTitleDialog.js index 14e605088..3e9ff6363 100644 --- a/apps/documenteditor/main/app/view/StyleTitleDialog.js +++ b/apps/documenteditor/main/app/view/StyleTitleDialog.js @@ -107,10 +107,11 @@ define([ menuStyle : 'width: 100%; max-height: 290px;', editable : false, cls : 'input-group-nr', - data : this.options.formats + data : this.options.formats, + disabled : (this.options.formats.length==0) }); - - this.cmbNextStyle.setValue(this.options.formats[0].value); + if (this.options.formats.length>0) + this.cmbNextStyle.setValue(this.options.formats[0].value); }, show: function() { @@ -129,7 +130,7 @@ define([ getNextStyle: function () { var me = this; - return me.cmbNextStyle.getValue(); + return (me.options.formats.length>0) ? me.cmbNextStyle.getValue() : null; }, onBtnClick: function(event) {