File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,7 +68,6 @@ function getActiveAttributes(state) {
6868 else state . doc . nodesBetween ( from , to , ( node ) => getAttrs ( node ) ) ;
6969 return attributes ;
7070 } catch ( error ) {
71- console . debug ( 'Error getting active attributes:' , error ) ;
7271 return { } ;
7372 }
7473}
Original file line number Diff line number Diff line change @@ -183,12 +183,14 @@ export const CommentsPlugin = Extension.create({
183183
184184 shouldUpdate = true ;
185185 editor . emit ( 'commentsUpdate' , update ) ;
186+
187+ const { tr : newTr } = editor . view . state ;
188+ const { dispatch } = editor . view ;
189+ newTr . setMeta ( CommentsPluginKey , { type : 'force' } ) ;
190+ dispatch ( newTr ) ;
186191 } ;
187192 } ;
188193
189- const { allCommentPositions } = pluginState ;
190- editor . emit ( 'comment-positions' , { activeThreadId, allCommentPositions } ) ;
191-
192194 return pluginState
193195 } ,
194196 } ,
@@ -207,7 +209,7 @@ export const CommentsPlugin = Extension.create({
207209 update ( view , prevState ) {
208210 const { state } = view
209211 const { doc, tr } = state
210-
212+
211213 if ( prevDoc && prevDoc . eq ( doc ) && ! shouldUpdate ) return ;
212214 prevDoc = doc ;
213215 shouldUpdate = false ;
@@ -280,6 +282,7 @@ export const CommentsPlugin = Extension.create({
280282
281283 // Remember the new decorations for next time
282284 prevDecorations = decorationSet
285+
283286 } ,
284287 }
285288 } ,
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ const resetLayout = async () => {
118118 verticalOffset .value = 0 ;
119119};
120120
121- watch (activeComment, () => {
121+ watch (activeComment, (newVal , oldVal ) => {
122122 nextTick (() => {
123123 if (! activeComment .value ) return verticalOffset .value = 0 ;
124124
@@ -130,10 +130,9 @@ watch(activeComment, () => {
130130
131131 const selectionTop = comment .selection .selectionBounds .top ;
132132 const renderedTop = renderedItem .top ;
133- const scrollY = window .scrollY ;
134133
135134 const editorBounds = floatingCommentsContainer .value .getBoundingClientRect ();
136- verticalOffset .value = selectionTop - renderedTop - editorBounds . top + scrollY ;
135+ verticalOffset .value = selectionTop - renderedTop;
137136
138137 setTimeout (() => {
139138 renderedItem .elementRef .value ? .scrollIntoView ({
Original file line number Diff line number Diff line change @@ -513,6 +513,8 @@ export const useCommentsStore = defineStore('comments', () => {
513513 . filter ( ( c ) => ! c . resolvedTime )
514514 . filter ( ( c ) => {
515515 const keys = Object . keys ( editorCommentPositions . value ) ;
516+ console . debug ( '[getFloatingComments] editorCommentPositions' , keys )
517+
516518 return keys . includes ( c . commentId ) ;
517519 } ) ;
518520 return comments ;
You can’t perform that action at this time.
0 commit comments