import { useUIState } from "src/useUIState"; import { ReplicacheMutators, useReplicache } from "src/replicache"; import { ToolbarButton } from "./index"; import { copySelection } from "src/utils/copySelection"; import { useSmoker, useToaster } from "components/Toast"; import { Props } from "components/Icons/Props"; import { TextAlignmentButton } from "./TextAlignmentToolbar"; import { getSortedSelection } from "components/SelectionManager/selectionState"; import { deleteBlock } from "src/utils/deleteBlock"; import { Separator, ShortcutKey } from "components/Layout"; export const MultiselectToolbar = (props: { setToolbarState: (state: "multiselect" | "text-alignment") => void; }) => { const { rep, undoManager } = useReplicache(); const smoker = useSmoker(); const toaster = useToaster(); const handleCopy = async (event: React.MouseEvent) => { if (!rep) return; let [sortedSelection] = await getSortedSelection(rep); await copySelection(rep, sortedSelection); smoker({ position: { x: event.clientX, y: event.clientY }, text: "Copied to clipboard", }); }; return (
{ e.stopPropagation(); if (!rep) return; let [sortedSelection] = await getSortedSelection(rep); await deleteBlock( sortedSelection.map((b) => b.value), rep, undoManager, ); toaster({ content: (
{sortedSelection.length} block {sortedSelection.length === 1 ? "" : "s"} deleted!{" "} Ctrl Z{" "} to undo.
), type: "success", }); }} >
); }; const CopySmall = (props: Props) => { return ( ); }; const TrashSmall = (props: Props) => { return ( ); };