fix: drag handle resolve container blocks + menu popup clamp viewport
Some checks failed
CI / Lint, Unit Tests & Build (push) Failing after 1m24s
CI / Deploy production (on server) (push) Has been skipped

- Drag handle résout les blocs conteneurs (columns, toggle, callout) au lieu du paragraphe intérieur
- Delete agit sur tout le bloc conteneur, pas juste le paragraphe
- Menu popup (block action menu) clampé dans le viewport (Math.min + overflow auto)
- Drag handle clamped dans le viewport via MutationObserver + scroll/resize
This commit is contained in:
Antigravity
2026-06-14 19:01:30 +00:00
parent 7fedfa8f50
commit f7b62009cf
3 changed files with 42 additions and 2 deletions

View File

@@ -21,5 +21,20 @@ export function resolveBlockAtDragHandle(editor: Editor): { node: PMNode; pos: n
const node = editor.state.doc.nodeAt(blockPos)
if (!node) return null
// Climb up to container blocks (columns, toggleBlock, calloutBlock)
// so the drag handle operates on the whole container, not inner paragraphs
const CONTAINER_TYPES = ['columns', 'toggleBlock', 'calloutBlock']
const $blockPos = editor.state.doc.resolve(blockPos)
for (let depth = $blockPos.depth; depth > 0; depth--) {
const ancestor = $blockPos.node(depth)
if (CONTAINER_TYPES.includes(ancestor.type.name)) {
const containerPos = $blockPos.before(depth)
const containerNode = editor.state.doc.nodeAt(containerPos)
if (containerNode) {
return { node: containerNode, pos: containerPos }
}
}
}
return { node, pos: blockPos }
}