Options
All
  • Public
  • Public/Protected
  • All
Menu

@pdftron/collab-react

Index

Functions

  • A context provider for the Collaboration Client. Place as high up in your application as possible. Accepts all of the Collaboration Client options as props.

    example
    import { CollabClientProvider } from '@pdftron/collab-react';
    import MyApp from './App';

    export function App() {
    return (
    <CollabClientProvider
    url='http://localhost:3000/'
    subscriptionUrl='ws://localhost:3000/subscribe'
    >
    <MyApp />
    </CollabClientProvider>
    )
    }

    Parameters

    Returns Element

  • useClient(): CollabClient
  • A hook that returns the instance of the CollabClient

    Returns CollabClient

  • useCurrentUser(): User | null
  • A hook that returns the currently logged in User. Returns null if a user is not logged in.

    A user can be logged in using the methods available on the Collaboration Client, which can be retrieved from the useClient hook.

    Returns User | null

  • useCurrentDocument(): Document | null
  • A hook that returns the currently opened Document.

    Returns null if no document has been loaded.

    Returns Document | null

  • useConnectedUsers(): User[]
  • A hook that returns an array of Users who are viewing the current document.

    Returns an empty array if no users are connected, or the connected users feature is not enabled.

    See this guide for more information.

    Returns User[]

  • useCurrentSnapshot(): Snapshot | null
  • A hook that returns the currently previewed Snapshot.

    Returns null if no snapshot is being previewed

    Returns Snapshot | null

  • useMentions(): Mention[]
  • A hook that returns all the users Mentions for the current document

    Returns Mention[]

  • useScrollSync(): ScrollSyncSession[]
  • A hook that returns a list of available scroll sync sessions for the current document

    Returns ScrollSyncSession[]

  • useCurrentScrollSyncSession(): ScrollSyncSession | null
  • A hook that returns the currently active scroll sync session

    Returns null if no session is active

    Returns ScrollSyncSession | null

  • useAnnotations(): Annotation[]
  • A hook that returns all the Annotations for the current document.

    If no document is loaded, this hook will return an empty array.

    Returns Annotation[]

Type aliases

CollabClientProviderProps: React.PropsWithChildren<{ client: CollabClient }>
UseDocumentsOptions: { sortBy?: "createdAt" | "updatedAt" | "unreadCount"; initialLoad?: number | "all" }

Type declaration

  • Optional sortBy?: "createdAt" | "updatedAt" | "unreadCount"

    Sort the documents on this property. Defaults to 'updatedAt'

  • Optional initialLoad?: number | "all"

    How many documents to load when the hook is first run. If set to 'all', all the users documents will be loaded. If not set, no documents will be loaded until loadMore or loadAll is manually called.

UseDocumentsReturnType: { loadMore: any; loadAll: any; loading: boolean; documents: Document[] }

Type declaration

  • loadMore:function
    • loadMore(count: number): Promise<void>
    • Loads more documents for the current user

      Parameters

      • count: number

        How many documents to load

      Returns Promise<void>

  • loadAll:function
    • loadAll(): Promise<void>
    • Loads all the documents for the current user

      Returns Promise<void>

  • loading: boolean

    A boolean representing if documents are currently being loaded

  • documents: Document[]

    An array of loaded Documents for the current user

UseSnapshotsOptions: { sortBy?: "createdAt" | "updatedAt"; initialLoad?: number | "all" }

Type declaration

  • Optional sortBy?: "createdAt" | "updatedAt"

    Sort the snapshots on this value. Defaults to 'updatedAt'

  • Optional initialLoad?: number | "all"

    How many snapshots to initially load for the current document. If set to 'all', all the documents snapshots will be loaded. If not set, no snapshots will be loaded until loadMore or loadAll is manually called.

UseSnapshotsReturnType: { loadMore: any; loadAll: any; loading: boolean; snapshots: Snapshot[] }

Type declaration

  • loadMore:function
    • loadMore(count: number): Promise<void>
    • Loads more snapshots for the current document

      Parameters

      • count: number

        How many snapshots to load

      Returns Promise<void>

  • loadAll:function
    • loadAll(): Promise<void>
    • Loads all the snapshots for the current document

      Returns Promise<void>

  • loading: boolean

    A boolean representing if snapshots are currently being loaded

  • snapshots: Snapshot[]

    An array of loaded Snapshots for the current user

Generated using TypeDoc