2.29.1 โ€ข Published 6 months ago

@editorjs/editorjs v2.29.1

Weekly downloads
13,772
License
Apache-2.0
Repository
github
Last release
6 months ago

npm.io npm.io npm.io Backers on Open Collective Sponsors on Open Collective npm.io Join the chat at https://gitter.im/codex-team/editor.js

IE / EdgeFirefoxChromeSafariiOS SafariOpera
Edge 12+Firefox 18+Chrome 49+Safari 10+Safari 10+Opera 36+

If you like a project ๐Ÿ’—๐Ÿ’—๐Ÿ’—

If you like Editor.js you can support project improvements and development of new features with a donation to our collective.

๐Ÿ‘‰ https://opencollective.com/editorjs

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Backers

Thank you to all our backers! ๐Ÿ™ [Become a backer]

Contributors

This project exists thanks to all the people who contribute.

We really welcome new contributors. If you want to make some code with us, please take a look at the Good First Tasks. You can write to us on team@codex.so or via special Telegram chat, or any other way.

Documentation

Please visit https://editorjs.io/ to view all documentation articles.

You can join a Gitter-channel or Telegram-chat and ask a question.

Changelog

See the whole Changelog

How to use Editor.js

Basics

Editor.js is a Block-Styled editor. Blocks are structural units, of which the Entry is composed. For example, Paragraph, Heading, Image, Video, List are Blocks. Each Block is represented by Plugin. We have many ready-to-use Plugins and a simple API for creating new ones.

How to use the Editor after Installation.

  • Create new Blocks by pressing Enter or clicking the Plus Button
  • Press TAB or click on the Plus Button to view the Toolbox
  • Press TAB again to leaf Toolbox and select a Block you need. Then press Enter.

npm.io

  • Select a text fragment and apply a style or insert a link from the Inline Toolbar

npm.io

  • Use the ยซthree-dotsยป button on the right to open Block Settings. From here, you can move and delete a Block or apply a Tool's settings, if it provided. For example, you can set a Heading level or List style.

npm.io

Shortcuts

A few shortcuts are preset as available.

ShortcutActionRestrictions
TABShow/leaf a Toolbox.On empty block
SHIFT+TABLeaf back a Toolbox.While Toolbox is opened
ENTERCreate a BlockWhile Toolbox is opened and some Tool is selected
CMD+BBold styleOn selection
CMD+IItalic styleOn selection
CMD+KInsert a linkOn selection

Each Tool can also have its own shortcuts. These are specified in the configuration of the Tool, for example:

var editor = new EditorJS({
  //...
  tools: {
    header: {
      class: Header,
      shortcut: 'CMD+SHIFT+H'
    },
    list: {
      class: List,
      shortcut: 'CMD+SHIFT+L'
    }
  }
  //...
 });

Installation Guide

There are few steps to run Editor.js on your site.

  1. Load Editor's core
  2. Load Tools
  3. Initialize Editor's instance

Step 1. Load Editor's core

Get Editor.js itself. It is a minified script with Editor's core and some default must-have tools.

Choose the most usable method of getting Editor for you.

  • Node package
  • Source from CDN
Option A. NPM install

Install the package via NPM or Yarn

npm i @editorjs/editorjs

Include module in your application

import EditorJS from '@editorjs/editorjs';
Option B. Use a CDN

You can load EditorJS directly from from jsDelivr CDN.

https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest

For example, place this in your HTML:

<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>

Or download the bundle file and use it from your server.

<script src="editor.js"></script>

Step 2. Load the Tools that you want to make available

Each Block is represented by a Tool. Tools are simple external scripts with their own logic. For example, there is a Header Tool into which you type your heading text. If you want to be able to use this, install the Header Tool the same way as the Editor (Node.js, CDN, local file).

Example: use Header from CDN

<script src="https://cdn.jsdelivr.net/npm/codex.editor.header@2.0.4/dist/bundle.js"></script>

Check Editor.js's community to see more ready-to-use Tools.

Step 3. Create Editor instance

Create an instance of Editor.js and pass Configuration Object with holderId and tools list.

<div id="editorjs"></div>

You can create a simple Editor with only default Paragraph Tool by passing a string with element's Id (wrapper for Editor) as a configuration param. Or use the default editorjs id for wrapper.

var editor = new EditorJS(); /** Zero-configuration */

// equals

var editor = new EditorJS('editorjs');

Or pass a whole settings object.

var editor = new EditorJS({
    /**
     * Create a holder for the Editor and pass its ID
     */
    holder : 'editorjs',

    /**
     * Available Tools list.
     * Pass Tool's class or Settings object for each Tool you want to use
     */
    tools: {
        header: {
          class: Header,
          inlineToolbar : true
        },
        // ...
    },

    /**
     * Previously saved data that should be rendered
     */
    data: {}
});

Saving Data

Call editor.save() and handle returned Promise with saved data.

editor.save()
  .then((savedData) => {
    console.log(savedData);
  });

Example

Take a look at the example.html to view more detailed examples.

Credits and references

About team

We are CodeX and we build products for developers and makers.

Follow us on Twitter: twitter.com/codex_team

Feel free to contact: team@codex.so

codex.so

@kikstart-ui/lib-editorjs@polo7/block-editoreditor-js-gridbyevolutioncytoscape.stickynote@infinitebrahmanuniverse/nolb-_edi@everything-registry/sub-chunk-277aalda-editoreditorjs-text-colorlegitbee-typescriptlegitbee-core-alphacms-tapircriscostack-frameworkcytoscape-stickynoteeditor-js-componenteditor-js-themeeditorjs-codeeditorjs-code-highlighteditorjs-font-familyeditorjs-font-sizeeditorjs-form-buildereditorjs-component-selectoreditorjs-highlighteditorjs-buildereditorjs-commentfibs-editoreditorjs-vueeditorjs-placeholder-tooleditorjs-preconfigurededitorjs-quizeditorjs-reacteditorjs-inlineeditorjs-layouteditorjs-layout-testingeditorjs-localvideoeditorjs-inline-coloreditorjs-inlinelistfreeflow-coreflexipanelgp-editorjsgs-text-editordraftsddoctors-editordoreactadotailadsstudio-editorjsduxwebhorul-editorhsl-strapi-plugin-react-editorjsidea-reactimage-editorjsilla-builderisha-rte-editorparagraph-editorjs-katexpn-block-editorexchange-react-uiblockeditor-test@dxbz/gs-t-components@edgarjuvianno/vue-sb-components@emilienkopp/ejs-factory@emilienkopp/html-factory@editorjs/dev-tools@om-mediaworks/shacl-form@djitsu/editor@hostlink/survey-jslourd-componentslourd-components-tkatex-editorjsmedusa-plugin-bloggerlrl-cms-tapirmagnerreusecoreru.coon.depssarman-vue-editor-jssl-web-mpsrinstallerssofa-ui-componentsstrapi-academy-plus-editorjsstrapi-editorjsstd-pagestrapi-plugin-editorstrapi-plugin-editorjsstrapi-plugin-editorjs-fieldstrapi-plugin-k-editorjsstrapi-plugin-react-editorjs-extended-embedstrapi-plugin-react-editorjsstrapi-plugin-field-editorjsmurph-projectmtxtrpcv2node-red-contrib-ui-editornuxt3-editorjsnewsproject_typesnewman-editorjs-layoutnuxt-editorjsnext-step-projectodoc-viewernull-editorjsreact-editor-js-reverpreact-editor-simple-imagereact-editor-simple-image.js
2.30.0-rc.9

6 months ago

2.30.0-rc.8

6 months ago

2.30.0-rc.5

6 months ago

2.30.0-rc.7

6 months ago

2.30.0-rc.4

6 months ago

2.30.0-rc.3

6 months ago

2.30.0-rc.2

7 months ago

2.30.0-rc.1

7 months ago

2.30.0-rc.0

8 months ago

2.29.1

9 months ago

2.29.0

9 months ago

2.29.0-rc.8

10 months ago

2.29.0-rc.7

10 months ago

2.28.0-rc.0

1 year ago

2.28.0-rc.1

1 year ago

2.28.0-rc.2

1 year ago

2.28.0-rc.3

1 year ago

2.29.0-rc.6

11 months ago

2.29.0-rc.5

12 months ago

2.28.0-rc.4

1 year ago

2.28.1

1 year ago

2.28.0

1 year ago

2.28.2

12 months ago

2.29.0-rc.0

1 year ago

2.29.0-rc.4

12 months ago

2.29.0-rc.3

12 months ago

2.29.0-rc.2

1 year ago

2.29.0-rc.1

1 year ago

2.27.2

1 year ago

2.27.1

1 year ago

2.27.0

1 year ago

2.27.0-rc.4

2 years ago

2.27.0-rc.3

2 years ago

2.27.0-rc.5

1 year ago

2.27.0-rc.0

2 years ago

2.27.0-rc.2

2 years ago

2.27.0-rc.1

2 years ago

2.26.3

2 years ago

2.26.2

2 years ago

2.26.5

2 years ago

2.26.4

2 years ago

2.26.0-rc.0

2 years ago

2.26.0-rc.1

2 years ago

2.26.0-rc.6

2 years ago

2.26.0-rc.7

2 years ago

2.26.1

2 years ago

2.26.0

2 years ago

2.25.0

2 years ago

2.24.3

2 years ago

2.24.1

2 years ago

2.24.0

2 years ago

2.24.2

2 years ago

2.23.2

3 years ago

2.23.1

3 years ago

2.23.0-rc.2

3 years ago

2.23.0

3 years ago

2.23.0-rc.1

3 years ago

2.23.0-rc.0

3 years ago

2.22.3

3 years ago

2.22.2

3 years ago

2.22.1

3 years ago

2.22.0

3 years ago

2.21.0

3 years ago

2.20.2

3 years ago

2.20.1

4 years ago

2.20.0

4 years ago

2.19.2

4 years ago

2.19.3

4 years ago

2.19.2-rc.2

4 years ago

2.19.2-rc.1

4 years ago

2.19.2-rc.0

4 years ago

2.19.1

4 years ago

2.19.0

4 years ago

2.18.0

4 years ago

2.17.0

5 years ago

2.16.1

5 years ago

2.16.0

5 years ago

2.15.1

5 years ago

2.15.0

5 years ago

2.14.0

5 years ago

2.13.0

5 years ago

2.12.4

6 years ago

2.12.3

6 years ago

2.12.2

6 years ago

2.12.1

6 years ago

2.12.0

6 years ago

2.11.11

6 years ago

2.11.10

6 years ago

2.11.9

6 years ago

2.11.8

6 years ago

2.11.7

6 years ago

2.11.6

6 years ago

2.11.5

6 years ago

2.11.4

6 years ago

2.11.3

6 years ago

2.11.2

6 years ago

2.11.1

6 years ago

2.11.0

6 years ago

2.10.0

6 years ago