Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 17 additions & 11 deletions src/view/FilesAppIntegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { isPublicShare } from '@nextcloud/sharing/public'
import axios from '@nextcloud/axios'
import { emit } from '@nextcloud/event-bus'
import { getCurrentDirectory } from '../helpers/filesApp.js'
import {
getSidebar
} from '@nextcloud/files'
import {
getClient,
getDefaultPropfind,
Expand Down Expand Up @@ -106,7 +109,7 @@ export default {

this.changeFilesRoute(node.fileid)

OCA?.Files?.Sidebar?.close()
getSidebar()?.close()

if (this.getFileList()) {
const newFileModel = oldFile.clone()
Expand All @@ -115,12 +118,10 @@ export default {
newFileModel.set('mtime', Date.now())
this.getFileList()
.add(newFileModel.toJSON())

OC.Apps.hideAppSidebar()
}
},

share() {
async share() {
if (this.handlers.share && this.handlers.share(this)) {
return
}
Expand All @@ -130,8 +131,10 @@ export default {
return
}

OCA?.Files?.Sidebar?.open(this.filePath + '/' + this.fileName)
OCA?.Files?.Sidebar?.setActiveTab('sharing')
const node = await this.getFileNode()
const sidebar = getSidebar()
sidebar?.open(node)
sidebar?.setActiveTab('sharing')
},

rename(newName) {
Expand All @@ -144,7 +147,7 @@ export default {
}

if (this.getFileList()) {
OC.Apps.hideAppSidebar()
getSidebar()?.close()
}
},

Expand Down Expand Up @@ -421,17 +424,20 @@ export default {
avatardiv.append(popover)
},

showRevHistory() {
async showRevHistory() {
if (this.handlers.showRevHistory && this.handlers.showRevHistory(this)) {
return
}

if (isPublicShare() || !OCA?.Files?.Sidebar) {
if (isPublicShare()) {
console.error('[FilesAppIntegration] Versions are not supported')
return
}
OCA?.Files?.Sidebar?.open(this.filePath + '/' + this.fileName)
OCA?.Files?.Sidebar?.setActiveTab('files_versions')

const node = await this.getFileNode()
const sidebar = getSidebar()
sidebar?.open(node)
sidebar?.setActiveTab('files_versions')
},

/**
Expand Down
3 changes: 2 additions & 1 deletion src/view/Office.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ import uiMention from '../mixins/uiMention.js'
import version from '../mixins/version.js'
import { getCurrentUser, getGuestNickname } from '@nextcloud/auth'
import { shouldAskForGuestName } from '../helpers/guestName.js'
import { getSidebar } from '@nextcloud/files'

const FRAME_DOCUMENT = 'FRAME_DOCUMENT'

Expand Down Expand Up @@ -288,7 +289,7 @@ export default {
},
})

window.OCA?.Files?.Sidebar?.close()
getSidebar()?.close()
}
this.postMessage.registerPostMessageHandler(this.postMessageHandler)

Expand Down
Loading