78775703c9
* typo fixed (#1235)
* Improvements: more translations added to the i18n example (#1250)
* Return the result of block.call (#1205)
* [Improvements] ESLint action (#1099)
* TSLint -> ESLint, GitHub Action
* Update eslint.yml
* Autofix
* more autofix
* fix
* manually fix some issues
* Update CHANGELOG.md
* [Refactor] ESLint fixed (#1100)
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* [Feature] i18n (#1106)
* i18n first steps
* i18n internal, toolbox, api for tools
* namespaced api
* tn, t
* tn in block tunes
* join toolbox and inlineTools under toolNames
* translations
* make enum toolTypes
* Update block.ts
* Update src/components/core.ts
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
* add more types
* rm tn
* export i18n types
* upd bundle
* fix tabulation
* Add type-safe namespaces
* upd
* Improve example
* Update toolbox.ts
* improve examplle
* upd
* fix typo
* Add comments for complex types
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
* Remove unused submodule
* Fixed: icon centering in Firefox
* Do not load styles twice (#1112)
* Do not load styles twice
* Add changelog
* Fix issue link
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Show warning if Block to delete is not found (#1111)
Resolves #1102
* Save Tools' order in the Toolbox (#1113)
Resolves #1073
* fix $.isEmpty performance (#1096)
* fix $.isEmpty performance
* add changelog
* upd bundle
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Add issue templates (#1114)
* Update issue templates (#1121)
* Update issue templates
* Apply suggestions from code review
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
* upd texts
* Update feature_request.md
* Update .github/ISSUE_TEMPLATE/discussion.md
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
* Allowing deleting block by block id (#1108)
* Allowing deleting block by block id
* Fixed no argument error
* Making index value optional for delete operation
* Added to changelog
* Making index value optional for delete operation
* Added parameter description
* Update docs/CHANGELOG.md
* Update types/api/blocks.d.ts
* Update editor.js
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Allow navigate next from last non-initial block (#1110)
Resolves #1103
* Create CODE_OF_CONDUCT.md (#1171)
* Create CODE_OF_CONDUCT.md
* Update changelog file
* Update dependencies (#1122)
* Update dependencies
* upd codex.tooltip
* Update editor.js.LICENSE.txt
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Feature/disable tab event config (#1164)
* Highlight first block on autofocus (#1127)
* Fix shortcut for external tools (#1141)
* fix/shortcut-for-external-tools
* Check inline tools property for shortcut
Co-authored-by: George Berezhnoy <gohabereg@gmail.com>
* Hotfix/issue1133 selection shortcut removed on editor destroy (#1140)
* Removed shortcut CMD+A on editor destroy #1133
* Removed patch version and made code cleaner #1133
* lint error fixes #1133
Co-authored-by: Sisir <sisir@hellosivi.com>
Co-authored-by: George Berezhnoy <gohabereg@gmail.com>
* [Feature] BlockAPI Interface (#1075)
* Fix BlockManager.insert method (#1172)
* Fix BlockManager.insert method
* upd
* Explicitly check for undefined
* Update tools master branches (#1180)
* Update master branches
* Update image
* Update CHANGELOG.md
* Fix behaviour of inputs editing in block settings (#1123)
* lint code
* Update CHANGELOG.md
* Return the result of block.call
This change allows blocks to return the result of `call` methods, thus allowing them to expose arbitrary data as needed.
My particular use case is I am using Vue to mount components inside of the larger editorjs framework. One of the components that we are developing can be thought of as a nested agenda, where labels need to be in an order like:
```
I. Top level
a. second level
i. third level
```
My plan is to have an orchestrator query all blocks, filter those that need labels prepended, and then programmatically tell each block (with another `call` method) to set its depth to the desired level. At that point, Vue can reactively update any labels, etc. that are needed.
I believe this change will allow for other such uses, and I imagine it should not break any existing code since it was returning `null` before.
* Disable ESLint for call method return value
Because we are returning the value of an arbitrary function, the return value can be anything (hence, the return type must be `any`). However, to reduce noise in ESLint output, we disable ESLint checking the line with the `any` type return.
* Change any type to unknown and add to CHANGELOG.md
Change any type of the call method to unknown but eslint shows error
saying the unknown type is undefined, Also, add the chnage to
CHANGELOG.md as an improvement with the link to the PR itself as no
issue was assigned with it.
* Add unknown to eslint globals
* upd
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
Co-authored-by: tasuku-s <tasuku@freemind.co.jp>
Co-authored-by: Athul Anil Kumar <athul7744@outlook.com>
Co-authored-by: Taly <vitalik7tv@yandex.ru>
Co-authored-by: flaming-cl <51183663+flaming-cl@users.noreply.github.com>
Co-authored-by: Nguyen Ngoc Son <sonnn.se@gmail.com>
Co-authored-by: Sisir Das K <37764463+sis-dk@users.noreply.github.com>
Co-authored-by: Sisir <sisir@hellosivi.com>
Co-authored-by: ranemihir <mihirrane171@gmail.com>
* <fix> toolbar--opened overlap with certain text [issue 1196] (#1201)
* [Improvements] ESLint action (#1099)
* TSLint -> ESLint, GitHub Action
* Update eslint.yml
* Autofix
* more autofix
* fix
* manually fix some issues
* Update CHANGELOG.md
* [Refactor] ESLint fixed (#1100)
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* [Feature] i18n (#1106)
* i18n first steps
* i18n internal, toolbox, api for tools
* namespaced api
* tn, t
* tn in block tunes
* join toolbox and inlineTools under toolNames
* translations
* make enum toolTypes
* Update block.ts
* Update src/components/core.ts
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
* add more types
* rm tn
* export i18n types
* upd bundle
* fix tabulation
* Add type-safe namespaces
* upd
* Improve example
* Update toolbox.ts
* improve examplle
* upd
* fix typo
* Add comments for complex types
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
* Remove unused submodule
* Fixed: icon centering in Firefox
* Do not load styles twice (#1112)
* Do not load styles twice
* Add changelog
* Fix issue link
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Show warning if Block to delete is not found (#1111)
Resolves #1102
* Save Tools' order in the Toolbox (#1113)
Resolves #1073
* fix $.isEmpty performance (#1096)
* fix $.isEmpty performance
* add changelog
* upd bundle
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Add issue templates (#1114)
* Update issue templates (#1121)
* Update issue templates
* Apply suggestions from code review
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
* upd texts
* Update feature_request.md
* Update .github/ISSUE_TEMPLATE/discussion.md
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
* Allowing deleting block by block id (#1108)
* Allowing deleting block by block id
* Fixed no argument error
* Making index value optional for delete operation
* Added to changelog
* Making index value optional for delete operation
* Added parameter description
* Update docs/CHANGELOG.md
* Update types/api/blocks.d.ts
* Update editor.js
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Allow navigate next from last non-initial block (#1110)
Resolves #1103
* Create CODE_OF_CONDUCT.md (#1171)
* Create CODE_OF_CONDUCT.md
* Update changelog file
* Update dependencies (#1122)
* Update dependencies
* upd codex.tooltip
* Update editor.js.LICENSE.txt
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Feature/disable tab event config (#1164)
* Highlight first block on autofocus (#1127)
* Fix shortcut for external tools (#1141)
* fix/shortcut-for-external-tools
* Check inline tools property for shortcut
Co-authored-by: George Berezhnoy <gohabereg@gmail.com>
* Hotfix/issue1133 selection shortcut removed on editor destroy (#1140)
* Removed shortcut CMD+A on editor destroy #1133
* Removed patch version and made code cleaner #1133
* lint error fixes #1133
Co-authored-by: Sisir <sisir@hellosivi.com>
Co-authored-by: George Berezhnoy <gohabereg@gmail.com>
* [Feature] BlockAPI Interface (#1075)
* Fix BlockManager.insert method (#1172)
* Fix BlockManager.insert method
* upd
* Explicitly check for undefined
* Update tools master branches (#1180)
* Update master branches
* Update image
* Update CHANGELOG.md
* Fix behaviour of inputs editing in block settings (#1123)
* lint code
* Update CHANGELOG.md
* <fix> toolbar overlap with text
* Add Fix in CHANGELOG.md
* Update editor.js
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
Co-authored-by: tasuku-s <tasuku@freemind.co.jp>
Co-authored-by: Athul Anil Kumar <athul7744@outlook.com>
Co-authored-by: Taly <vitalik7tv@yandex.ru>
Co-authored-by: Nguyen Ngoc Son <sonnn.se@gmail.com>
Co-authored-by: Sisir Das K <37764463+sis-dk@users.noreply.github.com>
Co-authored-by: Sisir <sisir@hellosivi.com>
Co-authored-by: ranemihir <mihirrane171@gmail.com>
* Rename initialBlock to defaultBlock (#1209)
* [Improvements] ESLint action (#1099)
* TSLint -> ESLint, GitHub Action
* Update eslint.yml
* Autofix
* more autofix
* fix
* manually fix some issues
* Update CHANGELOG.md
* [Refactor] ESLint fixed (#1100)
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* [Feature] i18n (#1106)
* i18n first steps
* i18n internal, toolbox, api for tools
* namespaced api
* tn, t
* tn in block tunes
* join toolbox and inlineTools under toolNames
* translations
* make enum toolTypes
* Update block.ts
* Update src/components/core.ts
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
* add more types
* rm tn
* export i18n types
* upd bundle
* fix tabulation
* Add type-safe namespaces
* upd
* Improve example
* Update toolbox.ts
* improve examplle
* upd
* fix typo
* Add comments for complex types
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
* Remove unused submodule
* Fixed: icon centering in Firefox
* Do not load styles twice (#1112)
* Do not load styles twice
* Add changelog
* Fix issue link
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Show warning if Block to delete is not found (#1111)
Resolves #1102
* Save Tools' order in the Toolbox (#1113)
Resolves #1073
* fix $.isEmpty performance (#1096)
* fix $.isEmpty performance
* add changelog
* upd bundle
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Add issue templates (#1114)
* Update issue templates (#1121)
* Update issue templates
* Apply suggestions from code review
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
* upd texts
* Update feature_request.md
* Update .github/ISSUE_TEMPLATE/discussion.md
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
* Allowing deleting block by block id (#1108)
* Allowing deleting block by block id
* Fixed no argument error
* Making index value optional for delete operation
* Added to changelog
* Making index value optional for delete operation
* Added parameter description
* Update docs/CHANGELOG.md
* Update types/api/blocks.d.ts
* Update editor.js
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Allow navigate next from last non-initial block (#1110)
Resolves #1103
* Create CODE_OF_CONDUCT.md (#1171)
* Create CODE_OF_CONDUCT.md
* Update changelog file
* Update dependencies (#1122)
* Update dependencies
* upd codex.tooltip
* Update editor.js.LICENSE.txt
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Feature/disable tab event config (#1164)
* Highlight first block on autofocus (#1127)
* Fix shortcut for external tools (#1141)
* fix/shortcut-for-external-tools
* Check inline tools property for shortcut
Co-authored-by: George Berezhnoy <gohabereg@gmail.com>
* Hotfix/issue1133 selection shortcut removed on editor destroy (#1140)
* Removed shortcut CMD+A on editor destroy #1133
* Removed patch version and made code cleaner #1133
* lint error fixes #1133
Co-authored-by: Sisir <sisir@hellosivi.com>
Co-authored-by: George Berezhnoy <gohabereg@gmail.com>
* [Feature] BlockAPI Interface (#1075)
* Fix BlockManager.insert method (#1172)
* Fix BlockManager.insert method
* upd
* Explicitly check for undefined
* Update tools master branches (#1180)
* Update master branches
* Update image
* Update CHANGELOG.md
* Fix behaviour of inputs editing in block settings (#1123)
* lint code
* Update CHANGELOG.md
* Rename initialBlock to defaultBlock
Closes #993
The initialBlock property is renamed to defaultBlock.
* Change keyword 'InitialBlock' to 'DefaultBlock' in all methods
Fixes #993
All the methods using the keyword 'Initial' or 'initial' for initial block
are replace with 'Default' or 'default'.
For example, the Tools.isIntitial() method is changed to Tools.isDefault().
* Keep initialBlock and defaultBlock both.
initialBlock property is still kept but it will deprecated in the
next major release.
* Change defaultBlock in example.html and rebuild.
* Remove package-lock.json file.
* Update docs/tools.md
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Update example/example-dev.html
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Update example/example.html
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Update example/example-dev.html
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Update example/example.html
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Update src/components/utils.ts
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Update src/components/utils.ts
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Update types/configs/editor-config.d.ts
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Update types/configs/editor-config.d.ts
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Update src/components/utils.ts
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Fix needAddDefaultBlock to needToAddDefaultBlock
* Add as an Improvement to CHANGELOG.md
* Delete editor.js.map
* fix log, rename some more places
* Update example.html
* Update blockManager.ts
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
Co-authored-by: tasuku-s <tasuku@freemind.co.jp>
Co-authored-by: Athul Anil Kumar <athul7744@outlook.com>
Co-authored-by: Taly <vitalik7tv@yandex.ru>
Co-authored-by: flaming-cl <51183663+flaming-cl@users.noreply.github.com>
Co-authored-by: Nguyen Ngoc Son <sonnn.se@gmail.com>
Co-authored-by: Sisir Das K <37764463+sis-dk@users.noreply.github.com>
Co-authored-by: Sisir <sisir@hellosivi.com>
* Fix blocks.delete with undefined index (#1182) (#1218)
* [Improvements] ESLint action (#1099)
* TSLint -> ESLint, GitHub Action
* Update eslint.yml
* Autofix
* more autofix
* fix
* manually fix some issues
* Update CHANGELOG.md
* [Refactor] ESLint fixed (#1100)
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* [Feature] i18n (#1106)
* i18n first steps
* i18n internal, toolbox, api for tools
* namespaced api
* tn, t
* tn in block tunes
* join toolbox and inlineTools under toolNames
* translations
* make enum toolTypes
* Update block.ts
* Update src/components/core.ts
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
* add more types
* rm tn
* export i18n types
* upd bundle
* fix tabulation
* Add type-safe namespaces
* upd
* Improve example
* Update toolbox.ts
* improve examplle
* upd
* fix typo
* Add comments for complex types
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
* Remove unused submodule
* Fixed: icon centering in Firefox
* Do not load styles twice (#1112)
* Do not load styles twice
* Add changelog
* Fix issue link
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Show warning if Block to delete is not found (#1111)
Resolves #1102
* Save Tools' order in the Toolbox (#1113)
Resolves #1073
* fix $.isEmpty performance (#1096)
* fix $.isEmpty performance
* add changelog
* upd bundle
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Add issue templates (#1114)
* Update issue templates (#1121)
* Update issue templates
* Apply suggestions from code review
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
* upd texts
* Update feature_request.md
* Update .github/ISSUE_TEMPLATE/discussion.md
Co-Authored-By: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
* Allowing deleting block by block id (#1108)
* Allowing deleting block by block id
* Fixed no argument error
* Making index value optional for delete operation
* Added to changelog
* Making index value optional for delete operation
* Added parameter description
* Update docs/CHANGELOG.md
* Update types/api/blocks.d.ts
* Update editor.js
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Allow navigate next from last non-initial block (#1110)
Resolves #1103
* Create CODE_OF_CONDUCT.md (#1171)
* Create CODE_OF_CONDUCT.md
* Update changelog file
* Update dependencies (#1122)
* Update dependencies
* upd codex.tooltip
* Update editor.js.LICENSE.txt
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Feature/disable tab event config (#1164)
* Highlight first block on autofocus (#1127)
* Fix shortcut for external tools (#1141)
* fix/shortcut-for-external-tools
* Check inline tools property for shortcut
Co-authored-by: George Berezhnoy <gohabereg@gmail.com>
* Hotfix/issue1133 selection shortcut removed on editor destroy (#1140)
* Removed shortcut CMD+A on editor destroy #1133
* Removed patch version and made code cleaner #1133
* lint error fixes #1133
Co-authored-by: Sisir <sisir@hellosivi.com>
Co-authored-by: George Berezhnoy <gohabereg@gmail.com>
* [Feature] BlockAPI Interface (#1075)
* Fix BlockManager.insert method (#1172)
* Fix BlockManager.insert method
* upd
* Explicitly check for undefined
* Update tools master branches (#1180)
* Update master branches
* Update image
* Update CHANGELOG.md
* Fix behaviour of inputs editing in block settings (#1123)
* lint code
* Update CHANGELOG.md
* fix: blocks.delete with undefined index (#1182)
* Add as a Fix in CHANGELOG.md.
* Update editor.js
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
Co-authored-by: tasuku-s <tasuku@freemind.co.jp>
Co-authored-by: Athul Anil Kumar <athul7744@outlook.com>
Co-authored-by: Taly <vitalik7tv@yandex.ru>
Co-authored-by: flaming-cl <51183663+flaming-cl@users.noreply.github.com>
Co-authored-by: Nguyen Ngoc Son <sonnn.se@gmail.com>
Co-authored-by: Sisir Das K <37764463+sis-dk@users.noreply.github.com>
Co-authored-by: Sisir <sisir@hellosivi.com>
Co-authored-by: ranemihir <mihirrane171@gmail.com>
* Fix spam clicking the tune button in Firefox (#1285)
* Fix spam cliclikng tune in Firefox #1273
* build
* Disabled unwanted I18n messages (#1282)
* The unwanted I18n messages from console is disabled
* Update docs/CHANGELOG.md
Improved Change log
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Remove import statement
import * as _ from '../utils';
removed
* Apply suggestions from code review
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
* Move SavedData and ValidatedData interfaces from internal types (#1251)
* Move SavedData and ValidatedData interfaces from internal types
* Add changelog
* Upd submodules (#1287)
* upd modules
* Revert "upd modules"
This reverts commit
|
||
---|---|---|
.github | ||
dist | ||
docs | ||
example | ||
src | ||
types | ||
.babelrc | ||
.editorconfig | ||
.eslintignore | ||
.eslintrc | ||
.gitignore | ||
.gitmodules | ||
.npmignore | ||
.postcssrc.yml | ||
.stylelintrc | ||
CODEOWNERS | ||
LICENSE | ||
package.json | ||
README.md | ||
tsconfig.json | ||
tslint.json | ||
webpack.config.js | ||
yarn.lock |
IE / Edge |
Firefox |
Chrome |
Safari |
iOS Safari |
Opera |
---|---|---|---|---|---|
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.
- Base concepts
- Getting started
- Configuration
- How to create a Block Tool Plugin
- How to create an Inline Tool Plugin
- API for Tools
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.
- Select a text fragment and apply a style or insert a link from the Inline Toolbar
- 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.
Shortcuts
A few shortcuts are preset as available.
Shortcut | Action | Restrictions |
---|---|---|
TAB |
Show/leaf a Toolbox. | On empty block |
SHIFT+TAB |
Leaf back a Toolbox. | While Toolbox is opened |
ENTER |
Create a Block | While Toolbox is opened and some Tool is selected |
CMD+B |
Bold style | On selection |
CMD+I |
Italic style | On selection |
CMD+K |
Insert a link | On 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.
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
- Local file from project
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>
Option C. Save source within your project
Copy the editor.js file to your project and load it.
<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
- We use HTMLJanitor module in our Sanitizer module.
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