@@ -207,16 +207,32 @@ function getTextStyleMarksFromLinkedStyles({ node, pos, editor }) {
207207 const familyMark = styleMarks . find ( ( m ) => m . attrs . fontFamily ) ;
208208
209209 // 4. Compute final fontSize (parse it, fall back to default if invalid)
210- const fontSize = sizeMark
210+ let fontSize = sizeMark
211211 ? ( ( ) => {
212212 const [ value , unit = 'pt' ] = parseSizeUnit ( sizeMark . attrs . fontSize ) ;
213213 return Number . isNaN ( value ) ? defaultSize : `${ value } ${ unit } ` ;
214214 } ) ( )
215215 : defaultSize ;
216216
217217 // 5. Compute final fontFamily (or fall back)
218- const fontFamily = familyMark ?. attrs . fontFamily ?? defaultFont ;
219-
218+ let fontFamily = familyMark ?. attrs . fontFamily ?? defaultFont ;
219+
220+ const firstChild = node . firstChild ;
221+ const hasOnlyOnePar = node . childCount === 1 && firstChild ?. type . name === 'paragraph' ;
222+
223+ // If a list item contains only one annotation,
224+ // then we try to take the font from there.
225+ if ( hasOnlyOnePar ) {
226+ const par = firstChild ;
227+ const parFirstChild = par ?. firstChild ;
228+ if ( par ?. childCount === 1 && parFirstChild ?. type . name === 'fieldAnnotation' ) {
229+ const aFontSize = parFirstChild . attrs . fontSize ;
230+ const aFontFamily = parFirstChild . attrs . fontFamily ;
231+ if ( ! sizeMark && aFontSize ) fontSize = aFontSize ;
232+ if ( ! familyMark && aFontFamily ) fontFamily = aFontFamily ;
233+ }
234+ }
235+
220236 return { fontSize, fontFamily } ;
221237}
222238
0 commit comments