I use ckeditor for richtextbox editing in MVC3 . In normal View, ckeditor is working good ,but when I try to use it with jQuery ui Dialog I have some problems with it.
My dialog:
$(document).ready(function() {
jQuery.noConflict();
jQuery("#contentOpen").live("click", function(e) {
e.preventDefault();
jQuery('<div />', {
class: 'customPopUp',
id: "popUpDialog",
}).appendTo("body")
.load(this.href, function() {
jQuery(this).dialog({
close: function() {
if (CKEDITOR.instances['NewsCulture_Content']) {
CKEDITOR.instances['NewsCulture_Content'].destroy();
}
jQuery(this).remove();
},
open: jQuery(function() {
jQuery('#NewsCulture_Content').ckeditor();
}),
width: 'auto',
height: 'auto',
});
});
});
});
View:
@{
Layout = null;
}
<script src="@Url.Content("~/Scripts/ckeditor/ckeditor.js")" type="text/javascript">/script>
<script src="@Url.Content("~/Scripts/ckeditor/adapters/jQuery.js")" type="text/javascript"></script>
@model CyberSystems.ViewModel.ViewModels.System.VmSysNewsCreatre
@using (Ajax.BeginForm("News_Room_AddNew", "Administration", null,
new AjaxOptions {HttpMethod = "POST", OnComplete = "addBarNewsCompelte"}, new {id = "addRoomNewsForm"}))
{
@Html.TextAreaFor(c=>c.NewsCulture.Content)
}
First time everything is fine and it looks like in the picture1 ; After two click on same plugin (Styles) something is going wrong , picture2. I have no idea what is the problem , any ideas will be appreciated...