Skip to content

Commit 612937d

Browse files
author
zesani
committed
test gutter
1 parent 38fa966 commit 612937d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

codemirror.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
var CodeMirrorMetas = require('./metas.js')
88
require('codemirror/lib/codemirror.css')
99
// var
10+
function makeMarker() {
11+
var marker = document.createElement("div");
12+
marker.style.color = "#822";
13+
marker.innerHTML = "";
14+
return marker;
15+
}
1016
export default {
1117
data: function() {
1218
return {
@@ -23,7 +29,8 @@
2329
styleActiveLine: true,
2430
lineNumbers: true,
2531
mode: 'text/javascript',
26-
lineWrapping: true
32+
lineWrapping: true,
33+
gutters: ["CodeMirror-linenumbers", "breakpoints"]
2734
}
2835
}
2936
},
@@ -83,6 +90,10 @@
8390
_this.$emit('input', _this.content)
8491
}
8592
})
93+
this.editor.on("gutterClick", function(cm, n) {
94+
var info = cm.lineInfo(n);
95+
cm.setGutterMarker(n, "breakpoints", info.gutterMarkers ? null : makeMarker())
96+
})
8697
},
8798
watch: {
8899
'code': function(newVal, oldVal) {

0 commit comments

Comments
 (0)