From 8427de721c216fcacba3aef0b6f61bf85ecce77a Mon Sep 17 00:00:00 2001 From: Julia Gru <56249914+julczka@users.noreply.github.com> Date: Thu, 20 Jul 2023 13:08:59 +0200 Subject: [PATCH] allow create empty --- .../partial-views-workspace-edit.element.ts | 12 ++++++++++-- .../workspace/partial-views-workspace.context.ts | 10 ++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace-edit.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace-edit.element.ts index 0733f15b4b..b17992eb89 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace-edit.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace-edit.element.ts @@ -11,8 +11,16 @@ import { Subject, debounceTime } from '@umbraco-cms/backoffice/external/rxjs'; @customElement('umb-partial-views-workspace-edit') export class UmbPartialViewsWorkspaceEditElement extends UmbLitElement { + #name: string | undefined = ''; @state() - private _name?: string | null = ''; + private get _name() { + return this.#name; + } + + private set _name(value) { + this.#name = value?.replace('.cshtml', ''); + this.requestUpdate(); + } @state() private _content?: string | null = ''; @@ -64,7 +72,7 @@ export class UmbPartialViewsWorkspaceEditElement extends UmbLitElement { }); this.inputQuery$.pipe(debounceTime(250)).subscribe((nameInputValue: string) => { - this.#partialViewsWorkspaceContext?.setName(nameInputValue); + this.#partialViewsWorkspaceContext?.setName(`${nameInputValue}.cshtml`); }); }); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace.context.ts index 6ac89765d3..a0769643f2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace.context.ts @@ -19,7 +19,14 @@ export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext