react-email-editor icon indicating copy to clipboard operation
react-email-editor copied to clipboard

Pass data to custom tools after editor initialization

Open eladkarakuli opened this issue 3 years ago • 3 comments

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

eladkarakuli avatar Jun 28 '21 20:06 eladkarakuli

@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.

faizan-ali avatar Sep 08 '21 22:09 faizan-ali

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.

gdvalderrama avatar Jan 25 '22 11:01 gdvalderrama

did anyone find the solution to this issue?

Drashti-Shah avatar Apr 05 '24 12:04 Drashti-Shah