Skip to content

Commit

Permalink
Bugfix: Disables Link Picker modal submit button (#2521)
Browse files Browse the repository at this point in the history
Link Picker modal, disables submit button

if URL or querystring are not set.
  • Loading branch information
leekelleher authored Nov 7, 2024
1 parent 9873bed commit 0616a43
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import type {
UmbLinkPickerModalValue,
} from './link-picker-modal.token.js';
import { css, customElement, html, nothing, query, state, when } from '@umbraco-cms/backoffice/external/lit';
import { isUmbracoFolder, UmbMediaTypeStructureRepository } from '@umbraco-cms/backoffice/media-type';
import { umbFocus } from '@umbraco-cms/backoffice/lit-element';
import { UmbDocumentDetailRepository } from '@umbraco-cms/backoffice/document';
import { UmbMediaDetailRepository } from '@umbraco-cms/backoffice/media';
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
import type { UmbInputDocumentElement } from '@umbraco-cms/backoffice/document';
import type { UmbInputMediaElement } from '@umbraco-cms/backoffice/media';
import type { UUIBooleanInputEvent, UUIInputEvent } from '@umbraco-cms/backoffice/external/uui';
import { isUmbracoFolder, UmbMediaTypeStructureRepository } from '@umbraco-cms/backoffice/media-type';

type UmbInputPickerEvent = CustomEvent & { target: { value?: string } };

Expand Down Expand Up @@ -56,8 +57,10 @@ export class UmbLinkPickerModalElement extends UmbModalBaseElement<UmbLinkPicker

if (query.includes('=')) {
this.#partialUpdateLink({ queryString: `?${query}` });
} else {
} else if (query) {
this.#partialUpdateLink({ queryString: `#${query}` });
} else {
this.#partialUpdateLink({ queryString: query });
}
}

Expand Down Expand Up @@ -149,6 +152,7 @@ export class UmbLinkPickerModalElement extends UmbModalBaseElement<UmbLinkPicker
color="positive"
look="primary"
label=${this.localize.term('general_submit')}
?disabled=${!this.value.link.url && !this.value.link.queryString}
@click=${this._submitModal}></uui-button>
</div>
</umb-body-layout>
Expand All @@ -169,7 +173,8 @@ export class UmbLinkPickerModalElement extends UmbModalBaseElement<UmbLinkPicker
label=${this.localize.term('general_url')}
.value=${this.value.link.url ?? ''}
?disabled=${this.value.link.unique ? true : false}
@change=${this.#onLinkUrlInput}>
@change=${this.#onLinkUrlInput}
${umbFocus()}>
</uui-input>
</umb-property-layout>
${when(
Expand Down

0 comments on commit 0616a43

Please sign in to comment.