我想更改事件dbl单击,但是我的代码不正确并且不起作用 我想要代码做什么
我用于代码镜像的jquery代码
function Script() {
var ua = navigator.userAgent;
if (ua && ua.toUpperCase().indexOf("OPERA MINI") > -1) {
return false;
}
window.editor = CodeMirror.fromTextArea(document.getElementById("fldScript"), {
mode: "text/javascript",
htmlMode: true,
lineWrapping: true,
autoCloseTags: true,
smartIndent: false,
addModeClass: true,
extraKeys: {
"Ctrl-Space": "autocomplete",
/*-------------- function dbl-click------------------*/
"dblclick" : function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
/*-------------- function key-press F11------------------*/
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen"))
cm.setOption("fullScreen", false);
}
}
});
window.editor.on("change", function() {
window.editor.save();
});
}
Script();
答案 0 :(得分:0)
function Script() {
var ua = navigator.userAgent;
if (ua && ua.toUpperCase().indexOf("OPERA MINI") > -1) {
return false;
}
window.editor = CodeMirror.fromTextArea(document.getElementById("fldScript"), {
mode: "javascript",
htmlMode: true,
lineWrapping: true,
autoCloseTags: true,
smartIndent: false,
addModeClass: true,
extraKeys: {
"Ctrl-Space": "autocomplete",
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
window.editor.on("change", function() {
window.editor.save();
});
window.editor.on('dblclick', function() {
if (window.editor.getOption("fullScreen") == false)
window.editor.setOption("fullScreen", !window.editor.getOption("fullScreen"));
});
}
Script();