Editor.js: How to use editor.js in Vue or React project?

Created on 4 Apr 2019  路  6Comments  路  Source: codex-team/editor.js

I want to use editorjs build a article edit system, but can't find a vuejs or react example

discussion

Most helpful comment

With Vue.js, if you don't want to use a third-party wrapper component, simply init the editor in the mounted() hook and assign it to window:

mounted() {
  window.editor = new EditorJS({...})
}

You can now use that object to access editor.js methods:

data() {
  return {
    content: {}
  }
},
methods: {
  save() {
    window.editor.save().then(saved => this.content = saved)
  },
},

All 6 comments

You can write your own wrapper. There are also several examples written by a community:

https://github.com/changjoo-park/vue-editor-js
https://www.npmjs.com/package/vue-editor-js

Thank you. It helps a lot.

Recently a React wrapper was published by @stfy

https://github.com/stfy/react-editor.js
https://www.npmjs.com/package/@stfy/react-editor.js

it is so good

With Vue.js, if you don't want to use a third-party wrapper component, simply init the editor in the mounted() hook and assign it to window:

mounted() {
  window.editor = new EditorJS({...})
}

You can now use that object to access editor.js methods:

data() {
  return {
    content: {}
  }
},
methods: {
  save() {
    window.editor.save().then(saved => this.content = saved)
  },
},

For your convenience we've collected an awesome-list with third-party libraries and extensions. You can find there wrappers for React and Vue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Someskumarasamy picture Someskumarasamy  路  4Comments

vsvanshi picture vsvanshi  路  4Comments

ReactorboY picture ReactorboY  路  5Comments

hata6502 picture hata6502  路  3Comments

Yakumo-Yukari picture Yakumo-Yukari  路  5Comments