Property

currentBlock

static

Blockly.Block

Which block is the context menu attached to?

Methods

blockCommentOption

static

blockCommentOption(block) returns Object

Make a context menu option for adding or removing comments on the current block.

Parameter

block

Blockly.BlockSvg

The block where the right-click originated.

Value must not be null.

Returns

non-null Object A menu option, containing text, enabled, and a callback.

blockDeleteOption

static

blockDeleteOption(block) returns Object

Make a context menu option for deleting the current block.

Parameter

block

Blockly.BlockSvg

The block where the right-click originated.

Value must not be null.

Returns

non-null Object A menu option, containing text, enabled, and a callback.

blockDuplicateOption

static

blockDuplicateOption(block) returns Object

Make a context menu option for duplicating the current block.

Parameter

block

Blockly.BlockSvg

The block where the right-click originated.

Value must not be null.

Returns

non-null Object A menu option, containing text, enabled, and a callback.

blockHelpOption

static

blockHelpOption(block) returns Object

Make a context menu option for showing help for the current block.

Parameter

block

Blockly.BlockSvg

The block where the right-click originated.

Value must not be null.

Returns

non-null Object A menu option, containing text, enabled, and a callback.

callbackFactory

static

callbackFactory(block, xml) returns function()

Create a callback function that creates and configures a block, then places the new block next to the original.

Parameter

block

Blockly.Block

Original block.

Value must not be null.

xml

Element

XML representation of new block.

Value must not be null.

Returns

non-null function() Function that creates a block.

commentDeleteOption

static

commentDeleteOption(comment) returns Object

Make a context menu option for deleting the current workspace comment.

Parameter

comment

Blockly.WorkspaceCommentSvg

The workspace comment where the right-click originated.

Value must not be null.

Returns

non-null Object A menu option, containing text, enabled, and a callback.

commentDuplicateOption

static

commentDuplicateOption(comment) returns Object

Make a context menu option for duplicating the current workspace comment.

Parameter

comment

Blockly.WorkspaceCommentSvg

The workspace comment where the right-click originated.

Value must not be null.

Returns

non-null Object A menu option, containing text, enabled, and a callback.

hide

static

hide()

Hide the context menu.

show

static

show(e, options, rtl)

Construct the menu based on the list of options and show the menu.

Parameter

e

Event

Mouse event.

Value must not be null.

options

Array of non-null Object

Array of menu options.

Value must not be null.

rtl

boolean

True if RTL, false if LTR.

workspaceCommentOption

static

workspaceCommentOption(ws, e) returns Object

Make a context menu option for adding a comment on the workspace.

Parameter

ws

Blockly.WorkspaceSvg

The workspace where the right-click originated.

Value must not be null.

e

Event

The right-click mouse event.

Value must not be null.

Returns

non-null Object A menu option, containing text, enabled, and a callback.