Skip to main content
March 7, 2026
Solved

Extension API: hook into deleted shape or line?

  • March 7, 2026
  • 4 replies
  • 155 views

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

Best answer by Kyler G

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
March 8, 2026

@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!

March 9, 2026

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

Kyler G
Kyler GAnswer
Lucid product team
March 9, 2026

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);

 

March 10, 2026

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