@nextcloud/viewer
    Preparing search index...

    Class Viewer

    The viewer of the page. Tells any page of the file shown, editing and the viewer closing, whoever opened it (see ViewerEventMap).

    Hierarchy

    • EventTarget
      • Viewer

    Implements

    Index
    • Returns Viewer

    • Set the viewer instance (called from init.ts) Private, do not use directly.

      Parameters

      • viewer: CreateComponentPublicInstanceWithMixins<Readonly<{}>>

        The mounted Viewer Vue component instance

      Returns void

    • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

      MDN Reference

      Type Parameters

      Parameters

      • type: K
      • listener: (event: ViewerEventMap[K]) => void
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Parameters

      • type: string
      • listener: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Close the viewer.

      Returns void

    • Show file compared with base, an older version of it: what changed from base to file. Side by side, base is on the left. Resolves with the session of this opening.

      Parameters

      Returns Promise<ViewerSession>

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • The element that shows a file, to render it outside the viewer, as the preview of a file link in a chat or a document does.

      Resolves with the tag name of the custom element of the handler the viewer would open the file with, once that element is defined (see IHandler.onInit), or with nothing when no handler takes the file. The element takes the props every handler does (ViewerProps), and says it has loaded or failed with the same events. Loads nothing of the viewer itself.

      Parameters

      • file: IFile

        The file to show

      Returns Promise<string | undefined>

    • Show an already-opened file by its id, without an update:file event. Used to sync the viewer to browser history (back/forward).

      Parameters

      • fileid: number

        The id of the file to show

      Returns void

    • Show files. Resolves with the session of this opening, which tells of the file shown, editing and the viewer closing (see ViewerEventMap).

      Parameters

      • nodes: IFile[]
      • Optionalfile: IFile
      • Optionaloptions: ViewerOptions
      • OptionalhandlerId: string

      Returns Promise<ViewerSession>

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

      MDN Reference

      Type Parameters

      Parameters

      • type: K
      • listener: (event: ViewerEventMap[K]) => void
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Parameters

      • type: string
      • listener: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Set the editing state (used to sync with the editing URL param).

      Parameters

      • editing: boolean

        Whether the viewer should be in editing mode

      Returns void