|
1 |
| -# vue-editor-js |
| 1 | +# vue3-editor-js |
2 | 2 |
|
3 |
| -[](https://wallabyjs.com/oss/) |
4 |
| - |
5 |
| - |
6 |
| -vue-editor-js is editorjs wrapper component. |
| 3 | +vue3-editor-js is an Editor.js wrapper component. |
7 | 4 |
|
8 | 5 | Please review this first. https://editorjs.io/
|
9 | 6 |
|
10 |
| -## For before 2.0.0 version users. |
11 |
| - |
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 |
| - |
15 |
| -Please See the [Demo.vue](https://github.com/ChangJoo-Park/vue-editor-js/blob/master/demo/Demo.vue) |
16 |
| - |
| 7 | +This Vue3 port is based on a fork from the [Vue 2 version](https://github.com/ChangJoo-Park/vue-editor-js) |
17 | 8 |
|
18 |
| -## For before 1.0.0 version users. |
| 9 | +## Editor.Js |
19 | 10 |
|
20 |
| -Please use `Vue.use` vue-editor-js in main.js. |
| 11 | +Current Editor.js version: `2.25.0` |
21 | 12 |
|
22 | 13 | ## Supported Plugins
|
23 | 14 |
|
24 |
| -- [Personality](https://github.com/editor-js/personality) |
25 |
| -- [Header](https://github.com/editor-js/header) |
26 |
| -- [List](https://github.com/editor-js/list) |
27 |
| -- [Image](https://github.com/editor-js/image) |
28 |
| -- [InlineCode](https://github.com/editor-js/inline-code) |
29 |
| -- [Embed](https://github.com/editor-js/embed) |
30 |
| -- [Quote](https://github.com/editor-js/quote) |
31 |
| -- [Marker](https://github.com/editor-js/marker) |
32 |
| -- [Code](https://github.com/editor-js/code) |
33 |
| -- [Link](https://github.com/editor-js/link) |
34 |
| -- [Delimiter](https://github.com/editor-js/delimiter) |
35 |
| -- [Raw](https://github.com/editor-js/raw) |
36 |
| -- [Table](https://github.com/editor-js/table) |
37 |
| -- [Warning](https://github.com/editor-js/warning) |
38 |
| -- [Paragraph](https://github.com/editor-js/paragraph) |
39 |
| -- [Checklist](https://github.com/editor-js/checklist) |
40 |
| - |
41 |
| -## Installation |
42 |
| - |
43 |
| -```bash |
44 |
| -# NPM |
45 |
| -npm install --save vue-editor-js |
46 |
| - |
47 |
| -# or Yarn |
48 |
| -yarn add vue-editor-js |
49 |
| -``` |
50 |
| - |
51 |
| -## Usage |
52 |
| - |
53 |
| -### In main.js |
54 |
| -```js |
55 |
| -// ... |
56 |
| -import Editor from 'vue-editor-js' |
57 |
| - |
58 |
| -Vue.use(Editor) |
59 |
| -// ... |
60 |
| -``` |
61 |
| - |
62 |
| -### In Nuxt.js |
63 |
| -```js |
64 |
| -// in nuxt.config.js |
65 |
| -plugins: [ |
66 |
| - { |
67 |
| - src: '~/plugins/vue-editor.js', ssr: false |
68 |
| - } |
69 |
| -], |
70 |
| - |
71 |
| -// in ~/plugins/vue-editor.js |
72 |
| -import Vue from 'vue' |
73 |
| -import Editor from 'vue-editor-js' |
74 |
| - |
75 |
| -Vue.use(Editor) |
76 |
| -``` |
77 |
| - |
78 |
| -```Vue |
79 |
| - <editor ref="editor" :config="config" :initialized="onInitialized"/> |
80 |
| -``` |
81 |
| - |
82 |
| -Define the initialization function to get the instance of editor.js when initializing |
83 |
| - |
84 |
| -If you are confused with using it with Nuxt, please see [here](https://github.com/ChangJoo-Park/vue-editor-on-nuxt) |
85 |
| - |
86 |
| -## Local import |
87 |
| - |
88 |
| -If you wish to only import Editor on a single component then you can do so by following the instructions below |
89 |
| - |
90 |
| -1. Make sure to install `@vue/composition-api` |
91 |
| -```bash |
92 |
| -# NPM |
93 |
| -npm i --save @vue/composition-api |
94 |
| - |
95 |
| -# or Yarn |
96 |
| -yarn add @vue/composition-api |
97 |
| -``` |
98 |
| -2. In main.js: |
99 |
| -```js |
100 |
| -import Vue from 'vue' |
101 |
| -import VueCompositionApi from '@vue/composition-api' |
102 |
| - |
103 |
| -Vue.use(VueCompositionApi) |
104 |
| -``` |
105 |
| -3. Don't import anything from `'vue-editor-js'` in main.js |
106 |
| -4. In your component: |
107 |
| -```js |
108 |
| -import { Editor } from 'vue-editor-js' |
109 |
| - |
110 |
| -export default { |
111 |
| - // ... |
112 |
| - components: { |
113 |
| - Editor, |
114 |
| - }, |
115 |
| - // ... |
116 |
| -} |
117 |
| -``` |
118 |
| - |
119 |
| -## Tools |
120 |
| -### Supported tools |
121 |
| -Same as in Supported Plugins, but with different naming |
122 |
| -- header |
123 |
| -- list |
124 |
| -- code |
125 |
| -- inlineCode |
126 |
| -- personality |
127 |
| -- embed |
128 |
| -- linkTool |
129 |
| -- marker |
130 |
| -- table |
131 |
| -- raw |
132 |
| -- delimiter |
133 |
| -- quote |
134 |
| -- image |
135 |
| -- warning |
136 |
| -- paragraph |
137 |
| -- checklist |
| 15 | +| Plugin | Version | |
| 16 | +|---------------------------------------------------------|----------| |
| 17 | +| [Header](https://github.com/editor-js/header) | `2.6.2` | |
| 18 | +| [List](https://github.com/editor-js/list) | `1.7.0` | |
138 | 19 |
|
139 | 20 |
|
140 |
| -### Usage |
141 |
| - |
142 |
| -1. Install the editorjs tool |
| 21 | +## Installation |
143 | 22 |
|
144 | 23 | ```bash
|
145 | 24 | # NPM
|
146 |
| -npm install --save @editorjs/header |
| 25 | +npm install --save vue3-editor-js |
147 | 26 |
|
148 | 27 | # or Yarn
|
149 |
| -yarn add @editorjs/header |
| 28 | +yarn add vue3-editor-js |
150 | 29 | ```
|
151 | 30 |
|
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 |
166 |
| -```vue |
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> |
189 |
| -``` |
190 |
| - |
191 |
| -## Upload Image (>= 1.1.0) |
192 |
| - |
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). |
195 |
| - |
196 |
| -```vue |
197 |
| -<editor :config="config" /> |
198 |
| -
|
199 |
| -<script> |
200 |
| -... |
201 |
| -data() { |
202 |
| - return { |
203 |
| - config: { |
204 |
| - image: { |
205 |
| - // Like in https://github.com/editor-js/image#config-params |
206 |
| - endpoints: { |
207 |
| - byFile: 'http://localhost:8090/image', |
208 |
| - byUrl: 'http://localhost:8090/image-by-url', |
209 |
| - }, |
210 |
| - field: 'image', |
211 |
| - types: 'image/*', |
212 |
| - }, |
213 |
| - } |
214 |
| - } |
215 |
| -} |
216 |
| -</script> |
217 |
| -``` |
218 |
| - |
219 |
| -## upload personality avatar ( >= 2.0.1) |
220 |
| - |
221 |
| -```js |
222 |
| - config: { |
223 |
| - personality: { |
224 |
| - endpoints: 'http://localhost:8090/image' |
225 |
| - } |
226 |
| -``` |
227 |
| -
|
228 |
| - |
229 |
| -
|
230 |
| -### Other props: |
231 |
| -- customTools - Object with name (key) and class of a custom tool (value) |
232 |
| -
|
233 |
| -Enjoy editorjs with Vue.js Project :tada: |
234 |
| -
|
235 |
| -## How to Contribute? |
236 |
| -
|
237 |
| -1. fork this project. |
238 |
| -2. edit code. |
239 |
| -3. PR |
240 |
| -
|
241 |
| -_OR_ |
242 |
| -
|
243 |
| -1. Just submit a issue! |
244 |
| -
|
245 | 31 | ## Contributors
|
246 | 32 |
|
247 |
| -- [ChangJoo Park](https://github.com/changjoo-park) |
248 |
| -- [yashha](https://github.com/yashha) |
249 |
| -- [Loskir](https://github.com/Loskir) |
250 |
| -
|
251 |
| -
|
252 |
| -## Wallaby.js |
253 |
| -
|
254 |
| -[](https://wallabyjs.com/oss/) |
255 |
| -
|
256 |
| -This repository contributors are welcome to use |
257 |
| -[Wallaby.js OSS License](https://wallabyjs.com/oss/) to get |
258 |
| -test results immediately as you type, and see the results in |
259 |
| -your editor right next to your code. |
| 33 | +- [Klöen Lansfiel](https://github.com/Kloen) |
0 commit comments