feat: add models package
This commit is contained in:
41
packages/models/src/Domain/Syncable/Note/NoteMutator.ts
Normal file
41
packages/models/src/Domain/Syncable/Note/NoteMutator.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { AppDataField } from '../../Abstract/Item/Types/AppDataField'
|
||||
import { NoteContent } from './NoteContent'
|
||||
import { DecryptedItemMutator } from '../../Abstract/Item/Mutator/DecryptedItemMutator'
|
||||
|
||||
export class NoteMutator extends DecryptedItemMutator<NoteContent> {
|
||||
set title(title: string) {
|
||||
this.mutableContent.title = title
|
||||
}
|
||||
|
||||
set text(text: string) {
|
||||
this.mutableContent.text = text
|
||||
}
|
||||
|
||||
set hidePreview(hidePreview: boolean) {
|
||||
this.mutableContent.hidePreview = hidePreview
|
||||
}
|
||||
|
||||
set preview_plain(preview_plain: string) {
|
||||
this.mutableContent.preview_plain = preview_plain
|
||||
}
|
||||
|
||||
set preview_html(preview_html: string | undefined) {
|
||||
this.mutableContent.preview_html = preview_html
|
||||
}
|
||||
|
||||
set prefersPlainEditor(prefersPlainEditor: boolean) {
|
||||
this.setAppDataItem(AppDataField.PrefersPlainEditor, prefersPlainEditor)
|
||||
}
|
||||
|
||||
set spellcheck(spellcheck: boolean) {
|
||||
this.mutableContent.spellcheck = spellcheck
|
||||
}
|
||||
|
||||
toggleSpellcheck(): void {
|
||||
if (this.mutableContent.spellcheck == undefined) {
|
||||
this.mutableContent.spellcheck = false
|
||||
} else {
|
||||
this.mutableContent.spellcheck = !this.mutableContent.spellcheck
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user