move constant to CLASSES

This commit is contained in:
dwelle 2025-04-30 13:53:57 +02:00
parent 865328457f
commit 0c02b8a446
3 changed files with 10 additions and 4 deletions

View file

@ -119,6 +119,7 @@ export const CLASSES = {
SHAPE_ACTIONS_MENU: "App-menu__left",
ZOOM_ACTIONS: "zoom-actions",
SEARCH_MENU_INPUT_WRAPPER: "layer-ui__search-inputWrapper",
SHAPE_SWITCH_PANEL_CLASSNAME: "ShapeSwitch__Panel",
};
export const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";

View file

@ -100,6 +100,7 @@ import {
arrayToMap,
type EXPORT_IMAGE_TYPES,
randomInteger,
CLASSES,
} from "@excalidraw/common";
import {
@ -469,7 +470,6 @@ import { EraserTrail } from "../eraser";
import ShapeSwitch, {
getSwitchCategoryFromElements,
SHAPE_SWITCH_PANEL_CLASSNAME,
shapeSwitchAtom,
switchShapes,
} from "./ShapeSwitch";
@ -4183,7 +4183,7 @@ class App extends React.Component<AppProps, AppState> {
event.key === KEYS.TAB &&
(document.activeElement === this.excalidrawContainerRef?.current ||
document.activeElement?.classList.contains(
SHAPE_SWITCH_PANEL_CLASSNAME,
CLASSES.SHAPE_SWITCH_PANEL_CLASSNAME,
))
) {
event.preventDefault();

View file

@ -28,7 +28,12 @@ import {
import { wrapText } from "@excalidraw/element/textWrapping";
import { getFontString, isDevEnv, updateActiveTool } from "@excalidraw/common";
import {
CLASSES,
getFontString,
isDevEnv,
updateActiveTool,
} from "@excalidraw/common";
import { measureText } from "@excalidraw/element/textMeasurements";
@ -301,7 +306,7 @@ const Panel = ({
left: `${panelPosition.x - app.state.offsetLeft - GAP_HORIZONTAL}px`,
zIndex: 2,
}}
className={SHAPE_SWITCH_PANEL_CLASSNAME}
className={CLASSES.SHAPE_SWITCH_PANEL_CLASSNAME}
>
{SHAPES.map(([type, icon]) => {
const isSelected =