Merge branch 'MDL-49686-master' of git://github.com/merrill-oakland/moodle

Conflicts:
	lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
This commit is contained in:
Eloy Lafuente (stronk7) 2015-04-02 11:08:11 +02:00
commit 82cf09885c
4 changed files with 45 additions and 21 deletions

View file

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

File diff suppressed because one or more lines are too long

View file

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

View file

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