handle formatting from google docs

This commit is contained in:
Damien Elmes 2019-12-06 14:08:59 +10:00
parent e2d7e5a8d7
commit 4fda2358b0

View file

@ -396,6 +396,9 @@ allowedTagsExtended["FONT"] = {"attrs": ["COLOR"]};
const allowedStyling = {
'color': true,
'background-color': true,
'font-weight': true,
'font-style': true,
'text-decoration-line': true,
};
var filterExternalSpan = function(node) {
@ -418,6 +421,10 @@ var filterExternalSpan = function(node) {
if (!allowedStyling.hasOwnProperty(name)) {
toRemove.push(name);
}
if (name === 'background-color' && node.style[name] === "transparent") {
// google docs adds this unnecessarily
toRemove.push(name);
}
}
for (let name of toRemove) {
node.style.removeProperty(name);