简体   繁体   English

CKEditor5 文本对齐

[英]CKEditor5 Text Alignment

I am try to configure my page with the CK5 editor.我正在尝试使用 CK5 编辑器配置我的页面。 I did:我做了:

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 works, but doesn't have an 'alignment' option.这有效,但没有“对齐”选项。 I found this link on how to install the @ckeditor/ckeditor5-alignment package我找到了关于如何安装 @ckeditor/ckeditor5-alignment 包的链接

I followed carefully the steps show in this link, I have installed the NPM package manager and was raised the 'node_modules' paste in my application, but my browser report the error我仔细按照此链接中显示的步骤进行操作,我已经安装了 NPM 包管理器并在我的应用程序中引发了“node_modules”粘贴,但我的浏览器报告了错误

Uncaught SyntaxError: Unexpected identifier未捕获的语法错误:意外的标识符

from this line:从这一行:

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

I'm not an expert in NPM, but followed the steps shown.我不是 NPM 专家,但按照所示步骤操作。 I don't know what is missing.我不知道缺少什么。

You have to create your own build in order to add some extra plugins.您必须创建自己的构建才能添加一些额外的插件。 You cannot add plugins to ckeditor5 without building it.你不能在不构建的情况下向 ckeditor5 添加插件。 More information:更多信息:
Ckeditor5 Custom Builds Ckeditor5 自定义构建

As a complement to @Dariush Salami's answer, take a look at this link , and check if it'll help you.作为对@Dariush Salami 回答的补充,请查看此链接,看看它是否对您有帮助。

If you would like to install plugins locally on your own machine, please see how this can be done here .如果您想在自己的机器上本地安装插件,请在此处查看如何完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM