Search code examples
javascriptadobe-indesignextendscriptadobe-extension

Is it possible to detect the suppression of an object in InDesign using CEP/ExtendScript?


I'm currently creating a plugin on InDesign and I would like to know if it's possible to detect if the user deletes an object ? Because I would need to retrieve the id of the deleted object to remove it from an array.

I didn't find anything in the documentation about this I hope I didn't miss it.

if it's possible, i need to detect it on all elements of all pages.

I was thinking something like:

app.activeDocument.allPages.allItems.addEventListener("delete", function () {
     var idOfDeleteElement = this.id;
})

And also if the user selects several objects to delete, how to do ?

Here is an image to illustrate what I am talking about :

enter image description here

Thank you in advance !


Solution

  • The solution of @YuriKhristich is a good compromise :

    Create a panel with a delete button and ask the user to use this button to delete items.