feat(editor): add button to insert new blocks at document end#254
Merged
feat(editor): add button to insert new blocks at document end#254
Conversation
Add AddBlockAtEndButton component that enables users to quickly create new blocks at the end of the document with the slash menu pre-activated. The button includes intelligent handling of edge cases: - Cleans up leftover "/" blocks from dismissed slash menus - Reuses empty trailing blocks instead of creating duplicates - Inserts "/" to trigger slash menu with inline decoration Updates document content areas with bottom padding (pb-60) to provide space for the floating button and improve UX. Includes comprehensive test suite validating block detection, insertion, and edge case handling at the ProseMirror level.
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
Adds a new "Add Block at End" button to the editor UI, enabling users to quickly insert new content blocks at the end of a document without needing to scroll or position their cursor manually.
Key Changes
New Component:
AddBlockAtEndButton- A floating button that intelligently manages block insertion at the document endEditor Integration: Integrated the button into
HyperMediaEditorViewcomponentLayout Adjustments:
draft.tsxto use bottom padding (pb-60) instead of margin for better spacingresource-page-common.tsxTest Coverage: Added comprehensive test suite (
addBlockAtEnd.test.ts) covering:Implementation Details
The button uses ProseMirror's editor state to: