fix(sql): preserve file associations and list selection

This commit is contained in:
zipg authored and GitHub committed 2026-08-13 11:44:55 +08:00
1 parent 2e27f7a66a
commit e5a3917f7d
25 files changed
+558 -186

No files matched your search

@@ -0,0 +1,19 @@
export type OrderedListSelectionIntent = "range" | "toggle" | "single";
export interface OrderedListSelectionItem {
type: string;
id: string;
}
export function orderedListSelectionIntent(event: Pick<MouseEvent, "shiftKey" | "metaKey" | "ctrlKey">): OrderedListSelectionIntent {
if (event.shiftKey) return "range";
if (event.metaKey || event.ctrlKey) return "toggle";
return "single";
}
export function orderedListRangeAnchorIndex(items: OrderedListSelectionItem[], anchorIndex: number | null, activeItem: OrderedListSelectionItem | null): number | null {
if (anchorIndex !== null && anchorIndex >= 0 && anchorIndex < items.length) return anchorIndex;
if (!activeItem) return null;
const index = items.findIndex((item) => item.type === activeItem.type && item.id === activeItem.id);
return index >= 0 ? index : null;
}