fix node name
This commit is contained in:
@@ -2,6 +2,7 @@ import { UUIButtonState, UUIInputElement, UUIInputEvent } from '@umbraco-ui/uui'
|
||||
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
|
||||
import { css, html, LitElement, nothing } from 'lit';
|
||||
import { customElement, property, state } from 'lit/decorators.js';
|
||||
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
||||
import { Subscription, distinctUntilChanged } from 'rxjs';
|
||||
import { UmbContextProviderMixin, UmbContextConsumerMixin } from '../../../core/context';
|
||||
import { UmbNotificationService } from '../../../core/services/notification.service';
|
||||
@@ -96,7 +97,10 @@ export class UmbEditorDataTypeElement extends UmbContextProviderMixin(UmbContext
|
||||
private _handleInput(event: UUIInputEvent) {
|
||||
if (event instanceof UUIInputEvent) {
|
||||
const target = event.composedPath()[0] as UUIInputElement;
|
||||
this._dataTypeContext?.update({ name: target.value });
|
||||
|
||||
if (typeof target?.value === 'string') {
|
||||
this._dataTypeContext?.update({ name: target.value });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +114,10 @@ export class UmbEditorDataTypeElement extends UmbContextProviderMixin(UmbContext
|
||||
return html`
|
||||
${this._dataType
|
||||
? html`
|
||||
<umb-editor-entity alias="Umb.Editor.DataType" name="${this._dataType.name}" @input="${this._handleInput}">
|
||||
<umb-editor-entity
|
||||
alias="Umb.Editor.DataType"
|
||||
name="${ifDefined(this._dataType?.name)}"
|
||||
@input="${this._handleInput}">
|
||||
<!-- TODO: these could be extensions points too -->
|
||||
<div slot="actions">
|
||||
<uui-button
|
||||
|
||||
@@ -101,7 +101,10 @@ export class UmbEditorDocumentTypeElement extends UmbContextProviderMixin(UmbCon
|
||||
private _handleInput(event: UUIInputEvent) {
|
||||
if (event instanceof UUIInputEvent) {
|
||||
const target = event.composedPath()[0] as UUIInputElement;
|
||||
this._documentTypeContext?.update({ name: target.value });
|
||||
|
||||
if (typeof target?.value === 'string') {
|
||||
this._documentTypeContext?.update({ name: target.value });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
|
||||
import { css, html, LitElement } from 'lit';
|
||||
import { customElement, property, state } from 'lit/decorators.js';
|
||||
import { UUIInputElement, UUIInputEvent } from '@umbraco-ui/uui';
|
||||
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
||||
import { UmbContextConsumerMixin, UmbContextProviderMixin } from '../../../core/context';
|
||||
import { UmbNodeStore } from '../../../core/stores/node.store';
|
||||
import { distinctUntilChanged, Subscription } from 'rxjs';
|
||||
@@ -139,9 +141,20 @@ export class UmbEditorNodeElement extends UmbContextProviderMixin(UmbContextCons
|
||||
delete this._node;
|
||||
}
|
||||
|
||||
// TODO. find a way where we don't have to do this for all editors.
|
||||
private _handleInput(event: UUIInputEvent) {
|
||||
if (event instanceof UUIInputEvent) {
|
||||
const target = event.composedPath()[0] as UUIInputElement;
|
||||
|
||||
if (typeof target?.value === 'string') {
|
||||
this._nodeContext?.update({ name: target.value });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-editor-entity alias="Umb.Editor.Node">
|
||||
<umb-editor-entity alias="Umb.Editor.Node" name="${ifDefined(this._node?.name)}" @input="${this._handleInput}">
|
||||
<div slot="footer">Breadcrumbs</div>
|
||||
|
||||
<div slot="actions">
|
||||
|
||||
Reference in New Issue
Block a user