Skip to main content

Class: WorkspaceComment

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

Extended by

Properties index

PropertyDescription
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.
workspaceThe workspace to construct the comment in.

Methods index

MethodDescription
setTextSets the text of the comment.
getTextReturns the text of the comment.
setSizeSets the comment's size in workspace units.
getSizeReturns the comment's size in workspace units.
setCollapsedSets whether the comment is collapsed or not.
isCollapsedReturns whether the comment is collapsed or not.
setEditableSets whether the comment is editable 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.
isMovableReturns whether the comment is movable or not, respecting whether the workspace is read-only.
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.
moveToMoves the comment to the given location in workspace coordinates.
getRelativeToSurfaceXYReturns the position of the comment in workspace coordinates.
disposeDisposes of this comment.
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 WorkspaceComment(workspace, id?): WorkspaceComment;

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

Constructs the comment.

Parameters

ParameterTypeDescription
workspaceWorkspaceThe workspace to construct the comment in.
id?stringAn optional ID to give to the comment. If not provided, one will be generated.

Returns

WorkspaceComment

Properties

id

readonly id: string;

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

The unique identifier for this comment.


location

protected location: Coordinate;

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

The location of the comment in workspace coordinates.


disposed

protected disposed: boolean = false;

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

Whether this comment has been disposed or not.


disposing

protected disposing: boolean = false;

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

Whether this comment is being disposed or not.


workspace

readonly workspace: Workspace;

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

The workspace to construct the comment in.

Methods

setText()

setText(text): void;

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

Sets the text of the comment.

Parameters

ParameterType
textstring

Returns

void


getText()

getText(): string;

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

Returns the text of the comment.

Returns

string


setSize()

setSize(size): void;

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

Sets the comment's size in workspace units.

Parameters

ParameterType
sizeSize

Returns

void


getSize()

getSize(): Size;

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

Returns the comment's size in workspace units.

Returns

Size


setCollapsed()

setCollapsed(collapsed): void;

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

Sets whether the comment is collapsed or not.

Parameters

ParameterType
collapsedboolean

Returns

void


isCollapsed()

isCollapsed(): boolean;

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

Returns whether the comment is collapsed or not.

Returns

boolean


setEditable()

setEditable(editable): void;

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

Sets whether the comment is editable or not.

Parameters

ParameterType
editableboolean

Returns

void


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


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


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


isMovable()

isMovable(): boolean;

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

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

Returns

boolean


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


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


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


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


moveTo()

moveTo(location, reason?): void;

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

Moves the comment to the given location in workspace coordinates.

Parameters

ParameterType
locationCoordinate
reason?string[]

Returns

void


getRelativeToSurfaceXY()

getRelativeToSurfaceXY(): Coordinate;

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

Returns the position of the comment in workspace coordinates.

Returns

Coordinate


dispose()

dispose(): void;

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

Disposes of this comment.

Returns

void


isDisposed()

isDisposed(): boolean;

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

Returns whether the comment has been disposed or not.

Returns

boolean


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