Impossible to dynamically update data without re-rendering the entire Editor
TehBunk opened this issue · comments
Seems like a severe limitation of unlayer is the inability to update options or data after the component has been initialized.
There's a clear way to pass data to a custom tool but passing data in this manor will trigger a re-render when updated.
When building a custom tool much like the product library custom tool you are forced to re-render if you want to update the products they can select from.
-
Is it possible to add a method on the unlayer editor to update tool data dynamically?
This would allow users to update data for their tools, without reloading unlocking tons of possibilities.
Or maybe the addition of some alternative method of dynamically showing data without re-renders. -
Is it possible to allow users to define custom events for their custom tools?
This would allow users to trigger code within in react components that have access to the emailEditorRef
// Similar to
unlayer.addEventListener('design:loaded', function (data) {
console.log('design:loaded', data);
})
// or maybe callback if possible even
unlayer.registerCallback('selectImage', function (data: any, done) {
done({ url: "" })
})
// would be nice to have it be able to edit the data for the custom tools
unlayer.registerCallback('custom#tool', function (data: any, done) {
done(data) // <- returns updated data?
})
- Is it possible to add the addition of methods to change the device option -> from mobile, tablet, desktop dynamically
unlayer.setDevice("email")
Similar issues OR issues that this would fix
#202
#224
#194
CC @brunolemos
@TehBunk @brunolemos Did you guys find the solution to this issue?
Did you guys find the solution to this issue?
No, this is still an issue that needs to be addressed.
I am currently using logic similar to that seen in the product library custom tool but it leaves a-lot to be desired and still doesn't quite work as you would hope.
It requires a re-render every time data is updated/added, is slow, and only supports limited usage/use cases