aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-06 16:13:25 -0500
committerbobzel <zzzman@gmail.com>2025-03-06 16:13:25 -0500
commit9c2a7c14fd9d0e44609aab30c6323583162009db (patch)
tree1d4a21925d15571724b21505cc616c9a1627fc9e /src
parent980d7d9f747b1ee0ca0ad86df18f98684de5b193 (diff)
fixed inital text in dayJournal
Diffstat (limited to 'src')
-rw-r--r--src/client/documents/Documents.ts44
1 files changed, 14 insertions, 30 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index ce8c8a6b7..873eb3f20 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -19,7 +19,6 @@ import { DocServer } from '../DocServer';
import { dropActionType } from '../util/DropActionTypes';
import { CollectionViewType, DocumentType } from './DocumentTypes';
import { Id } from '../../fields/FieldSymbols';
-import { DailyJournal } from '../views/nodes/formattedText/DailyJournal';
class EmptyBox {
public static LayoutString() {
@@ -917,36 +916,21 @@ export namespace Docs {
// AARAV ADD //
export function DailyJournalDocument(text: string | RichTextField, options: DocumentOptions = {}, fieldKey: string = 'text') {
- const rtf = {
- doc: {
- type: 'doc',
- content: [
- {
- type: 'paragraph',
- content: [
- {
- type: 'text',
- text,
- },
- ],
- },
- ],
+ return InstanceFromProto(
+ Prototypes.get(DocumentType.JOURNAL),
+ typeof text === 'string' ? RichTextField.textToRtf(text) : text,
+ {
+ title: new Date().toLocaleDateString(undefined, {
+ weekday: 'long',
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric',
+ }),
+ ...options,
},
- selection: { type: 'text', anchor: 1, head: 1 },
- storedMarks: [],
- Text: text,
- };
- const field = text instanceof RichTextField ? text : text ? new RichTextField(JSON.stringify(rtf), text) : options.text instanceof RichTextField ? options.text : undefined;
-
- return InstanceFromProto(Prototypes.get(DocumentType.JOURNAL), field, {
- title: new Date().toLocaleDateString(undefined, {
- weekday: 'long',
- year: 'numeric',
- month: 'long',
- day: 'numeric',
- }),
- ...options,
- });
+ undefined,
+ fieldKey
+ );
}
// AARAV ADD //