如何阻止TinyMCE删除span标签? [英] How to stop TinyMCE to delete the span tags?
问题描述
在我的工作中,以前的程序员决定在公司网站上使用美妙的TinyMCE。
我遇到的成千上万个问题之一是:
如果原始文本有 span
标记,当我按 backspace 删除一行( p
标记)时,所有 span
标签将从文本中删除。
这个错误比另一个更具体。我可以使用删除按钮删除任何东西,字符或标签(包括 p
标签),并且什么都不会发生。
如果我使用退格按钮删除任何内容,则不会发生任何事情。
但如果我删除了任何 p
标签(即使它是在编辑文本的过程中创建的),使用 backspace ,所有 span
标记都将被删除。
我到处寻找解决方法问题,因为客户端无法删除一行而不会丢失文本的所有标记,这些标记由 span
标记中应用的CSS制作。例如,
< p>
< span id =org_2class =apoloPonClick =myFunction(this.id);>
TEXT
< / span>
< / p>
有谁知道我该怎么办才能阻止TinyMCE删除我的文本,超出了必要的范围? p>
不仅当原始文本有一个 span
标记时。
当TinyMCE自己创建 span
标签时(例如,如果要为选定的文本加下划线),如果我删除 p
标签,所有
span
标签创建也消失。解决方案:尽管所有人都告诉我不要使用第4版,因为它仍处于测试阶段,这个版本解决了我的问题。
版本4中没有发生该错误。
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.
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.
这篇关于如何阻止TinyMCE删除span标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!