Commit 9581b30 1 parent 8622cb6 commit 9581b30 Copy full SHA for 9581b30
File tree 1 file changed +32
-28
lines changed
1 file changed +32
-28
lines changed Original file line number Diff line number Diff line change 5
5
<div class =" menubar-icons" />
6
6
</div >
7
7
<div v-if =" !loading" >
8
- <EditorContent
8
+ <EditorContent v-if = " editor "
9
9
class =" editor__content"
10
10
:editor =" editor" />
11
11
</div >
@@ -62,6 +62,7 @@ export default {
62
62
return {
63
63
loading: true ,
64
64
pageContent: null ,
65
+ editor: null ,
65
66
}
66
67
},
67
68
@@ -99,33 +100,6 @@ export default {
99
100
return this .markdownit .render (this .pageContent )
100
101
},
101
102
102
- /**
103
- * @returns {object}
104
- */
105
- editor () {
106
- return new Editor ({
107
- editable: false ,
108
- extensions: [
109
- new Heading (),
110
- new Code (),
111
- new Bold (),
112
- new Italic (),
113
- new Strike (),
114
- new HardBreak (),
115
- new HorizontalRule (),
116
- new BulletList (),
117
- new OrderedList (),
118
- new Blockquote (),
119
- new CodeBlock (),
120
- new ListItem (),
121
- new Link ({
122
- openOnClick: true ,
123
- }),
124
- new Image ({ currentDirectory: this .currentDirectory }),
125
- ],
126
- content: this .htmlContent ,
127
- })
128
- },
129
103
},
130
104
131
105
watch: {
@@ -154,12 +128,42 @@ export default {
154
128
this .$emit (' empty' )
155
129
}
156
130
this .loading = false
131
+ this .editor = this .createEditor ()
157
132
this .$nextTick (() => { this .$emit (' ready' ) })
158
133
} catch (e) {
159
134
const { id } = this .currentPage
160
135
console .error (` Failed to fetch content of page ${ id} ` , e)
161
136
}
162
137
},
138
+
139
+ /**
140
+ * @returns {object}
141
+ */
142
+ createEditor () {
143
+ return new Editor ({
144
+ editable: false ,
145
+ extensions: [
146
+ new Heading (),
147
+ new Code (),
148
+ new Bold (),
149
+ new Italic (),
150
+ new Strike (),
151
+ new HardBreak (),
152
+ new HorizontalRule (),
153
+ new BulletList (),
154
+ new OrderedList (),
155
+ new Blockquote (),
156
+ new CodeBlock (),
157
+ new ListItem (),
158
+ new Link ({
159
+ openOnClick: true ,
160
+ }),
161
+ new Image ({ currentDirectory: this .currentDirectory }),
162
+ ],
163
+ content: this .htmlContent ,
164
+ })
165
+ },
166
+
163
167
},
164
168
}
165
169
</script >
You can’t perform that action at this time.
0 commit comments