@edifice.io/react 1.7.4-develop-pedago.20241216163755 → 1.7.4-develop-pedago.20241217113003

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.
@@ -11,7 +11,6 @@ import SvgIconRafterRight from "../../../modules/icons/components/IconRafterRigh
11
11
  import { useTree } from "../hooks/useTree.js";
12
12
  import { useTreeSortable } from "../hooks/useTreeSortable.js";
13
13
  import { flattenNodes } from "../utilities/tree-sortable.js";
14
- import { mergeRefs } from "../../../utilities/refs/ref.js";
15
14
  const SortableTree = ({
16
15
  nodes,
17
16
  selectedNodeId: externalSelectedNodeId,
@@ -74,7 +73,7 @@ const SortableTree = ({
74
73
  renderNode,
75
74
  onTreeItemClick,
76
75
  onToggleNode
77
- }, ref) => {
76
+ }) => {
78
77
  const {
79
78
  t
80
79
  } = useTranslation(), selected = selectedNodeId === node.id, expanded = expandedNodes.has(node.id), animateLayoutChanges = ({
@@ -109,7 +108,7 @@ const SortableTree = ({
109
108
  }, handleItemToggleKeyDown = (event) => {
110
109
  (event.code === "Enter" || event.code === "Space") && (event.preventDefault(), event.stopPropagation(), onToggleNode == null || onToggleNode(node.id));
111
110
  }, spaceGestion = () => isDragging ? isChild ? depth === 1 ? `${indentationWidth * depth}px` : "0px" : `${indentationWidth * depth}px` : isChild ? "20px" : null;
112
- return /* @__PURE__ */ jsx("li", { ref: mergeRefs(ref, setNodeRef), id: `treeitem-${node.id}`, role: "treeitem", "aria-selected": selected, "aria-expanded": expanded, style: {
111
+ return /* @__PURE__ */ jsx("li", { ref: setNodeRef, id: `treeitem-${node.id}`, role: "treeitem", "aria-selected": selected, "aria-expanded": expanded, style: {
113
112
  ...style,
114
113
  marginLeft: spaceGestion()
115
114
  }, ...listeners, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: treeItemClasses.action, children: [
@@ -15,11 +15,7 @@ const useTreeSortable = ({
15
15
  const activationConstraint = {
16
16
  delay: 200,
17
17
  tolerance: 5
18
- }, indicator = !1, indentationWidth = 64, flattenedTree = useMemo(
19
- () => flattenTree(items, null),
20
- // eslint-disable-next-line react-hooks/exhaustive-deps
21
- [items]
22
- ), activeItem = activeId ? flattenedTree.find(({
18
+ }, indicator = !1, indentationWidth = 64, flattenedTree = useMemo(() => flattenTree(items, null), [items]), activeItem = activeId ? flattenedTree.find(({
23
19
  id
24
20
  }) => id === activeId) : null, projected = activeId && overId ? getProjection(flattenedTree, activeId, overId, offsetLeft, indentationWidth) : null;
25
21
  function handleDragStart(event) {
@@ -34,13 +34,13 @@ function getIndicesToUpdate(activeNode, activeNodeIndex, flattenedTree, projecte
34
34
  }
35
35
  function flattenTree(tree, parentId, depth = 0) {
36
36
  return tree.reduce((acc, node) => (acc.push({
37
+ ...node,
37
38
  id: node.id,
38
39
  name: node.name,
39
40
  parentId: parentId ?? null,
40
41
  position: node.position ?? void 0,
41
42
  depth: depth ?? 0,
42
- children: node.children,
43
- isVisible: node.isVisible
43
+ children: node.children
44
44
  }), node.children && node.children.length > 0 && (acc = acc.concat(flattenTree(node.children, node.id, depth + 1))), acc), []);
45
45
  }
46
46
  function flattenNodes(nodes, expandedNodes) {
@@ -48,6 +48,7 @@ function flattenNodes(nodes, expandedNodes) {
48
48
  var _a;
49
49
  const isExpanded = expandedNodes.has(node.id) && node.children && node.children.length > 0;
50
50
  return acc.push({
51
+ ...node,
51
52
  id: node.id,
52
53
  name: node.name,
53
54
  isChild,
@@ -12,13 +12,11 @@ const AttachmentRenderer = (props) => {
12
12
  const {
13
13
  t
14
14
  } = useTranslation(), {
15
- node,
16
- editor
15
+ node
17
16
  } = props, {
18
17
  editable
19
18
  } = useEditorContext(), [attachmentArrayAttrs, setAttachmentArrayAttrs] = useState(node.attrs.links), handleDelete = (index) => {
20
- var _a, _b;
21
- (_b = (_a = editor.commands).removeAttachment) == null || _b.call(_a), setAttachmentArrayAttrs((oldAttachments) => oldAttachments.filter((_, i) => i !== index));
19
+ setAttachmentArrayAttrs((oldAttachments) => oldAttachments.filter((_, i) => i !== index));
22
20
  };
23
21
  return attachmentArrayAttrs.length !== 0 && /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsxs("div", { style: {
24
22
  backgroundColor: "#F2F2F2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "1.7.4-develop-pedago.20241216163755",
3
+ "version": "1.7.4-develop-pedago.20241217113003",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -119,9 +119,9 @@
119
119
  "react-slugify": "^3.0.3",
120
120
  "swiper": "^10.1.0",
121
121
  "ua-parser-js": "^1.0.36",
122
- "@edifice.io/bootstrap": "1.7.4-develop-pedago.20241216163755",
123
- "@edifice.io/utilities": "1.7.4-develop-pedago.20241216163755",
124
- "@edifice.io/tiptap-extensions": "1.7.4-develop-pedago.20241216163755"
122
+ "@edifice.io/bootstrap": "1.7.4-develop-pedago.20241217113003",
123
+ "@edifice.io/tiptap-extensions": "1.7.4-develop-pedago.20241217113003",
124
+ "@edifice.io/utilities": "1.7.4-develop-pedago.20241217113003"
125
125
  },
126
126
  "devDependencies": {
127
127
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -147,7 +147,7 @@
147
147
  "typescript-eslint": "^8.8.1",
148
148
  "vite": "^5.4.11",
149
149
  "vite-plugin-dts": "^4.1.0",
150
- "@edifice.io/client": "1.7.4-develop-pedago.20241216163755"
150
+ "@edifice.io/client": "1.7.4-develop-pedago.20241217113003"
151
151
  },
152
152
  "peerDependencies": {
153
153
  "@react-spring/web": "^9.7.5",