refactor(commands): centralize command ids

This commit is contained in:
syntaxbullet
2026-07-03 11:31:02 +02:00
parent 8320203f11
commit 84a610f019
15 changed files with 66 additions and 38 deletions

View File

@@ -1,12 +1,13 @@
import type { ToolId } from "@editor/tools";
import type { Command } from "./command";
import { commandIds } from "./ids";
export type ToolSetActivePayload = {
tool: ToolId;
};
export const toolSetActiveCommand: Command<ToolSetActivePayload> = {
id: "tool.setActive",
id: commandIds.toolSetActive,
name: "Set active tool",
execute({ state }, payload) {
return {
@@ -23,7 +24,7 @@ export const toolSetActiveCommand: Command<ToolSetActivePayload> = {
};
export const toolEnterTemporaryPanCommand: Command = {
id: "tool.enterTemporaryPan",
id: commandIds.toolEnterTemporaryPan,
name: "Enter temporary pan",
execute({ state }) {
if (state.editor.tools.interactionMode.type === "temporary-pan") return state;
@@ -42,7 +43,7 @@ export const toolEnterTemporaryPanCommand: Command = {
};
export const toolExitTemporaryPanCommand: Command = {
id: "tool.exitTemporaryPan",
id: commandIds.toolExitTemporaryPan,
name: "Exit temporary pan",
execute({ state }) {
const mode = state.editor.tools.interactionMode;