5
5
6
6
vue-editor-js is editorjs wrapper component.
7
7
8
- Please see this first. https://editorjs.io/
8
+ Please review this first. https://editorjs.io/
9
9
10
10
## For before 2.0.0 version users.
11
11
12
- This plugins is turned to be just wrapper component.
13
- If you need to use plugin for editor.js, just import and set to config property.
12
+ This plugins is a wrapper component for editorjs .
13
+ If you need to use the plugin for editor.js then import it and set the config property.
14
14
15
15
Please See the [ Demo.vue] ( https://github.com/ChangJoo-Park/vue-editor-js/blob/master/demo/Demo.vue )
16
16
17
17
18
18
## For before 1.0.0 version users.
19
19
20
- Please ` Vue.use ` vue-editor-js in main.js.
20
+ Please use ` Vue.use ` vue-editor-js in main.js.
21
21
22
22
## Supported Plugins
23
23
@@ -41,6 +41,7 @@ Please `Vue.use` vue-editor-js in main.js.
41
41
## Installation
42
42
43
43
``` bash
44
+ # NPM
44
45
npm install --save vue-editor-js
45
46
46
47
# or Yarn
@@ -49,18 +50,17 @@ yarn add vue-editor-js
49
50
50
51
## Usage
51
52
53
+ ### In main.js
52
54
``` js
53
- // In main.js
54
55
// ...
55
56
import Editor from ' vue-editor-js'
56
57
57
58
Vue .use (Editor)
58
59
// ...
59
60
```
60
61
62
+ ### In Nuxt.js
61
63
``` js
62
- // on Nuxt.js
63
-
64
64
// in nuxt.config.js
65
65
plugins: [
66
66
{
@@ -79,19 +79,20 @@ Vue.use(Editor)
79
79
<editor ref="editor" :config="config" :initialized="onInitialized"/>
80
80
```
81
81
82
- define initialize Function for get instance of editor.js when initialized
82
+ Define the initialization function to get the instance of editor.js when initializing
83
83
84
- If you confused using on Nuxt, please see [ here] ( https://github.com/ChangJoo-Park/vue-editor-on-nuxt )
84
+ If you are confused with using it with Nuxt, please see [ here] ( https://github.com/ChangJoo-Park/vue-editor-on-nuxt )
85
85
86
86
## Local import
87
87
88
- You can import Editor only in components where you need it.
88
+ If you wish to only import Editor on a single component then you can do so by following the instructions below
89
89
90
90
1 . Make sure to install ` @vue/composition-api `
91
91
``` bash
92
+ # NPM
92
93
npm i --save @vue/composition-api
93
94
94
- # or Yarn
95
+ # or Yarn
95
96
yarn add @vue/composition-api
96
97
```
97
98
2 . In main.js:
@@ -137,14 +138,60 @@ Same as in Supported Plugins, but with different naming
137
138
138
139
139
140
### Usage
141
+
142
+ 1 . Install the editorjs tool
143
+
144
+ ``` bash
145
+ # NPM
146
+ npm install --save @editorjs/header
147
+
148
+ # or Yarn
149
+ yarn add @editorjs/header
150
+ ```
151
+
152
+ 2 . Insert the package into the config prop
153
+
154
+ ``` vue
155
+ <editor
156
+ ...
157
+ :config="{
158
+ tools: {
159
+ header: require('@editorjs/header')
160
+ }
161
+ }"
162
+ />
163
+ ```
164
+
165
+ #### Saving Example Code
140
166
``` vue
141
- <editor header list code ... :config="config"/>
167
+ <template>
168
+ <div id="app">
169
+ <Editor ref="editor" :config="config" />
170
+
171
+ <button @click="invokeSave">Save</button>
172
+ </div>
173
+ </template>
174
+
175
+ <script>
176
+ export default {
177
+ methods: {
178
+ invokeSave() {
179
+ this.$refs.editor._data.state.editor.save()
180
+ .then((data) => {
181
+ // Do what you want with the data here
182
+ console.log(data)
183
+ })
184
+ .catch(err => { console.log(err) })
185
+ }
186
+ },
187
+ }
188
+ </script>
142
189
```
143
190
144
191
## Upload Image (>= 1.1.0)
145
192
146
- for upload image , You need a backend for processing image . vue-editor-js provide special ` config ` props for easy .
147
- If you server for test upload image, please see [ server example] ( https://github.com/ChangJoo-Park/vue-editor-js-imageserver ) .
193
+ for uploading images , You will need a backend for processing the images . vue-editor-js provides a special ` config ` prop for easability .
194
+ If you are testing your server to upload an image, please see [ server example] ( https://github.com/ChangJoo-Park/vue-editor-js-imageserver ) .
148
195
149
196
``` vue
150
197
<editor :config="config" />
0 commit comments