diff --git a/README.md b/README.md index 11ef0b8d..2ea846ea 100644 --- a/README.md +++ b/README.md @@ -1,277 +1,234 @@ - +
+ + + +
-[![](https://flat.badgen.net/npm/v/@editorjs/editorjs?icon=npm)](https://www.npmjs.com/package/@editorjs/editorjs) -[![](https://flat.badgen.net/bundlephobia/min/@editorjs/editorjs?color=cyan)](https://www.npmjs.com/package/@editorjs/editorjs) -[![](https://flat.badgen.net/bundlephobia/minzip/@editorjs/editorjs?color=green)](https://www.npmjs.com/package/@editorjs/editorjs) -[![Backers on Open Collective](https://opencollective.com/editorjs/backers/badge.svg)](#backers) -[![Sponsors on Open Collective](https://opencollective.com/editorjs/sponsors/badge.svg)](#sponsors) -[![](https://img.shields.io/npm/l/@editorjs/editorjs?style=flat-square)](https://www.npmjs.com/package/@editorjs/editorjs) -[![Join the chat at https://gitter.im/codex-team/editor.js](https://badges.gitter.im/codex-team/editor.js.svg)](https://gitter.im/codex-team/editor.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ++ editorjs.io | + documentation | + changelog + +
-| | | | | | | -| --------- | --------- | --------- | --------- | --------- | --------- | -| Edge 12+ | Firefox 18+ | Chrome 49+ | Safari 10+ | iOS Safari 10+ | Opera 36+ + +## About +Editor.js is an open-source text editor offering a variety of features to help users create and format content efficiently. It has a modern, block-style interface that allows users to easily add and arrange different types of content, such as text, images, lists, quotes, etc. Each Block is provided via a separate plugin making Editor.js extremely flexible. -## Roadmap +Editor.js outputs a clean JSON data instead of heavy HTML markup. Use it in Web, iOS, Android, AMP, Instant Articles, speech readers, AI chatbots — everywhere. Easy to sanitize, extend and integrate with your logic. - +- 😍 Modern UI out of the box +- 💎 Clean JSON output +- ⚙️ Well-designed API +- 🛍 Various Tools available +- 💌 Free and open source -- Collaborative editing - - [ ] Implement Inline Tools JSON format `In progress` [#1801](https://github.com/codex-team/editor.js/pull/1801) - - [ ] Implement Operations creation and transformations - - [ ] Implement Tools API changes - - [ ] Implement Server and communication - - [ ] Update basic tools to fit the new API + -- Unified Toolbox - - [x] Block Tunes moved left [#1815](https://github.com/codex-team/editor.js/pull/1815) - - [x] Toolbox become vertical [#2014](https://github.com/codex-team/editor.js/pull/2014) - - [x] Ability to display several Toolbox buttons by the single Tool [#2050](https://github.com/codex-team/editor.js/pull/2050) - - [x] Block Tunes become vertical - - [ ] Conversion Toolbar uses Unified Toolbox - - [ ] Conversion Toolbar added to the Block Tunes -- Ecosystem improvements +## Installation - - - +It's quite simple: -## +1. Install Editor.js +2. Install tools you need +3. Initialize Editor's instance +Install using NPM, Yarn, or [CDN](https://www.jsdelivr.com/package/npm/@editorjs/editorjs): -## 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](https://opencollective.com/editorjs) - -### Sponsors - -Support us by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/editorjs/contribute/sir-8679/checkout)] - - - - - - - ### Backers - - Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/editorjs/contribute/backer-8632/checkout)] - - - -### 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](https://github.com/codex-team/editor.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+task%22). You can write to us on `team@codex.so` or via special [Telegram chat](https://t.me/editorjsdev), or any other way. - -## Documentation - -Please visit [https://editorjs.io/](https://editorjs.io) to view all documentation articles. - -- [Base concepts](https://editorjs.io/base-concepts) -- [Getting started](https://editorjs.io/getting-started) -- [Configuration](https://editorjs.io/configuration) -- [How to create a Block Tool Plugin](https://editorjs.io/creating-a-block-tool) -- [How to create an Inline Tool Plugin](https://editorjs.io/creating-an-inline-tool) -- [API for Tools](https://editorjs.io/tools-api) - -You can join a [Gitter-channel](https://gitter.im/codex-team/editor.js) or [Telegram-chat](//t.me/codex_editor) and ask a question. - -## Changelog - -See the whole [Changelog](/docs/CHANGELOG.md) - -If you want to follow Editor.js updates, [subscribe to our Newsletter](http://digest.editorjs.io/). - -## 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](http://github.com/editor-js/) ready-to-use Plugins and a [simple API](https://editorjs.io/tools-api) for creating new ones. - -How to use the Editor after [Installation](https://editorjs.io/getting-started). - -- 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. - - - ![](https://github.com/editor-js/list/raw/master/assets/example.gif) - -- Select a text fragment and apply a style or insert a link from the Inline Toolbar - -![](https://capella.pics/7ccbcfcd-1c49-4674-bea7-71021468a1bd.jpg) - -- 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. - -![](https://capella.pics/01a55381-46cd-47c7-b92e-34765434f2ca.jpg) - -### 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: - -```js -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](#load-editors-core) -2. [Load Tools](#load-tools) -3. [Initialize Editor's instance](#create-editor-instance) - -### Step 1. Load Editor's core - -Get Editor.js itself. It is a [minified script](dist/editor.js) 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 - -```shell +```bash npm i @editorjs/editorjs ``` -Include module in your application +Choose and install tools: -```javascript -import EditorJS from '@editorjs/editorjs'; -``` +- [Heading](https://github.com/editor-js/header) +- [Quote](https://github.com/editor-js/quote) +- [Image](https://github.com/editor-js/image) +- [Simple Image](https://github.com/editor-js/simple-image) (without backend requirement) +- [Nested List](https://github.com/editor-js/nested-list) +- [Checklist](https://github.com/editor-js/checklist) +- [Link embed](https://github.com/editor-js/link) +- [Embeds](https://github.com/editor-js/embed) (YouTube, Twitch, Vimeo, Gfycat, Instagram, Twitter, etc) +- [Table](https://github.com/editor-js/table) +- [Delimiter](https://github.com/editor-js/delimiter) +- [Warning](https://github.com/editor-js/warning) +- [Code](https://github.com/editor-js/code) +- [Raw HTML](https://github.com/editor-js/raw) +- [Attaches](https://github.com/editor-js/attaches) +- [Marker](https://github.com/editor-js/marker) +- [Inline Code](https://github.com/editor-js/inline-code) -##### Option B. Use a CDN +See the [😎 Awesome Editor.js](https://github.com/editor-js/awesome-editorjs) list for more tools. -You can load EditorJS directly from from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@editorjs/editorjs). - -`https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest` - -For example, place this in your HTML: - -```html - -``` - -Or download the bundle file and use it from your server. - -```html - -``` - -### Step 2. Load the Tools that you want to make available - -Each Block is represented by a [Tool](docs/tools.md). Tools are simple external scripts with their own logic. For example, there is a [Header](https://github.com/editor-js/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 - -```html - -``` - -Check [Editor.js's community](https://github.com/editor-js/) to see more ready-to-use Tools. - -### Step 3. Create Editor instance - -Create an instance of Editor.js and pass [Configuration Object](types/configs/editor-config.d.ts) with `holderId` and tools list. +Initialize the Editor: ```html ``` -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. - ```javascript -var editor = new EditorJS(); /** Zero-configuration */ +import EditorJS from '@editorjs/editorjs' -// equals - -var editor = new EditorJS('editorjs'); +const editor = new EditorJS({ + tools: { + // ... your tools + } +}) ```` -Or pass a whole settings object. - -```javascript -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: {} -}); -``` +See details about [Installation](https://editorjs.io/getting-started/) and [Configuration](https://editorjs.io/configuration/) at the documentation. ### Saving Data Call `editor.save()` and handle returned Promise with saved data. ```javascript -editor.save() - .then((savedData) => { - console.log(savedData); - }); +const data = await editor.save() ``` ### Example Take a look at the [example.html](example/example.html) to view more detailed examples. -## Credits and references -- We use [HTMLJanitor](https://github.com/guardian/html-janitor) module in our Sanitizer module. +## Roadmap + + + +- Unified Toolbox + - [x] Block Tunes moved left + - [x] Toolbox becomes vertical + - [x] Ability to display several Toolbox buttons by the single Tool + - [x] Block Tunes become vertical + - [ ] Block Tunes support nested menus + - [ ] Conversion Toolbar uses Unified Toolbox + - [ ] Conversion Toolbar added to the Block Tunes +- Collaborative editing + - [ ] Implement Inline Tools JSON format + - [ ] Operations Observer, Executor, Manager, Transformer + - [ ] Implement Undo/Redo Manager + - [ ] Implement Tools API changes + - [ ] Implement Server and communication + - [ ] Update basic tools to fit the new API +- Other features + - [ ] Blocks drag'n'drop + - [ ] New cross-block selection + - [ ] New cross-block caret moving +- Ecosystem improvements + - [x] CodeX Icons — the way to unify all tools and core icons + - [x] New Homepage and Docs + - [x] @editorjs/create-tool for Tools bootstrapping + - [ ] Editor.js DevTools — stand for core and tools development + - [ ] Editor.js Design System + - [ ] Editor.js Preset Env + - [ ] Editor.js ToolKit + - [ ] New core bundle system + - [ ] New documentation and guides + + + + + +