@flozy/editor 6.0.5 → 6.0.6

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.
Files changed (51) hide show
  1. package/dist/Editor/CommonEditor.js +15 -17
  2. package/dist/Editor/Editor.css +4 -3
  3. package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
  4. package/dist/Editor/Elements/Button/EditorButton.js +1 -0
  5. package/dist/Editor/Elements/DataView/DataView.js +4 -3
  6. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
  7. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
  8. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
  9. package/dist/Editor/Elements/Form/Form.js +1 -0
  10. package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
  11. package/dist/Editor/Elements/List/CheckList.js +2 -1
  12. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  13. package/dist/Editor/Elements/Search/SearchList.js +8 -1
  14. package/dist/Editor/Elements/SimpleText/index.js +19 -7
  15. package/dist/Editor/Elements/SimpleText/style.js +5 -1
  16. package/dist/Editor/Elements/Table/Table.js +15 -15
  17. package/dist/Editor/Elements/Table/TableCell.js +14 -9
  18. package/dist/Editor/MiniEditor.js +4 -2
  19. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +37 -28
  20. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
  21. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
  22. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
  23. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +3 -8
  24. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
  25. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
  26. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
  27. package/dist/Editor/Toolbar/PopupTool/index.js +45 -32
  28. package/dist/Editor/common/FontLoader/FontList.js +11 -11
  29. package/dist/Editor/common/FontLoader/FontLoader.js +45 -75
  30. package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
  31. package/dist/Editor/common/ImageSelector/UploadStyles.js +2 -1
  32. package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
  33. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +6 -0
  34. package/dist/Editor/common/Section/index.js +89 -60
  35. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  36. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  37. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  38. package/dist/Editor/commonStyle.js +5 -0
  39. package/dist/Editor/helper/deserialize/index.js +1 -1
  40. package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
  41. package/dist/Editor/helper/theme.js +24 -1
  42. package/dist/Editor/hooks/useDrag.js +11 -17
  43. package/dist/Editor/hooks/useEditorScroll.js +2 -1
  44. package/dist/Editor/hooks/useMouseMove.js +6 -4
  45. package/dist/Editor/plugins/withHTML.js +7 -1
  46. package/dist/Editor/utils/SlateUtilityFunctions.js +23 -12
  47. package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
  48. package/dist/Editor/utils/helper.js +41 -0
  49. package/dist/Editor/utils/pageSettings.js +14 -2
  50. package/dist/Editor/utils/table.js +21 -0
  51. package/package.json +3 -3
@@ -713,6 +713,47 @@ export const getSlateDom = (editor, range) => {
713
713
  console.log(err);
714
714
  }
715
715
  };
716
+
717
+ // The inputs inside the dynamic table lose focus after calling `setNodes` on the first `onChange` event.
718
+ // To replicate this issue, insert some paragraph nodes above the dynamic table, then type something in the title.
719
+ // After typing the first word, the input loses focus.
720
+ export const focusDynamicTableInput = e => {
721
+ setTimeout(() => {
722
+ const input = document.getElementById(e.target.id);
723
+ if (input) {
724
+ // Check if the input is not already focused
725
+ if (document.activeElement !== input) {
726
+ const length = input.value.length;
727
+ // Focus on the input
728
+ input.focus();
729
+
730
+ // number input not supports selection
731
+ if (e.target.type !== "number") {
732
+ // Set the cursor to the end
733
+ input.setSelectionRange(length, length);
734
+ }
735
+ }
736
+ }
737
+ }, 0);
738
+ };
739
+ export const clearWindowSelection = () => {
740
+ const selection = window.getSelection();
741
+ if (selection) {
742
+ selection.removeAllRanges(); // Clears the selection
743
+ }
744
+ };
745
+
746
+ export const viewSlateSelection = () => {
747
+ // if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
748
+ clearWindowSelection();
749
+ const selectionBg = "rgba(35, 131, 226, 0.35)";
750
+ const root = document.documentElement;
751
+ root.style.setProperty("--slate-highlight-bg", selectionBg);
752
+ };
753
+ export const hideSlateSelection = () => {
754
+ const root = document.documentElement;
755
+ root.style.setProperty("--slate-highlight-bg", "none");
756
+ };
716
757
  export function handleNegativeInteger(val) {
717
758
  return val < 0 ? 0 : val;
718
759
  }
@@ -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
  };
@@ -753,4 +753,25 @@ export const clearCellText = (editor, currentCellPath) => {
753
753
  } catch (err) {
754
754
  console.log(err);
755
755
  }
756
+ };
757
+ export const getTableColumns = element => {
758
+ const {
759
+ columns,
760
+ children
761
+ } = element || {};
762
+ if (columns) {
763
+ return columns;
764
+ }
765
+ const firstRow = children?.length ? children[0] : {};
766
+ return firstRow?.children?.length || 0;
767
+ };
768
+ export const getTableRows = element => {
769
+ const {
770
+ rows,
771
+ children
772
+ } = element || {};
773
+ if (rows) {
774
+ return rows;
775
+ }
776
+ return children?.length || 0;
756
777
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "6.0.5",
3
+ "version": "6.0.6",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -61,7 +61,7 @@
61
61
  "scripts": {
62
62
  "prepare": "husky install .husky",
63
63
  "analyze": "source-map-explorer build/static/js/*.js",
64
- "lint": "./node_modules/.bin/eslint --ignore-path .gitignore .",
64
+ "lint": "./node_modules/. bin/eslint --ignore-path .gitignore .",
65
65
  "start": "craco start",
66
66
  "build": "NODE_OPTIONS='--max_old_space_size=4096' craco build",
67
67
  "test": "craco test --passWithNoTests",
@@ -69,7 +69,7 @@
69
69
  "storybook": "storybook dev -p 6006",
70
70
  "build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
71
71
  "publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
72
- "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"
72
+ "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"
73
73
  },
74
74
  "eslintConfig": {
75
75
  "extends": [