@puckeditor/core 0.21.0 → 0.21.1-canary.1a6682a3

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.
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  PuckRichText
3
- } from "./chunk-V5I7CVLT.mjs";
3
+ } from "./chunk-7OHM63FC.mjs";
4
4
  import {
5
5
  EditorInner,
6
6
  LoadedRichTextMenu
7
- } from "./chunk-ZPR7EC3T.mjs";
7
+ } from "./chunk-RHVK562Z.mjs";
8
8
  import "./chunk-AOEDIUVK.mjs";
9
- import "./chunk-RYILZVCB.mjs";
10
- import "./chunk-UFXHMVJE.mjs";
11
- import "./chunk-MNNPATDB.mjs";
12
- import "./chunk-YBJ32VYI.mjs";
9
+ import "./chunk-5V242HXR.mjs";
10
+ import "./chunk-MSZPUXZP.mjs";
11
+ import "./chunk-KOUWDQ4Q.mjs";
12
+ import "./chunk-SKJTJUWU.mjs";
13
13
  import {
14
14
  useAppStore,
15
15
  useAppStoreApi
16
- } from "./chunk-HLB66X4S.mjs";
17
- import "./chunk-QIJR53IK.mjs";
18
- import "./chunk-AHX7X7NZ.mjs";
16
+ } from "./chunk-UMTU6EA7.mjs";
17
+ import "./chunk-37HTE4KO.mjs";
18
+ import "./chunk-MDUBGHWF.mjs";
19
19
  import "./chunk-Y2EFNT5P.mjs";
20
- import "./chunk-7TZD3NRP.mjs";
20
+ import "./chunk-PMXRXC2B.mjs";
21
21
  import {
22
22
  __spreadProps,
23
23
  __spreadValues,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PuckRichText
3
- } from "./chunk-V5I7CVLT.mjs";
3
+ } from "./chunk-7OHM63FC.mjs";
4
4
  import {
5
5
  styles_module_default
6
6
  } from "./chunk-AOEDIUVK.mjs";
@@ -1,9 +1,10 @@
1
1
  import {
2
+ generateId,
2
3
  rootDroppableId,
3
4
  setupZone,
4
5
  walkAppState,
5
6
  walkTree
6
- } from "./chunk-7TZD3NRP.mjs";
7
+ } from "./chunk-PMXRXC2B.mjs";
7
8
  import {
8
9
  __spreadProps,
9
10
  __spreadValues,
@@ -40,11 +41,6 @@ var insert = (list, index, item) => {
40
41
  return result;
41
42
  };
42
43
 
43
- // lib/generate-id.ts
44
- init_react_import();
45
- import { v4 as uuidv4 } from "uuid";
46
- var generateId = (type) => type ? `${type}-${uuidv4()}` : uuidv4();
47
-
48
44
  // lib/data/get-ids-for-parent.ts
49
45
  init_react_import();
50
46
  var getIdsForParent = (zoneCompound, state) => {
@@ -519,7 +515,6 @@ function createReducer({
519
515
 
520
516
  export {
521
517
  insert,
522
- generateId,
523
518
  populateIds,
524
519
  insertAction,
525
520
  getItem,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-UFXHMVJE.mjs";
3
+ } from "./chunk-MSZPUXZP.mjs";
4
4
  import {
5
5
  useHeadingOptions
6
- } from "./chunk-MNNPATDB.mjs";
6
+ } from "./chunk-KOUWDQ4Q.mjs";
7
7
  import {
8
8
  useListOptions
9
- } from "./chunk-YBJ32VYI.mjs";
9
+ } from "./chunk-SKJTJUWU.mjs";
10
10
  import {
11
11
  AlignCenter,
12
12
  AlignJustify,
@@ -26,7 +26,7 @@ import {
26
26
  Strikethrough,
27
27
  Underline,
28
28
  useControlContext
29
- } from "./chunk-HLB66X4S.mjs";
29
+ } from "./chunk-UMTU6EA7.mjs";
30
30
  import {
31
31
  get_class_name_factory_default
32
32
  } from "./chunk-Y2EFNT5P.mjs";
@@ -349,7 +349,7 @@ function AlignSelectFallback() {
349
349
  // components/RichTextMenu/controls/AlignSelect/index.tsx
350
350
  import { jsx as jsx10 } from "react/jsx-runtime";
351
351
  var AlignSelectLoaded = lazy(
352
- () => import("./loaded-G2WSQZO7.mjs").then((m) => ({
352
+ () => import("./loaded-362ACKSQ.mjs").then((m) => ({
353
353
  default: m.AlignSelectLoaded
354
354
  }))
355
355
  );
@@ -580,7 +580,7 @@ function HeadingSelectFallback() {
580
580
  // components/RichTextMenu/controls/HeadingSelect/index.tsx
581
581
  import { jsx as jsx22 } from "react/jsx-runtime";
582
582
  var HeadingSelectLoaded = lazy2(
583
- () => import("./loaded-MYALJBRK.mjs").then((m) => ({
583
+ () => import("./loaded-DIHUQBWF.mjs").then((m) => ({
584
584
  default: m.HeadingSelectLoaded
585
585
  }))
586
586
  );
@@ -612,7 +612,7 @@ function ListSelectFallback() {
612
612
  // components/RichTextMenu/controls/ListSelect/index.tsx
613
613
  import { jsx as jsx24 } from "react/jsx-runtime";
614
614
  var ListSelectLoaded = lazy3(
615
- () => import("./loaded-5AM4V5PV.mjs").then((m) => ({
615
+ () => import("./loaded-SJJ63OY2.mjs").then((m) => ({
616
616
  default: m.ListSelectLoaded
617
617
  }))
618
618
  );
@@ -43,7 +43,7 @@ var PuckRichText = Extension.create({
43
43
  if (options.blockquote !== false) {
44
44
  extensions.push(Blockquote.configure(options.blockquote));
45
45
  }
46
- if (options.bulletList !== false) {
46
+ if (options.bulletList !== false && options.listItem !== false) {
47
47
  extensions.push(BulletList.configure(options.bulletList));
48
48
  }
49
49
  if (options.code !== false) {
@@ -76,7 +76,7 @@ var PuckRichText = Extension.create({
76
76
  if (options.link !== false) {
77
77
  extensions.push(Link.configure(options == null ? void 0 : options.link));
78
78
  }
79
- if (options.orderedList !== false) {
79
+ if (options.orderedList !== false && options.listItem !== false) {
80
80
  extensions.push(OrderedList.configure(options.orderedList));
81
81
  }
82
82
  if (options.paragraph !== false) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EditorInner,
3
3
  LoadedRichTextMenu
4
- } from "./chunk-ZPR7EC3T.mjs";
4
+ } from "./chunk-RHVK562Z.mjs";
5
5
  import {
6
6
  RichTextRenderFallback,
7
7
  SlotRender,
@@ -10,13 +10,13 @@ import {
10
10
  getSlotTransform,
11
11
  useRichtextProps,
12
12
  useSlots
13
- } from "./chunk-WB2EIKOA.mjs";
13
+ } from "./chunk-YECKEQIW.mjs";
14
14
  import {
15
15
  ActionBar,
16
16
  IconButton,
17
17
  LoadedRichTextMenuInner,
18
18
  Loader
19
- } from "./chunk-RYILZVCB.mjs";
19
+ } from "./chunk-5V242HXR.mjs";
20
20
  import {
21
21
  ChevronDown,
22
22
  ChevronRight,
@@ -68,26 +68,26 @@ import {
68
68
  useRegisterHistorySlice,
69
69
  useRegisterPermissionsSlice,
70
70
  useResetAutoZoom
71
- } from "./chunk-HLB66X4S.mjs";
71
+ } from "./chunk-UMTU6EA7.mjs";
72
72
  import {
73
- generateId,
74
73
  getItem,
75
74
  insert,
76
75
  insertAction,
77
76
  makeStatePublic,
78
77
  populateIds
79
- } from "./chunk-QIJR53IK.mjs";
78
+ } from "./chunk-37HTE4KO.mjs";
80
79
  import {
81
80
  defaultAppState,
82
81
  defaultViewports,
83
82
  toComponent
84
- } from "./chunk-AHX7X7NZ.mjs";
83
+ } from "./chunk-MDUBGHWF.mjs";
85
84
  import {
86
85
  get_class_name_factory_default
87
86
  } from "./chunk-Y2EFNT5P.mjs";
88
87
  import {
89
88
  defaultSlots,
90
89
  expandNode,
90
+ generateId,
91
91
  mapFields,
92
92
  rootAreaId,
93
93
  rootDroppableId,
@@ -95,7 +95,7 @@ import {
95
95
  setupZone,
96
96
  walkAppState,
97
97
  walkField
98
- } from "./chunk-7TZD3NRP.mjs";
98
+ } from "./chunk-PMXRXC2B.mjs";
99
99
  import {
100
100
  __async,
101
101
  __commonJS,
@@ -883,12 +883,20 @@ var ArrayFieldItemInternal = ({
883
883
  const canEdit = useAppStore(
884
884
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
885
885
  );
886
+ const hasVisibleFields = useMemo2(() => {
887
+ if (!field.arrayFields) {
888
+ return false;
889
+ }
890
+ return Object.values(field.arrayFields).some(
891
+ (subField) => subField.type !== "slot" && subField.visible !== false
892
+ );
893
+ }, [field.arrayFields]);
886
894
  return /* @__PURE__ */ jsx6(Sortable, { id, index: dragIndex, disabled: readOnly, children: ({ isDragging, ref, handleRef }) => /* @__PURE__ */ jsxs(
887
895
  "div",
888
896
  {
889
897
  ref,
890
898
  className: getClassNameItem({
891
- isExpanded,
899
+ isExpanded: isExpanded && hasVisibleFields,
892
900
  isDragging,
893
901
  readOnly
894
902
  }),
@@ -898,7 +906,7 @@ var ArrayFieldItemInternal = ({
898
906
  {
899
907
  ref: handleRef,
900
908
  onClick: (e) => {
901
- if (isDragging) return;
909
+ if (isDragging || !hasVisibleFields) return;
902
910
  e.preventDefault();
903
911
  e.stopPropagation();
904
912
  onToggleExpand(id, isExpanded);
@@ -921,7 +929,7 @@ var ArrayFieldItemInternal = ({
921
929
  ]
922
930
  }
923
931
  ),
924
- /* @__PURE__ */ jsx6("div", { className: getClassNameItem("body"), children: isExpanded && /* @__PURE__ */ jsx6("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
932
+ /* @__PURE__ */ jsx6("div", { className: getClassNameItem("body"), children: isExpanded && hasVisibleFields && /* @__PURE__ */ jsx6("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
925
933
  const subField = field.arrayFields[subName];
926
934
  return /* @__PURE__ */ jsx6(
927
935
  SubField,
@@ -1971,7 +1979,7 @@ EditorFallback.displayName = "EditorFallback";
1971
1979
  // components/AutoField/fields/RichtextField/index.tsx
1972
1980
  import { Fragment as Fragment4, jsx as jsx17 } from "react/jsx-runtime";
1973
1981
  var Editor = lazy(
1974
- () => import("./Editor-L7XD2QW3.mjs").then((m) => ({
1982
+ () => import("./Editor-BUHU4Z6Z.mjs").then((m) => ({
1975
1983
  default: m.Editor
1976
1984
  }))
1977
1985
  );
@@ -3604,12 +3612,12 @@ import {
3604
3612
  } from "react";
3605
3613
  import { jsx as jsx27 } from "react/jsx-runtime";
3606
3614
  var Editor2 = lazy2(
3607
- () => import("./Editor-L7XD2QW3.mjs").then((m) => ({
3615
+ () => import("./Editor-BUHU4Z6Z.mjs").then((m) => ({
3608
3616
  default: m.Editor
3609
3617
  }))
3610
3618
  );
3611
3619
  var RichTextRender = lazy2(
3612
- () => import("./Render-FXZX6NFH.mjs").then((m) => ({
3620
+ () => import("./Render-DWVWZPNA.mjs").then((m) => ({
3613
3621
  default: m.RichTextRender
3614
3622
  }))
3615
3623
  );
@@ -7715,10 +7723,11 @@ var Layout = ({ children }) => {
7715
7723
  const pluginItems = useMemo23(() => {
7716
7724
  const details = {};
7717
7725
  const defaultPlugins = [blocksPlugin(), outlinePlugin()];
7726
+ const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
7718
7727
  const combinedPlugins = [
7719
7728
  ...defaultPlugins,
7720
7729
  ...plugins != null ? plugins : []
7721
- ].sort((a) => a.name === "legacy-side-bar" ? -1 : 1);
7730
+ ].sort((a, b) => isLegacy(a) - isLegacy(b));
7722
7731
  if (!(plugins == null ? void 0 : plugins.some((p) => p.name === "fields"))) {
7723
7732
  combinedPlugins.push(fieldsPlugin());
7724
7733
  }
@@ -5,7 +5,7 @@ import {
5
5
  Heading4,
6
6
  Heading5,
7
7
  Heading6
8
- } from "./chunk-HLB66X4S.mjs";
8
+ } from "./chunk-UMTU6EA7.mjs";
9
9
  import {
10
10
  init_react_import
11
11
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapFields
3
- } from "./chunk-7TZD3NRP.mjs";
3
+ } from "./chunk-PMXRXC2B.mjs";
4
4
  import {
5
5
  __async,
6
6
  __spreadProps,
@@ -3,7 +3,7 @@ import {
3
3
  AlignJustify,
4
4
  AlignLeft,
5
5
  AlignRight
6
- } from "./chunk-HLB66X4S.mjs";
6
+ } from "./chunk-UMTU6EA7.mjs";
7
7
  import {
8
8
  init_react_import
9
9
  } from "./chunk-M6W7YEVX.mjs";
@@ -422,6 +422,11 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
422
422
  });
423
423
  }
424
424
 
425
+ // lib/generate-id.ts
426
+ init_react_import();
427
+ import { v4 as uuidv4 } from "uuid";
428
+ var generateId = (type) => type ? `${type}-${uuidv4()}` : uuidv4();
429
+
425
430
  // lib/data/setup-zone.ts
426
431
  init_react_import();
427
432
  var setupZone = (data, zoneKey) => {
@@ -445,6 +450,7 @@ export {
445
450
  mapFields,
446
451
  expandNode,
447
452
  walkAppState,
453
+ generateId,
448
454
  walkTree,
449
455
  setupZone
450
456
  };
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-AOEDIUVK.mjs";
4
4
  import {
5
5
  LoadedRichTextMenuInner
6
- } from "./chunk-RYILZVCB.mjs";
6
+ } from "./chunk-5V242HXR.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-HLB66X4S.mjs";
10
+ } from "./chunk-UMTU6EA7.mjs";
11
11
  import {
12
12
  get_class_name_factory_default
13
13
  } from "./chunk-Y2EFNT5P.mjs";
@@ -50,6 +50,9 @@ var EditorInner = memo(
50
50
  event.preventDefault();
51
51
  (_b = editor == null ? void 0 : (_a = editor.commands).toggleItalic) == null ? void 0 : _b.call(_a);
52
52
  }
53
+ if (event.key.toLowerCase() === "backspace") {
54
+ event.stopPropagation();
55
+ }
53
56
  },
54
57
  [editor]
55
58
  );
@@ -97,7 +100,7 @@ init_react_import();
97
100
  import { lazy, Suspense } from "react";
98
101
  import { jsx as jsx2 } from "react/jsx-runtime";
99
102
  var LoadedRichTextMenuFull = lazy(
100
- () => import("./full-4UGAOTTB.mjs").then((m) => ({
103
+ () => import("./full-KLPRWVS4.mjs").then((m) => ({
101
104
  default: m.LoadedRichTextMenuFull
102
105
  }))
103
106
  );
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-HLB66X4S.mjs";
4
+ } from "./chunk-UMTU6EA7.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  createReducer,
3
- generateId,
4
3
  getItem,
5
4
  makeStatePublic
6
- } from "./chunk-QIJR53IK.mjs";
5
+ } from "./chunk-37HTE4KO.mjs";
7
6
  import {
8
7
  defaultAppState,
9
8
  defaultViewports,
10
9
  getChanged,
11
10
  resolveComponentData
12
- } from "./chunk-AHX7X7NZ.mjs";
11
+ } from "./chunk-MDUBGHWF.mjs";
13
12
  import {
14
13
  get_class_name_factory_default
15
14
  } from "./chunk-Y2EFNT5P.mjs";
16
15
  import {
16
+ generateId,
17
17
  walkAppState
18
- } from "./chunk-7TZD3NRP.mjs";
18
+ } from "./chunk-PMXRXC2B.mjs";
19
19
  import {
20
20
  __async,
21
21
  __objRest,
@@ -1593,6 +1593,7 @@ var Select = ({
1593
1593
  }) => {
1594
1594
  const [open, setOpen] = useState(false);
1595
1595
  const hasOptions = options.length > 0;
1596
+ const isDisabled = disabled || !hasOptions;
1596
1597
  return /* @__PURE__ */ jsx(
1597
1598
  "div",
1598
1599
  {
@@ -1601,7 +1602,7 @@ var Select = ({
1601
1602
  hasOptions,
1602
1603
  actionBar: mode === "actionBar",
1603
1604
  standalone: mode === "standalone",
1604
- disabled
1605
+ disabled: isDisabled
1605
1606
  }),
1606
1607
  children: /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
1607
1608
  hasOptions ? /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("button", { className: getClassName("button"), children: [
@@ -5,16 +5,17 @@ import {
5
5
  defaultAppState,
6
6
  resolveComponentData,
7
7
  toComponent
8
- } from "./chunk-AHX7X7NZ.mjs";
8
+ } from "./chunk-MDUBGHWF.mjs";
9
9
  import {
10
10
  get_class_name_factory_default
11
11
  } from "./chunk-Y2EFNT5P.mjs";
12
12
  import {
13
+ generateId,
13
14
  getZoneId,
14
15
  mapFields,
15
16
  walkAppState,
16
17
  walkTree
17
- } from "./chunk-7TZD3NRP.mjs";
18
+ } from "./chunk-PMXRXC2B.mjs";
18
19
  import {
19
20
  __async,
20
21
  __objRest,
@@ -354,15 +355,43 @@ function RichTextRenderFallback({ content }) {
354
355
  ) });
355
356
  }
356
357
 
358
+ // components/RichTextEditor/lib/mapDeep.ts
359
+ init_react_import();
360
+ var mapDeep = (source, path, render) => {
361
+ if (!source) {
362
+ return null;
363
+ }
364
+ if (path.length === 0) {
365
+ return render(source);
366
+ }
367
+ const [key, ...rest] = path;
368
+ if (Array.isArray(source)) {
369
+ return source.map((item) => mapDeep(item, path, render));
370
+ }
371
+ return __spreadProps(__spreadValues({}, source), {
372
+ [key]: mapDeep(source[key], rest, render)
373
+ });
374
+ };
375
+
357
376
  // components/RichTextEditor/lib/use-richtext-props.tsx
358
377
  import { jsx as jsx2 } from "react/jsx-runtime";
359
378
  function useRichtextProps(fields, props) {
360
- const findAllRichtextKeys = (fields2) => {
379
+ const findAllRichtextKeys = (fields2, path = []) => {
361
380
  if (!fields2) return [];
362
381
  const result = [];
363
382
  for (const [key, field] of Object.entries(fields2)) {
383
+ const currentPath = [...path, key];
364
384
  if (field.type === "richtext") {
365
- result.push(key);
385
+ result.push({
386
+ path: currentPath,
387
+ field
388
+ });
389
+ }
390
+ if (field.type === "array" && "arrayFields" in field) {
391
+ result.push(...findAllRichtextKeys(field.arrayFields, currentPath));
392
+ }
393
+ if (field.type === "object" && "objectFields" in field) {
394
+ result.push(...findAllRichtextKeys(field.objectFields, currentPath));
366
395
  }
367
396
  }
368
397
  return result;
@@ -371,20 +400,22 @@ function useRichtextProps(fields, props) {
371
400
  const richtextProps = useMemo2(() => {
372
401
  if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
373
402
  const RichTextRender = lazy(
374
- () => import("./Render-FXZX6NFH.mjs").then((m) => ({
403
+ () => import("./Render-DWVWZPNA.mjs").then((m) => ({
375
404
  default: m.RichTextRender
376
405
  }))
377
406
  );
378
- return richtextKeys.reduce((acc, key) => {
379
- acc[key] = /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ jsx2(
380
- RichTextRender,
407
+ let result = __spreadValues({}, props);
408
+ for (const { path, field } of richtextKeys) {
409
+ result = mapDeep(result, path, (content) => /* @__PURE__ */ jsx2(
410
+ Suspense,
381
411
  {
382
- content: props[key],
383
- field: fields[key]
384
- }
385
- ) });
386
- return acc;
387
- }, {});
412
+ fallback: /* @__PURE__ */ jsx2(RichTextRenderFallback, { content }),
413
+ children: /* @__PURE__ */ jsx2(RichTextRender, { content, field })
414
+ },
415
+ generateId()
416
+ ));
417
+ }
418
+ return result;
388
419
  }, [richtextKeys, props, fields]);
389
420
  return richtextProps;
390
421
  }
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-RYILZVCB.mjs";
4
- import "./chunk-UFXHMVJE.mjs";
5
- import "./chunk-MNNPATDB.mjs";
6
- import "./chunk-YBJ32VYI.mjs";
7
- import "./chunk-HLB66X4S.mjs";
8
- import "./chunk-QIJR53IK.mjs";
9
- import "./chunk-AHX7X7NZ.mjs";
3
+ } from "./chunk-5V242HXR.mjs";
4
+ import "./chunk-MSZPUXZP.mjs";
5
+ import "./chunk-KOUWDQ4Q.mjs";
6
+ import "./chunk-SKJTJUWU.mjs";
7
+ import "./chunk-UMTU6EA7.mjs";
8
+ import "./chunk-37HTE4KO.mjs";
9
+ import "./chunk-MDUBGHWF.mjs";
10
10
  import "./chunk-Y2EFNT5P.mjs";
11
- import "./chunk-7TZD3NRP.mjs";
11
+ import "./chunk-PMXRXC2B.mjs";
12
12
  import {
13
13
  __spreadValues,
14
14
  init_react_import
package/dist/index.js CHANGED
@@ -4081,6 +4081,7 @@ var init_Select = __esm({
4081
4081
  }) => {
4082
4082
  const [open, setOpen] = (0, import_react24.useState)(false);
4083
4083
  const hasOptions = options.length > 0;
4084
+ const isDisabled = disabled || !hasOptions;
4084
4085
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4085
4086
  "div",
4086
4087
  {
@@ -4089,7 +4090,7 @@ var init_Select = __esm({
4089
4090
  hasOptions,
4090
4091
  actionBar: mode === "actionBar",
4091
4092
  standalone: mode === "standalone",
4092
- disabled
4093
+ disabled: isDisabled
4093
4094
  }),
4094
4095
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_popover.Popover, { open, onOpenChange: setOpen, children: [
4095
4096
  hasOptions ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_popover.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("button", { className: getClassName15("button"), children: [
@@ -5060,6 +5061,9 @@ var init_EditorInner = __esm({
5060
5061
  event.preventDefault();
5061
5062
  (_b = editor == null ? void 0 : (_a = editor.commands).toggleItalic) == null ? void 0 : _b.call(_a);
5062
5063
  }
5064
+ if (event.key.toLowerCase() === "backspace") {
5065
+ event.stopPropagation();
5066
+ }
5063
5067
  },
5064
5068
  [editor]
5065
5069
  );
@@ -5246,7 +5250,7 @@ var init_extension = __esm({
5246
5250
  if (options.blockquote !== false) {
5247
5251
  extensions.push(import_extension_blockquote.Blockquote.configure(options.blockquote));
5248
5252
  }
5249
- if (options.bulletList !== false) {
5253
+ if (options.bulletList !== false && options.listItem !== false) {
5250
5254
  extensions.push(import_extension_list.BulletList.configure(options.bulletList));
5251
5255
  }
5252
5256
  if (options.code !== false) {
@@ -5279,7 +5283,7 @@ var init_extension = __esm({
5279
5283
  if (options.link !== false) {
5280
5284
  extensions.push(import_extension_link.Link.configure(options == null ? void 0 : options.link));
5281
5285
  }
5282
- if (options.orderedList !== false) {
5286
+ if (options.orderedList !== false && options.listItem !== false) {
5283
5287
  extensions.push(import_extension_list.OrderedList.configure(options.orderedList));
5284
5288
  }
5285
5289
  if (options.paragraph !== false) {
@@ -6374,12 +6378,20 @@ var ArrayFieldItemInternal = ({
6374
6378
  const canEdit = useAppStore(
6375
6379
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
6376
6380
  );
6381
+ const hasVisibleFields = (0, import_react17.useMemo)(() => {
6382
+ if (!field.arrayFields) {
6383
+ return false;
6384
+ }
6385
+ return Object.values(field.arrayFields).some(
6386
+ (subField) => subField.type !== "slot" && subField.visible !== false
6387
+ );
6388
+ }, [field.arrayFields]);
6377
6389
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Sortable, { id, index: dragIndex, disabled: readOnly, children: ({ isDragging, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
6378
6390
  "div",
6379
6391
  {
6380
6392
  ref,
6381
6393
  className: getClassNameItem({
6382
- isExpanded,
6394
+ isExpanded: isExpanded && hasVisibleFields,
6383
6395
  isDragging,
6384
6396
  readOnly
6385
6397
  }),
@@ -6389,7 +6401,7 @@ var ArrayFieldItemInternal = ({
6389
6401
  {
6390
6402
  ref: handleRef,
6391
6403
  onClick: (e) => {
6392
- if (isDragging) return;
6404
+ if (isDragging || !hasVisibleFields) return;
6393
6405
  e.preventDefault();
6394
6406
  e.stopPropagation();
6395
6407
  onToggleExpand(id, isExpanded);
@@ -6412,7 +6424,7 @@ var ArrayFieldItemInternal = ({
6412
6424
  ]
6413
6425
  }
6414
6426
  ),
6415
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: isExpanded && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
6427
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: isExpanded && hasVisibleFields && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
6416
6428
  const subField = field.arrayFields[subName];
6417
6429
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6418
6430
  SubField,
@@ -8843,15 +8855,46 @@ function RichTextRenderFallback({ content }) {
8843
8855
  ) });
8844
8856
  }
8845
8857
 
8858
+ // components/RichTextEditor/lib/use-richtext-props.tsx
8859
+ init_generate_id();
8860
+
8861
+ // components/RichTextEditor/lib/mapDeep.ts
8862
+ init_react_import();
8863
+ var mapDeep = (source, path, render) => {
8864
+ if (!source) {
8865
+ return null;
8866
+ }
8867
+ if (path.length === 0) {
8868
+ return render(source);
8869
+ }
8870
+ const [key, ...rest] = path;
8871
+ if (Array.isArray(source)) {
8872
+ return source.map((item) => mapDeep(item, path, render));
8873
+ }
8874
+ return __spreadProps(__spreadValues({}, source), {
8875
+ [key]: mapDeep(source[key], rest, render)
8876
+ });
8877
+ };
8878
+
8846
8879
  // components/RichTextEditor/lib/use-richtext-props.tsx
8847
8880
  var import_jsx_runtime59 = require("react/jsx-runtime");
8848
8881
  function useRichtextProps(fields, props) {
8849
- const findAllRichtextKeys = (fields2) => {
8882
+ const findAllRichtextKeys = (fields2, path = []) => {
8850
8883
  if (!fields2) return [];
8851
8884
  const result = [];
8852
8885
  for (const [key, field] of Object.entries(fields2)) {
8886
+ const currentPath = [...path, key];
8853
8887
  if (field.type === "richtext") {
8854
- result.push(key);
8888
+ result.push({
8889
+ path: currentPath,
8890
+ field
8891
+ });
8892
+ }
8893
+ if (field.type === "array" && "arrayFields" in field) {
8894
+ result.push(...findAllRichtextKeys(field.arrayFields, currentPath));
8895
+ }
8896
+ if (field.type === "object" && "objectFields" in field) {
8897
+ result.push(...findAllRichtextKeys(field.objectFields, currentPath));
8855
8898
  }
8856
8899
  }
8857
8900
  return result;
@@ -8864,16 +8907,18 @@ function useRichtextProps(fields, props) {
8864
8907
  default: m.RichTextRender
8865
8908
  }))
8866
8909
  );
8867
- return richtextKeys.reduce((acc, key) => {
8868
- acc[key] = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react59.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8869
- RichTextRender3,
8910
+ let result = __spreadValues({}, props);
8911
+ for (const { path, field } of richtextKeys) {
8912
+ result = mapDeep(result, path, (content) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8913
+ import_react59.Suspense,
8870
8914
  {
8871
- content: props[key],
8872
- field: fields[key]
8873
- }
8874
- ) });
8875
- return acc;
8876
- }, {});
8915
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RichTextRenderFallback, { content }),
8916
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RichTextRender3, { content, field })
8917
+ },
8918
+ generateId()
8919
+ ));
8920
+ }
8921
+ return result;
8877
8922
  }, [richtextKeys, props, fields]);
8878
8923
  return richtextProps;
8879
8924
  }
@@ -13491,10 +13536,11 @@ var Layout = ({ children }) => {
13491
13536
  const pluginItems = (0, import_react92.useMemo)(() => {
13492
13537
  const details = {};
13493
13538
  const defaultPlugins = [blocksPlugin(), outlinePlugin()];
13539
+ const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
13494
13540
  const combinedPlugins = [
13495
13541
  ...defaultPlugins,
13496
13542
  ...plugins != null ? plugins : []
13497
- ].sort((a) => a.name === "legacy-side-bar" ? -1 : 1);
13543
+ ].sort((a, b) => isLegacy(a) - isLegacy(b));
13498
13544
  if (!(plugins == null ? void 0 : plugins.some((p) => p.name === "fields"))) {
13499
13545
  combinedPlugins.push(fieldsPlugin());
13500
13546
  }
package/dist/index.mjs CHANGED
@@ -17,13 +17,13 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-K66K75HC.mjs";
21
- import "./chunk-ZPR7EC3T.mjs";
20
+ } from "./chunk-CFPX6GL5.mjs";
21
+ import "./chunk-RHVK562Z.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-WB2EIKOA.mjs";
26
+ } from "./chunk-YECKEQIW.mjs";
27
27
  import "./chunk-AOEDIUVK.mjs";
28
28
  import {
29
29
  Action,
@@ -33,17 +33,17 @@ import {
33
33
  Label,
34
34
  RichTextMenu,
35
35
  Separator
36
- } from "./chunk-RYILZVCB.mjs";
37
- import "./chunk-UFXHMVJE.mjs";
38
- import "./chunk-MNNPATDB.mjs";
39
- import "./chunk-YBJ32VYI.mjs";
40
- import "./chunk-HLB66X4S.mjs";
41
- import "./chunk-QIJR53IK.mjs";
42
- import "./chunk-AHX7X7NZ.mjs";
36
+ } from "./chunk-5V242HXR.mjs";
37
+ import "./chunk-MSZPUXZP.mjs";
38
+ import "./chunk-KOUWDQ4Q.mjs";
39
+ import "./chunk-SKJTJUWU.mjs";
40
+ import "./chunk-UMTU6EA7.mjs";
41
+ import "./chunk-37HTE4KO.mjs";
42
+ import "./chunk-MDUBGHWF.mjs";
43
43
  import "./chunk-Y2EFNT5P.mjs";
44
44
  import {
45
45
  walkTree
46
- } from "./chunk-7TZD3NRP.mjs";
46
+ } from "./chunk-PMXRXC2B.mjs";
47
47
  import "./chunk-M6W7YEVX.mjs";
48
48
  export {
49
49
  Action,
package/dist/internal.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createReducer
3
- } from "./chunk-QIJR53IK.mjs";
4
- import "./chunk-7TZD3NRP.mjs";
3
+ } from "./chunk-37HTE4KO.mjs";
4
+ import "./chunk-PMXRXC2B.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-UFXHMVJE.mjs";
3
+ } from "./chunk-MSZPUXZP.mjs";
4
4
  import {
5
5
  AlignLeft,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-HLB66X4S.mjs";
9
- import "./chunk-QIJR53IK.mjs";
10
- import "./chunk-AHX7X7NZ.mjs";
8
+ } from "./chunk-UMTU6EA7.mjs";
9
+ import "./chunk-37HTE4KO.mjs";
10
+ import "./chunk-MDUBGHWF.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-7TZD3NRP.mjs";
12
+ import "./chunk-PMXRXC2B.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useHeadingOptions
3
- } from "./chunk-MNNPATDB.mjs";
3
+ } from "./chunk-KOUWDQ4Q.mjs";
4
4
  import {
5
5
  Heading,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-HLB66X4S.mjs";
9
- import "./chunk-QIJR53IK.mjs";
10
- import "./chunk-AHX7X7NZ.mjs";
8
+ } from "./chunk-UMTU6EA7.mjs";
9
+ import "./chunk-37HTE4KO.mjs";
10
+ import "./chunk-MDUBGHWF.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-7TZD3NRP.mjs";
12
+ import "./chunk-PMXRXC2B.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-YBJ32VYI.mjs";
3
+ } from "./chunk-SKJTJUWU.mjs";
4
4
  import {
5
5
  List,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-HLB66X4S.mjs";
9
- import "./chunk-QIJR53IK.mjs";
10
- import "./chunk-AHX7X7NZ.mjs";
8
+ } from "./chunk-UMTU6EA7.mjs";
9
+ import "./chunk-37HTE4KO.mjs";
10
+ import "./chunk-MDUBGHWF.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-7TZD3NRP.mjs";
12
+ import "./chunk-PMXRXC2B.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -4081,6 +4081,7 @@ var init_Select = __esm({
4081
4081
  }) => {
4082
4082
  const [open, setOpen] = (0, import_react24.useState)(false);
4083
4083
  const hasOptions = options.length > 0;
4084
+ const isDisabled = disabled || !hasOptions;
4084
4085
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4085
4086
  "div",
4086
4087
  {
@@ -4089,7 +4090,7 @@ var init_Select = __esm({
4089
4090
  hasOptions,
4090
4091
  actionBar: mode === "actionBar",
4091
4092
  standalone: mode === "standalone",
4092
- disabled
4093
+ disabled: isDisabled
4093
4094
  }),
4094
4095
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_popover.Popover, { open, onOpenChange: setOpen, children: [
4095
4096
  hasOptions ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_popover.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("button", { className: getClassName15("button"), children: [
@@ -5060,6 +5061,9 @@ var init_EditorInner = __esm({
5060
5061
  event.preventDefault();
5061
5062
  (_b = editor == null ? void 0 : (_a = editor.commands).toggleItalic) == null ? void 0 : _b.call(_a);
5062
5063
  }
5064
+ if (event.key.toLowerCase() === "backspace") {
5065
+ event.stopPropagation();
5066
+ }
5063
5067
  },
5064
5068
  [editor]
5065
5069
  );
@@ -5246,7 +5250,7 @@ var init_extension = __esm({
5246
5250
  if (options.blockquote !== false) {
5247
5251
  extensions.push(import_extension_blockquote.Blockquote.configure(options.blockquote));
5248
5252
  }
5249
- if (options.bulletList !== false) {
5253
+ if (options.bulletList !== false && options.listItem !== false) {
5250
5254
  extensions.push(import_extension_list.BulletList.configure(options.bulletList));
5251
5255
  }
5252
5256
  if (options.code !== false) {
@@ -5279,7 +5283,7 @@ var init_extension = __esm({
5279
5283
  if (options.link !== false) {
5280
5284
  extensions.push(import_extension_link.Link.configure(options == null ? void 0 : options.link));
5281
5285
  }
5282
- if (options.orderedList !== false) {
5286
+ if (options.orderedList !== false && options.listItem !== false) {
5283
5287
  extensions.push(import_extension_list.OrderedList.configure(options.orderedList));
5284
5288
  }
5285
5289
  if (options.paragraph !== false) {
@@ -6377,12 +6381,20 @@ var ArrayFieldItemInternal = ({
6377
6381
  const canEdit = useAppStore(
6378
6382
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
6379
6383
  );
6384
+ const hasVisibleFields = (0, import_react17.useMemo)(() => {
6385
+ if (!field.arrayFields) {
6386
+ return false;
6387
+ }
6388
+ return Object.values(field.arrayFields).some(
6389
+ (subField) => subField.type !== "slot" && subField.visible !== false
6390
+ );
6391
+ }, [field.arrayFields]);
6380
6392
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Sortable, { id, index: dragIndex, disabled: readOnly, children: ({ isDragging, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
6381
6393
  "div",
6382
6394
  {
6383
6395
  ref,
6384
6396
  className: getClassNameItem({
6385
- isExpanded,
6397
+ isExpanded: isExpanded && hasVisibleFields,
6386
6398
  isDragging,
6387
6399
  readOnly
6388
6400
  }),
@@ -6392,7 +6404,7 @@ var ArrayFieldItemInternal = ({
6392
6404
  {
6393
6405
  ref: handleRef,
6394
6406
  onClick: (e) => {
6395
- if (isDragging) return;
6407
+ if (isDragging || !hasVisibleFields) return;
6396
6408
  e.preventDefault();
6397
6409
  e.stopPropagation();
6398
6410
  onToggleExpand(id, isExpanded);
@@ -6415,7 +6427,7 @@ var ArrayFieldItemInternal = ({
6415
6427
  ]
6416
6428
  }
6417
6429
  ),
6418
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: isExpanded && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
6430
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: isExpanded && hasVisibleFields && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
6419
6431
  const subField = field.arrayFields[subName];
6420
6432
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6421
6433
  SubField,
@@ -8846,15 +8858,46 @@ function RichTextRenderFallback({ content }) {
8846
8858
  ) });
8847
8859
  }
8848
8860
 
8861
+ // components/RichTextEditor/lib/use-richtext-props.tsx
8862
+ init_generate_id();
8863
+
8864
+ // components/RichTextEditor/lib/mapDeep.ts
8865
+ init_react_import();
8866
+ var mapDeep = (source, path, render) => {
8867
+ if (!source) {
8868
+ return null;
8869
+ }
8870
+ if (path.length === 0) {
8871
+ return render(source);
8872
+ }
8873
+ const [key, ...rest] = path;
8874
+ if (Array.isArray(source)) {
8875
+ return source.map((item) => mapDeep(item, path, render));
8876
+ }
8877
+ return __spreadProps(__spreadValues({}, source), {
8878
+ [key]: mapDeep(source[key], rest, render)
8879
+ });
8880
+ };
8881
+
8849
8882
  // components/RichTextEditor/lib/use-richtext-props.tsx
8850
8883
  var import_jsx_runtime59 = require("react/jsx-runtime");
8851
8884
  function useRichtextProps(fields, props) {
8852
- const findAllRichtextKeys = (fields2) => {
8885
+ const findAllRichtextKeys = (fields2, path = []) => {
8853
8886
  if (!fields2) return [];
8854
8887
  const result = [];
8855
8888
  for (const [key, field] of Object.entries(fields2)) {
8889
+ const currentPath = [...path, key];
8856
8890
  if (field.type === "richtext") {
8857
- result.push(key);
8891
+ result.push({
8892
+ path: currentPath,
8893
+ field
8894
+ });
8895
+ }
8896
+ if (field.type === "array" && "arrayFields" in field) {
8897
+ result.push(...findAllRichtextKeys(field.arrayFields, currentPath));
8898
+ }
8899
+ if (field.type === "object" && "objectFields" in field) {
8900
+ result.push(...findAllRichtextKeys(field.objectFields, currentPath));
8858
8901
  }
8859
8902
  }
8860
8903
  return result;
@@ -8867,16 +8910,18 @@ function useRichtextProps(fields, props) {
8867
8910
  default: m.RichTextRender
8868
8911
  }))
8869
8912
  );
8870
- return richtextKeys.reduce((acc, key) => {
8871
- acc[key] = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react59.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8872
- RichTextRender3,
8913
+ let result = __spreadValues({}, props);
8914
+ for (const { path, field } of richtextKeys) {
8915
+ result = mapDeep(result, path, (content) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8916
+ import_react59.Suspense,
8873
8917
  {
8874
- content: props[key],
8875
- field: fields[key]
8876
- }
8877
- ) });
8878
- return acc;
8879
- }, {});
8918
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RichTextRenderFallback, { content }),
8919
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RichTextRender3, { content, field })
8920
+ },
8921
+ generateId()
8922
+ ));
8923
+ }
8924
+ return result;
8880
8925
  }, [richtextKeys, props, fields]);
8881
8926
  return richtextProps;
8882
8927
  }
@@ -13494,10 +13539,11 @@ var Layout = ({ children }) => {
13494
13539
  const pluginItems = (0, import_react92.useMemo)(() => {
13495
13540
  const details = {};
13496
13541
  const defaultPlugins = [blocksPlugin(), outlinePlugin()];
13542
+ const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
13497
13543
  const combinedPlugins = [
13498
13544
  ...defaultPlugins,
13499
13545
  ...plugins != null ? plugins : []
13500
- ].sort((a) => a.name === "legacy-side-bar" ? -1 : 1);
13546
+ ].sort((a, b) => isLegacy(a) - isLegacy(b));
13501
13547
  if (!(plugins == null ? void 0 : plugins.some((p) => p.name === "fields"))) {
13502
13548
  combinedPlugins.push(fieldsPlugin());
13503
13549
  }
@@ -17,13 +17,13 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-K66K75HC.mjs";
21
- import "./chunk-ZPR7EC3T.mjs";
20
+ } from "./chunk-CFPX6GL5.mjs";
21
+ import "./chunk-RHVK562Z.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-WB2EIKOA.mjs";
26
+ } from "./chunk-YECKEQIW.mjs";
27
27
  import "./chunk-AOEDIUVK.mjs";
28
28
  import {
29
29
  Action,
@@ -33,17 +33,17 @@ import {
33
33
  Label,
34
34
  RichTextMenu,
35
35
  Separator
36
- } from "./chunk-RYILZVCB.mjs";
37
- import "./chunk-UFXHMVJE.mjs";
38
- import "./chunk-MNNPATDB.mjs";
39
- import "./chunk-YBJ32VYI.mjs";
40
- import "./chunk-HLB66X4S.mjs";
41
- import "./chunk-QIJR53IK.mjs";
42
- import "./chunk-AHX7X7NZ.mjs";
36
+ } from "./chunk-5V242HXR.mjs";
37
+ import "./chunk-MSZPUXZP.mjs";
38
+ import "./chunk-KOUWDQ4Q.mjs";
39
+ import "./chunk-SKJTJUWU.mjs";
40
+ import "./chunk-UMTU6EA7.mjs";
41
+ import "./chunk-37HTE4KO.mjs";
42
+ import "./chunk-MDUBGHWF.mjs";
43
43
  import "./chunk-Y2EFNT5P.mjs";
44
44
  import {
45
45
  walkTree
46
- } from "./chunk-7TZD3NRP.mjs";
46
+ } from "./chunk-PMXRXC2B.mjs";
47
47
  import {
48
48
  init_react_import
49
49
  } from "./chunk-M6W7YEVX.mjs";
package/dist/rsc.js CHANGED
@@ -242,7 +242,7 @@ var init_extension = __esm({
242
242
  if (options.blockquote !== false) {
243
243
  extensions.push(import_extension_blockquote.Blockquote.configure(options.blockquote));
244
244
  }
245
- if (options.bulletList !== false) {
245
+ if (options.bulletList !== false && options.listItem !== false) {
246
246
  extensions.push(import_extension_list.BulletList.configure(options.bulletList));
247
247
  }
248
248
  if (options.code !== false) {
@@ -275,7 +275,7 @@ var init_extension = __esm({
275
275
  if (options.link !== false) {
276
276
  extensions.push(import_extension_link.Link.configure(options == null ? void 0 : options.link));
277
277
  }
278
- if (options.orderedList !== false) {
278
+ if (options.orderedList !== false && options.listItem !== false) {
279
279
  extensions.push(import_extension_list.OrderedList.configure(options.orderedList));
280
280
  }
281
281
  if (options.paragraph !== false) {
@@ -643,15 +643,48 @@ function RichTextRenderFallback({ content }) {
643
643
  ) });
644
644
  }
645
645
 
646
+ // lib/generate-id.ts
647
+ init_react_import();
648
+ var import_uuid = require("uuid");
649
+ var generateId = (type) => type ? `${type}-${(0, import_uuid.v4)()}` : (0, import_uuid.v4)();
650
+
651
+ // components/RichTextEditor/lib/mapDeep.ts
652
+ init_react_import();
653
+ var mapDeep = (source, path, render) => {
654
+ if (!source) {
655
+ return null;
656
+ }
657
+ if (path.length === 0) {
658
+ return render(source);
659
+ }
660
+ const [key, ...rest] = path;
661
+ if (Array.isArray(source)) {
662
+ return source.map((item) => mapDeep(item, path, render));
663
+ }
664
+ return __spreadProps(__spreadValues({}, source), {
665
+ [key]: mapDeep(source[key], rest, render)
666
+ });
667
+ };
668
+
646
669
  // components/RichTextEditor/lib/use-richtext-props.tsx
647
670
  var import_jsx_runtime3 = require("react/jsx-runtime");
648
671
  function useRichtextProps(fields, props) {
649
- const findAllRichtextKeys = (fields2) => {
672
+ const findAllRichtextKeys = (fields2, path = []) => {
650
673
  if (!fields2) return [];
651
674
  const result = [];
652
675
  for (const [key, field] of Object.entries(fields2)) {
676
+ const currentPath = [...path, key];
653
677
  if (field.type === "richtext") {
654
- result.push(key);
678
+ result.push({
679
+ path: currentPath,
680
+ field
681
+ });
682
+ }
683
+ if (field.type === "array" && "arrayFields" in field) {
684
+ result.push(...findAllRichtextKeys(field.arrayFields, currentPath));
685
+ }
686
+ if (field.type === "object" && "objectFields" in field) {
687
+ result.push(...findAllRichtextKeys(field.objectFields, currentPath));
655
688
  }
656
689
  }
657
690
  return result;
@@ -664,16 +697,18 @@ function useRichtextProps(fields, props) {
664
697
  default: m.RichTextRender
665
698
  }))
666
699
  );
667
- return richtextKeys.reduce((acc, key) => {
668
- acc[key] = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react4.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
669
- RichTextRender2,
700
+ let result = __spreadValues({}, props);
701
+ for (const { path, field } of richtextKeys) {
702
+ result = mapDeep(result, path, (content) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
703
+ import_react4.Suspense,
670
704
  {
671
- content: props[key],
672
- field: fields[key]
673
- }
674
- ) });
675
- return acc;
676
- }, {});
705
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RichTextRenderFallback, { content }),
706
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RichTextRender2, { content, field })
707
+ },
708
+ generateId()
709
+ ));
710
+ }
711
+ return result;
677
712
  }, [richtextKeys, props, fields]);
678
713
  return richtextProps;
679
714
  }
package/dist/rsc.mjs CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  transformProps,
6
6
  useRichtextProps,
7
7
  useSlots
8
- } from "./chunk-WB2EIKOA.mjs";
8
+ } from "./chunk-YECKEQIW.mjs";
9
9
  import "./chunk-AOEDIUVK.mjs";
10
- import "./chunk-AHX7X7NZ.mjs";
10
+ import "./chunk-MDUBGHWF.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
12
  import {
13
13
  rootAreaId,
@@ -15,7 +15,7 @@ import {
15
15
  rootZone,
16
16
  setupZone,
17
17
  walkTree
18
- } from "./chunk-7TZD3NRP.mjs";
18
+ } from "./chunk-PMXRXC2B.mjs";
19
19
  import {
20
20
  __spreadProps,
21
21
  __spreadValues,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puckeditor/core",
3
- "version": "0.21.0",
3
+ "version": "0.21.1-canary.1a6682a3",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "puckeditor/puck",