简体   繁体   English

为CKeditor 5工具栏创建自定义按钮

[英]Create custom button(s) for CKeditor 5 toolbar

I've managed to customize the header and highlight dropdowns for CKEditor 5 – classic editor build by creating a new custom build . 我已经设法自定义标题并突出显示CKEditor 5的下拉列表-通过创建新的自定义构建来构建 经典编辑器
But I don't know how to add additional buttons to the toolbar. 但我不知道如何在工具栏中添加其他按钮。 For example a fullscreen button. 例如全屏按钮。 Current progress: github link 当前进展: github链接

If you want to add existing buttons to the main toolbar, then you need to configure the config.toolbar . 如果要将现有按钮添加到主工具栏,则需要配置config.toolbar In your example it corresponds to these lines . 在您的示例中,它对应于这些行

There's no fullscreen button at this moment. 目前没有全屏按钮。 You can add +1 to the https://github.com/ckeditor/ckeditor5/issues/1235 to increase its priority or try to implement this feature on your own. 您可以向https://github.com/ckeditor/ckeditor5/issues/1235添加+1以提高其优先级,或尝试自行实施此功能。

Basically, to create your own button you need to create a plugin which registers the button in the component factory and adds some actions that will be performed on the buttonView:execute event. 基本上,要创建自己的按钮,您需要创建一个插件,在组件工厂中注册按钮,并添加一些将在buttonView:execute事件上buttonView:execute You can follow the steps described in creating a simple plugin guide . 您可以按照创建简单插件指南中描述的步骤进行操作。 A good and complementary reading about the UI library can be found here . 可以在此处找到关于UI库的良好且互补的阅读。

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

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