Right, I think it came up before but the issue is that dialogs are supposed to be modal. So the user makes some changes, click Save, the modal is closed and you get the result back. Is there something more you'd need?
I will get an error that CodeMirror doesn't exist even though it's right there, as if it tried to load all scripts at once on dialog open.
The only way I got it to work is by delaying the call await dialogs.addScript(diffViewDialog, './UI/codemirror/addon/merge/merge.js'); until after the open function is called. (So that the view would be loaded already). But this solution isn't practical, I have to assume it's just a bug in Joplin that can be fixed ?
It doesn't have to. You're in control of the dialog content, so you can dynamically create hidden input fields and set the content to anything you want, which will be picked up by the dialog when it's closed.
I just noticed, the intended way to use dialogs is to create it once when loading the plugin. And then use .open when it's needed. So I'm back to step 1. A delay wouldn't work or else I'd have to create a new dialog every time.