Skip to main content

Class: RenderedWorkspaceComment

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:34

A bounded element interface.

Extends​

Implements​

Properties index​

PropertyDescription
viewThe class encompassing the svg elements making up the workspace comment.
workspaceThe workspace to construct the comment in.
idThe unique identifier for this comment.
locationThe location of the comment in workspace coordinates.
disposedWhether this comment has been disposed or not.
disposingWhether this comment is being disposed or not.

Methods index​

MethodDescription
setTextSets the text of the comment.
setPlaceholderTextSets the placeholder text displayed if the comment is empty.
setSizeSets the size of the comment.
setCollapsedSets whether the comment is collapsed or not.
setEditableSets whether the comment is editable or not.
getSvgRootReturns the root SVG element of this comment.
getSizeReturns the comment's size in workspace units. Does not respect collapsing.
getBoundingRectangleReturns the bounding rectangle of this comment in workspace coordinates. Respects collapsing.
moveByMove the comment by the given amounts in workspace coordinates.
moveToMoves the comment to the given location in workspace coordinates.
disposeDisposes of the view.
setDeleteStyleVisually indicates that this comment would be deleted if dropped.
isCopyableReturns whether this comment is copyable or not
isMovableReturns whether this comment is movable or not.
startDragStarts a drag on the comment.
dragDrags the comment to the given location.
endDragEnds the drag on the comment.
revertDragMoves the comment back to where it was at the start of a drag.
selectVisually highlights the comment.
unselectVisually unhighlights the comment.
toCopyDataReturns a JSON serializable representation of this comment's state that can be used for pasting.
showContextMenuShow a context menu for this comment.
snapToGridSnap this comment to the nearest grid point.
getEditorFocusableNodeReturns the FocusableNode representing the editor portion of this comment.
getFocusableElementSee IFocusableNode.getFocusableElement.
getFocusableTreeSee IFocusableNode.getFocusableTree.
onNodeFocusSee IFocusableNode.onNodeFocus.
onNodeBlurSee IFocusableNode.onNodeBlur.
canBeFocusedSee IFocusableNode.canBeFocused.
performActionHandles the user acting on this comment via keyboard navigation. Expands the comment and focuses its editor.
getTextReturns the text of the comment.
isCollapsedReturns whether the comment is collapsed or not.
isEditableReturns whether the comment is editable or not, respecting whether the workspace is read-only.
isOwnEditableReturns whether the comment is editable or not, only examining its own state and ignoring the state of the workspace.
setMovableSets whether the comment is movable or not.
isOwnMovableReturns whether the comment is movable or not, only examining its own state and ignoring the state of the workspace.
setDeletableSets whether the comment is deletable or not.
isDeletableReturns whether the comment is deletable or not, respecting whether the workspace is read-only.
isOwnDeletableReturns whether the comment is deletable or not, only examining its own state and ignoring the state of the workspace.
getRelativeToSurfaceXYReturns the position of the comment in workspace coordinates.
isDisposedReturns whether the comment has been disposed or not.
isDeadOrDyingReturns true if this comment view is currently being disposed or has already been disposed.

Constructors​

Constructor​

new RenderedWorkspaceComment(workspace, id?): RenderedWorkspaceComment;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:54

Constructs the workspace comment, including the view.

Parameters​

ParameterType
workspaceWorkspaceSvg
id?string

Returns​

RenderedWorkspaceComment

Overrides​

WorkspaceComment.constructor

Properties​

view​

view: CommentView;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:47

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


workspace​

readonly workspace: WorkspaceSvg;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:49

The workspace to construct the comment in.

Implementation of​

ICopyable.workspace

Overrides​

WorkspaceComment.workspace


id​

readonly id: string;

Defined in: packages/blockly/core/comments/workspace_comment.ts:19

The unique identifier for this comment.

Implementation of​

ICopyable.id

Inherited from​

WorkspaceComment.id


location​

protected location: Coordinate;

Defined in: packages/blockly/core/comments/workspace_comment.ts:40

The location of the comment in workspace coordinates.

Inherited from​

WorkspaceComment.location


disposed​

protected disposed: boolean = false;

Defined in: packages/blockly/core/comments/workspace_comment.ts:43

Whether this comment has been disposed or not.

Inherited from​

WorkspaceComment.disposed


disposing​

protected disposing: boolean = false;

Defined in: packages/blockly/core/comments/workspace_comment.ts:46

Whether this comment is being disposed or not.

Inherited from​

WorkspaceComment.disposing

Methods​

setText()​

setText(text): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:97

Sets the text of the comment.

Parameters​

ParameterType
textstring

Returns​

void

Overrides​

WorkspaceComment.setText


setPlaceholderText()​

setPlaceholderText(text): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:104

Sets the placeholder text displayed if the comment is empty.

Parameters​

ParameterType
textstring

Returns​

void


setSize()​

setSize(size): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:109

Sets the size of the comment.

Parameters​

ParameterType
sizeSize

Returns​

void

Overrides​

WorkspaceComment.setSize


setCollapsed()​

setCollapsed(collapsed): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:116

Sets whether the comment is collapsed or not.

Parameters​

ParameterType
collapsedboolean

Returns​

void

Overrides​

WorkspaceComment.setCollapsed


setEditable()​

setEditable(editable): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:123

Sets whether the comment is editable or not.

Parameters​

ParameterType
editableboolean

Returns​

void

Overrides​

WorkspaceComment.setEditable


getSvgRoot()​

getSvgRoot(): SVGElement;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:130

Returns the root SVG element of this comment.

Returns​

SVGElement

Implementation of​

IRenderedElement.getSvgRoot


getSize()​

getSize(): Size;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:138

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

Returns​

Size

Overrides​

WorkspaceComment.getSize


getBoundingRectangle()​

getBoundingRectangle(): Rect;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:146

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

Returns​

Rect

Implementation of​

IDraggable.getBoundingRectangle


moveBy()​

moveBy(
dx,
dy,
reason?
): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:162

Move the comment by the given amounts in workspace coordinates.

Parameters​

ParameterType
dxnumber
dynumber
reason?string[]

Returns​

void

Implementation of​

IDraggable.moveBy


moveTo()​

moveTo(location, reason?): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:169

Moves the comment to the given location in workspace coordinates.

Parameters​

ParameterType
locationCoordinate
reason?string[]

Returns​

void

Overrides​

WorkspaceComment.moveTo


dispose()​

dispose(): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:198

Disposes of the view.

Returns​

void

Implementation of​

IDeletable.dispose

Overrides​

WorkspaceComment.dispose


setDeleteStyle()​

setDeleteStyle(wouldDelete): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:226

Visually indicates that this comment would be deleted if dropped.

Parameters​

ParameterType
wouldDeleteboolean

Returns​

void

Implementation of​

IDeletable.setDeleteStyle


isCopyable()​

isCopyable(): boolean;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:235

Returns whether this comment is copyable or not

Returns​

boolean

Implementation of​

ICopyable.isCopyable


isMovable()​

isMovable(): boolean;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:240

Returns whether this comment is movable or not.

Returns​

boolean

Implementation of​

IDraggable.isMovable

Overrides​

WorkspaceComment.isMovable


startDrag()​

startDrag(): RenderedWorkspaceComment;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:245

Starts a drag on the comment.

Returns​

RenderedWorkspaceComment

Implementation of​

IDraggable.startDrag


drag()​

drag(newLoc): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:250

Drags the comment to the given location.

Parameters​

ParameterType
newLocCoordinate

Returns​

void

Implementation of​

IDraggable.drag


endDrag()​

endDrag(): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:255

Ends the drag on the comment.

Returns​

void

Implementation of​

IDraggable.endDrag


revertDrag()​

revertDrag(): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:260

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

Returns​

void

Implementation of​

IDraggable.revertDrag


select()​

select(): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:265

Visually highlights the comment.

Returns​

void

Implementation of​

ICopyable.select


unselect()​

unselect(): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:271

Visually unhighlights the comment.

Returns​

void

Implementation of​

ICopyable.unselect


toCopyData()​

toCopyData(): WorkspaceCommentCopyData | null;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:280

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

Returns​

WorkspaceCommentCopyData | null

Implementation of​

ICopyable.toCopyData


showContextMenu()​

showContextMenu(e): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:291

Show a context menu for this comment.

Parameters​

ParameterType
eEvent

Returns​

void

Implementation of​

IContextMenu.showContextMenu


snapToGrid()​

snapToGrid(): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:319

Snap this comment to the nearest grid point.

Returns​

void


getEditorFocusableNode()​

getEditorFocusableNode(): IFocusableNode;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:333

Returns​

IFocusableNode

The FocusableNode representing the editor portion of this comment.


getFocusableElement()​

getFocusableElement(): HTMLElement | SVGElement;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:338

See IFocusableNode.getFocusableElement.

Returns​

HTMLElement | SVGElement

Implementation of​

IFocusableNode.getFocusableElement


getFocusableTree()​

getFocusableTree(): IFocusableTree;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:343

See IFocusableNode.getFocusableTree.

Returns​

IFocusableTree

Implementation of​

IFocusableNode.getFocusableTree


onNodeFocus()​

onNodeFocus(): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:348

See IFocusableNode.onNodeFocus.

Returns​

void

Implementation of​

IFocusableNode.onNodeFocus


onNodeBlur()​

onNodeBlur(): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:356

See IFocusableNode.onNodeBlur.

Returns​

void

Implementation of​

IFocusableNode.onNodeBlur


canBeFocused()​

canBeFocused(): boolean;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:361

See IFocusableNode.canBeFocused.

Returns​

boolean

Implementation of​

IFocusableNode.canBeFocused


performAction()​

performAction(): void;

Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:369

Handles the user acting on this comment via keyboard navigation. Expands the comment and focuses its editor.

Returns​

void

Implementation of​

IFocusableNode.performAction


getText()​

getText(): string;

Defined in: packages/blockly/core/comments/workspace_comment.ts:105

Returns the text of the comment.

Returns​

string

Inherited from​

WorkspaceComment.getText


isCollapsed()​

isCollapsed(): boolean;

Defined in: packages/blockly/core/comments/workspace_comment.ts:133

Returns whether the comment is collapsed or not.

Returns​

boolean

Inherited from​

WorkspaceComment.isCollapsed


isEditable()​

isEditable(): boolean;

Defined in: packages/blockly/core/comments/workspace_comment.ts:146

Returns whether the comment is editable or not, respecting whether the workspace is read-only.

Returns​

boolean

Inherited from​

WorkspaceComment.isEditable


isOwnEditable()​

isOwnEditable(): boolean;

Defined in: packages/blockly/core/comments/workspace_comment.ts:154

Returns whether the comment is editable or not, only examining its own state and ignoring the state of the workspace.

Returns​

boolean

Inherited from​

WorkspaceComment.isOwnEditable


setMovable()​

setMovable(movable): void;

Defined in: packages/blockly/core/comments/workspace_comment.ts:159

Sets whether the comment is movable or not.

Parameters​

ParameterType
movableboolean

Returns​

void

Inherited from​

WorkspaceComment.setMovable


isOwnMovable()​

isOwnMovable(): boolean;

Defined in: packages/blockly/core/comments/workspace_comment.ts:179

Returns whether the comment is movable or not, only examining its own state and ignoring the state of the workspace.

Returns​

boolean

Inherited from​

WorkspaceComment.isOwnMovable


setDeletable()​

setDeletable(deletable): void;

Defined in: packages/blockly/core/comments/workspace_comment.ts:184

Sets whether the comment is deletable or not.

Parameters​

ParameterType
deletableboolean

Returns​

void

Inherited from​

WorkspaceComment.setDeletable


isDeletable()​

isDeletable(): boolean;

Defined in: packages/blockly/core/comments/workspace_comment.ts:192

Returns whether the comment is deletable or not, respecting whether the workspace is read-only.

Returns​

boolean

Implementation of​

IDeletable.isDeletable

Inherited from​

WorkspaceComment.isDeletable


isOwnDeletable()​

isOwnDeletable(): boolean;

Defined in: packages/blockly/core/comments/workspace_comment.ts:205

Returns whether the comment is deletable or not, only examining its own state and ignoring the state of the workspace.

Returns​

boolean

Inherited from​

WorkspaceComment.isOwnDeletable


getRelativeToSurfaceXY()​

getRelativeToSurfaceXY(): Coordinate;

Defined in: packages/blockly/core/comments/workspace_comment.ts:223

Returns the position of the comment in workspace coordinates.

Returns​

Coordinate

Implementation of​

IDraggable.getRelativeToSurfaceXY

Inherited from​

WorkspaceComment.getRelativeToSurfaceXY


isDisposed()​

isDisposed(): boolean;

Defined in: packages/blockly/core/comments/workspace_comment.ts:236

Returns whether the comment has been disposed or not.

Returns​

boolean

Inherited from​

WorkspaceComment.isDisposed


isDeadOrDying()​

isDeadOrDying(): boolean;

Defined in: packages/blockly/core/comments/workspace_comment.ts:244

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

Returns​

boolean

Inherited from​

WorkspaceComment.isDeadOrDying