@trycourier/react-designer 0.0.0-canary-20251113171853 → 0.0.0-canary-20251113174211
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/cjs/index.js
CHANGED
|
@@ -16321,84 +16321,51 @@ var useSyncEditorItems = /* @__PURE__ */ __name(({ setItems, rafId, editor }) =>
|
|
|
16321
16321
|
if (rafId.current && typeof cancelAnimationFrame !== "undefined") {
|
|
16322
16322
|
cancelAnimationFrame(rafId.current);
|
|
16323
16323
|
}
|
|
16324
|
-
const
|
|
16325
|
-
|
|
16326
|
-
|
|
16327
|
-
|
|
16328
|
-
|
|
16329
|
-
|
|
16330
|
-
|
|
16331
|
-
|
|
16332
|
-
|
|
16333
|
-
|
|
16334
|
-
|
|
16335
|
-
|
|
16336
|
-
|
|
16337
|
-
|
|
16338
|
-
|
|
16339
|
-
|
|
16340
|
-
|
|
16341
|
-
|
|
16342
|
-
|
|
16343
|
-
|
|
16344
|
-
isInsideCell = true;
|
|
16345
|
-
break;
|
|
16346
|
-
}
|
|
16347
|
-
parent = parent.parentElement;
|
|
16348
|
-
}
|
|
16349
|
-
if (!isInsideCell) {
|
|
16350
|
-
domIds.push(id);
|
|
16351
|
-
}
|
|
16324
|
+
const performSync = /* @__PURE__ */ __name(() => {
|
|
16325
|
+
try {
|
|
16326
|
+
const editorDOM = editor2 == null ? void 0 : editor2.view.dom;
|
|
16327
|
+
if (!editorDOM) {
|
|
16328
|
+
return;
|
|
16329
|
+
}
|
|
16330
|
+
const nodeWrappers = editorDOM.querySelectorAll(
|
|
16331
|
+
".react-renderer > div[data-node-view-wrapper][data-id]"
|
|
16332
|
+
);
|
|
16333
|
+
const domIds = [];
|
|
16334
|
+
nodeWrappers.forEach((wrapper) => {
|
|
16335
|
+
const htmlWrapper = wrapper;
|
|
16336
|
+
const id = htmlWrapper.dataset.id;
|
|
16337
|
+
if (id) {
|
|
16338
|
+
let parent = htmlWrapper.parentElement;
|
|
16339
|
+
let isInsideCell = false;
|
|
16340
|
+
while (parent && parent !== editorDOM) {
|
|
16341
|
+
if (parent.hasAttribute("data-column-cell")) {
|
|
16342
|
+
isInsideCell = true;
|
|
16343
|
+
break;
|
|
16352
16344
|
}
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
|
|
16358
|
-
};
|
|
16359
|
-
});
|
|
16360
|
-
} catch (error) {
|
|
16361
|
-
console.error("Error syncing editor items:", error);
|
|
16362
|
-
setItems((prev) => ({ ...prev }));
|
|
16345
|
+
parent = parent.parentElement;
|
|
16346
|
+
}
|
|
16347
|
+
if (!isInsideCell) {
|
|
16348
|
+
domIds.push(id);
|
|
16349
|
+
}
|
|
16363
16350
|
}
|
|
16364
16351
|
});
|
|
16365
|
-
|
|
16366
|
-
|
|
16367
|
-
const editorDOM = editor2 == null ? void 0 : editor2.view.dom;
|
|
16368
|
-
if (!editorDOM)
|
|
16369
|
-
return;
|
|
16370
|
-
const nodeWrappers = editorDOM.querySelectorAll(
|
|
16371
|
-
".react-renderer > div[data-node-view-wrapper][data-id]"
|
|
16372
|
-
);
|
|
16373
|
-
const domIds = [];
|
|
16374
|
-
nodeWrappers.forEach((wrapper) => {
|
|
16375
|
-
const htmlWrapper = wrapper;
|
|
16376
|
-
const id = htmlWrapper.dataset.id;
|
|
16377
|
-
if (id) {
|
|
16378
|
-
let parent = htmlWrapper.parentElement;
|
|
16379
|
-
let isInsideCell = false;
|
|
16380
|
-
while (parent && parent !== editorDOM) {
|
|
16381
|
-
if (parent.hasAttribute("data-column-cell")) {
|
|
16382
|
-
isInsideCell = true;
|
|
16383
|
-
break;
|
|
16384
|
-
}
|
|
16385
|
-
parent = parent.parentElement;
|
|
16386
|
-
}
|
|
16387
|
-
if (!isInsideCell) {
|
|
16388
|
-
domIds.push(id);
|
|
16389
|
-
}
|
|
16390
|
-
}
|
|
16391
|
-
});
|
|
16392
|
-
setItems((prevItems) => ({
|
|
16352
|
+
setItems((prevItems) => {
|
|
16353
|
+
return {
|
|
16393
16354
|
Editor: domIds,
|
|
16394
16355
|
Sidebar: prevItems.Sidebar
|
|
16395
|
-
}
|
|
16396
|
-
}
|
|
16397
|
-
|
|
16398
|
-
|
|
16356
|
+
};
|
|
16357
|
+
});
|
|
16358
|
+
} catch (error) {
|
|
16359
|
+
console.error("Error syncing editor items:", error);
|
|
16360
|
+
setItems((prev) => ({ ...prev }));
|
|
16399
16361
|
}
|
|
16400
|
-
},
|
|
16401
|
-
|
|
16362
|
+
}, "performSync");
|
|
16363
|
+
if (typeof requestAnimationFrame !== "undefined") {
|
|
16364
|
+
rafId.current = requestAnimationFrame(performSync);
|
|
16365
|
+
} else {
|
|
16366
|
+
performSync();
|
|
16367
|
+
}
|
|
16368
|
+
return void 0;
|
|
16402
16369
|
},
|
|
16403
16370
|
[setItems, rafId]
|
|
16404
16371
|
);
|