@flozy/editor 5.6.8 → 5.6.9

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.
@@ -20,7 +20,7 @@ const useTableStyles = (theme, appTheme) => ({
20
20
  "& .fillStroke": {
21
21
  stroke: appTheme?.palette?.editor?.tv_stroke
22
22
  },
23
- '& path': {
23
+ "& path": {
24
24
  stroke: appTheme?.palette?.editor?.tv_text
25
25
  }
26
26
  }
@@ -30,7 +30,10 @@ const useTableStyles = (theme, appTheme) => ({
30
30
  "& input": {
31
31
  color: appTheme?.palette?.editor?.tv_text_primary,
32
32
  background: "transparent",
33
- fontSize: '14px'
33
+ fontSize: "14px"
34
+ },
35
+ "& .Mui-disabled": {
36
+ "-webkit-text-fill-color": `${appTheme?.palette?.editor?.tv_text_primary} !important`
34
37
  }
35
38
  },
36
39
  "& th, tr, td": {
@@ -39,19 +42,19 @@ const useTableStyles = (theme, appTheme) => ({
39
42
  "& .tv-act-btn": {
40
43
  color: appTheme?.palette?.editor?.tv_text,
41
44
  textTransform: "none",
42
- '& .MuiButton-startIcon': {
45
+ "& .MuiButton-startIcon": {
43
46
  background: appTheme?.palette?.editor?.tv_ico_bg,
44
- borderRadius: '4px',
45
- padding: '4px',
47
+ borderRadius: "4px",
48
+ padding: "4px",
46
49
  "& svg": {
47
- width: '14px',
48
- height: '14px'
50
+ width: "14px",
51
+ height: "14px"
49
52
  }
50
53
  },
51
54
  "&.ico": {
52
55
  "& svg": {
53
56
  color: appTheme?.palette?.editor?.tv_text,
54
- '& path': {
57
+ "& path": {
55
58
  stroke: appTheme?.palette?.editor?.tv_text
56
59
  }
57
60
  }
@@ -60,7 +63,7 @@ const useTableStyles = (theme, appTheme) => ({
60
63
  color: appTheme?.palette?.editor?.tv_hover_text,
61
64
  "& svg": {
62
65
  color: appTheme?.palette?.editor?.tv_hover_text,
63
- '& path': {
66
+ "& path": {
64
67
  stroke: appTheme?.palette?.editor?.tv_hover_text
65
68
  }
66
69
  }
@@ -37,8 +37,9 @@ function DragButton({
37
37
  };
38
38
  const onDragClose = () => {
39
39
  setShowTool(false);
40
- setTimeout(() => resetSelection(), 200);
40
+ // setTimeout(() => resetSelection(), 200);
41
41
  };
42
+
42
43
  const dragProps = {
43
44
  ...dndProps,
44
45
  id: dndProps?.id + dragType,
@@ -288,36 +288,34 @@ const TableCell = props => {
288
288
  Transforms.select(editor, selection);
289
289
  };
290
290
  const onRowDrag = () => {
291
- if (rowNode) {
292
- const {
293
- children
294
- } = rowNode[0] || {};
295
- const rowPath = rowNode[1] || [];
296
- const rowStartCell = [...rowPath, 0];
297
- const rowEndCell = [...rowPath, children?.length - 1];
298
- updateTableSelection({
299
- startCellPath: rowStartCell,
300
- endCellPath: rowEndCell,
301
- isDragging: false
302
- });
303
- selectCurrentCell();
304
- }
291
+ selectCurrentCell();
292
+ const [rowNode] = getNodeWithType(editor, "table-row", path);
293
+ const {
294
+ children
295
+ } = rowNode[0] || {};
296
+ const rowPath = rowNode[1] || [];
297
+ const rowStartCell = [...rowPath, 0];
298
+ const rowEndCell = [...rowPath, children?.length - 1];
299
+ updateTableSelection({
300
+ startCellPath: rowStartCell,
301
+ endCellPath: rowEndCell,
302
+ isDragging: false
303
+ });
305
304
  };
306
305
  const onColDrag = () => {
307
- if (tableNode) {
308
- const [tableData, tablePath] = tableNode;
309
- const {
310
- rows
311
- } = tableData;
312
- const startColCell = [...tablePath, 0, column];
313
- const endColCell = [...tablePath, rows - 1, column];
314
- updateTableSelection({
315
- startCellPath: startColCell,
316
- endCellPath: endColCell,
317
- isDragging: false
318
- });
319
- selectCurrentCell();
320
- }
306
+ selectCurrentCell();
307
+ const [tableNode] = getNodeWithType(editor, "table", path);
308
+ const [tableData, tablePath] = tableNode;
309
+ const {
310
+ rows
311
+ } = tableData;
312
+ const startColCell = [...tablePath, 0, column];
313
+ const endColCell = [...tablePath, rows - 1, column];
314
+ updateTableSelection({
315
+ startCellPath: startColCell,
316
+ endCellPath: endColCell,
317
+ isDragging: false
318
+ });
321
319
  };
322
320
  const handleToolAction = (value, option, dragType) => {
323
321
  const isRowDrag = dragType === "row";
@@ -660,6 +660,7 @@ export function getInitialValue(value = [], readOnly) {
660
660
  // remove last empty nodes on readonly mode, to remove empty spaces
661
661
 
662
662
  let lastNonEmptyElementIndex;
663
+ const omittedNodes = [];
663
664
  for (let i = value?.length; i > 0; i--) {
664
665
  const elementIndex = i - 1;
665
666
  const node = value[elementIndex];
@@ -672,13 +673,14 @@ export function getInitialValue(value = [], readOnly) {
672
673
  const text = node.children[node.children.length - 1]?.text;
673
674
  lastNonEmptyElementIndex = hasOnlyTextChildren ? text ? elementIndex : null : elementIndex;
674
675
  } else if (omitNodes.includes(node?.type)) {
676
+ omittedNodes.push(node);
675
677
  continue;
676
678
  } else {
677
679
  lastNonEmptyElementIndex = elementIndex;
678
680
  }
679
681
  }
680
682
  const newValue = [...value].slice(0, lastNonEmptyElementIndex + 1);
681
- return newValue;
683
+ return [...newValue, ...omittedNodes];
682
684
  }
683
685
  return value;
684
686
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.6.8",
3
+ "version": "5.6.9",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"