Created
July 4, 2019 22:44
-
-
Save hypeJunction/5e4b2eb3246ea5c41cddf5aaf0dc07d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
install (Vue) { | |
Vue.prototype.$codemirror = { | |
async load (options) { | |
await import('codemirror/lib/codemirror.css'); | |
const module = await import('codemirror/lib/codemirror.js'); | |
const CodeMirror = module.default; | |
const modes = options.modes || []; | |
const modeImports = modes.map((mode) => { | |
return import(`codemirror/mode/${mode}/${mode}.js`); | |
}); | |
await Promise.all(modeImports); | |
return CodeMirror; | |
}, | |
}; | |
Vue.component('vue-codemirror', () => import('./VueCodemirror.vue')); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment