<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aditi singh</title>
    <description>The latest articles on DEV Community by Aditi singh (@aditi_singh_2a9627c810828).</description>
    <link>https://dev.to/aditi_singh_2a9627c810828</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2904355%2Fc86f3cd4-c08a-4712-b48a-77048de8b5e3.jpg</url>
      <title>DEV Community: Aditi singh</title>
      <link>https://dev.to/aditi_singh_2a9627c810828</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aditi_singh_2a9627c810828"/>
    <language>en</language>
    <item>
      <title>Figma Plugin: Manifest Permission Issues, Syntax Error, and WebSocket Reconnection Problems</title>
      <dc:creator>Aditi singh</dc:creator>
      <pubDate>Fri, 28 Feb 2025 18:03:56 +0000</pubDate>
      <link>https://dev.to/aditi_singh_2a9627c810828/figma-plugin-manifest-permission-issues-syntax-error-and-websocket-reconnection-problems-3848</link>
      <guid>https://dev.to/aditi_singh_2a9627c810828/figma-plugin-manifest-permission-issues-syntax-error-and-websocket-reconnection-problems-3848</guid>
      <description>&lt;p&gt;**I am encountering multiple errors while developing a Figma plugin that converts websites into editable Figma designs. The plugin fetches website content, processes HTML and CSS, and transforms it into Figma components while preserving styles, layout, and assets._&lt;/p&gt;

&lt;p&gt;🔗 GitHub Repository: &lt;a href="https://github.com/aditya-sphereoutsourcing/figma-htmlui" rel="noopener noreferrer"&gt;https://github.com/aditya-sphereoutsourcing/figma-htmlui&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Issue Details&lt;br&gt;
1️⃣ Manifest Errors&lt;br&gt;
When loading the plugin, I receive the following errors:&lt;/p&gt;

&lt;p&gt;Invalid permission specified: currentPage&lt;br&gt;
Invalid value for networkAccess. If you want to allow all domains, please add a "reasoning" field to the networkAccess object.&lt;br&gt;
2️⃣ Syntax Error in Vendor Core File&lt;br&gt;
I get a syntax error in a core file:&lt;/p&gt;

&lt;p&gt;typescript&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
Syntax error on line 52: Unexpected token .&lt;br&gt;
parsed.textContent = element.textContent?.trim();&lt;br&gt;
                                           ^&lt;br&gt;
Possible cause: The ?. (optional chaining) operator might not be supported in the Figma plugin environment.&lt;/p&gt;

&lt;p&gt;3️⃣ Multiplayer Session WebSocket Issues&lt;br&gt;
The console logs repeated connection attempts:&lt;/p&gt;

&lt;p&gt;csharp&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
[MultiplayerSession] connecting to wss://&lt;a href="http://www.figma.com/api/multiplayer/" rel="noopener noreferrer"&gt;www.figma.com/api/multiplayer/&lt;/a&gt;...&lt;br&gt;
This is followed by multiple reconnection attempts.&lt;/p&gt;

&lt;p&gt;🔄 How the Plugin Works &amp;amp; Where the Errors Occur&lt;br&gt;
1️⃣ Initial Request Processing&lt;/p&gt;

&lt;p&gt;figma.ui.onmessage listens for messages when the user requests a website conversion.&lt;br&gt;
The plugin fetches website content using fetch(msg.url).&lt;br&gt;
2️⃣ HTML Parsing (src/parsers/htmlParser.ts)&lt;/p&gt;

&lt;p&gt;Converts raw HTML into a structured DOM tree.&lt;br&gt;
Extracts properties, styles, and attributes.&lt;br&gt;
Handles special elements like images and SVGs.&lt;br&gt;
3️⃣ CSS Processing (src/parsers/cssParser.ts)&lt;/p&gt;

&lt;p&gt;Extracts CSS rules and computes styles.&lt;br&gt;
Resolves shorthand properties and media queries.&lt;br&gt;
4️⃣ Style Conversion (src/utils/styleConverter.ts)&lt;/p&gt;

&lt;p&gt;Converts CSS properties to Figma-compatible formats.&lt;br&gt;
Handles unit conversions (px, rem, em).&lt;br&gt;
5️⃣ Figma Node Creation (src/utils/figmaUtils.ts)&lt;/p&gt;

&lt;p&gt;Creates corresponding Figma nodes.&lt;br&gt;
Applies styles, layout, and constraints.&lt;br&gt;
🛠️ Steps Taken to Resolve&lt;br&gt;
✔️ Verified manifest.json to ensure correct permissions for currentPage and networkAccess.&lt;br&gt;
✔️ Checked if the optional chaining (?.) is causing compatibility issues with the Figma plugin environment.&lt;br&gt;
✔️ Attempted manual reconnection, but WebSocket disconnections persist.&lt;/p&gt;

&lt;p&gt;❓ How Can I Fix These Issues?&lt;br&gt;
Are there alternative permissions for currentPage in the Figma manifest?&lt;br&gt;
Does Figma's runtime lack support for optional chaining (?.), and if so, what is the best workaround?&lt;br&gt;
Could the WebSocket reconnection issue be related to rate-limiting or incorrect authentication?&lt;br&gt;
Any guidance or solutions would be greatly appreciated!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
