Planner: Add back undo/redo

This commit is contained in:
Kalle
2026-08-29 10:25:06 +03:00
parent d2f2144081
commit bdb2de1a40
2 changed files with 17 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ import {
type TLShapeId,
type TLUiStylePanelProps,
Tldraw,
type TldrawOptions,
} from "@tldraw/tldraw";
import clsx from "clsx";
import {
@@ -73,6 +74,10 @@ const GAME_UNITS_TO_PX: Record<"MINI" | "OVER", number> = {
MINI: 4.4,
OVER: 8.4,
};
// the menu panel that normally holds undo & redo is hidden, so they are moved to the toolbar
const TLDRAW_OPTIONS: Partial<TldrawOptions> = {
actionShortcutsLocation: "toolbar",
};
const MAIN_WEAPON_URL_PATTERN = /main-weapons-outlined\/(\d+)/;
const SPECIAL_WEAPON_URL_PATTERN = /special-weapons\/(\d+)/;
@@ -360,7 +365,6 @@ export default function Planner() {
Minimap: null,
NavigationPanel: null,
PageMenu: null,
QuickActions: null,
SharePanel: null,
StylePanel: CustomStylePanel,
TopPanel: null,
@@ -431,7 +435,11 @@ export default function Planner() {
</button>
</div>
<div style={{ position: "fixed", inset: 0 }}>
<Tldraw onMount={handleMount} components={tldrawComponents} />
<Tldraw
onMount={handleMount}
components={tldrawComponents}
options={TLDRAW_OPTIONS}
/>
</div>
<DragOverlay dropAnimation={null} modifiers={[snapCenterToCursor]}>
{activeDragItem ? (

View File

@@ -79,6 +79,13 @@ body:has(.planner) header {
border: var(--border-style);
}
/* the undo/redo row tucks under the toolbar, so it shares its look sans bottom border */
.tlui-toolbar__extras__controls {
border: var(--border-style);
border-bottom: none;
background-color: var(--color-panel);
}
.tlui-style-panel {
margin-top: 0 !important;
}