I would like the editor view to perform a certain functionality but only if a certain transaction is enacted. Is that possible? In other words, I’m not sure how to specify the editor view to render specific widget decorations only when specific menu options are clicked.
This sounds more like you need a custom state field that is set to a different value by some custom transaction (use transaction metadata to signal the change), and decorations that are maintained differently based on the value of that state field.
I’ve been following this example, but I’m a bit confused why the example doesn’t work a second time. When I try to upload an image a second time, the transaction doesn’t go through. Is this because of the state field you’re mentioning?
That’s not happening for me—the example seems to work when I add multiple images in a row.
The widget decorations are now working, but in the use case of an author going into the RTE, adding some text with widgets, saves the data, closes the space, and then opens the RTE again to load the saved data, would the widget decorations still load? Where the special characters have widgets, would these widgets still be there upon closing the RTE?
If you wrote the plugin, you know how it works and should be able to answer that (i.e. it depends on where you got the data that determines what widgets to render)
Okay, and is it possible for an undo action (command-Z) to apply to widget decorations as well? If a widget is “typed,” is there a way to command Z it without adding that functionality to a specific menubar button? (We do not have undo / redo buttons as part of the menubar.)
No, the prosemirror-history package only manages the document, no other data.