Skip to content

Commit 7562aa7

Browse files
committed
form issue fix
1 parent 230efb2 commit 7562aa7

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

blocks/form/form.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,12 @@ export default function decorate(block) {
744744
const data = Array.isArray(raw) ? raw : (raw?.fields && Array.isArray(raw.fields) ? raw.fields : null);
745745
if (!data || !Array.isArray(data)) throw new Error(`No form fields at ${source}`);
746746
const form = buildForm(data, submit);
747-
block.replaceChildren(form);
747+
const configRow = block.querySelector(':scope > div');
748+
if (configRow) {
749+
block.replaceChildren(configRow, form);
750+
} else {
751+
block.replaceChildren(form);
752+
}
748753
block.removeAttribute('style');
749754
} catch (error) {
750755

ue/scripts/ue.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { moveInstrumentation } from './ue-utils.js';
22

33
const setupObservers = () => {
4-
const mutatingBlocks = document.querySelectorAll('div.cards, div.journey-map');
4+
const mutatingBlocks = document.querySelectorAll('div.cards, div.journey-map, div.form');
55
const observer = new MutationObserver((mutations) => {
66
mutations.forEach((mutation) => {
77
if (mutation.type === 'childList' && mutation.target.tagName === 'DIV') {
@@ -72,24 +72,6 @@ const setupUEEventHandlers = () => {
7272
picture?.querySelector('img')?.removeAttribute('srcset');
7373
});
7474

75-
// When embedUrl is updated, copy to embedUrlText if empty so the URL is retained
76-
document.body.addEventListener('aue:content-patch', ({ detail: { patch, request } }) => {
77-
if (patch.name !== 'embedUrl') return;
78-
79-
const element = document.querySelector(`[data-aue-resource="${request.target.resource}"]`);
80-
if (!element) return;
81-
82-
const anchor = element.getAttribute('data-aue-prop') === 'embedUrl'
83-
? element
84-
: element.querySelector('[data-aue-prop="embedUrl"]') || element.querySelector('a[href]');
85-
if (!anchor || anchor.tagName !== 'A') return;
86-
87-
const url = patch.value || anchor.getAttribute('href') || '';
88-
if (url && (!anchor.textContent || !anchor.textContent.trim())) {
89-
anchor.textContent = url;
90-
}
91-
});
92-
9375
document.body.addEventListener('aue:ui-select', (event) => {
9476
const { detail } = event;
9577
const resource = detail?.resource;

0 commit comments

Comments
 (0)