I’m building a menu for PM which has some buttons to toggle marks.
The problem is that when I click said buttons with an empty selection the mark active/inactive state doesn’t seem to change. If I then start typing I can see the mark has been toggled successfully and the active state now has changed as expected.
I’ve recorded this little video:
I can see the editor in the basic example (or the one in ProseMirror’s home page) doesn’t behave like this and returns the correct active marks after using one of the mark buttons with an empty selection.
Just like in the example setup, I’m using
$from.marks() to determine which marks are active on an empty selection. Then I’m simply using the
toggleMark() command to get a function to toggle the marks.
On one hand it makes sense that
$from.marks() will not return the value I’m expecting because the caret is still adjacent to the node with the non toggled mark… but then how come it works in the example setup? Is there anything I’m missing?
Any help is appreciated.