CKEDITOR.editorConfig = function (config) {
    CKFinder.setupCKEditor(null, 'Ckeditor/Ckfinder');
    config.contentsCss = ["App_Themes/default/base.css"];
    if ($.browser.isMobile) config.bodyClass = 'm';//解决聚焦时安卓浏览器自动放大
    config.defaultLanguage = 'zh-cn';
    config.language = 'zh-cn';
    config.title = "";
    config.disableNativeTableHandles = false;
    config.linkShowAdvancedTab = false;
    config.dialog_noConfirmCancel = true;
    config.scayt_autoStartup = false;
    config.autoUpdateElement = false;
    config.toolbarCanCollapse = false;
    config.enterMode = CKEDITOR.ENTER_P;
    config.shiftEnterMode = CKEDITOR.ENTER_BR;
    config.skin = 'office2013';
    config.height = 100;
    config.smiley_path = 'ckeditor/smileys/';
    config.smiley_columns = 17;
    config.smiley_images = ['0.gif', '1.gif', '2.gif', '3.gif', '4.gif', '5.gif', '6.gif', '7.gif', '8.gif', '9.gif', '10.gif',
        '11.gif', '12.gif', '13.gif', '14.gif', '15.gif', '16.gif', '17.gif', '18.gif', '19.gif', '20.gif', '21.gif', '22.gif',
        '23.gif', '24.gif', '25.gif', '26.gif', '27.gif', '28.gif', '29.gif', '30.gif', '31.gif', '32.gif', '33.gif', '34.gif',
        '35.gif', '36.gif', '37.gif', '38.gif', '39.gif', '40.gif', '41.gif', '42.gif', '43.gif', '44.gif', '45.gif', '46.gif',
        '47.gif', '48.gif', '49.gif', '50.gif', '51.gif', '52.gif', '53.gif', '54.gif', '55.gif', '56.gif', '57.gif', '58.gif',
        '59.gif', '60.gif', '61.gif', '62.gif', '63.gif', '64.gif', '65.gif', '66.gif', '67.gif'];
    config.smiley_descriptions = [
        '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
        '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
        '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
        '', '', '', '', '', '', '', ''];
    config.font_names = '宋体;黑体;楷体/楷体,楷体_GB2312;仿宋/仿宋,仿宋_GB2312;隶书;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana';
    config.stylesSet = [
        { name: '标题样式A', element: 'h3', styles: { 'color': '#393d49', 'border-left': '0.35em #EF3B7A solid', 'padding-left': '5px', 'line-height': '1.3', 'margin-bottom': '1em'} },
        { name: '高亮区', element: 'div', styles: { 'background': '#fff3cd', 'padding': '0.8em 0.6em 0.8em 1.2em', 'border-radius': '4px', 'margin-bottom': '1em', 'border': '1px #ffeeba solid', 'color': '#854D27' } },
        { name: '浅灰区', element: 'div', styles: { 'background': '#f2f2f2', 'padding': '0.8em 0.6em 0.8em 1.2em', 'border-radius': '4px', 'margin-bottom': '1em' } },
        { name: '浅蓝区', element: 'div', styles: { 'background': '#ebf9ff', 'padding': '0.8em 0.6em 0.8em 1.2em', 'border-radius': '4px', 'margin-bottom': '1em', 'border': '1px #d9e9f5 solid', 'color': '#0c5460' } },
        { name: '标题样式B', element: 'div', attributes: { 'class': 'headerZone' } },
        { name: '标题样式C', element: 'div', attributes: { 'class': 'pageTitle' } },
        { name: '首行缩进', element: 'p', styles: { 'text-indent': '2em'} },
        { name: '1.8倍行距', element: 'p', styles: { 'line-height': '1.8'} },
        { name: '仅打印可见', element: 'div', attributes: { 'class': 'forPrint' } },
        { name: '仅屏幕可见', element: 'div', attributes: { 'class': 'forScreen' } },
        { name: '强调', element: 'span', styles: { 'color': '#ff4422', 'font-weight': 'bold'} },
        { name: '醒目', element: 'span', styles: { 'color': '#11aa66' } },
        { name: '文字阴影', element: 'span', styles: { 'text-shadow': '0.1em 0.1em 0.25em #aaa' } }
    ];
    config.stylesheetParser_skipSelectors = /(^\w+\.|^\.)/i;
    config.toolbar_Min = [
	['TextColor', 'BGColor', 'Bold', 'Italic', 'NumberedList', 'BulletedList', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'Link', 'Image', 'FontSize']
    ];
    config.toolbar_Compact = [
	['Maximize', 'TextColor', 'BGColor', 'Bold', 'Italic', 'NumberedList', 'BulletedList', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'Link', 'Image', 'Table', 'Smiley', 'FontSize']
    ];
    config.toolbar_Lesser = [
	['TextColor', 'BGColor', 'Bold', 'Italic'],
	['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'Indent'],
	['NumberedList', 'BulletedList', 'Undo'],
	['Link', 'Image', 'Table'],
	['FontSize', 'Styles', 'Source']
    ];
    config.toolbar_Normal = [
	['Maximize', 'TextColor', 'BGColor', 'Bold', 'Italic'],
	['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'Indent'],
	['NumberedList', 'BulletedList', 'RemoveFormat'],
	['Link', 'Image', 'Table', 'tabs'],
	['HorizontalRule', 'PageBreak', 'Smiley'],
	['Font', 'FontSize', 'Styles', 'Source']
    ];
    config.toolbar_Advanced = [
	['Maximize', 'Cut', 'Copy', 'Paste', 'PasteFromWord'],//, 'PasteText'
	['TextColor', 'BGColor', 'Bold', 'Italic', 'Underline'], //, 'Strike', 'Superscript'
	['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'Indent'],//, 'Outdent'
	['NumberedList', 'BulletedList', 'RemoveFormat', 'Undo', 'Redo'],
	['Link', 'Unlink', 'Image', 'Table', 'tabs'],
	['Find', 'HorizontalRule', 'PageBreak', 'Smiley'],
    ['Font', 'FontSize', 'Styles', 'Sourcedialog']
    ];
    //窄页面下FontSize会独立显示一行（若之前的按钮换行了），因此去除
    var width = document.documentElement.clientWidth;
    if (width <= 480) {
        config.toolbar_Compact[0].pop();
        config.toolbar_Min[0].pop();
        if (width <= 376) {
            config.toolbar_Compact[0].pop();
        }
    }
    config.toolbar = 'Compact';
    //避免无内容的标签被移除
    var tags = ["i", "b", "em", "span", "a"];
    for (var i = 0, tag; tag = tags[i++];) {
        CKEDITOR.dtd.$removeEmpty[tag] = false;
    }
    //config.protectedSource.push(/<a[^>]*>[\s]*<\/a>/g);
    config.allowedContent = true;//使切换源码视图后不丢失HTML自定义属性
    config.extraPlugins = 'codemirror,tabs,quicktable';
    config.codemirror = { autoFormatOnStart: true, lineNumbers: false, mode: 'htmlmixed' };
    config.sourceAreaTabSize = 4;
    //quicktable
    config.qtClass = "normal";
    config.qtWidth = "100%";
    config.qtColumns = 8;
};