diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 184d2d316..45a2178f0 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -10,6 +10,7 @@ define(['backbone', 'backboneUndo', 'keymaster', 'Utils', 'StorageManager', 'Dev defaults: { clipboard: null, + designerMode: false, selectedComponent: null, previousModel: null, changesCount: 0, @@ -36,7 +37,7 @@ define(['backbone', 'backboneUndo', 'keymaster', 'Utils', 'StorageManager', 'Dev M.onLoad(); }); - this.initUndoManager(); // Is already called (inside components and css composer) + this.initUndoManager(); this.on('change:selectedComponent', this.componentSelected, this); this.on('change:changesCount', this.updateBeforeUnload, this); diff --git a/src/parser/model/ParserCss.js b/src/parser/model/ParserCss.js index 10638aa6a..22e6855d3 100644 --- a/src/parser/model/ParserCss.js +++ b/src/parser/model/ParserCss.js @@ -80,7 +80,10 @@ define(function(require) { var stl = node.style; var style = {}; for (var j = 0, len2 = stl.length; j < len2; j++) { - style[stl[j]] = stl[stl[j]]; + var propName = stl[j]; + var important = stl.getPropertyPriority(propName); + style[propName] = stl[propName] + + (important ? ' !' + important : ''); } var lastRule = ''; diff --git a/test/specs/parser/model/ParserCss.js b/test/specs/parser/model/ParserCss.js index b3ddf7b6c..702192ec6 100644 --- a/test/specs/parser/model/ParserCss.js +++ b/test/specs/parser/model/ParserCss.js @@ -176,6 +176,19 @@ define([path + 'model/ParserCss',], obj.parse(str).should.deep.equal(result); }); + it('Parse rule with important styles', function() { + var str = ' .test1 {color:red !important; width: 100px; height: 10px !important}'; + var result = { + selectors: ['test1'], + style: { + color: 'red !important', + height: '10px !important', + width: '100px', + } + }; + obj.parse(str).should.deep.equal(result); + }); + }); }