jQuery Dialog not playing well with ckeditor
So in updating our web app to use jquery dialogs with ajax-obtained content, two key problems came up. Either, ckeditor took over the popup window and wouldn’t allow you to edit other text fields; OR after an open/close of a dialog box, the next open event on another dialog box would close almost immediately.
So, after some digging, two solutions came up.
- Per the last post on this bug report the solution (mostly to the second problem) was to use jqueryUI version 1.9.1. simple as that. 1.10.x caused the auto close problem.
-
Per this rather cryptic note on solving the problem, my co-worker wrote me this:
maybe you can rewrite the javascript so instead of
1.) create form for question in the div
2.) show div via jquery.dialog();
you can do
1.) show div via jquery.dialog()
2.) once it’s shown, create the form.
So that was it. Here’s the working code snippet :
[code language=”javascript”]
$("#surveyJqDialog").dialog({
width: 700,
modal: true,
//must do it this way else conflicts between dialog and ckeditor
open: function(){
qTextEditor = CKEDITOR.replace(‘questionText’);
},
close: function(){
qTextEditor.destroy();
}
});
[/code]