Hello,
Is it possible that if I add some dynamic HTML like this:
<div class="block">
<h1 id="headingText">Heading Text</h1>
<p id="subheadingText">Subheading text</p>
</div>
to the ContentEdit element (like ContentEdit.Text) to prevent removing elements from the DOM when all of the text is removed from them.
Ideally, what I am trying to do is that if you remove the text from h1 tag for example, the caret would stay at the index 0 and if you press the backspace again nothing would happen.
The second question I have is if it is possible to, again, add dynamic HTML to the ContentEdit element and keep the empty tags. For example if I add HTML like this:
<div class="block">
<h1>Heading text</h1>
<!-- Gets removed by HTMLString -->
<div class="emptyBlock"></div>
</div>
Div element with the class of emptyBlock would be removed from the DOM.
I have debugged this little bit and discovered that _Parser.prototype._popTag function of html-string.js removes them, but I am unable to prevent it.
Is there any solution to this?
I know that by adding to the empty element would prevent it from being removed from the DOM but this doesn't work for me in every case since in some elements I need to add HTML that looks like this:
<svg width="..." height="...">
<!-- This element again gets removed from the DOM -->
<path d="..." />
</svg>
Any help would be greatly appreciated.
Hello,
Is it possible that if I add some dynamic HTML like this:
to the ContentEdit element (like
ContentEdit.Text) to prevent removing elements from the DOM when all of the text is removed from them.Ideally, what I am trying to do is that if you remove the text from h1 tag for example, the caret would stay at the index 0 and if you press the backspace again nothing would happen.
The second question I have is if it is possible to, again, add dynamic HTML to the ContentEdit element and keep the empty tags. For example if I add HTML like this:
Div element with the class of
emptyBlockwould be removed from the DOM.I have debugged this little bit and discovered that
_Parser.prototype._popTagfunction ofhtml-string.jsremoves them, but I am unable to prevent it.Is there any solution to this?
I know that by adding
to the empty element would prevent it from being removed from the DOM but this doesn't work for me in every case since in some elements I need to add HTML that looks like this:Any help would be greatly appreciated.