From 2ff46bb8cb89e6a102f49dac088a13bcf0a7ec8b Mon Sep 17 00:00:00 2001 From: Piotrek Tomczewski Date: Sat, 7 Jan 2023 08:55:07 +0100 Subject: [PATCH] feat(ui): opening the details page with the reply button (#840) --- components/status/StatusActions.vue | 10 ++++------ pages/[[server]]/@[account]/[status].vue | 5 +++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/status/StatusActions.vue b/components/status/StatusActions.vue index c78ea293..1cc8c0b2 100644 --- a/components/status/StatusActions.vue +++ b/components/status/StatusActions.vue @@ -24,13 +24,11 @@ const { formatHumanReadableNumber, formatNumber, forSR } = useHumanReadableNumbe const reply = () => { if (!checkLogin()) return - if (details) { + if (details) focusEditor() - } - else { - const { key, draft } = getReplyDraft(status) - openPublishDialog(key, draft()) - } + + else + navigateTo({ path: getStatusRoute(status).href, state: { focusReply: true } }) } diff --git a/pages/[[server]]/@[account]/[status].vue b/pages/[[server]]/@[account]/[status].vue index 7c11f52a..3fdbc9ce 100644 --- a/pages/[[server]]/@[account]/[status].vue +++ b/pages/[[server]]/@[account]/[status].vue @@ -49,6 +49,11 @@ const focusEditor = () => { provide('focus-editor', focusEditor) +watch(publishWidget, () => { + if (window.history.state.focusReply) + focusEditor() +}) + onReactivated(() => { // Silently update data when reentering the page // The user will see the previous content first, and any changes will be updated to the UI when the request is completed