import { Node } from 'prosemirror-model';
export class ProseMirrorTransformer {
    _transformers;
    constructor(fns) {
        this._transformers = fns;
    }
    transform(doc) {
        const docJSON = doc.toJSON();
        this.transformJSON(docJSON);
        return 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);
            }
        }
    }
}
//# sourceMappingURL=index.js.map
