mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-03 21:02:40 +02:00
feat(mentions): add sidebar mention event atom and enhance document mention handling in the editor
This commit is contained in:
parent
f607636ba6
commit
960f761c6c
4 changed files with 227 additions and 27 deletions
|
|
@ -11,12 +11,24 @@ export const mentionedDocumentsAtom = atom<Pick<Document, "id" | "title" | "docu
|
|||
|
||||
/**
|
||||
* Atom to store documents selected via the sidebar checkboxes / row clicks.
|
||||
* These are NOT inserted as chips – the composer shows a count badge instead.
|
||||
* These power the selected-sources badge and backend doc filters.
|
||||
*/
|
||||
export const sidebarSelectedDocumentsAtom = atom<
|
||||
Pick<Document, "id" | "title" | "document_type">[]
|
||||
>([]);
|
||||
|
||||
export interface SidebarMentionEvent {
|
||||
kind: "add" | "remove";
|
||||
docs: Pick<Document, "id" | "title" | "document_type">[];
|
||||
nonce: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event atom used to tell the composer that documents were selected/unselected
|
||||
* from sidebar checkboxes, so chips can be inserted/removed in-editor.
|
||||
*/
|
||||
export const sidebarMentionEventAtom = atom<SidebarMentionEvent | null>(null);
|
||||
|
||||
/**
|
||||
* Derived read-only atom that merges @-mention chips and sidebar selections
|
||||
* into a single deduplicated set of document IDs for the backend.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue