import { jsx as _jsx } from "react/jsx-runtime";
import { fileBlockConfig, fileParse } from "@endexai/blocknote-core";
import { createReactBlockSpec, } from "../../schema/ReactBlockSpec.js";
import { FileBlockWrapper } from "./helpers/render/FileBlockWrapper.js";
import { LinkWithCaption } from "./helpers/toExternalHTML/LinkWithCaption.js";
export const FileToExternalHTML = (props) => {
    if (!props.block.props.url) {
        return _jsx("p", { children: "Add file" });
    }
    const link = (_jsx("a", { href: props.block.props.url, children: props.block.props.name || props.block.props.url }));
    if (props.block.props.caption) {
        return (_jsx(LinkWithCaption, { caption: props.block.props.caption, children: link }));
    }
    return link;
};
export const FileBlock = (props) => {
    return _jsx(FileBlockWrapper, { ...props });
};
export const ReactFileBlock = createReactBlockSpec(fileBlockConfig, {
    render: FileBlock,
    parse: fileParse,
    toExternalHTML: FileToExternalHTML,
});
//# sourceMappingURL=FileBlockContent.js.map