LoginSignup
3
3

More than 3 years have passed since last update.

Editor.jsプラグインで既に保存済みのデータを編集する

Posted at

Editor.jsプラグインで既に保存済みのデータを編集する

本家はこちら
https://editorjs.io/fill-block-with-saved-data

import EditorJS from '@editorjs/editorjs'
//  各種省略

// どこかで定義したdata変数
// JSON形式で保存していたのでparseする
const savedData = this.data ? JSON.parse(this.data) : null

this.editor = new  EditorJS({
  holder: 'codex-editor',
  tools: {
    header:  Header,
  },
  data: savedData, // dataプロパティーに既存データを突っ込む!!
})

// this.editorは好きに呼び出して
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3