javascript - CKEditor5 文本对齐
问题描述
我正在尝试使用 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);
});
这有效,但没有“对齐”选项。我找到了这个关于如何安装 @ckeditor/ckeditor5-alignment 包的链接
我仔细按照此链接中显示的步骤操作,我已经安装了 NPM 包管理器并在我的应用程序中提出了“node_modules”粘贴,但我的浏览器报告了错误
未捕获的 SyntaxError:意外的标识符
从这一行:
import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
我不是 NPM 方面的专家,但遵循了所示的步骤。我不知道缺少什么。
解决方案
您必须创建自己的构建才能添加一些额外的插件。你不能在不构建它的情况下将插件添加到 ckeditor5。更多信息:
Ckeditor5 自定义构建
推荐阅读
- javascript - 嵌套函数 - 未定义变量
- c# - for 循环中的子字符串提取的字符多于应有的字符
- openmaptiles - OpenMapTiles-Server Web 向导
- asp.net - 在 ASP.Net 1.1 应用程序中破解 .DLL 以将 ComponentOne WebGrid 更改为 .Net DataGrid
- java - 在春天将参数从一个映射传递到另一个映射
- rest - 用户名和密码在网络选项卡中可见
- python - Django将Count注释添加到过滤的预取相关查询
- php - 将 iframe 嵌入到 php 文件中
- java - 这个错误是什么意思,我该如何解决?
- angular - 如何在具有依赖关系的提供者中注册服务?