@particle-academy/react-fancy 3.4.0 → 3.4.2
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 +12 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3269,12 +3269,17 @@ function useFloatingPosition(anchorRef, floatingRef, options = {}) {
|
|
|
3269
3269
|
}, [anchorRef, floatingRef, placement, offset]);
|
|
3270
3270
|
react.useLayoutEffect(() => {
|
|
3271
3271
|
if (!enabled) return;
|
|
3272
|
-
|
|
3273
|
-
|
|
3272
|
+
let raf = 0;
|
|
3273
|
+
let frames = 0;
|
|
3274
|
+
const measure = () => {
|
|
3274
3275
|
update();
|
|
3275
|
-
|
|
3276
|
+
if (!floatingRef.current && frames++ < 20) {
|
|
3277
|
+
raf = requestAnimationFrame(measure);
|
|
3278
|
+
}
|
|
3279
|
+
};
|
|
3280
|
+
measure();
|
|
3276
3281
|
return () => cancelAnimationFrame(raf);
|
|
3277
|
-
}, [update, enabled]);
|
|
3282
|
+
}, [update, enabled, floatingRef]);
|
|
3278
3283
|
react.useEffect(() => {
|
|
3279
3284
|
if (!enabled) return;
|
|
3280
3285
|
window.addEventListener("scroll", update, true);
|
|
@@ -10812,8 +10817,9 @@ function ContentRenderer({
|
|
|
10812
10817
|
[instanceExtensions]
|
|
10813
10818
|
);
|
|
10814
10819
|
const html = react.useMemo(() => {
|
|
10815
|
-
const
|
|
10816
|
-
const
|
|
10820
|
+
const safe = value ?? "";
|
|
10821
|
+
const resolvedFormat = format === "auto" ? detectFormat(safe) : format;
|
|
10822
|
+
const raw = resolvedFormat === "markdown" ? marked.marked.parse(safe, { async: false }) : safe;
|
|
10817
10823
|
return unsafe ? raw : sanitizeHtml(raw);
|
|
10818
10824
|
}, [value, format, unsafe]);
|
|
10819
10825
|
const hasExtensions = extensions.length > 0;
|