@flozy/editor 4.8.7 → 4.8.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -139,13 +139,13 @@ const GridItem = props => {
|
|
139
139
|
const minWidthInPercent = isRightCol ? `${widths?.right}%` : cmWidth;
|
140
140
|
useEffect(() => {
|
141
141
|
try {
|
142
|
-
if (columnRef?.current && !parentDOM?.parentDOM) {
|
142
|
+
if (columnRef?.current && (!parentDOM?.parentDOM || !minWidth)) {
|
143
143
|
initDoms();
|
144
144
|
}
|
145
145
|
} catch (err) {
|
146
146
|
console.log(err);
|
147
147
|
}
|
148
|
-
}, [columnRef?.current]);
|
148
|
+
}, [columnRef?.current, minWidth]);
|
149
149
|
useEffect(() => {
|
150
150
|
if (isDone || isRightCol) {
|
151
151
|
initDoms();
|
@@ -158,7 +158,7 @@ const GridItem = props => {
|
|
158
158
|
// set init width
|
159
159
|
initColumnWidth(path, size?.width / parentDOM?.gridWidth * 100);
|
160
160
|
}
|
161
|
-
}, [resizing]);
|
161
|
+
}, [resizing, isDone]);
|
162
162
|
useEffect(() => {
|
163
163
|
if (resizing) {
|
164
164
|
updateColumnWidth({
|
@@ -219,7 +219,8 @@ const GridItem = props => {
|
|
219
219
|
onAddGridItem({
|
220
220
|
editor,
|
221
221
|
element: gridNode,
|
222
|
-
children: gridNode?.children || []
|
222
|
+
children: gridNode?.children || [],
|
223
|
+
isColumn: gridNode?.equalItems
|
223
224
|
});
|
224
225
|
} catch (err) {
|
225
226
|
console.log(err);
|
@@ -20,10 +20,22 @@ export const gridItem = (props = {}) => {
|
|
20
20
|
...(props || {})
|
21
21
|
};
|
22
22
|
};
|
23
|
+
const updateLastSiblingWidths = (editor, lastChildPath = []) => {
|
24
|
+
try {
|
25
|
+
Transforms.setNodes(editor, {
|
26
|
+
minWidth: ""
|
27
|
+
}, {
|
28
|
+
at: lastChildPath
|
29
|
+
});
|
30
|
+
} catch (err) {
|
31
|
+
console.log(err);
|
32
|
+
}
|
33
|
+
};
|
23
34
|
export const onAddGridItem = ({
|
24
35
|
editor,
|
25
36
|
element,
|
26
|
-
children
|
37
|
+
children,
|
38
|
+
isColumn
|
27
39
|
}) => {
|
28
40
|
const currentPath = editor.selection?.anchor?.path;
|
29
41
|
const ancestorsPath = Path.ancestors(currentPath, {
|
@@ -36,8 +48,12 @@ export const onAddGridItem = ({
|
|
36
48
|
const lastElement = {
|
37
49
|
...element.children[element.children.length - 1]
|
38
50
|
};
|
51
|
+
if (isColumn && children?.length - 1 > 0) {
|
52
|
+
updateLastSiblingWidths(editor, [...lp, children.length - 1]);
|
53
|
+
}
|
39
54
|
Transforms.insertNodes(editor, gridItem({
|
40
|
-
...lastElement,
|
55
|
+
...(lastElement || {}),
|
56
|
+
minWidth: null,
|
41
57
|
children: [{
|
42
58
|
type: "paragraph",
|
43
59
|
children: [{
|