Backspace delete give a prompt before deleting

How to delete the inserted picture before giving a confirmation box?

ProseMirror doesn’t implement any of prompt on backspace. What kind of prompt are you seeing?

I want to know how to judge the backspace key is to delete the picture,图片

Ah, you want a confirmation box. You’ll have to implement that yourself, as a custom command.

Yes, then how do I know that the backspace deleted pictures?

@marijn Yesterday I read about plugin. Would this be an approach for the confirmation box? What is best practice to handle further events for ‘cancel’ or ‘ok’?

I don’t think you’d even need a plugin. Binding a command to backspace with higher-priority than the default keybindings should work. The command can see if there’s a node selected that needs a confirmation to delete, or if the cursor is directly after such a node, and if so, show the dialog and return true to indicate that the key was handled (so that the other handlers won’t do the deletion anyway). If the user confirms the deletion, fire a transaction that actually deletes the node.

Brilliant, thank you. This answers xgzl87’s question very well.

My conclusion: If a keystroke is involved a command is the way to go and if only mouse is involved (selection or position) use a plugin.

Thanks, I’ll try.