@particle-academy/react-fancy 4.9.0 → 4.11.0
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 +9 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2421,6 +2421,7 @@ var Button = react.forwardRef(
|
|
|
2421
2421
|
loading = false,
|
|
2422
2422
|
disabled,
|
|
2423
2423
|
href,
|
|
2424
|
+
as: As,
|
|
2424
2425
|
responsive,
|
|
2425
2426
|
labelClassName,
|
|
2426
2427
|
...props
|
|
@@ -2583,11 +2584,12 @@ var Button = react.forwardRef(
|
|
|
2583
2584
|
trailingElements
|
|
2584
2585
|
] });
|
|
2585
2586
|
const safeHref = sanitizeHref(href);
|
|
2587
|
+
const Anchor = As ?? "a";
|
|
2586
2588
|
const buttonEl = safeHref && !disabled ? (
|
|
2587
2589
|
// Anchor mode forwards the same rest props as the <button> branch so
|
|
2588
2590
|
// onClick / target / rel / ref / ARIA / data-* reach the <a> (issue #7).
|
|
2589
2591
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2590
|
-
|
|
2592
|
+
Anchor,
|
|
2591
2593
|
{
|
|
2592
2594
|
ref,
|
|
2593
2595
|
href: safeHref,
|
|
@@ -11656,11 +11658,10 @@ function ContentRenderer({
|
|
|
11656
11658
|
);
|
|
11657
11659
|
}
|
|
11658
11660
|
ContentRenderer.displayName = "ContentRenderer";
|
|
11659
|
-
function toHtml(value, outputFormat, unsafe) {
|
|
11661
|
+
function toHtml(value, outputFormat, unsafe, valueFormat = "auto") {
|
|
11660
11662
|
if (!value) return "";
|
|
11661
11663
|
const raw = (() => {
|
|
11662
|
-
|
|
11663
|
-
const format = detectFormat(value);
|
|
11664
|
+
const format = valueFormat !== "auto" ? valueFormat : outputFormat === "html" ? "html" : detectFormat(value);
|
|
11664
11665
|
if (format === "html") return value;
|
|
11665
11666
|
return marked.marked.parse(value, { async: false }).trim();
|
|
11666
11667
|
})();
|
|
@@ -11673,6 +11674,7 @@ function EditorRoot({
|
|
|
11673
11674
|
defaultValue = "",
|
|
11674
11675
|
onChange,
|
|
11675
11676
|
outputFormat = "html",
|
|
11677
|
+
valueFormat = "auto",
|
|
11676
11678
|
lineSpacing = 1.6,
|
|
11677
11679
|
placeholder,
|
|
11678
11680
|
mode: modeProp,
|
|
@@ -11684,13 +11686,13 @@ function EditorRoot({
|
|
|
11684
11686
|
const mode = useFieldMode(modeProp);
|
|
11685
11687
|
const isView = mode === "view";
|
|
11686
11688
|
const initialHtml = react.useMemo(
|
|
11687
|
-
() => toHtml(value, outputFormat, unsafe),
|
|
11689
|
+
() => toHtml(value, outputFormat, unsafe, valueFormat),
|
|
11688
11690
|
// Seed the contentEditable from the LIVE value when (re)entering edit mode.
|
|
11689
11691
|
// EditorContent reads this once on mount, and it only mounts in edit mode —
|
|
11690
11692
|
// so this captures the current value on view→edit, not a stale mount snapshot,
|
|
11691
11693
|
// and does NOT re-run on every keystroke.
|
|
11692
11694
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11693
|
-
[isView, outputFormat, unsafe]
|
|
11695
|
+
[isView, outputFormat, unsafe, valueFormat]
|
|
11694
11696
|
);
|
|
11695
11697
|
const extensions = react.useMemo(
|
|
11696
11698
|
() => mergeExtensions(instanceExtensions),
|
|
@@ -11767,7 +11769,7 @@ function EditorRoot({
|
|
|
11767
11769
|
ContentRenderer,
|
|
11768
11770
|
{
|
|
11769
11771
|
value,
|
|
11770
|
-
format: outputFormat,
|
|
11772
|
+
format: valueFormat !== "auto" ? valueFormat : outputFormat,
|
|
11771
11773
|
lineSpacing,
|
|
11772
11774
|
extensions: instanceExtensions,
|
|
11773
11775
|
unsafe,
|