"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSchemaSpecs = void 0;
const const_1 = require("./const.js");
const DEFAULT_TITLE_PLACEHOLDER = 'Note';
const DEFAULT_CONTENT_PLACEHOLDER = 'Note content';
const getSchemaSpecs = (opts, placeholder) => ({
    [const_1.NoteNode.Note]: {
        attrs: {
            [const_1.NoteAttrs.Class]: { default: 'yfm-note yfm-accent-info' },
            [const_1.NoteAttrs.Type]: { default: 'info' },
        },
        content: `${const_1.NoteNode.NoteTitle} ${const_1.NoteNode.NoteContent}`,
        group: 'block yfm-note',
        parseDOM: [
            {
                tag: 'div.yfm-note',
                priority: 100,
                getAttrs: (node) => ({
                    [const_1.NoteAttrs.Class]: node.getAttribute(const_1.NoteAttrs.Class) || '',
                    [const_1.NoteAttrs.Type]: node.getAttribute(const_1.NoteAttrs.Type) || 'info',
                }),
            },
        ],
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        selectable: true,
        allowSelection: true,
        complex: 'root',
    },
    [const_1.NoteNode.NoteTitle]: {
        content: 'inline*',
        group: 'block yfm-note',
        parseDOM: [
            {
                tag: 'p.yfm-note-title',
                priority: 100,
            },
        ],
        toDOM() {
            return ['p', { class: 'yfm-note-title' }, 0];
        },
        selectable: false,
        allowSelection: false,
        placeholder: {
            content: placeholder?.[const_1.NoteNode.NoteTitle] ??
                opts?.yfmNoteTitlePlaceholder ??
                DEFAULT_TITLE_PLACEHOLDER,
            alwaysVisible: true,
        },
        complex: 'leaf',
    },
    [const_1.NoteNode.NoteContent]: {
        content: '(block | paragraph)+',
        group: 'block yfm-note',
        parseDOM: [
            {
                tag: 'div.yfm-note-content',
                priority: 100,
            },
        ],
        toDOM() {
            return ['div', { class: 'yfm-note-content' }, 0];
        },
        selectable: false,
        allowSelection: false,
        placeholder: {
            content: placeholder?.[const_1.NoteNode.NoteContent] ?? DEFAULT_CONTENT_PLACEHOLDER,
            alwaysVisible: true,
        },
        complex: 'leaf',
    },
});
exports.getSchemaSpecs = getSchemaSpecs;
//# sourceMappingURL=schema.js.map
