From: Aleksander Ɓukasz Date: Mon, 31 Mar 2014 14:02:24 +0000 (+0200) Subject: fourth batch: fixing blocking span - passing all tests, linting X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/0aa084a086d61520e1e8525bec2ac5d0290c7534 fourth batch: fixing blocking span - passing all tests, linting --- diff --git a/src/editor/modules/documentCanvas/canvas/genericElement.js b/src/editor/modules/documentCanvas/canvas/genericElement.js index 7d5d986..8b7d2fb 100644 --- a/src/editor/modules/documentCanvas/canvas/genericElement.js +++ b/src/editor/modules/documentCanvas/canvas/genericElement.js @@ -2,7 +2,8 @@ define(function(require) { 'use strict'; -var documentElement = require('./documentElement'), +var $ = require('libs/jquery'), + documentElement = require('./documentElement'), utils = require('./utils'), wlxmlUtils = require('utils/wlxml'); @@ -143,6 +144,19 @@ var generic = { this.wlxmlNode.contents().forEach(function(node) { this._container().append(this.canvas.createElement(node).dom()); }.bind(this)); + this.refresh(); + + }, + refresh: function() { + if(this.wlxmlNode.getTagName() === 'span') { + if(this.containsBlock()) { + this.displayAsBlock(); + } else { + this.displayInline(); + } + } else { + this.displayAsBlock(); + } }, containsBlock: function() { return this.children()