diff --git a/components/modal/ModalContainer.vue b/components/modal/ModalContainer.vue
index f2ddec39..99884a80 100644
--- a/components/modal/ModalContainer.vue
+++ b/components/modal/ModalContainer.vue
@@ -16,7 +16,7 @@ import {
-
+
diff --git a/components/publish/PublishButton.vue b/components/publish/PublishButton.vue
index e0e1e7b6..8d6f438c 100644
--- a/components/publish/PublishButton.vue
+++ b/components/publish/PublishButton.vue
@@ -1,8 +1,6 @@
diff --git a/components/status/StatusActions.vue b/components/status/StatusActions.vue
index 8090821d..1a383fdb 100644
--- a/components/status/StatusActions.vue
+++ b/components/status/StatusActions.vue
@@ -102,17 +102,14 @@ const deleteAndRedraft = async () => {
// TODO confirm to overwrite
}
- openPublishDialog({
+ openPublishDialog('dialog', {
params: { ...getParamsFromStatus(status), status: text! },
attachments: [],
})
}
function editStatus() {
- if (!dialogDraft.isEmpty) {
- // TODO confirm to overwrite
- }
- openPublishDialog({
+ openPublishDialog(`edit-${status.id}`, {
editingStatus: status,
params: getParamsFromStatus(status),
attachments: [],
diff --git a/composables/dialog.ts b/composables/dialog.ts
index bb54761c..d8ebe235 100644
--- a/composables/dialog.ts
+++ b/composables/dialog.ts
@@ -4,6 +4,7 @@ import { STORAGE_KEY_FIRST_VISIT, STORAGE_KEY_ZEN_MODE } from '~/constants'
export const imagePreview = ref({ src: '', alt: '' })
export const statusEdit = ref()
+export const dialogDraftKey = ref()
export const isFirstVisit = useLocalStorage(STORAGE_KEY_FIRST_VISIT, true)
export const isZenMode = useLocalStorage(STORAGE_KEY_ZEN_MODE, false)
export const toggleZenMode = useToggle(isZenMode)
@@ -18,9 +19,10 @@ export function openSigninDialog() {
isSigninDialogOpen.value = true
}
-export function openPublishDialog(draft?: Draft) {
+export function openPublishDialog(draftKey = 'dialog', draft?: Draft) {
+ dialogDraftKey.value = draftKey
if (draft)
- dialogDraft.draft.value = draft
+ currentUserDrafts.value[draftKey] = draft
isPublishDialogOpen.value = true
}
diff --git a/composables/statusDrafts.ts b/composables/statusDrafts.ts
index f9238988..0d1ecf54 100644
--- a/composables/statusDrafts.ts
+++ b/composables/statusDrafts.ts
@@ -69,11 +69,13 @@ export function useDraft(draftKey: string, inReplyToId?: string) {
export const dialogDraft = useDraft('dialog')
export function mentionUser(account: Account) {
- openPublishDialog(getDefaultDraft({ status: `@${account.acct} ` }))
+ openPublishDialog('dialog', getDefaultDraft({
+ status: `@${account.acct} `,
+ }))
}
export function directMessageUser(account: Account) {
- openPublishDialog(getDefaultDraft({
+ openPublishDialog('dialog', getDefaultDraft({
status: `@${account.acct} `,
visibility: 'direct',
}))