diff --git a/src/PublicShareAuthSidebar.vue b/src/PublicShareAuthSidebar.vue
index e0976aff082..a1020d3d952 100644
--- a/src/PublicShareAuthSidebar.vue
+++ b/src/PublicShareAuthSidebar.vue
@@ -14,6 +14,7 @@
+
@@ -30,6 +31,7 @@ import { t } from '@nextcloud/l10n'
import CallView from './components/CallView/CallView.vue'
import ChatView from './components/ChatView.vue'
import MediaSettings from './components/MediaSettings/MediaSettings.vue'
+import PollManager from './components/PollViewer/PollManager.vue'
import PollViewer from './components/PollViewer/PollViewer.vue'
import TopBar from './components/TopBar/TopBar.vue'
import TransitionWrapper from './components/UIShared/TransitionWrapper.vue'
@@ -51,6 +53,7 @@ export default {
CallView,
ChatView,
MediaSettings,
+ PollManager,
PollViewer,
TopBar,
TransitionWrapper,
diff --git a/src/PublicShareSidebar.vue b/src/PublicShareSidebar.vue
index 42124922432..dda3c90476a 100644
--- a/src/PublicShareSidebar.vue
+++ b/src/PublicShareSidebar.vue
@@ -25,6 +25,7 @@
+
@@ -44,6 +45,7 @@ import CallFailedDialog from './components/CallView/CallFailedDialog.vue'
import CallView from './components/CallView/CallView.vue'
import ChatView from './components/ChatView.vue'
import MediaSettings from './components/MediaSettings/MediaSettings.vue'
+import PollManager from './components/PollViewer/PollManager.vue'
import PollViewer from './components/PollViewer/PollViewer.vue'
import CallButton from './components/TopBar/CallButton.vue'
import TopBar from './components/TopBar/TopBar.vue'
@@ -71,6 +73,7 @@ export default {
MediaSettings,
NcButton,
NcLoadingIcon,
+ PollManager,
PollViewer,
TopBar,
TransitionWrapper,
diff --git a/src/components/NewMessage/NewMessage.vue b/src/components/NewMessage/NewMessage.vue
index 7d504d25454..bb9499220ca 100644
--- a/src/components/NewMessage/NewMessage.vue
+++ b/src/components/NewMessage/NewMessage.vue
@@ -29,7 +29,6 @@
:can-create-poll="canCreatePoll"
@open-file-upload="openFileUploadWindow"
@handle-file-share="showFilePicker = true"
- @toggle-poll-editor="togglePollEditor"
@update-new-file-dialog="updateNewFileDialog" />
@@ -152,17 +151,6 @@
-
-
-
-
-
{
- this.$refs.pollEditor?.fillPollEditorFromDraft(id, isPollEditorOpened)
- // Wait for editor to be mounted and filled before unmounting drafts dialog
- this.togglePollDraftHandler()
- })
- },
-
- togglePollDraftHandler() {
- this.showPollDraftHandler = !this.showPollDraftHandler
- },
-
focusInput() {
if (this.isMobileDevice) {
return
diff --git a/src/components/NewMessage/NewMessageAttachments.vue b/src/components/NewMessage/NewMessageAttachments.vue
index 741bdbd7799..b33d49dbaa0 100644
--- a/src/components/NewMessage/NewMessageAttachments.vue
+++ b/src/components/NewMessage/NewMessageAttachments.vue
@@ -45,7 +45,7 @@
+ @click="showPollEditor">
@@ -119,7 +119,7 @@ export default {
},
},
- emits: ['update-new-file-dialog', 'toggle-poll-editor', 'open-file-upload', 'handle-file-share'],
+ emits: ['update-new-file-dialog', 'open-file-upload', 'handle-file-share'],
computed: {
fileTemplateOptions() {
@@ -139,6 +139,10 @@ export default {
showSmartPicker() {
EventBus.emit('smart-picker-open')
},
+
+ showPollEditor() {
+ EventBus.emit('poll-editor-open', { id: null, fromDrafts: false })
+ },
},
}
diff --git a/src/components/PollViewer/PollDraftHandler.vue b/src/components/PollViewer/PollDraftHandler.vue
index bec69f26fe7..e9186a18343 100644
--- a/src/components/PollViewer/PollDraftHandler.vue
+++ b/src/components/PollViewer/PollDraftHandler.vue
@@ -27,7 +27,7 @@
draft
@click="openPollEditor" />
-
+
{{ t('spreed', 'Create new poll') }}
@@ -54,7 +54,7 @@ import { usePollsStore } from '../../stores/polls.ts'
const props = defineProps<{
token: string,
- showCreateButton?: boolean,
+ editorOpened?: boolean,
}>()
const emit = defineEmits<{
(event: 'close'): void,
@@ -72,8 +72,8 @@ const pollDrafts = computed(() => pollsStore.getDrafts(props.token))
* Opens poll editor pre-filled from the draft
* @param id poll draft ID
*/
-function openPollEditor(id) {
- EventBus.emit('poll-editor-open', id)
+function openPollEditor(id: number|null) {
+ EventBus.emit('poll-editor-open', { id, fromDrafts: !props.editorOpened })
}
diff --git a/src/components/PollViewer/PollEditor.vue b/src/components/PollViewer/PollEditor.vue
index 1113ab75ebb..9ea4cc73482 100644
--- a/src/components/PollViewer/PollEditor.vue
+++ b/src/components/PollViewer/PollEditor.vue
@@ -223,14 +223,15 @@ async function createPoll() {
/**
* Pre-fills form from the draft
* @param id poll draft ID
- * @param isAlreadyOpened poll draft ID
+ * @param fromDrafts whether editor was opened from drafts handler
*/
-function fillPollEditorFromDraft(id: number|null, isAlreadyOpened: boolean) {
- if (!isAlreadyOpened) {
+function fillPollEditorFromDraft(id: number|null, fromDrafts: boolean) {
+ if (fromDrafts) {
+ // Show 'Back' button, do not reset until closed
isOpenedFromDraft.value = true
}
- if (pollsStore.drafts[props.token][id]) {
+ if (id && pollsStore.drafts[props.token][id]) {
fillPollForm(pollsStore.drafts[props.token][id])
}
}
diff --git a/src/components/PollViewer/PollManager.vue b/src/components/PollViewer/PollManager.vue
new file mode 100644
index 00000000000..107be228559
--- /dev/null
+++ b/src/components/PollViewer/PollManager.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
diff --git a/src/views/FilesSidebarChatView.vue b/src/views/FilesSidebarChatView.vue
index deccbb206ec..8c5ec678665 100644
--- a/src/views/FilesSidebarChatView.vue
+++ b/src/views/FilesSidebarChatView.vue
@@ -8,6 +8,7 @@
+
@@ -17,6 +18,7 @@
import CallFailedDialog from '../components/CallView/CallFailedDialog.vue'
import ChatView from '../components/ChatView.vue'
import MediaSettings from '../components/MediaSettings/MediaSettings.vue'
+import PollManager from '../components/PollViewer/PollManager.vue'
import PollViewer from '../components/PollViewer/PollViewer.vue'
import CallButton from '../components/TopBar/CallButton.vue'
@@ -31,6 +33,7 @@ export default {
CallFailedDialog,
ChatView,
MediaSettings,
+ PollManager,
PollViewer,
},
diff --git a/src/views/MainView.vue b/src/views/MainView.vue
index 9b29ee78cd6..e1f45ccc420 100644
--- a/src/views/MainView.vue
+++ b/src/views/MainView.vue
@@ -10,6 +10,7 @@
+
@@ -23,6 +24,7 @@ import CallFailedDialog from '../components/CallView/CallFailedDialog.vue'
import CallView from '../components/CallView/CallView.vue'
import ChatView from '../components/ChatView.vue'
import LobbyScreen from '../components/LobbyScreen.vue'
+import PollManager from '../components/PollViewer/PollManager.vue'
import PollViewer from '../components/PollViewer/PollViewer.vue'
import TopBar from '../components/TopBar/TopBar.vue'
@@ -36,6 +38,7 @@ export default {
CallFailedDialog,
ChatView,
LobbyScreen,
+ PollManager,
PollViewer,
TopBar,
},