Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: custom block context menus #5976

Merged
merged 2 commits into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ class Block {
*/
this.saveConnections = undefined;

/**
* An optional method for defining custom block context menu items.
* @type {undefined|?function(!Array<!Object>)}
*/
this.customContextMenu = undefined;

/**
* An optional property for suppressing adding STATEMENT_PREFIX and
* STATEMENT_SUFFIX to generated code.
Expand Down
10 changes: 2 additions & 8 deletions core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class BlockSvg extends Block {
* mutation dialog button and UI to appear.
* @type {undefined|?function(WorkspaceSvg):!BlockSvg}
*/
this.decompose = undefined;
this.decompose;

/**
* An optional method called when a mutator dialog saves its content.
Expand All @@ -119,13 +119,7 @@ class BlockSvg extends Block {
* method for the default mutation dialog button and UI to appear.
* @type {undefined|?function(!BlockSvg)}
*/
this.compose = undefined;

/**
* An optional method for defining custom block context menu items.
* @type {undefined|?function(!Array<!Object>)}
*/
this.customContextMenu = undefined;
this.compose;

/**
* An property used internally to reference the block's rendering debugger.
Expand Down