Skip to main content

add-comment

Description

Triggered when a new comment is added

Usage

"add-comment": ({
id?: string | number,
cardId: string | number,
comment: {
text?: string,
date?: Date,
html?: string
},
skipProvider?: boolean
}) => void;

Parameters

The callback for the add-comment event receives an object with these properties:

  • id - (optional) the ID assigned to the new comment
  • cardId - (required) the ID of the card where the comment is being added
  • comment - (required) an object describing the new comment. It can include:
    • text - (optional) the comment’s text content
    • date - (optional) the date associated with the comment
    • html - (optional) the HTML markup for the comment. To show HTML instead of plain text, enable the html option in the editorShape configuration
  • skipProvider - (optional) controls whether the request to the server is skipped or not
info

To work with internal events, you can use the Event Bus methods

Example

// create Kanban
const board = new kanban.Kanban("#root", {
columns,
cards
});
// listen for the "add-comment" event
board.api.on("add-comment", (obj) => {
console.log(obj.comment);
});

Change log: This event was introduced in version 1.4