Our team has an email generator that generates HTML Emails based on a number of parameters. The user just has to check/uncheck boxes and the email gets regenerated.
Sometimes, the user has to slightly alter the content of the email manually.
Problem is, if the email content is altered manually, and then the user changes the parameters again, all his manual modifications are overriden.
I would like to be able to merge his modifications into the new generated HTML Email.
So what I have is:
- Email 1: Generated by the system based on a few parameters
- Email 1 + slight manual modifications
- Email 2: Generated by the system based on slightly different parameters than Email 1 (Resembles to Email 1 in every aspect except a sentence that was deleted or added)
How can merge the user modifications that user applied in Email 1 into Email 2 using a Javascript library.
>Solution :
Try using a library like diff-match-patch or js-diff to compare the two HTML emails and merge the modifications from email1 into email2