[QUESTIONS] How to set callbacks when asset click
Question
I can see that image has been set only with a single click on image asset. I want to close the modal even on when click. I try to set a callback on asset click
editor.AssetManager.onClick((model)=>{
console.log('model');
})
But when I click on asset. The console never trigger.
Answers (3)
@Uysim you can extend the image type https://grapesjs.com/docs/modules/Assets.html#extend-asset-types
Here is the original view of the image type
@pouyamiralayi This is not correct. My question is about the callback when user click on image on assets manager.
Your answer mean to close the modal immediately after it is opened
Hi there! your answer is here
I want to close the modal even on when click.
editor.on('run:open-assets', () => editor.Modal.close())
try to set a callback on asset click
editor.on('run:open-assets', () => console.log('callback!'))
cheers!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1044
change src for image element in model
hello when a image block drop to editor i hide the default asset manager and display my custom asset manager: fot this i have no problem.bu...
Issue #2754
How can i customize video blocks a
I want to create a video gallery-like image gallery. After drop video block shows the gallery . How can I do that?I using grapesjs-preset-w...
Issue #3376
Changing upload URL for AssetManager programmatically
I've got an situation where depending on how the Asset Manager is opened I want to pass a slightly different upload URL. In the asset:uploa...
Issue #3415
QUESTION: Custom Asset Manager. How to set bg image
Hi there! I'm building a custom modal for the Asset Manager and basically, it seems that I need to override command. How I can understand i...
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.