Class

Users (collaboration-core)

@ckeditor/ckeditor5-collaboration-core/src/users

class

The Users plugin provides the basic interface for setting and getting users involved in the document editing process.

Filtering

Properties

  • me : User | null

    A reference to the local user or null if it has not been set.

  • users : Collection.<User>

    readonly

    Holds all users added to the editor.

    for ( const user of editor.plugins.get( 'Users' ).users ) {
        console.log( user.name );
    }
    

    Use addUser to add a new user.

Methods

  • constructor()

  • addUser( userData ) → User

    Adds a new user to the list of users.

    Parameters

    userData : Object

    Returns

    User
  • defineMe( userId )

    Sets the user with the given ID as the local user (me).

    The local user can be only set once (this includes setting anonymous as the local user).

    Parameters

    userId : String
  • getOperationAuthor( operation ) → User

    Returns the author of the operation. It returns me by default if it is not overwritten.

    Parameters

    operation

    Operation operation Operation to check.

    Returns

    User
  • getUser( id ) → User

    Returns the user with a given ID.

    Parameters

    id : String

    Returns

    User
  • useAnonymousUser()

    Sets an anonymous user as me.

    The user's ID will be set to the value of config.users.anonymousUserId property.