From: Aleksander Ɓukasz Date: Thu, 18 Apr 2013 14:12:37 +0000 (+0200) Subject: Visual editor: fixing transformations X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/4f821bed58088f0c808e7cf912edb7a680def3ef?ds=sidebyside;hp=772c62777422069420bbe90f5b1340e9387fead3 Visual editor: fixing transformations --- diff --git a/modules/visualEditor.transformations.js b/modules/visualEditor.transformations.js index 725aaea..0f89641 100644 --- a/modules/visualEditor.transformations.js +++ b/modules/visualEditor.transformations.js @@ -20,8 +20,10 @@ if(typeof module !== 'undefined' && module.exports) { tagName = tagName.toLowerCase(); console.log('running ' + tagName); toret.find(tagName).replaceWith(function() { - var toret = $('
').attr('wlxml-tag', tagName); var currentTag = $(this); + if(currentTag.attr('wlxml-tag')) + return; + var toret = $('
').attr('wlxml-tag', tagName); if(currentTag.attr('class')) toret.attr('wlxml-class', currentTag.attr('class').replace(/\./g, '-')); toret.append(currentTag.contents()); @@ -33,6 +35,8 @@ if(typeof module !== 'undefined' && module.exports) { tagName = tagName.toLowerCase(); toret.find(tagName).replaceWith(function() { var currentTag = $(this); + if(currentTag.attr('wlxml-tag')) + return; var toret = $('').attr('wlxml-tag', tagName); if(currentTag.attr('class')) toret.attr('wlxml-class', currentTag.attr('class').replace(/\./g, '-'));