"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSchemaSpecs = void 0;
const const_1 = require("./const.js");
const DEFAULT_PLACEHOLDERS = {
    Title: 'Cut title',
    Content: 'Cut content',
};
const getSchemaSpecs = (opts, placeholder) => ({
    [const_1.CutNode.Cut]: {
        attrs: { class: { default: const_1.YfmCutClassName.Cut }, [const_1.CutAttr.Markup]: { default: null } },
        content: `${const_1.CutNode.CutTitle} ${const_1.CutNode.CutContent}`,
        group: 'block yfm-cut',
        parseDOM: [
            {
                tag: `.${const_1.YfmCutClassName.Cut}`,
                getAttrs: (node) => ({ [const_1.CutAttr.Markup]: node.getAttribute(const_1.CutAttr.Markup) }),
            },
        ],
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        selectable: true,
        allowSelection: true,
        selectAll: 'node',
        defining: true,
        complex: 'root',
    },
    [const_1.CutNode.CutTitle]: {
        attrs: {
            [const_1.CutAttr.Class]: { default: const_1.YfmCutClassName.Title },
            [const_1.CutAttr.Line]: { default: null },
        },
        content: 'inline*',
        group: 'block yfm-cut',
        parseDOM: [{ tag: `.${const_1.YfmCutClassName.Title}` }],
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        placeholder: {
            content: placeholder?.[const_1.CutNode.CutTitle] ??
                opts?.yfmCutTitlePlaceholder ??
                DEFAULT_PLACEHOLDERS.Title,
            alwaysVisible: true,
        },
        definingAsContext: true,
        selectable: false,
        allowSelection: false,
        complex: 'leaf',
    },
    [const_1.CutNode.CutContent]: {
        attrs: { class: { default: const_1.YfmCutClassName.Content } },
        content: '(block | paragraph)+',
        group: 'block yfm-cut',
        parseDOM: [{ tag: `.${const_1.YfmCutClassName.Content}` }],
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        placeholder: {
            content: placeholder?.[const_1.CutNode.CutContent] ??
                opts?.yfmCutContentPlaceholder ??
                DEFAULT_PLACEHOLDERS.Content,
            alwaysVisible: true,
        },
        definingAsContext: true,
        selectable: false,
        allowSelection: false,
        selectAll: 'content',
        complex: 'leaf',
    },
});
exports.getSchemaSpecs = getSchemaSpecs;
//# sourceMappingURL=schema.js.map
