@flozy/editor 5.3.3 → 5.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/dist/Editor/Editor.css +22 -7
  2. package/dist/Editor/Elements/Accordion/Accordion.js +8 -1
  3. package/dist/Editor/Elements/Button/EditorButton.js +2 -1
  4. package/dist/Editor/Elements/Divider/Divider.js +24 -9
  5. package/dist/Editor/Elements/Embed/Image.js +31 -12
  6. package/dist/Editor/Elements/Embed/Video.js +13 -2
  7. package/dist/Editor/Elements/Grid/GridItem.js +2 -0
  8. package/dist/Editor/Elements/Grid/Styles.js +44 -0
  9. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -0
  10. package/dist/Editor/Elements/Signature/SignaturePopup.js +4 -4
  11. package/dist/Editor/Styles/EditorStyles.js +3 -1
  12. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +17 -1
  13. package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -3
  14. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +200 -72
  15. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +10 -8
  16. package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
  17. package/dist/Editor/common/ColorPickerButton.js +5 -3
  18. package/dist/Editor/common/DnD/Draggable.js +2 -1
  19. package/dist/Editor/common/ImageSelector/Options/Upload.js +2 -1
  20. package/dist/Editor/common/ImageSelector/Styles.js +47 -6
  21. package/dist/Editor/common/ImageSelector/UploadStyles.js +18 -6
  22. package/dist/Editor/common/MentionsPopup/Styles.js +108 -118
  23. package/dist/Editor/common/Section/index.js +3 -3
  24. package/dist/Editor/common/Section/styles.js +5 -1
  25. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +4 -3
  26. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +27 -3
  27. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -2
  28. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +2 -1
  29. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
  30. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -0
  31. package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +4 -4
  32. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +22 -6
  33. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +21 -2
  34. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -0
  35. package/dist/Editor/common/StyleBuilder/index.js +5 -4
  36. package/dist/Editor/common/ToolbarIcon.js +2 -1
  37. package/dist/Editor/common/Uploader.js +42 -40
  38. package/dist/Editor/common/iconListV2.js +295 -77
  39. package/dist/Editor/commonStyle.js +281 -4
  40. package/dist/Editor/plugins/withCustomDeleteBackward.js +33 -2
  41. package/dist/Editor/plugins/withLayout.js +0 -41
  42. package/dist/Editor/utils/helper.js +6 -1
  43. package/package.json +2 -2
@@ -1,7 +1,147 @@
1
1
  const useCommonStyle = theme => ({
2
2
  sideBarDrawer: {
3
3
  "& .MuiPaper-root": {
4
- backgroundColor: theme?.palette?.editor?.background
4
+ backgroundColor: theme?.palette?.editor?.textFormatBgColor,
5
+ border: `1px solid ${theme?.palette?.editor?.miniToolBarBorder}`,
6
+ "@media only screen and (min-width: 899px)": {
7
+ borderRadius: "20px",
8
+ margin: "5px",
9
+ height: "calc(100% - 10px)",
10
+ overflow: "hidden"
11
+ },
12
+ "@media only screen and (max-width: 599px)": {
13
+ borderRadius: "20px 20px 0px 0px"
14
+ }
15
+ },
16
+ "& .optionePopupHeader": {
17
+ borderBottom: `1px solid ${theme?.palette?.editor?.deviderBgColor} !important`,
18
+ padding: "0px 0px 10px 0px",
19
+ margin: "0px 10px",
20
+ "& .MuiTypography-root": {
21
+ textTransform: "capitalize"
22
+ },
23
+ "& .close-popupbtn": {
24
+ background: theme?.palette?.editor?.closeButtonBgColor,
25
+ color: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`,
26
+ "& svg": {
27
+ color: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
28
+ }
29
+ }
30
+ },
31
+ "& .MuiDialogActions-root": {
32
+ // paddingTop: "10px",
33
+ "& .primaryBtn, .deleteBtn": {
34
+ height: "32px !important",
35
+ fontSize: "14px !important",
36
+ fontWeight: "600 !important",
37
+ padding: "0px 20px !important"
38
+ },
39
+ "& .deleteBtn": {
40
+ background: `${theme?.palette?.type === "light" && "#FFF7F9"} !important`
41
+ }
42
+ },
43
+ "& .MuiDialogContent-root": {
44
+ padding: "0px 5px 0px 10px!important",
45
+ height: "100%",
46
+ fontFamily: "Inter, sans-serif",
47
+ "& .MuiTypography-root": {
48
+ fontSize: "14px",
49
+ fontWeight: "500",
50
+ fontFamily: "Inter, sans-serif"
51
+ },
52
+ "& p": {
53
+ marginBottom: "7px",
54
+ marginTop: "4px"
55
+ },
56
+ "& .muiIconsListParent": {
57
+ "& svg": {
58
+ color: `${theme?.palette?.editor?.svgTextAlignStrokeColor} !important`
59
+ },
60
+ "&::-webkit-scrollbar-thumb": {
61
+ background: `none !important`
62
+ },
63
+ "&::-webkit-scrollbar-track": {
64
+ visibility: "hidden"
65
+ },
66
+ "&::-webkit-scrollbar-thumb": {
67
+ background: `${theme?.palette?.editor?.brainPopupScroll} !important`
68
+ },
69
+ "&::-webkit-scrollbar-track": {
70
+ visibility: "hidden"
71
+ }
72
+ },
73
+ "& .MuiGrid-root>.MuiGrid-item": {
74
+ paddingRight: "0px !important",
75
+ fontFamily: "Inter, sans-serif",
76
+ height: 'fit-content'
77
+ },
78
+ "& .MuiInputBase-root": {
79
+ borderRadius: "10px",
80
+ background: theme?.palette?.editor?.inputFieldBgColor,
81
+ border: `none`,
82
+ height: "36px",
83
+ boxShadow: "0px 4px 16px 0px #0000000D",
84
+ fontFamily: "Inter, sans-serif",
85
+ "&:hover .MuiOutlinedInput-notchedOutline": {
86
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
87
+ },
88
+ "& input::placeholder": {
89
+ color: "#94A3B8 !important",
90
+ opacity: "unset",
91
+ fontFamily: "Inter, sans-serif"
92
+ },
93
+ "& .colorPickerButton": {
94
+ border: `2px solid ${theme?.palette?.editor?.buttonBorder2} !important`
95
+ }
96
+ },
97
+ "& .MuiInputBase-root:has(.colorPickerButton)": {
98
+ "& .MuiInputBase-input": {
99
+ padding: "8.5px 14px 8.5px 0px",
100
+ fontFamily: "Inter, sans-serif"
101
+ }
102
+ },
103
+ "& .MuiInputBase-input": {
104
+ color: theme?.palette?.editor?.deletePopUpButtonTextColor,
105
+ textTransform: "math-auto",
106
+ fontFamily: "Inter, sans-serif"
107
+ },
108
+ "& .MuiOutlinedInput-notchedOutline": {
109
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
110
+ },
111
+ "& fieldset": {
112
+ border: `1px solid transparent`,
113
+ borderRadius: "10px"
114
+ },
115
+ "&::-webkit-scrollbar-thumb, & .MuiPaper-root ::-webkit-scrollbar-thumb": {
116
+ background: `none !important`
117
+ },
118
+ "&::-webkit-scrollbar-track, & .MuiPaper-root ::-webkit-scrollbar-track": {
119
+ visibility: "hidden"
120
+ },
121
+ "&:hover": {
122
+ "&::-webkit-scrollbar-thumb, & .MuiPaper-root ::-webkit-scrollbar-thumb": {
123
+ background: `${theme?.palette?.editor?.brainPopupScroll} !important`
124
+ },
125
+ "&::-webkit-scrollbar-track, & .MuiPaper-root ::-webkit-scrollbar-track": {
126
+ visibility: "hidden"
127
+ }
128
+ },
129
+ "& .sld-wrpr": {
130
+ paddingLeft: "5px",
131
+ "& .sliderInput": {
132
+ background: theme?.palette?.editor?.inputFieldBgColor,
133
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
134
+ borderRadius: "10px",
135
+ width: "46px !important",
136
+ marginLeft: "10px",
137
+ height: '36px !important'
138
+ }
139
+ },
140
+ '& .MuiFormHelperText-root': {
141
+ margin: '4px 0px 0px 0px',
142
+ color: theme?.palette?.editor?.closeButtonSvgStroke,
143
+ fontFamily: "Inter, sans-serif"
144
+ }
5
145
  },
6
146
  "& .MuiTypography-root": {
7
147
  color: theme?.palette?.editor?.textColor
@@ -26,11 +166,41 @@ const useCommonStyle = theme => ({
26
166
  backgroundColor: theme?.palette?.editor?.background,
27
167
  color: theme?.palette?.editor?.textColor
28
168
  },
169
+ customCheckBox: {
170
+ padding: "0px",
171
+ "& .MuiCheckbox-root": {
172
+ padding: "8px 8px 8px 10px",
173
+ "&:hover": {
174
+ background: "unset !important"
175
+ }
176
+ },
177
+ "& button": {
178
+ width: "18px !important",
179
+ height: "18px !important",
180
+ borderRadius: "3px",
181
+ border: `1px solid ${theme?.palette?.editor?.buttonBorder3}`,
182
+ "& svg": {
183
+ width: "14px",
184
+ height: "14px"
185
+ }
186
+ },
187
+ "& .checkedIcon": {
188
+ background: "#2563EB",
189
+ borderColor: "#2563EB",
190
+ padding: "0px"
191
+ },
192
+ "& .unCheckedIcon": {
193
+ background: theme?.palette?.editor?.checkedIconBg
194
+ },
195
+ "& p": {
196
+ margin: "0px !important"
197
+ }
198
+ },
29
199
  customPaddingInput: {
30
200
  background: theme?.palette?.editor?.inputFieldBgColor,
31
201
  border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
32
202
  color: theme?.palette?.editor?.textColor,
33
- borderRadius: '6px'
203
+ borderRadius: "6px"
34
204
  },
35
205
  colorPickerPopup: {
36
206
  "& .MuiPaper-root": {
@@ -40,7 +210,7 @@ const useCommonStyle = theme => ({
40
210
  "& .popup_tabs": {
41
211
  backgroundColor: theme?.palette?.editor?.background,
42
212
  "@media only screen and (max-width: 899px)": {
43
- width: '100% !important'
213
+ width: "100% !important"
44
214
  }
45
215
  },
46
216
  "& .popup_tabs-header": {
@@ -78,6 +248,9 @@ const useCommonStyle = theme => ({
78
248
  }
79
249
  }
80
250
  },
251
+ colorPickerBtnBorder: {
252
+ border: `2px solid ${theme?.palette?.editor?.buttonBorder2} !important`
253
+ },
81
254
  signaturePopup: {
82
255
  "& .MuiPaper-root": {
83
256
  backgroundColor: theme?.palette?.editor?.miniToolBarBackground,
@@ -175,7 +348,7 @@ const useCommonStyle = theme => ({
175
348
  },
176
349
  "& .deleteBtn": {
177
350
  background: "transparent",
178
- margin: '0px !important'
351
+ margin: "0px !important"
179
352
  },
180
353
  "& .MuiGrid-container": {
181
354
  "& .workFlowButton": {
@@ -209,6 +382,44 @@ const useCommonStyle = theme => ({
209
382
  textOptions: {
210
383
  "& .MuiPopover-root": {
211
384
  backgroundColor: theme?.palette?.editor?.background
385
+ },
386
+ "& svg": {
387
+ width: "20px",
388
+ height: "24px",
389
+ color: `${theme?.palette?.editor?.svgTextAlignStrokeColor} !important`
390
+ }
391
+ },
392
+ textOptionsList: {
393
+ "& .MuiMenuItem-root": {
394
+ padding: "8px 12px",
395
+ fontSize: "12px",
396
+ color: theme?.palette?.editor?.menuOptionTextColor,
397
+ fontWeight: '500',
398
+ fontFamily: "Inter, sans-serif",
399
+ minHeight: '36px',
400
+ "&:hover": {
401
+ backgroundColor: theme?.palette?.editor?.menuOptionHoverBackground
402
+ }
403
+ },
404
+ '& .Mui-selected': {
405
+ background: `${theme?.palette?.editor?.menuOptionSelectedOption} !important`
406
+ },
407
+ "& .MuiListSubheader-root": {
408
+ color: "gray",
409
+ fontWeight: "bold",
410
+ fontSize: "12px"
411
+ },
412
+ "& .MuiPaper-root": {
413
+ borderRadius: '8px',
414
+ padding: '0px',
415
+ background: `${theme?.palette?.editor?.textWeightPopUpBackground} !important`
416
+ },
417
+ '& .MuiButtonBase-root': {
418
+ margin: '4px',
419
+ borderRadius: '6px'
420
+ },
421
+ '& .MuiList-root': {
422
+ padding: '0px'
212
423
  }
213
424
  },
214
425
  datePicker: {
@@ -256,7 +467,73 @@ const useCommonStyle = theme => ({
256
467
  buttonMoreOption: {
257
468
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
258
469
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
470
+ padding: '4px !important',
471
+ '& svg': {
472
+ width: '18px !important',
473
+ height: '18px !important',
474
+ '& path': {
475
+ stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
476
+ }
477
+ }
478
+ },
479
+ pageSettingPopUpRoot: {
480
+ padding: "16px 8px 16px 10px!important",
481
+ height: "100%"
482
+ },
483
+ buttonMoreOption2: {
484
+ background: `${theme?.palette?.editor?.aiInputBackground} !important`,
485
+ border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
486
+ '& svg': {
487
+ '& path': {
488
+ fill: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
489
+ }
490
+ }
491
+ },
492
+ buttonMoreOption3: {
493
+ background: `${theme?.palette?.editor?.aiInputBackground} !important`,
494
+ border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
495
+ padding: '5px !important',
496
+ '& svg': {
497
+ width: '16px !important',
498
+ height: '16px !important',
499
+ '& path': {
500
+ stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
501
+ }
502
+ }
503
+ },
504
+ resizeButton: {
505
+ background: theme?.palette?.editor?.aiInputBackground,
506
+ border: `1px solid ${theme?.palette?.editor?.buttonBorder1}`,
507
+ padding: '5px !important',
508
+ borderRadius: '50% !important',
509
+ '& svg': {
510
+ width: '18px',
511
+ height: '18px',
512
+ '& path': {
513
+ fill: `${theme?.palette?.editor?.closeButtonSvgStroke}`
514
+ }
515
+ },
516
+ '&:hover': {
517
+ background: theme?.palette?.editor?.aiInputBackground
518
+ }
519
+ },
520
+ gradientFillBtn: {
521
+ background: `linear-gradient(112.61deg, #2C63ED 19.3%, #8360FD 88.14%) !important`,
522
+ textTransform: 'math-auto !important',
523
+ color: '#FFFFFF !important',
524
+ padding: '0px 12px !important',
525
+ height: '32px',
526
+ borderRadius: '8px',
527
+ fontWeight: '500',
528
+ fontSize: '14px'
529
+ },
530
+ emptyThumbBtn: {
531
+ background: `${theme?.palette?.editor?.sectionSettingIconHover} !important`,
532
+ color: `${theme?.palette?.editor?.textColor} !important`,
533
+ fontSize: '14px !important',
259
534
  '& svg': {
535
+ width: '20px !important',
536
+ height: '20px !important',
260
537
  '& path': {
261
538
  stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
262
539
  }
@@ -1,5 +1,5 @@
1
- import { Editor, Node, Path, Point, Transforms } from "slate";
2
- import { getNextNode } from "../utils/helper";
1
+ import { Editor, Node, Path, Point, Range, Transforms } from "slate";
2
+ import { containsSurrogatePair, getNextNode } from "../utils/helper";
3
3
  const BACKWARD_BLOCKS = ["list-item", "signature"];
4
4
  const isNodeTextEmpty = node => {
5
5
  const nodeText = Node.string(node);
@@ -29,6 +29,37 @@ const withCustomDeleteBackward = editor => {
29
29
  return;
30
30
  }
31
31
  }
32
+ if (selection && Range.isCollapsed(selection)) {
33
+ const [currentNode, path] = Editor.node(editor, selection);
34
+ if (currentNode && typeof currentNode.text === 'string') {
35
+ const text = currentNode.text;
36
+ if (containsSurrogatePair(text)) {
37
+ // Check if the cursor is at the end of a surrogate pair
38
+ const {
39
+ offset
40
+ } = selection.anchor;
41
+ const beforeCursor = text.slice(0, offset);
42
+ const afterCursor = text.slice(offset);
43
+ if (containsSurrogatePair(beforeCursor) || containsSurrogatePair(afterCursor)) {
44
+ // Delete the entire surrogate pair
45
+ Transforms.delete(editor, {
46
+ at: {
47
+ anchor: {
48
+ path,
49
+ offset: offset - 2
50
+ },
51
+ // Move back 2 for surrogate pair
52
+ focus: {
53
+ path,
54
+ offset
55
+ }
56
+ }
57
+ });
58
+ return;
59
+ }
60
+ }
61
+ }
62
+ }
32
63
 
33
64
  // Check if current node is a list item and is the last one, signature node
34
65
  const [node] = Editor.nodes(editor, {
@@ -60,47 +60,6 @@ const withLayout = editor => {
60
60
  });
61
61
  return;
62
62
  }
63
-
64
- // Transforms.insertNodes(editor, paragraph, { at: [0] });
65
- // const extractFirstText = (node) => {
66
- // if (node.text) {
67
- // return node.text;
68
- // }
69
- // if (node.children) {
70
- // for (const child of node.children) {
71
- // const text = extractFirstText(child);
72
- // if (text) {
73
- // return text;
74
- // }
75
- // }
76
- // }
77
- // return "";
78
- // };
79
-
80
- // const extractRemainingNodes = (node) => {
81
- // if (!node.children) {
82
- // return [];
83
- // }
84
- // const [, ...remainingChildren] = node.children;
85
- // return remainingChildren.map((child) => ({ ...child }));
86
- // };
87
-
88
- // const firstNode = editor.children[0];
89
- // const firstContent = extractFirstText(firstNode);
90
-
91
- // if (firstNode.type !== "title") {
92
- // const titleNode = {
93
- // type: "title",
94
- // children: [{ text: firstContent }],
95
- // };
96
- // Transforms.removeNodes(editor, { at: [0] });
97
- // Transforms.insertNodes(editor, titleNode, { at: [0], select: true });
98
- // const remainingNodes = extractRemainingNodes(firstNode);
99
- // if (remainingNodes.length > 0) {
100
- // Transforms.insertNodes(editor, remainingNodes, { at: [1] });
101
- // }
102
- // }
103
-
104
63
  ORDERS_LAYOUT.forEach((enforce, index) => {
105
64
  if (index < editor.children.length) {
106
65
  const existsNode = Node.get(editor, [index]);
@@ -686,4 +686,9 @@ export function getSelectedCls(defaultCls = "", selected, selectedClsName = "sel
686
686
  }
687
687
  export function handleNegativeInteger(val) {
688
688
  return val < 0 ? 0 : val;
689
- }
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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.3.3",
3
+ "version": "5.3.4",
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": [