feat(library): wire save-mode into the five custom-client tool submitters (#577)

Closes #565. Wires the fileId/saveMode pair into the ocr, erase-object, remove-background, background-replace, and blur-background submitters so the library save-mode selector works for them; remove-background's two-phase effects route now auto-saves the final composite instead of the transparent intermediate.
This commit is contained in:
SnapOtter
2026-07-19 22:35:25 +08:00
committed by GitHub
parent 4fea434859
commit 1113c761ea
9 changed files with 472 additions and 34 deletions
+6 -11
View File
@@ -2,16 +2,17 @@ import { BASE_CONFIG, CONVERSION_PRESETS } from "./conversion-presets.js";
/**
* Tools where the library save-mode choice (#495) does not work end to end,
* so the selector must stay hidden: either the tool's hand-written route
* ignores the multipart fileId/saveMode pair, or its settings component
* submits through its own XHR without sending them. For these tools a
* library-sourced edit is never auto-saved (the pre-#495 status quo).
* so the selector must stay hidden: the tool's hand-written route ignores the
* multipart fileId/saveMode pair, so a library-sourced edit is never
* auto-saved (the pre-#495 status quo).
*
* When wiring one of these up (parse fileId/saveMode in the route like
* tool-factory.ts, append them in the client like sign-pdf-settings.tsx),
* remove it from this set so the selector appears. The integration suite
* pins the other direction: every tool NOT listed here returns 400 for an
* invalid saveMode.
* invalid saveMode. (#565 wired the five custom-client submitters that had a
* ready route but a submitter that dropped the pair: ocr, erase-object,
* remove-background, background-replace, blur-background.)
*/
export const LIBRARY_SAVE_MODE_UNSUPPORTED_TOOLS: ReadonlySet<string> = new Set([
// Custom routes without fileId/saveMode handling
@@ -43,12 +44,6 @@ export const LIBRARY_SAVE_MODE_UNSUPPORTED_TOOLS: ReadonlySet<string> = new Set(
"strip-metadata",
"vectorize",
"watermark-image",
// Routes accept saveMode but the custom client submitters do not send it yet
"ocr",
"remove-background",
"erase-object",
"background-replace",
"blur-background",
// Conversion presets served by the custom image-to-pdf / pdf-to-image /
// svg-to-raster routes (the registry group rides the factory and works)
...CONVERSION_PRESETS.filter((p) => BASE_CONFIG[p.base]?.group !== "registry").map((p) => p.id),