You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 6, 2020. It is now read-only.
*[Collect statistics on the use of open source](#collect-statistics-on-the-use-of-open-source)
14
14
*[Install](#-install)
15
15
*[Using npm](#using-npm)
16
-
*[Usage](#-usage)
16
+
*[Editor Usage](#-editor-usage)
17
17
*[Load](#load)
18
18
*[Implement](#implement)
19
19
*[Using v-model](#using-v-model)
20
20
*[Props](#props)
21
21
*[Event](#event)
22
22
*[Method](#method)
23
+
*[Viewer Usage](#-viewer-usage)
24
+
*[Load](#load-1)
25
+
*[Implement](#implement-1)
26
+
*[Props](#props-1)
27
+
*[Event](#event-1)
23
28
*[Pull Request Steps](#-pull-request-steps)
24
29
*[Documents](#-documents)
25
30
*[Contributing](#-contributing)
@@ -50,9 +55,7 @@ tui.usageStatistics = false;
50
55
npm install --save @toast-ui/vue-editor
51
56
```
52
57
53
-
## 🔨 Usage
54
-
55
-
If you want to more details, see [Tutorials](https://github.com/nhnent/toast-ui.vue-editor/blob/master/docs/getting-started.md) 👀
58
+
## 📝 Editor Usage
56
59
57
60
### Load
58
61
@@ -83,7 +86,7 @@ You can use Toast UI Editor for Vue as moudule format or namespace. Also you can
83
86
import 'tui-editor/dist/tui-editor.css';
84
87
import 'tui-editor/dist/tui-editor-contents.css';
85
88
import 'codemirror/lib/codemirror.css';
86
-
import Editor from '@toast-ui/vue-editor/src/editor.vue'
89
+
import Editor from '@toast-ui/vue-editor/src/Editor.vue'
87
90
```
88
91
89
92
* Using namespace
@@ -125,7 +128,7 @@ new Vue({
125
128
126
129
### Using v-model
127
130
128
-
If you use v-model, you have to declare a `data`for binding.
131
+
If you use v-model, you have to declare a `data`for binding. (❗️ When using the editor in`wysiwyg` mode, `v-model` can cause performance degradation.)
129
132
130
133
In the example below, `editorText` is binding to the text of the editor.
131
134
@@ -158,7 +161,7 @@ export default {
158
161
| height | String | '300px' | This prop can control the height of the editor. |
159
162
| previewStyle | String | 'tab' | This prop can change preview style of the editor. (`tab` or `vertical`) |
160
163
| mode | String | 'markdown' | This prop can change mode of the editor. (`markdown`or `wysiwyg`) |
161
-
| html | String | - | If you want change content of the editor using html format, use this prop. |
164
+
| html | String | - | If you want to change content of the editor using html format, use this prop. |
162
165
| visible | Boolean | true | This prop can control visible of the eiditor. |
163
166
164
167
```js
@@ -193,6 +196,40 @@ const defaultOptions = {
193
196
]
194
197
};
195
198
```
199
+
Example :
200
+
201
+
``` html
202
+
<template>
203
+
<editor
204
+
:value="editorText"
205
+
:options="editorOptions"
206
+
:html="editorHtml"
207
+
:visible="editorVisible"
208
+
previewStyle="vertical"
209
+
height="500px"
210
+
mode="wysiwyg"
211
+
/>
212
+
</template>
213
+
<script>
214
+
import { Editor } from '@toast-ui/vue-editor'
215
+
216
+
export default {
217
+
components: {
218
+
'editor': Editor
219
+
},
220
+
data() {
221
+
return {
222
+
editorText: 'This is initialValue.',
223
+
editorOptions: {
224
+
hideModeSwitch: true
225
+
},
226
+
editorHtml: '',
227
+
editorVisible: true
228
+
};
229
+
},
230
+
};
231
+
</script>
232
+
```
196
233
197
234
### Event
198
235
@@ -202,6 +239,46 @@ const defaultOptions = {
202
239
* focus : It would be emitted when editor get focus
203
240
* blur : It would be emitted when editor loose focus
204
241
242
+
Example :
243
+
244
+
```html
245
+
<template>
246
+
<editor
247
+
@load="onEditorLoad"
248
+
@focus="onEditorFocus"
249
+
@blur="onEditorBlur"
250
+
@change="onEditorChange"
251
+
@stateChange="onEditorStateChange"
252
+
/>
253
+
</template>
254
+
<script>
255
+
import { Editor } from '@toast-ui/vue-editor'
256
+
257
+
export default {
258
+
components: {
259
+
'editor': Editor
260
+
},
261
+
methods: {
262
+
onEditorLoad() {
263
+
// implement your code
264
+
},
265
+
onEditorFocus() {
266
+
// implement your code
267
+
},
268
+
onEditorBlur() {
269
+
// implement your code
270
+
},
271
+
onEditorChange() {
272
+
// implement your code
273
+
},
274
+
onEditorStateChange() {
275
+
// implement your code
276
+
},
277
+
}
278
+
};
279
+
</script>
280
+
```
281
+
205
282
### Method
206
283
207
284
If you want to more manipulate the Editor, you can use `invoke` method to call the method of tui.editor. For more information of method, see [method of tui.editor](http://nhnent.github.io/tui.editor/api/latest/ToastUIEditor.html).
0 commit comments