grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

BUG: Modal won't open after closing it dynamically

Open alivex opened this issue 5 years ago • 2 comments

Hello;

Thank you guys for the great tool, I just love the documentation, the easy to use/understand. I think I ran into an issue with the modal not opening again after closing it dynamically the first time. example:


editor.on('modal:open', () => this.openModalHandler(editor));

openModalHandler(editor){
        const model = editor.getSelected();
        const modal = editor.Modal;
        const {type} = model.attributes;

        modal.close();

        switch (type) {
        case 'image':
        case 'section':
            return this.addBackgroundImage(type);
        }
    }
    

alivex avatar Jan 12 '21 22:01 alivex

I can't reproduce it on the official demo, eg.

editor.on('modal:open', () => {
 console.log('Modal opened');
 setTimeout(() => {
  console.log('Close modal');
  editor.Modal.close()
 }, 2000)
});

But just checking your code I'd say it doesn't open because you're closing it immediately after (just after the open is triggered), am I missing something?!

artf avatar Jan 25 '21 23:01 artf

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

no-response[bot] avatar Feb 05 '21 00:02 no-response[bot]