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:
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -200,6 +200,7 @@ export class UmbInputMultiUrlElement extends UUIFormControlMixin(UmbLitElement,
|
||||
},
|
||||
data: {
|
||||
index: index,
|
||||
isNew: index === null,
|
||||
config: {
|
||||
hideAnchor: this.hideAnchor,
|
||||
},
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -40,6 +40,7 @@ export class UmbUrlPickerMonacoMarkdownEditorAction extends UmbControllerBase {
|
||||
modal: { size: overlaySize },
|
||||
data: {
|
||||
index: null,
|
||||
isNew: selectedValue === '',
|
||||
config: {},
|
||||
},
|
||||
value: {
|
||||
|
||||
@@ -81,6 +81,7 @@ export default class UmbTinyMceMultiUrlPickerPlugin extends UmbTinyMcePluginBase
|
||||
data: {
|
||||
config: {},
|
||||
index: null,
|
||||
isNew: currentTarget?.url === undefined,
|
||||
},
|
||||
value: {
|
||||
link: currentTarget ?? {},
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user