Adobe Tech Blog
Published in

Adobe Tech Blog

New APIs in Adobe XD 14.0.42

Adobe XD version 14.0.42 is now available to the public, and there are some new API features you might want to be aware of when developing plugins XD. We’ll go over some of the highlights in this post. As always, if you have any questions, you can post them on our developer forums.

Convenient access to selection and the root node

You can now access the current selection and root node any time without having to pass it to other functions and methods. Just use require(“scenegraph”).selection and require(“scenegraph”).root respectively to get access.

This new method works side-by-side with the existing method of getting access to the current selection and document root node. As such, you can do either of the following (depending on your needs):

// XD 13 method
function menuHandler(selection, documentRoot) {
/* ... */
// XD 14
function someOtherAction() {
const { selection, root } = require("scenegraph");
/* ... */

Text styling APIs

It’s now easier to work with text elements that have one style. You can directly set the fill and other font properties without using the styleRanges array. For example:

const text = selection.items[0]; // assuming this is a text node
text.fill = new Color("Purple");
text.fontFamily = "Helvetica";

You can also get and set more text layout properties, such as paragraph spacing.

text.paragraphSpacing = 10;

Finally, you can now create and modify area text elements!

const text = new Text();
text.areaBox = {width: 100, height: 100};

Viewport APIs

const viewport = require("viewport");

You can also get information about the viewport’s current state.

const bounds = viewport.bounds;

Shared links

It’s now possible to get links to the most recently shared prototypes and design specs. This should improve the workflow for plugins that need access to published prototypes and design specs.

Document and node metadata

Your plugin can now store arbitrary metadata on nodes in the user’s document. The metadata is specific to your plugin and must be serializable to a string (think JSON.stringify). If you want to store document-wide metadata, you can store the data on the document’s root node.

Note that the data you store is not available to other plugins, and your plugin can’t access data stored by other plugins.

Other changes

These aren’t the only changes that landed in XD 14, but they are among the most useful for both existing and new plugins. Be sure to check out the change log for the entire set of changes.

As always, we’re excited to hear your feedback on these new APIs, as well as your requests for future APIs. You can leave feedback here. We can’t wait to see what you create.

For more stories like this, subscribe to our Creative Cloud Developer Newsletter.




News, updates, and thoughts related to Adobe, developers, and technology.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kerri Shotts

Kerri Shotts

JavaScript fangirl, Technical writer, Mobile app developer, Musician, Photographer, Transwoman (she/her), Atheist, Humanist. All opinions are my own. Hi there!

More from Medium

Smarter Testing Equals Safer Digital Experiences

Purification Design Methodology

Picking Color via Eyedropper on Web App

How to develop an offline Front-End app with mock data