mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
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:
commit
82cf09885c
4 changed files with 45 additions and 21 deletions
|
@ -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
|
@ -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: ""}
|
||||||
];
|
];
|
||||||
|
|
20
lib/editor/atto/yui/src/editor/js/clean.js
vendored
20
lib/editor/atto/yui/src/editor/js/clean.js
vendored
|
@ -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: ""}
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue