Skip to content

Commit

Permalink
add position data
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Apr 23, 2024
1 parent 5279b17 commit 2185bc6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion plugin-src/transformers/transformTextNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -35,14 +37,15 @@ 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)
}
]
}
]
},
positionData: segments,
...transformDimensionAndPosition(node, baseX, baseY),
...transformEffects(node),
...transformSceneNode(node),
Expand Down
3 changes: 3 additions & 0 deletions ui-src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
<body>
<div id="root"></div>
<script>
// Original penpot deployment
window.penpotPublicURI = 'https://design.penpot.app';
// Local proxy for testing purposes
// window.penpotPublicURI = 'http://localhost:5173';
// Google fonts url
// window.penpotPublicURI = 'https://fonts.googleapis.com';
window.penpotVersion = '2.0.0-13062-gc97f2d620';
</script>
<script type="module" src="./main.tsx"></script>
Expand Down
3 changes: 2 additions & 1 deletion ui-src/lib/types/text/textAttributes.ts
Original file line number Diff line number Diff line change
@@ -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[];
};

0 comments on commit 2185bc6

Please sign in to comment.