I have a text editor that mounts via a hook:
const TextEditorHook = {
updated() {
mountTrumbowyg(this)
},
mounted() {
mountTrumbowyg(this)
},
reconnected() {
mountTrumbowyg(this)
}
}
mountTrumbowyg
is nothing to fancy, just initializing the Trumbowyg editor.
I’ve been using this hook in a LiveView for a few years with no issue. Now I am trying to wire up another textfield, in a separate LiveView:
<div class="form-group">
<%= label f, :description %>
<%= textarea f, :description, class: control_classes(f, :description), phx_hook: "TextEditorHook" %>
</div>
Same set up as the first however every time an event happens the text editor disappears:
Both of these LiveViews are fairly simple, structured much the same way. I do remember a similar issue when I implemented the first one years back but I solved it by adding updated
to the hook.