Skip to content

Commit

Permalink
Merge branch 'MDL-49686-28' of git://github.com/merrill-oakland/moodl…
Browse files Browse the repository at this point in the history
…e into MOODLE_28_STABLE

Conflicts:
	lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
  • Loading branch information
andrewnicols committed Apr 1, 2015
2 parents 47f8e3e + 42fb2c1 commit 240d90b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1301,12 +1301,20 @@ EditorClean.prototype = {

// Run some more rules that care about quotes and whitespace.
rules = [
// Remove MSO-blah, MSO:blah in style attributes. Only removes one or more that appear in succession.
{regex: /(<[^>]*?style\s*?=\s*?"[^>"]*?)(?:[\s]*MSO[-:][^>;"]*;?)+/gi, replace: "$1"},
// Remove MSO classes in class attributes. Only removes one or more that appear in succession.
{regex: /(<[^>]*?class\s*?=\s*?"[^>"]*?)(?:[\s]*MSO[_a-zA-Z0-9\-]*)+/gi, replace: "$1"},
// Remove Apple- classes in class attributes. Only removes one or more that appear in succession.
{regex: /(<[^>]*?class\s*?=\s*?"[^>"]*?)(?:[\s]*Apple-[_a-zA-Z0-9\-]*)+/gi, replace: "$1"},
// Get all style attributes so we can work on them.
{regex: /(<[^>]*?style\s*?=\s*?")([^>"]*)(")/gi, replace: function(match, group1, group2, group3) {
// Remove MSO-blah, MSO:blah style attributes.
group2 = group2.replace(/(?:^|;)[\s]*MSO[-:](?:&[\w]*;|[^;"])*/gi,"");
return group1 + group2 + group3;
}},
// Get all class attributes so we can work on them.
{regex: /(<[^>]*?class\s*?=\s*?")([^>"]*)(")/gi, replace: function(match, group1, group2, group3) {
// Remove MSO classes.
group2 = group2.replace(/(?:^|[\s])[\s]*MSO[_a-zA-Z0-9\-]*/gi,"");
// Remove Apple- classes.
group2 = group2.replace(/(?:^|[\s])[\s]*Apple-[_a-zA-Z0-9\-]*/gi,"");
return group1 + group2 + group3;
}},
// Remove OLE_LINK# anchors that may litter the code.
{regex: /<a [^>]*?name\s*?=\s*?"OLE_LINK\d*?"[^>]*?>\s*?<\/a>/gi, replace: ""}
];
Expand Down
Loading

0 comments on commit 240d90b

Please sign in to comment.