Copy and Paste HTML to the editor #1830
Unanswered
varshiniNaN
asked this question in
Questions & Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
When I try to copy and paste Html content to the editor, I'm facing issues with additional spaces. p tags are getting added as tiptap adds p tags to each line.
Ex: I'm reading the content using
editor.getHTML()
. So If I paste the below HTML to the editoreditor.getHTML() returns
<p><p>Hello,</p></p><p><% if( random.length > 0) { %></p><p> <p>Comments:</p></p><p> <ul></p><p> <% for(var data of random){ %></p><p> <li><%=data.firstName%> <%=data.lastName%>: <%=data.content%> </li></p><p> <% } %></p><p> </ul></p><p><% } %></p><p><p>Please review.</p></p>
The below is saved to the DB
<p><p>Hello,</p></p><p><% if( random.length > 0) { %></p><p> <p>Comments:</p></p><p> <ul></p><p> <% for(var data of random){ %></p><p> <li><%=data.firstName%> <%=data.lastName%>: <%=data.content%> </li></p><p> <% } %></p><p> </ul></p><p><% } %></p><p><p>Please review.</p></p>
Screen.Recording.2021-09-02.at.11.42.24.AM.mov
Is there a way to get rid of those p tags at least while pasting HTML to the editor?
Beta Was this translation helpful? Give feedback.
All reactions