CanvasAnvil is an open source AI diagram maker and flowchart generator - an infinite-canvas diagram editor and self-hosted drawio alternative that writes editable .drawio files. Text to diagram, then fix nodes, layout and labels in place. Also AI presentations, interior design CAD/BOM, posters and infographics.
TypeScript ai-agentsai-diagramai-presentationbomcadcanvasdiagramdiagram-generatordrawioflowchartinfographicspptppt-generatorpresentation-generatorreactsvgedittext-to-diagramtypescriptworkflow
feat(ppt): make edit the default and drop the automatic mode
codingFeng1019ca7f5d2f19e
diff --git a/client/workspaces/ppt/canvas/PptCanvas.tsx b/client/workspaces/ppt/canvas/PptCanvas.tsxindex 505c686..0cbecac 100644--- a/client/workspaces/ppt/canvas/PptCanvas.tsx+++ b/client/workspaces/ppt/canvas/PptCanvas.tsx@@ -669,12 +669,13 @@ export function PptCanvas({label: uploadedImageLabel(i + 1, uiLang as MaterialLang),}));/**- * Which image call a slide takes.+ * Which image call a slide takes: the user's choice from the chat toolbar,+ * not the router's guess.*- * The router picks by itself unless the user pinned a mode in the chat- * panel. Editing needs something to edit, so a pinned "edit" still redraws- * a slide that has no image yet -- otherwise the message would silently do- * nothing.+ * A payload without the field predates the toolbar, so it falls back to+ * what the router wanted. Editing needs something to edit, and a message+ * can add a slide that has no picture yet -- that one still gets drawn,+ * or it would come out blank.*/const pinnedImageMode: "auto" | "edit" | "regenerate" =parsed?.imageMode === "edit" || parsed?.imageMode === "regenerate" ? parsed.imageMode : "auto";diff --git a/client/workspaces/ppt/chat/ChatPanel.tsx b/client/workspaces/ppt/chat/ChatPanel.tsxindex 7c2241e..9611234 100644--- a/client/workspaces/ppt/chat/ChatPanel.tsx+++ b/client/workspaces/ppt/chat/ChatPanel.tsx@@ -111,14 +111,16 @@ export function ChatPanel({const [pptClearTick, setPptClearTick] = useState(0);const lastUploadedImagesRef = useRef<string[]>([]);/**- * Which image call the next message should take.+ * Which image call the next message takes.*- * "auto" leaves it to the router, which is right most of the time and wrong- * in the two ways a user notices: a wording tweak that redraws the whole- * slide and loses a picture they liked, and a request to change the picture- * that edits the old one instead of drawing a new one.+ * Always one of the two, never the router's guess: by the time there is a+ * conversation there is a slide on screen with a picture in it, so editing+ * is the safe default and redrawing is the deliberate choice. Leaving it to+ * the router was wrong in the two ways a user notices -- a wording tweak+ * redrawing the whole slide and losing a picture they liked, and a request+ * to change the picture editing the old one instead.*/- const [imageMode, setImageMode] = useState<"auto" | "edit" | "regenerate">("auto");+ const [imageMode, setImageMode] = useState<"edit" | "regenerate">("edit");const imageModeRef = useRef(imageMode);imageModeRef.current = imageMode;@@ -234,16 +236,11 @@ const getPptTag = (slideId: string, title: string, kind: "outline" | "slide_imag// any {{image:...}} references the model emitted.try {const parsed = JSON.parse(jsonText);- let changed = false;if (lastUploadedImagesRef.current.length > 0) {parsed.uploadedImages = lastUploadedImagesRef.current;- changed = true;}- if (imageModeRef.current !== 'auto') {- parsed.imageMode = imageModeRef.current;- changed = true;- }- await runCodeAction(changed ? JSON.stringify(parsed) : jsonText, 'ppt');+ parsed.imageMode = imageModeRef.current;+ await runCodeAction(JSON.stringify(parsed), 'ppt');} catch {await runCodeAction(jsonText, 'ppt');}@@ -706,7 +703,7 @@ const getPptTag = (slideId: string, title: string, kind: "outline" | "slide_imag)}variant="ghost"size="sm"- onClick={() => setImageMode((m) => (m === "edit" ? "auto" : "edit"))}+ onClick={() => setImageMode("edit")}className={cn("h-8 w-8 p-0",imageMode === "edit"@@ -723,7 +720,7 @@ const getPptTag = (slideId: string, title: string, kind: "outline" | "slide_imag)}variant="ghost"size="sm"- onClick={() => setImageMode((m) => (m === "regenerate" ? "auto" : "regenerate"))}+ onClick={() => setImageMode("regenerate")}className={cn("h-8 w-8 p-0",imageMode === "regenerate"