@flozy/editor 4.8.2 → 4.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/dist/Editor/CommonEditor.js +6 -6
  2. package/dist/Editor/Editor.css +8 -1
  3. package/dist/Editor/Elements/AI/AIInput.js +4 -5
  4. package/dist/Editor/Elements/AI/PopoverAIInput.js +78 -62
  5. package/dist/Editor/Elements/AI/Styles.js +1 -0
  6. package/dist/Editor/Elements/Divider/Divider.js +9 -4
  7. package/dist/Editor/Elements/Embed/EmbedPopup.js +7 -1
  8. package/dist/Editor/Elements/Form/Form.js +38 -2
  9. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +7 -1
  10. package/dist/Editor/Elements/Form/FormElements/FormDate.js +7 -1
  11. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +7 -1
  12. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +7 -1
  13. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +7 -1
  14. package/dist/Editor/Elements/Form/FormElements/FormText.js +7 -1
  15. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +6 -1
  16. package/dist/Editor/Elements/Form/FormPopup.js +12 -9
  17. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
  18. package/dist/Editor/Elements/Grid/GridItem.js +7 -2
  19. package/dist/Editor/Elements/Search/SearchAttachment.js +98 -0
  20. package/dist/Editor/Elements/Search/SearchButton.js +111 -0
  21. package/dist/Editor/Elements/Search/SearchList.js +207 -0
  22. package/dist/Editor/Styles/EditorStyles.js +1 -1
  23. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
  24. package/dist/Editor/Toolbar/Toolbar.js +8 -0
  25. package/dist/Editor/Toolbar/toolbarGroups.js +5 -0
  26. package/dist/Editor/assets/svg/BrainIcon.js +37 -0
  27. package/dist/Editor/assets/svg/DocsIcon.js +38 -0
  28. package/dist/Editor/assets/svg/UserIcon.js +23 -0
  29. package/dist/Editor/common/Icon.js +7 -1
  30. package/dist/Editor/common/MentionsPopup/index.js +4 -2
  31. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +0 -1
  32. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -1
  33. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +144 -12
  34. package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -3
  35. package/dist/Editor/common/Section/index.js +2 -4
  36. package/dist/Editor/common/Shorthands/elements.js +13 -0
  37. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +1 -1
  38. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +5 -2
  39. package/dist/Editor/common/StyleBuilder/formStyle.js +206 -119
  40. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +5 -0
  41. package/dist/Editor/common/StyleBuilder/index.js +123 -10
  42. package/dist/Editor/plugins/withCustomDeleteBackward.js +53 -2
  43. package/dist/Editor/utils/Decorators/highlightSelection.js +22 -0
  44. package/dist/Editor/utils/Decorators/index.js +3 -2
  45. package/dist/Editor/utils/SlateUtilityFunctions.js +14 -0
  46. package/dist/Editor/utils/brains.js +16 -0
  47. package/dist/Editor/utils/font.js +11 -4
  48. package/dist/Editor/utils/formfield.js +8 -4
  49. package/dist/Editor/utils/helper.js +15 -2
  50. package/package.json +1 -1
@@ -0,0 +1,16 @@
1
+ import { Transforms } from "slate";
2
+ import insertNewLine from "./insertNewLine";
3
+ export const insertBrain = (editor, data, position) => {
4
+ const brains = {
5
+ type: "brains",
6
+ ...data,
7
+ children: [{
8
+ text: ""
9
+ }]
10
+ };
11
+ Transforms.insertNodes(editor, brains, {
12
+ at: position,
13
+ select: true
14
+ });
15
+ insertNewLine(editor);
16
+ };
@@ -60,7 +60,14 @@ export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
60
60
  };
61
61
  });
62
62
  export const headingMap = {
63
- "headingOne": "32px",
64
- "headingTwo": "24px",
65
- "headingThree": "19px"
66
- };
63
+ headingOne: "32px",
64
+ headingTwo: "24px",
65
+ headingThree: "19px"
66
+ };
67
+ export const fontWeightOptions = [{
68
+ text: "Bold",
69
+ value: "500"
70
+ }, {
71
+ text: "Bolder",
72
+ value: "600"
73
+ }];
@@ -1,5 +1,5 @@
1
1
  import { Transforms } from "slate";
2
- export const formField = () => {
2
+ export const formField = data => {
3
3
  return {
4
4
  type: "form-field",
5
5
  grid: 6,
@@ -12,14 +12,18 @@ export const formField = () => {
12
12
  text: ""
13
13
  }],
14
14
  field_type: "text",
15
- bgColor: "rgba(255, 255, 255, 1)",
16
- borderColor: "#ccc",
15
+ bgColor: data?.bgColor ? data?.bgColor : "rgba(255, 255, 255, 1)",
16
+ borderColor: data?.borderColor ? data?.borderColor : "#ccc",
17
17
  bannerSpacing: {
18
18
  left: 16,
19
19
  right: 16,
20
20
  top: 16,
21
21
  bottom: 16
22
- }
22
+ },
23
+ fontFamily: data?.fontFamily ? data?.fontFamily : "",
24
+ textSize: data?.textSize ? data?.textSize : "",
25
+ textColor: data?.textColor ? data?.textColor : "",
26
+ fontWeight: data?.fontWeight ? data?.fontWeight : "500"
23
27
  };
24
28
  };
25
29
  export const insertGridItem = editor => {
@@ -496,10 +496,23 @@ export const isFreeGrid = (nodes, types = ["freegrid", "freegridItem", "freegrid
496
496
  }
497
497
  return false;
498
498
  } catch (err) {
499
- console.log('isFreeGrid error:', err);
499
+ console.log("isFreeGrid error:", err);
500
500
  return false;
501
501
  }
502
502
  };
503
+ export const getNextNode = editor => {
504
+ try {
505
+ const parentPath = [editor?.selection?.focus?.path[0]];
506
+ const nextPath = Path.next(parentPath);
507
+ const nextNode = Node.get(editor, nextPath);
508
+ return {
509
+ nextPath,
510
+ nextNode
511
+ };
512
+ } catch (err) {
513
+ return;
514
+ }
515
+ };
503
516
  export const getPreviousNode = editor => {
504
517
  try {
505
518
  const parentPath = Path.parent(editor?.selection?.anchor?.path);
@@ -526,7 +539,7 @@ export const isPageSettings = (event, editor) => {
526
539
  const {
527
540
  previousNode,
528
541
  previousPath
529
- } = getPreviousNode(editor);
542
+ } = getPreviousNode(editor) || {};
530
543
  if (previousNode?.type === "page-settings") {
531
544
  event.preventDefault(); // stops deleting backward
532
545
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.8.2",
3
+ "version": "4.8.4",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"