主题: 每次获取的内容不一样
作者: 红鹦鹉, 发布日期: 2012-08-25 16:28:08, 浏览数: 2502

操作系统: win7

浏览器版本: ie9

KindEditor版本: 4.1.2

BUG再现步骤:
1.设置不过滤html


allowImageUpload: false,
allowFlashUpload: false,
allowMediaUpload: false,
allowFileManager: false,
filterMode: false 

 

2.输入


<table class="ke-zeroborder" border="0" cellspacing="0" cellpadding="0">
 <tbody>
  <tr>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub0')" height="40" width="80" align="center" onmouseout="this.background=''">
    <a href="index.aspx"><span style="color:#ffffff;font-size:12px;">网站首页</span></a>
   </td>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub1')" height="40" width="80" align="center" onmouseout="this.background=''">
    [链接0]<span style="color:#ffffff;font-size:12px;">[导航0]</span>[/链接]
   </td>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub2')" height="40" width="80" align="center" onmouseout="this.background=''">
    [链接1]<span style="color:#ffffff;font-size:12px;">[导航1]</span>[/链接]
   </td>
  </tr>
 </tbody>
</table>

 

提交写入数据库(access数据库)

 

 3.重数据库中读取数据(红色的代码是编辑器自动生成的与写入的不一致

<table class="ke-zeroborder" border="0" cellspacing="0" cellpadding="0">
 <tbody>
  <tr>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub0')" height="40" background="user_image/img-2.jpg" width="80" align="center" onmouseout="this.background=''">
    <a href="index.aspx"><span style="color:#ffffff;font-size:12px;">网站首页</span></a>
   </td>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub1')" height="40" width="80" align="center" onmouseout="this.background=''">
    [链接0]<span style="color:#ffffff;font-size:12px;">[导航0]</span>[/链接]
   </td>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub2')" height="40" width="80" align="center" onmouseout="this.background=''">
    [链接1]<span style="color:#ffffff;font-size:12px;">[导航1]</span>[/链接]
   </td>
  </tr>
 </tbody>
</table> 

 

不做任何修改然后再重新读取数据得到结果也不一样


<table class="ke-zeroborder" border="0" cellspacing="0" cellpadding="0">
 <tbody>
  <tr>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub0')" height="40" background="user_image/img-2.jpg" width="80" align="center" onmouseout="this.background=''">
    <a href="index.aspx"><span style="color:#ffffff;font-size:12px;">网站首页</span></a>
   </td>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub1')" height="40" background="user_image/img-2.jpg" width="80" align="center" onmouseout="this.background=''">
    [链接0]<span style="color:#ffffff;font-size:12px;">[导航0]</span>[/链接]
   </td>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub2')" height="40" width="80" align="center" onmouseout="this.background=''">
    [链接1]<span style="color:#ffffff;font-size:12px;">[导航1]</span>[/链接]
   </td>
  </tr>
 </tbody>
</table> 

 

不做任何修改第三次读取结果还是不一样

 

 

 

<table class="ke-zeroborder" border="0" cellspacing="0" cellpadding="0">
 <tbody>
  <tr>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub0')" height="40" background="user_image/img-2.jpg" width="80" align="center" onmouseout="this.background=''">
    <a href="index.aspx"><span style="color:#ffffff;font-size:12px;">网站首页</span></a>
   </td>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub1')" height="40" background="user_image/img-2.jpg" width="80" align="center" onmouseout="this.background=''">
    [链接0]<span style="color:#ffffff;font-size:12px;">[导航0]</span>[/链接]
   </td>
   <td onmouseover="this.background='user_image/img-2.jpg';SwitchMenu('sub2')" height="40" background="user_image/img-2.jpg" width="80" align="center" onmouseout="this.background=''">
    [链接1]<span style="color:#ffffff;font-size:12px;">[导航1]</span>[/链接]
   </td>
  </tr>
 </tbody>
</table>

 

测试结果,这样的代码编辑器读取数据库数据会做些改动,得到的代码和数据库中的不一致

期望结果:

作者: Roddy, 发布日期: 2012-08-26 19:02:01
这是因为在编辑器里触发了onmouse事件,加了背景图片,建议换个思路解决,比如设置到编辑器的HTML是data-onmouseover="JS代码",显示HTML时改成onmouseover="JS代码"。
回复
发表新帖 发表回复