Skip to content

Commit

Permalink
Update Commands docs with the existing contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Nov 8, 2024
1 parent bee12b1 commit 23cd33f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ For example, when a user types "contact", the Command Palette needs to filter th

Static and dynamic commands can be contextual. This means that in a given context (for example, when navigating the Site Editor or editing a template), some specific commands are given more priority and are visible as soon as you open the Command Palette. Also, when typing the Command Palette, these contextual commands are shown above the rest of the commands.

At the moment, two contexts have been implemented:
At the moment, three contexts have been implemented:

- `site-editor`: This is the context that is set when you are navigating in the site editor (sidebar visible).
- `site-editor-edit`: This is the context that is set when you are editing a document (template, template part or page) in the site editor.
As the usage of the Command Palette expands, more contexts will be added.
- `entity-edit`: This is the context that is set when you are editing a document (template, template part or page).
- `block-selection-edit`: This is the context that is set when a block is selected.

As the usage of the Command Palette expands, more contexts will be added.

Attaching a command or command loader to a given context is as simple as adding the `context` property (with the right context value from the available contexts above) to the `useCommand` or `useCommandLoader` calls.

Expand Down

0 comments on commit 23cd33f

Please sign in to comment.