@univerjs/sheets-thread-comment v0.5.4


Class: FThreadComment

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:247

Constructors

new FThreadComment()

new FThreadComment(
   _thread, 
   _parent, 
   _injector, 
   _commandService, 
   _univerInstanceService, 
   _threadCommentModel, 
   _userManagerService): FThreadComment

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:248

Parameters

ParameterType
_thread| IBaseComment | IThreadComment
_parent| undefined | IThreadComment
_injectorInjector
_commandServiceICommandService
_univerInstanceServiceIUniverInstanceService
_threadCommentModelSheetsThreadCommentModel
_userManagerServiceUserManagerService

Returns

FThreadComment

Methods

delete()

delete(): Promise<boolean>

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:387

Returns

Promise<boolean>

Deprecated

use deleteAsync as instead.


deleteAsync()

deleteAsync(): Promise<boolean>

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:373

Delete the comment and it’s replies

Returns

Promise<boolean>

success or not

Example

const comment = univerAPI.getActiveWorkbook()
 .getSheetById(sheetId)
 .getCommentById(commentId);
const success = await comment.deleteAsync();

getCommentData()

getCommentData(): IBaseComment

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:292

Get the comment data

Returns

IBaseComment

The comment data

Example

const comment = univerAPI.getActiveWorkbook()
 .getSheetById(sheetId)
 .getCommentById(commentId);
const commentData = comment.getCommentData();

getContent()

getContent(): IDocumentBody

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:342

Returns

IDocumentBody

Deprecated

use getRichText as instead


getIsRoot()

getIsRoot(): boolean

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:277

Whether the comment is a root comment

Returns

boolean

Whether the comment is a root comment

Example

const comment = univerAPI.getActiveWorkbook()
 .getSheetById(sheetId)
 .getCommentById(commentId);
const isRoot = comment.getIsRoot();

getRange()

getRange(): null | FRange

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:326

Get the range of the comment

Returns

null | FRange

The range of the comment

Example

const comment = univerAPI.getActiveWorkbook()
 .getSheetById(sheetId)
 .getCommentById(commentId);
const range = comment.getRange();

getReplies()

getReplies(): undefined | FThreadComment[]

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:308

Get the replies of the comment

Returns

undefined | FThreadComment[]

the replies of the comment

Example

const comment = univerAPI.getActiveWorkbook()
 .getSheetById(sheetId)
 .getCommentById(commentId);
const replies = comment.getReplies();

getRichText()

getRichText(): RichTextValue

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:357

Get the rich text of the comment

Returns

RichTextValue

The rich text of the comment

Example

const comment = univerAPI.getActiveWorkbook()
 .getSheetById(sheetId)
 .getCommentById(commentId);
const richText = comment.getRichText();

replyAsync()

replyAsync(comment): Promise<boolean>

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:479

Reply to the comment

Parameters

ParameterTypeDescription
commentFTheadCommentBuilderThe comment to reply to

Returns

Promise<boolean>

success or not

Example

const comment = univerAPI.getActiveWorkbook()
 .getSheetById(sheetId)
 .getCommentById(commentId);
 
const reply = univerAPI.newTheadComment()
 .setContent(univerAPI.newRichText().insertText('hello zhangsan'));
 
const success = await comment.replyAsync(reply);

resolve()

resolve(resolved?): Promise<boolean>

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:435

Parameters

ParameterType
resolved?boolean

Returns

Promise<boolean>

Deprecated

use resolveAsync as instead


resolveAsync()

resolveAsync(resolved?): Promise<boolean>

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:451

Resolve the comment

Parameters

ParameterTypeDescription
resolved?booleanWhether the comment is resolved

Returns

Promise<boolean>

success or not

Example

const comment = univerAPI.getActiveWorkbook()
 .getSheetById(sheetId)
 .getCommentById(commentId);
const success = await comment.resolveAsync(true);

update()

update(content): Promise<boolean>

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:395

Parameters

ParameterType
contentIDocumentBody

Returns

Promise<boolean>

Deprecated

use updateAsync as instead


updateAsync()

updateAsync(content): Promise<boolean>

Defined in: sheets-thread-comment/src/facade/f-thread-comment.ts:411

Update the comment content

Parameters

ParameterTypeDescription
content| IDocumentBody | RichTextValueThe new content of the comment

Returns

Promise<boolean>

success or not

Example

const comment = univerAPI.getActiveWorkbook()
 .getSheetById(sheetId)
 .getCommentById(commentId);
const success = await comment.updateAsync(univerAPI.newRichText().insertText('hello zhangsan'));