From 34b8038819a88a20985a63d2e8510a3ed0b8ff87 Mon Sep 17 00:00:00 2001 From: Shaswat Raj <108283560+playlikeboy@users.noreply.github.com> Date: Sun, 25 Oct 2026 10:20:12 +0530 Subject: [PATCH 1/2] fix(inline-toolbar): do not show "Convert to" when there is nothing to convert to The inline "Convert to" item was rendered even when no conversion targets were available for the current block. getConvertibleToolsForBlock() kept tools whose toolbox entries had all been filtered out (for example the block's own tool, whose only toolbox entry describes the block itself), leaving them with an empty toolbox. ConvertInlineTool.render() then only checked the number of convertible tools, not the number of resulting menu items, so it returned a "Convert to" item with an empty items list. The block tunes menu in blockSettings.ts already guards on the items count, which is why the bug only appeared in the inline toolbar. - utils/blocks: skip tools whose toolbox entries were all filtered out - inline-tool-convert: return no item when there are no convert items, mirroring the existing guard in the block tunes menu Adds a Cypress regression test: with only the default paragraph tool available, the inline toolbar opens without a convert-to item. Related to #2833 --- .../inline-tools/inline-tool-convert.ts | 7 ++++ src/components/utils/blocks.ts | 9 +++++ .../cypress/tests/modules/InlineToolbar.cy.ts | 33 +++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/src/components/inline-tools/inline-tool-convert.ts b/src/components/inline-tools/inline-tool-convert.ts index b0347a682..b4e6f777c 100644 --- a/src/components/inline-tools/inline-tool-convert.ts +++ b/src/components/inline-tools/inline-tool-convert.ts @@ -89,6 +89,13 @@ export default class ConvertInlineTool implements InlineTool { return result; }, []); + /** + * Do not show the "Convert to" item when there is nothing to convert to + */ + if (convertToItems.length === 0) { + return []; + } + const currentBlockToolboxItem = await currentBlock.getActiveToolboxEntry(); const icon = currentBlockToolboxItem !== undefined ? currentBlockToolboxItem.icon : IconReplace; const isDesktop = !_.isMobileScreen(); diff --git a/src/components/utils/blocks.ts b/src/components/utils/blocks.ts index 710cfa5f8..60cb79068 100644 --- a/src/components/utils/blocks.ts +++ b/src/components/utils/blocks.ts @@ -99,6 +99,15 @@ export async function getConvertibleToolsForBlock(block: BlockAPI, allBlockTools return true; }); + /** + * Skip tools whose toolbox entries were all filtered out: + * such tools have nothing a block could be converted to, + * so they should not be treated as convertible + */ + if (actualToolboxItems.length === 0) { + return result; + } + result.push({ ...tool, toolbox: actualToolboxItems, diff --git a/test/cypress/tests/modules/InlineToolbar.cy.ts b/test/cypress/tests/modules/InlineToolbar.cy.ts index c68cd0399..f593ce7f8 100644 --- a/test/cypress/tests/modules/InlineToolbar.cy.ts +++ b/test/cypress/tests/modules/InlineToolbar.cy.ts @@ -220,6 +220,39 @@ describe('Inline Toolbar', () => { }); }); + describe('Conversion toolbar without convertible tools', () => { + it('should not show the convert-to item when there are no tools to convert to', () => { + /** + * Only the default paragraph tool is available, + * so the current block cannot be converted to anything + */ + cy.createEditor({ + data: { + blocks: [ + { + type: 'paragraph', + data: { + text: 'Some text', + }, + }, + ], + }, + }); + + cy.get('[data-cy=editorjs]') + .find('.ce-paragraph') + .selectText('Some text'); + + /** Inline Toolbar should be opened with the usual inline tools */ + cy.get('[data-cy="inline-toolbar"] .ce-popover__container') + .should('be.visible'); + + cy.get('[data-cy=editorjs]') + .get('[data-item-name=convert-to]') + .should('not.exist'); + }); + }); + describe('Nested Editor instance inline toolbar', () => { it('should not close inline toolbar of the nested Editor instance when clicking within that toolbar', () => { cy.createEditor({ From aa7f63a432b83383d8fb8c761c56da49d73ca0e4 Mon Sep 17 00:00:00 2001 From: Shaswat Raj Date: Sun, 1 Nov 2026 16:39:14 +0530 Subject: [PATCH 2/2] chore: bump rc version and add changelog entry Co-Authored-By: Claude Fable 5.1 --- docs/CHANGELOG.md | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 67ee4c0e3..480a12c7f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,6 +4,7 @@ - `Improvement` - Removed "Narrow" ("Thin") mode. On non-mobile viewports, Plus and Block Tunes controls now use a responsive action rail beside the editor content. - `Improvement` - `paste` config supports filter functions for tag-based substitution +- `Fix` - "Convert to" is not shown in the Inline Toolbar when there are no tools to convert to ### 2.31.7 diff --git a/package.json b/package.json index ccd9b3070..b57e61968 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/editorjs", - "version": "2.32.0-rc.2", + "version": "2.32.0-rc.3", "description": "Editor.js — open source block-style WYSIWYG editor with JSON output", "main": "dist/editorjs.umd.js", "module": "dist/editorjs.mjs",