Skip to content

Commit

Permalink
MDL-49565 atto: Allow html comments in editor code
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmerrill committed Mar 18, 2015
1 parent 111141b commit 5cb3403
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
Expand Up @@ -657,11 +657,6 @@ EditorClean.prototype = {
// Reference: "http://stackoverflow.com/questions/1068280/javascript-regex-multiline-flag-doesnt-work" // Reference: "http://stackoverflow.com/questions/1068280/javascript-regex-multiline-flag-doesnt-work"
{regex: /<style[^>]*>[\s\S]*?<\/style>/gi, replace: ""}, {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. // Remove any open HTML comment opens that are not followed by a close. This can completely break page layout.
{regex: /<!--(?![\s\S]*?-->)/gi, replace: ""}, {regex: /<!--(?![\s\S]*?-->)/gi, replace: ""},


Expand Down Expand Up @@ -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). // Rules that get rid of the real-nasties and don't care about normalize code (correct quotes, white spaces, etc).
var rules = [ 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. // Remove any xml blocks.
{regex: /<xml[^>]*>[\s\S]*?<\/xml>/gi, replace: ""}, {regex: /<xml[^>]*>[\s\S]*?<\/xml>/gi, replace: ""},
// Remove any <?xml><\?xml> blocks. // Remove any <?xml><\?xml> blocks.
Expand Down

0 comments on commit 5cb3403

Please sign in to comment.