We’ve built HistoryStates to mirror ExtendScript functionality. length , parent , and getByName(name) are provided. You can also use indices as such: activeDocument.historyStates[2] .
save no longer infers the file type from the requested file name. Instead, it invokes a save dialog for unsaved files, and performs a save operation for saved, modified files.
saveAs is provided for bmp , gif , jpg , png , psb , psd formats. Use SaveOptions objects to request specific saves (e.g. PhotoshopSaveOptions).
Execute as Modal allows you to create plugins that can be guaranteed exclusive control over Photoshop during execution. It further allows for clear user feedback when this is occuring, and allows plugins to suspendHistory and resumeHistory .
If you’re not part of the Photoshop prerelease group, email me ( finnegan at adobe.com) or DM me with the email address associated with your AdobeID.
Thanks for the update. Do you know if a suspend history option is going to be added to the DOM? I know that the history state can be consolidated and renamed for multiple descriptors within 1 batch play. However, it would be nice to be able to create 1 history state for an entire function that could contain multiple batch play commands within the function.
The hostControl property on the executionContext is used for suspending and resuming history states. While a history state is suspended, Photoshop will coalesce all document changes into a single history state with a custom name.
async function historyStateSample(executionContext) {
let hostControl = executionContext.hostControl;
// Get an ID for a target document
let documentID = await getTargetDocument();
// Suspend history state on the target document
// This will coalesce all changes into a single history state called
// 'Custom Command'
let suspensionID = await hostControl.suspendHistory({
"historyStateInfo": {
"name": "Custom Command",
"target": [ {_ref: "document", _id: documentID}]
}
});
// modify the document
// . . .
// resume the history state
await hostControl.resumeHistory(suspensionID);
}
Just wondering… is there any chance we’d get a shorthand like let suspensionID = await hostControl.suspendHistory("Custom Command")
I think in 99% of the cases developers want to suspend the history on the target document. Would be awesome if we could just pass a string for the name and have UXP internally write all that boilderplate for the target document reference.
Thanks, I am finally going to get started on testing the API 2. I have some longer operations that could really benefit from the progress bar and user stop button, because it is hard to do an early abort on the UXP execution though the other methods I created.
Most of the time https://developer-stage.adobe.com/ does not load at all. On very rare occasions, if you’re lucky, you get page loaded, but then clicking on any link doesn’t load again
Oh! That’s weird… In any case, the changelog isn’t meant to live on stage indefinitely. @heewoo might have some insight on when it can move to a non-stage home…