mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-12-27 20:31:52 +00:00
53 lines
1.4 KiB
HTML
53 lines
1.4 KiB
HTML
|
<!doctype html>
|
||
|
|
||
|
<title>CodeMirror: Breakpoint Demo</title>
|
||
|
<meta charset="utf-8"/>
|
||
|
<link rel=stylesheet href="../doc/docs.css">
|
||
|
|
||
|
<link rel="stylesheet" href="../lib/codemirror.css">
|
||
|
<script src="../lib/codemirror.js"></script>
|
||
|
<script src="../mode/javascript/javascript.js"></script>
|
||
|
<style type="text/css">
|
||
|
.breakpoints {width: .8em;}
|
||
|
.breakpoint { color: #822; }
|
||
|
.CodeMirror {border: 1px solid #aaa;}
|
||
|
</style>
|
||
|
<div id=nav>
|
||
|
<a href="http://codemirror.net"><img id=logo src="../doc/logo.png"></a>
|
||
|
|
||
|
<ul>
|
||
|
<li><a href="../index.html">Home</a>
|
||
|
<li><a href="../doc/manual.html">Manual</a>
|
||
|
<li><a href="https://github.com/marijnh/codemirror">Code</a>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li><a class=active href="#">Breakpoint</a>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<article>
|
||
|
<h2>Breakpoint Demo</h2>
|
||
|
<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.gutterMarkers ? null : makeMarker());
|
||
|
});
|
||
|
|
||
|
function makeMarker() {
|
||
|
var marker = document.createElement("div");
|
||
|
marker.style.color = "#822";
|
||
|
marker.innerHTML = "●";
|
||
|
return marker;
|
||
|
}
|
||
|
</textarea></form>
|
||
|
|
||
|
<p>Click the line-number gutter to add or remove 'breakpoints'.</p>
|
||
|
|
||
|
<script>eval(document.getElementById("code").value);</script>
|
||
|
|
||
|
</article>
|