Commit b23cbb32 authored by Julia Radzhabova's avatar Julia Radzhabova

[DE] Bugs with document without styles: update from style, create new style, delete all styles.

parent 65ccd925
...@@ -456,6 +456,10 @@ define([ ...@@ -456,6 +456,10 @@ define([
} }
}, },
clearComboView: function() {
this.fieldPicker.store.reset([]);
},
selectByIndex: function(index) { selectByIndex: function(index) {
if (index < 0) if (index < 0)
this.fieldPicker.deselectAll(); this.fieldPicker.deselectAll();
......
...@@ -733,7 +733,7 @@ define([ ...@@ -733,7 +733,7 @@ define([
var styleRec = listStyle.menuPicker.store.findWhere({ var styleRec = listStyle.menuPicker.store.findWhere({
title: name 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.menuPicker.selectRecord(styleRec);
listStyle.resumeEvents(); listStyle.resumeEvents();
...@@ -1892,7 +1892,7 @@ define([ ...@@ -1892,7 +1892,7 @@ define([
me._state.prstyle = title; me._state.prstyle = title;
style.put_Name(title); style.put_Name(title);
characterStyle.put_Name(title + '_character'); characterStyle.put_Name(title + '_character');
style.put_Next(nextStyle.asc_getName()); style.put_Next((nextStyle) ? nextStyle.asc_getName() : null);
me.api.asc_AddNewStyle(style); me.api.asc_AddNewStyle(style);
} }
Common.NotificationCenter.trigger('edit:complete', me.toolbar); Common.NotificationCenter.trigger('edit:complete', me.toolbar);
...@@ -2630,7 +2630,8 @@ define([ ...@@ -2630,7 +2630,8 @@ define([
if (self._state.prstyle) styleRec = listStyles.menuPicker.store.findWhere({title: self._state.prstyle}); if (self._state.prstyle) styleRec = listStyles.menuPicker.store.findWhere({title: self._state.prstyle});
listStyles.fillComboView((styleRec) ? styleRec : listStyles.menuPicker.store.at(0), true); listStyles.fillComboView((styleRec) ? styleRec : listStyles.menuPicker.store.at(0), true);
Common.NotificationCenter.trigger('edit:complete', this); Common.NotificationCenter.trigger('edit:complete', this);
} } else if (listStyles.rendered)
listStyles.clearComboView();
window.styles_loaded = true; window.styles_loaded = true;
}, },
......
...@@ -107,9 +107,10 @@ define([ ...@@ -107,9 +107,10 @@ define([
menuStyle : 'width: 100%; max-height: 290px;', menuStyle : 'width: 100%; max-height: 290px;',
editable : false, editable : false,
cls : 'input-group-nr', cls : 'input-group-nr',
data : this.options.formats data : this.options.formats,
disabled : (this.options.formats.length==0)
}); });
if (this.options.formats.length>0)
this.cmbNextStyle.setValue(this.options.formats[0].value); this.cmbNextStyle.setValue(this.options.formats[0].value);
}, },
...@@ -129,7 +130,7 @@ define([ ...@@ -129,7 +130,7 @@ define([
getNextStyle: function () { getNextStyle: function () {
var me = this; var me = this;
return me.cmbNextStyle.getValue(); return (me.options.formats.length>0) ? me.cmbNextStyle.getValue() : null;
}, },
onBtnClick: function(event) { onBtnClick: function(event) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment