Skip to content

Comment badge improvements#2415

Merged
tf merged 6 commits intocodevise:masterfrom
tf:badge-improvements
May 7, 2026
Merged

Comment badge improvements#2415
tf merged 6 commits intocodevise:masterfrom
tf:badge-improvements

Conversation

@tf
Copy link
Copy Markdown
Member

@tf tf commented May 7, 2026

REDMINE-21261

tf added 6 commits May 7, 2026 12:49
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.
@tf tf added this to the v17.2 milestone May 7, 2026
@tf tf merged commit 91f79a0 into codevise:master May 7, 2026
18 checks passed
@tf tf deleted the badge-improvements branch May 7, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant