import { get$Cursor } from "../../../../utils/selection.js";
import { YfmHeadingAttr } from "../const.js";
import { isFoldingHeading } from "../utils.js";
export const removeFoldingIfCursorAtStartOfHeading = (state, dispatch) => {
    const $cursor = get$Cursor(state.selection);
    if (!$cursor)
        return false;
    if ($cursor.parentOffset === 0 && isFoldingHeading($cursor.parent)) {
        dispatch?.(state.tr.setNodeAttribute($cursor.before(), YfmHeadingAttr.Folding, null));
        return true;
    }
    return false;
};
//# sourceMappingURL=removeFoldingIfCursorAtStartOfHeading.js.map
