Skip to content

Commit 7c177b1

Browse files
authored
Merge pull request #7265 from hifi-phil/cms/workspace-extensions
Cms/workspace extensions
2 parents 0c15865 + 58e37b6 commit 7c177b1

File tree

11 files changed

+999
-202
lines changed

11 files changed

+999
-202
lines changed

16/umbraco-cms/.gitbook.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,5 @@ redirects:
145145
extending/content-apps: customizing/extending-overview/extension-types/workspaces/workspace-views.md
146146
extending/backoffice-setup/extension-types: customizing/extending-overview/extension-types/README.md
147147
customizing/extending-overview/extension-registry/extension-registry: customizing/extending-overview/extension-registry/register-extensions.md
148+
customizing/extending-overview/extension-types/workspaces/workspace-action-menu-item: customizing/extending-overview/extension-types/workspaces/workspace-action-menu-items.md
149+
customizing/extending-overview/extension-types/workspaces/workspace-footer-app: customizing/extending-overview/extension-types/workspaces/workspace-footer-apps.md

16/umbraco-cms/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@
184184
* [Trees](customizing/extending-overview/extension-types/tree.md)
185185
* [Workspaces](customizing/extending-overview/extension-types/workspaces/README.md)
186186
* [Workspace Actions](customizing/extending-overview/extension-types/workspaces/workspace-editor-actions.md)
187+
* [Workspace Action Menu Items](customizing/extending-overview/extension-types/workspaces/workspace-action-menu-items.md)
187188
* [Workspace Context](customizing/extending-overview/extension-types/workspaces/workspace-context.md)
188189
* [Workspace Views](customizing/extending-overview/extension-types/workspaces/workspace-views.md)
190+
* [Workspace Footer Apps](customizing/extending-overview/extension-types/workspaces/workspace-footer-apps.md)
189191
* [Extension Kind](customizing/extending-overview/extension-kind.md)
190192
* [Extension Conditions](customizing/extending-overview/extension-conditions.md)
191193
* [Custom Extension types](customizing/extending-overview/custom-extension-type.md)
Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,50 @@
11
---
22
description: >-
3-
An overview of the available extension types related to workspaces.
3+
Learn about workspace extension types that provide shared functionality and enable communication within workspace environments.
44
---
55

66
# Extension Types: Workspaces
7+
8+
Workspace extensions are specialized components that enhance Umbraco's editing environments for documents, media, and members. They share state through workspace contexts. This enables coordinated functionality like synchronized actions, real-time status updates, and seamless data flow across the editing interface.
9+
10+
## Available Extension Types
11+
12+
Workspace extensions can be grouped into these types:
13+
14+
### Core Extensions
15+
- **[Workspace Context](workspace-context.md)** - Provides shared state management and communication between workspace extensions
16+
- **[Workspace](../../../workspaces.md)** - Defines the main workspace environment and routing
17+
18+
### User Interface Extensions
19+
- **[Workspace Views](workspace-views.md)** - Tab-based content areas for organizing different aspects of entity editing
20+
- **[Workspace Footer Apps](workspace-footer-apps.md)** - Persistent status information and contextual data in the footer area
21+
22+
### Action Extensions
23+
- **[Workspace Actions](workspace-editor-actions.md)** - Primary action buttons that appear in the workspace footer
24+
- **[Workspace Action Menu Items](workspace-action-menu-items.md)** - Dropdown menu items that extend workspace actions with additional functionality
25+
26+
## Integration Patterns
27+
28+
Workspace extensions communicate through shared contexts using these patterns:
29+
30+
1. **[Workspace Context](workspace-context.md)** manages centralized state using observables that automatically notify subscribers of changes
31+
2. **[Workspace Actions](workspace-editor-actions.md)** consume the context to modify state when users interact with buttons or menu items
32+
3. **[Workspace Action Menu Items](workspace-action-menu-items.md)** add additional options for workspace actions
33+
4. **[Workspace Views](workspace-views.md)** observe context state to automatically update their UI when data changes
34+
5. **[Footer Apps](workspace-footer-apps.md)** monitor context state to display real-time status information
35+
36+
### Communication Flow
37+
38+
```
39+
Workspace Context (State Management)
40+
↕️
41+
Workspace Actions (State Modification)
42+
↕️
43+
Workspace Views (State Display)
44+
↕️
45+
Footer Apps (Status Monitoring)
46+
```
47+
48+
{% hint style="info" %}
49+
All workspace extensions are automatically scoped to their workspace instance, ensuring that extensions in different workspaces do not interfere with each other.
50+
{% endhint %}

16/umbraco-cms/customizing/extending-overview/extension-types/workspaces/workspace-action-menu-item.md

Whitespace-only changes.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
description: >-
3+
Learn how to create workspace action menu items that extend workspace actions with additional functionality.
4+
---
5+
6+
# Workspace Action Menu Item
7+
8+
Workspace Action Menu Items extend existing workspace actions by adding dropdown menu options. They provide secondary functionality that relates to the primary action without cluttering the workspace footer.
9+
10+
## Manifest
11+
12+
{% code caption="manifest.ts" %}
13+
```typescript
14+
{
15+
type: 'workspaceActionMenuItem',
16+
kind: 'default',
17+
alias: 'example.workspaceActionMenuItem.resetCounter',
18+
name: 'Reset Counter Menu Item',
19+
api: () => import('./reset-counter-menu-item.action.js'),
20+
forWorkspaceActions: 'example.workspaceAction.incrementor',
21+
weight: 100,
22+
meta: {
23+
label: 'Reset Counter',
24+
icon: 'icon-refresh',
25+
},
26+
}
27+
```
28+
{% endcode %}
29+
30+
### Key Properties
31+
- **`kind`** - Specifies which type of element should be shown (if no `element` is provided). The `default` option refers to the `<umb-workspace-action-menu-item />`, which supports a label and an href
32+
- **`forWorkspaceActions`** - Specifies which workspace action this extends
33+
- **`weight`** - Controls ordering within the dropdown menu
34+
- **`meta.label`** - Text displayed in dropdown
35+
- **`meta.icon`** - Icon displayed alongside label
36+
37+
## Implementation
38+
39+
Create a workspace action menu item by extending `UmbWorkspaceActionMenuItemBase` and implementing the `execute` method. This provides the functionality that runs when a user interacts with the menu item:
40+
41+
{% code caption="reset-counter-menu-item.action.ts" %}
42+
```typescript
43+
import { EXAMPLE_COUNTER_CONTEXT } from './counter-workspace-context.js';
44+
import { UmbWorkspaceActionMenuItemBase } from '@umbraco-cms/backoffice/workspace';
45+
import type { UmbWorkspaceActionMenuItem } from '@umbraco-cms/backoffice/workspace';
46+
47+
export class ExampleResetCounterMenuItemAction extends UmbWorkspaceActionMenuItemBase implements UmbWorkspaceActionMenuItem {
48+
override async execute() {
49+
const context = await this.getContext(EXAMPLE_COUNTER_CONTEXT);
50+
if (!context) {
51+
throw new Error('Could not get the counter context');
52+
}
53+
54+
context.reset();
55+
}
56+
}
57+
58+
export const api = ExampleResetCounterMenuItemAction;
59+
```
60+
{% endcode %}
61+
62+
## Action Relationship
63+
64+
Menu items display a dropdown menu for their associated actions:
65+
66+
### Primary Action
67+
```typescript
68+
// The main action that appears as a button
69+
{
70+
type: 'workspaceAction',
71+
alias: 'example.workspaceAction.save',
72+
meta: { label: 'Save' },
73+
}
74+
```
75+
76+
### Menu Item Extensions
77+
```typescript
78+
// Multiple menu items can extend the same action
79+
{
80+
type: 'workspaceActionMenuItem',
81+
alias: 'example.menuItem.saveAndClose',
82+
forWorkspaceActions: 'example.workspaceAction.save',
83+
meta: { label: 'Save and Close' },
84+
}
85+
86+
{
87+
type: 'workspaceActionMenuItem',
88+
alias: 'example.menuItem.saveAsDraft',
89+
forWorkspaceActions: 'example.workspaceAction.save',
90+
meta: { label: 'Save as Draft' },
91+
}
92+
```

0 commit comments

Comments
 (0)