unlayer / react-email-editor

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

loading template in react-email-editor #392

Open Anubhavgarg1910 opened 4 months ago

Anubhavgarg1910 commented 4 months ago

Hey I am using react-email-editor in my project. It's working fine just an isssue. I am getting html Document but I want it to load in my react-editor initially . Is there any predefined function so that I can load my html to json and render it. please help me with this looking for a solution from a long time.

SouravBandyopadhyay commented 3 months ago

As per documentation you can not load html directly you have to convert it into json

Anubhavgarg1910 commented 3 months ago

How can I convert in Json?

On Thu, 25 Apr, 2024, 7:01 pm Sourav Bandyopadhyay, < @.***> wrote:

As per documentation you can not load html directly you have to convert it into json

— Reply to this email directly, view it on GitHub https://github.com/unlayer/react-email-editor/issues/392#issuecomment-2077188061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ56NUSOAYSRV4CI4RFI75DY7EARRAVCNFSM6AAAAABF3DSPQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZXGE4DQMBWGE . You are receiving this because you authored the thread.Message ID: @.***>

SouravBandyopadhyay commented 3 months ago

As of now from my knowledge there is no direct way to convert html to json such that unlayer editor can read it out. You can take reference from the below issue as well:

sarpkayature commented 3 months ago

You cannot upload a JSON. Unlayer converts html its own way.

Anubhavgarg1910 commented 3 months ago

Ok, thanks. I will try. Instead of using html I should extract the json?

On Thu, 25 Apr, 2024, 7:33 pm Sarpkaya Ture, @.***> wrote:

You cannot upload a JSON. Unlayer converts html its own way.

— Reply to this email directly, view it on GitHub https://github.com/unlayer/react-email-editor/issues/392#issuecomment-2077277058, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ56NUQJV6LPWXAUH5ZNLXTY7EELRAVCNFSM6AAAAABF3DSPQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZXGI3TOMBVHA . You are receiving this because you authored the thread.Message ID: @.***>

sarpkayature commented 3 months ago

@Anubhavgarg1910 my advice will be to keep your html and html's json in database. While loading it from remote, just load json. Html will be required during sending emails. In docs you can find very describing examples about it. They recently updated their docs. Unlayer doesn't read html you export unless audit it i think.Therefore keep you template's json and html in different keys in your db.