Skip to content
Permalink
Browse files

MDL-49565 atto: Allow html comments in editor code

  • Loading branch information...
merrill-oakland committed Mar 18, 2015
1 parent 111141b commit 5cb340368f81bf707921ed7eeccd2a88b1d31b8f
@@ -657,11 +657,6 @@ EditorClean.prototype = {
// Reference: "http://stackoverflow.com/questions/1068280/javascript-regex-multiline-flag-doesnt-work"
{regex: /<style[^>]*>[\s\S]*?<\/style>/gi, replace: ""},

// Source: "http://stackoverflow.com/questions/2875027/clean-microsoft-word-pasted-text-using-javascript"
// Source: "http://stackoverflow.com/questions/1068280/javascript-regex-multiline-flag-doesnt-work"
// Remove all HTML comments.
{regex: /<!--[\s\S]*?-->/gi, replace: ""},

// Remove any open HTML comment opens that are not followed by a close. This can completely break page layout.
{regex: /<!--(?![\s\S]*?-->)/gi, replace: ""},

@@ -832,6 +827,11 @@ EditorClean.prototype = {

// Rules that get rid of the real-nasties and don't care about normalize code (correct quotes, white spaces, etc).
var rules = [
// Stuff that is specifically from MS Word and similar office packages.
// Remove if comment blocks.
{regex: /<!--\[if[\s\S]*?endif\]-->/gi, replace: ""},
// Remove start and end fragment comment blocks.
{regex: /<!--(Start|End)Fragment-->/gi, replace: ""},
// Remove any xml blocks.
{regex: /<xml[^>]*>[\s\S]*?<\/xml>/gi, replace: ""},
// Remove any <?xml><\?xml> blocks.

0 comments on commit 5cb3403

Please sign in to comment.
You can’t perform that action at this time.