@@ -506,7 +506,7 @@ function shouldRebuildForChanges(update: ViewUpdate, plugin: EmbedMetadataPlugin
506506 const nextFrontmatter = getFrontmatterRange ( nextDoc ) ;
507507 let needsRebuild = false ;
508508
509- update . changes . iterChanges ( ( fromA , toA , fromB , toB , inserted ) => {
509+ update . changes . iterChanges ( ( fromA , toA , fromB , toB , _inserted ) => {
510510 if ( needsRebuild ) {
511511 return ;
512512 }
@@ -668,31 +668,23 @@ class MetadataWidget extends WidgetType {
668668
669669 // Render the replacement widget node for a single syntax marker.
670670 toDOM ( ) : HTMLElement {
671- const span = document . createElement ( "span" ) ;
671+ const span = window . activeDocument . createElement ( "span" ) ;
672672 applyValueStyles ( span , this . plugin . settings ) ;
673673 let container = span ;
674674 if ( this . markdownStyle . highlight ) {
675- const mark = document . createElement ( "mark" ) ;
676- mark . classList . add ( "cm-highlight" ) ;
677- container . appendChild ( mark ) ;
675+ const mark = container . createEl ( "mark" , { cls : "cm-highlight" } ) ;
678676 container = mark ;
679677 }
680678 if ( this . markdownStyle . strike ) {
681- const del = document . createElement ( "del" ) ;
682- del . classList . add ( "cm-strikethrough" ) ;
683- container . appendChild ( del ) ;
679+ const del = container . createEl ( "del" , { cls : "cm-strikethrough" } ) ;
684680 container = del ;
685681 }
686682 if ( this . markdownStyle . bold ) {
687- const strong = document . createElement ( "strong" ) ;
688- strong . classList . add ( "cm-strong" ) ;
689- container . appendChild ( strong ) ;
683+ const strong = container . createEl ( "strong" , { cls : "cm-strong" } ) ;
690684 container = strong ;
691685 }
692686 if ( this . markdownStyle . italic ) {
693- const em = document . createElement ( "em" ) ;
694- em . classList . add ( "cm-em" ) ;
695- container . appendChild ( em ) ;
687+ const em = container . createEl ( "em" , { cls : "cm-em" } ) ;
696688 container = em ;
697689 }
698690 renderInlineMarkdown ( this . plugin . app , this . sourcePath , container , this . value , this . plugin ) ;
0 commit comments