Skip to content

Commit

Permalink
Do not render the workspace if file list is hidden
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Nov 9, 2022
1 parent 3bb952b commit 821686e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/helpers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
*/

import { subscribe } from '@nextcloud/event-bus'
import { openMimetypes } from './mime.js'
import RichWorkspace from '../views/RichWorkspace.vue'
import { imagePath } from '@nextcloud/router'
Expand Down Expand Up @@ -170,6 +171,12 @@ const FilesWorkspacePlugin = {
store,
}).$mount(this.el)

subscribe('files:navigation:changed', () => {
// Expose if the default file list is active to the component
// to only render the workspace if the file list is actually visible
vm.active = OCA.Files.App.getCurrentFileList() === fileList
})

fileList.$el.on('urlChanged', data => {
vm.path = data.dir.toString()
})
Expand Down
6 changes: 5 additions & 1 deletion src/views/RichWorkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<div v-if="enabled" id="rich-workspace" :class="{'icon-loading': !loaded || !ready, 'focus': focus, 'dark': darkTheme, 'creatable': canCreate}">
<div v-if="enabled && active" id="rich-workspace" :class="{'icon-loading': !loaded || !ready, 'focus': focus, 'dark': darkTheme, 'creatable': canCreate}">
<div v-if="showEmptyWorkspace" class="empty-workspace" @click="createNew">
<p class="placeholder">
{{ t('text', 'Add notes, lists or links …') }}
Expand Down Expand Up @@ -63,6 +63,10 @@ export default {
type: String,
required: true,
},
active: {
type: Boolean,
default: true,
},
},
data() {
return {
Expand Down

0 comments on commit 821686e

Please sign in to comment.