Browse Source

Avoid adding css rules with temporary option

15-beta
artf 8 years ago
parent
commit
d40f1f8dea
  1. 2
      src/block_manager/model/Block.js
  2. 12
      src/dom_components/model/Components.js

2
src/block_manager/model/Block.js

@ -6,7 +6,7 @@ module.exports = Backbone.Model.extend({
// If true, triggers an 'active' event on dropped component // If true, triggers an 'active' event on dropped component
activate: 0, activate: 0,
// If true, the dropped component will be selected // If true, the dropped component will be selected
select: 1, select: 0,
// If true, all IDs of dropped component and its style will be changed // If true, all IDs of dropped component and its style will be changed
resetId: 0, resetId: 0,
label: '', label: '',

12
src/dom_components/model/Components.js

@ -37,11 +37,10 @@ module.exports = Backbone.Collection.extend({
const cssc = em.get('CssComposer'); const cssc = em.get('CssComposer');
const parsed = em.get('Parser').parseHtml(value); const parsed = em.get('Parser').parseHtml(value);
if (parsed.css && cssc) { if (parsed.css && cssc && !opt.temporary) {
const { avoidUpdateStyle } = opt;
cssc.addCollection(parsed.css, { cssc.addCollection(parsed.css, {
extend: 1, ...opt,
avoidUpdateStyle extend: 1
}); });
} }
@ -62,7 +61,7 @@ module.exports = Backbone.Collection.extend({
return Backbone.Collection.prototype.add.apply(this, [models, opt]); return Backbone.Collection.prototype.add.apply(this, [models, opt]);
}, },
onAdd(model, c, opts) { onAdd(model, c, opts = {}) {
const em = this.em; const em = this.em;
const style = model.getStyle(); const style = model.getStyle();
const avoidInline = em && em.getConfig('avoidInlineStyle'); const avoidInline = em && em.getConfig('avoidInlineStyle');
@ -72,7 +71,8 @@ module.exports = Backbone.Collection.extend({
!avoidInline && !avoidInline &&
em && em &&
em.get && em.get &&
em.getConfig('forceClass') em.getConfig('forceClass') &&
!opts.temporary
) { ) {
const name = model.cid; const name = model.cid;
const rule = em.get('CssComposer').setClassRule(name, style); const rule = em.get('CssComposer').setClassRule(name, style);

Loading…
Cancel
Save