X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/690fb9ef0a8964fb7b7f18eb8c7243ac03cf4b47..6c3dfb35e4a92d05de9ffcfd7d6e23a9a9cb32fe:/modules/visualEditor.transformations.js?ds=sidebyside diff --git a/modules/visualEditor.transformations.js b/modules/visualEditor.transformations.js index 49f9aa3..7374f2e 100644 --- a/modules/visualEditor.transformations.js +++ b/modules/visualEditor.transformations.js @@ -20,8 +20,7 @@ if(typeof module !== 'undefined' && module.exports) { tagName = tagName.toLowerCase(); console.log('running ' + tagName); toret.find(tagName).replaceWith(function() { - var suffix = tagName !== 'div' ? tagName : 'block'; - var toret = $('
').attr('wlxml-tag', suffix); + var toret = $('').attr('wlxml-tag', tagName); var currentTag = $(this); if(currentTag.attr('class')) toret.attr('wlxml-class', currentTag.attr('class')); @@ -69,7 +68,11 @@ if(typeof module !== 'undefined' && module.exports) { toret.find('div, span').replaceWith(function() { var div = $(this); var tagName = div.attr('wlxml-tag'); - return $('<'+tagName+'>').append(div.contents()); + var toret = $('<'+tagName+'>'); + if(div.attr('wlxml-class')) + toret.attr('class', div.attr('wlxml-class')) + toret.append(div.contents()); + return toret; }); var meta = $('