FrameworkJavaScript
Database comment block: comments on rows
An internal block tool that stores one comment on a database row. It is not user-insertable and has no toolbox entry. A thread is a database-comment child of the row. Its replies are database-comment children of the thread.
It is an annotation, not page content. Blok hides its holder. Views, find, copy, select-all and the HTML, Markdown and plain-text exports skip it. Comment writes do not add undo steps.
Registering database registers this tool automatically. Naming database-comment yourself replaces it. A host comments hook in the database config replaces the built-in comments.
Import
TypeScript
import { DatabaseComment } from '@bloklabs/core/tools';Save Data
TypeScript
interface DatabaseCommentData {
text: string; // Plain text, not HTML
createdAt: number; // Epoch ms when it was written
authorId?: string; // The writer, as the host's people directory knows them
authorName?: string; // The writer's display name when it was written
propertyId?: string; // Set on a thread about one cell: that property's id
editedAt?: number; // Epoch ms of the last edit
resolved?: boolean; // Set on a resolved thread
}
// A thread is a child of the row; its replies are children of the thread.JSON
{
"id": "cmt001",
"type": "database-comment",
"parent": "row001",
"data": {
"text": "Can we ship this on Friday?",
"createdAt": 1760745600000,
"authorId": "u1",
"authorName": "Ada",
"propertyId": "prop2"
}
}Usage Example
TypeScript
// DatabaseComment is not inserted directly. Registering Database
// registers it too, as `database-comment`.
import { Database } from '@bloklabs/core/tools';
const editor = new Blok({
holder: 'editor',
tools: {
database: { class: Database },
},
});