How can you integrate a custom file browser/uploader with CKEditor?

前端 未结 8 1554
南方客
南方客 2020-11-28 00:14

The official documentation is less than clear - what\'s the correct way to integrate a custom file browser/uploader with CKEditor? (v3 - not FCKEditor)

8条回答
  •  爱一瞬间的悲伤
    2020-11-28 00:55

    This is the approach I've used. It's quite straightforward, and works just fine.

    In the CK editor root directory there is a file named config.js

    I added this (you don't need the querystring stuff, this is just for our file manager). I also included some skinning and changing of the default buttons shown:

    CKEDITOR.editorConfig = function(config) {
    
        config.skin = 'v2';
        config.startupFocus = false;
        config.filebrowserBrowseUrl = '/admin/content/filemanager.aspx?path=Userfiles/File&editor=FCK';
        config.filebrowserImageBrowseUrl = '/admin/content/filemanager.aspx?type=Image&path=Userfiles/Image&editor=FCK';
        config.toolbar_Full =
        [
            ['Source', '-', 'Preview', '-'],
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Print', 'SpellChecker'], //, 'Scayt' 
            ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
            '/',
            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'],
            ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
            ['Link', 'Unlink', 'Anchor'],
            ['Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar'],
            '/',
            ['Styles', 'Format', 'Templates'],
            ['Maximize', 'ShowBlocks']
        ];
    
    };
    

    Then, our file manager calls this:

    opener.SetUrl('somefilename');
    

提交回复
热议问题