-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathEditor.vue
More file actions
40 lines (35 loc) · 740 Bytes
/
Editor.vue
File metadata and controls
40 lines (35 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template lang='html'>
<div class="note-area">
<textarea />
</div>
</template>
<script>
import SimpleMDE from 'simplemde';
export default {
props: ['value'],
mounted
};
function mounted() {
const md = initEditor(this.$el.childNodes[0], this.value);
md.codemirror.focus();
md.codemirror.setCursor(100);
md.codemirror.on("change", () => {
const val = this.md.value();
this.$emit('input', val);
});
this.md = md;
}
function initEditor(el, val) {
return new SimpleMDE({
element: el,
spellChecker: false,
placeholder: "Type here...",
toolbar: false,
toolbarTips: false,
status: false,
autoDownloadFontAwesome: false,
forceSync: true,
initialValue: val
});
}
</script>