import ObjectID from 'bson-objectid';
import { DecoratorNode } from 'lexical';
export class ServerInlineBlockNode extends DecoratorNode {
  __fields;
  constructor({
    fields,
    key
  }) {
    super(key);
    this.__fields = fields;
  }
  static clone(node) {
    return new this({
      fields: node.__fields,
      key: node.__key
    });
  }
  static getType() {
    return 'inlineBlock';
  }
  static importDOM() {
    return {};
  }
  static importJSON(serializedNode) {
    const node = $createServerInlineBlockNode(serializedNode.fields);
    return node;
  }
  static isInline() {
    return false;
  }
  canIndent() {
    return true;
  }
  createDOM() {
    const element = document.createElement('span');
    element.classList.add('inline-block-container');
    return element;
  }
  decorate(editor, config) {
    return null;
  }
  exportDOM() {
    const element = document.createElement('span');
    element.classList.add('inline-block-container');
    const text = document.createTextNode(this.getTextContent());
    element.append(text);
    return {
      element
    };
  }
  exportJSON() {
    return {
      type: 'inlineBlock',
      fields: this.getFields(),
      version: 1
    };
  }
  getFields() {
    return this.getLatest().__fields;
  }
  getTextContent() {
    return `Block Field`;
  }
  isInline() {
    return true;
  }
  setFields(fields) {
    const writable = this.getWritable();
    writable.__fields = fields;
  }
  updateDOM() {
    return false;
  }
}
export function $createServerInlineBlockNode(fields) {
  return new ServerInlineBlockNode({
    fields: {
      ...fields,
      id: fields?.id || new ObjectID.default().toHexString()
    }
  });
}
export function $isServerInlineBlockNode(node) {
  return node instanceof ServerInlineBlockNode;
}
//# sourceMappingURL=InlineBlocksNode.js.map