@fabwcie/free-drawing / components/CommandPalette
components/CommandPalette
Classes
CommandPalette
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:65
Command palette: search field and commands available now (tools, edition, view, file, language), arrow keys choose one, Enter or click runs it
Extends
Constructors
Constructor
new CommandPalette(
drawer):CommandPalette
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:83
Build the palette without header nor footer: search field, list of commands and empty message
Parameters
drawer
Drawer whose commands are listed and run
Returns
Overrides
Properties
$backdrop
$backdrop:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:53
Backdrop around the dialog (only with backdrop option), shown and hidden with it
Inherited from
$empty
$empty:
HTMLParagraphElement
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:71
Message shown when no command matches search
$input
$input:
HTMLInputElement
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:67
Search field (combobox): keeps focus, arrow keys choose an option, Enter runs it
$list
$list:
HTMLDivElement
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:69
List of options (listbox) of commands matching search, in their groups
$modal
$modal:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:41
Dialog element (role="dialog", aria-modal), holds header, body and footer
Inherited from
$modalBody
$modalBody:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:45
Body of the dialog: content of the dialog
Inherited from
$modalFooter
$modalFooter:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:47
Footer of the dialog: buttons of the dialog
Inherited from
$modalHeader
$modalHeader:
HTMLDivElement
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:43
Header of the dialog: title and close button, removed when showHeader option is false
Inherited from
commands
commands:
Command[] =[]
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:73
Commands available when palette was opened
drawer
drawer:
Drawer
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:51
Drawer the dialog belongs to
Inherited from
options
options:
ModalOptions
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:49
Options of the dialog, merged with default ones
Inherited from
Methods
_createOption()
private_createOption(command):HTMLDivElement
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:202
Option of a command: icon, label, check mark when checked, shortcut. Hover makes it active, click runs it
Parameters
command
Command shown by the option
Returns
HTMLDivElement
Option element (role="option"), added to its group by _render
_filter()
private_filter():void
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:150
Commands matching every word of search, in label, group or id
Returns
void
_getCommands()
private_getCommands():Command[]
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:279
Commands available now: widgets of toolbar, actions allowed (read only, selection, history), components shown (zoom, position, layers), states of toggles
Returns
Command[]
Available commands with the title of their group, in order of groups (tools, editor, view, file, language)
_onKeydown()
private_onKeydown(e):void
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:260
Keys of the search field: Down / Up move the active option (looping), Enter runs it
Parameters
e
KeyboardEvent
Keydown of the search field (ignored during composition)
Returns
void
_render()
private_render():void
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:164
Options of shown commands, in their groups, first one active
Returns
void
_setActive()
private_setActive(index):void
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:242
Active option (aria-selected, aria-activedescendant of the field), scrolled into view
Parameters
index
number
Index in shown commands, none active when out of them
Returns
void
appendBodyContent()
appendBodyContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:272
Adds text at the end of the body (as text, not parsed as HTML)
Parameters
content
string
Text added after the body content
Returns
void
Inherited from
destroy()
destroy():
void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:346
Hides the dialog and removes it from the page
Returns
void
Inherited from
execute()
execute(
command):void
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:142
Close palette (focus back in drawer), then run command
Parameters
command
Command chosen (Enter or click)
Returns
void
hide()
hide():
void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:318
Hides the dialog and gives focus back to the element which opened it, else to the drawer, unless an element out of the drawer took it (field of the page or another drawer clicked)
Returns
void
Inherited from
isVisible()
isVisible():
boolean
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:339
Whether the dialog is shown
Returns
boolean
True while the dialog is shown
Inherited from
keepFocus()
protectedkeepFocus(...$preferred):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:195
Focus kept in the dialog when an update hid or disabled its focused element (its own button: start, stop...): on the first reachable of the given elements, else on the first element of the dialog, never on the page behind it
Parameters
$preferred
...HTMLElement[]
Elements to focus, in order of preference
Returns
void
Inherited from
setBodyContent()
setBodyContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:264
Replaces the body with an HTML string
Parameters
content
string
HTML markup of the body, empty to clear it
Returns
void
Inherited from
setFooterContent()
setFooterContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:280
Replaces the footer with an HTML string
Parameters
content
string
HTML markup of the footer (buttons), empty to clear it
Returns
void
Inherited from
setHeaderContent()
setHeaderContent(
content):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:254
Replaces the header with an HTML string (an empty string keeps the current header)
Parameters
content
string
HTML markup of the header
Returns
void
Inherited from
setTitle()
setTitle(
title):void
Defined in: packages/free-drawing/src/components/Modal/Modal.ts:108
Title in header
Parameters
title
string
Text of the title (nothing without header)
Returns
void
Inherited from
show()
show():
void
Defined in: packages/free-drawing/src/components/CommandPalette/CommandPalette.ts:131
Show palette with commands available now, search field empty
Returns
void