Skip to content

Commit 5473c8f

Browse files
authored
Merge pull request #7828 from nextcloud/backport/7821/stable32
[stable32] fix(FloatingButtons): also hide when readonly, plaintext or richworkspace
2 parents c08fe59 + 60815b7 commit 5473c8f

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

src/components/Editor.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@
5454
</MenuBar>
5555
<div v-else class="menubar-placeholder" />
5656
</template>
57-
<ContentContainer v-show="contentLoaded" ref="contentWrapper" />
57+
<ContentContainer
58+
v-show="contentLoaded"
59+
ref="contentWrapper"
60+
:read-only="!editMode" />
5861
<SuggestionsBar v-if="isRichEditor && contentLoaded" />
5962
</MainContainer>
6063
<Reader

src/components/Editor/ContentContainer.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<EditorOutline />
1515
</div>
1616
<slot />
17-
<FloatingButtons v-if="!isMobile && !isFullWidth" />
17+
<FloatingButtons v-if="showFloatingButtons" />
1818
<EditorContent
1919
role="document"
2020
class="editor__content text-editor__content"
@@ -27,6 +27,7 @@
2727
import { useIsMobile } from '@nextcloud/vue/composables/useIsMobile'
2828
import { EditorContent } from '@tiptap/vue-2'
2929
import { useEditor } from '../../composables/useEditor.ts'
30+
import { useEditorFlags } from '../../composables/useEditorFlags.ts'
3031
import { useEditorWidth } from '../../composables/useEditorWidth.ts'
3132
import EditorOutline from './EditorOutline.vue'
3233
import FloatingButtons from './FloatingButtons.vue'
@@ -40,16 +41,32 @@ export default {
4041
FloatingButtons,
4142
},
4243
mixins: [useOutlineStateMixin],
44+
props: {
45+
readOnly: {
46+
type: Boolean,
47+
required: true,
48+
},
49+
},
4350
setup() {
4451
const isMobile = useIsMobile()
4552
const { editor } = useEditor()
53+
const { isRichEditor, isRichWorkspace } = useEditorFlags()
4654
const { isFullWidth } = useEditorWidth()
47-
return { editor, isMobile, isFullWidth }
55+
return { editor, isMobile, isFullWidth, isRichEditor, isRichWorkspace }
4856
},
4957
computed: {
5058
showOutline() {
5159
return this.$outlineState.visible
5260
},
61+
showFloatingButtons() {
62+
return (
63+
!this.readOnly
64+
&& !this.isMobile
65+
&& !this.isFullWidth
66+
&& this.isRichEditor
67+
&& !this.isRichWorkspace
68+
)
69+
},
5370
},
5471
}
5572
</script>

src/components/Editor/MarkdownContentEditor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<ReadonlyBar />
1616
</slot>
1717
</template>
18-
<ContentContainer />
18+
<ContentContainer :read-only="readOnly" />
1919
</MainContainer>
2020
</Wrapper>
2121
</template>

0 commit comments

Comments
 (0)