HI all,
I am building a template system, where a user can click on a desired template. I save the choise in an onclick function, and use JQuery ajax, to get the template inserted into the page the user is building. The template shows up fine, but I dont get the CKeditor instance with it. The user can add as many template onto the page as he/her wishes, so I need the inline editor to be attached to all the divs created (with class="bigeditor").
Here is the onclick function, that gets the template from a PHP file:
// GET THE TEMPLATE FROM THE PHP FILE:
$.get("includes/pages/template_editor.php", { template_id: temp_id }).done( function( return_data ) {
var template = return_data;
// INSERT TEMPLATE TO CMS DIV CONTAINER:
$("#cms_get_content").append(template);
// CALL CKEDITOR INLINE EDITOR, TO ALL DIVS ON THE PAGE LOADED THROUGH AJAX, THAT HAS THE CLASS: "BIGEDITOR"
// HOW DO I MAKE THAT HAPPEN..
CKEDITOR.inline('bigeditor');
});
CKEDITOR.inline('bigeditor'); Works on ONE(the first) div, IF it has an ID="bigeditor", and not a class="bigeditor". - But I need to use classes as there is several editable divs on the page.
IMPORTANT:
I have used the CKEDITOR INLINE functionality, and I need to attach the editor to several div classes on the same page.
I need to insert an custom editor, with a toolbar looking like this:
// Toolbar configuration:
editor.config.toolbar = [
{ name: 'document', items : [ 'Source','-','Preview' ] },
{ name: 'clipboard', items : [ 'Undo','-','Redo' ] },
{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote',
'-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] },
{ name: 'editing', items : [ 'Find','Replace' ] },
{ name: 'insert', items : [ 'Image','Video','HorizontalRule' ] },
{ name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] },
{ name: 'links', items : [ 'Link','Unlink' ] },
'/',
{ name: 'styles', items : [ 'Format','Font','FontSize' ] },
{ name: 'colors', items : [ 'TextColor','BGColor' ] }
];
Im stuck here, and hope theres someone who can help out as Im eager to keep the ajax functionality to the page.
Best Regards, Jan