开发者

How do I send the ckeditor config using jQuery service?

开发者 https://www.devze.com 2023-02-01 03:55 出处:网络
My service is built and it is sending the config variable to my js file: [[\'SpellChecker\',\'-\',\'Undo\',\'Redo\',\'-\',\'Bold\'开发者_如何学运维,\'Italic\',\'Underline\',\'NumberedList\',\'Bulleted

My service is built and it is sending the config variable to my js file: [['SpellChecker','-','Undo','Redo','-','Bold'开发者_如何学运维,'Italic','Underline','NumberedList','BulletedList']]

The above is assigned to my javascript like so:

var config = "<?= stripslashes($_REQUEST['config']) ?>";

I can alert out the config just fine: console.log(config) does send back the correct data...

However, I get an error thrown in my console!:

v is undefined [Break On This Error] var u=n.toolbox.toolbars,v=n.config.to...aximize','ShowBlocks','-','About']];

If I comment out the config:

//CKEDITOR.config.toolbar = config;

everything works fine but the configuration doesn't exist, of course...


FIXED...PFFFFFFFFT

// Setup the configurations for this instance
CKEDITOR.config.toolbar = eval(config);


$(document).ready(function(){
    $('.reply').click(
    function(event){
        // Event click Off Default
        event.preventDefault();
        // CKEditor
        $(function(){
            var config = {toolbar:[['Bold', 'Italic', '-', 'Link', 'Unlink']]};
            //<?php /*echo"var config = {toolbar:[['Bold', 'Italic', '-', 'Link', 'Unlink']]};" ;*/ ?>
            // DOM class = "cke"
            $('textarea.cke').ckeditor(function(){}, config);                
        });
        return false;
    });
}); 
0

精彩评论

暂无评论...
验证码 换一张
取 消