【问题标题】:CKEditor5 Text AlignmentCKEditor5 文本对齐
【发布时间】:2021-05-21 02:07:02
【问题描述】:

我正在尝试使用 CK5 编辑器配置我的页面。我做到了:

ClassicEditor.create(document.querySelector('#editor'), {
  language: 'pt-br',
  toolbar: ['heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote'],
  heading: {
    options: [{
      model: 'paragraph',
      title: 'Paragrafo',
      class: 'ck-heading_paragraph'
    }, {
      model: 'heading1',
      view: 'h1',
      title: 'Cabeçalho 1',
      class: 'ck-heading_heading1'
    }, {
      model: 'heading2',
      view: 'h2',
      title: 'Cabeçalho 2',
      class: 'ck-heading_heading2'
    }, {
      model: 'heading3',
      view: 'h3',
      title: 'Cabeçalho 3',
      class: 'ck-heading_heading2'
    }]
  }
}).then(editor => {
  console.log(editor);
}).catch(error => {
  console.log(error);
});

这可行,但没有“对齐”选项。我找到了this link 关于如何安装@ckeditor/ckeditor5-alignment 包

我仔细按照此链接中显示的步骤,我已经安装了 NPM 包管理器并在我的应用程序中提出了“node_modules”粘贴,但我的浏览器报告错误

Uncaught SyntaxError: Unexpected identifier

从这一行:

import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';

我不是 NPM 方面的专家,但我遵循了所示的步骤。我不知道是什么 不见了。

【问题讨论】:

    标签: javascript jquery npm ckeditor ckeditor5


    【解决方案1】:

    您必须创建自己的构建才能添加一些额外的插件。您不能在不构建 ckeditor5 的情况下将插件添加到它。 更多信息:
    Ckeditor5 Custom Builds

    【讨论】:

      【解决方案2】:

      作为对@Dariush Salami 回答的补充,请查看this link,看看它是否对您有帮助。

      如果您想在自己的机器上本地安装插件,请查看如何做到这一点here

      【讨论】:

        猜你喜欢
        • 2018-05-13
        • 2020-07-12
        • 2015-02-12
        • 2020-05-23
        • 2017-02-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-12-26
        相关资源
        最近更新 更多