Question
UndoGroup in ExtendScript works, in CEP not. Why and how?
Hello all,
I try to add an UndoGroup in my CEP panel, but it does not get added to the Undo menu.
When making a UI Panel I would use:
app.beginUndoGroup("Undo the Hello text");
var comp = app.project.activeItem;
var myTextLayer = comp.layers.addText("Hello");
app.endUndoGroup();
that would add a Text layer and the option Edit > Undo > Undo the Hello text.
With CEP I try it like this in 3 methods.
async BeginUndo(){
let result = await evalScript(`
(function() {
app.beginUndoGroup("Undo the Hello text");
}())
`)
console.log("BeginUndo");
}
async AddText(){
let result = await evalScript(`
(function() {
var comp = app.project.activeItem;
var myTextLayer = comp.layers.addText("Hello");
}())
`)
console.log("Adding a layer");
}
async EndUndo(){
let result = await evalScript(`
(function() {
app.endUndoGroup();
}())
`)
console.log("EndUndo");
}
function Start(){
this.BeginUndo();
this.AddText();
this.EndUndo();
}
Start();
Results in the log:
-BeginUndo
-Adding a layer
-EndUndo
Result in the comp:
-a freshly added textlayer.
Besides this expected result, I wanted to see in the menu: Edit > Undo > Undo the Hello text
Instead, I only see Undo New textlayer. I assume methods are being called, but I guess I'm wrong and don't see what is going on.
Can someone point me in the right direction?
