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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user