aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes')
-rw-r--r--src/client/views/nodes/scrapbook/ScrapbookBox.tsx12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/client/views/nodes/scrapbook/ScrapbookBox.tsx b/src/client/views/nodes/scrapbook/ScrapbookBox.tsx
index 2db76c76f..ff757af88 100644
--- a/src/client/views/nodes/scrapbook/ScrapbookBox.tsx
+++ b/src/client/views/nodes/scrapbook/ScrapbookBox.tsx
@@ -23,6 +23,7 @@ import './ScrapbookBox.scss';
import { ScrapbookItemConfig } from './ScrapbookPreset';
import { createPreset, getPresetNames } from './ScrapbookPresetRegistry';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { DocUtils } from '../../../documents/DocUtils';
function createPlaceholder(cfg: ScrapbookItemConfig, doc: Doc) {
const placeholder = new Doc();
@@ -207,25 +208,18 @@ export class ScrapbookBox extends ViewBoxAnnotatableComponent<FieldViewProps>()
rejectDrop = (de: DragManager.DropEvent, subView?: DocumentView) => false; // allow all Docs to be dropped onto scrapbook -- let filterAddDocument make the final decision.
/**
- * iterate through all items and their children and return a flat list of leaf placeholder content Docs
- * @param items
- * @returns list of placeholder content Docs
- */
- unwrapPlaceholders = (items: Doc[]): Doc[] => items.flatMap(d => (d.$type === DocumentType.COL ? this.unwrapPlaceholders(DocListCast(d[Doc.LayoutDataKey(d)])) : [d]));
-
- /**
* Filter function to determine if a document can be added to the scrapbook.
* This checks if the document matches any of the placeholder slots in the scrapbook.
* @param docs - The document(s) being added to the scrapbook.
* @returns true if the document can be added, false otherwise.
*/
filterAddDocument = (docs: Doc | Doc[]) => {
- toList(docs).forEach(doc => slotRealDocIntoPlaceholders(doc, this.unwrapPlaceholders(this.ScrapbookLayoutDocs)));
+ toList(docs).forEach(doc => slotRealDocIntoPlaceholders(doc, DocUtils.unwrapPlaceholders(this.ScrapbookLayoutDocs)));
return false;
};
@computed get regenPrompt() {
- const allDocs = this.unwrapPlaceholders(this.ScrapbookLayoutDocs); // find all non-collections in scrapbook (e.g., placeholder content docs)
+ const allDocs = DocUtils.unwrapPlaceholders(this.ScrapbookLayoutDocs); // find all non-collections in scrapbook (e.g., placeholder content docs)
const internalTagsSet = new Set<string>(allDocs.flatMap(doc => StrListCast(doc.$tags_chat).filter(tag => !tag.startsWith?.('ASPECT_'))));
const internalTags = Array.from(internalTagsSet).join(', ');