chore: prettier files

This commit is contained in:
Mo
2022-05-03 10:51:40 -05:00
parent f5a90060ea
commit 43d94fbcbf
127 changed files with 1365 additions and 2428 deletions

View File

@@ -208,14 +208,9 @@ export class AppState {
const selectedTag = this.selectedTag
const activeRegularTagUuid =
selectedTag && selectedTag instanceof SNTag ? selectedTag.uuid : undefined
const activeRegularTagUuid = selectedTag && selectedTag instanceof SNTag ? selectedTag.uuid : undefined
await this.application.noteControllerGroup.createNoteView(
undefined,
title,
activeRegularTagUuid,
)
await this.application.noteControllerGroup.createNoteView(undefined, title, activeRegularTagUuid)
}
getActiveNoteController() {
@@ -304,9 +299,7 @@ export class AppState {
}
}
const changedOrInserted = [...changed, ...inserted].filter(
(i) => i.content_type === ContentType.Note,
)
const changedOrInserted = [...changed, ...inserted].filter((i) => i.content_type === ContentType.Note)
const selectedTag = this.tags.selected

View File

@@ -5,9 +5,7 @@ import { runInAction, makeObservable, observable, action } from 'mobx'
export class NoAccountWarningState {
show: boolean
constructor(application: SNApplication, appObservers: (() => void)[]) {
this.show = application.hasAccount()
? false
: storage.get(StorageKey.ShowNoAccountWarning) ?? true
this.show = application.hasAccount() ? false : storage.get(StorageKey.ShowNoAccountWarning) ?? true
appObservers.push(
application.addEventObserver(async () => {

View File

@@ -1,12 +1,5 @@
import { ElementIds } from '@/ElementIDs'
import {
ApplicationEvent,
ContentType,
PrefKey,
SNNote,
SNTag,
UuidString,
} from '@standardnotes/snjs'
import { ApplicationEvent, ContentType, PrefKey, SNNote, SNTag, UuidString } from '@standardnotes/snjs'
import { action, computed, makeObservable, observable } from 'mobx'
import { WebApplication } from '../Application'
import { AppState } from './AppState'
@@ -22,11 +15,7 @@ export class NoteTagsState {
tagsContainerMaxWidth: number | 'auto' = 0
addNoteToParentFolders: boolean
constructor(
private application: WebApplication,
private appState: AppState,
appEventListeners: (() => void)[],
) {
constructor(private application: WebApplication, private appState: AppState, appEventListeners: (() => void)[]) {
makeObservable(this, {
autocompleteInputFocused: observable,
autocompleteSearchQuery: observable,
@@ -56,10 +45,7 @@ export class NoteTagsState {
this.reloadTags()
}),
application.addSingleEventObserver(ApplicationEvent.PreferencesChanged, async () => {
this.addNoteToParentFolders = application.getPreference(
PrefKey.NoteAddToParentFolders,
true,
)
this.addNoteToParentFolders = application.getPreference(PrefKey.NoteAddToParentFolders, true)
}),
)
}
@@ -71,9 +57,7 @@ export class NoteTagsState {
get autocompleteTagHintVisible(): boolean {
return (
this.autocompleteSearchQuery !== '' &&
!this.autocompleteTagResults.some(
(tagResult) => tagResult.title === this.autocompleteSearchQuery,
)
!this.autocompleteTagResults.some((tagResult) => tagResult.title === this.autocompleteSearchQuery)
)
}
@@ -146,20 +130,14 @@ export class NoteTagsState {
focusPreviousTagResult(tagResult: SNTag): void {
const previousTagResultIndex = this.getTagIndex(tagResult, this.autocompleteTagResults) - 1
if (
previousTagResultIndex > -1 &&
this.autocompleteTagResults.length > previousTagResultIndex
) {
if (previousTagResultIndex > -1 && this.autocompleteTagResults.length > previousTagResultIndex) {
const previousTagResult = this.autocompleteTagResults[previousTagResultIndex]
this.setFocusedTagResultUuid(previousTagResult.uuid)
}
}
searchActiveNoteAutocompleteTags(): void {
const newResults = this.application.items.searchTags(
this.autocompleteSearchQuery,
this.activeNote,
)
const newResults = this.application.items.searchTags(this.autocompleteSearchQuery, this.activeNote)
this.setAutocompleteTagResults(newResults)
}

View File

@@ -85,9 +85,7 @@ export class NotesState {
private async selectNotesRange(selectedNote: SNNote): Promise<void> {
const notes = this.application.items.getDisplayableNotes()
const lastSelectedNoteIndex = notes.findIndex(
(note) => note.uuid == this.lastSelectedNote?.uuid,
)
const lastSelectedNoteIndex = notes.findIndex((note) => note.uuid == this.lastSelectedNote?.uuid)
const selectedNoteIndex = notes.findIndex((note) => note.uuid == selectedNote.uuid)
let notesToSelect = []
@@ -351,9 +349,7 @@ export class NotesState {
}
getSpellcheckStateForNote(note: SNNote) {
return note.spellcheck != undefined
? note.spellcheck
: this.appState.isGlobalSpellcheckEnabled()
return note.spellcheck != undefined ? note.spellcheck : this.appState.isGlobalSpellcheckEnabled()
}
async toggleGlobalSpellcheckForNote(note: SNNote) {
@@ -395,9 +391,7 @@ export class NotesState {
isTagInSelectedNotes(tag: SNTag): boolean {
const selectedNotes = Object.values(this.selectedNotes)
return selectedNotes.every((note) =>
this.appState.getNoteTags(note).find((noteTag) => noteTag.uuid === tag.uuid),
)
return selectedNotes.every((note) => this.appState.getNoteTags(note).find((noteTag) => noteTag.uuid === tag.uuid))
}
setShowProtectedWarning(show: boolean): void {

View File

@@ -59,11 +59,7 @@ export class NotesViewState {
hideEditorIcon: false,
}
constructor(
private application: WebApplication,
private appState: AppState,
appObservers: (() => void)[],
) {
constructor(private application: WebApplication, private appState: AppState, appObservers: (() => void)[]) {
this.resetPagination()
appObservers.push(
@@ -78,11 +74,7 @@ export class NotesViewState {
this.appState.selectedTag instanceof SmartView &&
this.appState.selectedTag?.uuid === SystemViewId.TrashedNotes
if (
activeNote.trashed &&
!browsingTrashedNotes &&
!this.appState?.searchOptions.includeTrashed
) {
if (activeNote.trashed && !browsingTrashedNotes && !this.appState?.searchOptions.includeTrashed) {
this.selectNextOrCreateNew()
} else if (!this.selectedNotes[activeNote.uuid]) {
this.selectNote(activeNote).catch(console.error)
@@ -99,10 +91,7 @@ export class NotesViewState {
this.reloadNotesDisplayOptions()
this.reloadNotes()
if (
this.appState.selectedTag &&
findInArray(tags, 'uuid', this.appState.selectedTag.uuid)
) {
if (this.appState.selectedTag && findInArray(tags, 'uuid', this.appState.selectedTag.uuid)) {
/** Tag title could have changed */
this.reloadPanelTitle()
}
@@ -271,33 +260,15 @@ export class NotesViewState {
sortBy = CollectionSort.UpdatedAt
}
freshDisplayOptions.sortBy = sortBy
freshDisplayOptions.sortReverse = this.application.getPreference(
PrefKey.SortNotesReverse,
false,
)
freshDisplayOptions.showArchived = this.application.getPreference(
PrefKey.NotesShowArchived,
false,
)
freshDisplayOptions.showTrashed = this.application.getPreference(
PrefKey.NotesShowTrashed,
false,
) as boolean
freshDisplayOptions.sortReverse = this.application.getPreference(PrefKey.SortNotesReverse, false)
freshDisplayOptions.showArchived = this.application.getPreference(PrefKey.NotesShowArchived, false)
freshDisplayOptions.showTrashed = this.application.getPreference(PrefKey.NotesShowTrashed, false) as boolean
freshDisplayOptions.hidePinned = this.application.getPreference(PrefKey.NotesHidePinned, false)
freshDisplayOptions.hideProtected = this.application.getPreference(
PrefKey.NotesHideProtected,
false,
)
freshDisplayOptions.hideNotePreview = this.application.getPreference(
PrefKey.NotesHideNotePreview,
false,
)
freshDisplayOptions.hideProtected = this.application.getPreference(PrefKey.NotesHideProtected, false)
freshDisplayOptions.hideNotePreview = this.application.getPreference(PrefKey.NotesHideNotePreview, false)
freshDisplayOptions.hideDate = this.application.getPreference(PrefKey.NotesHideDate, false)
freshDisplayOptions.hideTags = this.application.getPreference(PrefKey.NotesHideTags, true)
freshDisplayOptions.hideEditorIcon = this.application.getPreference(
PrefKey.NotesHideEditorIcon,
false,
)
freshDisplayOptions.hideEditorIcon = this.application.getPreference(PrefKey.NotesHideEditorIcon, false)
const displayOptionsChanged =
freshDisplayOptions.sortBy !== this.displayOptions.sortBy ||
freshDisplayOptions.sortReverse !== this.displayOptions.sortReverse ||
@@ -339,11 +310,7 @@ export class NotesViewState {
createPlaceholderNote = () => {
const selectedTag = this.appState.selectedTag
if (
selectedTag &&
selectedTag instanceof SmartView &&
selectedTag.uuid !== SystemViewId.AllNotes
) {
if (selectedTag && selectedTag instanceof SmartView && selectedTag.uuid !== SystemViewId.AllNotes) {
return
}
return this.createNewNote()
@@ -405,11 +372,7 @@ export class NotesViewState {
return document.getElementById(ELEMENT_ID_SCROLL_CONTAINER)
}
selectNote = async (
note: SNNote,
userTriggered?: boolean,
scrollIntoView = true,
): Promise<void> => {
selectNote = async (note: SNNote, userTriggered?: boolean, scrollIntoView = true): Promise<void> => {
await this.appState.notes.selectNote(note.uuid, userTriggered)
if (scrollIntoView) {
const noteElement = document.getElementById(`note-${note.uuid}`)

View File

@@ -1,8 +1,4 @@
import {
ApplicationEvent,
ClientDisplayableError,
convertTimestampToMilliseconds,
} from '@standardnotes/snjs'
import { ApplicationEvent, ClientDisplayableError, convertTimestampToMilliseconds } from '@standardnotes/snjs'
import { action, computed, makeObservable, observable } from 'mobx'
import { WebApplication } from '../Application'