-
Notifications
You must be signed in to change notification settings - Fork 808
Cms/workspace extensions #7265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Cms/workspace extensions #7265
Changes from 4 commits
328def3
4f96d27
fced10f
0226457
9199081
ea0e183
4ffabaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. | ||
|
||
## 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
|
||
|
||
|
||
### 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 | ||
|
||
|
||
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: | ||||||
|
||||||
- **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" %} | ||||||
|
||||||
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: | ||||||
|
||||||
|
||||||
{% 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: | ||||||
|
Menu items create dropdown menus for their associated actions: | |
Menu items display a dropdown menus for their associated actions: |
Outdated
There was a problem hiding this comment.
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
Outdated
There was a problem hiding this comment.
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
Outdated
There was a problem hiding this comment.
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.
Check warning on line 141 in 16/umbraco-cms/customizing/extending-overview/extension-types/workspaces/workspace-action-menu-items.md
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"}
There was a problem hiding this comment.
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.