Home Reference Source
import Marker from 'jquery-crate/view/marker.js'
public class | source

Marker

Marker is class for managing the marker of one user,it includes the caret, avatar, and pseudo Names.

Constructor Summary

Public Constructor
public

constructor(origin: [string], lifeTime: Number, range: [{index: index,length: 0}], cursorsp: [cursor module], cursor: [Boolean], isItME: Boolean)

Marker Module manages the Carets, avatars, pseudo names for the different users of the document

Member Summary

Public Members
public

animal: [type]

auto generated pseudo name (from animals list)

public

add or not the avatar

public

color r,g,b

public

color rgb(r,g,b)

public

color rgba(r,g,b,0.5)

public

cursor: [type]

true for an editor, false if it is from a ping

public

lifeTime: [type]

lifeTime After this time, if no ping or Caret position is received => remove caret and avatar.

public

origin: [type]

origin the id of the the user

public

Anonymous + auto generated pseudo name

public

used to store last update time to detected outdated users

public

timer: [type]: *

a timer that is used to check if the user is Outdated

Method Summary

Public Methods
public

addAvatar(divID: string)

public

addCursor(range: [{index: index,length: 0}])

addCursor add the cursor to the editor

public

capitalize(s: [string]): [string]

capitalize uppercase the first letter

public

checkIfOutdated check if the user is outdated and if it is the case remove its caret and avatar

public

getAvatar(): [type]

getAvatar return the div that contains this user id

public

getColor(str: [string]): [(r,g,b))]

getColor for a specific id, get a unique color

public

removeAvatar(): [type]

removeAvatar remove the avatar of the user from the interface

public

setPseudo(Pseudo: [type])

setPseudo set pseudo for the user

public

update(range: [{index: index,length: 0}], cursor: [boolean])

update the time to keep the avatar and cursor if it exist

Public Constructors

public constructor(origin: [string], lifeTime: Number, range: [{index: index,length: 0}], cursorsp: [cursor module], cursor: [Boolean], isItME: Boolean) source

Marker Module manages the Carets, avatars, pseudo names for the different users of the document

Params:

NameTypeAttributeDescription
origin [string]

the id of the the user

lifeTime Number

After this time, if no ping or Caret position is received => remove caret and avatar. if lifetime is -1 we didn't add the avatar

range [{index: index,length: 0}]

range stars from index with the specified length

cursorsp [cursor module]

the used cursor module for quilljs

cursor [Boolean]

create the caret or not. If it is from ping, it will be false else true

isItME Boolean

is it my caret ? true or false to disable the time if it is true

Public Members

public animal: [type] source

auto generated pseudo name (from animals list)

public avatarAdd: Boolean source

add or not the avatar

public color: String source

color r,g,b

public colorRGB: String source

color rgb(r,g,b)

public colorRGBLight: String source

color rgba(r,g,b,0.5)

public cursor: [type] source

true for an editor, false if it is from a ping

public lifeTime: [type] source

lifeTime After this time, if no ping or Caret position is received => remove caret and avatar. if lifetime is -1 we don't add the avatar

public origin: [type] source

origin the id of the the user

public pseudoName: String source

Anonymous + auto generated pseudo name

public time: Date source

used to store last update time to detected outdated users

public timer: [type]: * source

a timer that is used to check if the user is Outdated

Return:

[type]

[description]

Public Methods

public addAvatar(divID: string) source

Params:

NameTypeAttributeDescription
divID string
  • optional
  • default: #users

public addCursor(range: [{index: index,length: 0}]) source

addCursor add the cursor to the editor

Params:

NameTypeAttributeDescription
range [{index: index,length: 0}]

[description]

public capitalize(s: [string]): [string] source

capitalize uppercase the first letter

Params:

NameTypeAttributeDescription
s [string]

[string]

Return:

[string]

[String the first letter is in uppercase]

public checkIfOutdated() source

checkIfOutdated check if the user is outdated and if it is the case remove its caret and avatar

public getAvatar(): [type] source

getAvatar return the div that contains this user id

Return:

[type]

[description]

public getColor(str: [string]): [(r,g,b))] source

getColor for a specific id, get a unique color

Params:

NameTypeAttributeDescription
str [string]

[the id of the user]

Return:

[(r,g,b))]

[the corresponding rgb color]

public removeAvatar(): [type] source

removeAvatar remove the avatar of the user from the interface

Return:

[type]

[description]

public setPseudo(Pseudo: [type]) source

setPseudo set pseudo for the user

Params:

NameTypeAttributeDescription
Pseudo [type]

[description]

public update(range: [{index: index,length: 0}], cursor: [boolean]) source

update the time to keep the avatar and cursor if it exist

Params:

NameTypeAttributeDescription
range [{index: index,length: 0}]

[description]

cursor [boolean]

[if it is true add update the caret position]