Browse Source

Pass properly options in setStyle. Fixes #3176

pull/3264/head
Artur Arseniev 6 years ago
parent
commit
bc0983d8f3
  1. 4
      src/css_composer/index.js
  2. 8
      src/editor/model/Editor.js

4
src/css_composer/index.js

@ -257,8 +257,8 @@ export default () => {
* Remove all rules * Remove all rules
* @return {this} * @return {this}
*/ */
clear() { clear(opts = {}) {
this.getAll().reset(); this.getAll().reset(null, opts);
return this; return this;
}, },

8
src/editor/model/Editor.js

@ -453,14 +453,14 @@ export default Backbone.Model.extend({
/** /**
* Set style inside editor's canvas. This method overrides actual style * Set style inside editor's canvas. This method overrides actual style
* @param {Object|string} style CSS string or style model * @param {Object|string} style CSS string or style model
* @param {Object} opt the options object to be used by the [CssRules.add]{@link rules#add} method * @param {Object} opt the options object to be used by the `CssRules.add` method
* @return {this} * @return {this}
* @private * @private
*/ */
setStyle(style, opt = {}) { setStyle(style, opt = {}) {
var rules = this.get('CssComposer').getAll(); const cssc = this.get('CssComposer');
for (var i = 0, len = rules.length; i < len; i++) rules.pop(); cssc.clear(opt);
rules.add(style, opt); cssc.getAll().add(style, opt);
return this; return this;
}, },

Loading…
Cancel
Save