Open modal after drop element
Question
How to show custom modal dialog when drop element on editor? like asset modal dialog appears when drop image block to the editor.
Answers (3)
Please check the docs https://grapesjs.com/docs/api/modal_dialog.html#modal
use Modal.setContent();
Use Editor events
[https://grapesjs.com/docs/api/editor.html#available-events](https://grapesjs.com/docs/api/editor.html#available-events)
`editor.on('component:add', (model, argument) => {
//filter using component name
if (model.getName() === 'modelName') {
//show modal
}
//filter using css Class
if (model.getAttrToHTML().class === 'className') {
//show model
}
});`Thanks. I'm new to this plugin. How to create my own modal dialog that has checkbox or select options or etc ?
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 #1831
[Question] How to run command for a block component?
I'd like to do something like this. so once a user drops the test component into the canvas, I'd like to open up asset manager modal where...
Issue #1683
How to change id/class when new element drop on editor or render element with dynamic ip?
Hello @artf , Hope you are doing well. I have two questions regards dynamic blocks adding, 1) Is it possible to render the block with dynam...
Issue #362
How to create custom link components that prompts users to type link/choose link similar to Images Component Modal
Image Components have logic to call Modal and prompt user's interaction for options/configuration of image url. Would like to do similar to...
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.