@flozy/editor 9.8.3 → 9.8.4

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 (257) hide show
  1. package/dist/Editor/ChatEditor.js +26 -19
  2. package/dist/Editor/CommonEditor.js +141 -26
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +11 -7
  5. package/dist/Editor/Elements/AI/AIInput.js +5 -3
  6. package/dist/Editor/Elements/AI/CustomSelect.js +9 -5
  7. package/dist/Editor/Elements/AI/PopoverAIInput.js +15 -5
  8. package/dist/Editor/Elements/Accordion/Accordion.js +4 -3
  9. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +4 -1
  10. package/dist/Editor/Elements/Accordion/AccordionButton.js +6 -2
  11. package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +4 -1
  12. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  13. package/dist/Editor/Elements/AppHeader/AppHeaderButton.js +6 -2
  14. package/dist/Editor/Elements/AppHeader/AppHeaderPopup.js +4 -1
  15. package/dist/Editor/Elements/Attachments/AttachmentsButton.js +4 -1
  16. package/dist/Editor/Elements/Button/ButtonPopup.js +4 -1
  17. package/dist/Editor/Elements/Button/ButtonToolIcon.js +6 -2
  18. package/dist/Editor/Elements/Button/EditorButton.js +43 -30
  19. package/dist/Editor/Elements/Carousel/Carousel.js +5 -4
  20. package/dist/Editor/Elements/Carousel/CarouselButton.js +6 -2
  21. package/dist/Editor/Elements/Carousel/CarouselItem.js +3 -2
  22. package/dist/Editor/Elements/ChipText/ChipTextPopup.js +4 -1
  23. package/dist/Editor/Elements/CodeToText/CodeToText.js +5 -4
  24. package/dist/Editor/Elements/CodeToText/HtmlContextMenu.js +6 -2
  25. package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -14
  26. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  27. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  28. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  29. package/dist/Editor/Elements/Colorbox/ColorboxButton.js +6 -2
  30. package/dist/Editor/Elements/DataView/DataView.js +5 -2
  31. package/dist/Editor/Elements/DataView/DataViewButton.js +6 -2
  32. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +4 -2
  33. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +448 -0
  34. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +21 -6
  35. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +13 -12
  36. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +7 -4
  37. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +7 -5
  38. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +9 -7
  39. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +8 -3
  40. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +5 -3
  41. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +6 -5
  42. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +5 -3
  43. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +9 -7
  44. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +15 -12
  45. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +3 -2
  46. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +3 -2
  47. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +23 -6
  48. package/dist/Editor/Elements/DataView/Layouts/TableView.js +6 -4
  49. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +8 -4
  50. package/dist/Editor/Elements/DataView/Layouts/index.js +3 -1
  51. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +5 -2
  52. package/dist/Editor/Elements/Divider/Divider.js +5 -3
  53. package/dist/Editor/Elements/Divider/DividerButton.js +6 -2
  54. package/dist/Editor/Elements/Divider/DividerPopup.js +3 -2
  55. package/dist/Editor/Elements/Embed/Embed.js +4 -1
  56. package/dist/Editor/Elements/Embed/EmbedPopup.js +4 -1
  57. package/dist/Editor/Elements/Embed/Image.js +16 -11
  58. package/dist/Editor/Elements/Embed/Video.js +10 -7
  59. package/dist/Editor/Elements/EmbedScript/Code.js +7 -4
  60. package/dist/Editor/Elements/EmbedScript/EmbedScript.js +6 -2
  61. package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +8 -5
  62. package/dist/Editor/Elements/Emoji/EmojiButton.js +6 -2
  63. package/dist/Editor/Elements/Form/FieldPopup.js +4 -1
  64. package/dist/Editor/Elements/Form/Form.js +12 -9
  65. package/dist/Editor/Elements/Form/FormButton.js +6 -2
  66. package/dist/Editor/Elements/Form/FormPopup.js +3 -2
  67. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +18 -12
  68. package/dist/Editor/Elements/Form/Workflow/ListWorkflow.js +13 -8
  69. package/dist/Editor/Elements/Form/Workflow/MoreOptions.js +3 -2
  70. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  71. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +4 -2
  72. package/dist/Editor/Elements/Form/Workflow/index.js +15 -9
  73. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +67 -23
  74. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +31 -6
  75. package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +6 -2
  76. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +54 -6
  77. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +3 -2
  78. package/dist/Editor/Elements/FreeGrid/Options/More.js +10 -4
  79. package/dist/Editor/Elements/FreeGrid/styles.js +3 -0
  80. package/dist/Editor/Elements/Grid/Grid.js +13 -10
  81. package/dist/Editor/Elements/Grid/GridButton.js +9 -5
  82. package/dist/Editor/Elements/Grid/GridItem.js +14 -8
  83. package/dist/Editor/Elements/Grid/GridItemPopup.js +4 -1
  84. package/dist/Editor/Elements/Grid/GridPopup.js +4 -1
  85. package/dist/Editor/Elements/Grid/SectionPopup.js +4 -1
  86. package/dist/Editor/Elements/Link/Link.js +8 -5
  87. package/dist/Editor/Elements/Link/LinkButton.js +4 -1
  88. package/dist/Editor/Elements/List/CheckList.js +18 -10
  89. package/dist/Editor/Elements/NewLine/NewLineButton.js +6 -2
  90. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +4 -1
  91. package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +4 -1
  92. package/dist/Editor/Elements/Search/SearchButton.js +7 -4
  93. package/dist/Editor/Elements/Search/SearchList.js +10 -5
  94. package/dist/Editor/Elements/Signature/SignatureButton.js +6 -2
  95. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +2 -8
  96. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +6 -2
  97. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +4 -1
  98. package/dist/Editor/Elements/Signature/SignaturePopup.js +17 -16
  99. package/dist/Editor/Elements/SimpleText/index.js +14 -5
  100. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  101. package/dist/Editor/Elements/Table/DragButton.js +4 -2
  102. package/dist/Editor/Elements/Table/Table.js +23 -11
  103. package/dist/Editor/Elements/Table/TablePopup.js +4 -1
  104. package/dist/Editor/Elements/Table/TableSelector.js +10 -6
  105. package/dist/Editor/Elements/Table/TableTool.js +8 -4
  106. package/dist/Editor/Elements/Title/title.js +9 -8
  107. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +4 -1
  108. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  109. package/dist/Editor/MiniEditor.js +10 -3
  110. package/dist/Editor/Styles/EditorStyles.js +5 -5
  111. package/dist/Editor/Toolbar/Basic/index.js +2 -1
  112. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +6 -2
  113. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  114. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  115. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +8 -4
  116. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  117. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +17 -5
  118. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +10 -5
  119. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +10 -4
  120. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +10 -4
  121. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +9 -3
  122. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +42 -35
  123. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  124. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +58 -51
  125. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +29 -22
  126. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +226 -87
  127. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +20 -10
  128. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +10 -5
  129. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +71 -11
  130. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +11 -5
  131. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +122 -42
  132. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +436 -0
  133. package/dist/Editor/Toolbar/PopupTool/index.js +18 -2
  134. package/dist/Editor/Toolbar/Toolbar.js +20 -10
  135. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  136. package/dist/Editor/assets/svg/ClearAllRounded.js +31 -0
  137. package/dist/Editor/assets/svg/ResetIconNew.js +23 -0
  138. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  139. package/dist/Editor/common/ColorPickerButton.js +39 -14
  140. package/dist/Editor/common/CustomColorPicker/index.js +131 -0
  141. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  142. package/dist/Editor/common/CustomDialog/index.js +8 -10
  143. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  144. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  145. package/dist/Editor/common/CustomSelect.js +43 -0
  146. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  147. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  148. package/dist/Editor/common/Icon.js +31 -1
  149. package/dist/Editor/common/ImageSelector/ImageSelector.js +10 -8
  150. package/dist/Editor/common/ImageSelector/Options/AddLink.js +6 -4
  151. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  152. package/dist/Editor/common/LinkSettings/NavComponents.js +14 -10
  153. package/dist/Editor/common/LinkSettings/index.js +20 -14
  154. package/dist/Editor/common/LinkSettings/navOptions.js +1 -1
  155. package/dist/Editor/common/MUIIcon/index.js +0 -3
  156. package/dist/Editor/common/MentionsPopup/index.js +6 -2
  157. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +46 -22
  158. package/dist/Editor/common/RnD/ContextMenu/index.js +3 -2
  159. package/dist/Editor/common/RnD/ElementOptions/index.js +7 -2
  160. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +8 -3
  161. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +7 -3
  162. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  163. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  164. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  165. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  166. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +7 -4
  167. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  168. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  169. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +6 -2
  170. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  171. package/dist/Editor/common/RnD/OptionsPopup/index.js +4 -3
  172. package/dist/Editor/common/RnD/ShadowElement.js +2 -1
  173. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -4
  174. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  175. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  176. package/dist/Editor/common/RnD/Utils/gridDropItem.js +73 -9
  177. package/dist/Editor/common/RnD/Utils/index.js +3 -0
  178. package/dist/Editor/common/RnD/VirtualElement/BoxHeaderAutoAlignment.js +43 -0
  179. package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +44 -0
  180. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +134 -0
  181. package/dist/Editor/common/RnD/VirtualElement/helper.js +382 -0
  182. package/dist/Editor/common/RnD/VirtualElement/index.js +187 -103
  183. package/dist/Editor/common/RnD/VirtualElement/styles.js +155 -7
  184. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +5 -3
  185. package/dist/Editor/common/RnD/index.js +69 -13
  186. package/dist/Editor/common/Section/index.js +7 -4
  187. package/dist/Editor/common/Shorthands/elements.js +72 -3
  188. package/dist/Editor/common/SnackBar/index.js +43 -0
  189. package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +4 -4
  190. package/dist/Editor/common/StyleBuilder/boxStyle.js +2 -2
  191. package/dist/Editor/common/StyleBuilder/buttonStyle.js +6 -4
  192. package/dist/Editor/common/StyleBuilder/dividerStyles.js +2 -2
  193. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +6 -6
  194. package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -2
  195. package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +13 -9
  196. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +11 -3
  197. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +19 -5
  198. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +22 -10
  199. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +6 -3
  200. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +27 -13
  201. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +43 -14
  202. package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +10 -6
  203. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +19 -6
  204. package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +6 -2
  205. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +5 -2
  206. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +7 -6
  207. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +9 -6
  208. package/dist/Editor/common/StyleBuilder/fieldTypes/metaDataMapping.js +8 -2
  209. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +12 -11
  210. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +6 -2
  211. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +8 -4
  212. package/dist/Editor/common/StyleBuilder/fieldTypes/textAlign.js +6 -2
  213. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +21 -12
  214. package/dist/Editor/common/StyleBuilder/formStyle.js +7 -7
  215. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +6 -6
  216. package/dist/Editor/common/StyleBuilder/gridStyle.js +5 -5
  217. package/dist/Editor/common/StyleBuilder/index.js +8 -5
  218. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +5 -7
  219. package/dist/Editor/common/SwipeableDrawer/index.js +1 -1
  220. package/dist/Editor/common/Uploader.js +16 -5
  221. package/dist/Editor/commonStyle.js +68 -57
  222. package/dist/Editor/helper/index.js +27 -3
  223. package/dist/Editor/helper/textIndeces.js +58 -0
  224. package/dist/Editor/helper/theme.js +202 -2
  225. package/dist/Editor/hooks/useAutoScroll.js +38 -0
  226. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  227. package/dist/Editor/hooks/useMouseMove.js +9 -3
  228. package/dist/Editor/hooks/useThemeValues.js +63 -0
  229. package/dist/Editor/plugins/withEmbeds.js +1 -1
  230. package/dist/Editor/plugins/withHTML.js +11 -9
  231. package/dist/Editor/plugins/withLayout.js +3 -2
  232. package/dist/Editor/plugins/withLinks.js +10 -0
  233. package/dist/Editor/plugins/withTable.js +1 -1
  234. package/dist/Editor/theme/ThemeList.js +50 -173
  235. package/dist/Editor/theme/index.js +149 -0
  236. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  237. package/dist/Editor/themeSettings/buttons/index.js +290 -0
  238. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  239. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  240. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  241. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  242. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  243. package/dist/Editor/themeSettings/fonts/style.js +61 -0
  244. package/dist/Editor/themeSettings/icons.js +60 -0
  245. package/dist/Editor/themeSettings/index.js +351 -0
  246. package/dist/Editor/themeSettings/style.js +220 -0
  247. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  248. package/dist/Editor/themeSettingsAI/index.js +355 -0
  249. package/dist/Editor/themeSettingsAI/saveTheme.js +205 -0
  250. package/dist/Editor/themeSettingsAI/style.js +259 -0
  251. package/dist/Editor/utils/SlateUtilityFunctions.js +186 -54
  252. package/dist/Editor/utils/brains.js +1 -2
  253. package/dist/Editor/utils/draftToSlate.js +3 -2
  254. package/dist/Editor/utils/font.js +40 -37
  255. package/dist/Editor/utils/freegrid.js +3 -3
  256. package/dist/Editor/utils/helper.js +92 -21
  257. package/package.json +4 -4
@@ -1,8 +1,32 @@
1
1
  import React from "react";
2
2
  import { Select, MenuItem } from "@mui/material";
3
- import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
3
+ import { addMarkData, activeMark, getSelectedElementStyle } from "../../utils/SlateUtilityFunctions.js";
4
+ import { toolbarGroups } from "../toolbarGroups.js";
4
5
  import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
6
+ import { googleFontList as defaultFonts } from "../../common/FontLoader/FontList.js";
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ const allTools = toolbarGroups.flat();
9
+ const fontWeight = allTools.find(f => f.format === "fontWeight");
10
+ export const getValue = (editor, format) => {
11
+ switch (format) {
12
+ case "fontFamily":
13
+ {
14
+ const style = getSelectedElementStyle("font-family", editor, format);
15
+ return style || defaultFonts[0];
16
+ }
17
+ case "fontWeight":
18
+ {
19
+ const {
20
+ options
21
+ } = fontWeight || {};
22
+ const fontWeightStyle = getSelectedElementStyle("font-weight", editor, format);
23
+ const selected = options?.find(o => o.value === fontWeightStyle || o.numVal === fontWeightStyle);
24
+ return selected?.value;
25
+ }
26
+ default:
27
+ return activeMark(editor, format);
28
+ }
29
+ };
6
30
  const Dropdown = ({
7
31
  classes,
8
32
  editor,
@@ -10,7 +34,7 @@ const Dropdown = ({
10
34
  options,
11
35
  width
12
36
  }) => {
13
- const value = activeMark(editor, format);
37
+ const value = activeMark(editor, format, true) || getValue(editor, format);
14
38
  const changeMarkData = (event, format) => {
15
39
  event.preventDefault();
16
40
  const value = event.target.value;
@@ -20,7 +44,7 @@ const Dropdown = ({
20
44
  });
21
45
  };
22
46
  return /*#__PURE__*/_jsx(Select, {
23
- value: value,
47
+ value: value || options?.[0]?.value,
24
48
  className: "editor-dd",
25
49
  onChange: e => changeMarkData(e, format),
26
50
  MenuProps: {
@@ -1,9 +1,10 @@
1
1
  import React from "react";
2
2
  import { Autocomplete, TextField } from "@mui/material";
3
- import { activeMark, addMarkData } from "../../utils/SlateUtilityFunctions.js";
3
+ import { addMarkData } from "../../utils/SlateUtilityFunctions.js";
4
4
  import usePopupStyle from "../PopupTool/PopupToolStyle.js";
5
5
  import { useEditorContext } from "../../hooks/useMouseMove.js";
6
- import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
6
+ import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
7
+ import { getValue } from "./Dropdown.js";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  const FontFamilyAutocomplete = ({
9
10
  editor,
@@ -14,7 +15,7 @@ const FontFamilyAutocomplete = ({
14
15
  val = "",
15
16
  webFont = false
16
17
  }) => {
17
- const markValue = activeMark(editor, format);
18
+ const markValue = getValue(editor, format);
18
19
  const value = !webFont ? markValue : val;
19
20
  const changeMarkData = (event, newValue, format) => {
20
21
  if (!webFont) {
@@ -1,21 +1,25 @@
1
1
  import React from "react";
2
2
  import Icon from "../../common/Icon";
3
3
  import Button from "../../common/Button";
4
- import { toggleMark, isMarkActive } from "../../utils/SlateUtilityFunctions.js";
4
+ import { toggleMark, isMarkBtnActive } from "../../utils/SlateUtilityFunctions.js";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const MarkButton = ({
7
7
  editor,
8
8
  format,
9
- title
9
+ title,
10
+ customProps
10
11
  }) => {
12
+ const {
13
+ translation
14
+ } = customProps;
11
15
  return /*#__PURE__*/_jsx(Button, {
12
- active: isMarkActive(editor, format),
16
+ active: isMarkBtnActive(editor, format),
13
17
  format: format,
14
18
  onMouseDown: e => {
15
19
  e.preventDefault();
16
20
  toggleMark(editor, format);
17
21
  },
18
- title: title,
22
+ title: translation(title),
19
23
  style: {
20
24
  color: "#64748B"
21
25
  },
@@ -1,8 +1,7 @@
1
1
  import React, { useEffect, useRef, useState } from "react";
2
2
  import { TextField, IconButton } from "@mui/material";
3
- import { addMarkData, activeMark, isBlockActive } from "../../utils/SlateUtilityFunctions.js";
4
- import { headingMap, sizeMap } from "../../utils/font.js";
5
- import { getBreakPointsValue } from "../../helper/theme.js";
3
+ import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
4
+ import { getBreakPointsValue, getTextSizeVal } from "../../helper/theme.js";
6
5
  import useWindowResize from "../../hooks/useWindowResize.js";
7
6
  import { BREAKPOINTS_DEVICES } from "../../helper/theme.js";
8
7
  import { TextSizeDownArrow, TextSizeUpArrow } from "../../common/iconListV2.js";
@@ -15,11 +14,15 @@ const TextSize = ({
15
14
  format,
16
15
  fullWidth
17
16
  }) => {
18
- const [size] = useWindowResize();
19
- const val = activeMark(editor, format);
20
- const value = getBreakPointsValue(val, size?.device);
21
17
  const [fontSize, setFontSize] = useState();
22
18
  const timerRef = useRef();
19
+ const [size] = useWindowResize();
20
+ const val = activeMark(editor, format);
21
+
22
+ // const noFontSize =
23
+ // val === "normal" || (typeof val === "object" && !Object.keys(val)?.length);
24
+
25
+ const value = getTextSizeVal(editor);
23
26
  useEffect(() => {
24
27
  setFontSize(getSizeVal());
25
28
  }, [value]);
@@ -55,13 +58,7 @@ const TextSize = ({
55
58
  };
56
59
  const getSizeVal = () => {
57
60
  try {
58
- let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
59
- Object.entries(headingMap).forEach(([format, value]) => {
60
- if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
61
- size = value;
62
- }
63
- });
64
- return parseInt(size);
61
+ return parseInt(value);
65
62
  } catch (err) {
66
63
  return "";
67
64
  }
@@ -10,6 +10,7 @@ import usePopupStyle from "../PopupTool/PopupToolStyle";
10
10
  import PopperHeader from "../PopupTool/PopperHeader";
11
11
  import { useEditorContext } from "../../hooks/useMouseMove";
12
12
  import PageSettingsButton from "../../Elements/PageSettings/PageSettingsButton";
13
+ import { isFreeGrid } from "../../utils/helper";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
16
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -31,6 +32,16 @@ const POPUP_TITLE = {
31
32
  addElement: "Add Elements",
32
33
  addTemplate: "Templates"
33
34
  };
35
+ const disableAddElementBtn = editor => {
36
+ if (isFreeGrid(editor?.children || [])) {
37
+ return true;
38
+ }
39
+ const isFocused = !!editor?.selection?.anchor?.path;
40
+ if (!isFocused) {
41
+ return true;
42
+ }
43
+ return false;
44
+ };
34
45
  const MiniToolbar = props => {
35
46
  const {
36
47
  customProps,
@@ -49,7 +60,8 @@ const MiniToolbar = props => {
49
60
  const open = Boolean(PopupComponent);
50
61
  const DialogComp = !fullScreen ? Popper : Dialog;
51
62
  const {
52
- hideTools
63
+ hideTools,
64
+ translation
53
65
  } = customProps;
54
66
  const boxRef = useRef(null); // Add ref to get the Box element
55
67
  const UPDATED_MENU_OPTIONS = MENU_OPTIONS.filter(f => (hideTools || [])?.indexOf(f.type) === -1);
@@ -140,11 +152,10 @@ const MiniToolbar = props => {
140
152
  icon: Icon
141
153
  }) => {
142
154
  const isDisabled = popupType === type || type === "undo" ? !canUndo : type === "redo" ? !canRedo : false;
143
- const isFocussed = editor?.selection?.anchor?.path;
144
- const disableAddElement = type === "addElement" && !isFocussed;
155
+ const disableAddElement = type === "addElement" && disableAddElementBtn(editor);
145
156
  return /*#__PURE__*/_jsxs(Tooltip, {
146
157
  arrow: true,
147
- title: label,
158
+ title: translation(label),
148
159
  disableHoverListener: toolTip,
149
160
  children: [type !== "page-settings" && /*#__PURE__*/_jsx(IconButton, {
150
161
  className: `${type === popper ? "active" : ""} ${type === "undo" && !canUndo || type === "redo" && !canRedo ? "disabled" : ""} ${type === "undo" ? canUndo ? "activeUndo" : "disabledUndo" : type === "redo" ? canRedo ? "activeRedo" : "disabledRedo" : ""} ${disableAddElement ? "disableAddElement" : ""}
@@ -194,7 +205,8 @@ const MiniToolbar = props => {
194
205
  fullScreen: fullScreen,
195
206
  toggleFullscreen: toggleFullscreen,
196
207
  search: search,
197
- onSearch: onSearch
208
+ onSearch: onSearch,
209
+ customProps: customProps
198
210
  }), /*#__PURE__*/_jsx(PopupComponent, {
199
211
  classes: popupStyles,
200
212
  editor: editor,
@@ -135,14 +135,16 @@ const AddTemplates = props => {
135
135
  classes: classes,
136
136
  onSelectTemplate: onSelectTemplate,
137
137
  m: mapData,
138
- fullScreen: fullScreen
138
+ fullScreen: fullScreen,
139
+ customProps: customProps
139
140
  }, `template_Card_${mapData.id}_popup`);
140
141
  case "Buttons":
141
142
  return /*#__PURE__*/_jsx(ButtonTemplateCard, {
142
143
  classes: classes,
143
144
  onSelectTemplate: onSelectTemplate,
144
145
  m: mapData,
145
- fullScreen: fullScreen
146
+ fullScreen: fullScreen,
147
+ customProps: customProps
146
148
  }, `template_Card_${mapData.id}_popup`);
147
149
  case "Banners":
148
150
  case "Tables":
@@ -151,7 +153,8 @@ const AddTemplates = props => {
151
153
  onSelectTemplate: onSelectTemplate,
152
154
  m: mapData,
153
155
  fullScreen: fullScreen,
154
- height: "smallCard"
156
+ height: "smallCard",
157
+ customProps: customProps
155
158
  }, `template_Card_${mapData.id}_popup`);
156
159
  case "404 Page":
157
160
  return /*#__PURE__*/_jsx(FullViewCard, {
@@ -159,14 +162,16 @@ const AddTemplates = props => {
159
162
  onSelectTemplate: onSelectTemplate,
160
163
  m: mapData,
161
164
  fullScreen: fullScreen,
162
- height: "mediumCard"
165
+ height: "mediumCard",
166
+ customProps: customProps
163
167
  }, `template_Card_${mapData.id}_popup`);
164
168
  default:
165
169
  return /*#__PURE__*/_jsx(TemplateCard, {
166
170
  classes: classes,
167
171
  onSelectTemplate: onSelectTemplate,
168
172
  m: mapData,
169
- fullScreen: fullScreen
173
+ fullScreen: fullScreen,
174
+ customProps: customProps
170
175
  }, `template_Card_${mapData.id}_popup`);
171
176
  }
172
177
  };
@@ -6,7 +6,8 @@ const Select = props => {
6
6
  const {
7
7
  classes,
8
8
  data,
9
- onSelectTemplate
9
+ onSelectTemplate,
10
+ translation
10
11
  } = props;
11
12
  return /*#__PURE__*/_jsx(Box, {
12
13
  className: "template-card-action",
@@ -19,7 +20,7 @@ const Select = props => {
19
20
  children: /*#__PURE__*/_jsx(Button, {
20
21
  className: "blueBtn",
21
22
  onClick: onSelectTemplate(data),
22
- children: "Select"
23
+ children: translation("Select")
23
24
  })
24
25
  });
25
26
  };
@@ -27,8 +28,12 @@ const ButtonTemplateCard = props => {
27
28
  const {
28
29
  classes,
29
30
  m,
30
- onSelectTemplate
31
+ onSelectTemplate,
32
+ customProps
31
33
  } = props;
34
+ const {
35
+ translation
36
+ } = customProps;
32
37
  return /*#__PURE__*/_jsx(Grid, {
33
38
  item: true,
34
39
  xs: 3,
@@ -45,7 +50,8 @@ const ButtonTemplateCard = props => {
45
50
  }), /*#__PURE__*/_jsx(Select, {
46
51
  classes: classes,
47
52
  onSelectTemplate: onSelectTemplate,
48
- data: m
53
+ data: m,
54
+ translation: translation
49
55
  })]
50
56
  })
51
57
  })
@@ -6,7 +6,8 @@ const Select = props => {
6
6
  const {
7
7
  classes,
8
8
  data,
9
- onSelectTemplate
9
+ onSelectTemplate,
10
+ translation
10
11
  } = props;
11
12
  return /*#__PURE__*/_jsx(Box, {
12
13
  className: "template-card-action",
@@ -18,7 +19,7 @@ const Select = props => {
18
19
  children: /*#__PURE__*/_jsx(Button, {
19
20
  className: "blueBtn",
20
21
  onClick: onSelectTemplate(data),
21
- children: "Select"
22
+ children: translation("Select")
22
23
  })
23
24
  });
24
25
  };
@@ -27,8 +28,12 @@ const FullViewCard = props => {
27
28
  classes,
28
29
  m,
29
30
  onSelectTemplate,
30
- height = 'smallCard'
31
+ height = 'smallCard',
32
+ customProps
31
33
  } = props;
34
+ const {
35
+ translation
36
+ } = customProps;
32
37
  return /*#__PURE__*/_jsx(Grid, {
33
38
  item: true,
34
39
  xs: 12,
@@ -46,7 +51,8 @@ const FullViewCard = props => {
46
51
  }), /*#__PURE__*/_jsx(Select, {
47
52
  classes: classes,
48
53
  onSelectTemplate: onSelectTemplate,
49
- data: m
54
+ data: m,
55
+ translation: translation
50
56
  })]
51
57
  })
52
58
  })
@@ -11,9 +11,14 @@ function MiniColorPicker(props) {
11
11
  format,
12
12
  classes,
13
13
  id,
14
- editor
14
+ editor,
15
+ customProps,
16
+ type
15
17
  } = props;
16
18
  const [openColorTool, setOpenColorTool] = useState(null);
19
+ const {
20
+ translation
21
+ } = customProps;
17
22
  return /*#__PURE__*/_jsxs("div", {
18
23
  children: [/*#__PURE__*/_jsxs(Button, {
19
24
  className: "fontColorBtn",
@@ -29,12 +34,13 @@ function MiniColorPicker(props) {
29
34
  activeMark: activeMark,
30
35
  editor: editor,
31
36
  showHex: false,
32
- title: "Text Color",
37
+ title: translation("Text Color"),
33
38
  id: id,
34
39
  classes: classes,
35
40
  forMiniTool: true,
36
41
  openColorTool: openColorTool,
37
- closeColorTool: () => setOpenColorTool(null)
42
+ closeColorTool: () => setOpenColorTool(null),
43
+ type: type
38
44
  }, id)]
39
45
  });
40
46
  }
@@ -15,45 +15,52 @@ function Label({
15
15
  }), " ", label]
16
16
  });
17
17
  }
18
- const alignmentOptions = [{
19
- id: 17,
20
- value: "alignLeft",
21
- type: "block",
22
- title: /*#__PURE__*/_jsx(Label, {
23
- icon: "alignLeft",
24
- label: "Left Align"
25
- }),
26
- label: /*#__PURE__*/_jsx(Icon, {
27
- icon: "alignLeft"
28
- })
29
- }, {
30
- id: 18,
31
- value: "alignCenter",
32
- type: "block",
33
- title: /*#__PURE__*/_jsx(Label, {
34
- icon: "alignCenter",
35
- label: "Center Align"
36
- }),
37
- label: /*#__PURE__*/_jsx(Icon, {
38
- icon: "alignCenter"
39
- })
40
- }, {
41
- id: 19,
42
- value: "alignRight",
43
- type: "block",
44
- title: /*#__PURE__*/_jsx(Label, {
45
- icon: "alignRight",
46
- label: "Right Align"
47
- }),
48
- label: /*#__PURE__*/_jsx(Icon, {
49
- icon: "alignRight"
50
- })
51
- }];
18
+ function getAlignmentOptions(translation) {
19
+ return [{
20
+ id: 17,
21
+ value: "alignLeft",
22
+ type: "block",
23
+ title: /*#__PURE__*/_jsx(Label, {
24
+ icon: "alignLeft",
25
+ label: translation("Left Align")
26
+ }),
27
+ label: /*#__PURE__*/_jsx(Icon, {
28
+ icon: "alignLeft"
29
+ })
30
+ }, {
31
+ id: 18,
32
+ value: "alignCenter",
33
+ type: "block",
34
+ title: /*#__PURE__*/_jsx(Label, {
35
+ icon: "alignCenter",
36
+ label: translation("Center Align")
37
+ }),
38
+ label: /*#__PURE__*/_jsx(Icon, {
39
+ icon: "alignCenter"
40
+ })
41
+ }, {
42
+ id: 19,
43
+ value: "alignRight",
44
+ type: "block",
45
+ title: /*#__PURE__*/_jsx(Label, {
46
+ icon: "alignRight",
47
+ label: translation("Right Align")
48
+ }),
49
+ label: /*#__PURE__*/_jsx(Icon, {
50
+ icon: "alignRight"
51
+ })
52
+ }];
53
+ }
52
54
  function SelectAlignment({
53
55
  editor,
54
56
  classes,
55
- closeMainPopup
57
+ closeMainPopup,
58
+ customProps
56
59
  }) {
60
+ const {
61
+ translation
62
+ } = customProps;
63
+ const alignmentOptions = getAlignmentOptions(translation);
57
64
  const selected = useMemo(() => {
58
65
  return alignmentOptions.find(t => isBlockActive(editor, t.value));
59
66
  }, [alignmentOptions, isBlockActive, editor]);
@@ -1,10 +1,9 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
- import { activeMark, addMarkData, isBlockActive } from "../../../utils/SlateUtilityFunctions";
2
+ import { activeMark, addMarkData } from "../../../utils/SlateUtilityFunctions";
3
3
  import { Button, IconButton, Popover, TextField } from "@mui/material";
4
4
  import DownArrowIcon from "../../../assets/svg/DownArrowIcon";
5
5
  import useWindowResize from "../../../hooks/useWindowResize";
6
- import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme";
7
- import { headingMap, sizeMap } from "../../../utils/font";
6
+ import { BREAKPOINTS_DEVICES, getBreakPointsValue, getTextSizeVal } from "../../../helper/theme";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
9
  const fontSizeOptions = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
@@ -19,7 +18,7 @@ function SelectFontSize({
19
18
  const containerRef = useRef();
20
19
  const [size] = useWindowResize();
21
20
  const val = activeMark(editor, format);
22
- const value = getBreakPointsValue(val, size?.device);
21
+ const value = getTextSizeVal(editor);
23
22
  const timerRef = useRef();
24
23
  const updateMarkData = newVal => {
25
24
  let upData = {
@@ -53,13 +52,7 @@ function SelectFontSize({
53
52
  };
54
53
  const getSizeVal = () => {
55
54
  try {
56
- let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
57
- Object.entries(headingMap).forEach(([format, value]) => {
58
- if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
59
- size = value;
60
- }
61
- });
62
- return isNaN(parseInt(size)) ? 14 : parseInt(size);
55
+ return parseInt(value);
63
56
  } catch (err) {
64
57
  return "";
65
58
  }
@@ -97,8 +90,8 @@ function SelectFontSize({
97
90
  anchorEl: anchorEl,
98
91
  onClose: () => setAnchorEl(null),
99
92
  anchorOrigin: {
100
- vertical: 'bottom',
101
- horizontal: 'left'
93
+ vertical: "bottom",
94
+ horizontal: "left"
102
95
  },
103
96
  sx: classes.customSelectPopoverWrapper,
104
97
  children: fontSizeOptions.map((s, i) => {
@@ -16,61 +16,68 @@ function Label({
16
16
  }), " ", label]
17
17
  });
18
18
  }
19
- const listOptions = [{
20
- id: 15,
21
- value: "orderedList",
22
- type: "block",
23
- title: /*#__PURE__*/_jsx(Label, {
24
- icon: "orderedList",
25
- label: "Ordered List"
26
- }),
27
- label: /*#__PURE__*/_jsx(Icon, {
28
- icon: "orderedList"
29
- }),
30
- group: "list"
31
- }, {
32
- id: 16,
33
- value: "unorderedList",
34
- type: "block",
35
- title: /*#__PURE__*/_jsx(Label, {
36
- icon: "unorderedList",
37
- label: "Bulleted List"
38
- }),
39
- label: /*#__PURE__*/_jsx(Icon, {
40
- icon: "unorderedList"
41
- }),
42
- group: "list"
43
- }, {
44
- id: 43,
45
- value: "check-list-item",
46
- type: "block",
47
- title: /*#__PURE__*/_jsx(Label, {
48
- icon: "check-list-item",
49
- label: "Check List"
50
- }),
51
- label: /*#__PURE__*/_jsx(Icon, {
52
- icon: "check-list-item"
53
- }),
54
- group: "list"
55
- }, {
56
- id: 30,
57
- value: "accordion",
58
- type: "accordion",
59
- group: "list",
60
- component: "AccordionButton",
61
- title: /*#__PURE__*/_jsx(Label, {
62
- icon: "accordion",
63
- label: "Accordion"
64
- }),
65
- label: /*#__PURE__*/_jsx(Icon, {
66
- icon: "accordion"
67
- })
68
- }];
19
+ function getListOptions(translation) {
20
+ return [{
21
+ id: 15,
22
+ value: "orderedList",
23
+ type: "block",
24
+ title: /*#__PURE__*/_jsx(Label, {
25
+ icon: "orderedList",
26
+ label: translation("Ordered List")
27
+ }),
28
+ label: /*#__PURE__*/_jsx(Icon, {
29
+ icon: "orderedList"
30
+ }),
31
+ group: "list"
32
+ }, {
33
+ id: 16,
34
+ value: "unorderedList",
35
+ type: "block",
36
+ title: /*#__PURE__*/_jsx(Label, {
37
+ icon: "unorderedList",
38
+ label: translation("Bulleted List")
39
+ }),
40
+ label: /*#__PURE__*/_jsx(Icon, {
41
+ icon: "unorderedList"
42
+ }),
43
+ group: "list"
44
+ }, {
45
+ id: 43,
46
+ value: "check-list-item",
47
+ type: "block",
48
+ title: /*#__PURE__*/_jsx(Label, {
49
+ icon: "check-list-item",
50
+ label: translation("Check List")
51
+ }),
52
+ label: /*#__PURE__*/_jsx(Icon, {
53
+ icon: "check-list-item"
54
+ }),
55
+ group: "list"
56
+ }, {
57
+ id: 30,
58
+ value: "accordion",
59
+ type: "accordion",
60
+ group: "list",
61
+ component: "AccordionButton",
62
+ title: /*#__PURE__*/_jsx(Label, {
63
+ icon: "accordion",
64
+ label: translation("Accordion")
65
+ }),
66
+ label: /*#__PURE__*/_jsx(Icon, {
67
+ icon: "accordion"
68
+ })
69
+ }];
70
+ }
69
71
  function SelectList({
70
72
  editor,
71
73
  classes,
72
- closeMainPopup
74
+ closeMainPopup,
75
+ customProps
73
76
  }) {
77
+ const {
78
+ translation
79
+ } = customProps;
80
+ const listOptions = getListOptions(translation);
74
81
  const selectedList = useMemo(() => {
75
82
  return listOptions.find(t => isBlockActive(editor, t.value));
76
83
  }, [listOptions, isBlockActive, editor]);