Spaces:
Running
Running
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>CodeMirror: Breakpoint Demo</title> | |
<link rel="stylesheet" href="../lib/codemirror.css"> | |
<script src="../lib/codemirror.js"></script> | |
<script src="../mode/javascript/javascript.js"></script> | |
<link rel="stylesheet" href="../doc/docs.css"> | |
<style type="text/css"> | |
.breakpoints {width: .8em;} | |
.breakpoint { color: #822; } | |
.CodeMirror {border: 1px solid #aaa;} | |
</style> | |
</head> | |
<body> | |
<h1>CodeMirror: Breakpoint demo</h1> | |
<form><textarea id="code" name="code"> | |
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | |
lineNumbers: true, | |
gutters: ["CodeMirror-linenumbers", "breakpoints"] | |
}); | |
editor.on("gutterClick", function(cm, n) { | |
var info = cm.lineInfo(n); | |
cm.setGutterMarker(n, "breakpoints", info.markers ? null : makeMarker()); | |
}); | |
function makeMarker() { | |
var marker = document.createElement("div"); | |
marker.innerHTML = "β"; | |
marker.className = "breakpoint"; | |
return marker; | |
} | |
</textarea></form> | |
<p>Click the line-number gutter to add or remove 'breakpoints'.</p> | |
<script> | |
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | |
lineNumbers: true, | |
gutters: ["CodeMirror-linenumbers", "breakpoints"] | |
}); | |
editor.on("gutterClick", function(cm, n) { | |
var info = cm.lineInfo(n); | |
cm.setGutterMarker(n, "breakpoints", info.gutterMarkers ? null : makeMarker()); | |
}); | |
function makeMarker() { | |
var marker = document.createElement("div"); | |
marker.style.color = "#822"; | |
marker.innerHTML = "β"; | |
return marker; | |
} | |
</script> | |
</body> | |
</html> | |