Skip to main content
Mar 7, 2026 2:07 PM UTC
Solved

Extension API: hook into deleted shape or line?

Team Lucid,
I am aware we can hook selection.  Is it possible to hook into the user has deleted a shape or line?

Thanks,

Dan

Kyler G
Kyler GAnswer
Lucid product team
Mar 9, 2026 8:04 PM UTC

Hello,
I believe you want `hookDeleteItems`. This can be found on the document proxy. Reference here.

It would look like this:

// Hook into delete events                                                                                                                                                                  
const handle = this.client.document.hookDeleteItems((itemIds: string[]) => {
console.log('Deleted item IDs:', itemIds);
// Do something with the deleted item IDs
});

// Later, when you want to stop listening:
this.client.document.unhookDeleteItems(handle);

 

Comments

aparrish
Lucid Legend Level 8
Lucid Legend Level 8
Mar 8, 2026 5:22 PM UTC

​@quodsimDan do you mean “if”? Here’s the link to Lucid’s API developer document: https://developer.lucid.co/reference/overview#import-document

I hope you can find an answer to your question there!

Translate
Mar 9, 2026 12:10 PM UTC

I have read the extension api extensively I dont anything related to ‘if’ the user deletes.

Translate
Kyler G
Kyler GAnswer
Lucid product team
Mar 9, 2026 8:04 PM UTC

Hello,
I believe you want `hookDeleteItems`. This can be found on the document proxy. Reference here.

It would look like this:

// Hook into delete events                                                                                                                                                                  
const handle = this.client.document.hookDeleteItems((itemIds: string[]) => {
console.log('Deleted item IDs:', itemIds);
// Do something with the deleted item IDs
});

// Later, when you want to stop listening:
this.client.document.unhookDeleteItems(handle);

 

Translate
Mar 10, 2026 12:34 AM UTC

that is exactly what I am looking for!  I sorry I missed it!

Translate