You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I would like to have a specific event handler when a block or blocks are deleted, because I have some linked blocks that are being added as pairs, e.g (startBlock and endBlock) so if I delete a startBlock the endBlock is automatically deleted, because they are "pairs" in my implementation.
So I don't want to do that validation on the onChange method every time.
Describe the solution you'd like
Having a onDelete or onRemove or onContentDeleted or onRemoveBlocks event, so it receives a callback with the deleted blocks[] as argument.
something like this:
consteditor=useCreateBlockNote();useEffect(()=>{if(editor){// a function to know when blocks are deleted so we don't use onChange every time editor.onRemoveBlocks((deletedBlocksArray)=>{myCustomHandler(deletedBlocksArray);})}},[editor]);
Describe alternatives you've considered
Right now I do a validation for ALL the blocks on every onChange, but I think isn't the best approach, I would like to do those validations only when a block is deleted, if we are editing or creating/adding blocks I don't need to do extra validations.
is there any other possible solution?
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I would like to have a specific event handler when a block or blocks are deleted, because I have some linked blocks that are being added as pairs, e.g (startBlock and endBlock) so if I delete a startBlock the endBlock is automatically deleted, because they are "pairs" in my implementation.
So I don't want to do that validation on the
onChange
method every time.Describe the solution you'd like
Having a
onDelete
oronRemove
oronContentDeleted
oronRemoveBlocks
event, so it receives a callback with the deleted blocks[] as argument.something like this:
Describe alternatives you've considered
Right now I do a validation for ALL the blocks on every
onChange
, but I think isn't the best approach, I would like to do those validations only when a block is deleted, if we are editing or creating/adding blocks I don't need to do extra validations.is there any other possible solution?
The text was updated successfully, but these errors were encountered: