Skip to main content

blockly > comments > RenderedWorkspaceComment

comments.RenderedWorkspaceComment class

Signature:

export declare class RenderedWorkspaceComment extends WorkspaceComment implements IBoundedElement, IRenderedElement, IDraggable, ISelectable, IDeletable, ICopyable<WorkspaceCommentCopyData>, IContextMenu, IFocusableNode 

Extends: WorkspaceComment

Implements: IBoundedElement, IRenderedElement, IDraggable, ISelectable, IDeletable, ICopyable<WorkspaceCommentCopyData>, IContextMenu, IFocusableNode

Constructors

Constructor

Modifiers

Description

(constructor)(workspace, id)

Constructs the workspace comment, including the view.

Properties

Property

Modifiers

Type

Description

view

CommentView

The class encompassing the svg elements making up the workspace comment.

workspace

readonly

WorkspaceSvg

Methods

Method

Modifiers

Description

canBeFocused()

See IFocusableNode.canBeFocused.

dispose()

Disposes of the view.

drag(newLoc)

Drags the comment to the given location.

endDrag()

Ends the drag on the comment.

getBoundingRectangle()

Returns the bounding rectangle of this comment in workspace coordinates. Respects collapsing.

getEditorFocusableNode()

getFocusableElement()

See IFocusableNode.getFocusableElement.

getFocusableTree()

See IFocusableNode.getFocusableTree.

getSize()

Returns the comment's size in workspace units. Does not respect collapsing.

getSvgRoot()

Returns the root SVG element of this comment.

isCopyable()

Returns whether this comment is copyable or not

isMovable()

Returns whether this comment is movable or not.

moveBy(dx, dy, reason)

Move the comment by the given amounts in workspace coordinates.

moveTo(location, reason)

Moves the comment to the given location in workspace coordinates.

onNodeBlur()

See IFocusableNode.onNodeBlur.

onNodeFocus()

See IFocusableNode.onNodeFocus.

revertDrag()

Moves the comment back to where it was at the start of a drag.

select()

Visually highlights the comment.

setCollapsed(collapsed)

Sets whether the comment is collapsed or not.

setDeleteStyle(wouldDelete)

Visually indicates that this comment would be deleted if dropped.

setEditable(editable)

Sets whether the comment is editable or not.

setPlaceholderText(text)

Sets the placeholder text displayed if the comment is empty.

setSize(size)

Sets the size of the comment.

setText(text)

Sets the text of the comment.

showContextMenu(e)

Show a context menu for this comment.

snapToGrid()

Snap this comment to the nearest grid point.

startDrag()

Starts a drag on the comment.

toCopyData()

Returns a JSON serializable representation of this comment's state that can be used for pasting.

unselect()

Visually unhighlights the comment.