jaredreich / pell

📝 the simplest and smallest WYSIWYG text editor for web, with no dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can user edit previously stored content in WYSIWYG mode? SOLVED

shepherdlewis000 opened this issue · comments

I'm trying to allow a user to edit content previously stored as a string from the editor. On my "edit" page, I tried setting pell.content as both innerHTML and textContent as done in the examples. My problem is that I wish the user to not have to deal with any HTML tags but to see the content as it was on the original pell editor form (on the "add" page). I'd like the old content to appear in the pell editor in WYSIWYG mode. Sorry if this is not a Pell issue but please advise.
I'm fairly new and guessing this may be an issue with unsanitized data but I'm not totally familiar with what the ramifications are.
I just realized I'm in a mess where the user can further apply formatting tags to previous tags, etc. For example, user highlights this text within the editor <p>Blah...</p> and clicks "Italic" button, then saves and italic is applied to the p tags. Maybe I'm in over my head here..

This turned out to be a simple problem due to using ejs template for my first time. To not escape HTML in the template I should have used <%- htmlSnippet %> rather than <%= htmlSnippet %>