"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProseMirrorTransformer = void 0;
const prosemirror_model_1 = require("prosemirror-model");
class ProseMirrorTransformer {
    _transformers;
    constructor(fns) {
        this._transformers = fns;
    }
    transform(doc) {
        const docJSON = doc.toJSON();
        this.transformJSON(docJSON);
        return prosemirror_model_1.Node.fromJSON(doc.type.schema, docJSON);
    }
    transformJSON(node) {
        for (const fn of this._transformers) {
            fn(node);
        }
        if (node.content) {
            for (const child of node.content) {
                this.transformJSON(child);
            }
        }
    }
}
exports.ProseMirrorTransformer = ProseMirrorTransformer;
//# sourceMappingURL=index.js.map
