diff options
author | bobzel <zzzman@gmail.com> | 2025-03-07 21:16:44 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-03-07 21:16:44 -0500 |
commit | 97f2fd0fe18bf476304af06918de25059d4fd8b5 (patch) | |
tree | a3613d8dd6cba7b4fe996b320853c92b3a338135 /src/client/documents/Documents.ts | |
parent | 54bfa54b498f7a7c5813c2f5d0ff3005d6ff44ab (diff) |
fixes to daily journal creation.
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r-- | src/client/documents/Documents.ts | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 61b370da4..7468b0c00 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -920,22 +920,36 @@ export namespace Docs { // AARAV ADD // export function DailyJournalDocument(text: string | RichTextField, options: DocumentOptions = {}, fieldKey: string = 'text') { - const styles = { - bold: true, // Make the journal date bold - color: 'blue', // Set the journal date color to blue - fontSize: 18, // Set the font size to 18px for the whole text + const getFormattedDate = () => { + const date = new Date().toLocaleDateString(undefined, { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric', + }); + return date; + }; + + const getDailyText = () => { + const placeholderText = 'Start writing here...'; + const dateText = `${getFormattedDate()}`; + + return RichTextField.textToRtfFormat( + [ + { text: 'Journal Entry:', styles: { bold: true, color: 'black', fontSize: 20 } }, + { text: dateText, styles: { italic: true, color: 'gray', fontSize: 15 } }, + { text: placeholderText, styles: { fontSize: 14, color: 'gray' } }, + ], + undefined, + placeholderText.length + ); }; return InstanceFromProto( Prototypes.get(DocumentType.JOURNAL), - typeof text === 'string' ? RichTextField.textToRtf(text, undefined, styles, undefined) : text, + getDailyText(), { - title: new Date().toLocaleDateString(undefined, { - weekday: 'long', - year: 'numeric', - month: 'long', - day: 'numeric', - }), + title: getFormattedDate(), ...options, }, undefined, |