Repository navigation
Draw no block handle beside the empty line under the last block - #969
Merged
Merged
Conversation
The editor keeps an empty paragraph under the document's last block for the caret: MDXEditor appends one whenever the document ends with a card or a divider, and a decided card that gives its place to its prose leaves that line right under the prose. The handle's pointer tracking counted it as a block, so pointing just below the last block drew the handle beside a blank band about a line tall, as though a thin block were there. The handle now passes over an empty paragraph of the document's own when no block with something on it follows. The paragraph stays, so a click below the last block still puts the caret there and what is written there has its handle; an empty line between two blocks keeps its handle too. A browser test points a few pixels at a time below an open decision and below a decided decision's prose, then writes on the line. Co-authored-by: Alex Lavaee <lavaman131@github.com>
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.
Why
Pointing just below a document's last block showed the block handle (⋮⋮) beside nothing, as though a thin block were there.
The editor keeps an empty paragraph under the last block so the caret has somewhere to go:
The handle's pointer tracking (
BlockHandlePlugininpackages/editor/src/widgets/block-handle.tsx) counted that line as a block. Any pointer in a band about one line tall below the last block brought up the handle.What
The tracker now passes over an empty paragraph at the document's own level when no block with something on it follows. Nothing else changes:
Before and after
Each case was checked in Chromium. A pixel diff of the document pane compared the pointer resting over Chat with the pointer at every 3px from the last block's bottom to 61px below it.
Tests
e2e/block-handle-controls.e2e.tsgains two tests: one with an open decision last, and one with a decided decision's prose last. In each, the pointer first rests on the last block, where the handle shows. It then moves to points 6px apart from just below that block to past the end of the empty line. At every point the handle must be gone. A click on the line and some typing then writes a paragraph after the questionnaire in the saved MDX, and that paragraph has its handle.Both tests failed before the fix for the reason above: the handle was still shown 20px below the open decision and 14px below the decided decision's prose.
Verification on 409993b:
bun run fix: no changes.bun run ciandbun run typespass.bun test packages/editorpasses: 1005 tests.E2E_PORT_BASEunderflock:block-handle-controls,block-selection,notion-blocks,inline-decision-deck,decision-marker,focus,columnsandcallout: 77 passed with 4 workers.focus.e2e.tsandinline-decision-deck.e2e.tspassed in full when rerun with 1 worker (24 passed).