Skip to content

Commit 8ac4dd3

Browse files
authored
Remove color while pasting text (#6061)
1 parent 9e93d05 commit 8ac4dd3

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

client/src/app/ui/modules/editor/components/editor/extensions/clear-textcolor.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ const ClearTextcolorPastePlugin = new Plugin({
2121
continue;
2222
}
2323

24-
const isTextBlack = !el.style.color || tinycolor(el.style.color).toHex() === `000000`;
25-
const isBgWhite = !el.style.backgroundColor || tinycolor(el.style.backgroundColor).toHex() === `ffffff`;
26-
if (isTextBlack && isBgWhite) {
24+
const textColor = !el.style.color || tinycolor(el.style.color).toHex();
25+
const bgColor = !el.style.backgroundColor || tinycolor(el.style.backgroundColor).toHex();
26+
27+
if (
28+
(textColor === `000000` && bgColor === `ffffff`) ||
29+
(textColor === `ffffff` && bgColor === `424242`)
30+
) {
2731
el.style.color = ``;
2832
el.style.backgroundColor = ``;
2933
}

0 commit comments

Comments
 (0)