Skip to content

Commit 3cc563e

Browse files
committed
feat: define vega code block using json overlay mode in editor
to get vega-lite syntax highlighting work Signed-off-by: Max Wu <[email protected]>
1 parent 3a5c6fa commit 3cc563e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

public/js/lib/editor/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ export default class Editor {
131131
}
132132
this.eventListeners = {}
133133
this.config = config
134+
135+
// define modes from mode mime
136+
let ignoreOverlay = {
137+
token: function (stream, state) {
138+
stream.next()
139+
return null
140+
}
141+
}
142+
CodeMirror.defineMode('vega', function (config, modeConfig) {
143+
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'application/ld+json'), ignoreOverlay)
144+
})
134145
}
135146

136147
on (event, cb) {

0 commit comments

Comments
 (0)