"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tableCellContextPlugin = void 0;
const prosemirror_state_1 = require("prosemirror-state");
const core_1 = require("../../../../../core/index.js");
const yfm_table_1 = require("../../../../../i18n/yfm-table/index.js");
const convert_table_1 = require("../../../../yfm/YfmTable/commands/convert-table.js");
const TableSpecs_1 = require("../../TableSpecs/index.js");
const innerActions_1 = require("../../actions/innerActions.js");
const tableActions_1 = require("../../actions/tableActions.js");
const view_1 = require("./view.js");
const tableCellContextPlugin = () => new prosemirror_state_1.Plugin({
    view(view) {
        const { schema } = view.state;
        const actions = (0, core_1.bindActions)({
            ...innerActions_1.innerActions,
            deleteTable: tableActions_1.deleteTableAction,
            convert: {
                isEnable: convert_table_1.convertToYfmTable,
                run: convert_table_1.convertToYfmTable,
            },
        })(view);
        return new view_1.TableCellContextView(view, [
            [
                {
                    action: actions.setCellLeftAlign,
                    text: (0, yfm_table_1.i18n)('table.menu.cell.align.left'),
                },
                {
                    action: actions.setCellCenterAlign,
                    text: (0, yfm_table_1.i18n)('table.menu.cell.align.center'),
                },
                {
                    action: actions.setCellRightAlign,
                    text: (0, yfm_table_1.i18n)('table.menu.cell.align.right'),
                },
            ],
            [
                { action: actions.addRow, text: (0, yfm_table_1.i18n)('table.menu.row.add') },
                { action: actions.deleteRow, text: (0, yfm_table_1.i18n)('table.menu.row.remove') },
                { action: actions.addColumn, text: (0, yfm_table_1.i18n)('table.menu.column.add') },
                { action: actions.deleteColumn, text: (0, yfm_table_1.i18n)('table.menu.column.remove') },
            ],
            { action: actions.convert, text: (0, yfm_table_1.i18n)('table.menu.convert.yfm') },
            { action: actions.deleteTable, text: (0, yfm_table_1.i18n)('table.menu.table.remove') },
        ], [schema.nodes[TableSpecs_1.TableNode.HeaderCell], schema.nodes[TableSpecs_1.TableNode.DataCell]]);
    },
});
exports.tableCellContextPlugin = tableCellContextPlugin;
//# sourceMappingURL=index.js.map
