aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
authorsharkiecodes <lanyi_stroud@brown.edu>2025-04-21 19:41:51 -0400
committersharkiecodes <lanyi_stroud@brown.edu>2025-04-21 19:41:51 -0400
commit5290e6a69fdadb6037f3d8a03f5ed82e00927520 (patch)
tree2ab7cb47f242905b14f78653ba74024b9b4b0b5a /src/client/documents/Documents.ts
parent17e24e780b54f2f7015c0ca955c3aa5091bba19c (diff)
attempting to integrate scrapbooks
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index be857da6d..2a2f9d342 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -526,6 +526,16 @@ export class DocumentOptions {
ai_firefly_seed?: number;
ai_firefly_prompt?: string;
+ /**
+ * JSON‐stringified slot configuration for ScrapbookBox
+ */
+ scrapbookConfig?: string;
+
+ /**
+ * The list of embedded Doc instances in each Scrapbook slot
+ */
+ scrapbookContents?: List<Doc>;
+
_outpaintingMetadata?: STRt = new StrInfo('serialized JSON metadata needed for image outpainting', false);
}
@@ -590,6 +600,18 @@ export namespace Docs {
},
],
// AARAV ADD //
+
+ [
+ DocumentType.SCRAPBOOK,
+ {
+ layout: { view: EmptyBox, dataField: 'text' },
+ options: {
+ title: 'Scrapbook',
+ acl_Guest: SharingPermissions.View,
+ },
+
+ },
+ ],
]);
const suffix = 'Proto';
@@ -922,6 +944,26 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.RTF), field, options, undefined, fieldKey);
}
+ export function ScrapbookDocument(
+ items: Doc[] = [],
+ options: DocumentOptions = {},
+ fieldKey: string = 'items'
+ ) {
+ return InstanceFromProto(
+ Prototypes.get(DocumentType.SCRAPBOOK),
+ new List<Doc>(items),
+ {
+ title: options.title
+ ?? new Date().toLocaleDateString(undefined, {
+ year: 'numeric', month: 'short', day: 'numeric'
+ }),
+ ...options,
+ },
+ undefined,
+ fieldKey
+ );
+ }
+
// AARAV ADD //
export function DailyJournalDocument(text: string | RichTextField, options: DocumentOptions = {}, fieldKey: string = 'text') {
@@ -964,6 +1006,8 @@ export namespace Docs {
// AARAV ADD //
+
+
export function LinkDocument(source: Doc, target: Doc, options: DocumentOptions = {}, id?: string) {
const linkDoc = InstanceFromProto(
Prototypes.get(DocumentType.LINK),