@ohhwells/bridge 0.1.77 → 0.1.78
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 +7 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7433,6 +7433,10 @@ function topLevelSections() {
|
|
|
7433
7433
|
function instanceIdOf(el) {
|
|
7434
7434
|
return el.dataset.ohwInstance ?? el.dataset.ohwSection ?? "";
|
|
7435
7435
|
}
|
|
7436
|
+
function findByInstanceId(instanceId) {
|
|
7437
|
+
const escapedId = CSS.escape(instanceId);
|
|
7438
|
+
return document.querySelector(`[data-ohw-instance="${escapedId}"]`) ?? document.querySelector(`[data-ohw-section="${escapedId}"]:not([data-ohw-instance])`);
|
|
7439
|
+
}
|
|
7436
7440
|
function planSectionMove(instanceId, targetIndex, currentPath) {
|
|
7437
7441
|
const sections = topLevelSections();
|
|
7438
7442
|
const index = sections.findIndex((el) => instanceIdOf(el) === instanceId);
|
|
@@ -7468,7 +7472,7 @@ function syncRemovedFlags(entries) {
|
|
|
7468
7472
|
}
|
|
7469
7473
|
});
|
|
7470
7474
|
for (const id of removedIds) {
|
|
7471
|
-
const el =
|
|
7475
|
+
const el = findByInstanceId(id);
|
|
7472
7476
|
if (el) {
|
|
7473
7477
|
el.style.display = "none";
|
|
7474
7478
|
el.setAttribute(REMOVED_ATTR2, "");
|
|
@@ -7496,9 +7500,7 @@ function applyPersistedOrder(entries) {
|
|
|
7496
7500
|
}
|
|
7497
7501
|
}
|
|
7498
7502
|
function setSectionRemoved(instanceId, currentPath, existingEntries, removed) {
|
|
7499
|
-
|
|
7500
|
-
if (!document.querySelector(`[data-ohw-instance="${escapedId}"]`) && !document.querySelector(`[data-ohw-section="${escapedId}"]:not([data-ohw-instance])`))
|
|
7501
|
-
return null;
|
|
7503
|
+
if (!findByInstanceId(instanceId)) return null;
|
|
7502
7504
|
const byId = new Map(existingEntries.map((e) => [e.instanceId, e]));
|
|
7503
7505
|
const allSections = Array.from(document.querySelectorAll("[data-ohw-section]")).filter(
|
|
7504
7506
|
(el) => !el.parentElement?.closest("[data-ohw-section]") && !isChromeSection(el)
|
|
@@ -20188,7 +20190,7 @@ function OhhwellsBridge() {
|
|
|
20188
20190
|
postToParent2({
|
|
20189
20191
|
type: "ow:ready",
|
|
20190
20192
|
version: "1",
|
|
20191
|
-
bridgeVersion: "0.1.
|
|
20193
|
+
bridgeVersion: "0.1.77",
|
|
20192
20194
|
path: pathname,
|
|
20193
20195
|
nodes: collectEditableNodes(editContentRef.current),
|
|
20194
20196
|
sections
|