Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow to change outline state from outside WrapperComponent
* Emit `outline-toggled` event when outline got toggled from Text
* Allow to pass property `showOutlineOutside` for changing outline state
  from parent component.

This is required to support toggeling the outline from inside
Collectives.

Related: #2919

Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- authored and backportbot-nextcloud[bot] committed Nov 22, 2022
commit 4033feb1a88540a9b4b5e9b565bdb74958f1c1e2
8 changes: 7 additions & 1 deletion src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
:sync-error="syncError"
:has-connection-issue="hasConnectionIssue"
:content-loaded="contentLoaded"
:show-author-annotations="showAuthorAnnotations">
:show-author-annotations="showAuthorAnnotations"
:show-outline-outside="showOutlineOutside"
@outline-toggled="outlineToggled">
<MainContainer v-if="$editor">
<!-- Readonly -->
<div v-if="readOnly" class="text-editor--readonly-bar">
Expand Down Expand Up @@ -218,6 +220,10 @@ export default {
type: Boolean,
default: false,
},
showOutlineOutside: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand Down
12 changes: 12 additions & 0 deletions src/components/Editor/Wrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export default {
type: Boolean,
require: true,
},
showOutlineOutside: {
type: Boolean,
default: false,
},
},

data: () => ({
Expand Down Expand Up @@ -107,6 +111,13 @@ export default {
return this.viewWidth > 1265
},
},

watch: {
'showOutlineOutside'() {
this.outline.visible = this.showOutlineOutside
},
},

mounted() {
this.outline.enable = this.isAbleToShowOutline

Expand All @@ -121,6 +132,7 @@ export default {
methods: {
outlineToggle() {
this.outline.visible = !this.outline.visible
this.$emit('outline-toggled', this.outline.visible)
},
},

Expand Down
7 changes: 6 additions & 1 deletion src/components/ViewerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
:active="active"
:autofocus="autofocus"
:share-token="shareToken"
:mime="mime" />
:mime="mime"
:show-outline-outside="showOutlineOutside" />
</template>

<script>
Expand Down Expand Up @@ -62,6 +63,10 @@ export default {
type: String,
default: null,
},
showOutlineOutside: {
type: Boolean,
default: false,
},
},
beforeMount() {
// FIXME Dirty fix to avoid recreating the component on stable16
Expand Down