updated the link picker modal and the property editors using it. (#18059)

* updated the link picker modal and the property editors using it.

* updated the last language

* some minor updates to the code so that it uses the correct actions

* Minor change in the language key that is being used.

* use camel case

* use "add" and "update" without "link"

---------

Co-authored-by: Mads Rasmussen <madsr@hey.com>
This commit is contained in:
jonat123
2025-01-27 10:49:02 +01:00
committed by GitHub
parent 2648d17cb6
commit bc3881707e
9 changed files with 16 additions and 3 deletions

View File

@@ -542,6 +542,8 @@ export default {
selectIcon: 'Vælg ikon',
selectItem: 'Vælg item',
selectLink: 'Vælg link',
addLink: 'Tilføj Link',
updateLink: 'Opdater Link',
selectMacro: 'Vælg makro',
selectContent: 'Vælg indhold',
selectContentType: 'Vælg indholdstype',

View File

@@ -573,6 +573,8 @@ export default {
selectIcon: 'Select icon',
selectItem: 'Select item',
selectLink: 'Configure link',
addLink: 'Add Link',
updateLink: 'Update Link',
selectMacro: 'Select macro',
selectContent: 'Select content',
selectContentType: 'Select content type',

View File

@@ -565,6 +565,8 @@ export default {
selectIcon: 'Select icon',
selectItem: 'Select item',
selectLink: 'Configure link',
addLink: 'Add Link',
updateLink: 'Update Link',
selectMacro: 'Select macro',
selectContent: 'Select content',
selectContentType: 'Select content type',

View File

@@ -200,6 +200,7 @@ export class UmbInputMultiUrlElement extends UUIFormControlMixin(UmbLitElement,
},
data: {
index: index,
isNew: index === null,
config: {
hideAnchor: this.hideAnchor,
},

View File

@@ -200,7 +200,10 @@ export class UmbLinkPickerModalElement extends UmbModalBaseElement<UmbLinkPicker
override render() {
return html`
<umb-body-layout headline=${this.localize.term('defaultdialogs_selectLink')}>
<umb-body-layout
headline=${this.localize.term(
this.modalContext?.data.isNew ? 'defaultdialogs_addLink' : 'defaultdialogs_updateLink',
)}>
<uui-box>
${this.#renderLinkType()} ${this.#renderLinkAnchorInput()} ${this.#renderLinkTitleInput()}
${this.#renderLinkTargetInput()}
@@ -210,7 +213,7 @@ export class UmbLinkPickerModalElement extends UmbModalBaseElement<UmbLinkPicker
<uui-button
color="positive"
look="primary"
label=${this.localize.term('general_submit')}
label=${this.localize.term(this.modalContext?.data.isNew ? 'general_add' : 'general_update')}
?disabled=${!this.value.link.type}
@click=${this.#onSubmit}></uui-button>
</div>

View File

@@ -5,6 +5,7 @@ import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
export interface UmbLinkPickerModalData {
config: UmbLinkPickerConfig;
index: number | null;
isNew: boolean;
}
export type UmbLinkPickerModalValue = { link: UmbLinkPickerLink };

View File

@@ -40,6 +40,7 @@ export class UmbUrlPickerMonacoMarkdownEditorAction extends UmbControllerBase {
modal: { size: overlaySize },
data: {
index: null,
isNew: selectedValue === '',
config: {},
},
value: {

View File

@@ -81,6 +81,7 @@ export default class UmbTinyMceMultiUrlPickerPlugin extends UmbTinyMcePluginBase
data: {
config: {},
index: null,
isNew: currentTarget?.url === undefined,
},
value: {
link: currentTarget ?? {},

View File

@@ -10,7 +10,7 @@ export default class UmbTiptapToolbarLinkExtensionApi extends UmbTiptapToolbarEl
override async execute(editor?: Editor) {
const attrs = editor?.getAttributes(UmbLink.name) ?? {};
const link = this.#getLinkData(attrs);
const data = { config: {}, index: null };
const data = { config: {}, index: null, isNew: link?.url === undefined };
const value = { link };
const overlaySize = this.configuration?.getValueByAlias<UUIModalSidebarSize>('overlaySize') ?? 'small';