Skip to content
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

Feature: Readonly mode for Text Box Property Editor UI #2027

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
state,
ifDefined,
type PropertyValueMap,
property,
} from '@umbraco-cms/backoffice/external/lit';
import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
Expand All @@ -23,6 +24,15 @@ export class UmbPropertyEditorUITextBoxElement
extends UmbFormControlMixin<string>(UmbLitElement, undefined)
implements UmbPropertyEditorUiElement
{
/**
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
* @type {boolean}
* @attr
* @default false
*/
@property({ type: Boolean, reflect: true })
readonly = false;

#defaultType: UuiInputTypeType = 'text';

@state()
Expand Down Expand Up @@ -63,7 +73,8 @@ export class UmbPropertyEditorUITextBoxElement
placeholder=${ifDefined(this._placeholder)}
inputMode=${ifDefined(this._inputMode)}
maxlength=${ifDefined(this._maxChars)}
@input=${this.onChange}></uui-input>`;
@input=${this.onChange}
?readonly=${this.readonly}></uui-input>`;
}

static styles = [
Expand Down