Skip to content

Instantly share code, notes, and snippets.

View cpryland's full-sized avatar

Chris Ryland cpryland

  • Em Software, Inc.
  • Pittsburgh, PA
View GitHub Profile
@cpryland
cpryland / App.jsx
Last active June 10, 2020 14:45
sample built-in documentation for XD plugin
render() {
return (
<panel>
<div id="name-height">
<input
id="icon-search-input"
autoFocus
placeholder="icon name"
uxp-quiet="true"
type="search"
@cpryland
cpryland / computeEditContextRoot.js
Last active August 3, 2019 21:13
One theory about how to compute the edit context given a selection in XD
import { Artboard, Group } from 'scenegraph'
// Strictly speaking, promoteArtboards means follow the spec.
// For some usage, we don't want that behavior.
function computeEditContextRoot(selection, promoteArtboards = true) {
// Number of nodes above the given node in the artwork tree.
function computeDepthToRoot(node) {
let depth = 0
while (node.parent != null) {
node = node.parent