From 9d4bfd04760753b6fdd7ed81372ab8d85b615bc3 Mon Sep 17 00:00:00 2001 From: aaravkumar Date: Fri, 7 Mar 2025 12:55:31 -0500 Subject: added more individual text formatting features + journal like background --- .../views/nodes/formattedText/DailyJournal.tsx | 40 ++++++++++++++-------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'src/client/views/nodes/formattedText') diff --git a/src/client/views/nodes/formattedText/DailyJournal.tsx b/src/client/views/nodes/formattedText/DailyJournal.tsx index ec1f7a023..c8f049ecf 100644 --- a/src/client/views/nodes/formattedText/DailyJournal.tsx +++ b/src/client/views/nodes/formattedText/DailyJournal.tsx @@ -50,24 +50,19 @@ export class DailyJournal extends ViewBoxAnnotatableComponent() @action setDailyText() { - console.log('setDailyText() called...'); const placeholderText = 'Start writing here...'; - const initialText = `Journal Entry - ${this.journalDate}\n${placeholderText}`; + const dateText = `${this.journalDate}\n`; console.log('Checking if dataDoc has text field...'); - 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 - }; - - console.log('Setting new text field with:', initialText); - this.dataDoc[this.fieldKey] = RichTextField.textToRtf( - initialText, - undefined, // No image DocId - styles, // Pass the styles object here - placeholderText.length // The position for text selection + this.dataDoc[this.fieldKey] = 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 - 2 ); console.log('Current text field:', this.dataDoc[this.fieldKey]); @@ -83,7 +78,22 @@ export class DailyJournal extends ViewBoxAnnotatableComponent() render() { return ( -
+
); -- cgit v1.2.3-70-g09d2