[QUESTION] Enable confirmation box when remove block
Question
Is there any option to activate a confirmation box before delete any block?
Answers (3)
Nope, but you can extend the default tlb-delete command
editor.Commands.add('tlb-delete', ed => {
if (confirm('Sure?')) {
const selected = ed.getSelected();
selected && selected.destroy();
}
});
@artf this works only for toolbar button, but when I hit "delete" on my keyboard it doesn't. How can I override this event?
Hi @Iceweex, unfortunately, at the moment, you can't. For the next release, I'll centralize those commands and will update also its event lifecycle, so in that case, you'll able to achieve the task in this way
const commandName = 'core:component-delete';
editor.on(`run:${commandName}:before`, (options) => {
console.log(`BEFORE ${commandName}`);
if (!confirm('Are you sure')) {
options.abort = 1;
}
});
editor.on(`run:${commandName}`, (deleted, options) => {
console.log(`AFTER ${commandName}`, deleted);
});
editor.on(`abort:${commandName}`, (options) => {
console.log(`ABORT ${commandName}`);
});
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2561
How to add extra options to the block element next to delete option ?
WARNING READ and FOLLOW next 5 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #3027
BUG: Image asset manager, on remove no ability to re-upload the same image that was removed
Are you able to reproduce the bug from the demo? No, in the image asset manager in the demo there is no option to remove images. What is th...
Issue #1318
Question: How to enable Event of mouse to increase value of input
hi @artf I want to know Is there any way to enable input mouse scroller in style manager as you can my screenshot. i want to initalize scro...
Issue #2166
[QUESTION][REQUEST] How to remove a block?
editor.DomComponents.getWrapper().getEl().insertAdjacentHTML('beforeBegin', letBlock) letBlock letblock is a variable that contains HTML. Q...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.