File tree Expand file tree Collapse file tree
packages/superdoc/src/stores Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -472,12 +472,11 @@ export const useCommentsStore = defineStore('comments', () => {
472472
473473 // Create comments for tracked changes
474474 // that do not have a corresponding comment (created in Word).
475+ const { tr } = editor . view . state ;
476+ const { dispatch } = editor . view ;
477+
475478 groupedChanges . forEach ( ( { insertedMark, deletionMark, formatMark } , index ) => {
476479 console . debug ( `Create comment for track change: ${ index } ` ) ;
477-
478- const { dispatch } = editor . view ;
479- const { tr } = editor . view . state ;
480-
481480 const foundComment = commentsList . value . find (
482481 ( i ) =>
483482 i . commentId === insertedMark ?. mark . attrs . id ||
@@ -489,7 +488,6 @@ export const useCommentsStore = defineStore('comments', () => {
489488 if ( foundComment ) {
490489 if ( isLastIteration ) {
491490 tr . setMeta ( CommentsPluginKey , { type : 'force' } ) ;
492- dispatch ( tr ) ;
493491 }
494492 return ;
495493 }
@@ -504,9 +502,10 @@ export const useCommentsStore = defineStore('comments', () => {
504502 if ( isLastIteration ) tr . setMeta ( CommentsPluginKey , { type : 'force' } ) ;
505503 tr . setMeta ( CommentsPluginKey , { type : 'forceTrackChanges' } ) ;
506504 tr . setMeta ( TrackChangesBasePluginKey , trackChangesPayload ) ;
507- dispatch ( tr ) ;
508505 }
509506 } ) ;
507+
508+ dispatch ( tr ) ;
510509 } ;
511510
512511 const translateCommentsForExport = ( ) => {
You can’t perform that action at this time.
0 commit comments