if (data.links && this.opts.pasteLinks) {
elBySelAll('a', div, function(link) {
if (link.href) {
- link.outerHTML = '#####[a href="' + link.href + '"]#####' + link.innerHTML + '#####[/a]#####';
+ link.outerHTML = '#@###[a href="' + link.href + '"]###@#' + link.innerHTML + '#@###[/a]###@#';
}
});
html = div.innerHTML;
}
+
+ // The original code uses a slightly different pattern that did not distinguish between the
+ // opening and closing "#####" pattern, causing some degree of ambiguity and false-positives.
+ // links & images
+ if ((data.links && this.opts.pasteLinks) || (data.images && this.opts.pasteImages))
+ {
+ html = html.replace(new RegExp('#@###\\[', 'gi'), '<');
+ html = html.replace(new RegExp('\\]###@#', 'gi'), '>');
+ }
return mpReconvertTags.call(this, html, data);
}).bind(this);