"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const Slate = require("slate");
const overrideDeleteBackward = (editor) => {
  const { deleteBackward } = editor;
  editor.deleteBackward = (unit) => {
    const selection = editor.selection;
    if (selection && Slate.Range.isCollapsed(selection)) {
      const [node, nodePath] = Slate.Editor.node(editor, [selection.focus.path[0]]);
      if (Slate.Element.isElement(node) && Slate.Node.string(node) === "") {
        const previous = Slate.Editor.previous(editor, {
          at: nodePath,
          voids: true
        });
        if (previous) {
          const [previousNode] = previous;
          if (Slate.Element.isElement(previousNode) && editor.isVoid(previousNode)) {
            editor.apply({
              type: "remove_node",
              path: nodePath,
              node
            });
            return;
          }
        }
      }
    }
    deleteBackward(unit);
  };
};
exports.overrideDeleteBackward = overrideDeleteBackward;
//# sourceMappingURL=overrideDeleteBackward.cjs.map
