import { DOMParser } from "prosemirror-model";
export const createHtmlInserter = (view, contentConverter, startPos, dispatchTransaction) => {
    const schema = view.state.schema;
    return async (input) => {
        const container = document.createElement('span');
        container.innerHTML = await contentConverter.parseAsHTML(input, schema);
        const fragment = DOMParser.fromSchema(schema).parse(container).content;
        dispatchTransaction(view, startPos, fragment);
    };
};
