@flozy/editor 5.3.6 → 5.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. package/dist/Editor/CommonEditor.js +14 -8
  2. package/dist/Editor/Editor.css +58 -22
  3. package/dist/Editor/Elements/Accordion/Accordion.js +8 -1
  4. package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
  5. package/dist/Editor/Elements/Button/EditorButton.js +9 -2
  6. package/dist/Editor/Elements/Color Picker/ColorButtons.js +4 -2
  7. package/dist/Editor/Elements/DataView/DataView.js +124 -0
  8. package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
  9. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +67 -0
  10. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
  11. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
  12. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
  13. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -0
  14. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +35 -0
  15. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
  19. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
  20. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
  21. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
  22. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
  23. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +74 -0
  24. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
  25. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
  26. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -0
  27. package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
  28. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
  29. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +37 -0
  30. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
  31. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +60 -0
  32. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
  33. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
  34. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
  35. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
  36. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
  37. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
  38. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
  39. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
  40. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +112 -0
  41. package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
  42. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +80 -0
  43. package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
  44. package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
  45. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +281 -0
  46. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
  47. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +74 -0
  48. package/dist/Editor/Elements/DataView/styles.js +154 -0
  49. package/dist/Editor/Elements/Divider/Divider.js +24 -9
  50. package/dist/Editor/Elements/Embed/Image.js +31 -12
  51. package/dist/Editor/Elements/Embed/Video.js +13 -2
  52. package/dist/Editor/Elements/Form/Form.js +1 -0
  53. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  54. package/dist/Editor/Elements/FreeGrid/styles.js +2 -1
  55. package/dist/Editor/Elements/Grid/GridItem.js +2 -0
  56. package/dist/Editor/Elements/Grid/Styles.js +44 -0
  57. package/dist/Editor/Elements/List/CheckList.js +2 -1
  58. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  59. package/dist/Editor/Elements/Signature/SignaturePopup.js +4 -4
  60. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  61. package/dist/Editor/Elements/SimpleText/style.js +10 -1
  62. package/dist/Editor/Elements/Table/Table.js +2 -4
  63. package/dist/Editor/Elements/Table/TableCell.js +5 -10
  64. package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
  65. package/dist/Editor/MiniEditor.js +15 -1
  66. package/dist/Editor/Styles/EditorStyles.js +5 -3
  67. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +17 -1
  68. package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -3
  69. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +210 -72
  70. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +56 -8
  71. package/dist/Editor/Toolbar/Toolbar.js +6 -0
  72. package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
  73. package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
  74. package/dist/Editor/common/ColorPickerButton.js +5 -3
  75. package/dist/Editor/common/DnD/Draggable.js +2 -1
  76. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  77. package/dist/Editor/common/Icon.js +6 -0
  78. package/dist/Editor/common/ImageSelector/Options/Upload.js +2 -1
  79. package/dist/Editor/common/ImageSelector/Styles.js +47 -6
  80. package/dist/Editor/common/ImageSelector/UploadStyles.js +18 -6
  81. package/dist/Editor/common/MentionsPopup/Styles.js +109 -122
  82. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
  83. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  84. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  85. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  86. package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -6
  87. package/dist/Editor/common/RnD/index.js +2 -1
  88. package/dist/Editor/common/Section/index.js +3 -3
  89. package/dist/Editor/common/Section/styles.js +5 -1
  90. package/dist/Editor/common/Shorthands/elements.js +13 -1
  91. package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -1
  92. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +9 -3
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +27 -3
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -2
  95. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  96. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +2 -1
  97. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
  98. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -0
  99. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  100. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  101. package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +4 -4
  102. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +22 -6
  103. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +21 -2
  104. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +15 -4
  105. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -0
  106. package/dist/Editor/common/StyleBuilder/index.js +17 -9
  107. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  108. package/dist/Editor/common/ToolbarIcon.js +1 -1
  109. package/dist/Editor/common/Uploader.js +46 -36
  110. package/dist/Editor/common/iconListV2.js +348 -130
  111. package/dist/Editor/common/iconslist.js +6 -3
  112. package/dist/Editor/commonStyle.js +290 -4
  113. package/dist/Editor/helper/deserialize/index.js +19 -23
  114. package/dist/Editor/helper/enforceDateFormat.js +41 -0
  115. package/dist/Editor/helper/index.js +16 -3
  116. package/dist/Editor/helper/theme.js +24 -1
  117. package/dist/Editor/hooks/useMouseMove.js +5 -2
  118. package/dist/Editor/hooks/useTable.js +22 -19
  119. package/dist/Editor/plugins/withCustomDeleteBackward.js +33 -2
  120. package/dist/Editor/plugins/withEmbeds.js +30 -26
  121. package/dist/Editor/utils/SlateUtilityFunctions.js +27 -4
  122. package/dist/Editor/utils/button.js +4 -4
  123. package/dist/Editor/utils/dataView.js +43 -0
  124. package/dist/Editor/utils/helper.js +50 -10
  125. package/dist/Editor/utils/pageSettings.js +14 -2
  126. package/package.json +2 -2
@@ -40,32 +40,36 @@ const withEmbeds = editor => {
40
40
  }
41
41
  };
42
42
  editor.insertBreak = (...args) => {
43
- const parentPath = Path.parent(editor.selection.focus.path);
44
- const parentNode = Node.get(editor, parentPath);
45
- if (editor.isVoid(parentNode)) {
46
- const nextPath = Path.next(parentPath);
47
- Transforms.insertNodes(editor, {
48
- type: "paragraph",
49
- children: [{
50
- text: ""
51
- }]
52
- }, {
53
- at: nextPath,
54
- select: true // Focus on this node once inserted
55
- });
56
- } else if (AvoidCopying.indexOf(parentNode?.type) >= 0) {
57
- const nextPath = Path.next(parentPath);
58
- Transforms.insertNodes(editor, {
59
- type: "paragraph",
60
- children: [{
61
- text: ""
62
- }]
63
- }, {
64
- at: nextPath,
65
- select: true // Focus on this node once inserted
66
- });
67
- } else {
68
- insertBreak(...args);
43
+ try {
44
+ const parentPath = Path.parent(editor.selection.focus.path);
45
+ const parentNode = Node.get(editor, parentPath);
46
+ if (editor.isVoid(parentNode)) {
47
+ const nextPath = Path.next(parentPath);
48
+ Transforms.insertNodes(editor, {
49
+ type: "paragraph",
50
+ children: [{
51
+ text: ""
52
+ }]
53
+ }, {
54
+ at: nextPath,
55
+ select: true // Focus on this node once inserted
56
+ });
57
+ } else if (AvoidCopying.indexOf(parentNode?.type) >= 0) {
58
+ const nextPath = Path.next(parentPath);
59
+ Transforms.insertNodes(editor, {
60
+ type: "paragraph",
61
+ children: [{
62
+ text: ""
63
+ }]
64
+ }, {
65
+ at: nextPath,
66
+ select: true // Focus on this node once inserted
67
+ });
68
+ } else {
69
+ insertBreak(...args);
70
+ }
71
+ } catch (err) {
72
+ console.log(err);
69
73
  }
70
74
  };
71
75
  return editor;
@@ -43,6 +43,9 @@ import Code from "../Elements/EmbedScript/Code";
43
43
  import FreeGrid from "../Elements/FreeGrid/FreeGrid";
44
44
  import FreeGridItem from "../Elements/FreeGrid/FreeGridItem";
45
45
  import FreeGridBox from "../Elements/FreeGrid/FreeGridBox";
46
+ import DataView from "../Elements/DataView/DataView";
47
+ import ViewData from "../Elements/DataView/Layouts/ViewData";
48
+ import ColumnView from "../Elements/DataView/Layouts/ColumnView";
46
49
  import SearchAttachment from "../Elements/Search/SearchAttachment";
47
50
  // import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
48
51
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -152,7 +155,7 @@ export const activeMark = (editor, format) => {
152
155
  const defaultMarkData = {
153
156
  color: "#000000",
154
157
  bgColor: "#FFFFFF",
155
- fontSize: "normal",
158
+ fontSize: "14px",
156
159
  fontFamily: "PoppinsRegular",
157
160
  fontWeight: "normal"
158
161
  };
@@ -237,7 +240,8 @@ export const getMarked = (leaf, children, theme) => {
237
240
  // },
238
241
  ...textStyles,
239
242
  fontFamily: family,
240
- fontWeight: leaf.fontWeight
243
+ fontWeight: leaf.fontWeight,
244
+ WebkitTextFillColor: 'unset !important'
241
245
  },
242
246
  children: children
243
247
  })
@@ -246,7 +250,6 @@ export const getMarked = (leaf, children, theme) => {
246
250
  if (leaf.highlight) {
247
251
  children = /*#__PURE__*/_jsx("span", {
248
252
  style: {
249
- background: "#EAEBFE",
250
253
  color: "inherit"
251
254
  },
252
255
  children: children
@@ -309,7 +312,8 @@ export const getBlock = props => {
309
312
  borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
310
313
  margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
311
314
  width: element?.bgColor ? "calc(100% - 16px)" : "100%",
312
- borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
315
+ borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
316
+ lineHeight: 1.43
313
317
  },
314
318
  children: children
315
319
  });
@@ -369,6 +373,9 @@ export const getBlock = props => {
369
373
  });
370
374
  case "orderedList":
371
375
  return /*#__PURE__*/_jsx("ol", {
376
+ style: {
377
+ lineHeight: 1.43
378
+ },
372
379
  className: "listItemMargin",
373
380
  type: "1",
374
381
  ...attributes,
@@ -376,6 +383,9 @@ export const getBlock = props => {
376
383
  });
377
384
  case "unorderedList":
378
385
  return /*#__PURE__*/_jsx("ul", {
386
+ style: {
387
+ lineHeight: 1.43
388
+ },
379
389
  className: "listItemMargin",
380
390
  ...attributes,
381
391
  children: children
@@ -564,6 +574,19 @@ export const getBlock = props => {
564
574
  contentEditable: false,
565
575
  children: children
566
576
  });
577
+ // Data View
578
+ case "dataView":
579
+ return /*#__PURE__*/_jsx(DataView, {
580
+ ...props
581
+ });
582
+ case "viewData":
583
+ return /*#__PURE__*/_jsx(ViewData, {
584
+ ...props
585
+ });
586
+ case "columnView":
587
+ return /*#__PURE__*/_jsx(ColumnView, {
588
+ ...props
589
+ });
567
590
  default:
568
591
  return /*#__PURE__*/_jsx(SimpleText, {
569
592
  ...props,
@@ -20,10 +20,10 @@ export const insertButton = editor => {
20
20
  bottomRight: 30
21
21
  },
22
22
  bannerSpacing: {
23
- left: 16,
24
- top: 8,
25
- right: 16,
26
- bottom: 8
23
+ left: 24,
24
+ top: 10,
25
+ right: 24,
26
+ bottom: 10
27
27
  },
28
28
  ...(windowVar.lastButtonProps || {})
29
29
  };
@@ -0,0 +1,43 @@
1
+ import { Transforms } from "slate";
2
+ import insertNewLine from "./insertNewLine";
3
+ const getDefaultDatView = () => ({
4
+ type: "dataView",
5
+ title: "",
6
+ layouts: [{
7
+ key: "view1",
8
+ type: "table",
9
+ label: "Table 1 View",
10
+ value: "table1",
11
+ filter: [],
12
+ sort: []
13
+ }],
14
+ properties: [{
15
+ key: "column1",
16
+ label: "Task",
17
+ type: "text",
18
+ visible: true,
19
+ default: true
20
+ }],
21
+ rows: [{
22
+ id: new Date().getTime(),
23
+ column1: ""
24
+ }],
25
+ children: [{
26
+ type: "viewData",
27
+ children: [{
28
+ text: ""
29
+ }]
30
+ }]
31
+ });
32
+ export const insertDataView = editor => {
33
+ try {
34
+ Transforms.insertNodes(editor, {
35
+ ...getDefaultDatView()
36
+ }, {
37
+ at: editor?.selection.focus.path
38
+ });
39
+ insertNewLine(editor);
40
+ } catch (err) {
41
+ console.log(err);
42
+ }
43
+ };
@@ -4,6 +4,7 @@ import insertNewLine from "./insertNewLine";
4
4
  import { getDevice } from "../helper/theme";
5
5
  export const windowVar = {};
6
6
  let ST_TIMEOUT = null;
7
+ const BLOCKS = ["grid", "dataView"];
7
8
  export const formatDate = (date, format = "MM/DD/YYYY") => {
8
9
  if (!date) return "";
9
10
  var d = new Date(date),
@@ -163,7 +164,7 @@ export const handleInsertLastElement = (event, editor) => {
163
164
  if (isFreeGrid) {
164
165
  return;
165
166
  }
166
- const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c => c.type === "grid");
167
+ const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c => BLOCKS.includes(c.type));
167
168
  if (!ReactEditor.isFocused(editor)) {
168
169
  if (isLastElementEmpty) {
169
170
  if (hasPath) {
@@ -623,6 +624,35 @@ export const isPageSettings = (event, editor) => {
623
624
  return isPageSettingsNode;
624
625
  }
625
626
  };
627
+ export function capitalizeFirstLetter(str) {
628
+ if (!str) return str;
629
+ return str.charAt(0).toUpperCase() + str.slice(1);
630
+ }
631
+ export const insertLineBreakAtEndOfPath = (editor, path) => {
632
+ try {
633
+ const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
634
+ if (node) {
635
+ // Insert the line break
636
+ Transforms.insertNodes(editor, {
637
+ type: "paragraph",
638
+ children: [{
639
+ text: ""
640
+ }]
641
+ }, {
642
+ at: nodePath
643
+ });
644
+ }
645
+ } catch (err) {
646
+ console.log(err);
647
+ }
648
+ };
649
+ export function isHavingSelection(editor) {
650
+ try {
651
+ return editor?.selection && !Range.isCollapsed(editor.selection);
652
+ } catch (err) {
653
+ console.log(err);
654
+ }
655
+ }
626
656
  const omitNodes = ["site-settings", "page-settings"];
627
657
  export function getInitialValue(value = [], readOnly) {
628
658
  if (readOnly === "readonly" && value?.length) {
@@ -651,17 +681,27 @@ export function getInitialValue(value = [], readOnly) {
651
681
  }
652
682
  return value;
653
683
  }
654
- export function capitalizeFirstLetter(str) {
655
- if (!str) return str;
656
- return str.charAt(0).toUpperCase() + str.slice(1);
684
+ export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
685
+ return `${defaultCls} ${selected ? selectedClsName : ""}`;
657
686
  }
658
- export function isHavingSelection(editor) {
687
+ export function handleNegativeInteger(val) {
688
+ return val < 0 ? 0 : val;
689
+ }
690
+ export const containsSurrogatePair = text => {
691
+ // Match surrogate pairs (high and low surrogate)
692
+ const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
693
+ return surrogatePairRegex.test(text);
694
+ };
695
+ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
659
696
  try {
660
- return editor?.selection && !Range.isCollapsed(editor.selection);
697
+ const options = {
698
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === nodeType,
699
+ ...(otherOptions || {})
700
+ };
701
+ const [node, nodePath] = Editor.nodes(editor, options);
702
+ return node ? [node, nodePath] : [];
661
703
  } catch (err) {
662
704
  console.log(err);
705
+ return [];
663
706
  }
664
- }
665
- export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
666
- return `${defaultCls} ${selected ? selectedClsName : ""}`;
667
- }
707
+ };
@@ -9,7 +9,13 @@ export const findPageSettings = editor => {
9
9
  path: null,
10
10
  element: {
11
11
  pageProps: {
12
- pageWidth: "fixed"
12
+ pageWidth: "fixed",
13
+ "lineHeight": {
14
+ "xs": 1.43,
15
+ "sm": 1.43,
16
+ "md": 1.43,
17
+ "lg": 1.43
18
+ }
13
19
  }
14
20
  }
15
21
  };
@@ -34,7 +40,13 @@ export const getPageSettings = editor => {
34
40
  path: null,
35
41
  element: {
36
42
  pageProps: {
37
- pageWidth: "fixed"
43
+ pageWidth: "fixed",
44
+ "lineHeight": {
45
+ "xs": 1.43,
46
+ "sm": 1.43,
47
+ "md": 1.43,
48
+ "lg": 1.43
49
+ }
38
50
  }
39
51
  }
40
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.3.6",
3
+ "version": "5.3.7",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -68,7 +68,7 @@
68
68
  "storybook": "storybook dev -p 6006",
69
69
  "build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
70
70
  "publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
71
- "publish:local": "rm -rf /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist --copy-files"
71
+ "publish:local": "rm -rf /Users/agmac30/Documents/CODE_BASE/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac30/Documents/CODE_BASE/flozy/client/node_modules/@flozy/editor/dist --copy-files"
72
72
  },
73
73
  "eslintConfig": {
74
74
  "extends": [