The annotate function is similar to the annotate function of Word, you can select a text alignment to comment, as shown in the following figure:
PS: This feature is only available in the Pro version (commercial version) and not in the open source version. Pro version preview address: http://pro.aieditor.com.cn
new AiEditor({ element: "#aiEditor", comment: { enable: true, floatable: false, containerClassName: "comment-container", // currentAccountAvatar: "https://aieditor.com.cn/logo.png", currentAccount:"Miachel Yang", currentAccountId: "1", enableWithEditDisable: true, onCommentActivated: (commentIds) => { // When the comment area gets focus }, queryAllComments: () => { // Query all comments of the current document and return CommentInfo[] or Promise<CommentInfo[]> }, queryMyComments: () => { // Query "My Comments", return CommentInfo[] or Promise<CommentInfo[]> }, queryCommentsByIds: (commentIds) => { // Query multiple comments based on multiple document IDs and return CommentInfo[] or Promise<CommentInfo[]> }, onCommentCreate: (comment) => { // When a comment is created, returns CommentInfo or Promise<CommentInfo> }, onCommentDeleteConfirm:(comment)=>{ // When a comment is deleted, a confirmation box pops up and returns boolean or Promise<boolean>; }, onCommentDelete: (commentId) => { // When the comment is deleted, returns boolean or Promise<boolean>; }, onCommentUpdate: (commentId, content) => { // When the comment is modified, returns a boolean or Promise<boolean>; }, },})
enable: Whether to enable the comment function
floatable: Whether the content of the comment is floating with the position of the comment area
containerClassName: Customize the class name of the comment area, used for custom style
currentAccountAvatar: When floatable = false, configure the display avatar
currentAccount: Configure the name of the current user, which is used to display in the comment
currentAccountId: Configure the id of the current user
enableWithEditDisable: Whether to enable the annotation (comment) function in read-only mode, the default is false
onCommentActivated: This callback is triggered when the comment gets the focus
onCommentCreate: Listen for comments to be created. At this time, we should save the comment content to the database and return the complete comment information
onCommentDeleteConfirm: Listen for comments to be deleted, pop up a confirmation box, and return boolean or Promise<boolean>
onCommentDelete: Listen for comments to be deleted, and the comments in the database should be deleted synchronously at this time
onCommentUpdate: Listen for comments to be modified
queryAllComments: Query all comments (valid when floatable: false is configured)
queryMyComments: Query my comments (valid when floatable: false is configured)
queryCommentsByIds: Query all comments based on multiple comment ids (valid when floatable: true is configured)
Comment
The annotate function is similar to the annotate function of Word, you can select a text alignment to comment, as shown in the following figure:
How to Use
floatable = false
, configure the display avatarPromise<boolean>
floatable: false
is configured)floatable: false
is configured)floatable: true
is configured)Sample code
The following example code uses LocalStorage to save the comment content
CommentInfo Description of the comment information