I am trying to get the Trix editor to work with Phoenix LiveView. The editor is rendering and populating with text, however, I am now trying to use a LiveView JS Hook to get updates to the editor this is not working. I suspect this may have something to do with needing to add a phx-update="ignore" but so far no luck. This editor is also dynamically being added to page so that may be an issue but I’m not sure.
As stated, updated() is a function triggered by the live_view JS when the server is updating the element, not for catching client-side changes.
If you want to send document changes to the server when the editor is updated by the user, you should set up event listeners on the trix element in the mounted() hook function, listening to the relevant editor changes, and then using this.pushEvent(event, payload, (reply, ref) => ...) in the listener to send whatever you want back to the server.
Alternative easier answer is to leverage the trix form integration
Integrating With Forms
To submit the contents of a <trix-editor> with a form, first define a hidden input field in the form and assign it an id. Then reference that id in the editor’s input attribute.