CKEditor inside jQuery Dialog, how do I build it?
- by Ben Dauphinee
So, I'm working with CKEditor and jQuery, trying to build a pop-out editor.
Below is what I have coded so far, and I can't seem to get it working the way I want it to.
Basically, click the 'Edit' link, dialog box pops up, with the content to edit loaded into the CKEditor.
Also, not required, but helpful if you can suggest how to do it. I can't seem to find out how to make the save button work in CKEditor (though I think the form will do it).
Thanks in advance for any help.
$(document).ready(function(){
var config = new Array();
config.height = "350px";
config.resize_enabled = false;
config.tabSpaces = 4;
config.toolbarCanCollapse = false;
config.width = "700px";
config.toolbar_Full = [["Save","-","Cut","Copy","Paste","-","Undo","Redo","-","Bold","Italic", "-", "NumberedList","BulletedList","-","Link","Unlink","-","Image","Table"]];
$("a.opener").click(function(){
var editid = $(this).attr("href");
var editwin = \'<form><div id="header"><input type="text"></div><div id="content"><textarea id="content"></textarea></div></form>\';
var $dialog = $("<div>"+editwin+"</div>").dialog({
autoOpen: false,
title: "Editor",
height: 360,
width: 710,
buttons: {
"Ok": function(){
var data = $(this).val();
}
}
});
//$(this).dialog("close");
$.getJSON("ajax/" + editid, function(data){
alert("datagrab");
$dialog.("textarea#content").html(data.content).ckeditor(config);
alert("winset");
$dialog.dialog("open");
});
return false;
});
});