"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: 'yfm-cut' }, [const_1.CutAttr.Markup]: { default: null } },
        content: `${const_1.CutNode.CutTitle} ${const_1.CutNode.CutContent}`,
        group: 'block yfm-cut',
        parseDOM: [
            {
                tag: '.yfm-cut',
                getAttrs: (node) => ({ [const_1.CutAttr.Markup]: node.getAttribute(const_1.CutAttr.Markup) }),
            },
        ],
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        selectable: true,
        allowSelection: true,
        defining: true,
        complex: 'root',
    },
    [const_1.CutNode.CutTitle]: {
        attrs: { class: { default: 'yfm-cut-title' } },
        content: 'inline*',
        group: 'block yfm-cut',
        parseDOM: [{ tag: '.yfm-cut-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: 'yfm-cut-content' } },
        content: '(block | paragraph)+',
        group: 'block yfm-cut',
        parseDOM: [{ tag: '.yfm-cut-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,
        complex: 'leaf',
    },
});
exports.getSchemaSpecs = getSchemaSpecs;
//# sourceMappingURL=schema.js.map
