CommentThread (comments/comments)
@ckeditor/ckeditor5-comments/src/comments/commentsrepository
Comment thread representation.
Stores a list of Comments
.
Filtering
Properties
-
channelId : String | undefined
module:comments/comments/commentsrepository~CommentThread#channelId
The channel where the comment thread was created.
-
A collection of
Comment
s belonging to this thread. -
id : String
module:comments/comments/commentsrepository~CommentThread#id
The comment thread ID.
-
isAttached : Boolean
module:comments/comments/commentsrepository~CommentThread#isAttached
Informs if the comment thread is attached to any target at the moment.
-
Informs if the comment thread is in read-only state (
true
) or not (false
). -
Informs if the comment thread can be removed by the local user.
-
length : Number
module:comments/comments/commentsrepository~CommentThread#length
The number of comments in the comment thread.
-
weight : Number
module:comments/comments/commentsrepository~CommentThread#weight
Sum of weights of all comments in this thread.
Methods
-
constructor( commentsRepository, data = { [data.channelId], data.id } )
module:comments/comments/commentsrepository~CommentThread#constructor
Parameters
commentsRepository : CommentsRepository
data : Object
-
Properties
[ data.channelId ] : String
data.id : String
-
addComment( data = { data.commentId, data.content, data.authorId, [data.createdAt], [data.attributes], [data.isFromAdapter] } )
module:comments/comments/commentsrepository~CommentThread#addComment
Creates a new comment inside the comment thread.
Note This method is event-driven. It means it fires an event then a normal priority listener catches it and executes an action. It makes it possible to add some actions before and after method will be executed.
Parameters
data : Object
Data object.
Propertiesdata.commentId : String
Comment id.
data.content : String
Comment content.
data.authorId : String
Author id.
[ data.createdAt ] : Date
Creation date. If not set, current date (
new Date()
) will be used.[ data.attributes ] : Object
Custom comment attributes. See also
setAttribute
andremoveAttribute
.[ data.isFromAdapter ] : Boolean
-
Defaults to
false
Fires
-
attachTo( target ) → Annotation
module:comments/comments/commentsrepository~CommentThread#attachTo
Creates comment annotations and displays it attached to the given target.
Parameters
target : HTMLElement | Rect | function
Returns
Annotation
Created annotation.
-
getComment( commentId ) → Comment
module:comments/comments/commentsrepository~CommentThread#getComment
-
remove( [ data ] = { [data.isFromAdapter] } )
module:comments/comments/commentsrepository~CommentThread#remove
Removes comment thread.
Note This method is event-driven. It means it fires an event then a normal priority listener catches it and executes an action. It makes it possible to add some actions before and after method will be executed.
Parameters
[ data ] : Object
-
Properties
[ data.isFromAdapter ] : Boolean
-
Defaults to
false
Defaults to
{}
Fires
-
toJSON() → Object
module:comments/comments/commentsrepository~CommentThread#toJSON
Returns
Object
Events
-
change:isReadOnly( eventInfo, name, value, oldValue )
module:comments/comments/commentsrepository~CommentThread#event:change:isReadOnly
Fired when the
isReadOnly
property changed value.Parameters
eventInfo : EventInfo
An object containing information about the fired event.
name : String
Name of the changed property (
isReadOnly
).value : Boolean
New value of the
isReadOnly
property with given key ornull
, if operation should remove property.oldValue : Boolean
Old value of the
isReadOnly
property with given key ornull
, if property was not set before.
-
change:isRemovable( eventInfo, name, value, oldValue )
module:comments/comments/commentsrepository~CommentThread#event:change:isRemovable
Fired when the
isRemovable
property changed value.Parameters
eventInfo : EventInfo
An object containing information about the fired event.
name : String
Name of the changed property (
isRemovable
).value : Boolean
New value of the
isRemovable
property with given key ornull
, if operation should remove property.oldValue : Boolean
Old value of the
isRemovable
property with given key ornull
, if property was not set before.
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.