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([
}
},
clearComboView: function() {
this.fieldPicker.store.reset([]);
},
selectByIndex: function(index) {
if (index < 0)
this.fieldPicker.deselectAll();
......
......@@ -733,7 +733,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();
......@@ -1892,7 +1892,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);
......@@ -2630,7 +2630,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;
},
......
......@@ -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) {
......
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