我尝试在Sulu (2.2.1版)中使用CKeditor5设置字体颜色,我遵循了这位医生的做法。
因此,首先,我将这一行添加到资产/admin/Package.json文件(到“依赖项”对象中):
"@ckeditor/ckeditor5-font": "^23.0.0",然后,我将这一行添加到资产/admin/index.js文件中:
import {ckeditorPluginRegistry, ckeditorConfigRegistry} from 'sulu-admin-bundle/containers';
import Font from '@ckeditor/ckeditor5-font/src/font';
ckeditorPluginRegistry.add(Font);
ckeditorConfigRegistry.add((config) => ({
toolbar: [...config.toolbar, 'fontColor', 'fontBackgroundColor'],
}));然后我运行以下命令:对于所问的问题,请执行以下命令:bin/console sulu:admin:update-build:
这个工作很棒,我可以在我的text_editor内容类型中设置颜色和背景色。
但是,当我尝试添加一个具有single_media_selection内容类型的图像时,有一个带有此错误的空白页进入浏览器控制台:
TypeError: (void 0) is not a function如果删除我添加的所有行,single_media_selection工作很好,但不能将颜色转换为CKeditor。
我在什么地方犯了错吗?
发布于 2021-03-02 14:34:17
在您提到的文档中,有一个评论表示必须使用"@ckeditor/ckeditor5-font": "^18.0.0",如果使用Sulu2.1,则必须使用"@ckeditor/ckeditor5-font": "^23.0.0" (如果使用Sulu2.2及更高版本)。
既然您提到,您正在使用Sulu2.1,这可能就是错误。
https://stackoverflow.com/questions/66441037
复制相似问题