"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.$isEmbedNode = exports.$createEmbedNode = exports.EmbedNode = void 0;
const react_1 = __importDefault(require("react"));
const LexicalDecoratorBlockNode_1 = require("@lexical/react/LexicalDecoratorBlockNode");
const EmbedComponent_1 = require("../components/EmbedComponent");
class EmbedNode extends LexicalDecoratorBlockNode_1.DecoratorBlockNode {
    constructor(html, format, key) {
        super(format, key);
        this.__html = html;
    }
    static getType() {
        return 'embed';
    }
    static clone(node) {
        return new EmbedNode(node.__html, node.__format, node.__key);
    }
    createDOM() {
        return document.createElement('div');
    }
    updateDOM() {
        return false;
    }
    decorate() {
        return react_1.default.createElement(EmbedComponent_1.EmbedComponent, { html: this.__html, nodeKey: this.__key });
    }
    static importJSON(serializedNode) {
        return $createEmbedNode(serializedNode);
    }
    exportJSON() {
        return {
            ...super.exportJSON(),
            type: 'embed',
            version: 1,
            html: this.__html,
        };
    }
}
exports.EmbedNode = EmbedNode;
function $createEmbedNode({ html }) {
    return new EmbedNode(html);
}
exports.$createEmbedNode = $createEmbedNode;
function $isEmbedNode(node) {
    return node instanceof EmbedNode;
}
exports.$isEmbedNode = $isEmbedNode;
//# sourceMappingURL=EmbedNode.js.map