import { toggleMark } from "../../../../pm/commands.js";
import { linkType } from "../LinkSpecs/index.js";
import { addPlaceholder } from "./descriptor.js";
export const addLinkPlaceholder = (deps) => (state, dispatch) => {
    if (!state.selection.empty)
        return false;
    const markType = linkType(state.schema);
    if (markType.isInSet(state.selection.$from.marks()))
        return false;
    if (!toggleMark(markType)(state))
        return false;
    dispatch?.(addPlaceholder(state.tr, deps).scrollIntoView());
    return true;
};
//# sourceMappingURL=commands.js.map
