
CKEDITOR_5_CONFIGS = {
    'default': {
        'toolbar': {
            'items': [
                'heading', '|', 'bold', 'italic', 'link', 'imageUpload',
                'blockQuote'
            ],
            'shouldNotGroupWhenFull':
            True
        },
        'language': 'zh-cn',  # 中文界面
        'image': {
            'toolbar': [
                'imageTextAlternative', '|', 'imageStyle:alignLeft',
                'imageStyle:full'
            ],
            'styles': ['full', 'alignLeft']  # 图片对齐选项
        },
        'licenseKey': ''  # GPL 版本无需密钥 
    },
    'basic': {
        'toolbar': {
            'items': [
                'heading', '|', 'bold', 'italic', 'link', 'bulletedList',
                'numberedList', '|', 'undo', 'redo'
            ],
            'shouldNotGroupWhenFull':
            True
        },
        'language': 'zh-cn',
        'licenseKey': '',  # GPL 版本无需密钥 
        'height': '150px'  # 紧凑高度
    },
    'article': {
        'toolbar': {
            'items': [
                'heading', '|', 'fontSize', 'fontFamily', 'fontColor',
                'highlight', '|', 'alignment:left', 'alignment:right',
                'alignment:center', '|', 'imageUpload', 'link', 'blockQuote',
                'codeBlock', '|', 'bulletedList', 'numberedList', 'todoList',
                '|', 'horizontalLine', 'pageBreak', '|', 'undo', 'redo'
            ],
            'shouldNotGroupWhenFull':
            True
        },
        'licenseKey': '',  # GPL 版本无需密钥 
        'image': {
            'toolbar': [
                'imageTextAlternative', 'toggleImageCaption',
                'imageStyle:inline', 'imageStyle:block', 'imageStyle:side'
            ],
            'styles': ['full', 'side', 'alignLeft', 'alignRight']
        },
        'language': 'zh-cn',
        'height': '500px'
    },
    'tech': {
        'licenseKey': '',  # GPL 版本无需密钥 
        'toolbar': {
            'items': [
                'heading',
                '|',
                'code',
                'codeBlock',
                'htmlEmbed',
                '|',
                'insertTable',
                'mathType',
                'chemType',
                '|',
                'sourceEditing'  # 源码模式
            ],
            'shouldNotGroupWhenFull':
            True
        },
        'table': {
            'contentToolbar': [
                'tableColumn', 'tableRow', 'mergeTableCells',
                'toggleTableCaption'
            ]
        },
        'codeBlock': {
            'languages': [{
                'language': 'python',
                'label': 'Python'
            }, {
                'language': 'javascript',
                'label': 'JavaScript'
            }, {
                'language': 'html',
                'label': 'HTML'
            }]
        },
        'language': 'zh-cn',  # 中文界面
    },
    'admin': {
        'toolbar': {
            'items': [
                'heading', '|', 'fontSize', 'fontFamily',
                'fontBackgroundColor', 'fontColor', '|', 'alignment', 'indent',
                'outdent', '|', 'imageUpload', 'uploadImage', 'insertMedia',
                'link', '|', 'blockQuote', 'codeBlock', 'htmlEmbed', '|',
                'specialCharacters', 'horizontalLine', 'pageBreak', '|',
                'restrictedEditing', 'sourceEditing', '|', 'undo', 'redo'
            ],
            'shouldNotGroupWhenFull':
            True
        },
        'licenseKey': '',  # GPL 版本无需密钥 
        'mediaEmbed': {
            'previewsInData':
            True,
            'providers': [{
                'name':
                'youtube',
                'url': [
                    r'^https?://(www\.)?youtube\.com/watch\?v=([^&\s]+)',
                    r'^https?://youtu\.be/([^&\s]+)'
                ],
                'html':
                '''
                        <iframe 
                            width="560" 
                            height="315" 
                            src="https://www.youtube.com/embed/{id}" 
                            frameborder="0" 
                            allowfullscreen
                        ></iframe>
                    '''
            }]
        },
        'language': 'zh-cn',
    },
    'markdown': {
        'licenseKey': '',  # GPL 版本无需密钥 
        'toolbar': {
            'items': [
                'heading', '|', 'bold', 'italic', 'link', 'code', '|',
                'blockQuote', 'codeBlock', '|', 'undo', 'redo'
            ],
            'shouldNotGroupWhenFull':
            True
        },
        'htmlSupport': {  # 允许Markdown标签
            'allow': [{
                'name': 'div',
                'attributes': ['class']
            }, {
                'name': 'span',
                'attributes': ['class']
            }]
        },
        'markdown': {  # 启用Markdown输出
            'converterType': 'markdown',
            'formatOnSave': True
        }
    },
    # 用于前台内容展示
    'readonly': {
        'licenseKey': '',  # GPL 版本无需密钥 
        'toolbar': [],
        'readOnly': True,
        'initialData': '<p style="color:#666">此内容不可编辑</p>'
    },
    "full_features": {
        "toolbar": {
            "items": [
                "heading", "|", "bold", "italic", "underline", "strikethrough",
                "subscript", "superscript", "|", "fontColor",
                "fontBackgroundColor", "fontFamily", "fontSize", "|",
                "alignment", "|", "numberedList", "bulletedList", "todoList",
                "|", "outdent", "indent", "link", "imageUpload", "mediaEmbed",
                "|", "blockQuote", "code", "codeBlock", "htmlEmbed", "|",
                "insertTable", "horizontalLine", "sourceEditing", "|", "undo",
                "redo", "|", "findAndReplace", "selectAll",
                "specialCharacters", "removeFormat"
            ],
            "shouldNotGroupWhenFull":
            True
        },
        "language": "zh-cn",
        "disableAutoInline": True,  # 禁用自动初始化
        "image": {
            "toolbar": [
                "imageTextAlternative", "toggleImageCaption", "|",
                "imageStyle:inline", "imageStyle:alignLeft",
                "imageStyle:alignRight", "imageStyle:alignCenter",
                "imageStyle:alignBlockLeft", "imageStyle:alignBlockRight",
                "imageStyle:block", "imageStyle:side", "|", "resizeImage:25",
                "resizeImage:50", "resizeImage:75", "resizeImage:original"
            ],
            "styles": [
                "full", "side", "alignLeft", "alignRight", "alignCenter",
                "alignBlockLeft", "alignBlockRight"
            ]
        },
        "table": {
            "contentToolbar": [
                "tableColumn", "tableRow", "mergeTableCells",
                "tableProperties", "tableCellProperties"
            ],
            "tableProperties": {
                "borderColors":
                ["#000000", "#cccccc", "#ff0000", "#00ff00", "#0000ff"],
                "backgroundColors":
                ["#ffffff", "#cccccc", "#ff0000", "#00ff00", "#0000ff"]
            }
        },
        "codeBlock": {
            "languages": [{
                "language": "plaintext",
                "label": "Plain text"
            }, {
                'language': 'git',
                'label': 'Git'
            }, {
                "language": "python",
                "label": "Python"
            }, {
                "language": "javascript",
                "label": "JavaScript"
            }, {
                "language": "typescript",
                "label": "TypeScript"
            }, {
                "language": "java",
                "label": "Java"
            }, {
                "language": "c",
                "label": "C"
            }, {
                "language": "cpp",
                "label": "C++"
            }, {
                "language": "csharp",
                "label": "C#"
            }, {
                "language": "ruby",
                "label": "Ruby"
            }, {
                "language": "go",
                "label": "Go"
            }, {
                "language": "rust",
                "label": "Rust"
            }, {
                "language": "swift",
                "label": "Swift"
            }, {
                "language": "kotlin",
                "label": "Kotlin"
            }, {
                "language": "php",
                "label": "PHP"
            }, {
                "language": "html",
                "label": "HTML"
            }, {
                "language": "css",
                "label": "CSS"
            }, {
                "language": "sass",
                "label": "SASS"
            }, {
                "language": "scss",
                "label": "SCSS"
            }, {
                "language": "sql",
                "label": "SQL"
            }, {
                "language": "json",
                "label": "JSON"
            }, {
                "language": "yaml",
                "label": "YAML"
            }, {
                "language": "xml",
                "label": "XML"
            }, {
                "language": "markdown",
                "label": "Markdown"
            }, {
                "language": "bash",
                "label": "Bash"
            }, {
                "language": "shell",
                "label": "Shell"
            }, {
                "language": "powershell",
                "label": "PowerShell"
            }, {
                "language": "dockerfile",
                "label": "Dockerfile"
            }, {
                "language": "nginx",
                "label": "Nginx"
            }, {
                "language": "apache",
                "label": "Apache"
            }, {
                "language": "groovy",
                "label": "Groovy"
            }, {
                "language": "lua",
                "label": "Lua"
            }, {
                "language": "perl",
                "label": "Perl"
            }, {
                "language": "r",
                "label": "R"
            }, {
                "language": "scala",
                "label": "Scala"
            }, {
                "language": "matlab",
                "label": "MATLAB"
            }, {
                "language": "objectivec",
                "label": "Objective-C"
            }, {
                "language": "vbnet",
                "label": "VB.NET"
            }, {
                "language": "clojure",
                "label": "Clojure"
            }, {
                "language": "coffeescript",
                "label": "CoffeeScript"
            }, {
                "language": "diff",
                "label": "Diff"
            }, {
                "language": "elixir",
                "label": "Elixir"
            }, {
                "language": "erlang",
                "label": "Erlang"
            }, {
                "language": "graphql",
                "label": "GraphQL"
            }, {
                "language": "haskell",
                "label": "Haskell"
            }, {
                "language": "julia",
                "label": "Julia"
            }, {
                "language": "prolog",
                "label": "Prolog"
            }, {
                "language": "twig",
                "label": "Twig"
            }]
        },
        "fontFamily": {
            "options": [
                "default", "Arial, Helvetica, sans-serif",
                "Courier New, Courier, monospace", "Georgia, serif",
                "Lucida Sans Unicode, Lucida Grande, sans-serif",
                "Tahoma, Geneva, sans-serif", "Times New Roman, Times, serif",
                "Trebuchet MS, Helvetica, sans-serif",
                "Verdana, Geneva, sans-serif", "微软雅黑, Microsoft YaHei",
                "宋体, SimSun", "黑体, SimHei"
            ]
        },
        "fontSize": {
            "options": ["default", 10, 12, 14, 16, 18, 20, 24, 28, 32, 36]
        },
        "licenseKey": "",
        "htmlSupport": {
            "allow": [{
                "name": "/.*/",
                "attributes": True,
                "classes": True,
                "styles": True
            }]
        }
    },
}