refactor: note editor relationships (#1821)
This commit is contained in:
29
packages/snjs/lib/Spec/SpecUtils.ts
Normal file
29
packages/snjs/lib/Spec/SpecUtils.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import * as Models from '@standardnotes/models'
|
||||
|
||||
export const createNote = (payload?: Partial<Models.NoteContent>): Models.SNNote => {
|
||||
return new Models.SNNote(
|
||||
new Models.DecryptedPayload(
|
||||
{
|
||||
uuid: String(Math.random()),
|
||||
content_type: ContentType.Note,
|
||||
content: Models.FillItemContent({ ...payload }),
|
||||
...Models.PayloadTimestampDefaults(),
|
||||
},
|
||||
Models.PayloadSource.Constructor,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
export const createNoteWithTitle = (title: string) => {
|
||||
return new Models.SNNote(
|
||||
new Models.DecryptedPayload({
|
||||
uuid: String(Math.random()),
|
||||
content_type: ContentType.Note,
|
||||
content: Models.FillItemContent<Models.NoteContent>({
|
||||
title: title,
|
||||
}),
|
||||
...Models.PayloadTimestampDefaults(),
|
||||
}),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user