Skip to content
This repository was archived by the owner on Dec 9, 2022. It is now read-only.

Commit d33e975

Browse files
committed
feat(vue3): Rewrite the plugin to work with Vue3 and update all relevant dependencies. Also switch the build tools and update all relevant configurations for a future release on npm. Remove a lot of the Editor.js supported plugins.
1 parent bc817a1 commit d33e975

23 files changed

+32533
-13438
lines changed

.browserslistrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
> 1%
2-
last 2 versions
3-
not ie <= 8
1+
current node
2+
last 2 versions and > 2%
3+
ie > 10

.github/FUNDING.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# These are supported funding model platforms
22

3-
github: [changjoo-park]
4-
ko_fi: A316F4N
3+
github: [Kloen]
4+
patreon: kloenlansfiel

.github/workflow/npm-publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Node.js Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 16
15+
- run: npm ci
16+
- run: npm run build
17+
18+
publish-npm:
19+
needs: build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: actions/setup-node@v3
24+
with:
25+
node-version: 16
26+
registry-url: https://registry.npmjs.org/
27+
- run: npm ci
28+
- run: npm run build
29+
- run: npm publish
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.ncurc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
reject: ['rollup','vue-tsc']

CHANGELOG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# 2.0.2
2-
3-
- Support change holder id @npyramid PR #70
1+
# WIP
42

53
# 1.0.0
64

7-
- Support Vue Composition API
8-
- Drop support import in compoentn
5+
- Vue3 port of `vue-editor-js`
6+
- Removed all the plugins but Header and List
7+
- Update all dependencies
8+
- Update the demo
9+
- Update the building process

README.md

Lines changed: 13 additions & 239 deletions
Original file line numberDiff line numberDiff line change
@@ -1,259 +1,33 @@
1-
# vue-editor-js
1+
# vue3-editor-js
22

3-
[![Wallaby.js](https://img.shields.io/badge/wallaby.js-powered-blue.svg?style=for-the-badge&logo=github)](https://wallabyjs.com/oss/)
4-
5-
6-
vue-editor-js is editorjs wrapper component.
3+
vue3-editor-js is an Editor.js wrapper component.
74

85
Please review this first. https://editorjs.io/
96

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)
178

18-
## For before 1.0.0 version users.
9+
## Editor.Js
1910

20-
Please use `Vue.use` vue-editor-js in main.js.
11+
Current Editor.js version: `2.25.0`
2112

2213
## Supported Plugins
2314

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` |
13819

13920

140-
### Usage
141-
142-
1. Install the editorjs tool
21+
## Installation
14322

14423
```bash
14524
# NPM
146-
npm install --save @editorjs/header
25+
npm install --save vue3-editor-js
14726

14827
# or Yarn
149-
yarn add @editorjs/header
28+
yarn add vue3-editor-js
15029
```
15130

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-
![](https://user-images.githubusercontent.com/1451365/69627876-d7ca9600-108e-11ea-85c7-1e52c4284758.png)
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-
24531
## Contributors
24632

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-
[![Wallaby.js](https://img.shields.io/badge/wallaby.js-powered-blue.svg?style=for-the-badge&logo=github)](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)

babel.config.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
const devPresets = ['@vue/babel-preset-app'];
2+
const buildPresets = [
3+
[
4+
'@babel/preset-env',
5+
{},
6+
],
7+
'@babel/preset-typescript',
8+
];
19
module.exports = {
2-
presets: [
3-
'@vue/app'
4-
]
5-
}
10+
presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets),
11+
};

0 commit comments

Comments
 (0)