主题: 在代码模式自己插入代码,返回,在进入会乱掉
作者: 天意人间, 发布日期: 2012-10-01 19:35:28, 浏览数: 2160

因为我不想用内部的html代码插件,所以代码是通过vim生成的,然后再加上类来显示代码,可是在代码模式插入,直接保存就没有问题,如果切换回可是模式,保存就会有问题了,比如我插入的代码会换行等等

操作系统: server 2003


浏览器版本: firefox,chrome 均为最新版

KindEditor版本: 4.1.2

BUG再现步骤:
1.切换到代码模式

2.插入代码,如


<pre class="byvim">
<span class="Identifier">&lt;</span><span class="Statement">html</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">head</span><span class="Identifier">&gt;</span>
<span class="PreProc">        </span><span class="Identifier">&lt;</span><span class="Statement">meta</span><span class="Identifier"> </span><span class="Type">charset</span><span class="Identifier">=</span><span class="Constant">&quot;utf-8&quot;</span><span class="Identifier"> /&gt;</span>
<span class="PreProc">        </span><span class="Identifier">&lt;</span><span class="Statement">title</span><span class="Identifier">&gt;</span><span class="Title">Rating Test</span><span class="Identifier">&lt;/</span><span class="Statement">title</span><span class="Identifier">&gt;</span>
<span class="PreProc">        </span><span class="Identifier">&lt;</span><span class="Statement">script</span><span class="Identifier"> </span><span class="Type">language</span><span class="Identifier">=</span><span class="Constant">&quot;javascript&quot;</span><span class="Identifier"> </span><span class="Type">src</span><span class="Identifier">=</span><span class="Constant">&quot;js/mootools.1.4.5.js&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">script</span><span class="Identifier">&gt;</span>
<span class="PreProc">        </span><span class="Identifier">&lt;</span><span class="Statement">script</span><span class="Identifier"> </span><span class="Type">language</span><span class="Identifier">=</span><span class="Constant">&quot;javascript&quot;</span><span class="Identifier"> </span><span class="Type">src</span><span class="Identifier">=</span><span class="Constant">&quot;js/Rating.js&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">script</span><span class="Identifier">&gt;</span>
<span class="PreProc">        </span><span class="Identifier">&lt;</span><span class="Statement">script</span><span class="Identifier"> </span><span class="Type">language</span><span class="Identifier">=</span><span class="Constant">&quot;javascript&quot;</span><span class="Identifier">&gt;</span>
<span class="Special">            </span><span class="Statement">document</span><span class="Special">.addEvent</span>(<span class="Constant">&quot;domready&quot;</span><span class="Special">,</span><span class="Identifier">function</span>()<span class="Identifier">{</span>
<span class="Special">                </span><span class="Comment">//创建一个对象,放在ratingtest下,默认为5分,input hidden对象name为store</span>
<span class="Special">                </span><span class="Identifier">var</span><span class="Special"> rating=</span><span class="Statement">new</span><span class="Special"> Rating</span>(<span class="Constant">&quot;ratingtest&quot;</span><span class="Special">,</span>5<span class="Special">,</span><span class="Constant">&quot;store&quot;</span>)<span class="Special">;</span>
<span class="Special">                </span><span class="Comment">//添加rate事件,当选择5分的时候,设置为不可用状态</span>
<span class="Special">                rating.addEvent</span>(<span class="Constant">&quot;rate&quot;</span><span class="Special">,</span><span class="Identifier">function</span>()<span class="Identifier">{</span>
<span class="Special">                    </span><span class="Statement">if</span>(<span class="Identifier">this</span><span class="Special">.getRating</span>()<span class="Special">==</span>5)<span class="Identifier">{</span>
<span class="Special">                        </span><span class="Identifier">this</span><span class="Special">.setEnable</span>(<span class="Constant">false</span>)<span class="Special">;</span>
<span class="Special">                    </span><span class="Identifier">}</span>
<span class="Special">                </span><span class="Identifier">}</span>)<span class="Special">;</span>
<span class="Special">                </span><span class="Comment">//添加按钮点击事件,设置为可用</span>
<span class="Special">                $</span>(<span class="Constant">&quot;enable&quot;</span>)<span class="Special">.addEvent</span>(<span class="Constant">&quot;click&quot;</span><span class="Special">,</span><span class="Identifier">function</span>()<span class="Identifier">{</span>
<span class="Special">                    rating.setEnable</span>(<span class="Constant">true</span>)<span class="Special">;</span>
<span class="Special">                </span><span class="Identifier">}</span>)<span class="Special">;</span>
<span class="Special">            </span><span class="Identifier">}</span>)<span class="Special">;</span>
<span class="Special">        </span><span class="Identifier">&lt;/</span><span class="Statement">script</span><span class="Identifier">&gt;</span>
<span class="PreProc">    </span><span class="Identifier">&lt;/</span><span class="Statement">head</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">body</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">div</span><span class="Identifier"> </span><span class="Type">id</span><span class="Identifier">=</span><span class="Constant">&quot;ratingtest&quot;</span><span class="Identifier">&gt;</span>评分:<span class="Identifier">&lt;/</span><span class="Statement">div</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">div</span><span class="Identifier">&gt;&lt;</span><span class="Statement">input</span><span class="Identifier"> </span><span class="Type">type</span><span class="Identifier">=</span><span class="Constant">&quot;button&quot;</span><span class="Identifier"> </span><span class="Type">id</span><span class="Identifier">=</span><span class="Constant">&quot;enable&quot;</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;enable&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">div</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;/</span><span class="Statement">body</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;/</span><span class="Statement">html</span><span class="Identifier">&gt;</span>
</pre>


3,不切回,直接保存就是正常的,切回,在保存就不正常


期望结果: 可以正常显示

作者: Roddy, 发布日期: 2012-10-01 20:49:32
回复
作者: 天意人间, 发布日期: 2012-10-01 20:56:47

回复Roddy:

这个是有的,我已经加上了,没有过滤我的任何东西,就是结构乱了

回复
作者: 天意人间, 发布日期: 2012-10-01 21:51:11

回复Roddy:

试用ckeditor,tinymce都没有问题,而kindeditor,和百度的ueditor都有这个问题

回复
发表新帖 发表回复