简体   繁体   English

如何在代码镜像中更改事件 dbl-click

[英]How to change event dbl-click in code-mirror

I want to change the event dbl click but my code is not correct and does not work What I want the code to do我想更改事件 dbl click 但我的代码不正确且不起作用 我想要代码做什么

my code我的代码

my jquery code for code-mirror我的代码镜像的 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();
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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM