@@ -193,7 +193,6 @@ import Vue from 'vue'
193193import axios from ' @nextcloud/axios'
194194import { showError } from ' @nextcloud/dialogs'
195195import { emit , subscribe , unsubscribe } from ' @nextcloud/event-bus'
196- import { registerFileAction , FileAction , Permission , DefaultType } from ' @nextcloud/files'
197196import getSortingConfig from ' ../services/FileSortingConfig.ts'
198197
199198import isFullscreen from ' @nextcloud/vue/dist/Mixins/isFullscreen.js'
@@ -205,7 +204,6 @@ import canDownload from '../utils/canDownload.js'
205204import cancelableRequest from ' ../utils/CancelableRequest.js'
206205import Error from ' ../components/Error.vue'
207206import File from ' ../models/file.js'
208- import filesActionHandler from ' ../services/FilesActionHandler.js'
209207import legacyFilesActionHandler from ' ../services/LegacyFilesActionHandler.js'
210208import getFileInfo from ' ../services/FileInfo.ts'
211209import getFileList from ' ../services/FileList.ts'
@@ -214,7 +212,6 @@ import logger from '../services/logger.js'
214212
215213import Delete from ' vue-material-design-icons/Delete.vue'
216214import Download from ' vue-material-design-icons/Download.vue'
217- import EyeSvg from ' @mdi/svg/svg/eye.svg?raw'
218215import Fullscreen from ' vue-material-design-icons/Fullscreen.vue'
219216import FullscreenExit from ' vue-material-design-icons/FullscreenExit.vue'
220217import Pencil from ' vue-material-design-icons/Pencil.vue'
@@ -286,8 +283,7 @@ export default {
286283 isSidebarShown: false ,
287284 isFullscreenMode: false ,
288285 canSwipe: true ,
289- // TODO: remove OCA?.Files?.fileActions when public Files is Vue
290- isStandalone: OCP ? .Files === undefined && OCA ? .Files ? .fileActions === undefined ,
286+ isStandalone: false ,
291287 theme: null ,
292288 root: getRootPath (),
293289 handlerId: ' ' ,
@@ -523,6 +519,12 @@ export default {
523519 },
524520
525521 beforeMount () {
522+ this .isStandalone = window .OCP ? .Files === undefined && window .OCA ? .Files ? .fileActions === undefined
523+
524+ if (this .isStandalone ) {
525+ logger .info (' No OCP.Files app found, viewer is now in standalone mode' )
526+ }
527+
526528 // register on load
527529 document .addEventListener (' DOMContentLoaded' , () => {
528530 // register all primary components mimes
@@ -542,16 +544,10 @@ export default {
542544 this .Sidebar = OCA .Files .Sidebar .state
543545 }
544546
545- this .registerFileActions ()
546-
547547 logger .info (` ${ this .handlers .length } viewer handlers registered` , { handlers: this .handlers })
548548 })
549549
550550 window .addEventListener (' resize' , this .onResize )
551-
552- if (this .isStandalone ) {
553- logger .info (' No OCP.Files app found, viewer is now in standalone mode' )
554- }
555551 },
556552
557553 mounted () {
@@ -939,31 +935,6 @@ export default {
939935 }
940936 },
941937
942- registerFileActions() {
943- if (!this.isStandalone) {
944- registerFileAction(new FileAction({
945- id: 'view',
946- displayName() {
947- return t('viewer', 'View')
948- },
949- iconSvgInline: () => EyeSvg,
950- default: DefaultType.DEFAULT,
951- enabled: (nodes) => {
952- // Disable if not located in user root
953- if (nodes.some(node => !(node.isDavRessource && node.root?.startsWith('/files')))) {
954- return false
955- }
956- // Faster to check if at least one node doesn't match the requirements
957- return !nodes.some(node => (
958- (node.permissions & Permission.READ) === 0
959- || !this.Viewer.mimetypes.includes(node.mime)
960- ))
961- },
962- exec: filesActionHandler,
963- }))
964- }
965- },
966-
967938 /**
968939 * Close the viewer
969940 */
0 commit comments