From b38ea596e65db73c2b003209a71cf6359d851a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 10 Jan 2024 15:25:33 +0100 Subject: [PATCH] fix: Prioritize un-collapsible menubar entries for mobile and aggregate children in the hidden entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jonas Signed-off-by: Julius Härtl --- src/components/Menu/MenuBar.vue | 14 ++++++++++---- src/components/Menu/entries.js | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/Menu/MenuBar.vue b/src/components/Menu/MenuBar.vue index 5acf3eac8c6..b7e2c3032ae 100644 --- a/src/components/Menu/MenuBar.vue +++ b/src/components/Menu/MenuBar.vue @@ -161,14 +161,20 @@ export default { return list }, hiddenEntries() { + const entries = this.entries.filter(({ priority }) => { + // reverse logic from visibleEntries + return priority !== undefined && priority > this.iconsLimit + }).reduce((acc, entry) => { + // If entry has children, merge them into list. Otherwise keep entry itself. + const children = entry.children ?? [entry] + return [...acc, ...children] + }, []) + return { key: 'remain', label: this.t('text', 'Remaining actions'), icon: DotsHorizontal, - children: this.entries.filter(({ priority }) => { - // reverse logic from visibleEntries - return priority !== undefined && priority > this.iconsLimit - }), + children: entries, } }, }, diff --git a/src/components/Menu/entries.js b/src/components/Menu/entries.js index 86cea4fb543..1d2809c6a41 100644 --- a/src/components/Menu/entries.js +++ b/src/components/Menu/entries.js @@ -308,7 +308,7 @@ export default [ }, }, ], - priority: 3, + priority: 6, }, { key: 'code-block', @@ -340,13 +340,13 @@ export default [ action: (command, emojiObject = {}) => { return command.emoji(emojiObject) }, - priority: 5, + priority: 3, }, { key: 'insert-attachment', label: t('text', 'Insert attachment'), icon: Images, component: ActionAttachmentUpload, - priority: 4, + priority: 1, }, ]