mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-12-04 10:25:07 +03:00
feat(editor): ui.disabled.minimap; zoom buttons without the minimap toggle (#12606)
* feat(editor): ui.disabled.minimap; zoom buttons without the minimap toggle
- `ui={{ disabled: { minimap: true } }}`: a new opt-out form of the `ui`
prop, the full default UI minus the controls listed. Removes the minimap
and every way to toggle it (footer button, Preferences item, command
palette and context menu entries), through the minimap action's predicate
- without the minimap toggle (removed by `ui.disabled.minimap`, or the
reduced UI of `ui.enabled`), the zoom controls are the zoom out / zoom
level / zoom in buttons again instead of the zoom menu: their
PanelComponents, styles and zen-mode rules are restored from before #12605
- `isUIControlEnabled` handles both forms and is on AppClassProperties; the
props comparator compares either form generically
Claude Opus 5.5 (xhigh)
* docs(editor): changelog for the minimap, zoom menu and ui.disabled
Claude Opus 5.5 (xhigh)
* fix(editor): hide the zen-mode zoom buttons from keyboard focus
The −/+ buttons' own `visibility: visible` (.ToolIcon_type_button--show)
overrode their wrappers' `visibility: hidden` in zen mode, so Tab still
focused the invisible buttons. Hide the buttons too, at the end of the
wrappers' fade.
Claude Opus 5.5 (xhigh)
This commit is contained in:
1 parent
609f0f2fff
commit
82d5847e57
12 files changed
+327
-36
No files matched your search
@@ -13,6 +13,13 @@ Please add the latest change on the top under the correct section.
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Minimap, zoom menu and `ui.disabled` (2026-11-12) [#12605](https://github.com/excalidraw/excalidraw/pull/12605), [#12606](https://github.com/excalidraw/excalidraw/pull/12606)
|
||||
|
||||
- A toggleable minimap above the bottom-left canvas actions: drag its viewport (or press outside of it) to pan, wheel over it to zoom. Toggled from the footer button next to the zoom level, the Preferences menu, the command palette and the context menu; stored as `appState.minimapEnabled` (in the browser, not in exported files). Not shown on phones or in editors shorter than 500px.
|
||||
- The zoom out / zoom in buttons are replaced by a zoom menu on the zoom level (zoom in and out, zoom to fit, zoom to selection, reset zoom), sharing the footer island with the minimap toggle. The zoom in, zoom out and reset zoom actions are unchanged.
|
||||
- New `ui={{ disabled: { minimap: true } }}`, the opt-out form of the `ui` prop: the full default UI minus the listed controls. It removes the minimap and every way to toggle it.
|
||||
- Without the minimap toggle (`ui.disabled.minimap`, or the reduced UI of `ui={{ enabled: { zoom: true } }}`), the zoom controls stay the zoom out / zoom level / zoom in buttons.
|
||||
|
||||
### Arrows aren't clipped to frames (2026-10-31) [#12516](https://github.com/excalidraw/excalidraw/pull/12516)
|
||||
|
||||
- Arrows and their labels are no longer clipped to the frame they belong to, so they can connect elements across and out of frames, and their part outside the frame can be selected. They still belong to their frame, so they're moved, copied and deleted with it, but only while one of their ends is in it (bound to an element in the frame, or inside it). An arrow whose ends both leave its frame (moved, bound to elements outside it, or with the elements it's bound to) leaves the frame.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import {
|
||||
DEFAULT_CANVAS_BACKGROUND_PICKS,
|
||||
MAX_ZOOM,
|
||||
MIN_ZOOM,
|
||||
THEME,
|
||||
ZOOM_STEP,
|
||||
CODES,
|
||||
@@ -16,6 +18,8 @@ import type { Bounds } from "@excalidraw/common";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { ColorPicker } from "../components/ColorPicker/ColorPicker";
|
||||
import { IconButton } from "../components/IconButton";
|
||||
import { Tooltip } from "../components/Tooltip";
|
||||
import {
|
||||
MoonIcon,
|
||||
SunIcon,
|
||||
@@ -25,6 +29,7 @@ import {
|
||||
ZoomOutIcon,
|
||||
ZoomResetIcon,
|
||||
} from "../components/icons";
|
||||
import { useAppStateValue } from "../hooks/useAppStateValue";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { getNormalizedZoom } from "../scene";
|
||||
@@ -33,6 +38,7 @@ import {
|
||||
getViewportForZoomWithScrollConstraints,
|
||||
zoomToFitBounds,
|
||||
} from "../viewport";
|
||||
import { getShortcutKey } from "../shortcut";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
@@ -146,6 +152,29 @@ export const actionZoomIn = register({
|
||||
captureUpdate: CaptureUpdateAction.EVENTUALLY,
|
||||
};
|
||||
},
|
||||
PanelComponent: ({ updateData }) => {
|
||||
const zoomValue = useAppStateValue((appState) => appState.zoom.value);
|
||||
return (
|
||||
<Tooltip
|
||||
label={`${t("buttons.zoomIn")} — ${getShortcutKey("CtrlOrCmd++")}`}
|
||||
className="zoom-in-button-wrapper"
|
||||
delay
|
||||
>
|
||||
<IconButton
|
||||
type="button"
|
||||
className="zoom-in-button zoom-button"
|
||||
icon={ZoomInIcon}
|
||||
aria-label={t("buttons.zoomIn")}
|
||||
// the shortcut used to reach AT via the (now removed) native title
|
||||
aria-keyshortcuts={getShortcutKey("CtrlOrCmd++")}
|
||||
disabled={zoomValue >= MAX_ZOOM}
|
||||
onClick={() => {
|
||||
updateData(null);
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
keyTest: (event) =>
|
||||
(event.code === CODES.EQUAL || event.code === CODES.NUM_ADD) &&
|
||||
(event[KEYS.CTRL_OR_CMD] || event.shiftKey),
|
||||
@@ -177,6 +206,29 @@ export const actionZoomOut = register({
|
||||
captureUpdate: CaptureUpdateAction.EVENTUALLY,
|
||||
};
|
||||
},
|
||||
PanelComponent: ({ updateData }) => {
|
||||
const zoomValue = useAppStateValue((appState) => appState.zoom.value);
|
||||
return (
|
||||
<Tooltip
|
||||
label={`${t("buttons.zoomOut")} — ${getShortcutKey("CtrlOrCmd+-")}`}
|
||||
className="zoom-out-button-wrapper"
|
||||
delay
|
||||
>
|
||||
<IconButton
|
||||
type="button"
|
||||
className="zoom-out-button zoom-button"
|
||||
icon={ZoomOutIcon}
|
||||
aria-label={t("buttons.zoomOut")}
|
||||
// the shortcut used to reach AT via the (now removed) native title
|
||||
aria-keyshortcuts={getShortcutKey("CtrlOrCmd+-")}
|
||||
disabled={zoomValue <= MIN_ZOOM}
|
||||
onClick={() => {
|
||||
updateData(null);
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
keyTest: (event) =>
|
||||
(event.code === CODES.MINUS || event.code === CODES.NUM_SUBTRACT) &&
|
||||
(event[KEYS.CTRL_OR_CMD] || event.shiftKey),
|
||||
@@ -213,6 +265,28 @@ export const actionResetZoom = register({
|
||||
captureUpdate: CaptureUpdateAction.EVENTUALLY,
|
||||
};
|
||||
},
|
||||
PanelComponent: ({ updateData }) => {
|
||||
const zoomValue = useAppStateValue((appState) => appState.zoom.value);
|
||||
return (
|
||||
<Tooltip
|
||||
label={t("buttons.resetZoom")}
|
||||
style={{ height: "100%" }}
|
||||
className="reset-zoom-button-wrapper"
|
||||
delay
|
||||
>
|
||||
<IconButton
|
||||
type="button"
|
||||
className="reset-zoom-button zoom-button"
|
||||
aria-label={t("buttons.resetZoom")}
|
||||
onClick={() => {
|
||||
updateData(null);
|
||||
}}
|
||||
>
|
||||
{(zoomValue * 100).toFixed(0)}%
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
keyTest: (event) =>
|
||||
(event.code === CODES.ZERO || event.code === CODES.NUM_ZERO) &&
|
||||
(event[KEYS.CTRL_OR_CMD] || event.shiftKey),
|
||||
|
||||
@@ -31,6 +31,9 @@ export const actionToggleMinimap = register({
|
||||
},
|
||||
checked: (appState) => appState.minimapEnabled,
|
||||
predicate: (elements, appState, appProps, app) =>
|
||||
// not part of the host's UI (`ui={false}`, `ui.enabled`, or
|
||||
// `ui.disabled.minimap`)
|
||||
app.isUIControlEnabled("minimap") &&
|
||||
// the minimap lives in the footer, which isn't rendered on phones
|
||||
app.editorInterface.formFactor !== "phone" &&
|
||||
appState.height >= MINIMAP_MIN_EDITOR_HEIGHT &&
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.zoom-button,
|
||||
.undo-redo-buttons button,
|
||||
.minimap-toggle-button {
|
||||
border-radius: 0 !important;
|
||||
@@ -30,6 +31,69 @@
|
||||
}
|
||||
}
|
||||
|
||||
// the zoom out / zoom level / zoom in buttons, shown instead of the zoom menu
|
||||
// when there's no minimap toggle
|
||||
.reset-zoom-button {
|
||||
border-left: 0 !important;
|
||||
border-right: 0 !important;
|
||||
padding: 0 0.625rem !important;
|
||||
width: 3.75rem !important;
|
||||
justify-content: center;
|
||||
color: var(--text-primary-color);
|
||||
|
||||
// unlike the other zoom buttons, has no .ToolIcon__icon to show the hover
|
||||
.zoom-actions &:hover:not(:active) {
|
||||
background-color: var(--button-hover-bg);
|
||||
}
|
||||
}
|
||||
|
||||
// shifted left in zen mode (the wrapper rather than the button, so that the
|
||||
// tooltip, positioned off the wrapper, moves along)
|
||||
.reset-zoom-button-wrapper {
|
||||
transition: transform var(--zen-mode-transition-duration) ease-in-out;
|
||||
}
|
||||
|
||||
// faded out in zen mode
|
||||
.zoom-out-button-wrapper,
|
||||
.zoom-in-button-wrapper {
|
||||
transition: opacity var(--zen-mode-transition-duration) ease-in-out,
|
||||
visibility var(--zen-mode-transition-duration);
|
||||
|
||||
// hidden along with the wrappers, at the end of their fade (see
|
||||
// styles.scss)
|
||||
.zoom-button {
|
||||
transition: visibility var(--zen-mode-transition-duration);
|
||||
}
|
||||
}
|
||||
|
||||
.zoom-out-button {
|
||||
border-top-left-radius: var(--border-radius-lg) !important;
|
||||
border-bottom-left-radius: var(--border-radius-lg) !important;
|
||||
|
||||
:root[dir="rtl"] & {
|
||||
transform: scaleX(-1);
|
||||
}
|
||||
|
||||
.ToolIcon__icon {
|
||||
border-top-right-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.zoom-in-button {
|
||||
border-top-right-radius: var(--border-radius-lg) !important;
|
||||
border-bottom-right-radius: var(--border-radius-lg) !important;
|
||||
|
||||
:root[dir="rtl"] & {
|
||||
transform: scaleX(-1);
|
||||
}
|
||||
|
||||
.ToolIcon__icon {
|
||||
border-top-left-radius: 0 !important;
|
||||
border-bottom-left-radius: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
// the zoom level, opening the zoom menu (overrides the dropdown trigger's
|
||||
// own, outlined look: it's a part of the zoom island)
|
||||
.excalidraw .zoom-actions .zoom-menu-trigger {
|
||||
|
||||
@@ -886,7 +886,8 @@ export const MobileShapeActions = ({
|
||||
|
||||
/**
|
||||
* The zoom level, opening a menu of the zoom actions, along with the minimap
|
||||
* toggle.
|
||||
* toggle. Without the minimap toggle (removed by the host's `ui` config), the
|
||||
* zoom out / zoom level (resetting it) / zoom in buttons instead.
|
||||
*/
|
||||
export const ZoomActions = ({
|
||||
actionManager,
|
||||
@@ -900,7 +901,16 @@ export const ZoomActions = ({
|
||||
zenModeEnabled: boolean;
|
||||
}) => (
|
||||
<div className={CLASSES.ZOOM_ACTIONS}>
|
||||
{zoomUIEnabled && <ZoomMenu actionManager={actionManager} />}
|
||||
{zoomUIEnabled &&
|
||||
(minimapUIEnabled ? (
|
||||
<ZoomMenu actionManager={actionManager} />
|
||||
) : (
|
||||
<>
|
||||
{actionManager.renderAction("zoomOut")}
|
||||
{actionManager.renderAction("resetZoom")}
|
||||
{actionManager.renderAction("zoomIn")}
|
||||
</>
|
||||
))}
|
||||
{minimapUIEnabled && (
|
||||
<div
|
||||
className={clsx("minimap-toggle zen-mode-transition", {
|
||||
|
||||
@@ -466,10 +466,14 @@ import type {
|
||||
GenerateDiagramToCode,
|
||||
NullableGridSize,
|
||||
UIConfig,
|
||||
UIControl,
|
||||
} from "../types";
|
||||
import type { RoughCanvas } from "roughjs/bin/canvas";
|
||||
import type { Action, ActionResult } from "../actions/types";
|
||||
|
||||
const isUIConfig = (ui: AppProps["ui"]): ui is UIConfig =>
|
||||
typeof ui === "object" && ui !== null;
|
||||
|
||||
const AppContext = React.createContext<AppClassProperties>(null!);
|
||||
const AppPropsContext = React.createContext<AppProps>(null!);
|
||||
|
||||
@@ -1074,23 +1078,32 @@ class App extends React.Component<AppProps, AppState> {
|
||||
);
|
||||
}
|
||||
|
||||
/** Whether Excalidraw's full default UI is rendered. */
|
||||
/**
|
||||
* Whether Excalidraw's default UI is rendered (with `ui.disabled`, minus the
|
||||
* controls it removes).
|
||||
*/
|
||||
public isDefaultUIEnabled(props: Pick<AppProps, "ui"> = this.props): boolean {
|
||||
return (
|
||||
props.ui !== false && (typeof props.ui !== "object" || props.ui === null)
|
||||
props.ui !== false && !(isUIConfig(props.ui) && "enabled" in props.ui)
|
||||
);
|
||||
}
|
||||
|
||||
/** Whether an individual default UI control is rendered. */
|
||||
public isUIControlEnabled(
|
||||
control: keyof UIConfig["enabled"],
|
||||
public isUIControlEnabled = (
|
||||
control: UIControl,
|
||||
props: Pick<AppProps, "ui"> = this.props,
|
||||
): boolean {
|
||||
if (typeof props.ui === "object" && props.ui !== null) {
|
||||
return props.ui.enabled?.[control] === true;
|
||||
): boolean => {
|
||||
if (isUIConfig(props.ui)) {
|
||||
return "enabled" in props.ui
|
||||
? (props.ui.enabled as Partial<Record<UIControl, boolean>>)?.[
|
||||
control
|
||||
] === true
|
||||
: (props.ui.disabled as Partial<Record<UIControl, boolean>>)?.[
|
||||
control
|
||||
] !== true;
|
||||
}
|
||||
return props.ui !== false;
|
||||
}
|
||||
};
|
||||
|
||||
updateEditorAtom = <Value, Args extends unknown[], Result>(
|
||||
atom: WritableAtom<Value, Args, Result>,
|
||||
|
||||
@@ -243,8 +243,7 @@ const LayerUI = ({
|
||||
);
|
||||
};
|
||||
|
||||
const minimapUIEnabled =
|
||||
defaultUIEnabled && actionManager.isActionEnabled(actionToggleMinimap);
|
||||
const minimapUIEnabled = actionManager.isActionEnabled(actionToggleMinimap);
|
||||
|
||||
const renderCanvasActions = () => (
|
||||
<div style={{ position: "relative" }}>
|
||||
|
||||
@@ -643,6 +643,10 @@ body.excalidraw-cursor-resize * {
|
||||
}
|
||||
}
|
||||
|
||||
.reset-zoom-button {
|
||||
font-family: var(--ui-font);
|
||||
}
|
||||
|
||||
.finalize-button {
|
||||
display: grid;
|
||||
grid-auto-flow: column;
|
||||
@@ -720,6 +724,35 @@ body.excalidraw-cursor-resize * {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
}
|
||||
|
||||
// zoom buttons (no zoom menu): only show the zoom level (fade out in
|
||||
// place, same as other zen-hidden UI). Hides the tooltip wrappers so they
|
||||
// don't show tooltips either.
|
||||
.zoom-out-button-wrapper,
|
||||
.zoom-in-button-wrapper {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
|
||||
// the buttons set their own `visibility: visible`
|
||||
// (.ToolIcon_type_button--show), which would keep them focusable
|
||||
.zoom-button {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.reset-zoom-button {
|
||||
border-radius: var(--border-radius-lg) !important;
|
||||
}
|
||||
|
||||
// shift into the hidden zoom-out button's place
|
||||
.reset-zoom-button-wrapper {
|
||||
transform: translateX(calc(-1 * var(--lg-button-size)));
|
||||
|
||||
:root[dir="rtl"] & {
|
||||
transform: translateX(var(--lg-button-size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fade the chrome in/out only while toggling zen mode (see
|
||||
|
||||
@@ -40,6 +40,7 @@ import type {
|
||||
AppState,
|
||||
ExcalidrawImperativeAPI,
|
||||
ExcalidrawProps,
|
||||
UIConfig,
|
||||
} from "./types";
|
||||
|
||||
polyfill();
|
||||
@@ -268,6 +269,22 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
/** Same form (`enabled` or `disabled`), with the same controls in it. */
|
||||
const isUIConfigSame = (prev: UIConfig, next: UIConfig) => {
|
||||
const getControls = (config: UIConfig) =>
|
||||
("enabled" in config ? config.enabled : config.disabled) as
|
||||
| Record<string, boolean | undefined>
|
||||
| undefined;
|
||||
if ("enabled" in prev !== "enabled" in next) {
|
||||
return false;
|
||||
}
|
||||
const prevControls = getControls(prev) ?? {};
|
||||
const nextControls = getControls(next) ?? {};
|
||||
return [
|
||||
...new Set([...Object.keys(prevControls), ...Object.keys(nextControls)]),
|
||||
].every((control) => !!prevControls[control] === !!nextControls[control]);
|
||||
};
|
||||
|
||||
const areEqual = (prevProps: ExcalidrawProps, nextProps: ExcalidrawProps) => {
|
||||
// short-circuit early
|
||||
if (prevProps.children !== nextProps.children) {
|
||||
@@ -339,9 +356,7 @@ const areEqual = (prevProps: ExcalidrawProps, nextProps: ExcalidrawProps) => {
|
||||
prevUI !== null &&
|
||||
typeof nextUI === "object" &&
|
||||
nextUI !== null &&
|
||||
!!prevUI.enabled?.zoom === !!nextUI.enabled?.zoom &&
|
||||
!!prevUI.enabled?.scrollBackToContent ===
|
||||
!!nextUI.enabled?.scrollBackToContent);
|
||||
isUIConfigSame(prevUI, nextUI));
|
||||
|
||||
if (!isUISame) {
|
||||
return false;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { vi } from "vitest";
|
||||
|
||||
import { THEME, viewportCoordsToSceneCoords } from "@excalidraw/common";
|
||||
|
||||
import { actionToggleMinimap } from "../actions";
|
||||
import { Excalidraw } from "../index";
|
||||
import { AnimationController } from "../renderer/animation";
|
||||
|
||||
@@ -98,6 +99,24 @@ describe("minimap", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("is removed with every way to toggle it by ui.disabled.minimap", async () => {
|
||||
await render(
|
||||
<Excalidraw
|
||||
ui={{ disabled: { minimap: true } }}
|
||||
initialData={{ appState: { minimapEnabled: true } }}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(getMinimap()).toBe(null);
|
||||
expect(document.querySelector("[data-testid='button-minimap']")).toBe(null);
|
||||
// the Preferences item, command palette and context menu go by it
|
||||
expect(h.app.actionManager.isActionEnabled(actionToggleMinimap)).toBe(
|
||||
false,
|
||||
);
|
||||
// the rest of the default UI stays
|
||||
expect(document.querySelector(".main-menu-trigger")).not.toBe(null);
|
||||
});
|
||||
|
||||
it("is toggled by the footer button", async () => {
|
||||
await render(<Excalidraw />);
|
||||
|
||||
|
||||
@@ -67,4 +67,29 @@ describe("zoom menu", () => {
|
||||
expect(getTrigger().textContent).toBe("110%");
|
||||
expect(getMenu()).toBe(null);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["the reduced UI", { enabled: { zoom: true } }],
|
||||
["ui.disabled.minimap", { disabled: { minimap: true } }],
|
||||
] as const)(
|
||||
"is replaced by the zoom buttons without the minimap toggle (%s)",
|
||||
async (_, ui) => {
|
||||
await render(<Excalidraw ui={ui} />);
|
||||
|
||||
expect(getTrigger()).toBe(null);
|
||||
const getResetButton = () =>
|
||||
document.querySelector<HTMLElement>(".reset-zoom-button")!;
|
||||
expect(getResetButton().textContent).toBe("100%");
|
||||
|
||||
fireEvent.click(document.querySelector(".zoom-in-button")!);
|
||||
expect(getResetButton().textContent).toBe("110%");
|
||||
|
||||
fireEvent.click(document.querySelector(".zoom-out-button")!);
|
||||
fireEvent.click(document.querySelector(".zoom-out-button")!);
|
||||
expect(getResetButton().textContent).toBe("90%");
|
||||
|
||||
fireEvent.click(getResetButton());
|
||||
expect(h.state.zoom.value).toBe(1);
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -800,26 +800,52 @@ export type InteractionConfig = {
|
||||
};
|
||||
};
|
||||
|
||||
export type UIConfig = {
|
||||
/**
|
||||
* Default UI controls that stay enabled while the rest of Excalidraw's
|
||||
* default UI is hidden. Opt-in: anything omitted or `false` is disabled.
|
||||
*/
|
||||
enabled: {
|
||||
/**
|
||||
* The zoom-out, reset-zoom, and zoom-in controls.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
zoom?: boolean;
|
||||
/**
|
||||
* The button shown when the viewport is scrolled away from all content.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
scrollBackToContent?: boolean;
|
||||
};
|
||||
};
|
||||
export type UIConfig =
|
||||
| {
|
||||
/**
|
||||
* Default UI controls that stay enabled while the rest of Excalidraw's
|
||||
* default UI is hidden. Opt-in: anything omitted or `false` is
|
||||
* disabled.
|
||||
*/
|
||||
enabled: {
|
||||
/**
|
||||
* The zoom controls (zoom out, the zoom level resetting it, zoom in).
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
zoom?: boolean;
|
||||
/**
|
||||
* The button shown when the viewport is scrolled away from all
|
||||
* content.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
scrollBackToContent?: boolean;
|
||||
};
|
||||
}
|
||||
| {
|
||||
/**
|
||||
* Default UI controls that are removed while the rest of Excalidraw's
|
||||
* default UI is rendered. Opt-out: anything omitted or `false` stays.
|
||||
*/
|
||||
disabled: {
|
||||
/**
|
||||
* The minimap, and every way to toggle it (its footer button, the
|
||||
* Preferences menu item, and the command palette and context menu
|
||||
* entries). Without the minimap toggle next to them, the zoom
|
||||
* controls are the zoom out / zoom level / zoom in buttons instead of
|
||||
* the zoom menu.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
minimap?: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
/** A default UI control that `UIConfig` can keep or remove. */
|
||||
export type UIControl =
|
||||
| keyof Extract<UIConfig, { enabled: unknown }>["enabled"]
|
||||
| keyof Extract<UIConfig, { disabled: unknown }>["disabled"];
|
||||
|
||||
/** Supported visual changes. Geometry, content, bindings and styles are not overridable. */
|
||||
export type ElementRenderOverride = Readonly<{
|
||||
@@ -988,10 +1014,12 @@ export interface ExcalidrawProps {
|
||||
* `false`.
|
||||
*
|
||||
* Pass a config object to keep specific default controls rendered while the
|
||||
* rest of the default UI is hidden (see `UIConfig`):
|
||||
* rest of the default UI is hidden, or to remove specific controls from the
|
||||
* otherwise full default UI (see `UIConfig`):
|
||||
*
|
||||
* ```tsx
|
||||
* <Excalidraw ui={{ enabled: { zoom: true } }} />
|
||||
* <Excalidraw ui={{ disabled: { minimap: true } }} />
|
||||
* ```
|
||||
*
|
||||
* NOTE: this is WIP and what default UI is/is not rendered when ui=false
|
||||
@@ -1280,6 +1308,7 @@ export type AppClassProperties = {
|
||||
|
||||
isInteractionEnabled: App["isInteractionEnabled"];
|
||||
isNavigationEnabled: App["isNavigationEnabled"];
|
||||
isUIControlEnabled: App["isUIControlEnabled"];
|
||||
};
|
||||
|
||||
export type PointerDownState = Readonly<{
|
||||
|
||||
Reference in new issue
Block a user