Skip to content

Commit 4b49f3e

Browse files
committed
fix: menubar without formatting on plain text mode
Not really a backport but rather a reimplementation of #2757. Signed-off-by: Max <max@nextcloud.com>
1 parent 877e32d commit 4b49f3e

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/components/EditorWrapper.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
ref="menubar"
4949
:file-path="relativePath"
5050
:file-id="fileId"
51+
:is-read-only="readOnly"
5152
:is-rich-editor="isRichEditor"
5253
:is-public="isPublic"
5354
:autohide="autohide"
@@ -68,7 +69,7 @@
6869
</MenuBar>
6970
<div v-if="!menubarLoaded" class="menubar placeholder" />
7071
<div ref="contentWrapper" class="content-wrapper">
71-
<MenuBubble v-if="renderMenus"
72+
<MenuBubble v-if="renderRichEditorMenus"
7273
:content-wrapper="contentWrapper"
7374
:file-path="relativePath" />
7475
<EditorContent v-show="contentLoaded"
@@ -291,12 +292,16 @@ export default {
291292
displayed() {
292293
return this.currentSession && this.active
293294
},
294-
renderMenus() {
295+
renderRichEditorMenus() {
295296
return this.contentLoaded
296297
&& this.isRichEditor
297298
&& !this.syncError
298299
&& !this.readOnly
299300
},
301+
renderMenus() {
302+
return this.contentLoaded
303+
&& !this.syncError
304+
},
300305
},
301306
watch: {
302307
lastSavedStatus() {

src/components/MenuBar.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
class="hidden-visually"
3030
:multiple="true"
3131
@change="onImageUploadFilePicked">
32-
<div v-if="isRichEditor" ref="menubar" class="menubar-icons">
32+
<div v-if="isRichEditor && !isReadOnly" ref="menubar" class="menubar-icons">
3333
<template v-for="(icon) in icons">
3434
<EmojiPicker v-if="icon.class === 'icon-emoji'"
3535
v-show="icon.priority <= iconCount"
@@ -154,6 +154,10 @@ export default {
154154
useEditorMixin,
155155
],
156156
props: {
157+
isReadOnly: {
158+
type: Boolean,
159+
default: false,
160+
},
157161
isRichEditor: {
158162
type: Boolean,
159163
default: true,
@@ -189,7 +193,7 @@ export default {
189193
submenuVisibility: {},
190194
lastImagePath: null,
191195
icons: [...menuBarIcons],
192-
editorHasFocus: false
196+
editorHasFocus: false,
193197
}
194198
},
195199
computed: {

0 commit comments

Comments
 (0)