【问题标题】:CKeditor 5 (online builder) missing buttonsCKeditor 5(在线生成器)缺少按钮
【发布时间】:2020-08-26 18:37:34
【问题描述】:

使用 CKeditor v5 在线构建器下载了默认设置。

使用时一切正常。但是当使用加载本地(和下载的在线构建器版本)时,所有按钮都消失了,为什么?

感谢您的帮助。

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>

    <script src="/ckeditor5/build/ckeditor.js"></script>
    <!-- <script src="https://cdn.ckeditor.com/ckeditor5/20.0.0/classic/ckeditor.js"></script> -->

<body>

        <div id="editor">Test Text (buttons missing)</div>
                
        <script>
            ClassicEditor
            .create( document.querySelector( '#editor' ) )
            .catch( error => {
            console.error( error );
            } );
        </script>

</body>
</html>

【问题讨论】:

    标签: ckeditor5


    【解决方案1】:

    检查附加到 CKEditor 5 构建 (samples/index.html) 的示例的源代码。您会注意到在初始化 CKEditor 实例时需要传递一个工具栏配置。

    【讨论】:

    • 你的意思是我需要将工具栏配置部分从 (samples/index.html) 复制到我自己的 html 文件中才能工作吗?我想这将是一个公平的假设,我的逻辑坚持认为 Online Builder 会处理这个问题。所以基本上我的坏:)谢谢
    • 我同意这是违反直觉的,我们会尝试解决它。​​
    【解决方案2】:

    对于 Angular 用户:

    即使默认的 ckeditor 构建 (@ckeditor/ckeditor5-build-classic/build/ckeditor) 带来了它自己的工具栏按钮, 您必须自己为自定义构建添加它(例如https://ckeditor.com/ckeditor-5/online-builder/

    theCustomBuild/sample/index.html 生成的工具栏数组复制到您的配置中:

    html:

    <ckeditor [editor]="Editor" [config]="config"></ckeditor>
    

    在您的组件中:

    public config = {
        toolbar: [
            'exportPdf',
            'heading',
            '|',
            'bold',
            ...
        ]
    };
    

    【讨论】:

      猜你喜欢
      • 2020-09-15
      • 2018-08-22
      • 1970-01-01
      • 2020-10-24
      • 2018-09-01
      • 1970-01-01
      • 2016-01-09
      • 2014-06-16
      • 1970-01-01
      相关资源
      最近更新 更多