@particle-academy/react-fancy 4.9.0 → 4.10.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 CHANGED
@@ -11656,11 +11656,10 @@ function ContentRenderer({
11656
11656
  );
11657
11657
  }
11658
11658
  ContentRenderer.displayName = "ContentRenderer";
11659
- function toHtml(value, outputFormat, unsafe) {
11659
+ function toHtml(value, outputFormat, unsafe, valueFormat = "auto") {
11660
11660
  if (!value) return "";
11661
11661
  const raw = (() => {
11662
- if (outputFormat === "html") return value;
11663
- const format = detectFormat(value);
11662
+ const format = valueFormat !== "auto" ? valueFormat : outputFormat === "html" ? "html" : detectFormat(value);
11664
11663
  if (format === "html") return value;
11665
11664
  return marked.marked.parse(value, { async: false }).trim();
11666
11665
  })();
@@ -11673,6 +11672,7 @@ function EditorRoot({
11673
11672
  defaultValue = "",
11674
11673
  onChange,
11675
11674
  outputFormat = "html",
11675
+ valueFormat = "auto",
11676
11676
  lineSpacing = 1.6,
11677
11677
  placeholder,
11678
11678
  mode: modeProp,
@@ -11684,13 +11684,13 @@ function EditorRoot({
11684
11684
  const mode = useFieldMode(modeProp);
11685
11685
  const isView = mode === "view";
11686
11686
  const initialHtml = react.useMemo(
11687
- () => toHtml(value, outputFormat, unsafe),
11687
+ () => toHtml(value, outputFormat, unsafe, valueFormat),
11688
11688
  // Seed the contentEditable from the LIVE value when (re)entering edit mode.
11689
11689
  // EditorContent reads this once on mount, and it only mounts in edit mode —
11690
11690
  // so this captures the current value on view→edit, not a stale mount snapshot,
11691
11691
  // and does NOT re-run on every keystroke.
11692
11692
  // eslint-disable-next-line react-hooks/exhaustive-deps
11693
- [isView, outputFormat, unsafe]
11693
+ [isView, outputFormat, unsafe, valueFormat]
11694
11694
  );
11695
11695
  const extensions = react.useMemo(
11696
11696
  () => mergeExtensions(instanceExtensions),
@@ -11767,7 +11767,7 @@ function EditorRoot({
11767
11767
  ContentRenderer,
11768
11768
  {
11769
11769
  value,
11770
- format: outputFormat,
11770
+ format: valueFormat !== "auto" ? valueFormat : outputFormat,
11771
11771
  lineSpacing,
11772
11772
  extensions: instanceExtensions,
11773
11773
  unsafe,