Last active
May 24, 2018 15:22
-
-
Save jdmichaud/40c5135b5d45064e3dab3171cc3cb347 to your computer and use it in GitHub Desktop.
CodeMirror integration
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Code Mirror Tests</title> | |
<link rel="stylesheet" href="dist/bundle.css"> | |
<script src="dist/main.js"></script> | |
<script> | |
window.onload = () => { | |
createEditor(document.getElementById('editor')); | |
} | |
</script> | |
<style> | |
#editor { | |
border: 1px solid black; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="editor"></div> | |
</body> | |
</html> |
This file contains hidden or 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
import CodeMirror from 'codemirror'; | |
import gfm from 'codemirror/mode/gfm/gfm.js' | |
import 'codemirror/lib/codemirror.css'; | |
window.createEditor = (element) => { | |
var myCodeMirror = CodeMirror(element, { | |
value: 'test', | |
mode: 'gfm', | |
lineNumbers: true, | |
theme: "default", | |
}); | |
} |
This file contains hidden or 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
import resolve from 'rollup-plugin-node-resolve'; | |
import commonjs from 'rollup-plugin-commonjs'; | |
import css from 'rollup-plugin-css-only' | |
export default [{ | |
input: 'main.js', | |
output: { | |
name: 'codeMirrorTest', | |
file: 'dist/main.js', | |
format: 'umd' | |
}, | |
plugins: [ | |
resolve(), // so Rollup can find `ms` | |
commonjs(), // so Rollup can convert `ms` to an ES module | |
css({ output: 'dist/bundle.css' }), | |
] | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment