Hi! We're looking into using Motion, and noticed an issue when we were trying to render a Trix editor inside a motion component.
We've noticed that when using a custom element, upon re-render of the component, attributes on that component are lost. You can see a simple example if you had an element which was initialized this way:
But after the element is clicked and the component is re-rendered:
<foo-bar data-motion="click->update"></foo-bar>
This is actually preventing us from being able to have a form with a rich text field using Actiontext/Trix editor since Trix uses custom elements to build the editor on render.
We were wondering if there was a missing step to get custom elements working or if that is a limitation/issue with motion at this time. Thanks so much for taking a look!
Hi! We're looking into using Motion, and noticed an issue when we were trying to render a Trix editor inside a motion component.
We've noticed that when using a custom element, upon re-render of the component, attributes on that component are lost. You can see a simple example if you had an element which was initialized this way:
which is attached in a component:
(with a
component.rb
file that has a mapped#update
method)Upon initial page load, the element looks like this:
But after the element is clicked and the component is re-rendered:
This is actually preventing us from being able to have a form with a rich text field using Actiontext/Trix editor since Trix uses custom elements to build the editor on render. We were wondering if there was a missing step to get custom elements working or if that is a limitation/issue with motion at this time. Thanks so much for taking a look!