A block-style editor with clean JSON output
blocks.convert(blockId, newType)
API method was added. It allows to convert existing Block to a Block of another type.blocks.insertMany()
API method added. It allows to insert several Blocks to the specified index.::selection
outside the editor.blocks.render()
API method optimized. Big documents will be displayed 8x faster.
blocks.clear()
now will trigger onChange with "block-removed" event for all removed blocks.blocks.clear()
now can be awaited.BlockMutationType
and BlockMutationEvent
types exportedblocks.update(id, data)
now can accept partial data object — it will update only passed properties, others will remain the same.blocks.update(id, data)
now will trigger onChange with only block-change
event.blocks.update(id, data)
will return a promise with BlockAPI object of the changed block.Improvement
- The blocks.clear()
now can be awaited.Improvement
- The blocks.render()
won't lead onChange
callImprovement
- BlockMutationType
and BlockMutationEvent
types exportedImprovement
- blocks.update(id, data)
now can accept partial data object — it will update only passed properties, others will remain the same.Improvement
- blocks.update(id, data)
now will trigger onChange with only block-change
event.Improvement
- blocks.update(id, data)
will return a promise with the BlockAPI
object of the changed block.Improvement
- Performance optimizations: initialization speed increased, blocks.render()
API method optimized. Big documents will be displayed faster.New
- The blocks.insertMany()
API method added. It allows to insert several Blocks to specified index.Improvement
- Initialization Loader has been removed.Improvement
- Selection style won't override your custom style for ::selection
outside the editor.Improvement
- "Editor saving" log removedImprovement
- "I'm ready" log removedImprovement
- The stub-block style simplified.Improvement
- If some Block's tool will throw an error during construction, we will show Stub block instead of skipping it during renderImprovement
- Call of blocks.clear()
now will trigger onChange with "block-removed" event for all removed blocks.New
- The .convert(blockId, newType)
API method addedImprovement
- Tools shortcuts could be used to convert one Block to another.Improvement
- Tools shortcuts displayed in the Conversion ToolbarNew
- Block ids now displayed in DOM via a data-id attribute. Could be useful for plugins that want access a Block's element by id.Improvement
- 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.Improvement
- The Delete keydown will work like a Backspace when several Blocks are selected.Improvement
- If we have two empty Blocks, and press Backspace at the start of the second one, the previous will be removed instead of current.Fix
- onChange
won't be called when element marked by data-mutation-free
changes some attributeFix
- onChange
will be called on removing the whole text in a blockonChange
callback. Now the second argument can contain an array of CustomEvents as well as a single one. Multiple changes made in a short period of time will be batched under a single onChange
call.close()
method calls optimized.onChange
callback can be muted if all mutations contain nodes with the data-mutation-free
attribute.block-changed
event triggering. Only block-added
event will be dispatched.EventDispatcher
types improved. Now we can pass EventsMap
via generic to specify a map of event names and their payloads that can be used in a particular EventDispatcher instance.onChange
callback won't trigger when block tunes are opened or closed.BlockToolData
type.pasteConfig
getter with false
value could be used to disable paste handling by Editor.js core. Could be useful if your tool has its own paste handler.Improvement
— Breaking Change — Batching added to the onChange
callback. Now the second argument can contain an array of CustomEvents as well as a single one. If several changes will be made in short period of time, they will be batched under the single onChange
callImprovement
— Pressing "Enter" at the end of a Block won't lead to redundant block-changed
event triggering. Only block-added
event will be dispatched.Fix
— The onChange
won't be triggered with Block Tunes opening and closing.Refactoring
— EventDispatcher
types improved. Now we can pass EventsMap
via generic to specify a map of event names and their payloads that can be used in a particular EventDispatcher instance.Refactoring
— All events in common editor Event Bus now have own type declarations.Refactoring
— Now Blocks don't have own Mutation Observer. The single observer attached to the editor's blocks wrapper element. ModificationsObserver
listens blocks wrapper changes, then emits an event into the common editor Event Bus. Each Block subscribes to such events and handle those who related to a particular Block.Improvement
— Block's mutation handler now will be called on every block change (including background changes). Previously, it have worked only if a particular Block have been focused.Refactoring
— Debounce have been removed from Block's mutation handler. The batching in ModificationObserver
used instead.Improvement
— Number of caret saving method calls optimized for Block Tunes opening/closing.New
— Types for Block mutation events added.Fix
- Several bugs caused by random browser extensions. Now we are not searching for a block's container in the DOM on saving. Instead, we keep it in memory and update it when the tool changes a container element.