return {
init: function () {
+ this.opts.pasteInlineTags = this.opts.pasteInlineTags.filter(function (value) {
+ return (value !== 'span');
+ });
+
var mpOnSet = this.clean.onSet;
this.clean.onSet = (function (html) {
return mpOnSet.call(this, html.replace(/\u200B/g, ''));
var mpOnSync = this.clean.onSync;
this.clean.onSync = (function (html) {
- var div, replacements = {};
+ var div = elCreate('div');
+ var replacements = {};
+
if (html.indexOf('<pre') !== -1) {
- div = elCreate('div');
div.innerHTML = html;
elBySelAll('pre', div, function (pre) {
html = mpOnSync.call(this, html);
- if (div) {
- div.innerHTML = html;
-
- elBySelAll('pre', div, function (pre) {
+ div.innerHTML = html;
+
+ elBySelAll('span', div, function (span) {
+ span.outerHTML = span.innerHTML;
+ });
+ elBySelAll('pre', div, function (pre) {
+ if (replacements.hasOwnProperty(pre.textContent)) {
pre.textContent = replacements[pre.textContent];
- });
-
- html = div.innerHTML;
- }
+ }
+ });
+
+ html = div.innerHTML;
return html;
}).bind(this);
return html;
}).bind(this);
+
+ var mpStripTags = this.clean.stripTags;
+ this.clean.stripTags = (function(input, denied) {
+ if (Array.isArray(denied)) {
+ denied.push('span');
+ }
+
+ return mpStripTags.call(this, input, denied);
+ }).bind(this);
}
}
};