intercept and prevent an asset from being removed
Question
How would you go about intercepting and preventing an asset from being removed? I suspect the image may already have been removed by the time we run "asset:remove". If so how do we tap into the actions and ask for confirmation? The reason I ask is because I want to tie a deletion in GJS to permanent deletion of images from client accounts.
editor.on('asset:remove', () => {
if (!window.confirm("Are you sure?")) {
// HERE I WOULD LIKE TO BREAK THE REMOVE ACTION.
...
Answers (2)
Missed it in the docs.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1916
[QUESTION] How to change the dragging nature?
Hi, We have been working with GrapesJs for sometime. I know you have already been asked about the designer mode (Free drag) and you said it...
Issue #857
[Question]: How do I add a custom font in the Typography | Font dropdown?
Hi, First off, this is what I've been looking for for a long time so thanks for your efforts. Next, I'd like to add a font in the Typograph...
Issue #648
Panel may be moveable but prevent move, remove properties on the childs
Hi, How can I prevent move, remove properties on the childs? In this case (see code below) the user may move the parent (Template2), but al...
Issue #667
Question about Asset Manager
Hi @artf , I have two question about Asset Manager. How I can set a image by select, current logic after I upload image, I must select imag...
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.