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 defining the new comment details. It can include:
    • text - (optional) the comment's text content
    • date - (optional) the date when the comment was made
    • html - (optional) the comment's HTML content. To enable rendering of HTML instead of text, activate the html property in the editorShape configuration
  • skipProvider - (optional) controls whether the request to the server is prevented or not
info

To manage internal event handling, refer to the Event Bus methods

Example

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

Change log: This event was introduced in v1.4