Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export const getRunBooleanProp = (run: Run, prop: string): boolean => {
* @returns The underline style or empty string if not present
*/
export const getRunUnderlineStyle = (run: Run): string => {
if ('underline' in run && typeof run.underline === 'boolean') {
return run.underline ? 'single' : '';
}
if ('underline' in run && run.underline && typeof run.underline === 'object') {
return (run.underline as { style?: string }).style ?? '';
}
Expand Down
12 changes: 9 additions & 3 deletions packages/layout-engine/pm-adapter/src/converters/paragraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,16 @@ export function fieldAnnotationNodeToRun(
if (typeof textHighlight === 'string') run.textHighlight = textHighlight;

// Text formatting
// Prefer explicit attrs on the annotation node; they should override metadata formatting.
const formatting = fieldMetadata?.formatting;
if (attrs.bold === true || formatting?.bold === true) run.bold = true;
if (attrs.italic === true || formatting?.italic === true) run.italic = true;
if (attrs.underline === true || formatting?.underline === true) run.underline = true;
if (attrs.bold === true) run.bold = true;
else if (attrs.bold !== false && formatting?.bold === true) run.bold = true;

if (attrs.italic === true) run.italic = true;
else if (attrs.italic !== false && formatting?.italic === true) run.italic = true;

if (attrs.underline === true) run.underline = true;
else if (attrs.underline !== false && formatting?.underline === true) run.underline = true;

// Position tracking
const pos = positions.get(node);
Expand Down
Loading