mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: command palette tweaks and fixes (#7876)
This commit is contained in:
parent
4987cc53d0
commit
f597bd3e01
10 changed files with 116 additions and 44 deletions
|
@ -39,6 +39,7 @@ import Trans from "../Trans";
|
|||
import DropdownMenuItemContentRadio from "../dropdownMenu/DropdownMenuItemContentRadio";
|
||||
import { THEME } from "../../constants";
|
||||
import type { Theme } from "../../element/types";
|
||||
import { trackEvent } from "../../analytics";
|
||||
|
||||
import "./DefaultItems.scss";
|
||||
|
||||
|
@ -122,7 +123,7 @@ export const SaveAsImage = () => {
|
|||
};
|
||||
SaveAsImage.displayName = "SaveAsImage";
|
||||
|
||||
export const CommandPalette = () => {
|
||||
export const CommandPalette = (opts?: { className?: string }) => {
|
||||
const setAppState = useExcalidrawSetAppState();
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -130,9 +131,13 @@ export const CommandPalette = () => {
|
|||
<DropdownMenuItem
|
||||
icon={boltIcon}
|
||||
data-testid="command-palette-button"
|
||||
onSelect={() => setAppState({ openDialog: { name: "commandPalette" } })}
|
||||
onSelect={() => {
|
||||
trackEvent("command_palette", "open", "menu");
|
||||
setAppState({ openDialog: { name: "commandPalette" } });
|
||||
}}
|
||||
shortcut={getShortcutFromShortcutName("commandPalette")}
|
||||
aria-label={t("commandPalette.title")}
|
||||
className={opts?.className}
|
||||
>
|
||||
{t("commandPalette.title")}
|
||||
</DropdownMenuItem>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue