Skip to content

Commit b921ab6

Browse files
committed
edit document blueprint
1 parent 3d422c1 commit b921ab6

File tree

5 files changed

+55
-9
lines changed

5 files changed

+55
-9
lines changed

src/packages/data-type/tree/folder/workspace/manifests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const manifests: Array<UmbExtensionManifest> = [
1717
type: 'workspaceAction',
1818
kind: 'default',
1919
alias: 'Umb.WorkspaceAction.DataType.Folder.Submit',
20-
name: 'Save Media Type Folder Workspace Action',
20+
name: 'Submit Media Type Folder Workspace Action',
2121
api: UmbSubmitWorkspaceAction,
2222
meta: {
2323
label: '#buttons_save',

src/packages/documents/document-blueprints/tree/folder/workspace/document-blueprint-folder-editor.element.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { UMB_DOCUMENT_BLUEPRINT_FOLDER_WORKSPACE_ALIAS } from './constants.js';
21
import { UMB_DOCUMENT_BLUEPRINT_FOLDER_WORKSPACE_CONTEXT } from './document-blueprint-folder.workspace.context-token.js';
32
import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
4-
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
3+
import type { UUIInputElement } from '@umbraco-cms/backoffice/external/uui';
4+
import { UUIInputEvent } from '@umbraco-cms/backoffice/external/uui';
5+
import { umbFocus, UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
56
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
7+
import { umbBindToValidation } from '@umbraco-cms/backoffice/validation';
68

79
const elementName = 'umb-document-blueprint-folder-workspace-editor';
810
@customElement(elementName)
@@ -30,12 +32,37 @@ export class UmbDocumentBlueprintFolderWorkspaceEditorElement extends UmbLitElem
3032
});
3133
}
3234

35+
#handleInput(event: UUIInputEvent) {
36+
if (event instanceof UUIInputEvent) {
37+
const target = event.composedPath()[0] as UUIInputElement;
38+
39+
if (typeof target?.value === 'string') {
40+
this.#workspaceContext?.setName(target.value);
41+
}
42+
}
43+
}
44+
3345
override render() {
34-
return html`<umb-workspace-editor headline=${this._name} alias=${UMB_DOCUMENT_BLUEPRINT_FOLDER_WORKSPACE_ALIAS}>
46+
return html`<umb-workspace-editor>
47+
<uui-input
48+
slot="header"
49+
id="nameInput"
50+
.value=${this._name ?? ''}
51+
@input="${this.#handleInput}"
52+
required
53+
${umbBindToValidation(this, `$.name`, this._name)}
54+
${umbFocus()}></uui-input>
3555
</umb-workspace-editor>`;
3656
}
3757

38-
static override styles = [UmbTextStyles, css``];
58+
static override styles = [
59+
UmbTextStyles,
60+
css`
61+
#nameInput {
62+
flex: 1 1 auto;
63+
}
64+
`,
65+
];
3966
}
4067

4168
export { UmbDocumentBlueprintFolderWorkspaceEditorElement as element };

src/packages/documents/document-blueprints/tree/folder/workspace/manifests.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { UMB_DOCUMENT_BLUEPRINT_FOLDER_ENTITY_TYPE } from '../../../entity.js';
22
import { UMB_DOCUMENT_BLUEPRINT_FOLDER_WORKSPACE_ALIAS } from './constants.js';
3+
import { UmbSubmitWorkspaceAction } from '@umbraco-cms/backoffice/workspace';
34

45
export const manifests: Array<UmbExtensionManifest> = [
56
{
@@ -12,4 +13,22 @@ export const manifests: Array<UmbExtensionManifest> = [
1213
entityType: UMB_DOCUMENT_BLUEPRINT_FOLDER_ENTITY_TYPE,
1314
},
1415
},
16+
{
17+
type: 'workspaceAction',
18+
kind: 'default',
19+
alias: 'Umb.WorkspaceAction.DocumentBlueprint.Folder.Submit',
20+
name: 'Submit Document Blueprint Folder Workspace Action',
21+
api: UmbSubmitWorkspaceAction,
22+
meta: {
23+
label: '#buttons_save',
24+
look: 'primary',
25+
color: 'positive',
26+
},
27+
conditions: [
28+
{
29+
alias: 'Umb.Condition.WorkspaceAlias',
30+
match: UMB_DOCUMENT_BLUEPRINT_FOLDER_WORKSPACE_ALIAS,
31+
},
32+
],
33+
},
1534
];

src/packages/documents/document-types/tree/folder/workspace/manifests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { UmbSubmitWorkspaceAction } from '@umbraco-cms/backoffice/workspace';
21
import { UMB_DOCUMENT_TYPE_FOLDER_ENTITY_TYPE } from '../../../entity.js';
32
import { UMB_DOCUMENT_TYPE_FOLDER_WORKSPACE_ALIAS } from './constants.js';
3+
import { UmbSubmitWorkspaceAction } from '@umbraco-cms/backoffice/workspace';
44

55
export const manifests: Array<UmbExtensionManifest> = [
66
{
@@ -16,8 +16,8 @@ export const manifests: Array<UmbExtensionManifest> = [
1616
{
1717
type: 'workspaceAction',
1818
kind: 'default',
19-
alias: 'Umb.WorkspaceAction.DocumentType.Folder.Save',
20-
name: 'Save Document Type Folder Workspace Action',
19+
alias: 'Umb.WorkspaceAction.DocumentType.Folder.Submit',
20+
name: 'Submit Document Type Folder Workspace Action',
2121
api: UmbSubmitWorkspaceAction,
2222
meta: {
2323
label: '#buttons_save',

src/packages/media/media-types/tree/folder/workspace/manifests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const manifests: Array<UmbExtensionManifest> = [
1717
type: 'workspaceAction',
1818
kind: 'default',
1919
alias: 'Umb.WorkspaceAction.MediaType.Folder.Submit',
20-
name: 'Save Media Type Folder Workspace Action',
20+
name: 'Submit Media Type Folder Workspace Action',
2121
api: UmbSubmitWorkspaceAction,
2222
meta: {
2323
label: '#buttons_save',

0 commit comments

Comments
 (0)