Repository navigation
fix(inline-toolbar): do not show "Convert to" when there is nothing to convert to - #3040
Open
playlikeboy wants to merge 1 commit into
Open
playlikeboy wants to merge 1 commit into
playlikeboy wants to merge 1 commit into
Conversation
…o 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 codex-team#2833
playlikeboy
requested review from
TatianaFomina,
gohabereg,
ilyamore88 and
neSpecc
as code owners
October 25, 2026 04:54
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The inline toolbar shows a Convert to item even when there is nothing the current block can be converted to — it opens an empty submenu. As confirmed in #2833: "We should not show convertTo if there is no blocks to convert to."
This PR fixes that for the inline toolbar. (It does not make
convertToconfigurable viainlineToolbar— per the discussion in #2833 that part is not planned.)Root cause
getConvertibleToolsForBlock()filters each candidate tool's toolbox entries (dropping entries that describe the current block itself, entries without icons, etc.) but then keeps the tool even when all of its entries were filtered out, leaving it with an empty toolbox.Example: in an editor with only the default paragraph tool, the paragraph's single toolbox entry is filtered out (it describes the current block), yet the tool was still returned as "convertible".
ConvertInlineTool.render()only checked the number of convertible tools, not the number of resulting menu items, so it returned a Convert to item whoseitemslist is empty. The block tunes menu (blockSettings.ts) already guards on the items count, which is why the bug only appeared in the inline toolbar.Changes
src/components/utils/blocks.ts—getConvertibleToolsForBlock()now skips tools whose toolbox entries were all filtered out.src/components/inline-tools/inline-tool-convert.ts—render()returns no item when there are no convert items, mirroring the existing guard in the block tunes menu.test/cypress/tests/modules/InlineToolbar.cy.ts— regression test: with only the default paragraph tool available, selecting text opens the inline toolbar without aconvert-toitem.Related issue
#2833 (the maintainer-confirmed part: Convert to must not be shown when there are no blocks to convert to)
Testing
eslinton all changed files: no errors. Fulleslint src/totals are identical before and after this change (257 problems — 23 errors / 234 warnings — pre-existing onnextwith the locally resolved toolchain).vite build(production): passes.vite build --mode test(build:test): passes.@editorjs/paragraphpackage (single toolbox entry withoutdata,conversionConfigimport/exporttext), which is exactly the case that produced an empty Convert to submenu.