fix(ui): block context menu acts on the embed, not its target - #13099
Open
ChipNowacek wants to merge 1 commit into
Open
fix(ui): block context menu acts on the embed, not its target#13099ChipNowacek wants to merge 1 commit into
ChipNowacek wants to merge 1 commit into
Conversation
The bullet right-click handler derived block-id from the bullet's blockid attribute. A row rendered through :block/link carries the LINKED block's uuid there and the linking block's own uuid in originalblockid, so every block-level context menu action was built around the embed target rather than the embed. Deleting a node embed via the menu's Cut item therefore destroyed the target and its whole subtree while leaving the embed in place. Distinct from the async-selection defect in logseq/logseq#13096: cut-block! never resolved originals, before or after the worker migration. Verified over six embed shapes (block with content, block with children, empty block, empty page, page with blocks, embed-of-embed chain): the menu's Cut now removes the placeholder and leaves the target intact. Co-Authored-By: Claude Opus 5 <[email protected]>
tiensonqin
force-pushed
the
fix/embed-context-menu-target
branch
from
August 26, 2026 10:38
cce8c43 to
a365cc7
Compare
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.
Fixes logseq/db-test#1104.
Right-clicking a Node embed's bullet and choosing Cut deletes the embedded target
and leaves the embed in place.
The bullet right-click handler derives
block-idfrom the bullet'sblockidattribute. On a row rendered through
:block/linkthat holds the linked block'suuid, while the linking block's own uuid is in
originalblockid. The handler neverreads the latter, so
block-context-menu-content— and every block-level action init — is built around the embed target.
The same handler stores the
.ls-blockrow viaconj-selection-block!, and that rowdoes carry
originalblockid, which is why the menu's selection-based items behavecorrectly while its block-based items do not.
This prefers
originalblockidwhen present:Rows inside an embedded page carry no
originalblockid, so right-clicking one stilltargets that inner block.
Scope
This is not the same defect as logseq/db-test#1105. That one was introduced by the worker
migration (
fe65e36f13); this one predates it —cut-block!has never resolvedoriginals, and the pre-migration version differed only in using a synchronous
db/entity.It also redirects the other block-level menu actions — notably the block-level
deleteviadelete-block-aux!— to the embed rather than its target. That appearsto be the intended behaviour, but it is a wider change than Cut alone and deserves a
look.
Verification
Built from source, driven through the real UI both by injected input and by hand,
with outcomes read from
client-ops.forward_outliner_opsand the fixture restoredbefore each trial. Six embed shapes (block with content, block with children, empty
block, empty page, page with blocks, embed-of-embed chain): the menu's Cut removes
the placeholder and leaves the target intact in every case, with no change to the
keyboard gestures or to "Delete selected blocks".
One caveat on that: those runs were on a build that also carried the logseq/db-test#1105 fix, since
both were in hand by then. This change is independent of it — it touches only how
block-idis derived — but it has not been exercised in isolation.