Skip to content

Commit 5a22c6b

Browse files
committed
feat: codemirror config
1 parent 4a4562b commit 5a22c6b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/bytemd/src/Editor.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
<script>
22
import { onMount } from 'svelte';
33
import codemirror from 'codemirror';
4-
import mdMode from 'codemirror/mode/markdown/markdown.js';
4+
import 'codemirror/mode/markdown/markdown.js';
55
import Viewer from './Viewer.svelte';
66
77
window.process = { cwd: () => '/' }; // FIXME:
8+
89
export let source;
10+
export let codemirrorConfig;
11+
912
let textarea;
1013
1114
onMount(() => {
1215
const ed = codemirror.fromTextArea(textarea, {
13-
mode: 'markdown'
16+
mode: 'markdown',
17+
lineNumbers: true,
18+
lineWrapping: true,
19+
...codemirrorConfig
1420
});
1521
ed.setValue(source);
1622
ed.on('change', () => {

0 commit comments

Comments
 (0)