@flozy/editor 10.7.0 → 10.7.2

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 (143) hide show
  1. package/dist/Editor/ChatEditor.js +17 -16
  2. package/dist/Editor/CommonEditor.js +126 -15
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +39 -11
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
  6. package/dist/Editor/Elements/AI/Styles.js +1 -0
  7. package/dist/Editor/Elements/Accordion/Accordion.js +25 -17
  8. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  9. package/dist/Editor/Elements/Attachments/AttachmentStyles.js +16 -0
  10. package/dist/Editor/Elements/Attachments/Attachments.js +153 -11
  11. package/dist/Editor/Elements/Attachments/AttachmentsButton.js +14 -4
  12. package/dist/Editor/Elements/Button/EditorButton.js +23 -7
  13. package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
  14. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  15. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  16. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  17. package/dist/Editor/Elements/Embed/Embed.js +36 -43
  18. package/dist/Editor/Elements/Embed/Image.js +240 -23
  19. package/dist/Editor/Elements/Embed/Video.js +246 -15
  20. package/dist/Editor/Elements/Form/FormField.js +1 -1
  21. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  22. package/dist/Editor/Elements/Form/Workflow/constant.js +25 -1
  23. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +39 -33
  24. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
  25. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
  26. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  27. package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
  28. package/dist/Editor/Elements/FreeGrid/styles.js +9 -0
  29. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  30. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +2 -1
  31. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  32. package/dist/Editor/Elements/Table/Table.js +3 -3
  33. package/dist/Editor/Elements/Title/title.js +6 -6
  34. package/dist/Editor/Elements/TopBanner/TopBanner.js +6 -1
  35. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +8 -2
  36. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  37. package/dist/Editor/MiniEditor.js +2 -1
  38. package/dist/Editor/Styles/EditorStyles.js +20 -5
  39. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  40. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  41. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  42. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  43. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  44. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
  45. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  46. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +19 -5
  47. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
  48. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +16 -7
  49. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
  50. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +69 -9
  51. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +70 -12
  52. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
  53. package/dist/Editor/Toolbar/PopupTool/index.js +5 -2
  54. package/dist/Editor/Toolbar/toolbarGroups.js +56 -10
  55. package/dist/Editor/assets/svg/BackIcon.js +18 -0
  56. package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
  57. package/dist/Editor/common/ColorPickerButton.js +38 -16
  58. package/dist/Editor/common/CustomColorPicker/index.js +130 -0
  59. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  60. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  61. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  62. package/dist/Editor/common/CustomSelect.js +43 -0
  63. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  64. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  65. package/dist/Editor/common/Icon.js +28 -0
  66. package/dist/Editor/common/ImageSelector/ImageSelector.js +45 -7
  67. package/dist/Editor/common/ImageSelector/Options/Upload.js +26 -11
  68. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  69. package/dist/Editor/common/LinkSettings/NavComponents.js +6 -2
  70. package/dist/Editor/common/MentionsPopup/index.js +9 -1
  71. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  72. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  73. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  74. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  75. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  76. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  77. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +20 -7
  78. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  79. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
  80. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +20 -7
  81. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
  82. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  83. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  84. package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -18
  85. package/dist/Editor/common/RnD/Utils/index.js +3 -1
  86. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +45 -58
  87. package/dist/Editor/common/RnD/VirtualElement/helper.js +320 -130
  88. package/dist/Editor/common/RnD/VirtualElement/styles.js +22 -0
  89. package/dist/Editor/common/RnD/index.js +48 -13
  90. package/dist/Editor/common/Shorthands/elements.js +62 -4
  91. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  92. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +20 -2
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  95. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  96. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
  97. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
  98. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
  99. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
  100. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  101. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
  102. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  103. package/dist/Editor/common/StyleBuilder/index.js +8 -4
  104. package/dist/Editor/common/Uploader.js +125 -17
  105. package/dist/Editor/common/UploaderWithProgress.js +183 -0
  106. package/dist/Editor/common/iconslist.js +21 -0
  107. package/dist/Editor/commonStyle.js +107 -64
  108. package/dist/Editor/helper/index.js +10 -2
  109. package/dist/Editor/helper/textIndeces.js +58 -0
  110. package/dist/Editor/helper/theme.js +203 -2
  111. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  112. package/dist/Editor/hooks/useMouseMove.js +9 -3
  113. package/dist/Editor/hooks/useThemeValues.js +63 -0
  114. package/dist/Editor/plugins/withEmbeds.js +1 -1
  115. package/dist/Editor/plugins/withHTML.js +7 -3
  116. package/dist/Editor/plugins/withTable.js +1 -1
  117. package/dist/Editor/service/fileupload.js +53 -0
  118. package/dist/Editor/theme/ThemeList.js +50 -173
  119. package/dist/Editor/theme/index.js +149 -0
  120. package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
  121. package/dist/Editor/themeSettings/buttons/index.js +300 -0
  122. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  123. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  124. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  125. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  126. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  127. package/dist/Editor/themeSettings/fonts/style.js +62 -0
  128. package/dist/Editor/themeSettings/icons.js +60 -0
  129. package/dist/Editor/themeSettings/index.js +380 -0
  130. package/dist/Editor/themeSettings/style.js +299 -0
  131. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  132. package/dist/Editor/themeSettingsAI/index.js +355 -0
  133. package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
  134. package/dist/Editor/themeSettingsAI/style.js +332 -0
  135. package/dist/Editor/utils/SlateUtilityFunctions.js +182 -21
  136. package/dist/Editor/utils/accordion.js +62 -34
  137. package/dist/Editor/utils/button.js +1 -17
  138. package/dist/Editor/utils/draftToSlate.js +3 -2
  139. package/dist/Editor/utils/font.js +40 -37
  140. package/dist/Editor/utils/helper.js +97 -21
  141. package/dist/Editor/utils/insertAppHeader.js +8 -4
  142. package/package.json +4 -4
  143. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -454
@@ -10,6 +10,8 @@ import { AllColors } from "../../Elements/Color Picker/ColorButtons";
10
10
  import { fontFamilyMap } from "../../utils/font";
11
11
  import { getBorderColor } from "../../utils/helper";
12
12
  import SelectTypography from "./MiniTextFormat/SelectTypography";
13
+ import { isTextCustomized, saveToTheme } from "../../helper/theme";
14
+ import { useEditorTheme } from "../../hooks/useEditorTheme";
13
15
  import SelectSuperSubscript from "./MiniTextFormat/SelectSuperSubscript";
14
16
  import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
15
17
  import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
@@ -29,7 +31,8 @@ const TextFormat = props => {
29
31
  editor,
30
32
  onClose,
31
33
  closeMainPopup,
32
- customProps
34
+ customProps,
35
+ commonProps
33
36
  } = props;
34
37
  const [anchorEl, setAnchorEl] = useState(null);
35
38
  const [type, setType] = useState(null);
@@ -37,20 +40,29 @@ const TextFormat = props => {
37
40
  const {
38
41
  translation
39
42
  } = customProps;
43
+ const {
44
+ listType
45
+ } = commonProps || {};
40
46
  const {
41
47
  element: pageSt
42
48
  } = getPageSettings(editor) || {};
43
49
  const pageSettingLine = pageSt?.pageProps?.lineHeight;
44
50
  const {
45
51
  fontFamilies,
46
- theme
52
+ theme: appTheme
47
53
  } = useEditorContext();
48
54
  const breakpoint = getDevice(window.innerWidth);
49
55
  const fontWeight = allTools.find(f => f.format === "fontWeight");
50
56
  const fontStyle = allTools.filter(f => f.type === "mark" && f.format !== "strikethrough" && f.format !== "superscript" && f.format !== "subscript");
51
57
  const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
52
58
  const link = allTools.find(f => f.format?.indexOf("link") >= 0);
53
- const lists = allTools.filter(f => f.group?.indexOf("list") >= 0);
59
+ const lists = allTools.filter(f => {
60
+ let listTool = f.group?.indexOf("list") >= 0;
61
+ if (listTool) {
62
+ const hide = f.hideFor?.includes(listType);
63
+ return !hide;
64
+ }
65
+ });
54
66
  const {
55
67
  isActive: isBlockQuoteActive,
56
68
  props: bqProps
@@ -62,6 +74,11 @@ const TextFormat = props => {
62
74
  color: "",
63
75
  bgColor: ""
64
76
  };
77
+ const {
78
+ theme,
79
+ updateTheme
80
+ } = useEditorTheme();
81
+ const customized = isTextCustomized(editor);
65
82
  let lineSpacingValue = activeMark(editor, "lineHeight");
66
83
  lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
67
84
  const handleColorPicker = type => e => {
@@ -116,6 +133,51 @@ const TextFormat = props => {
116
133
  sx: classes.textFormatWrapper,
117
134
  className: "text-formatter-popup",
118
135
  children: [/*#__PURE__*/_jsxs(Grid, {
136
+ item: true,
137
+ xs: 12,
138
+ children: [/*#__PURE__*/_jsxs(Grid, {
139
+ container: true,
140
+ justifyContent: "space-between",
141
+ alignItems: "center",
142
+ children: [/*#__PURE__*/_jsx(Grid, {
143
+ item: true,
144
+ children: /*#__PURE__*/_jsx(Typography, {
145
+ variant: "body1",
146
+ color: "primary",
147
+ sx: classes.typoLabel,
148
+ children: "Style"
149
+ })
150
+ }), /*#__PURE__*/_jsx(Grid, {
151
+ item: true,
152
+ children: theme?.id ? /*#__PURE__*/_jsx(Button, {
153
+ sx: classes.defaultBtn,
154
+ onClick: () => {
155
+ const {
156
+ field,
157
+ theme
158
+ } = saveToTheme(editor) || {};
159
+ updateTheme(theme, {
160
+ action: "ELEMENT_PROPS_CHANGE",
161
+ fieldName: field
162
+ });
163
+ },
164
+ disabled: !customized,
165
+ children: "Save to theme"
166
+ }) : null
167
+ })]
168
+ }), /*#__PURE__*/_jsx(Grid, {
169
+ item: true,
170
+ xs: 12,
171
+ sx: classes.textFormatField,
172
+ children: /*#__PURE__*/_jsx(SelectTypography, {
173
+ editor: editor,
174
+ classes: classes,
175
+ closeMainPopup: closeMainPopup,
176
+ type: "fullWidth",
177
+ customProps: customProps
178
+ })
179
+ })]
180
+ }), /*#__PURE__*/_jsxs(Grid, {
119
181
  item: true,
120
182
  xs: 12,
121
183
  children: [/*#__PURE__*/_jsxs(Grid, {
@@ -242,7 +304,8 @@ const TextFormat = props => {
242
304
  rounded: true,
243
305
  title: translation("textColor"),
244
306
  id: "11_cc",
245
- classes: classes
307
+ classes: classes,
308
+ type: "textColor"
246
309
  }, "11_cc")
247
310
  })]
248
311
  }), /*#__PURE__*/_jsxs(Grid, {
@@ -268,7 +331,7 @@ const TextFormat = props => {
268
331
  children: /*#__PURE__*/_jsx(Button, {
269
332
  sx: classes.defaultBtn2,
270
333
  startIcon: /*#__PURE__*/_jsx(ColorResetIcon, {
271
- stroke: theme?.palette?.type === "dark" ? "#505359" : "#A2B0B9"
334
+ stroke: appTheme?.palette?.type === "dark" ? "#505359" : "#A2B0B9"
272
335
  }),
273
336
  onClick: handleDefault({
274
337
  format: "bgColor"
@@ -358,12 +421,7 @@ const TextFormat = props => {
358
421
  xs: 12,
359
422
  className: "typo-icons",
360
423
  sx: classes.evenSpace,
361
- children: [/*#__PURE__*/_jsx(SelectTypography, {
362
- classes: classes,
363
- editor: editor,
364
- closeMainPopup: closeMainPopup || onClose,
365
- customProps: customProps
366
- }), fontStyle?.map((m, i) => {
424
+ children: [fontStyle?.map((m, i) => {
367
425
  return /*#__PURE__*/_jsx(MarkButton, {
368
426
  editor: editor,
369
427
  ...m,
@@ -402,7 +460,7 @@ const TextFormat = props => {
402
460
  value: lineSpacingValue,
403
461
  onChange: handleLineSpacing,
404
462
  data: {
405
- key: 'lineHeight'
463
+ key: "lineHeight"
406
464
  }
407
465
  })
408
466
  })]
@@ -0,0 +1,439 @@
1
+ import { Box, Button, Divider, Grid, IconButton, Popover, TextField, Tooltip, Typography } from "@mui/material";
2
+ import { useEditorContext } from "../../hooks/useMouseMove";
3
+ // import FormatClearIcon from "@mui/icons-material/FormatClear";
4
+ import usePopupStyles from "../PopupTool/PopupToolStyle";
5
+ import { TextMinusIcon, TextPlusIcon } from "../../common/iconslist";
6
+ import { BREAKPOINTS_DEVICES, getBreakPointsValue, getVariableValue } from "../../helper/theme";
7
+ import useWindowResize from "../../hooks/useWindowResize";
8
+ import { toolbarGroups } from "../toolbarGroups";
9
+ import Icon from "../../common/Icon";
10
+ import { useMemo, useState } from "react";
11
+ import CommonButton from "../../common/Button";
12
+ import CustomSelect from "../../common/CustomSelect";
13
+ import ColorButtons from "../../Elements/Color Picker/ColorButtons";
14
+ // import FormatColorResetIcon from "@mui/icons-material/FormatColorReset";
15
+ import ColorPickerStyles from "../../Elements/Color Picker/Styles";
16
+ import colorWheel from "../../Elements/Color Picker/colorWheel.png";
17
+ import CustomColorPicker from "../../common/CustomColorPicker";
18
+ import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
19
+ import { googleFontList as defaultFonts } from "../../common/FontLoader/FontList";
20
+ import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
21
+ import { fontFamilyMap } from "../../utils/font";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ import { jsxs as _jsxs } from "react/jsx-runtime";
24
+ import { Fragment as _Fragment } from "react/jsx-runtime";
25
+ function getFontStyleProps(settings = {}, format) {
26
+ const {
27
+ fontWeight,
28
+ fontStyle
29
+ } = settings;
30
+ let isActive;
31
+ let onClick;
32
+ switch (format) {
33
+ case "bold":
34
+ isActive = fontWeight === "bold" || fontWeight === "700";
35
+ onClick = () => {
36
+ return {
37
+ fontWeight: isActive ? "normal" : "bold"
38
+ };
39
+ };
40
+ break;
41
+ case "italic":
42
+ isActive = fontStyle === "italic";
43
+ onClick = () => {
44
+ return {
45
+ fontStyle: isActive ? "unset" : "italic"
46
+ };
47
+ };
48
+ break;
49
+
50
+ // case "underline":
51
+ // isActive = textDecoration.includes("underline");
52
+ // onClick = () => {
53
+ // let otherTextDecoration = textDecoration?.includes("line-through")
54
+ // ? "line-through"
55
+ // : "";
56
+
57
+ // otherTextDecoration += isActive ? "" : " underline";
58
+
59
+ // return { textDecoration: otherTextDecoration };
60
+ // };
61
+ // break;
62
+ // case "strikethrough":
63
+ // isActive = textDecoration.includes("line-through");
64
+ // onClick = () => {
65
+ // let otherTextDecoration = textDecoration?.includes("underline")
66
+ // ? "underline"
67
+ // : "";
68
+
69
+ // otherTextDecoration += isActive ? "" : " line-through";
70
+
71
+ // return { textDecoration: otherTextDecoration };
72
+ // };
73
+ // break;
74
+
75
+ default:
76
+ isActive = false;
77
+ onClick = () => {};
78
+ break;
79
+ }
80
+ return {
81
+ isActive,
82
+ onClick
83
+ };
84
+ }
85
+ const allTools = toolbarGroups.flat();
86
+ function ThemeTextFormat(props) {
87
+ const {
88
+ settings,
89
+ updateSettings,
90
+ onSaveTextSettings,
91
+ onClose
92
+ } = props;
93
+ const {
94
+ theme,
95
+ fontFamilies
96
+ } = useEditorContext();
97
+ const classes = usePopupStyles(theme);
98
+ const pickerStyles = ColorPickerStyles(theme);
99
+ const fontStyle = allTools.filter(f => f.type === "mark" && f.themeEnabled);
100
+ const fontWeight = allTools.find(f => f.format === "fontWeight");
101
+ const fontFamilyVal = useMemo(() => {
102
+ const {
103
+ fontFamily = ""
104
+ } = settings;
105
+ let font = fontFamily.startsWith("var") ? getVariableValue(fontFamily) : fontFamily;
106
+ return font;
107
+ }, [settings]);
108
+ const fontWeightVal = useMemo(() => {
109
+ const {
110
+ options
111
+ } = fontWeight || {};
112
+ const selected = options?.find(o => o.value === settings?.fontWeight || o.numVal === settings?.fontWeight);
113
+ return selected?.value;
114
+ }, [settings?.fontWeight]);
115
+ return /*#__PURE__*/_jsxs(Box, {
116
+ sx: classes.textFormatContainer,
117
+ children: [/*#__PURE__*/_jsxs(Grid, {
118
+ container: true,
119
+ sx: classes.textFormatWrapper,
120
+ children: [/*#__PURE__*/_jsxs(Grid, {
121
+ item: true,
122
+ xs: 12,
123
+ children: [/*#__PURE__*/_jsxs(Grid, {
124
+ container: true,
125
+ justifyContent: "space-between",
126
+ alignItems: "center",
127
+ children: [/*#__PURE__*/_jsx(Grid, {
128
+ item: true,
129
+ children: /*#__PURE__*/_jsx(Typography, {
130
+ variant: "body1",
131
+ color: "primary",
132
+ sx: classes.typoLabel,
133
+ children: "Font Family"
134
+ })
135
+ }), /*#__PURE__*/_jsx(Grid, {
136
+ item: true,
137
+ children: /*#__PURE__*/_jsx(Button, {
138
+ sx: classes.defaultBtn1,
139
+ startIcon: /*#__PURE__*/_jsx(TextDefaultStyleIcon, {}),
140
+ onClick: () => updateSettings({
141
+ fontFamily: Object.values(fontFamilyMap)[0]
142
+ }),
143
+ className: "npr-0",
144
+ children: "Default Text"
145
+ })
146
+ })]
147
+ }), /*#__PURE__*/_jsx(Grid, {
148
+ item: true,
149
+ xs: 12,
150
+ sx: classes.textFormatField,
151
+ children: /*#__PURE__*/_jsx(FontFamilyAutocomplete, {
152
+ editor: {},
153
+ format: "fontFamily",
154
+ options: fontFamilies?.options,
155
+ width: "100%",
156
+ onChange: updateSettings,
157
+ val: fontFamilyVal || defaultFonts[0],
158
+ webFont: true
159
+ })
160
+ })]
161
+ }), /*#__PURE__*/_jsxs(Grid, {
162
+ container: true,
163
+ spacing: 2,
164
+ children: [/*#__PURE__*/_jsxs(Grid, {
165
+ item: true,
166
+ xs: 6,
167
+ children: [/*#__PURE__*/_jsx(Typography, {
168
+ variant: "body1",
169
+ color: "primary",
170
+ sx: classes.typoLabel,
171
+ children: "Font Weight"
172
+ }), /*#__PURE__*/_jsx(Grid, {
173
+ item: true,
174
+ xs: 12,
175
+ sx: classes.textFormatField,
176
+ children: /*#__PURE__*/_jsx(CustomSelect, {
177
+ options: fontWeight?.options || [],
178
+ classes: classes,
179
+ onChange: e => {
180
+ updateSettings({
181
+ fontWeight: e.target.value
182
+ });
183
+ },
184
+ value: fontWeightVal
185
+ })
186
+ })]
187
+ }), /*#__PURE__*/_jsxs(Grid, {
188
+ item: true,
189
+ xs: 6,
190
+ children: [/*#__PURE__*/_jsx(Typography, {
191
+ variant: "body1",
192
+ color: "primary",
193
+ sx: classes.typoLabel,
194
+ children: "Font Size"
195
+ }), /*#__PURE__*/_jsx(Grid, {
196
+ item: true,
197
+ xs: 12,
198
+ sx: classes.textFormatCG,
199
+ children: /*#__PURE__*/_jsx(TextSize, {
200
+ classes: classes,
201
+ value: settings?.fontSize || 16,
202
+ onChange: fontSize => updateSettings({
203
+ fontSize
204
+ }),
205
+ fullWidth: true
206
+ })
207
+ })]
208
+ })]
209
+ }), /*#__PURE__*/_jsx(Grid, {
210
+ item: true,
211
+ xs: 12,
212
+ sx: classes.dividerGrid,
213
+ children: /*#__PURE__*/_jsx(Divider, {})
214
+ }), /*#__PURE__*/_jsxs(Grid, {
215
+ item: true,
216
+ xs: 12,
217
+ children: [/*#__PURE__*/_jsxs(Grid, {
218
+ container: true,
219
+ justifyContent: "space-between",
220
+ alignItems: "center",
221
+ children: [/*#__PURE__*/_jsx(Grid, {
222
+ item: true,
223
+ children: /*#__PURE__*/_jsx(Typography, {
224
+ variant: "body1",
225
+ color: "primary",
226
+ sx: classes.typoLabel,
227
+ children: "Text Color"
228
+ })
229
+ }), /*#__PURE__*/_jsx(Grid, {
230
+ item: true,
231
+ children: /*#__PURE__*/_jsx(Button, {
232
+ sx: classes.defaultBtn1,
233
+ startIcon: /*#__PURE__*/_jsx(ColorResetIcon, {}),
234
+ onClick: () => updateSettings({
235
+ color: "#ddd"
236
+ }),
237
+ children: "Default Color"
238
+ })
239
+ })]
240
+ }), /*#__PURE__*/_jsx(Grid, {
241
+ sx: classes.textFormatColorWrpr,
242
+ children: /*#__PURE__*/_jsx(ColorPicker, {
243
+ classes: classes,
244
+ pickerStyles: pickerStyles,
245
+ onChange: color => updateSettings({
246
+ color
247
+ }),
248
+ color: settings?.color,
249
+ disableEditTheme: true
250
+ })
251
+ })]
252
+ }), /*#__PURE__*/_jsx(Grid, {
253
+ item: true,
254
+ xs: 12,
255
+ sx: classes.dividerGrid,
256
+ children: /*#__PURE__*/_jsx(Divider, {})
257
+ }), /*#__PURE__*/_jsxs(Grid, {
258
+ item: true,
259
+ xs: 12,
260
+ children: [/*#__PURE__*/_jsx(Typography, {
261
+ variant: "body1",
262
+ color: "primary",
263
+ sx: classes.typoLabel,
264
+ children: "Typography"
265
+ }), /*#__PURE__*/_jsx(Grid, {
266
+ item: true,
267
+ xs: 12,
268
+ className: "typo-icons",
269
+ sx: classes.evenSpace,
270
+ children: fontStyle?.map((m, i) => {
271
+ const {
272
+ isActive,
273
+ onClick
274
+ } = getFontStyleProps(settings, m.format) || {};
275
+ return /*#__PURE__*/_jsx(CommonButton, {
276
+ active: isActive,
277
+ onClick: () => {
278
+ const style = onClick();
279
+ updateSettings(style);
280
+ },
281
+ children: /*#__PURE__*/_jsx(Icon, {
282
+ icon: m.format
283
+ })
284
+ }, i);
285
+ })
286
+ })]
287
+ })]
288
+ }), /*#__PURE__*/_jsxs("div", {
289
+ className: "saveThemeBtnsWrapper",
290
+ children: [/*#__PURE__*/_jsx(Button, {
291
+ onClick: onClose,
292
+ className: "closeBtn",
293
+ style: {
294
+ background: "none"
295
+ },
296
+ children: "Cancel"
297
+ }), /*#__PURE__*/_jsx(Button, {
298
+ onClick: onSaveTextSettings,
299
+ className: "confirmBtn",
300
+ children: "Save"
301
+ })]
302
+ })]
303
+ });
304
+ }
305
+ export default ThemeTextFormat;
306
+ function TextSize(props) {
307
+ const {
308
+ classes,
309
+ value: val,
310
+ onChange,
311
+ fullWidth
312
+ } = props;
313
+ const [size] = useWindowResize();
314
+ const value = getBreakPointsValue(val, size?.device);
315
+ const updateMarkData = newVal => {
316
+ let upData = {
317
+ ...getBreakPointsValue(val),
318
+ [size?.device]: `${newVal}px`
319
+ };
320
+
321
+ // if desktop update to all other devices
322
+ // to avoid default normal size
323
+ if (size?.device === "lg") {
324
+ upData = BREAKPOINTS_DEVICES.reduce((a, b) => {
325
+ a[b] = upData[b] || `${newVal}px`;
326
+ return a;
327
+ }, {});
328
+ }
329
+ onChange(upData);
330
+ };
331
+ const onChangeSize = e => {
332
+ let inc = parseInt(e.target.value) || 8;
333
+ inc = inc > 200 ? 200 : inc;
334
+ updateMarkData(inc || 8);
335
+ };
336
+ const getSizeVal = () => {
337
+ try {
338
+ return parseInt(value);
339
+ } catch (err) {
340
+ return "";
341
+ }
342
+ };
343
+ const combinedOldVal = getSizeVal();
344
+ const onIncreaseSize = () => {
345
+ let inc = (combinedOldVal || 0) + 1;
346
+ inc = inc > 200 ? 200 : inc;
347
+ updateMarkData(inc);
348
+ };
349
+ const onDecreaseSize = () => {
350
+ const newVal = combinedOldVal - 1 < 0 ? 0 : combinedOldVal - 1;
351
+ updateMarkData(newVal);
352
+ };
353
+ return /*#__PURE__*/_jsx(TextField, {
354
+ sx: classes?.textSize,
355
+ value: combinedOldVal,
356
+ onChange: onChangeSize,
357
+ size: "small",
358
+ inputProps: {
359
+ style: {
360
+ width: fullWidth ? "100%" : "30px",
361
+ textAlign: "center",
362
+ height: "19px",
363
+ fontSize: "14px"
364
+ }
365
+ },
366
+ fullWidth: fullWidth,
367
+ InputProps: {
368
+ style: {
369
+ borderRadius: "8px"
370
+ },
371
+ endAdornment: /*#__PURE__*/_jsxs("div", {
372
+ className: "textFontArrows",
373
+ children: [/*#__PURE__*/_jsx(IconButton, {
374
+ onClick: onIncreaseSize,
375
+ size: "small",
376
+ children: /*#__PURE__*/_jsx(TextPlusIcon, {})
377
+ }), /*#__PURE__*/_jsx(IconButton, {
378
+ onClick: onDecreaseSize,
379
+ size: "small",
380
+ children: /*#__PURE__*/_jsx(TextMinusIcon, {})
381
+ })]
382
+ })
383
+ }
384
+ });
385
+ }
386
+ function ColorPicker(props) {
387
+ const {
388
+ classes,
389
+ pickerStyles,
390
+ onChange,
391
+ color,
392
+ disableEditTheme
393
+ } = props;
394
+ const [anchorEl, setAnchorEl] = useState(null);
395
+ const open = Boolean(anchorEl);
396
+ const handleClose = () => {
397
+ setAnchorEl(null);
398
+ };
399
+ return /*#__PURE__*/_jsxs(_Fragment, {
400
+ children: [/*#__PURE__*/_jsx(Tooltip, {
401
+ title: "",
402
+ arrow: true,
403
+ children: /*#__PURE__*/_jsx(IconButton, {
404
+ sx: pickerStyles.colorPickerIcon,
405
+ onClick: e => {
406
+ setAnchorEl(e.currentTarget);
407
+ },
408
+ children: /*#__PURE__*/_jsx("img", {
409
+ src: colorWheel,
410
+ alt: "color wheel"
411
+ })
412
+ })
413
+ }), /*#__PURE__*/_jsx(ColorButtons, {
414
+ classes: pickerStyles,
415
+ onSelect: onChange,
416
+ activeColor: color,
417
+ disableEditTheme: disableEditTheme
418
+ }), /*#__PURE__*/_jsx(Popover, {
419
+ open: open,
420
+ anchorEl: anchorEl,
421
+ onClose: handleClose,
422
+ anchorOrigin: {
423
+ vertical: "top",
424
+ horizontal: "center"
425
+ },
426
+ transformOrigin: {
427
+ vertical: "bottom",
428
+ horizontal: "top"
429
+ },
430
+ sx: classes.colorPickerPopup,
431
+ children: /*#__PURE__*/_jsx(CustomColorPicker, {
432
+ gradient: true,
433
+ onChange: onChange,
434
+ color: color,
435
+ disableEditTheme: disableEditTheme
436
+ })
437
+ })]
438
+ });
439
+ }
@@ -9,7 +9,7 @@ import { useEditorContext } from "../../hooks/useMouseMove";
9
9
  import usePopupStyles from "../PopupTool/PopupToolStyle";
10
10
  import useEditorScroll from "../../hooks/useEditorScroll";
11
11
  import { isCarouselSelected } from "../../helper";
12
- import { hideSlateSelection } from "../../utils/helper";
12
+ import { hideSlateSelection, viewSlateSelection } from "../../utils/helper";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  const isSlateDOM = event => {
15
15
  return event.target.getAttribute("data-slate-string") === "true";
@@ -95,15 +95,18 @@ const PopupTool = props => {
95
95
  const isFreeGridEnabled = enable === 1 && isFreeGridElement;
96
96
  if (!selection || Range.isCollapsed(selection) || Editor.string(editor, selection) === "" || isFreeGridEnabled) {
97
97
  setAnchorEl(null);
98
+ hideSlateSelection(); // removes slate selection background, when there is no selection
98
99
  } else {
99
100
  updateAnchorEl();
100
- hideSlateSelection(); // removes slate selection background, when there is no selection
101
+ viewSlateSelection();
102
+ // hideSlateSelection(); // removes slate selection background, when there is no selection
101
103
  }
102
104
  }, [selection, event, selectedElement?.enable]);
103
105
  const handleClose = () => {
104
106
  // setAnchorEl(null);
105
107
  setOpen(false);
106
108
  setPopupType("");
109
+ Transforms.deselect(editor);
107
110
  };
108
111
  return open && !openAI ? /*#__PURE__*/_jsx(ClickAwayListener, {
109
112
  onClickAway: e => {