feat: image previews (#104)
Co-authored-by: lihbr <lihbr@users.noreply.github.com>
This commit is contained in:
parent
a812ea098f
commit
9df9c06f64
4 changed files with 36 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
|||
import type { Draft } from './statusDrafts'
|
||||
import { STORAGE_KEY_FIRST_VISIT, STORAGE_KEY_ZEN_MODE } from '~/constants'
|
||||
|
||||
export const imagePreview = ref({ src: '', alt: '' })
|
||||
export const isFirstVisit = useLocalStorage(STORAGE_KEY_FIRST_VISIT, true)
|
||||
export const isZenMode = useLocalStorage(STORAGE_KEY_ZEN_MODE, false)
|
||||
export const toggleZenMode = useToggle(isZenMode)
|
||||
|
@ -8,6 +9,7 @@ export const toggleZenMode = useToggle(isZenMode)
|
|||
export const isUserSwitcherOpen = ref(false)
|
||||
export const isSigninDialogOpen = ref(false)
|
||||
export const isPublishDialogOpen = ref(false)
|
||||
export const isImagePreviewDialogOpen = ref(false)
|
||||
export const isPreviewHelpOpen = ref(isFirstVisit.value)
|
||||
|
||||
export function openUserSwitcher() {
|
||||
|
@ -19,10 +21,6 @@ export function openSigninDialog() {
|
|||
isUserSwitcherOpen.value = false
|
||||
}
|
||||
|
||||
export function openPreviewHelp() {
|
||||
isPreviewHelpOpen.value = true
|
||||
}
|
||||
|
||||
export function openPublishDialog(draft?: Draft) {
|
||||
if (draft)
|
||||
dialogDraft.draft.value = draft
|
||||
|
@ -34,3 +32,12 @@ if (isPreviewHelpOpen.value) {
|
|||
isFirstVisit.value = false
|
||||
})
|
||||
}
|
||||
|
||||
export function openImagePreviewDialog(image: { src: string; alt: string }) {
|
||||
imagePreview.value = image
|
||||
isImagePreviewDialogOpen.value = true
|
||||
}
|
||||
|
||||
export function openPreviewHelp() {
|
||||
isPreviewHelpOpen.value = true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue