"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.liftListItem = exports.sinkListItem = exports.toOrderedList = exports.toBulletList = void 0;
const helpers_1 = require("./helpers.js");
exports.toBulletList = (0, helpers_1.wrapPerLine)({ beforeText: '- ' });
exports.toOrderedList = (0, helpers_1.wrapPerLine)({ beforeText: '1. ' });
exports.sinkListItem = (0, helpers_1.wrapPerLine)({ beforeText: '  ', skipEmptyLine: false });
const liftListItem = ({ state, dispatch }) => {
    const tr = state.changeByRange((range) => {
        const changeSpec = [];
        (0, helpers_1.iterateOverRangeLines)(state.doc, range, (line) => {
            if (line.text.startsWith('  '))
                changeSpec.push({ from: line.from, to: line.from + 2, insert: '' });
            else if (line.text.startsWith(' '))
                changeSpec.push({ from: line.from, to: line.from + 1, insert: '' });
        });
        const changes = state.changes(changeSpec);
        return { changes, range: range.map(changes) };
    });
    dispatch(state.update(tr));
    return true;
};
exports.liftListItem = liftListItem;
//# sourceMappingURL=lists.js.map
