unlayer / react-email-editor

Drag-n-Drop Email Editor Component for React.js
https://unlayer.com/
MIT License
4.57k stars 740 forks source link

Pass data to custom tools after editor initialization #202

Open eladkarakuli opened 3 years ago

eladkarakuli commented 3 years ago

Hi,

I'm building a custom tool much like the product library custom tool But, in order to paginate, search and show available products I would like to be able to pass and change the data after the initialization of the editor

there's a clear way to pass data to a custom tool but it seems that there's no way to update or pass again different data after the initialization

Thank you very much

faizan-ali commented 3 years ago

@eladkarakuli Hmm that's an interesting problem. You could trigger a forced re-render of the Editor component whenever the data is updated in order to reflect the changes? This would mean holding editor state in some sort of wrapper component around the editor (so you don't lose it on re-render) and managing it via the design:updated event listener.

gdvalderrama commented 2 years ago

The problem is not re-rendering, the problem is being able to paginate through a list API endpoint. Say your product custom tool had thousands of products, how could we go about allowing the user to search for those products and insert any of them?

It's unrealistic to expect an API to return all products without pagination, but data can only be passed when initializing, and will not contain all products.

Drashti-Shah commented 6 months ago

did anyone find the solution to this issue?