Permalink
Browse files

Updated clean plugin to ignore supplementary elements

  • Loading branch information...
1 parent dfd6c14 commit 8f31bd731655c513facda279d9392e9c6b134952 @faceleg faceleg committed Aug 16, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/plugins/clean/jquery.ui.editor.clean.js
View
9 src/plugins/clean/jquery.ui.editor.clean.js
@@ -69,13 +69,18 @@
editor.getElement()
.find(this.options.stripEmptyTags[i])
.filter(function() {
- if ($.trim($(this).html()) === '') {
- return true;
+ // Do not remove ignored elements. Inserter is responsible for these.
+ if ($(this).hasClass(plugin.options.supplementaryClass)) {
+ return false;
}
// Do not clear selection markers if the editor has it in use
if ($(this).hasClass('rangySelectionBoundary') && selectionSaved() === false) {
return true;
}
+ // Finally, remove empty elements
+ if ($.trim($(this).html()) === '') {
+ return true;
+ }
})
.remove();
}

0 comments on commit 8f31bd7

Please sign in to comment.