@nextcloud/viewer
    Preparing search index...

    Interface ViewerAPI

    interface ViewerAPI {
        close(): void;
        compare(
            file: IFile,
            base: IFile,
            options?: CompareOptions,
        ): Promise<ViewerSession>;
        goTo(fileid: number): void;
        open(
            nodes: IFile[],
            file?: IFile,
            options?: ViewerOptions,
            handlerId?: string,
        ): Promise<ViewerSession>;
        openFolder(
            folder: IFolder,
            file?: IFile,
            options?: ViewerOptions,
            handlerId?: string,
        ): Promise<ViewerSession>;
        setEditing(editing: boolean): void;
    }

    Implemented by

    Index
    • 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>

    • 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>

    • Parameters

      • folder: IFolder
      • Optionalfile: IFile
      • Optionaloptions: ViewerOptions
      • OptionalhandlerId: string

      Returns Promise<ViewerSession>

    • 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