Part 1: Understanding plugin basics
Part 2: Creating a "button frame" plugin
- Adobe XD API Reference
- Finished code from this part
To use: create a new bookmark and paste into the URL field. | |
In Chrome, you can paste the full multiline code as shown below. | |
In other browsers, you may need to minify the code into one line first. |
// If "const" is to the LEFT of "*" it applies to the object being pointed at | |
// If "const" is to the RIGHT of "*" it applies to the variable holding the pointer address | |
const T* ptr; // object is immutable | |
T const* ptr; // " | |
T* const ptr; // 'ptr' cannot be changed to point to a different address, but object is not immutable | |
// (i.e. the variable is const, not the thing it points to) | |
const T* const ptr; // object is immutable AND 'ptr' cannot be changed to point to a different address |
Part 1: Understanding plugin basics
Part 2: Creating a "button frame" plugin
// DEPRECATED: See "Expand All Comments" at https://gist.github.com/peterflynn/ace5dd3d7a8ec645cd42 for | |
// a more up to date, maintained version of this. | |
// Original bookmarklet from this gist (does not work anymore): | |
// javascript:(function() { $(".outdated-diff-comment-container").addClass("open"); }()); | |
// Newer, working version (from link above as of Jan 2017): | |
// javascript:(function() { document.querySelectorAll(".outdated-diff-comment-container").forEach(function(n) {n.classList.add("open")}) }()); |
var dialog; | |
function createDialog() { | |
dialog = document.createElement("dialog"); | |
dialog.innerHTML = ` | |
<form method="dialog"> | |
<h1>Hello, world!</h1> | |
<hr> | |
<footer> | |
<!-- Ok button is special: it will automatically close the dialog for us --> |
Part 1: Understanding plugin basics
Part 2: Creating a "button frame" plugin
/* | |
* Sample plugin code for Adobe XD. | |
* | |
* Visit http://adobexdplatform.com/ for API docs and more sample code. | |
*/ | |
var {Rectangle, Color} = require("scenegraph"); | |
var dialog; |
/* | |
* Sample plugin code for Adobe XD. | |
* | |
* Visit http://adobexdplatform.com/ for API docs and more sample code. | |
*/ | |
var {Rectangle, Color} = require("scenegraph"); | |
function createRectangle(selection) { | |
var textNode = selection.items[0]; |
var fs = require("uxp").storage.localFileSystem; | |
function loadStyleguideFile(selection) { | |
return fs.getFileForOpening() | |
.then(function (file) { | |
console.log("User chose file: " + file); | |
return file.read(); | |
}) | |
.then(function (text) { | |
var json = JSON.parse(text); |
/* | |
* Sample plugin code for Adobe XD. | |
* | |
* Visit http://adobexdplatform.com/ for API docs and more sample code. | |
*/ | |
var {Rectangle, Color} = require("scenegraph"); | |
function createRectangle(selection) { | |
// Insert a red square in the current artboard or group/container |