Skip to content

Instantly share code, notes, and snippets.

@jdmichaud
Last active May 24, 2018 15:22
Show Gist options
  • Save jdmichaud/40c5135b5d45064e3dab3171cc3cb347 to your computer and use it in GitHub Desktop.
Save jdmichaud/40c5135b5d45064e3dab3171cc3cb347 to your computer and use it in GitHub Desktop.
CodeMirror integration
<!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>
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",
});
}
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