Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 16/umbraco-cms/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@
* [Section View](customizing/extending-overview/extension-types/sections/section-view.md)
* [Workspaces](customizing/extending-overview/extension-types/workspaces/README.md)
* [Workspace Actions](customizing/extending-overview/extension-types/workspaces/workspace-editor-actions.md)
* [Workspace Action Menu Items](customizing/extending-overview/extension-types/workspaces/workspace-action-menu-items.md)
* [Workspace Context](customizing/extending-overview/extension-types/workspaces/workspace-context.md)
* [Workspace Views](customizing/extending-overview/extension-types/workspaces/workspace-views.md)
* [Workspace Footer Apps](customizing/extending-overview/extension-types/workspaces/workspace-footer-apps.md)
* [Menu](customizing/extending-overview/extension-types/menu.md)
* [Header Apps](customizing/extending-overview/extension-types/header-apps.md)
* [Icons](customizing/extending-overview/extension-types/icons.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,67 @@
---
description: >-
An overview of the available extension types related to workspaces.
Learn about workspace extension types that provide shared functionality and communication within workspace environments.
---

# Extension Types: Workspaces

Workspace extensions provide functionality that operates within specific workspace environments, such as document editing, media management, or member editing. These extensions can communicate through shared workspace contexts to create cohesive, integrated functionality.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if the Docs are here to help people learn and understand concepts, then the texts we provide should be carefully curated to guide people through the most common aspects and push the secondary aspects to more advanced sections.

When I read this sentence, I'm not sure what I was supposed to learn. Maybe my context-window is too short, or the AI just generated some text that sounds nice, but I don't see how this helps would help me or anyone new to understand the topic of this section.


## Available Extension Types

Workspace extensions include several types that work together through shared state management:

Check warning on line 12 in 16/umbraco-cms/customizing/extending-overview/extension-types/workspaces/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐢 [UmbracoDocs.Editorializing] Consider removing 'several' Raw Output: {"message": "[UmbracoDocs.Editorializing] Consider removing 'several'", "location": {"path": "16/umbraco-cms/customizing/extending-overview/extension-types/workspaces/README.md", "range": {"start": {"line": 12, "column": 30}}}, "severity": "WARNING"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after reading this sentence, I have more questions.
"state management?" what does that mean in this context


### Core Extensions
- **[Workspace Context](workspace-context.md)** - Provides shared state management and communication between workspace extensions
- **[Workspace](workspace.md)** - Defines the main workspace environment and routing

### User Interface Extensions
- **[Workspace Views](workspace-views.md)** - Tab-based content areas for organizing different aspects of entity editing
- **[Workspace Footer Apps](workspace-footer-apps.md)** - Persistent status information and contextual data in the footer area

### Action Extensions
- **[Workspace Actions](workspace-editor-actions.md)** - Primary action buttons that appear in the workspace footer
- **[Workspace Action Menu Items](workspace-action-menu-items.md)** - Dropdown menu items that extend workspace actions with additional functionality

## Integration Patterns

Workspace extensions communicate through shared contexts using these patterns:

1. **Workspace Context** manages centralized state using observables that automatically notify subscribers of changes
2. **Workspace Actions** consume the context to modify state when users interact with buttons or menu items
3. **Workspace Views** observe context state to automatically update their UI when data changes
4. **Footer Apps** monitor context state to display real-time status information

### Communication Flow

```
Workspace Context (State Management)
↕️
Workspace Actions (State Modification)
↕️
Workspace Views (State Display)
↕️
Footer Apps (Status Monitoring)
```

## Getting Started
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a repetition of the Integration Patterns above.

I would say Getting Start should properly cover how to get started with you own Workspace from the ground.

And then another Headline could be for context regarding extension an existing Workspace, which is partly covered by the Extension-Types


To create a complete workspace extension system:

1. **Start with a [Workspace Context](workspace-context.md)** to provide shared state management
2. **Add [Workspace Actions](workspace-editor-actions.md)** for primary user interactions
3. **Create [Workspace Views](workspace-views.md)** for dedicated editing interfaces
4. **Include [Footer Apps](workspace-footer-apps.md)** for persistent status information
5. **Extend actions with [Menu Items](workspace-action-menu-items.md)** for additional functionality

{% hint style="info" %}
All workspace extensions are automatically scoped to their workspace instance, ensuring that extensions in different workspaces cannot interfere with each other.
{% endhint %}

## Example Implementation

For a complete working example that demonstrates all workspace extension types working together, see:

{% content-ref url="../../../../../examples/workspace-context-counter/" %}
[Complete Integration Example](../../../../../examples/workspace-context-counter/)
{% endcontent-ref %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
---
description: >-
Learn how to create workspace action menu items that extend workspace actions with additional functionality.
---

# Workspace Action Menu Item

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.

## Purpose

Action Menu Items provide:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels very AI generated, but to be fair its true, but a bit heavy to read. Like do you need to be so spell it out...

- **Secondary actions** that extend primary workspace actions
- **Grouped functionality** under a single action button
- **Progressive disclosure** for related operations
- **Context integration** with workspace state

{% hint style="info" %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is misplaced, should be together with the Manifest

Action Menu Items are associated with specific Workspace Actions using the `forWorkspaceActions` property.
{% endhint %}

## Manifest

{% code caption="manifest.ts" %}
```typescript
{
type: 'workspaceActionMenuItem',
kind: 'default',
alias: 'example.workspaceActionMenuItem.resetCounter',
name: 'Reset Counter Menu Item',
api: () => import('./reset-counter-menu-item.action.js'),
forWorkspaceActions: 'example.workspaceAction.incrementor',
weight: 100,
meta: {
label: 'Reset Counter',
icon: 'icon-refresh',
},
}
```
{% endcode %}

### Key Properties
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default kind should be mentioned here as well, as thata gives the Element for this.

- **`forWorkspaceActions`** - Specifies which workspace action this extends
- **`weight`** - Controls ordering within the dropdown menu
- **`meta.label`** - Text displayed in dropdown
- **`meta.icon`** - Icon displayed alongside label

## Implementation

Create a workspace action menu item by extending `UmbWorkspaceActionMenuItemBase` and implementing the `execute` method. This provides the functionality that runs when users select the menu item:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the word select is off here. I think interacts is better.


{% code caption="reset-counter-menu-item.action.ts" %}
```typescript
import { EXAMPLE_COUNTER_CONTEXT } from './counter-workspace-context.js';
import { UmbWorkspaceActionMenuItemBase } from '@umbraco-cms/backoffice/workspace';
import type { UmbWorkspaceActionMenuItem } from '@umbraco-cms/backoffice/workspace';

export class ExampleResetCounterMenuItemAction extends UmbWorkspaceActionMenuItemBase implements UmbWorkspaceActionMenuItem {
override async execute() {
const context = await this.getContext(EXAMPLE_COUNTER_CONTEXT);
if (!context) {
throw new Error('Could not get the counter context');
}

context.reset();
}
}

export const api = ExampleResetCounterMenuItemAction;
```
{% endcode %}

## Action Relationship

Menu items create dropdown menus for their associated actions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Menu items create dropdown menus for their associated actions:
Menu items display a dropdown menus for their associated actions:


### Primary Action
```typescript
// The main action that appears as a button
{
type: 'workspaceAction',
alias: 'example.workspaceAction.save',
meta: { label: 'Save' },
}
```

### Menu Item Extensions
```typescript
// Multiple menu items can extend the same action
{
type: 'workspaceActionMenuItem',
alias: 'example.menuItem.saveAndClose',
forWorkspaceActions: 'example.workspaceAction.save',
meta: { label: 'Save and Close' },
}

{
type: 'workspaceActionMenuItem',
alias: 'example.menuItem.saveAsDraft',
forWorkspaceActions: 'example.workspaceAction.save',
meta: { label: 'Save as Draft' },
}
```

## Use Cases

### Alternative Operations
Provide different ways to perform related actions:
```typescript
// Primary: Quick save
// Menu: Save and close, Save as template, Save and publish
```

### Destructive Actions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont agree, lets remove this one

Keep dangerous operations in dropdown menus:
```typescript
// Primary: Edit
// Menu: Delete, Archive, Reset
```

### Context-Specific Options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think this example is a bit odd

Add options that depend on entity state:
```typescript
override async execute() {
const entityContext = await this.getContext(ENTITY_CONTEXT);

if (entityContext.isDraft()) {
await entityContext.saveAsDraft();
} else {
await entityContext.saveAndPublish();
}
}
```

## Best Practices
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, do we need to spell this out. I mean if we have to cover these topics in all articles it becomes very repetive and a lot of content that does not have much value.


### Related Functionality
Only group actions that are logically related to the primary action.

### Clear Labels
Use descriptive labels that clearly indicate the menu item's purpose.

Check warning on line 141 in 16/umbraco-cms/customizing/extending-overview/extension-types/workspaces/workspace-action-menu-items.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐢 [UmbracoDocs.Editorializing] Consider removing 'clearly' Raw Output: {"message": "[UmbracoDocs.Editorializing] Consider removing 'clearly'", "location": {"path": "16/umbraco-cms/customizing/extending-overview/extension-types/workspaces/workspace-action-menu-items.md", "range": {"start": {"line": 141, "column": 29}}}, "severity": "WARNING"}

### Appropriate Ordering
Use weight to order menu items by importance or frequency of use.

### Context Dependencies
Always check context availability before performing operations.

{% content-ref url="../../../../../examples/workspace-context-counter/" %}
[Complete Integration Example](../../../../../examples/workspace-context-counter/)
{% endcontent-ref %}
Loading
Loading