Skip to content

Commit 5e00af7

Browse files
committed
form UE fix
1 parent 5b6388f commit 5e00af7

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

blocks/form/form.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -746,12 +746,7 @@ export default function decorate(block) {
746746
const data = Array.isArray(raw) ? raw : (raw?.fields && Array.isArray(raw.fields) ? raw.fields : null);
747747
if (!data || !Array.isArray(data)) throw new Error(`No form fields at ${source}`);
748748
const form = buildForm(data, submit);
749-
const configRow = block.querySelector(':scope > div');
750-
if (configRow) {
751-
block.replaceChildren(configRow, form);
752-
} else {
753-
block.replaceChildren(form);
754-
}
749+
block.replaceChildren(form);
755750
block.removeAttribute('style');
756751
} catch (error) {
757752

component-definition.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@
174174
"fields": [
175175
{
176176
"name": "source",
177-
"selector": "div:nth-child(1)>div>p"
177+
"selector": "div:nth-child(1)>div>a[href]"
178178
},
179179
{
180180
"name": "actionUrl",
181-
"selector": "div:nth-child(2)>div>p"
181+
"selector": "div:nth-child(2)>div>a[href]"
182182
}
183183
]
184184
}

component-models.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,16 @@
257257
"id": "form",
258258
"fields": [
259259
{
260-
"component": "richtext",
260+
"component": "reference",
261261
"name": "source",
262262
"label": "Form Source URL",
263263
"valueType": "string",
264+
"multi": false,
264265
"required": true,
265266
"description": "URL to the JSON form definition"
266267
},
267268
{
268-
"component": "richtext",
269+
"component": "text",
269270
"name": "actionUrl",
270271
"label": "Submit Endpoint",
271272
"valueType": "string",

ue/models/blocks/form.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"rows": 2,
1111
"columns": 1,
1212
"fields": [
13-
{ "name": "source", "selector": "div:nth-child(1)>div>p" },
14-
{ "name": "actionUrl", "selector": "div:nth-child(2)>div>p" }
13+
{ "name": "source", "selector": "div:nth-child(1)>div>a[href]" },
14+
{ "name": "actionUrl", "selector": "div:nth-child(2)>div>a[href]" }
1515
]
1616
}
1717
}
@@ -22,15 +22,16 @@
2222
"id": "form",
2323
"fields": [
2424
{
25-
"component": "richtext",
25+
"component": "reference",
2626
"name": "source",
2727
"label": "Form Source URL",
2828
"valueType": "string",
29+
"multi": false,
2930
"required": true,
3031
"description": "URL to the JSON form definition"
3132
},
3233
{
33-
"component": "richtext",
34+
"component": "text",
3435
"name": "actionUrl",
3536
"label": "Submit Endpoint",
3637
"valueType": "string",

0 commit comments

Comments
 (0)