"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addLinkPlaceholder = void 0;
const commands_1 = require("../../../../pm/commands.js");
const LinkSpecs_1 = require("../LinkSpecs/index.js");
const descriptor_1 = require("./descriptor.js");
const addLinkPlaceholder = (deps) => (state, dispatch) => {
    if (!state.selection.empty)
        return false;
    const markType = (0, LinkSpecs_1.linkType)(state.schema);
    if (markType.isInSet(state.selection.$from.marks()))
        return false;
    if (!(0, commands_1.toggleMark)(markType)(state))
        return false;
    dispatch?.((0, descriptor_1.addPlaceholder)(state.tr, deps).scrollIntoView());
    return true;
};
exports.addLinkPlaceholder = addLinkPlaceholder;
//# sourceMappingURL=commands.js.map
