fix: slash menu invisible in presentation mode #2018
Draft
+61
−41
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.
Problem
The slash menu (
/) was completely invisible in presentation mode (layout engine enabled). Pressing/would steal focus to the menu's hidden search input, blocking all typing, but the menu itself was rendered off-screen at ~left: -9900px.Root cause:
Editor.coordsAtPos()always used the ProseMirror view's coordinates, but in presentation mode the PM view is hidden off-screen (left: -9999px). The layout engine renders the visible content separately.Fixes #781
Changes
Editor.coordsAtPos: delegate toPresentationEditor.coordsAtPos()when available, which returns visual layout coordinates instead of hidden PM view coordinates.PresentationEditor.coordsAtPos: add caret geometry fallback via#computeCaretLayoutRect+denormalizeClientPointfor positions wheregetRangeRectsreturns empty (collapsed selections on empty lines).Slash menu plugin: add surface top-left fallback when
coordsAtPosreturns null (blank document before first layout). SetMENU_OFFSET_Xto 0 so the menu aligns with the cursor.Test plan
pnpm dev(layout engine ON by default)/, menu appears at top-left of editor/, menu appears at cursor positionpnpm test, all 5545 tests pass