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

问题描述 投票:0回答:1

我想改变事件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();
jquery codemirror codemirror-modes react-codemirror
1个回答
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();
© www.soinside.com 2019 - 2024. All rights reserved.