import { track, useEditor, TldrawUiMenuItem } from 'tldraw' import { LockIcon } from './Icons' export const LockStatus = track(() => { const editor = useEditor() const selectedShapes = editor.getSelectedShapes() const hasLocked = selectedShapes.some(s => s.isLocked) if (!hasLocked) return null return (
Selection Locked
) }) export const ToggleLockMenuItem = track(() => { const editor = useEditor() const selectedShapes = editor.getSelectedShapes() if (selectedShapes.length === 0) return null const allLocked = selectedShapes.every((s) => s.isLocked) return ( { editor.updateShapes( selectedShapes.map((s) => ({ id: s.id, type: s.type, isLocked: !allLocked, })) ) }} /> ) })