Skip to content

Commit 31c9dbf

Browse files
authored
Merge pull request #7 from n9ti/master
add unseen line marker
2 parents 9e877ea + 6ed96c1 commit 31c9dbf

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

codemirror.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
props: {
1717
code: String,
1818
value: String,
19+
unseenLines: Array,
20+
marker: Function,
1921
options: {
2022
type: Object,
2123
default: function() {
@@ -83,6 +85,7 @@
8385
_this.$emit('input', _this.content)
8486
}
8587
})
88+
this.unseenLineMarkers()
8689
},
8790
watch: {
8891
'code': function(newVal, oldVal) {
@@ -93,6 +96,7 @@
9396
this.content = newVal
9497
this.editor.scrollTo(scrollInfo.left, scrollInfo.top)
9598
}
99+
this.unseenLineMarkers()
96100
},
97101
'value': function(newVal, oldVal) {
98102
const editor_value = this.editor.getValue()
@@ -102,6 +106,18 @@
102106
this.content = newVal
103107
this.editor.scrollTo(scrollInfo.left, scrollInfo.top)
104108
}
109+
this.unseenLineMarkers()
110+
}
111+
},
112+
methods: {
113+
unseenLineMarkers: function () {
114+
var _this = this
115+
if (_this.unseenLines !== undefined && _this.marker !== undefined) {
116+
_this.unseenLines.forEach(line => {
117+
var info = _this.editor.lineInfo(line)
118+
_this.editor.setGutterMarker(line, "breakpoints", info.gutterMarkers ? null : _this.marker())
119+
})
120+
}
105121
}
106122
}
107123
}
@@ -111,5 +127,6 @@
111127
.CodeMirror,
112128
.CodeMirror pre {
113129
font-family: Menlo, Monaco, Consolas, "Courier New", monospace!important;
130+
padding: 0 20px !important; /* Horizontal padding of content */
114131
}
115132
</style>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-codemirror",
3-
"version": "2.1.0",
3+
"version": "2.1.2",
44
"description": "Codemirror component for Vue.js(1.x ~ 2.x)",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)