@ohhwells/bridge 0.1.110 → 0.1.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +35 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8178,6 +8178,7 @@ var FIELD_TYPES = [
|
|
|
8178
8178
|
var FIELD_ATTR = "data-ohw-form-field";
|
|
8179
8179
|
var FIELD_TYPE_ATTR = "data-ohw-field-type";
|
|
8180
8180
|
var PLACEHOLDER_EDIT_ATTR = "data-ohw-placeholder-edit";
|
|
8181
|
+
var seedFieldByForm = /* @__PURE__ */ new WeakMap();
|
|
8181
8182
|
function fieldsKey(formKey) {
|
|
8182
8183
|
return `${formKey}-fields`;
|
|
8183
8184
|
}
|
|
@@ -8263,7 +8264,11 @@ function markFormFields(form) {
|
|
|
8263
8264
|
ensureFieldLabel(wrapper, key);
|
|
8264
8265
|
syncRequiredMark(wrapper);
|
|
8265
8266
|
});
|
|
8266
|
-
|
|
8267
|
+
const wrappers = listFieldWrappers(form);
|
|
8268
|
+
if (wrappers.length > 0 && !seedFieldByForm.has(form)) {
|
|
8269
|
+
seedFieldByForm.set(form, wrappers[0].cloneNode(true));
|
|
8270
|
+
}
|
|
8271
|
+
return wrappers;
|
|
8267
8272
|
}
|
|
8268
8273
|
function readFieldsFromDom(form) {
|
|
8269
8274
|
return listFieldWrappers(form).map((wrapper) => {
|
|
@@ -8407,12 +8412,27 @@ function insertField(form, type) {
|
|
|
8407
8412
|
wrapper = source.cloneNode(true);
|
|
8408
8413
|
source.after(wrapper);
|
|
8409
8414
|
} else {
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8415
|
+
const seed = seedFieldByForm.get(form);
|
|
8416
|
+
if (seed) {
|
|
8417
|
+
wrapper = seed.cloneNode(true);
|
|
8418
|
+
} else {
|
|
8419
|
+
wrapper = document.createElement("div");
|
|
8420
|
+
const input2 = document.createElement("input");
|
|
8421
|
+
input2.style.width = "100%";
|
|
8422
|
+
input2.style.boxSizing = "border-box";
|
|
8423
|
+
input2.style.padding = "12px";
|
|
8424
|
+
input2.style.border = "1px solid color-mix(in srgb, currentColor 35%, transparent)";
|
|
8425
|
+
input2.style.borderRadius = "8px";
|
|
8426
|
+
input2.style.background = "#fff";
|
|
8427
|
+
input2.style.fontFamily = "inherit";
|
|
8428
|
+
input2.style.fontSize = "inherit";
|
|
8429
|
+
input2.style.color = "inherit";
|
|
8430
|
+
wrapper.append(input2);
|
|
8431
|
+
}
|
|
8414
8432
|
const submit = form.querySelector('button, input[type="submit"]');
|
|
8415
|
-
|
|
8433
|
+
let anchor = submit;
|
|
8434
|
+
while (anchor && anchor.parentElement !== form) anchor = anchor.parentElement;
|
|
8435
|
+
if (anchor) anchor.before(wrapper);
|
|
8416
8436
|
else form.appendChild(wrapper);
|
|
8417
8437
|
}
|
|
8418
8438
|
wrapper.setAttribute(FIELD_ATTR, key);
|
|
@@ -19596,8 +19616,10 @@ function OhhwellsBridge() {
|
|
|
19596
19616
|
crushed its fields together (OHH-490). Not media (image/bg-image/video/icon/map)
|
|
19597
19617
|
either: those can be their own flex containers centering fallback content (a
|
|
19598
19618
|
placeholder label, a mascot emoji) \u2014 forcing block broke that centering while the
|
|
19599
|
-
image was unset (OHH-758-ish).
|
|
19600
|
-
|
|
19619
|
+
image was unset (OHH-758-ish). Not inside a container that declares its editables
|
|
19620
|
+
inline (data-ohw-inline-editables): a row of inline links \u2014 a footer's legal line \u2014
|
|
19621
|
+
keeps its line; blockified labels put each link on its own row in the editor only. */
|
|
19622
|
+
[data-ohw-editable]:not([data-ohw-editable="form"]):not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"]):not([data-ohw-editable="icon"]):not([data-ohw-editable="map"]):not([data-ohw-inline-editables] *) {
|
|
19601
19623
|
display: block;
|
|
19602
19624
|
}
|
|
19603
19625
|
/* The block-force above is an author rule, so it beats the browser's own
|
|
@@ -21340,6 +21362,7 @@ function OhhwellsBridge() {
|
|
|
21340
21362
|
applyMapQuery(el, val);
|
|
21341
21363
|
} else if (el.dataset.ohwEditable === "icon") {
|
|
21342
21364
|
applyIconMarkup(el, val);
|
|
21365
|
+
} else if (el.dataset.ohwEditable === "form") {
|
|
21343
21366
|
} else if (isIconMarkupValue(val)) {
|
|
21344
21367
|
} else {
|
|
21345
21368
|
el.innerHTML = val;
|
|
@@ -21349,6 +21372,9 @@ function OhhwellsBridge() {
|
|
|
21349
21372
|
}
|
|
21350
21373
|
applyLogoFromContent(content);
|
|
21351
21374
|
applyLogoSizes(content);
|
|
21375
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
21376
|
+
reconcileFieldsFromContent(form, content);
|
|
21377
|
+
});
|
|
21352
21378
|
if (sectionsJson) {
|
|
21353
21379
|
initSectionsFromContent({ __ohw_sections: sectionsJson }, true);
|
|
21354
21380
|
sectionsLoadedRef.current = true;
|
|
@@ -22660,7 +22686,7 @@ function OhhwellsBridge() {
|
|
|
22660
22686
|
postToParent2({
|
|
22661
22687
|
type: "ow:ready",
|
|
22662
22688
|
version: "1",
|
|
22663
|
-
bridgeVersion: "0.1.
|
|
22689
|
+
bridgeVersion: "0.1.110",
|
|
22664
22690
|
path: pathname,
|
|
22665
22691
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22666
22692
|
sections
|