diff --git a/manifest.json b/manifest.json index 2c20996d..d9f788e0 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "ui": "dist/index.html", "editorType": ["figma"], "networkAccess": { - "allowedDomains": ["https://design.penpot.app"], + "allowedDomains": ["https://design.penpot.app", "https://fonts.googleapis.com"], "devAllowedDomains": ["http://localhost:5173"] }, "documentAccess": "dynamic-page" diff --git a/plugin-src/transformers/transformTextNode.ts b/plugin-src/transformers/transformTextNode.ts index 2df78da0..1084d38d 100644 --- a/plugin-src/transformers/transformTextNode.ts +++ b/plugin-src/transformers/transformTextNode.ts @@ -23,6 +23,8 @@ export const transformTextNode = (node: TextNode, baseX: number, baseY: number): 'fills' ]); + const segments = translateStyledTextSegments(node, styledTextSegments); + return { type: 'text', name: node.name, @@ -35,7 +37,7 @@ export const transformTextNode = (node: TextNode, baseX: number, baseY: number): children: [ { type: 'paragraph', - children: translateStyledTextSegments(node, styledTextSegments), + children: segments, ...(styledTextSegments.length ? transformTextStyle(node, styledTextSegments[0]) : {}), ...transformFills(node) } @@ -43,6 +45,7 @@ export const transformTextNode = (node: TextNode, baseX: number, baseY: number): } ] }, + positionData: segments, ...transformDimensionAndPosition(node, baseX, baseY), ...transformEffects(node), ...transformSceneNode(node), diff --git a/ui-src/index.html b/ui-src/index.html index b6b27167..e0fff18f 100644 --- a/ui-src/index.html +++ b/ui-src/index.html @@ -8,9 +8,12 @@
diff --git a/ui-src/lib/types/text/textAttributes.ts b/ui-src/lib/types/text/textAttributes.ts index 411d742d..1a64e6b0 100644 --- a/ui-src/lib/types/text/textAttributes.ts +++ b/ui-src/lib/types/text/textAttributes.ts @@ -1,8 +1,9 @@ -import { TextContent } from './textContent'; +import { TextContent, TextNode } from './textContent'; export const TEXT_TYPE: unique symbol = Symbol.for('text'); export type TextAttributes = { type: 'text' | typeof TEXT_TYPE; content?: TextContent; + positionData: TextNode[]; };