mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-12 20:10:09 +02:00

* fix: hide canvas-modifying UI in view mode (#5815) * fix: hide canvas-modifying UI in view mode * add class for better targeting * fix missing `key` * fix: useOutsideClick not working in view mode * fix: Corrected typo in toggle theme shortcut (#5813) * fix: incorrectly selecting linear elements on creation while tool-locked (#5785) * fix: syncing 1-point lines to remote clients (#5677) * feat: stop deleting whole line when no point select in line editor (#5676) * feat: stop deleting whole line when no point select in line editor * Comments typo Co-authored-by: DanielJGeiger <1852529+DanielJGeiger@users.noreply.github.com> Co-authored-by: David Luzar <luzar.david@gmail.com> Co-authored-by: Paul Yi <paulyiengr@gmail.com> Co-authored-by: DanielJGeiger <1852529+DanielJGeiger@users.noreply.github.com>
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import "./ToolIcon.scss";
|
|
|
|
import clsx from "clsx";
|
|
import { ToolButtonSize } from "./ToolButton";
|
|
import { LockedIcon, UnlockedIcon } from "./icons";
|
|
|
|
type LockIconProps = {
|
|
title?: string;
|
|
name?: string;
|
|
checked: boolean;
|
|
onChange?(): void;
|
|
zenModeEnabled?: boolean;
|
|
isMobile?: boolean;
|
|
};
|
|
|
|
const DEFAULT_SIZE: ToolButtonSize = "medium";
|
|
|
|
const ICONS = {
|
|
CHECKED: LockedIcon,
|
|
UNCHECKED: UnlockedIcon,
|
|
};
|
|
|
|
export const LockButton = (props: LockIconProps) => {
|
|
return (
|
|
<label
|
|
className={clsx(
|
|
"ToolIcon ToolIcon__lock",
|
|
`ToolIcon_size_${DEFAULT_SIZE}`,
|
|
{
|
|
"is-mobile": props.isMobile,
|
|
},
|
|
)}
|
|
title={`${props.title} — Q`}
|
|
>
|
|
<input
|
|
className="ToolIcon_type_checkbox"
|
|
type="checkbox"
|
|
name={props.name}
|
|
onChange={props.onChange}
|
|
checked={props.checked}
|
|
aria-label={props.title}
|
|
data-testid="toolbar-lock"
|
|
/>
|
|
<div className="ToolIcon__icon">
|
|
{props.checked ? ICONS.CHECKED : ICONS.UNCHECKED}
|
|
</div>
|
|
</label>
|
|
);
|
|
};
|