Skip to main content

blockly > comments > CommentView

comments.CommentView class

Signature:

export declare class CommentView implements IRenderedElement 

Implements: IRenderedElement

Constructors

Constructor

Modifiers

Description

(constructor)(workspace, commentId)

Constructs a new instance of the CommentView class

Properties

Property

Modifiers

Type

Description

commentId

readonly

string

defaultCommentSize

static

Size

The default size of newly created comments.

disposed

protected

boolean

Whether this comment view has been disposed or not.

disposing

protected

boolean

Whether this comment view is currently being disposed or not.

workspace

readonly

WorkspaceSvg

Methods

Method

Modifiers

Description

addDisposeListener(listener)

Registers a callback that listens for disposal of this view.

addOnCollapseListener(listener)

Registers a callback that listens for collapsed-ness changes.

addSizeChangeListener(listener)

Registers a callback that listens for size changes.

addTextChangeListener(listener)

Registers a callback that listens for text changes on the comment editor.

bringToFront()

Brings the workspace comment to the front of its layer.

dispose()

Disposes of this comment view.

getEditorFocusableNode()

getRelativeToSurfaceXY()

Returns the current location of the comment in workspace coordinates.

getSize()

Returns the current size of the comment in workspace units. Respects collapsing.

getSvgRoot()

Returns the root SVG group element of the comment view.

getText()

Returns the current text of the comment.

isCollapsed()

Returns true if the comment is currently collapsed.

isDeadOrDying()

Returns true if this comment view is currently being disposed or has already been disposed.

isDisposed()

Returns whether this comment view has been disposed or not.

isEditable()

Returns true if the comment is currently editable.

moveTo(location)

Moves the comment view to the given location.

removeDisposeListener(listener)

Removes the given listener from the list of disposal listeners.

removeOnCollapseListener(listener)

Removes the given listener from the list of on collapse listeners.

removeSizeChangeListener(listener)

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

removeTextChangeListener(listener)

Removes the given listener from the comment editor.

setCollapsed(collapsed)

Sets whether the comment is currently collapsed or not.

setEditable(editable)

Sets the editability of the comment.

setPlaceholderText(text)

Sets the placeholder text displayed for an empty comment.

setSize(size)

Sets the size of the comment in workspace units, updates the view elements to reflect the new size, and triggers size change listeners.

setSizeWithoutFiringEvents(size)

Sets the size of the comment in workspace units, and updates the view elements to reflect the new size.

setText(text)

Sets the current text of the comment.