diff --git a/src/lib/export/docx.ts b/src/lib/export/docx.ts index 8d4b77b..c6a0b9e 100644 --- a/src/lib/export/docx.ts +++ b/src/lib/export/docx.ts @@ -373,9 +373,10 @@ function runPropsFromMarks(marks: TiptapNode['marks'] = [], force: TextProps = { if (h) props.shading = { type: ShadingType.CLEAR, fill: h }; } // Visible hyperlink styling (the ExternalHyperlink wrapper carries the target), unless - // the link came in without one — Word draws those like the text around them. + // the link came in without one — Word draws those like the text around them. The blue + // outranks a baked region color, as the editor's a-rule beats the region CSS. if (marks?.some((m) => m.type === 'link' && !m.attrs?.plain)) { - if (!props.color) props.color = '0563C1'; + if (!ts?.attrs?.color) props.color = '0563C1'; if (!props.underline) props.underline = { type: UnderlineType.SINGLE }; } return props; diff --git a/src/lib/export/odt.ts b/src/lib/export/odt.ts index eb79af4..1e2bd9b 100644 --- a/src/lib/export/odt.ts +++ b/src/lib/export/odt.ts @@ -2984,6 +2984,11 @@ function applyRuns(p: ParagraphBuilder | CellBuilder, content: TiptapNode[] = [] const direct = { ...fmt }; Object.assign(fmt, forced, direct); if (!direct.bold && fmt.fontWeight === 'normal') delete fmt.bold; + // A link keeps its own paint: LibreOffice's Internet Link style and the editor's + // a-rule both outrank the region color, so the bake must not override it. + if (!direct.color && node.marks?.some((m) => m.type === 'link' && !m.attrs?.plain)) { + delete fmt.color; + } } // A named character style: bake its resolved formatting (so odf-kit always mints a // span) and mark the run, so applyCharacterStyles can re-point that span at the style.