Skip to main content

blockly > comments > CommentEditor

comments.CommentEditor class

The part of a comment that can be typed into.

Signature:

export declare class CommentEditor implements IFocusableNode 

Implements: IFocusableNode

Constructors

Constructor

Modifiers

Description

(constructor)(workspace, commentId, onFinishEditing)

Constructs a new instance of the CommentEditor class

Properties

Property

Modifiers

Type

Description

id?

string

(Optional)

workspace

WorkspaceSvg

Methods

Method

Modifiers

Description

addTextChangeListener(listener)

Registers a callback that listens for text changes.

canBeFocused()

getDom()

Gets the dom structure for this comment editor.

getFocusableElement()

getFocusableTree()

getText()

Gets the current text of the comment.

onNodeBlur()

onNodeFocus()

removeTextChangeListener(listener)

Removes the given listener from the list of text change listeners.

setEditable(isEditable)

Sets whether the textarea is editable. If not, the textarea will be readonly.

setPlaceholderText(text)

Sets the placeholder text displayed for an empty comment.

setText(text)

Sets the current text of the comment and fires change listeners.

updateSize(size, topBarSize)

Update the size of the comment editor element.