chore: update Angular cache and TypeScript build info files
This commit is contained in:
@@ -266,6 +266,31 @@ export class BookmarksService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all bookmarks with a specific path (useful for file bookmarks)
|
||||
*/
|
||||
removePathEverywhere(path: string): void {
|
||||
const doc = this._doc();
|
||||
|
||||
const removeByPath = (items: BookmarkNode[]): BookmarkNode[] => {
|
||||
return items.filter(item => {
|
||||
if (item.type === 'file' && item.path === path) {
|
||||
return false; // Remove this item
|
||||
}
|
||||
if (item.type === 'group') {
|
||||
// Recursively filter children
|
||||
item.items = removeByPath(item.items);
|
||||
return true; // Keep the group
|
||||
}
|
||||
return true; // Keep other items
|
||||
});
|
||||
};
|
||||
|
||||
const updated = { ...doc, items: removeByPath([...doc.items]) };
|
||||
this._doc.set(updated);
|
||||
this._isDirty.set(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a bookmark
|
||||
*/
|
||||
|
||||
@@ -265,12 +265,23 @@ export function moveNode(
|
||||
|
||||
// Can't move a node into itself or its descendants
|
||||
if (newParentCtime !== null && isDescendant(found.node, newParentCtime)) {
|
||||
console.warn('Cannot move a node into its own descendant');
|
||||
return doc;
|
||||
}
|
||||
|
||||
const nodeClone = cloneNode(found.node);
|
||||
const oldParentCtime = found.parent ? found.parent.ctime : null;
|
||||
const oldIndex = found.index;
|
||||
|
||||
// If moving within the same parent, adjust index
|
||||
let adjustedIndex = newIndex;
|
||||
if (oldParentCtime === newParentCtime && oldIndex < newIndex) {
|
||||
// When removing from earlier position, indices shift down
|
||||
adjustedIndex = newIndex - 1;
|
||||
}
|
||||
|
||||
let updated = removeNode(doc, nodeCtime);
|
||||
updated = addNode(updated, nodeClone, newParentCtime, newIndex);
|
||||
updated = addNode(updated, nodeClone, newParentCtime, adjustedIndex);
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CdkDropList } from '@angular/cdk/drag-drop';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class DropListRegistryService {
|
||||
private lists = new Map<string, CdkDropList<any>>();
|
||||
private updates$ = new BehaviorSubject<void>(undefined);
|
||||
|
||||
get changes() {
|
||||
return this.updates$.asObservable();
|
||||
}
|
||||
|
||||
register(id: string, list: CdkDropList<any>): void {
|
||||
this.lists.set(id, list);
|
||||
this.updates$.next();
|
||||
}
|
||||
|
||||
unregister(id: string): void {
|
||||
if (this.lists.delete(id)) {
|
||||
this.updates$.next();
|
||||
}
|
||||
}
|
||||
|
||||
get(id: string): CdkDropList<any> | undefined {
|
||||
return this.lists.get(id);
|
||||
}
|
||||
|
||||
listExcept(id: string): CdkDropList<any>[] {
|
||||
return Array.from(this.lists.entries())
|
||||
.filter(([key]) => key !== id)
|
||||
.map(([, val]) => val);
|
||||
}
|
||||
|
||||
listAll(): CdkDropList<any>[] {
|
||||
return Array.from(this.lists.values());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user