mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: command palette (#7804)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
parent
6b523563d8
commit
550a388b2b
63 changed files with 5226 additions and 317 deletions
|
@ -5,6 +5,7 @@ import clsx from "clsx";
|
|||
import { KEYS } from "../keys";
|
||||
import { AppState } from "../types";
|
||||
import { useCreatePortalContainer } from "../hooks/useCreatePortalContainer";
|
||||
import { useRef } from "react";
|
||||
|
||||
export const Modal: React.FC<{
|
||||
className?: string;
|
||||
|
@ -20,6 +21,10 @@ export const Modal: React.FC<{
|
|||
className: "excalidraw-modal-container",
|
||||
});
|
||||
|
||||
const animationsDisabledRef = useRef(
|
||||
document.body.classList.contains("excalidraw-animations-disabled"),
|
||||
);
|
||||
|
||||
if (!modalRoot) {
|
||||
return null;
|
||||
}
|
||||
|
@ -34,7 +39,9 @@ export const Modal: React.FC<{
|
|||
|
||||
return createPortal(
|
||||
<div
|
||||
className={clsx("Modal", props.className)}
|
||||
className={clsx("Modal", props.className, {
|
||||
"animations-disabled": animationsDisabledRef.current,
|
||||
})}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
onKeyDown={handleKeydown}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue