I have a plugin that should show a dialog (Modal) every time the user double-clicks on a word.
Double-click detection is not a problem, but the exact fields / values ββin the dialog box depend on which word the user clicked on and on some kind of mutable global state. Therefore, I cannot create a dialogue until the moment I need to show it. And here's the problem: how do I do this?
I am using this code now:
var dialogName="uniqueDialog" + counter++;
CKEDITOR.dialog.add(dialogName,function(editor) {
});
CKEDITOR.instances.editor.openDialog(dialogName);
This works, but you need to add a uniquely named dialog, just to show it once, and then a newer use of it again seems really really wrong. I am also afraid that this will continue to use resources as the dialogs are more deleted (I could not find any removal method).
So my question is: is there a better way to dynamically create and show a one-use dialog?
source
share