Skip to main content

Class: ToolboxSeparator

Defined in: packages/blockly/core/toolbox/separator.ts:26

Class for a toolbox separator. This is the thin visual line that appears on the toolbox. This item is not interactable.

Extends​

Properties index​

PropertyDescription
registrationNameName used for registering a toolbox separator.
cssConfig_All the CSS class names that are used to create a separator.
id_-
parent_-
level_-
toolboxItemDef_-
workspace_-
parentToolbox_The toolbox this category belongs to.

Methods index​

MethodDescription
initInitializes the toolbox item. This includes creating the DOM and updating the state of any items based on the info object.
createDom_Creates the DOM for a separator.
getDivGets the div for the toolbox item.
disposeDispose of this toolbox item. No-op by default.
canBeFocusedPrevents separator toolbox items from gaining focus.
getClickTargetGets the HTML element that is clickable. The parent toolbox element receives clicks. The parent toolbox will add an ID to this element so it can pass the onClick event to the correct toolboxItem.
getIdGets a unique identifier for this toolbox item.
getParentGets the parent if the toolbox item is nested.
isSelectableWhether the toolbox item is selectable.
isCollapsibleWhether the toolbox item is collapsible.
setVisible_Sets whether the category is visible or not. For a category to be visible its parent category must also be expanded.
getFocusableElementSee IFocusableNode.getFocusableElement.
getFocusableTreeSee IFocusableNode.getFocusableTree.
onNodeFocusSee IFocusableNode.onNodeFocus.
onNodeBlurSee IFocusableNode.onNodeBlur.
getParentToolboxReturns the toolbox this toolbox item belongs to.

Constructors​

Constructor​

new ToolboxSeparator(separatorDef, toolbox): ToolboxSeparator;

Defined in: packages/blockly/core/toolbox/separator.ts:39

Parameters​

ParameterTypeDescription
separatorDefSeparatorInfoThe information needed to create a separator.
toolboxIToolboxThe parent toolbox for the separator.

Returns​

ToolboxSeparator

Overrides​

ToolboxItem.constructor

Properties​

registrationName​

static registrationName: string = 'sep';

Defined in: packages/blockly/core/toolbox/separator.ts:28

Name used for registering a toolbox separator.


cssConfig_​

protected cssConfig_: CssConfig;

Defined in: packages/blockly/core/toolbox/separator.ts:31

All the CSS class names that are used to create a separator.


id_​

protected id_: string;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:26

Inherited from​

ToolboxItem.id_


parent_​

protected parent_:
| ICollapsibleToolboxItem
| null;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:27

Inherited from​

ToolboxItem.parent_


level_​

protected level_: number;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:28

Inherited from​

ToolboxItem.level_


toolboxItemDef_​

protected toolboxItemDef_:
| ToolboxItemInfo
| null;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:29

Inherited from​

ToolboxItem.toolboxItemDef_


workspace_​

protected workspace_: WorkspaceSvg;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:30

Inherited from​

ToolboxItem.workspace_


parentToolbox_​

protected readonly parentToolbox_: IToolbox;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:32

The toolbox this category belongs to.

Inherited from​

ToolboxItem.parentToolbox_

Methods​

init()​

init(): void;

Defined in: packages/blockly/core/toolbox/separator.ts:47

Initializes the toolbox item. This includes creating the DOM and updating the state of any items based on the info object.

Returns​

void

Overrides​

ToolboxItem.init


createDom_()​

protected createDom_(): HTMLDivElement;

Defined in: packages/blockly/core/toolbox/separator.ts:56

Creates the DOM for a separator.

Returns​

HTMLDivElement

The parent element for the separator.


getDiv()​

getDiv(): HTMLDivElement;

Defined in: packages/blockly/core/toolbox/separator.ts:68

Gets the div for the toolbox item.

Returns​

HTMLDivElement

The div for the toolbox item.

Overrides​

ToolboxItem.getDiv


dispose()​

dispose(): void;

Defined in: packages/blockly/core/toolbox/separator.ts:72

Dispose of this toolbox item. No-op by default.

Returns​

void

Overrides​

ToolboxItem.dispose


canBeFocused()​

canBeFocused(): boolean;

Defined in: packages/blockly/core/toolbox/separator.ts:79

Prevents separator toolbox items from gaining focus.

Returns​

boolean

Overrides​

ToolboxItem.canBeFocused


getClickTarget()​

getClickTarget(): Element | null;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:91

Gets the HTML element that is clickable. The parent toolbox element receives clicks. The parent toolbox will add an ID to this element so it can pass the onClick event to the correct toolboxItem.

Returns​

Element | null

The HTML element that receives clicks, or null if this item should not receive clicks.

Inherited from​

ToolboxItem.getClickTarget


getId()​

getId(): string;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:100

Gets a unique identifier for this toolbox item.

Returns​

string

The ID for the toolbox item.

Inherited from​

ToolboxItem.getId


getParent()​

getParent():
| ICollapsibleToolboxItem
| null;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:110

Gets the parent if the toolbox item is nested.

Returns​

| ICollapsibleToolboxItem | null

The parent toolbox item, or null if this toolbox item is not nested.

Inherited from​

ToolboxItem.getParent


isSelectable()​

isSelectable(): boolean;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:129

Whether the toolbox item is selectable.

Returns​

boolean

True if the toolbox item can be selected.

Inherited from​

ToolboxItem.isSelectable


isCollapsible()​

isCollapsible(): boolean;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:138

Whether the toolbox item is collapsible.

Returns​

boolean

True if the toolbox item is collapsible.

Inherited from​

ToolboxItem.isCollapsible


setVisible_()​

setVisible_(_isVisible): void;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:151

Sets whether the category is visible or not. For a category to be visible its parent category must also be expanded.

Parameters​

ParameterTypeDescription
_isVisiblebooleanTrue if category should be visible.

Returns​

void

Inherited from​

ToolboxItem.setVisible_


getFocusableElement()​

getFocusableElement(): HTMLElement | SVGElement;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:154

See IFocusableNode.getFocusableElement.

Returns​

HTMLElement | SVGElement

Inherited from​

ToolboxItem.getFocusableElement


getFocusableTree()​

getFocusableTree(): IFocusableTree;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:166

See IFocusableNode.getFocusableTree.

Returns​

IFocusableTree

Inherited from​

ToolboxItem.getFocusableTree


onNodeFocus()​

onNodeFocus(): void;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:171

See IFocusableNode.onNodeFocus.

Returns​

void

Inherited from​

ToolboxItem.onNodeFocus


onNodeBlur()​

onNodeBlur(): void;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:181

See IFocusableNode.onNodeBlur.

Returns​

void

Inherited from​

ToolboxItem.onNodeBlur


getParentToolbox()​

getParentToolbox(): IToolbox;

Defined in: packages/blockly/core/toolbox/toolbox_item.ts:191

Returns the toolbox this toolbox item belongs to.

Returns​

IToolbox

Inherited from​

ToolboxItem.getParentToolbox