1

I've got the following problem with TinyMCE:

I've inserted the following code into a TinyMCE instance:

<p><a href="/_pics/articles/large/WAbOlemChF.jpg" rel="gallery"><img class="img-center" src="/_pics/articles/WAbOlemChF.jpg" alt="b" /></a></p>
<p><a href="/_pics/articles/large/cT89QKCChs.jpg" rel="gallery"><img class="img-center" src="/_pics/articles/cT89QKCChs.jpg" alt="v" /></a></p>

This results is the following:

If I place the cursor as indicated in the image above, and I hit the DELETE key, I get the following:

So far, so good, except that when I check out the code, it looks like this:

<p><a href="/_pics/articles/large/cT89QKCChs.jpg" rel="gallery"><img class="img-center" src="/_pics/articles/WAbOlemChF.jpg" alt="b" /><img class="img-center" src="/_pics/articles/cT89QKCChs.jpg" alt="v" /></a></p>

Note, that the A tags have been merged. As you'd image this raises a big problem since the "href" attribute was different. I would've expected it to put both A tags in the same paragraph, but keep them distinct.

Is it a TinyMCE bug, or there's something in the configuration that I can tweak so it merges only identical A tags?

I'm using v3.5.6, jQuery version.

4

2 回答 2

0

如果您不希望 TinyMCE 弄乱您的代码,只需给它一个类。这适用于 WordPress 实现,因此希望它也适用于您。

例子..

<p class="image"><a href="/_pics/articles/large/WAbOlemChF.jpg" rel="gallery"><img class="img-center" src="/_pics/articles/WAbOlemChF.jpg" alt="b" /></a></p>
<p class="image"><a href="/_pics/articles/large/cT89QKCChs.jpg" rel="gallery"><img class="img-center" src="/_pics/articles/cT89QKCChs.jpg" alt="v" /></a></p>

不必定义该类,如果需要,只需给它一个空类。重点是,TinyMCE 不会删除任何有类的东西,因此你的代码应该保持不变。

于 2012-09-24T09:45:33.973 回答
0

我们有很多奇怪的删除行为可能是因为浏览器有错误。解决方案是处理 delte 进程并执行自己的操作以绕过默认行为。为此,我们定义了几种发生意外情况的场景,并尝试隔离这些情况以便能够纠正它。

于 2012-09-24T09:31:39.353 回答