From 1e85fe36a636a7ab4e4daf48c2877ba9e91eeccb Mon Sep 17 00:00:00 2001 From: Ku6epXBOCTuK Date: Thu, 10 Sep 2026 10:06:47 +0500 Subject: [PATCH] feat: update text tools to new types --- web/src/lib/registry-new/text.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/web/src/lib/registry-new/text.ts b/web/src/lib/registry-new/text.ts index ba07039..6fbdd23 100644 --- a/web/src/lib/registry-new/text.ts +++ b/web/src/lib/registry-new/text.ts @@ -3,7 +3,7 @@ import { drawTextBlock, drawTextTile } from "../core/domText"; import type { Position9 } from "../core/textdraw"; import type { FontStyle, Plate } from "../registry-schema"; import { field, toolSchema } from "../registry-schema"; -import type { ToolEntry } from "./types"; +import { imgTool, type ToolEntry } from "./types"; interface AddTextParams { text: string; @@ -47,7 +47,8 @@ const addText: ToolEntry = { category: "text", domOnly: true, schema: addTextSchema, - run: (img, p) => + input: "image", + run: imgTool((img, p) => drawTextBlock(img, { text: p.text, fontSize: p.style.size, @@ -60,6 +61,7 @@ const addText: ToolEntry = { plateColor: p.plate.enabled ? p.plate.color : undefined, plateOpacityPercent: p.plate.opacity, }), + ), }; interface DateStampParams { @@ -107,7 +109,8 @@ const dateStamp: ToolEntry = { category: "text", domOnly: true, schema: dateStampSchema, - run: (img, p) => + input: "image", + run: imgTool((img, p) => drawTextBlock(img, { text: formatStamp(new Date(), p.format), fontSize: p.style.size, @@ -120,6 +123,7 @@ const dateStamp: ToolEntry = { plateColor: p.plate.enabled ? p.plate.color : undefined, plateOpacityPercent: p.plate.opacity, }), + ), }; interface WatermarkTileParams { @@ -169,7 +173,8 @@ const watermarkTile: ToolEntry = { category: "text", domOnly: true, schema: watermarkTileSchema, - run: (img, p) => + input: "image", + run: imgTool((img, p) => drawTextTile(img, { text: p.text, fontSize: p.style.size, @@ -181,6 +186,7 @@ const watermarkTile: ToolEntry = { stepY: p.stepY, angleDeg: p.angle, }), + ), }; export const textEntries = [addText, dateStamp, watermarkTile];