Comment badge improvements#2415
Merged
tf merged 6 commits intocodevise:masterfrom May 7, 2026
Merged
Conversation
For elements that extend to the viewport edge (full width or custom margin) inset the icon on the bottom line of the selection rect and also position drag handler like this instead of moving it inside the element. Position margin indicator tooltips to prevent overlap with icons. Display selection rect with open sides when it is full width. Also fix position of drag indicator for editable text selection rects. REDMINE-21261
Pass placement: 'left-start' to useAnchoredFloating so badges land on the left side of the editable container instead of the right. The alignToContainerEdge middleware already supports 'left'-prefixed placements; right edge of the floating element ends up at containerRect.left - 8 (the same 8px offset used everywhere else).
Drop the explicit height on .badge and the breakpoint-md override that bumped it on desktop, and let the consistent space(1.5) padding shape the badge across viewports. Also drop the now-redundant height: auto on .iconOnly. The .dot variant keeps its fixed dimensions.
…ction When a text block is focused with a non-collapsed selection but no new comment thread has been activated yet, render an icon-mode badge at the location where a future inline comment badge for that range would appear. Acts as a 'you can comment here' hint. Renders the badge via a standalone PendingSelectionBadge component that anchors floating-ui directly at editor.selection's DOM range — not via the highlights/decoration system. Going through highlights would require busting MemoizedText's leaf cache on every selection change, and the resulting leaf re-render makes Slate force-sync the (still-stale) editor.selection back to the DOM, re-selecting text on mouseup outside an existing selection. Extracts useEffectiveSelection(editor, onChange) so HoveringToolbar and the new PendingSelectionBadge share identical 'settled and meaningful selection' timing — same isDragging guard, same focus, collapsed and empty-string filters. Both attach a native mousedown listener on the editor's DOM node and flip back via a one-shot document mouseup with a 10ms settle delay. The pending icon now appears at exactly the same moment as the hovering toolbar. Exports alignToContainerEdge from rangeAnchors so the new badge can reuse the same horizontal placement logic as BadgeColumn.
Extract the local useStartNewThread hook from HoveringToolbar into a shared module so the pending-selection icon badge can fire the same 'open new-thread form for the current selection' action when clicked. HoveringToolbar's comment button keeps using the same hook for now — removed in a follow-up.
The pending-selection icon badge already triggers the same useStartNewThread action when clicked, so the dedicated comment button in the hovering toolbar is no longer needed. Drop the button, its handler branch, and the AddCommentIcon import.
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.
REDMINE-21261