Block Tunes
@bettysteger is already working on this.
Since Jun 5, 2026.
Assessment
This issue has not been assessed yet.
Description
Block Tunes is type of Tool that can enhance a Block within the editor. It's either could just a functional feature (like moving/removing blocks) or some UI enhancement (e.g. Block background, Spoiler for a Block, etc.)
Tunes are integrated in the UI within the Block Settings
In v2 the functional side of the Tune works via EditorAPI. The UI side works by wrapping the Block content with an element that Tune has control of.
For example:
<div class="background-tune"> <!-- Tune element -->
<div class="block-content">...</div>
</div>
V2 BlockTune and it's constructable interfaces:
export interface BlockTune {
/**
* Returns BlockTune's UI.
* Should return either MenuConfig (recommended) (@see https://editorjs.io/menu-config/)
* or HTMLElement (UI consitency is not guaranteed)
*/
render(): HTMLElement | MenuConfig;
/**
* Method called on Tool render. Pass Tool content as an argument.
*
* You can wrap Tool's content with any wrapper you want to provide Tune's UI
*
* @param {HTMLElement} pluginsContent — Tool's content wrapper
*/
wrap?(pluginsContent: HTMLElement): HTMLElement;
/**
* Called on Tool's saving. Should return any data Tune needs to save
*
* @return {BlockTuneData}
*/
save?(): BlockTuneData;
}
export interface BlockTuneConstructable {
/**
* Flag show Tool is Block Tune
*/
isTune: boolean;
/**
* Tune's sanitize configuration
*/
sanitize?: SanitizerConfig;
/**
* @constructor
*
* @param config - Block Tune config
*/
new(config: {
api: API,
config?: ToolConfig,
block: BlockAPI,
data: BlockTuneData,
}): BlockTune;
/**
* Tune`s prepare method. Can be async
* @param data
*/
prepare?(): Promise<void> | void;
/**
* Tune`s reset method to clean up anything set by prepare. Can be async
*/
reset?(): void | Promise<void>;
}
For V3 there are going to be changes
| Method | Comment |
|---|---|
| save() | not required anymore as data should be saved within the Model |
| render() | should be completely replaced by MenuConfig (maybe even could be a static property |
| wrap() | this is the most challenging part, covered below |
| isTune | should be replaced by type property (see other tool interfaces in V3) |
| sanitize | should not be needed anymore as we store clean data in the model |
| prepare() | should stay |
| reset() | should stay |
Block wrapping problem
In V3 UI is a set of external plugins. Therefore, neither the core nor adapter would have direct access there. However, BlockManager has access to the Tool content (at least for now), so maybe we can intercept the event and wrap the UI there. The task here is to investigate different options to wrap the Block contents (or maybe even use some other concept to change Block's UI)
High level requirements
- BlockTune interface should be described
- BlockTuneAdapter should be added to DOMAdapter to be able to update tune's data and subscribe to its external updates
- Tunes instantiation for the block should be implemented (providing the API and Adapter to the Tune)
- Methods to update BlockTunes' data should be added to the EditorAPI
- Internal Tunes to be implemented: RemoveBlock, MoveBlock
- Dominant language
- TypeScript
- Stars
- 12
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from editor-js/document-model
-
editor-js/document-model#176 · 1 reaction · 2 assignees ·
-
BlocksUI doesn't remove its blocksHolder DOM event listeners (or the holder itself) on destroy() Opengood first issue
Difficulty 4/5 3-5 days Newbie friendliness 58/100
editor-js/document-model#170 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
editor-js/document-model#167 ·
-
Index refactoring Opengood first issue
Difficulty 5/5 Over a week Newbie friendliness 38/100
editor-js/document-model#154 ·
-
Paste plugin Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
editor-js/document-model#137 ·
All issues in editor-js/document-model
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·