fix: don't close popover when previewing file (#1017)
This commit is contained in:
@@ -32,6 +32,7 @@ import { SubscriptionState } from './SubscriptionState'
|
||||
import { SyncState } from './SyncState'
|
||||
import { TagsState } from './TagsState'
|
||||
import { WebOrDesktopDevice } from '@/Device/WebOrDesktopDevice'
|
||||
import { FilePreviewModalState } from './FilePreviewModalState'
|
||||
|
||||
export enum AppStateEvent {
|
||||
TagChanged,
|
||||
@@ -84,6 +85,7 @@ export class AppState {
|
||||
readonly notesView: NotesViewState
|
||||
readonly subscription: SubscriptionState
|
||||
readonly files: FilesState
|
||||
readonly filePreviewModal = new FilePreviewModalState()
|
||||
|
||||
isSessionsModalVisible = false
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { SNFile } from '@standardnotes/snjs/dist/@types'
|
||||
import { action, makeObservable, observable } from 'mobx'
|
||||
|
||||
export class FilePreviewModalState {
|
||||
isOpen = false
|
||||
currentFile: SNFile | undefined = undefined
|
||||
otherFiles: SNFile[] = []
|
||||
|
||||
constructor() {
|
||||
makeObservable(this, {
|
||||
isOpen: observable,
|
||||
currentFile: observable,
|
||||
otherFiles: observable,
|
||||
|
||||
activate: action,
|
||||
dismiss: action,
|
||||
setCurrentFile: action,
|
||||
})
|
||||
}
|
||||
|
||||
setCurrentFile = (currentFile: SNFile) => {
|
||||
this.currentFile = currentFile
|
||||
}
|
||||
|
||||
activate = (currentFile: SNFile, otherFiles: SNFile[]) => {
|
||||
this.currentFile = currentFile
|
||||
this.otherFiles = otherFiles
|
||||
this.isOpen = true
|
||||
}
|
||||
|
||||
dismiss = () => {
|
||||
this.isOpen = false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user