Methods
-
setCategory( commands [, category ] )
If no category specified, merge commands in generic category
.
else replace existent category (if exist) with this set of commands -
Description
If no category specified, merge commands in generic category
else replace existent category (if exist) with this set of commandsParameters
Name Type Attributes Default Description commands
Array.<PaletteCommand~Command> category
string | symbol <optional> '' Examples
// add commands to default context palette.setCategory([ { name: 'foo', description: 'log `foo` in console' action() { console.log('foo'); } } ]); // replace `Bar` context palette.setCategory([ { name: 'foo', description: 'log `foo` in console' action() { console.log('foo'); } } ], 'Bar');
Details
-
removeCategory( category )
-
Parameters
Name Type Description category
string | symbol Details
-
addToCategory( commands [, category ] )
Add list (or single) Command to the category
. -
Description
Add list (or single) Command to the category
Parameters
Name Type Attributes Default Description commands
PaletteCommand~Command | Array.<PaletteCommand~Command> category
string | symbol <optional> '' Generic category if not specified
Details
-
show()
lazy load the command palette and display it
. -
Description
lazy load the command palette and display it
Details
-
hide()
lazy load the command palette and hide it
. -
Description
lazy load the command palette and hide it
Details
-
isShow() → {boolean}
lazy load the command palette and return if it display
. -
Description
lazy load the command palette and return if it display
Returns
Details
-
isHide() → {boolean}
lazy load the command palette and return if it not display
. -
Description
lazy load the command palette and return if it not display
Returns
Details
-
next()
lazy load the palette
.
and select next item in command list -
Description
lazy load the palette
and select next item in command listDetails
-
prev()
lazy load the palette
.
and select previous item in command list -
Description
lazy load the palette
and select previous item in command listDetails
-
search( text )
lazy load palette
.
and hide items whose not respect the fuzzySearch terms -
Description
lazy load palette
and hide items whose not respect the fuzzySearch termsParameters
Name Type Description text
string Details
-
dispatch()
lazy load palette
.
and run selected command -
Description
lazy load palette
and run selected commandDetails
-
destroy()
Remove PaletteCommand from DOM
. -
Description
Remove PaletteCommand from DOM
Details
Type Definitions
-
Command
-
Properties
Name Type Attributes Description name
string | symbol Name of command (print in palette after category name)
description
string <optional> Detail text for explain action of command
action
function Callback when user press
Enter
on command when selectedDetails
-
ConstructorOptionsNavigation( event )
-
Parameters
Name Type Description event
KeyboardEvent keypress event from document
Details
-
ConstructorOptions
-
Properties
Name Type Attributes Description cssClass
string <optional> add if you want stylize the palette with your own css ;-)
isShortcut
PaletteCommand~ConstructorOptionsShortcut <optional> take a KeyboardEvent and return if right shortcut, by default the shortcut is ctrl-alt-p
navigationCallback
PaletteCommand~ConstructorOptionsNavigation <optional> take a KeyboardEvent and execute your navigation
Details
-
ConstructorOptionsShortcut( event ) → {boolean}