Skip to main content

Class: Modal

Defined in: index.js:21

Class responsible for creating a Blockly modal.

Properties index​

PropertyDescription
shouldCloseOnEscIf true close the modal when the user hits escape. Otherwise, do not close on escape.
shouldCloseOnOverlayClickIf true close the modal when the user clicks outside the modal. Otherwise, only close when user hits the 'X' button or escape.
workspace_The workspace to display the modal over.

Methods index​

MethodDescription
addEvent_Helper method for adding an event.
disposeDisposes of this modal. Unlink from all DOM elements and remove all event listeners to prevent memory leaks.
hideHide the Blockly modal.
initInitialize a Blockly modal.
onCancel_The function to be called when the user hits the 'x' button.
renderCreate all the dom elements for the modal.
renderContent_Render content for the modal content div.
renderFooter_Render content for the modal footer.
renderHeader_Render content for the modal header.
showShows the Blockly modal and focus on the first focusable element.
widgetCreate_Add the Blockly modal to the widget div and position it properly.
widgetDispose_Disposes of any events or dom-references belonging to the editor.

Constructors​

Constructor​

new Modal(title, workspace): Modal;

Defined in: index.js:28

Constructor for creating a Blockly modal.

Parameters​

ParameterTypeDescription
titlestringThe title for the modal.
workspaceWorkspaceSvgThe workspace to display the modal over.

Returns​

Modal

Properties​

shouldCloseOnEsc​

shouldCloseOnEsc: boolean;

Defined in: index.js:83

If true close the modal when the user hits escape. Otherwise, do not close on escape.


shouldCloseOnOverlayClick​

shouldCloseOnOverlayClick: boolean;

Defined in: index.js:77

If true close the modal when the user clicks outside the modal. Otherwise, only close when user hits the 'X' button or escape.


workspace_​

protected workspace_: WorkspaceSvg;

Defined in: index.js:41

The workspace to display the modal over.

Methods​

addEvent_()​

protected addEvent_(
node,
name,
thisObject,
func
): void;

Defined in: index.js:228

Helper method for adding an event.

Parameters​

ParameterTypeDescription
nodeElementNode upon which to listen.
namestringEvent name to listen to (e.g. 'mousedown').
thisObjectObjectThe value of 'this' in the function.
funcFunctionFunction to call when event is triggered.

Returns​

void


dispose()​

dispose(): void;

Defined in: index.js:98

Disposes of this modal. Unlink from all DOM elements and remove all event listeners to prevent memory leaks.

Returns​

void


hide()​

hide(): void;

Defined in: index.js:138

Hide the Blockly modal.

Returns​

void


init()​

init(): void;

Defined in: index.js:89

Initialize a Blockly modal.

Returns​

void


onCancel_()​

protected onCancel_(): void;

Defined in: index.js:146

The function to be called when the user hits the 'x' button.

Returns​

void


render()​

render(): void;

Defined in: index.js:241

Create all the dom elements for the modal.

Returns​

void


renderContent_()​

protected renderContent_(_contentContainer): void;

Defined in: index.js:331

Render content for the modal content div.

Parameters​

ParameterTypeDescription
_contentContainerHTMLDivElementThe modal's content div.

Returns​

void


renderFooter_()​

protected renderFooter_(_footerContainer): void;

Defined in: index.js:340

Render content for the modal footer.

Parameters​

ParameterTypeDescription
_footerContainerHTMLElementThe modal's footer div.

Returns​

void


renderHeader_()​

protected renderHeader_(headerContainer): void;

Defined in: index.js:319

Render content for the modal header.

Parameters​

ParameterTypeDescription
headerContainerHTMLElementThe modal's header div.

Returns​

void


show()​

show(): void;

Defined in: index.js:111

Shows the Blockly modal and focus on the first focusable element.

Returns​

void


widgetCreate_()​

protected widgetCreate_(): void;

Defined in: index.js:154

Add the Blockly modal to the widget div and position it properly.

Returns​

void


widgetDispose_()​

protected widgetDispose_(): void;

Defined in: index.js:164

Disposes of any events or dom-references belonging to the editor.

Returns​

void