diff --git a/components/text-selection-toolbar.tsx b/components/text-selection-toolbar.tsx index a9bb238b..839980e8 100644 --- a/components/text-selection-toolbar.tsx +++ b/components/text-selection-toolbar.tsx @@ -710,12 +710,47 @@ function MorePopover({ function FloatingToolbar({ position, actions, + isMobile, }: { position: Position; actions: ToolbarAction[]; + isMobile: boolean; }) { - // Calculate position — center above the selection, clamp to viewport - const toolbarWidth = actions.length * 44 + 8; // approximate + if (isMobile) { + // Mobile: fixed bottom bar + return createPortal( +
e.preventDefault()} + > +
+ {actions.map((action) => ( + + ))} +
+
, + document.body, + ); + } + + // Desktop: floating above the selection + const toolbarWidth = actions.length * 44 + 8; const left = Math.max( 8, Math.min( @@ -727,9 +762,9 @@ function FloatingToolbar({ return createPortal(
e.preventDefault()} // prevent losing selection + onMouseDown={(e) => e.preventDefault()} > {actions.map((action) => ( ))}
, @@ -1008,7 +1043,11 @@ export function TextSelectionToolbar() { return (
{/* Floating toolbar */} - + {/* More popover */}