Skip to content

BlockSuite API Documentation / @blocksuite/affine-widget-keyboard-toolbar

@blocksuite/affine-widget-keyboard-toolbar

Classes

AffineKeyboardToolbarWidget

Extends

Constructors

Other

config
Get Signature

get config(): object

Returns

object

items

items: KeyboardToolbarItem[]

keyboard
Get Signature

get keyboard(): VirtualKeyboardProviderWithAction & object

Returns

VirtualKeyboardProviderWithAction & object

connectedCallback()

connectedCallback(): void

Invoked when the component is added to the document's DOM.

In connectedCallback() you should setup tasks that should only occur when the element is connected to the document. The most common of these is adding event listeners to nodes external to the element, like a keydown event handler added to the window.

ts
connectedCallback() {
  super.connectedCallback();
  addEventListener('keydown', this._handleKeydown);
}

Typically, anything done in connectedCallback() should be undone when the element is disconnected, in disconnectedCallback().

Returns

void

Overrides

WidgetComponent.connectedCallback

render()

render(): TemplateResult<1> | typeof nothing

Invoked on each update to perform rendering tasks. This method may return any value renderable by lit-html's ChildPart - typically a TemplateResult. Setting properties inside this method will not trigger the element to update.

Returns

TemplateResult<1> | typeof nothing

Overrides

WidgetComponent.render

attributes

controllers

dev-mode

lifecycle

properties

rendering

styles

updates

Type Aliases

DynamicKeyboardToolPanelGroup()

DynamicKeyboardToolPanelGroup = (ctx) => KeyboardToolPanelGroup | null

Parameters

ctx

KeyboardToolbarContext

Returns

KeyboardToolPanelGroup | null


KeyboardIconType

KeyboardIconType = TemplateResult | (ctx) => TemplateResult


KeyboardSubToolbarConfig

KeyboardSubToolbarConfig = object

Properties

autoShow()?

optional autoShow: (ctx) => Signal<boolean>

It will enter this sub-toolbar when the condition is met.

Parameters
ctx

KeyboardToolbarContext

Returns

Signal<boolean>

icon

icon: KeyboardIconType

items

items: KeyboardToolbarItem[]


KeyboardToolbarActionItem

KeyboardToolbarActionItem = object

Properties

action()?

optional action: (ctx) => void | Promise<void>

Parameters
ctx

KeyboardToolbarContext

Returns

void | Promise<void>

Description

The action to be executed when the item is clicked.

background?

optional background: string | (ctx) => string | undefined

disableWhen()?

optional disableWhen: (ctx) => boolean

Parameters
ctx

KeyboardToolbarContext

Returns

boolean

Default
ts
false
Description

Whether to set the item as disabled status.

icon

icon: KeyboardIconType

name

name: string

showWhen()?

optional showWhen: (ctx) => boolean

Parameters
ctx

KeyboardToolbarContext

Returns

boolean

Default
ts
true
Description

Whether to show the item in the toolbar.


KeyboardToolbarConfig

KeyboardToolbarConfig = object

Properties

items

items: KeyboardToolbarItem[]


KeyboardToolbarContext

KeyboardToolbarContext = object

Properties

closeToolPanel()

closeToolPanel: () => void

Close current tool panel and show virtual keyboard

Returns

void

rootComponent

rootComponent: BlockComponent

std

std: BlockStdScope


KeyboardToolbarItem

KeyboardToolbarItem = KeyboardToolbarActionItem | KeyboardSubToolbarConfig | KeyboardToolPanelConfig


KeyboardToolPanelConfig

KeyboardToolPanelConfig = object

Properties

activeBackground?

optional activeBackground: string

activeIcon?

optional activeIcon: KeyboardIconType

groups

groups: (KeyboardToolPanelGroup | DynamicKeyboardToolPanelGroup)[]

icon

icon: KeyboardIconType


KeyboardToolPanelGroup

KeyboardToolPanelGroup = object

Properties

items

items: KeyboardToolbarActionItem[]

name

name: string

Variables

AFFINE_KEYBOARD_TOOLBAR_WIDGET

const AFFINE_KEYBOARD_TOOLBAR_WIDGET: "affine-keyboard-toolbar-widget" = 'affine-keyboard-toolbar-widget'


defaultKeyboardToolbarConfig

const defaultKeyboardToolbarConfig: KeyboardToolbarConfig


KeyboardToolbarConfigExtension

const KeyboardToolbarConfigExtension: ConfigFactory<Partial<KeyboardToolbarConfig>>


keyboardToolbarWidget

const keyboardToolbarWidget: ExtensionType