Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else if (blur.brightnessAmount < 0) {
css += `background-color: rgba(0, 0, 0, ${-num(blur.brightnessAmount / 100)});\n`;
}
// Fill opacity
if (blur.fillOpacity > 0) {
// This blends the shape's fill on top of the blurred background (fill itself is unblurred).
// TODO: support this for solid & gradient fills by baking alpha (& brightnessAmount color) into fill!
css += `/* (plus shape's fill blended on top as a separate layer with ${num(blur.fillOpacity * 100)}% opacity) */\n`;
}
} else {
css += `filter: ${blur.blurAmount}px;\n`;
}
}
clipboard.copyText(css);
// console.log(css);
}
function handleSubmit(e, dialog, resources) {
var clipText = resources.value;
let clipboard = require("clipboard");
clipboard.copyText(clipText);
// Close the dialog, passing back data
dialog.close(resources.value);
// Prevent further automatic close handlers
e.preventDefault();
}
outputFile: file,
type: application.RenditionType.SVG,
minify: true,
embedImages: false
}
]
// Create rendition
await application.createRenditions(renditions)
// Read tmp file and generate SVG code
const markup = await file.read()
const svgCode = escapeHtml(markup)
// Copy to clipboard too!
clipboard.copyText(markup)
// Show output dialog
await createDialog({
title: 'SVG Output',
template: () => `<input value="${svgCode}">`
})
}
async function test(selection, documentRoot) {
for (const node of selection.items) {
console.log("Hello world: ", node);
if (node instanceof Text) {
clipboard.copyText(node.text);
} else if (node instanceof Ellipse) {
node.fill = new Color("#ffaaee");
await shell.openExternal('https://adobe-xd.gitbook.io/plugin-api-reference/uxp-api-reference/network-apis/shell');
}
}
const tempFolder = await fs.getTemporaryFolder();
const newFile = await tempFolder.createFile("tempfile.txt", {overwrite: true});
await newFile.write("Hello, world!");
await newFile.moveTo(tempFolder, {overwrite: true});
const anotherFile = await tempFolder.getEntry('tempfile.txt');
if (anotherFile.isFile) {
anotherFile.write("Good day");
} else if (anotherFile.isFolder) {
console.log("That's a folder. It shouldn't be a folder. What have you done?")
}