2020-10-15 16:08:01 +01:00
<!doctype html>
< html class = "default no-js" >
< head >
< meta charset = "utf-8" >
< meta http-equiv = "X-UA-Compatible" content = "IE=edge" >
< title > Command | Joplin Plugin API Documentation< / title >
< meta name = "description" content = "Documentation for Joplin Plugin API Documentation" >
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
< link rel = "stylesheet" href = "../assets/css/main.css" >
< / head >
< body >
< header >
< div class = "tsd-page-toolbar" >
< div class = "container" >
< div class = "table-wrap" >
< div class = "table-cell" id = "tsd-search" data-index = "../assets/js/search.json" data-base = ".." >
< div class = "field" >
< label for = "tsd-search-field" class = "tsd-widget search no-caption" > Search< / label >
< input id = "tsd-search-field" type = "text" / >
< / div >
< ul class = "results" >
< li class = "state loading" > Preparing search index...< / li >
< li class = "state failure" > The search index is not available< / li >
< / ul >
< a href = "../classes/joplin.html" class = "title" > Joplin Plugin API Documentation< / a >
< / div >
< div class = "table-cell" id = "tsd-widgets" >
< div id = "tsd-filter" >
< a href = "#" class = "tsd-widget options no-caption" data-toggle = "options" > Options< / a >
< div class = "tsd-filter-group" >
< div class = "tsd-select" id = "tsd-filter-visibility" >
< span class = "tsd-select-label" > All< / span >
< ul class = "tsd-select-list" >
< li data-value = "public" > Public< / li >
< li data-value = "protected" > Public/Protected< / li >
< li data-value = "private" class = "selected" > All< / li >
< / ul >
< / div >
< input type = "checkbox" id = "tsd-filter-inherited" checked / >
< label class = "tsd-widget" for = "tsd-filter-inherited" > Inherited< / label >
< / div >
< / div >
< a href = "#" class = "tsd-widget menu no-caption" data-toggle = "menu" > Menu< / a >
< / div >
< / div >
< / div >
< / div >
< div class = "tsd-page-title" >
< div class = "container" >
< ul class = "tsd-breadcrumb" >
<!--
< li >
< a href = "../globals.html" > Globals< / a >
< / li >
-->
< li >
< a href = "command.html" > Command< / a >
< / li >
< / ul >
< h1 > <!-- Interface --> Command< / h1 >
< / div >
< / div >
< / header >
< div class = "container container-main" >
< div class = "row" >
< div class = "col-8 col-content" >
<!--
< section class = "tsd-panel tsd-hierarchy" >
< h3 > Hierarchy< / h3 >
< ul class = "tsd-hierarchy" >
< li >
< span class = "target" > Command< / span >
< / li >
< / ul >
< / section >
-->
< section class = "tsd-panel-group tsd-index-group" >
< h2 > Index< / h2 >
< section class = "tsd-panel tsd-index-panel" >
< div class = "tsd-index-content" >
< section class = "tsd-index-section " >
< h3 > Properties< / h3 >
< ul class = "tsd-index-list" >
2020-10-21 00:27:11 +01:00
< li class = "tsd-kind-property tsd-parent-kind-interface" > < a href = "command.html#enabledcondition" class = "tsd-kind-icon" > enabled< wbr > Condition< / a > < / li >
2020-10-15 16:08:01 +01:00
< li class = "tsd-kind-property tsd-parent-kind-interface" > < a href = "command.html#iconname" class = "tsd-kind-icon" > icon< wbr > Name< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-interface" > < a href = "command.html#label" class = "tsd-kind-icon" > label< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-interface" > < a href = "command.html#name" class = "tsd-kind-icon" > name< / a > < / li >
< / ul >
< / section >
< section class = "tsd-index-section " >
< h3 > Methods< / h3 >
< ul class = "tsd-index-list" >
< li class = "tsd-kind-method tsd-parent-kind-interface" > < a href = "command.html#execute" class = "tsd-kind-icon" > execute< / a > < / li >
< / ul >
< / section >
< / div >
< / section >
< / section >
< section class = "tsd-panel-group tsd-member-group " >
< h2 > Properties< / h2 >
2020-10-21 00:27:11 +01:00
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface" >
< a name = "enabledcondition" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagOptional" > Optional< / span > enabled< wbr > Condition< / h3 >
< div class = "tsd-signature tsd-kind-icon" > enabled< wbr > Condition< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > string< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Defines whether the command should be enabled or disabled, which in turns affects
the enabled state of any associated button or menu item.< / p >
< / div >
< p > The condition should be expressed as a " when-clause" (as in Visual Studio Code). It' s a simple boolean expression that evaluates to
< code > true< / code > or < code > false< / code > . It supports the following operators:< / p >
< table >
< thead >
< tr >
< th > Operator< / th >
< th > Symbol< / th >
< th > Example< / th >
< / tr >
< / thead >
< tbody > < tr >
< td > Equality< / td >
< td > ==< / td >
< td > " editorType == markdown" < / td >
< / tr >
< tr >
< td > Inequality< / td >
< td > !=< / td >
< td > " currentScreen != config" < / td >
< / tr >
< tr >
< td > Or< / td >
< td > ||< / td >
< td > " noteIsTodo || noteTodoCompleted" < / td >
< / tr >
< tr >
< td > And< / td >
< td > & & < / td >
< td > " oneNoteSelected & & !inConflictFolder" < / td >
< / tr >
< / tbody > < / table >
2020-11-06 21:52:57 +00:00
< p > Currently the supported context variables aren' t documented, but you can < a href = "https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/services/commands/stateToWhenClauseContext.ts" > find the list here< / a > .< / p >
2020-10-21 00:27:11 +01:00
< p > Note: Commands are enabled by default unless you use this property.< / p >
< / div >
< / section >
2020-10-15 16:08:01 +01:00
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface" >
< a name = "iconname" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagOptional" > Optional< / span > icon< wbr > Name< / h3 >
< div class = "tsd-signature tsd-kind-icon" > icon< wbr > Name< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > string< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
2020-10-21 00:27:11 +01:00
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Icon to be used on toolbar buttons for example< / p >
< / div >
< / div >
2020-10-15 16:08:01 +01:00
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface" >
< a name = "label" class = "tsd-anchor" > < / a >
2020-10-21 00:56:03 +01:00
< h3 > < span class = "tsd-flag ts-flagOptional" > Optional< / span > label< / h3 >
2020-10-15 16:08:01 +01:00
< div class = "tsd-signature tsd-kind-icon" > label< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > string< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
2020-10-21 00:27:11 +01:00
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
2020-10-21 00:56:03 +01:00
< p > Label to be displayed on menu items or keyboard shortcut editor for example.
If it is missing, it' s assumed it' s a private command, to be called programmatically only.
In that case the command will not appear in the shortcut editor or command panel, and logically
should not be used as a menu item.< / p >
2020-10-21 00:27:11 +01:00
< / div >
< / div >
2020-10-15 16:08:01 +01:00
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface" >
< a name = "name" class = "tsd-anchor" > < / a >
< h3 > name< / h3 >
< div class = "tsd-signature tsd-kind-icon" > name< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > string< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
2020-10-21 00:27:11 +01:00
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Name of command - must be globally unique< / p >
< / div >
< / div >
2020-10-15 16:08:01 +01:00
< / section >
< / section >
< section class = "tsd-panel-group tsd-member-group " >
< h2 > Methods< / h2 >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface" >
< a name = "execute" class = "tsd-anchor" > < / a >
< h3 > execute< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-interface" >
2020-10-21 00:56:03 +01:00
< li class = "tsd-signature tsd-kind-icon" > execute< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
2020-10-15 16:08:01 +01:00
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< / aside >
2020-10-21 00:27:11 +01:00
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
2020-10-21 00:56:03 +01:00
< p > Code to be ran when the command is executed. It may return a result.< / p >
2020-10-21 00:27:11 +01:00
< / div >
< / div >
2020-10-15 16:08:01 +01:00
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
2020-10-21 00:56:03 +01:00
< h5 > < span class = "tsd-flag ts-flagRest" > Rest< / span > < span class = "tsd-signature-symbol" > ...< / span > args: < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
2020-10-15 16:08:01 +01:00
< / li >
< / ul >
<!-- JOPLINCHANGE
2020-10-21 00:56:03 +01:00
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
2020-10-15 16:08:01 +01:00
-->
< / li >
< / ul >
< / section >
< / section >
< / div >
< div class = "col-4 col-menu menu-sticky-wrap menu-highlight" >
<!--
< nav class = "tsd-navigation primary" >
< ul >
< li class = "globals " >
< a href = "../globals.html" > < em > Globals< / em > < / a >
< / li >
< / ul >
< / nav >
-->
< nav class = "tsd-navigation secondary menu-sticky" >
< ul class = "before-current" >
2020-10-21 00:27:11 +01:00
< li class = " tsd-kind-enum" >
< a href = "../enums/contentscripttype.html" class = "tsd-kind-icon" > ContentScriptType< / a >
< / li >
2020-10-15 16:08:01 +01:00
< li class = " tsd-kind-enum" >
< a href = "../enums/filesystemitem.html" class = "tsd-kind-icon" > FileSystemItem< / a >
< / li >
< li class = " tsd-kind-enum" >
< a href = "../enums/importmoduleoutputformat.html" class = "tsd-kind-icon" > ImportModuleOutputFormat< / a >
< / li >
< li class = " tsd-kind-enum" >
< a href = "../enums/menuitemlocation.html" class = "tsd-kind-icon" > MenuItemLocation< / a >
< / li >
< li class = " tsd-kind-enum" >
< a href = "../enums/settingitemtype.html" class = "tsd-kind-icon" > SettingItemType< / a >
< / li >
< li class = " tsd-kind-enum" >
< a href = "../enums/toolbarbuttonlocation.html" class = "tsd-kind-icon" > ToolbarButtonLocation< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplin.html" class = "tsd-kind-icon" > joplin< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplincommands.html" class = "tsd-kind-icon" > joplin.commands< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplindata.html" class = "tsd-kind-icon" > joplin.data< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplininterop.html" class = "tsd-kind-icon" > joplin.interop< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplinplugins.html" class = "tsd-kind-icon" > joplin.plugins< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplinsettings.html" class = "tsd-kind-icon" > joplin.settings< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplinviews.html" class = "tsd-kind-icon" > joplin.views< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplinviewsdialogs.html" class = "tsd-kind-icon" > joplin.views.dialogs< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplinviewsmenuitems.html" class = "tsd-kind-icon" > joplin.views.menuItems< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplinviewsmenus.html" class = "tsd-kind-icon" > joplin.views.menus< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplinviewspanels.html" class = "tsd-kind-icon" > joplin.views.panels< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplinviewstoolbarbuttons.html" class = "tsd-kind-icon" > joplin.views.toolbarButtons< / a >
< / li >
< li class = " tsd-kind-class" >
< a href = "../classes/joplinworkspace.html" class = "tsd-kind-icon" > joplin.workspace< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "buttonspec.html" class = "tsd-kind-icon" > ButtonSpec< / a >
< / li >
< / ul >
< ul class = "current" >
< li class = "current tsd-kind-interface" >
< a href = "command.html" class = "tsd-kind-icon" > Command< / a >
< ul >
2020-10-21 00:27:11 +01:00
< li class = " tsd-kind-property tsd-parent-kind-interface" >
< a href = "command.html#enabledcondition" class = "tsd-kind-icon" > enabled< wbr > Condition< / a >
< / li >
2020-10-15 16:08:01 +01:00
< li class = " tsd-kind-property tsd-parent-kind-interface" >
< a href = "command.html#iconname" class = "tsd-kind-icon" > icon< wbr > Name< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-interface" >
< a href = "command.html#label" class = "tsd-kind-icon" > label< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-interface" >
< a href = "command.html#name" class = "tsd-kind-icon" > name< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-interface" >
< a href = "command.html#execute" class = "tsd-kind-icon" > execute< / a >
< / li >
< / ul >
< / li >
< / ul >
< ul class = "after-current" >
< li class = " tsd-kind-interface" >
< a href = "createmenuitemoptions.html" class = "tsd-kind-icon" > CreateMenuItemOptions< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "editorcommand.html" class = "tsd-kind-icon" > EditorCommand< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "exportcontext.html" class = "tsd-kind-icon" > ExportContext< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "exportmodule.html" class = "tsd-kind-icon" > ExportModule< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "exportoptions.html" class = "tsd-kind-icon" > ExportOptions< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "importcontext.html" class = "tsd-kind-icon" > ImportContext< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "importmodule.html" class = "tsd-kind-icon" > ImportModule< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "menuitem.html" class = "tsd-kind-icon" > MenuItem< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "script.html" class = "tsd-kind-icon" > Script< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "settingitem.html" class = "tsd-kind-icon" > SettingItem< / a >
< / li >
< li class = " tsd-kind-interface" >
< a href = "settingsection.html" class = "tsd-kind-icon" > SettingSection< / a >
< / li >
< li class = " tsd-kind-type-alias" >
< a href = "../globals.html#buttonid" class = "tsd-kind-icon" > ButtonId< / a >
< / li >
< li class = " tsd-kind-type-alias" >
< a href = "../globals.html#path" class = "tsd-kind-icon" > Path< / a >
< / li >
< li class = " tsd-kind-type-alias" >
< a href = "../globals.html#viewhandle" class = "tsd-kind-icon" > ViewHandle< / a >
< / li >
< / ul >
< / nav >
< / div >
< / div >
< / div >
<!-- JOPLINCHANGE
< footer class = "with-border-bottom" >
< div class = "container" >
< h2 > Legend< / h2 >
< div class = "tsd-legend-group" >
< ul class = "tsd-legend" >
< li class = "tsd-kind-property tsd-parent-kind-interface" > < span class = "tsd-kind-icon" > Property< / span > < / li >
< li class = "tsd-kind-method tsd-parent-kind-interface" > < span class = "tsd-kind-icon" > Method< / span > < / li >
< / ul >
< ul class = "tsd-legend" >
< li class = "tsd-kind-constructor tsd-parent-kind-class" > < span class = "tsd-kind-icon" > Constructor< / span > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < span class = "tsd-kind-icon" > Method< / span > < / li >
< / ul >
< / div >
< / div >
< / footer >
< div class = "container tsd-generator" >
< p > Generated using < a href = "https://typedoc.org/" target = "_blank" > TypeDoc< / a > < / p >
< / div >
-->
< div class = "overlay" > < / div >
< script src = "../assets/js/main.js" > < / script >
< / body >
< / html >