Skip to content

Commit

Permalink
Merge 811ee15 into 049f821
Browse files Browse the repository at this point in the history
  • Loading branch information
backportbot-nextcloud[bot] authored Nov 7, 2022
2 parents 049f821 + 811ee15 commit efcf480
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 16 deletions.
25 changes: 25 additions & 0 deletions cypress/e2e/workspace.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,31 @@ describe('Workspace', function() {
})
})

it('Hides the workspace when switching to another folder', function() {
cy.uploadFile('test.md', 'text/markdown', `${currentFolder}/README.md`)
cy.createFolder(`${currentFolder}/subdirectory`)
cy.reload()
cy.get('.files-fileList').should('contain', 'README.md')
cy.get('#rich-workspace .ProseMirror')
.should('contain', 'Hello world')
cy.openFolder('subdirectory')
cy.get('#rich-workspace')
.get('.ProseMirror')
.should('not.exist')
})

it('Hides the workspace when switching to another view', function() {
cy.uploadFile('test.md', 'text/markdown', `${currentFolder}/README.md`)
cy.reload()
cy.get('.files-fileList').should('contain', 'README.md')
cy.get('#rich-workspace .ProseMirror')
.should('contain', 'Hello world')
cy.get('.nav-recent')
.click()
cy.get('#rich-workspace .ProseMirror')
.should('not.exist')
})

it('adds a Readme.md', function() {
cy.get('.files-fileList').should('not.contain', 'Readme.md')
cy.openWorkspace()
Expand Down
4 changes: 2 additions & 2 deletions js/editor-rich.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor-rich.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/helpers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

import { loadState } from '@nextcloud/initial-state'
import { subscribe } from '@nextcloud/event-bus'
import { openMimetypes } from './mime.js'
import { getSharingToken } from './token.js'
import RichWorkspace from '../views/RichWorkspace.vue'
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, 'empty': showEmptyWorkspace}">
<div v-if="enabled && active" id="rich-workspace" :class="{'icon-loading': !loaded || !ready, 'focus': focus, 'dark': darkTheme, 'creatable': canCreate, 'empty': showEmptyWorkspace}">
<a v-if="showEmptyWorkspace"
tabindex="0"
class="empty-workspace"
Expand Down Expand Up @@ -71,6 +71,10 @@ export default {
type: String,
required: true,
},
active: {
type: Boolean,
default: true,
},
},
data() {
return {
Expand Down

0 comments on commit efcf480

Please sign in to comment.