MDL-50795 atto: Pasting into atto removes background colour style.

Copying from one atto editor to another comes with a lot of style
information. This removes the color attributes which make the page
look ugly when competing with different themes.
This commit is contained in:
Adrian Greeve
2016-03-26 09:32:08 +08:00
committed by Dan Poltawski
parent a30a81e3a0
commit 53d2f810ea
4 changed files with 9 additions and 3 deletions
@@ -1314,6 +1314,8 @@ EditorClean.prototype = {
{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,"");
// Remove backgroud color style.
group2 = group2.replace(/background-color:.*?;/gi,"");
return group1 + group2 + group3;
}},
// Get all class attributes so we can work on them.
File diff suppressed because one or more lines are too long
@@ -1303,6 +1303,8 @@ EditorClean.prototype = {
{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,"");
// Remove backgroud color style.
group2 = group2.replace(/background-color:.*?;/gi,"");
return group1 + group2 + group3;
}},
// Get all class attributes so we can work on them.
+2
View File
@@ -290,6 +290,8 @@ EditorClean.prototype = {
{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,"");
// Remove backgroud color style.
group2 = group2.replace(/background-color:.*?;/gi,"");
return group1 + group2 + group3;
}},
// Get all class attributes so we can work on them.