因为我不想用内部的html代码插件,所以代码是通过vim生成的,然后再加上类来显示代码,可是在代码模式插入,直接保存就没有问题,如果切换回可是模式,保存就会有问题了,比如我插入的代码会换行等等
操作系统: server 2003
浏览器版本: firefox,chrome 均为最新版
KindEditor版本: 4.1.2
BUG再现步骤:
1.切换到代码模式
2.插入代码,如
<pre class="byvim">
<span class="Identifier"><</span><span class="Statement">html</span><span class="Identifier">></span>
<span class="Identifier"><</span><span class="Statement">head</span><span class="Identifier">></span>
<span class="PreProc"> </span><span class="Identifier"><</span><span class="Statement">meta</span><span class="Identifier"> </span><span class="Type">charset</span><span class="Identifier">=</span><span class="Constant">"utf-8"</span><span class="Identifier"> /></span>
<span class="PreProc"> </span><span class="Identifier"><</span><span class="Statement">title</span><span class="Identifier">></span><span class="Title">Rating Test</span><span class="Identifier"></</span><span class="Statement">title</span><span class="Identifier">></span>
<span class="PreProc"> </span><span class="Identifier"><</span><span class="Statement">script</span><span class="Identifier"> </span><span class="Type">language</span><span class="Identifier">=</span><span class="Constant">"javascript"</span><span class="Identifier"> </span><span class="Type">src</span><span class="Identifier">=</span><span class="Constant">"js/mootools.1.4.5.js"</span><span class="Identifier">></span><span class="Identifier"></</span><span class="Statement">script</span><span class="Identifier">></span>
<span class="PreProc"> </span><span class="Identifier"><</span><span class="Statement">script</span><span class="Identifier"> </span><span class="Type">language</span><span class="Identifier">=</span><span class="Constant">"javascript"</span><span class="Identifier"> </span><span class="Type">src</span><span class="Identifier">=</span><span class="Constant">"js/Rating.js"</span><span class="Identifier">></span><span class="Identifier"></</span><span class="Statement">script</span><span class="Identifier">></span>
<span class="PreProc"> </span><span class="Identifier"><</span><span class="Statement">script</span><span class="Identifier"> </span><span class="Type">language</span><span class="Identifier">=</span><span class="Constant">"javascript"</span><span class="Identifier">></span>
<span class="Special"> </span><span class="Statement">document</span><span class="Special">.addEvent</span>(<span class="Constant">"domready"</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">"ratingtest"</span><span class="Special">,</span>5<span class="Special">,</span><span class="Constant">"store"</span>)<span class="Special">;</span>
<span class="Special"> </span><span class="Comment">//添加rate事件,当选择5分的时候,设置为不可用状态</span>
<span class="Special"> rating.addEvent</span>(<span class="Constant">"rate"</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">"enable"</span>)<span class="Special">.addEvent</span>(<span class="Constant">"click"</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"></</span><span class="Statement">script</span><span class="Identifier">></span>
<span class="PreProc"> </span><span class="Identifier"></</span><span class="Statement">head</span><span class="Identifier">></span>
<span class="Identifier"><</span><span class="Statement">body</span><span class="Identifier">></span>
<span class="Identifier"><</span><span class="Statement">div</span><span class="Identifier"> </span><span class="Type">id</span><span class="Identifier">=</span><span class="Constant">"ratingtest"</span><span class="Identifier">></span>评分:<span class="Identifier"></</span><span class="Statement">div</span><span class="Identifier">></span>
<span class="Identifier"><</span><span class="Statement">div</span><span class="Identifier">><</span><span class="Statement">input</span><span class="Identifier"> </span><span class="Type">type</span><span class="Identifier">=</span><span class="Constant">"button"</span><span class="Identifier"> </span><span class="Type">id</span><span class="Identifier">=</span><span class="Constant">"enable"</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">"enable"</span><span class="Identifier">></span><span class="Identifier"></</span><span class="Statement">div</span><span class="Identifier">></span>
<span class="Identifier"></</span><span class="Statement">body</span><span class="Identifier">></span>
<span class="Identifier"></</span><span class="Statement">html</span><span class="Identifier">></span>
</pre>
3,不切回,直接保存就是正常的,切回,在保存就不正常
期望结果: 可以正常显示