diff --git a/packages/element/embeddable.ts b/packages/element/embeddable.ts index 1dc1968a0..3fcb19b00 100644 --- a/packages/element/embeddable.ts +++ b/packages/element/embeddable.ts @@ -1,8 +1,5 @@ -import { register } from "../actions/register"; import { FONT_FAMILY, VERTICAL_ALIGN } from "../constants"; -import { setCursorForShape } from "../cursor"; -import { CaptureUpdateAction } from "../store"; -import { escapeDoubleQuotes, getFontString, updateActiveTool } from "../utils"; +import { escapeDoubleQuotes, getFontString } from "../utils"; import { newTextElement } from "./newElement"; import { wrapText } from "./textWrapping"; @@ -319,34 +316,6 @@ export const createPlaceholderEmbeddableLabel = ( }); }; -export const actionSetEmbeddableAsActiveTool = register({ - name: "setEmbeddableAsActiveTool", - trackEvent: { category: "toolbar" }, - target: "Tool", - label: "toolBar.embeddable", - perform: (elements, appState, _, app) => { - const nextActiveTool = updateActiveTool(appState, { - type: "embeddable", - }); - - setCursorForShape(app.canvas, { - ...appState, - activeTool: nextActiveTool, - }); - - return { - elements, - appState: { - ...appState, - activeTool: updateActiveTool(appState, { - type: "embeddable", - }), - }, - captureUpdate: CaptureUpdateAction.EVENTUALLY, - }; - }, -}); - const matchHostname = ( url: string, /** using a Set assumes it already contains normalized bare domains */ diff --git a/packages/excalidraw/actions/actionEmbeddable.ts b/packages/excalidraw/actions/actionEmbeddable.ts new file mode 100644 index 000000000..47f3c9e98 --- /dev/null +++ b/packages/excalidraw/actions/actionEmbeddable.ts @@ -0,0 +1,33 @@ +import { setCursorForShape } from "../cursor"; +import { CaptureUpdateAction } from "../store"; +import { updateActiveTool } from "../utils"; + +import { register } from "./register"; + +export const actionSetEmbeddableAsActiveTool = register({ + name: "setEmbeddableAsActiveTool", + trackEvent: { category: "toolbar" }, + target: "Tool", + label: "toolBar.embeddable", + perform: (elements, appState, _, app) => { + const nextActiveTool = updateActiveTool(appState, { + type: "embeddable", + }); + + setCursorForShape(app.canvas, { + ...appState, + activeTool: nextActiveTool, + }); + + return { + elements, + appState: { + ...appState, + activeTool: updateActiveTool(appState, { + type: "embeddable", + }), + }, + captureUpdate: CaptureUpdateAction.EVENTUALLY, + }; + }, +}); diff --git a/packages/excalidraw/actions/index.ts b/packages/excalidraw/actions/index.ts index a556bfbea..f37747aeb 100644 --- a/packages/excalidraw/actions/index.ts +++ b/packages/excalidraw/actions/index.ts @@ -30,6 +30,8 @@ export { actionToggleTheme, } from "./actionCanvas"; +export { actionSetEmbeddableAsActiveTool } from "./actionEmbeddable"; + export { actionFinalize } from "./actionFinalize"; export {