Class: Modal
Defined in: index.js:21
Class responsible for creating a Blockly modal.
Properties index
| Property | Description |
|---|---|
| shouldCloseOnEsc | If true close the modal when the user hits escape. Otherwise, do not close on escape. |
| shouldCloseOnOverlayClick | If 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
| Method | Description |
|---|---|
| addEvent_ | Helper method for adding an event. |
| dispose | Disposes of this modal. Unlink from all DOM elements and remove all event listeners to prevent memory leaks. |
| hide | Hide the Blockly modal. |
| init | Initialize a Blockly modal. |
| onCancel_ | The function to be called when the user hits the 'x' button. |
| render | Create 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. |
| show | Shows 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
| Parameter | Type | Description |
|---|---|---|
title | string | The title for the modal. |
workspace | WorkspaceSvg | The 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
| Parameter | Type | Description |
|---|---|---|
node | Element | Node upon which to listen. |
name | string | Event name to listen to (e.g. 'mousedown'). |
thisObject | Object | The value of 'this' in the function. |
func | Function | Function 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
| Parameter | Type | Description |
|---|---|---|
_contentContainer | HTMLDivElement | The modal's content div. |
Returns
void
renderFooter_()
protected renderFooter_(_footerContainer): void;
Defined in: index.js:340
Render content for the modal footer.
Parameters
| Parameter | Type | Description |
|---|---|---|
_footerContainer | HTMLElement | The modal's footer div. |
Returns
void
renderHeader_()
protected renderHeader_(headerContainer): void;
Defined in: index.js:319
Render content for the modal header.
Parameters
| Parameter | Type | Description |
|---|---|---|
headerContainer | HTMLElement | The 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