@nextcloud/viewer
v1.0.0
Published
Nextcloud viewer app API bindings
Readme
Nextcloud Viewer integration
Usage
🔍 Add you own file view
If you want to make your app compatible with this app, you can use the methods provided by the @nextcloud/viewer npm.js package:
- Create a vue component which use the
pathandmimeprops (they will be automatically passed by the viewer) - Register your mime viewer with the following:
import { registerHandler } from '@nextcloud/viewer' import VideoView from 'VideoView.vue' registerHandler({ // unique id id: 'video', // optional, it will group every view of this group and // use the proper view when building the file list // of the slideshow. // e.g. you open an image/jpeg that have the `media` group // you will be able to see the video/mpeg from the `video` handler // files that also have the `media` group set. group: 'media', // the list of mimes your component is able to display mimes: [ 'video/mpeg', 'video/ogg', 'video/webm', 'video/mp4' ], // your vue component view component: VideoView }) - Make sure your script is loaded with
\OCP\Util::addInitScriptso that the handler is registered before the viewer is loaded.
[!TIP] If you feel like your mime should be integrated on this repo, you can also create a pull request with your object on the
modelsdirectory and the view on thecomponentsdirectory. Please have a look at what's already here and take example of it. 🙇♀️
