v2.28.0
codex-team/editor.jsv2.28.0Aug 24, 2023by github-actions[bot]
AI Summary
A feature-rich release that introduces new Blocks API methods, significant UX improvements for deletion actions, and major performance optimizations.
Key Highlights
- New `blocks.convert()` API method
- New `blocks.insertMany()` API method
- Performance optimization (Big documents 8x faster)
- Improved Delete key UX behavior
- Block IDs in DOM via data-id attribute
New Features
- Block IDs in DOM (data-id attribute)
- Blocks API: `blocks.convert(blockId, newType)`
- Blocks API: `blocks.insertMany()`
- Performance: Big documents 8x faster
- UX: Improved Delete key behavior
- UI: Initialization Loader removed
- API: `blocks.clear()` is now awaitable
- API: `blocks.update()` supports partial data
- Types: `BlockMutationType` and `BlockMutationEvent` exported
Full Release Notes
<img width="975" alt="2 28" src="https://github.com/codex-team/editor.js/assets/3684889/d6b7a96a-0ceb-4e28-b651-bbb7e5609056"> ## New features - Block ids now displayed in DOM via a data-id attribute. Could be useful for plugins that want to access a Block's element by id. - **Blocks API** — The `blocks.convert(blockId, newType)` API method was added. It allows to convert existing Block to a Block of another type. - **Blocks API** — The `blocks.insertMany()` API method added. It allows to insert several Blocks to the specified index. ## Improvements - **UX** — The Delete keydown at the end of the Block will now work opposite a Backspace at the start. Next Block will be removed (if empty) or merged with the current one. - **UX** — The Delete keydown will work like a Backspace when several Blocks are selected. - **UX** — If we have two empty Blocks, and press Backspace at the start of the second one, the previous will be removed instead of the current. - **Shortcuts** — Tools shortcuts could be used to convert one Block to another. - **UI** — Tools shortcuts displayed in the Conversion Toolbar - **UI** — Initialization Loader has been removed. - **Styles** — Selection style won't override your custom style for `::selection` outside the editor. - **Performance** — Performance optimizations: initialization speed increased, `blocks.render()` API method optimized. **Big documents will be displayed 8x faster.** - **DX** — "Editor saving" log removed - **DX** — "I'm ready" log removed - **UI** — The stub-block style is simplified. - **UI** — If some Block's tool throws an error during construction, we will show Stub block instead of skipping it during render - **onChange** — Call of `blocks.clear()` now will trigger onChange with "block-removed" event for all removed blocks. - **Blocks API** — The `blocks.clear()` now can be awaited. - **Types** — `BlockMutationType` and `BlockMutationEvent` types exported - **Blocks API** — `blocks.update(id, data)` now can accept partial data object — it will update only passed properties, others will remain the same. - **onChange** — `blocks.update(id, data)` now will trigger onChange with only `block-change` event. - **Blocks API** — `blocks.update(id, data)` will return a promise with BlockAPI object of the changed block.