From 2ee3317b0001fe5043000f7044893903f6d30fcf Mon Sep 17 00:00:00 2001 From: Fork Less Date: Thu, 25 Jun 2026 01:31:54 +0200 Subject: [PATCH] fix: remove auto-title junk from create_element handler --- src/index.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index ce236de..e0ac2a2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1094,16 +1094,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request: CallToolRequest) const id = customId || generateId(); const normalizedFont = normalizeFontFamily(elementProps.fontFamily); - // Auto-populate title+subtitle for container types unless text is explicitly set + // Use explicit text if provided, otherwise fall back to title/title+subtitle card layout const CONTAINER_TYPES = new Set(['rectangle', 'ellipse', 'diamond']); const isContainer = CONTAINER_TYPES.has(params.type); - const hasExplicitText = elementProps.text !== undefined; - const effectiveTitle = title ?? (isContainer && !hasExplicitText ? 'Title' : undefined); - const effectiveSubtitle = subtitle ?? (isContainer && !hasExplicitText && effectiveTitle ? 'Description' : undefined); - - const effectiveText = effectiveTitle ?? elementProps.text; - const effectiveFontSize = effectiveTitle ? (titleFontSize ?? 24) : (elementProps.fontSize ?? USER_PREFS.fontSize); - const effectiveFontFamily = effectiveTitle + const effectiveText = title ?? elementProps.text; + const effectiveSubtitle = isContainer && subtitle ? subtitle : undefined; + const effectiveFontSize = title ? (titleFontSize ?? 24) : (elementProps.fontSize ?? USER_PREFS.fontSize); + const effectiveFontFamily = title ? (normalizeFontFamily(titleFontFamily) ?? USER_PREFS.fontFamily) : (normalizedFont ?? USER_PREFS.fontFamily); @@ -1132,7 +1129,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request: CallToolRequest) const excalidrawElement = convertTextToLabel(element); // Card layout: title (bound) + subtitle (grouped standalone text) - const groupId = (effectiveTitle && effectiveSubtitle && isContainer) ? generateId() : undefined; + const groupId = (title && effectiveSubtitle && isContainer) ? generateId() : undefined; // Add groupId to container if using card layout if (groupId) {