From 259aaed6bdb77872c40d5c1ea63af741eb52fd4c Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Mon, 12 May 2025 02:32:28 -0400 Subject: styleref working hackily --- src/client/views/smartdraw/DrawingFillHandler.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/client/views/smartdraw') diff --git a/src/client/views/smartdraw/DrawingFillHandler.tsx b/src/client/views/smartdraw/DrawingFillHandler.tsx index 48107ff0d..73a47681a 100644 --- a/src/client/views/smartdraw/DrawingFillHandler.tsx +++ b/src/client/views/smartdraw/DrawingFillHandler.tsx @@ -25,8 +25,8 @@ export class DrawingFillHandler { : [] : Doc.Links(drawing) .map(link => Doc.getOppositeAnchor(link, drawing)) - .map(anchor => anchor && DocCast(anchor.embedContainer)); - const styleUrl = await DocumentView.GetDocImage(styleDocs.filter(doc => doc?.data instanceof ImageField).lastElement())?.then(styleImg => { + .map(anchor => anchor && DocCast(anchor.embedContainer)); + const styyleUrl = await DocumentView.GetDocImage(styleDocs.lastElement())?.then(styleImg => { const hrefParts = ImageCast(styleImg).url.href.split('.'); return `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`; }); @@ -42,6 +42,7 @@ export class DrawingFillHandler { const { href } = ImageCast(imageField).url; const hrefParts = href.split('.'); const structureUrl = `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`; + const styleUrl = styleDoc ? `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}` : undefined; return imageUrlToBase64(structureUrl) .then(gptDescribeImage) .then((prompt, newPrompt = user_prompt || prompt) => -- cgit v1.2.3-70-g09d2