首页 > 建站教程 > 编辑器、IDE >  ckeditor5编写自定义插件,并做国际化处理正文

ckeditor5编写自定义插件,并做国际化处理

首先下载好ckeditor5的自定义构建项目,在src目录下新建plugins文件夹存放我们自己写的插件

这里我编写一个emoji表情插件,做为参考,目录如下:

ckeditor5自定义插件


其中index.js内容

import { Plugin } from 'ckeditor5/src/core';
export default class SpecialCharactersEmoji extends Plugin {
  /**
   * @inheritDoc
   */
  static get pluginName() {
    return 'SpecialCharactersEmoji';
  }
  /**
   * @inheritDoc
   */
  init() {
    const editor = this.editor;
    const t = editor.t;
      editor.plugins.get("SpecialCharacters").addItems("Emoji", [
        { title: t("smiley face"), character: "