|
15 | 15 | </template>
|
16 | 16 |
|
17 | 17 | <script>
|
18 |
| - import VueSimplemde from 'vue-simplemde/src/vue-simplemde' |
| 18 | +import VueSimplemde from 'vue-simplemde'; |
19 | 19 |
|
20 |
| - // Base example |
21 |
| - export default { |
22 |
| - components: { |
23 |
| - VueSimplemde |
24 |
| - }, |
25 |
| - data () { |
26 |
| - return { |
27 |
| - content: '', |
28 |
| - configs: { |
29 |
| - spellChecker: false // disable spell check |
30 |
| - } |
31 |
| - } |
32 |
| - } |
33 |
| - } |
| 20 | +// Base example |
| 21 | +export default { |
| 22 | + components: { |
| 23 | + VueSimplemde, |
| 24 | + }, |
| 25 | + data() { |
| 26 | + return { |
| 27 | + content: '', |
| 28 | + configs: { |
| 29 | + spellChecker: false, // disable spell check |
| 30 | + }, |
| 31 | + }; |
| 32 | + }, |
| 33 | +}; |
34 | 34 |
|
35 |
| - // Complete example |
36 |
| - export default { |
37 |
| - components: { |
38 |
| - VueSimplemde |
39 |
| - }, |
40 |
| - data () { |
41 |
| - return { |
42 |
| - content: '', |
43 |
| - configs: { |
44 |
| - status: false, // disable the status bar at the bottom |
45 |
| - spellChecker: false // disable spell check |
46 |
| - } |
47 |
| - } |
48 |
| - }, |
49 |
| - computed: { |
50 |
| - simplemde () { |
51 |
| - return this.$refs.markdownEditor.simplemde |
52 |
| - } |
| 35 | +// Complete example |
| 36 | +export default { |
| 37 | + components: { |
| 38 | + VueSimplemde, |
| 39 | + }, |
| 40 | + data() { |
| 41 | + return { |
| 42 | + content: '', |
| 43 | + configs: { |
| 44 | + status: false, // disable the status bar at the bottom |
| 45 | + spellChecker: false, // disable spell check |
| 46 | + }, |
| 47 | + }; |
| 48 | + }, |
| 49 | + computed: { |
| 50 | + simplemde() { |
| 51 | + return this.$refs.markdownEditor.simplemde; |
53 | 52 | },
|
54 |
| - mounted () { |
55 |
| - console.log(this.simplemde) |
56 |
| - this.simplemde.togglePreview() |
| 53 | + }, |
| 54 | + mounted() { |
| 55 | + console.log(this.simplemde); |
| 56 | + this.simplemde.togglePreview(); |
57 | 57 |
|
58 |
| - // 'change' envent has bound, via @input attache an event listener |
59 |
| - // You can attache events in this [list](https://codemirror.net/doc/manual.html#events) yourself if necessary |
60 |
| - this.simplemde.codemirror.on('beforeChange', (instance, changeObj) => { |
61 |
| - // do some things |
62 |
| - }) |
| 58 | + // 'change' envent has bound, via @input attache an event listener |
| 59 | + // You can attache events in this [list](https://codemirror.net/doc/manual.html#events) yourself if necessary |
| 60 | + this.simplemde.codemirror.on('beforeChange', (instance, changeObj) => { |
| 61 | + // do some things |
| 62 | + }); |
63 | 63 |
|
64 |
| - // remove SimpleMDE, when component destroy will invoke |
65 |
| - this.simplemde = null |
| 64 | + // remove SimpleMDE, when component destroy will invoke |
| 65 | + this.simplemde = null; |
66 | 66 |
|
67 |
| - // some useful methods |
68 |
| - this.$refs.markdownEditor.initialize() // init |
69 |
| - this.simplemde.toTextArea() |
70 |
| - this.simplemde.isPreviewActive() // returns boolean |
71 |
| - this.simplemde.isSideBySideActive() // returns boolean |
72 |
| - this.simplemde.isFullscreenActive() // returns boolean |
73 |
| - this.simplemde.clearAutosavedValue() // no returned value |
74 |
| - this.simplemde.markdown(this.content) // returns parsed html |
75 |
| - this.simplemde.codemirror.refresh() // refresh codemirror |
| 67 | + // some useful methods |
| 68 | + this.$refs.markdownEditor.initialize(); // init |
| 69 | + this.simplemde.toTextArea(); |
| 70 | + this.simplemde.isPreviewActive(); // returns boolean |
| 71 | + this.simplemde.isSideBySideActive(); // returns boolean |
| 72 | + this.simplemde.isFullscreenActive(); // returns boolean |
| 73 | + this.simplemde.clearAutosavedValue(); // no returned value |
| 74 | + this.simplemde.markdown(this.content); // returns parsed html |
| 75 | + this.simplemde.codemirror.refresh(); // refresh codemirror |
| 76 | + }, |
| 77 | + methods: { |
| 78 | + handleInput() { |
| 79 | + // do some things |
76 | 80 | },
|
77 |
| - methods: { |
78 |
| - handleInput () { |
79 |
| - // do some things |
80 |
| - } |
81 |
| - } |
82 |
| - } |
| 81 | + }, |
| 82 | +}; |
83 | 83 | </script>
|
84 | 84 |
|
85 | 85 | <style>
|
|
0 commit comments