How do I pass in config info to CKEditor using the jQuery adapter?

后端 未结 7 740
感动是毒
感动是毒 2021-02-05 06:49

I\'m using the latest CKeditor with jQuery adapter.

I have successfully got it to work, and display.

However, as I am completely new to CKeditor, how d

相关标签:
7条回答
  • 2021-02-05 07:23
    var config = {
        toolbar:
        [
            ['Source','-','Save','NewPage','Preview','-','Templates'],
            ['Maximize', 'ShowBlocks','-','About']
        ],
        coreStyles_bold: { element : 'b', overrides : 'strong' }
    };
    

    Simply add the respective config object, above I added coreStyles_bold, All I did is change the "=" from the CK API documentation to a ":"

    0 讨论(0)
  • 2021-02-05 07:24

    I have accomplished this using this code. Hopefully this helps.

    Here is the html:

    <textarea id="txtMessage" class="editor"></textarea>
    

    and here is the javascript:

    try {
            var config =
                {
                    height: 180,
                    width: 515,
                    linkShowAdvancedTab: false,
                    scayt_autoStartup: true,
                    enterMode: Number(2),
                    toolbar_Full: [['Styles', 'Bold', 'Italic', 'Underline', 'SpellChecker', 'Scayt', '-', 'NumberedList', 'BulletedList'],
                                    ['Link', 'Unlink'], ['Undo', 'Redo', '-', 'SelectAll']]
    
                };
    
            $('textarea.editor').ckeditor(config);   }
    
    0 讨论(0)
  • 2021-02-05 07:26

    Not sure if this is a new feature of CKEDITOR, but just want to share my solution (in case it helps anyone looking for this now):

    $("textarea.youreditor").ckeditor
    (
        {
            customConfig: "/path/to/custom/config.js"
        }
    );
    

    ... and my config looks like this (simply copied the default config.js):

    CKEDITOR.editorConfig = function(config)
    {
        config.toolbar_Full =
        [
            { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
            { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'] },
            { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] },
            { name: 'colors', items : [ 'TextColor','BGColor' ] }
        ];  
    };    
    
    0 讨论(0)
  • 2021-02-05 07:34

    There is an official documentation for it, see jQuery Adapter

    The ckeditor() method accepts two optional parameters:

    • A callback function to be executed when the editor is ready.
    • Configuration options specific to the created editor instance:
        $( 'textarea' ).ckeditor({
            uiColor: '#9AB8F3'
        });
    
    0 讨论(0)
  • 2021-02-05 07:39
    jQuery(function(){
            var config = {
                toolbar:
                [
                    ['Bold', 'Italic', 'Underline', '-', 'NumberedList', 'BulletedList', '-', 'Undo', 'Redo', '-', 'SelectAll'],
                    ['UIColor']
                ]
            };      
            jQuery('#textAreaElement').ckeditor(config);
        });
    
    0 讨论(0)
  • 2021-02-05 07:42

    I passed an empty function...

    $('textarea#my').ckeditor($.noop, {
        property: 'value'
    });
    
    0 讨论(0)
提交回复
热议问题