feat: define vega code block using json overlay mode in editor

to get vega-lite syntax highlighting work

Signed-off-by: Max Wu <jackymaxj@gmail.com>
This commit is contained in:
Max Wu 2020-02-27 17:35:17 +08:00
parent 3a5c6fa5ed
commit 3cc563ec59
1 changed files with 11 additions and 0 deletions

View File

@ -131,6 +131,17 @@ export default class Editor {
}
this.eventListeners = {}
this.config = config
// define modes from mode mime
let ignoreOverlay = {
token: function (stream, state) {
stream.next()
return null
}
}
CodeMirror.defineMode('vega', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'application/ld+json'), ignoreOverlay)
})
}
on (event, cb) {