import { mergeAttributes, Node } from '../../externals.js';
export const Figure = Node.create({
    name: 'figure',
    group: 'block',
    content: 'block+',
    draggable: true,
    selectable: true,
    isolating: true,
    atom: true,
    addAttributes() {
        return {
            figcaption: {
                default: '',
            },
        };
    },
    addOptions() {
        return {
            HTMLAttributes: {},
        };
    },
    parseHTML() {
        return [
            {
                tag: this.name,
                getAttrs: (dom) => {
                    const figcaption = dom.querySelector('figcaption');
                    return {
                        figcaption: figcaption?.textContent || '',
                    };
                },
            },
        ];
    },
    renderHTML({ HTMLAttributes }) {
        return [this.name, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
    },
});
