User
The representation of a single user that is involved in document editing.
Properties
avatar : undefined | stringmodule:collaboration-core/users~User#avatarThe URL pointing to the image with the avatar of the user.
If avatar is not set, default avatar is used.
module:collaboration-core/users~User#colorCSS colors classes object for the user.
id : stringmodule:collaboration-core/users~User#idThe ID of the user.
initials : stringreadonlymodule:collaboration-core/users~User#initialsThe initials of the user.
By default, the initials are composed of the user name's first and last words ignoring non-characters parts:
- for
Joe Doe, the initials areJD, - for
Joe Doe (admin), the initials areJD, - for
Anonymousthe initials areA, - for
Katie John-Newmanthe initials areKJ, - for
Adam Daniel Smiththe initials areAS.
The initials can be configured by
UserConfig#getInitialsCallback.- for
isAnonymous : booleanreadonlymodule:collaboration-core/users~User#isAnonymousIs
truefor the anonymous user,falseotherwise.The anonymous user is used when there is no defined user for given resource.
The situations when the anonymous user is used will depend on your application. For example, it can be used when the editor can be used by "guest" users of your application, or when the original user's account was removed.
isMe : booleanreadonlymodule:collaboration-core/users~User#isMeIs
truefor the local user.name : stringmodule:collaboration-core/users~User#nameThe name of the user.
Methods
constructor( data, [ getInitialsCallback ] )module:collaboration-core/users~User#constructorParameters
data : CollaborationUserDataUser data.
[ getInitialsCallback ] : ( name: string ) => stringThe custom callback configured via the editor configuration to calculate the initials.