ckeditor使用前端代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>CKEditor 5 – classic editor build – development sample</title>
    <style>
        body {
            max-width: 800px;
            margin: 20px auto;
        }
    </style>
</head>
<body>

<h1>CKEditor 5 – classic editor build – development sample</h1>

<div id="editor">
    <h2>Sample</h2>

    <p>This is an instance of the <a href="https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#classic-editor">classic editor build</a>.</p>

    <figure class="image">
        <img src="tests/manual/sample.jpg" alt="Autumn fields" />
    </figure>

    <p>You can use this sample to validate whether your <a href="https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/custom-builds.html">custom build</a> works fine.</p>
</div>

<h2 style="text-align:center"><a href="index35.html" target="_blank">ckfinder3.5</a></h2>
 


<script src="build/ckeditor.js"></script>
<script src="build/translations/zh-cn.js"></script>
 

<script>
    ClassicEditor.create( document.querySelector( '#editor' ),{
    toolbar: {
                items: [
                    'sourceEditing',
                    '|','undo','redo',
                    '|','heading',
                    '|','findandReplace','alignment','bold','italic','underline','code',
                    'horizontalLine','removeformat','link','strikethrough','subscript','superscript','blockQuote','specialCharacters',
                    '|','FontSize','FontColor','FontBackgroundColor','FontFamily','highlight',
                    '|','numberedList','bulletedList','todoList','outdent','indent','pageBreak',
                    '|','insertImage','cKFinder','insertTable','mediaEmbed',
                
                ]
            },
            ckfinder: {
                uploadUrl: 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json'
            },
            //设置字体
            fontFamily: {
                options: [
                    'default',
                    'Blackoak Std',
                    '宋体,SimSun',
                    '新宋体,NSimSun',
                    '微软雅黑,Microsoft YaHei',
                    '楷体_GB2312,KaiTi_GB2312',
                    '隶书,LiSu',
                    '幼园,YouYuan',
                    '华文细黑,STXihei',
                ]
            },
            image: {

                styles: [
                    'full','alignLeft', 'alignCenter', 'alignRight'
                ],  
                resizeOptions: [
                    {
                    name: 'resizeImage:原尺寸',
                    label: '原尺寸',
                    value: null
                    },
                    {
                    name: 'resizeImage:25',
                    label: '25%',
                    value: '25'
                    },
                    {
                    name: 'resizeImage:50',
                    label: '50%',
                    value: '50'
                    },
                    {
                    name: 'resizeImage:75',
                    label: '75%',
                    value: '75'
                    }
                ],
                toolbar: [
                    // 'imageStyle:full',
                    // 'imageStyle:side',
                    'imageStyle:alignLeft',
                    'imageStyle:alignCenter',
                    'imageStyle:alignRight',
                    '|',
                    'resizeImage', 
                    '|',
                    'toggleImageCaption',
                    'imageTextAlternative',
                    'linkImage'
                ],

            },
            table: {
            contentToolbar: [
            'tableColumn',
            'tableRow',
            'mergeTableCells',
            'tableCellProperties',
            'tableProperties'
            ]
            },
            language: 'zh-cn'
    } )
        .then( editor => {
            window.editor = editor;
        } )
        .catch( error => {
            console.error( 'There was a problem initializing the editor.', error );
        } );
</script>

</body>
</html>

  • 8
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值