Closed delashum closed 6 months ago
If I understand correctly per the conversation in https://github.com/ProseMirror/prosemirror/issues/721 the callback provided to the widget shouldn't be called until the view has fully applied the state changes so this seems like a bug.
You didn't understand that correctly. This callback is called to draw the widget, so as part of the update. It should just draw the widget, possibly saving the view
reference to use in event handlers, and definitely not poke around in the editor DOM.
Problem
The specific problem I am trying to solve it to draw an outline around the entire table selection when the selection changes but I am running into a case where the widget is being painted before the DOM has updated so I don't have access to the latest DOM. If I understand correctly per the conversation in https://github.com/ProseMirror/prosemirror/issues/721 the callback provided to the widget shouldn't be called until the view has fully applied the state changes so this seems like a bug.
Minimal repro
https://codesandbox.io/p/sandbox/dreamy-swartz-s23w7h?file=%2Fsrc%2Findex.js