Drag & drop tab reordering

Tabs are draggable within the strip: HTML5 DnD with the WebKit setData quirk
handled, an inset primary insertion line at the drop position (no layout
shift), and the dragged tab dimmed. Reordering only touches the workspaces
array order; ids, sessions, and the active tab are unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jokin
2026-07-11 17:33:52 +02:00
co-authored by Claude Fable 5
parent c95087c079
commit 3e33bac426
2 changed files with 68 additions and 1 deletions
+12
View File
@@ -274,6 +274,18 @@ export class PanelsService {
}
}
/** Reorder a tab (drag & drop). Order is purely visual; ids stay stable. */
moveWorkspace(id: number, toIndex: number): void {
this.workspaces.update((list) => {
const fromIndex = list.findIndex((w) => w.id === id);
if (fromIndex < 0) return list;
const next = [...list];
const [moved] = next.splice(fromIndex, 1);
next.splice(Math.max(0, Math.min(next.length, toIndex)), 0, moved);
return next;
});
}
cycleWorkspace(delta: 1 | -1): void {
const list = this.workspaces();
if (list.length < 2) return;