Remove Redactor-specific markup and attributes from the edited text.

This commit is contained in:
alekseybobkov 2015-01-15 21:35:39 -08:00
parent b25606ddd1
commit 39c4ec6371
1 changed files with 21 additions and 1 deletions

View File

@ -139,7 +139,27 @@
}
this.$textarea.trigger('syncBefore.oc.richeditor', [container])
return container.html
var $domTree = $('<div>'+container.html+'</div>')
// This code removes Redactor-specific attributes and tags from the code.
// It seems to be a known problem with Redactor, try googling for
// "data-redactor-tag" or "redactor-invisible-space" (with quotes)
$('*', $domTree).removeAttr('data-redactor-tag')
$domTree.find('span[data-redactor-class="redactor-invisible-space"]').each(function(){
$(this).children().insertBefore(this)
$(this).remove()
})
$domTree.find('span.redactor-invisible-space').each(function(){
$(this).children().insertBefore(this)
$(this).remove()
})
$domTree.find('div.oc-figure-controls').remove()
return $domTree.html()
}
RichEditor.prototype.keydown = function(e, $editor) {