Modal dialog in CodeMirror editor

Hi, Is there a way to display modal dialog in CodeMirror (like the one shown in the pic ?)
I tried using addWidget() ,but it is messing up the content in the editor. Please let me know if there is a better way to create modal dialog in CodeMirror ?

Just overlaying some element over the editor is the easiest way to do something like this.

1 Like

Thanks. I used addWidget() and used z-index to make sure they don’t mess with editor’s contents.
cm.addWidget({ line: currentLineNum, ch:20 }, modalDialog, true);

Is there a way to center the widget within the viewable area of the editor ? I noticed the add widget() some times places the widget below the viewable area.

Don’t use addWidget, since it has no use in this situation. Place your dialog outside of the editor, and possibly use a shared parent element + absolute positioning to position it over the editor.

Sure Thanks, I resolved the issue.