You can customize the initial state of the module from the editor initialization, by passing the following Configuration Object

const editor = grapesjs.init({
 modal: {
   // options
 }
})

Once the editor is instantiated you can use its API. Before using these methods you should get the module from the instance

const modal = editor.Modal;

open

Open the modal window

Parameters

Returns this

close

Close the modal window

Returns this

onceClose

Execute callback when the modal will be closed. The callback will be called one only time

Parameters

Returns this

onceOpen

Execute callback when the modal will be opened. The callback will be called one only time

Parameters

Returns this

isOpen

Checks if the modal window is open

Returns Boolean

setTitle

Set the title to the modal window

Parameters

Examples

modal.setTitle('New title');

Returns this

getTitle

Returns the title of the modal window

Returns string

setContent

Set the content of the modal window

Parameters

Examples

modal.setContent('<div>Some HTML content</div>');

Returns this

getContent

Get the content of the modal window

Returns string

Last Updated: 5/2/2019, 1:28:33 AM