百度的Ueditor原来一开始就定义了Ctrl+Enter就Submit Form啊,但是与Ajax不兼容。
百度的Ueditor原来一开始就定义了Ctrl+Enter就Submit Form啊,但是与Ajax不兼容。
By lincanbin
at 2015-04-15
1人收藏 • 5227人看过
百度的Ueditor定义了Ctrl+Enter Submit Form,但是现在Ajax用的居多吧?
怪不得我自己写了个Ctrl + Enter提交的在Ueditor的iframe内老是无响应
遍历了document.getElementsByTagName("iframe")
然后对
iframeo.contentWindow.document.body.onkeydown
设置了触发函数,搞了我老半天没发现问题在哪里,原来是百度的锅。
- 登录后方可回帖
4 个回复 | 最后更新于 2015-04-15
根据这里,删除掉了Ueditor里的Ctrl + Enter的监听部分:
/**
* 快捷键提交
* @file
* @since 1.2.6.1
*/
/**
* 提交表单
* @command autosubmit
* @method execCommand
* @param { String } cmd 命令字符串
* @example
* ```javascript
* editor.execCommand( 'autosubmit' );
* ```
*/
UE.plugin.register('autosubmit',function(){
return {
shortcutkey:{
"autosubmit":"ctrl+13" //手动提交
},
commands:{
'autosubmit':{
execCommand:function () {
var me=this,
form = domUtils.findParentByTagName(me.iframe,"form", false);
if (form){
if(me.fireEvent("beforesubmit")===false){
return;
}
me.sync();
form.submit();
}
}
}
}
}
});https://github.com/lincanbin/Carbon-Forum/issues/26
完成,服务器代码还没同步到最新所以暂时还没生效。
