diff --git a/src/lib/editor/fontColor.ts b/src/lib/editor/fontColor.ts index 7e1057c..65de1aa 100644 --- a/src/lib/editor/fontColor.ts +++ b/src/lib/editor/fontColor.ts @@ -33,7 +33,7 @@ export const FontColor = Extension.create({ renderHTML: attributes => { if (!attributes.color) return {}; return { - style: `color: ${attributes.color}`, + style: `--font-color: ${attributes.color}; color: ${attributes.color}`, 'data-color': attributes.color, }; }, diff --git a/src/styles/editor.css b/src/styles/editor.css index 02fe0f4..053ef6a 100644 --- a/src/styles/editor.css +++ b/src/styles/editor.css @@ -263,6 +263,14 @@ } } +/* Fallback channel: drive color from the --font-color custom property so the + visible color survives even if ProseMirror's incremental DOM update leaves + a reused span with a stale `style` attribute that no longer contains + `color:`. The inline `color:` declaration still wins when present. */ +.tiptap [data-color] { + color: var(--font-color, currentColor); +} + /* allBlack theme: force all explicitly-colored text to the page text color. The color is still stored on the textStyle mark, so .odt exports remain faithful. */ [data-theme="allBlack"] .tiptap [data-color] {