Skip to main content
Question

How can i import Styles from a remote lobrary into the plugin interface?

  • October 16, 2024
  • 7 replies
  • 62 views

santferal

I am having problems importing styles from a remote library. I can’t get them to display in a div inside the plugin interface.
I had no problem with the variables but now I can’t import them correctly. Because I imagine that they work in a different way but I can’t find the documentation.
Thank you very much in advance.

This topic has been closed for replies.

7 replies

tank666
  • 4873 replies
  • October 16, 2024

What’s the problem, exactly? Get the style value, send it to the UI, convert that value to the format you need, and apply it to your div.


santferal
  • Author
  • New Participant
  • 6 replies
  • October 16, 2024

Yes, I cant get the values of the styles to apply it on the div in the plugin interface. ( the plugin is running on a file with out styles and it has only styles from a remote library)


tank666
  • 4873 replies
  • October 16, 2024

Use the getStyleByIdAsync(id) method to get the desired style data (or import styles using importStyleByKeyAsync(key), or use the REST API).


santferal
  • Author
  • New Participant
  • 6 replies
  • October 16, 2024

Thanks @tank666 !!
Could you show me an example functional code to have all the remote style import link complete ?


Gleb
  • Power Member
  • 4710 replies
  • October 16, 2024

Here you go:

const importedStyle = await importStyleByKeyAsync("abcde")

(replace abcde with your actual style key)


santferal
  • Author
  • New Participant
  • 6 replies
  • October 17, 2024

I dont have a defined style key beause wll depend on the libraries that will be linked to the file. So for an universal case how should be that part of the key ?


tank666
  • 4873 replies
  • October 17, 2024

So get style keys from remote libraries using REST API or by opening each library file and using local styles getting methods using Plugin API.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings