@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.cjs
CHANGED
|
@@ -8251,6 +8251,7 @@ var FIELD_TYPES = [
|
|
|
8251
8251
|
var FIELD_ATTR = "data-ohw-form-field";
|
|
8252
8252
|
var FIELD_TYPE_ATTR = "data-ohw-field-type";
|
|
8253
8253
|
var PLACEHOLDER_EDIT_ATTR = "data-ohw-placeholder-edit";
|
|
8254
|
+
var seedFieldByForm = /* @__PURE__ */ new WeakMap();
|
|
8254
8255
|
function fieldsKey(formKey) {
|
|
8255
8256
|
return `${formKey}-fields`;
|
|
8256
8257
|
}
|
|
@@ -8336,7 +8337,11 @@ function markFormFields(form) {
|
|
|
8336
8337
|
ensureFieldLabel(wrapper, key);
|
|
8337
8338
|
syncRequiredMark(wrapper);
|
|
8338
8339
|
});
|
|
8339
|
-
|
|
8340
|
+
const wrappers = listFieldWrappers(form);
|
|
8341
|
+
if (wrappers.length > 0 && !seedFieldByForm.has(form)) {
|
|
8342
|
+
seedFieldByForm.set(form, wrappers[0].cloneNode(true));
|
|
8343
|
+
}
|
|
8344
|
+
return wrappers;
|
|
8340
8345
|
}
|
|
8341
8346
|
function readFieldsFromDom(form) {
|
|
8342
8347
|
return listFieldWrappers(form).map((wrapper) => {
|
|
@@ -8480,12 +8485,27 @@ function insertField(form, type) {
|
|
|
8480
8485
|
wrapper = source.cloneNode(true);
|
|
8481
8486
|
source.after(wrapper);
|
|
8482
8487
|
} else {
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8488
|
+
const seed = seedFieldByForm.get(form);
|
|
8489
|
+
if (seed) {
|
|
8490
|
+
wrapper = seed.cloneNode(true);
|
|
8491
|
+
} else {
|
|
8492
|
+
wrapper = document.createElement("div");
|
|
8493
|
+
const input2 = document.createElement("input");
|
|
8494
|
+
input2.style.width = "100%";
|
|
8495
|
+
input2.style.boxSizing = "border-box";
|
|
8496
|
+
input2.style.padding = "12px";
|
|
8497
|
+
input2.style.border = "1px solid color-mix(in srgb, currentColor 35%, transparent)";
|
|
8498
|
+
input2.style.borderRadius = "8px";
|
|
8499
|
+
input2.style.background = "#fff";
|
|
8500
|
+
input2.style.fontFamily = "inherit";
|
|
8501
|
+
input2.style.fontSize = "inherit";
|
|
8502
|
+
input2.style.color = "inherit";
|
|
8503
|
+
wrapper.append(input2);
|
|
8504
|
+
}
|
|
8487
8505
|
const submit = form.querySelector('button, input[type="submit"]');
|
|
8488
|
-
|
|
8506
|
+
let anchor = submit;
|
|
8507
|
+
while (anchor && anchor.parentElement !== form) anchor = anchor.parentElement;
|
|
8508
|
+
if (anchor) anchor.before(wrapper);
|
|
8489
8509
|
else form.appendChild(wrapper);
|
|
8490
8510
|
}
|
|
8491
8511
|
wrapper.setAttribute(FIELD_ATTR, key);
|
|
@@ -19663,8 +19683,10 @@ function OhhwellsBridge() {
|
|
|
19663
19683
|
crushed its fields together (OHH-490). Not media (image/bg-image/video/icon/map)
|
|
19664
19684
|
either: those can be their own flex containers centering fallback content (a
|
|
19665
19685
|
placeholder label, a mascot emoji) \u2014 forcing block broke that centering while the
|
|
19666
|
-
image was unset (OHH-758-ish).
|
|
19667
|
-
|
|
19686
|
+
image was unset (OHH-758-ish). Not inside a container that declares its editables
|
|
19687
|
+
inline (data-ohw-inline-editables): a row of inline links \u2014 a footer's legal line \u2014
|
|
19688
|
+
keeps its line; blockified labels put each link on its own row in the editor only. */
|
|
19689
|
+
[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] *) {
|
|
19668
19690
|
display: block;
|
|
19669
19691
|
}
|
|
19670
19692
|
/* The block-force above is an author rule, so it beats the browser's own
|
|
@@ -21407,6 +21429,7 @@ function OhhwellsBridge() {
|
|
|
21407
21429
|
applyMapQuery(el, val);
|
|
21408
21430
|
} else if (el.dataset.ohwEditable === "icon") {
|
|
21409
21431
|
applyIconMarkup(el, val);
|
|
21432
|
+
} else if (el.dataset.ohwEditable === "form") {
|
|
21410
21433
|
} else if (isIconMarkupValue(val)) {
|
|
21411
21434
|
} else {
|
|
21412
21435
|
el.innerHTML = val;
|
|
@@ -21416,6 +21439,9 @@ function OhhwellsBridge() {
|
|
|
21416
21439
|
}
|
|
21417
21440
|
applyLogoFromContent(content);
|
|
21418
21441
|
applyLogoSizes(content);
|
|
21442
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
21443
|
+
reconcileFieldsFromContent(form, content);
|
|
21444
|
+
});
|
|
21419
21445
|
if (sectionsJson) {
|
|
21420
21446
|
initSectionsFromContent({ __ohw_sections: sectionsJson }, true);
|
|
21421
21447
|
sectionsLoadedRef.current = true;
|
|
@@ -22727,7 +22753,7 @@ function OhhwellsBridge() {
|
|
|
22727
22753
|
postToParent2({
|
|
22728
22754
|
type: "ow:ready",
|
|
22729
22755
|
version: "1",
|
|
22730
|
-
bridgeVersion: "0.1.
|
|
22756
|
+
bridgeVersion: "0.1.110",
|
|
22731
22757
|
path: pathname,
|
|
22732
22758
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22733
22759
|
sections
|