mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
chore: Use isDevEnv() and isTestEnv() (#9264)
All checks were successful
Tests / test (push) Successful in 4m50s
All checks were successful
Tests / test (push) Successful in 4m50s
Signed-off-by: Mark Tolmacs <mark@lazycat.hu> Co-authored-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
parent
77aca48c84
commit
e1bb59fb8f
16 changed files with 48 additions and 45 deletions
|
@ -85,7 +85,6 @@ import {
|
|||
DRAGGING_THRESHOLD,
|
||||
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
||||
ELEMENT_TRANSLATE_AMOUNT,
|
||||
ENV,
|
||||
EVENT,
|
||||
FRAME_STYLE,
|
||||
IMAGE_MIME_TYPES,
|
||||
|
@ -258,6 +257,7 @@ import {
|
|||
getDateTime,
|
||||
isShallowEqual,
|
||||
arrayToMap,
|
||||
isDevEnv,
|
||||
} from "../utils";
|
||||
import {
|
||||
createSrcDoc,
|
||||
|
@ -2434,7 +2434,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||
this.excalidrawContainerValue.container =
|
||||
this.excalidrawContainerRef.current;
|
||||
|
||||
if (import.meta.env.MODE === ENV.TEST || import.meta.env.DEV) {
|
||||
if (isTestEnv() || isDevEnv()) {
|
||||
const setState = this.setState.bind(this);
|
||||
Object.defineProperties(window.h, {
|
||||
state: {
|
||||
|
@ -11060,7 +11060,7 @@ declare global {
|
|||
}
|
||||
|
||||
export const createTestHook = () => {
|
||||
if (import.meta.env.MODE === ENV.TEST || import.meta.env.DEV) {
|
||||
if (isTestEnv() || isDevEnv()) {
|
||||
window.h = window.h || ({} as Window["h"]);
|
||||
|
||||
Object.defineProperties(window.h, {
|
||||
|
|
|
@ -14,7 +14,7 @@ import { useUIAppState } from "../../context/ui-appState";
|
|||
import { atom, useSetAtom } from "../../editor-jotai";
|
||||
import { useOutsideClick } from "../../hooks/useOutsideClick";
|
||||
import { KEYS } from "../../keys";
|
||||
import { updateObject } from "../../utils";
|
||||
import { isDevEnv, updateObject } from "../../utils";
|
||||
import { useDevice, useExcalidrawSetAppState } from "../App";
|
||||
import { Island } from "../Island";
|
||||
|
||||
|
@ -52,7 +52,7 @@ export const SidebarInner = forwardRef(
|
|||
}: SidebarProps & Omit<React.RefAttributes<HTMLDivElement>, "onSelect">,
|
||||
ref: React.ForwardedRef<HTMLDivElement>,
|
||||
) => {
|
||||
if (import.meta.env.DEV && onDock && docked == null) {
|
||||
if (isDevEnv() && onDock && docked == null) {
|
||||
console.warn(
|
||||
"Sidebar: `docked` must be set when `onDock` is supplied for the sidebar to be user-dockable. To hide this message, either pass `docked` or remove `onDock`",
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue