JavaScript hook on block deletion

Permalink
Hi folks,

I want to perform some JavaScript code when a block is deleted. In particular I want to remove an image from the HTML-tree that is not part of the block's removed XML structure.

Is it possible to hook into the deletion process of a block?

Thanks in advance,
David

 
JohntheFish replied on at Permalink Reply
JohntheFish
Within C5's php, block controllers can have a delete method, so it may be considerably simpler to write a delete method for the block that does most or all of what you want.

If you still want to do it all with javascript, in edit mode, deleting a block is an ajax transaction between the browser and the server, so it should be possible to adapt the javascript involved to trigger a javascript event that you could then listen for and remove the unwanted image. You could also simulate such an event with a polling loop. You would then need to use javascript to simulate the C5 process for removing the image with further ajax transactions.