From 4fda2358b0f64537a9d022fc2e20380cec5bf191 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 6 Dec 2019 14:08:59 +1000 Subject: [PATCH] handle formatting from google docs --- web/editor.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/editor.js b/web/editor.js index d75ffe235..30732088d 100644 --- a/web/editor.js +++ b/web/editor.js @@ -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);