aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 //