问题
Here in my work, the previous programmer decided to use the wonderful TinyMCE on the company website. One of the thousands of problems I'm having is:
If the original text have any span
tag, when I press the backspace to delete a line (p
tag only), all span
tags are deleted from the text.
This error is much more specific than the other. I can delete anything, character or tag (including the p
tags), using the delete button and nothing happens.
If I delete anything using the backspace button, nothing happens too.
But if I delete any p
tag (even if it was created during the editing of the text), using the backspace, all span
tags are deleted.
I'm looking everywhere a way to solve this problem, because the client is not able to delete a row without losing all the markings of the text, which are made by CSS applied in span
tags. E.g.,
<p>
<span id="org_2" class="apoloP" onClick="myFunction(this.id);">
TEXT
</span>
</p>
Does anyone know how I can do to stop TinyMCE delete my text, beyond what is necessary?
It is not only when the original text has a span
tag.
When the TinyMCE creates a span
tag itself (if to underline the selected text, for example), if I delete a p
tag, all span
tags created also disappear.
回答1:
Solution: Despite all tell me not to use version 4 because is still in beta, was this version that solved my problem.
The bug does not occur in version 4.
回答2:
Looks like you should have a closer look at the tinymce setting valid_elements and valid_children. Make sure spans are valid elements and can be children to paragraphs.
来源:https://stackoverflow.com/questions/16346562/how-to-stop-tinymce-to-delete-the-span-tags