var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));

// src/braft-editor/pluginExtends.tsx
var import_react = __toESM(require("react"));
var import_braft_editor = __toESM(require("braft-editor"));
var import_max_length = __toESM(require("braft-extensions/dist/max-length"));
var import_code_highlighter = __toESM(require("braft-extensions/dist/code-highlighter"));
var import_code_highlighter2 = require("braft-extensions/dist/code-highlighter.css");
var entityTags = {
  // 指定扩展类型
  type: "entity",
  // 指定扩展的entity名称，推荐使用全部大写，内部也会将小写转换为大写
  name: "KEYWORD-ITEM",
  // 在编辑器工具栏中增加一个控制按钮，点击时会将所选文字转换为该entity
  // control: {
  //     text: '标签'
  // },
  // 指定entity的mutability属性，可选值为MUTABLE和IMMUTABLE，表明该entity是否可编辑，默认为MUTABLE
  mutability: "IMMUTABLE",
  // 指定通过上面新增的按钮创建entity时的默认附加数据
  // data: {},
  // 指定entity在编辑器中的渲染组件
  component: (props) => {
    return /* @__PURE__ */ import_react.default.createElement("span", { className: "keyword-item", contentEditable: false }, props.children);
  },
  // 指定html转换为editorState时，何种规则的内容将会转换成该entity
  importer: (nodeName, node) => {
    if (nodeName.toLowerCase() === "span" && node.classList && node.classList.contains("keyword-item")) {
      return {
        mutability: "IMMUTABLE",
        data: {}
      };
    }
    return;
  },
  // 指定输出该entity在输出的html中的呈现方式
  exporter: (entityObject, originalText) => {
    return /* @__PURE__ */ import_react.default.createElement("span", { className: "keyword-item" }, originalText);
  }
};
import_braft_editor.default.use([
  (0, import_max_length.default)({}),
  (0, import_code_highlighter.default)({
    syntaxs: [
      {
        name: "CODE",
        syntax: "javascript"
      }
    ]
  }),
  entityTags
]);
