Class: RenderedWorkspaceComment
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:36
A bounded element interface.
Extends
Implements
IBoundedElementIRenderedElementIDraggableISelectableIDeletableICopyable<WorkspaceCommentCopyData>IContextMenuIFocusableNode
Properties index
| Property | Description |
|---|---|
| view | The class encompassing the svg elements making up the workspace comment. |
| workspace | The workspace to construct the comment in. |
| id | The unique identifier for this comment. |
| location | The location of the comment in workspace coordinates. |
| disposed | Whether this comment has been disposed or not. |
| disposing | Whether this comment is being disposed or not. |
Methods index
| Method | Description |
|---|---|
| setText | Sets the text of the comment. |
| setPlaceholderText | Sets the placeholder text displayed if the comment is empty. |
| setSize | Sets the size of the comment. |
| setCollapsed | Sets whether the comment is collapsed or not. |
| setEditable | Sets whether the comment is editable or not. |
| getSvgRoot | Returns the root SVG element of this comment. |
| getSize | Returns the comment's size in workspace units. Does not respect collapsing. |
| getBoundingRectangle | Returns the bounding rectangle of this comment in workspace coordinates. Respects collapsing. |
| moveBy | Move the comment by the given amounts in workspace coordinates. |
| moveTo | Moves the comment to the given location in workspace coordinates. |
| dispose | Disposes of the view. |
| setDeleteStyle | Visually indicates that this comment would be deleted if dropped. |
| isCopyable | Returns whether this comment is copyable or not |
| isMovable | Returns whether this comment is movable or not. |
| startDrag | Starts a drag on the comment. |
| drag | Drags the comment to the given location. |
| endDrag | Ends the drag on the comment. |
| revertDrag | Moves the comment back to where it was at the start of a drag. |
| select | Visually highlights the comment. |
| unselect | Visually unhighlights the comment. |
| toCopyData | Returns a JSON serializable representation of this comment's state that can be used for pasting. |
| showContextMenu | Show a context menu for this comment. |
| snapToGrid | Snap this comment to the nearest grid point. |
| getEditorFocusableNode | Returns the FocusableNode representing the editor portion of this comment. |
| getFocusableElement | See IFocusableNode.getFocusableElement. |
| getFocusableTree | See IFocusableNode.getFocusableTree. |
| onNodeFocus | See IFocusableNode.onNodeFocus. |
| onNodeBlur | See IFocusableNode.onNodeBlur. |
| canBeFocused | See IFocusableNode.canBeFocused. |
| performAction | Handles the user acting on this comment via keyboard navigation. Expands the comment and focuses its editor. |
| getText | Returns the text of the comment. |
| isCollapsed | Returns whether the comment is collapsed or not. |
| isEditable | Returns whether the comment is editable or not, respecting whether the workspace is read-only. |
| isOwnEditable | Returns whether the comment is editable or not, only examining its own state and ignoring the state of the workspace. |
| setMovable | Sets whether the comment is movable or not. |
| isOwnMovable | Returns whether the comment is movable or not, only examining its own state and ignoring the state of the workspace. |
| setDeletable | Sets whether the comment is deletable or not. |
| isDeletable | Returns whether the comment is deletable or not, respecting whether the workspace is read-only. |
| isOwnDeletable | Returns whether the comment is deletable or not, only examining its own state and ignoring the state of the workspace. |
| getRelativeToSurfaceXY | Returns the position of the comment in workspace coordinates. |
| isDisposed | Returns whether the comment has been disposed or not. |
| isDeadOrDying | Returns 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:56
Constructs the workspace comment, including the view.
Parameters
| Parameter | Type |
|---|---|
workspace | WorkspaceSvg |
id? | string |
Returns
RenderedWorkspaceComment
Overrides
Properties
view
view: CommentView;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:49
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:51
The workspace to construct the comment in.
Implementation of
Overrides
id
readonly id: string;
Defined in: packages/blockly/core/comments/workspace_comment.ts:19
The unique identifier for this comment.
Implementation of
Inherited from
location
protected location: Coordinate;
Defined in: packages/blockly/core/comments/workspace_comment.ts:40
The location of the comment in workspace coordinates.
Inherited from
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
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
Methods
setText()
setText(text): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:99
Sets the text of the comment.
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
void
Overrides
setPlaceholderText()
setPlaceholderText(text): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:106
Sets the placeholder text displayed if the comment is empty.
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
void
setSize()
setSize(size): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:111
Sets the size of the comment.
Parameters
| Parameter | Type |
|---|---|
size | Size |
Returns
void
Overrides
setCollapsed()
setCollapsed(collapsed): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:118
Sets whether the comment is collapsed or not.
Parameters
| Parameter | Type |
|---|---|
collapsed | boolean |
Returns
void
Overrides
setEditable()
setEditable(editable): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:125
Sets whether the comment is editable or not.
Parameters
| Parameter | Type |
|---|---|
editable | boolean |
Returns
void
Overrides
getSvgRoot()
getSvgRoot(): SVGElement;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:132
Returns the root SVG element of this comment.
Returns
SVGElement
Implementation of
getSize()
getSize(): Size;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:140
Returns the comment's size in workspace units. Does not respect collapsing.
Returns
Overrides
getBoundingRectangle()
getBoundingRectangle(): Rect;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:148
Returns the bounding rectangle of this comment in workspace coordinates. Respects collapsing.
Returns
Implementation of
IDraggable.getBoundingRectangle
moveBy()
moveBy(
dx,
dy,
reason?
): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:164
Move the comment by the given amounts in workspace coordinates.
Parameters
| Parameter | Type |
|---|---|
dx | number |
dy | number |
reason? | string[] |
Returns
void
Implementation of
moveTo()
moveTo(location, reason?): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:171
Moves the comment to the given location in workspace coordinates.
Parameters
| Parameter | Type |
|---|---|
location | Coordinate |
reason? | string[] |
Returns
void
Overrides
dispose()
dispose(): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:200
Disposes of the view.
Returns
void
Implementation of
Overrides
setDeleteStyle()
setDeleteStyle(wouldDelete): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:228
Visually indicates that this comment would be deleted if dropped.
Parameters
| Parameter | Type |
|---|---|
wouldDelete | boolean |
Returns
void
Implementation of
isCopyable()
isCopyable(): boolean;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:237
Returns whether this comment is copyable or not
Returns
boolean
Implementation of
isMovable()
isMovable(): boolean;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:242
Returns whether this comment is movable or not.
Returns
boolean
Implementation of
Overrides
startDrag()
startDrag(): RenderedWorkspaceComment;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:247
Starts a drag on the comment.
Returns
RenderedWorkspaceComment
Implementation of
drag()
drag(newLoc): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:252
Drags the comment to the given location.
Parameters
| Parameter | Type |
|---|---|
newLoc | Coordinate |
Returns
void
Implementation of
endDrag()
endDrag(): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:257
Ends the drag on the comment.
Returns
void
Implementation of
revertDrag()
revertDrag(): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:262
Moves the comment back to where it was at the start of a drag.
Returns
void
Implementation of
select()
select(): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:267
Visually highlights the comment.
Returns
void
Implementation of
unselect()
unselect(): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:273
Visually unhighlights the comment.
Returns
void
Implementation of
toCopyData()
toCopyData(): WorkspaceCommentCopyData | null;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:282
Returns a JSON serializable representation of this comment's state that can be used for pasting.
Returns
WorkspaceCommentCopyData | null
Implementation of
showContextMenu()
showContextMenu(e): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:293
Show a context menu for this comment.
Parameters
| Parameter | Type |
|---|---|
e | Event |
Returns
void
Implementation of
snapToGrid()
snapToGrid(): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:321
Snap this comment to the nearest grid point.
Returns
void
getEditorFocusableNode()
getEditorFocusableNode(): IFocusableNode;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:335
Returns
The FocusableNode representing the editor portion of this comment.
getFocusableElement()
getFocusableElement(): HTMLElement | SVGElement;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:340
See IFocusableNode.getFocusableElement.
Returns
HTMLElement | SVGElement
Implementation of
IFocusableNode.getFocusableElement
getFocusableTree()
getFocusableTree(): IFocusableTree;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:345
See IFocusableNode.getFocusableTree.
Returns
Implementation of
IFocusableNode.getFocusableTree
onNodeFocus()
onNodeFocus(): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:350
See IFocusableNode.onNodeFocus.
Returns
void
Implementation of
onNodeBlur()
onNodeBlur(): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:358
See IFocusableNode.onNodeBlur.
Returns
void
Implementation of
canBeFocused()
canBeFocused(): boolean;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:363
See IFocusableNode.canBeFocused.
Returns
boolean
Implementation of
performAction()
performAction(): void;
Defined in: packages/blockly/core/comments/rendered_workspace_comment.ts:371
Handles the user acting on this comment via keyboard navigation. Expands the comment and focuses its editor.
Returns
void
Implementation of
getText()
getText(): string;
Defined in: packages/blockly/core/comments/workspace_comment.ts:105
Returns the text of the comment.
Returns
string
Inherited from
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
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
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
| Parameter | Type |
|---|---|
movable | boolean |
Returns
void
Inherited from
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
setDeletable()
setDeletable(deletable): void;
Defined in: packages/blockly/core/comments/workspace_comment.ts:184
Sets whether the comment is deletable or not.
Parameters
| Parameter | Type |
|---|---|
deletable | boolean |
Returns
void
Inherited from
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
Inherited from
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
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
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