@flozy/editor 5.9.2 → 5.9.3

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 (59) hide show
  1. package/dist/Editor/CommonEditor.js +11 -6
  2. package/dist/Editor/Editor.css +22 -16
  3. package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
  4. package/dist/Editor/Elements/Button/EditorButton.js +3 -1
  5. package/dist/Editor/Elements/DataView/DataView.js +4 -3
  6. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +8 -14
  7. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
  8. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
  9. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
  10. package/dist/Editor/Elements/Form/Form.js +1 -0
  11. package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
  12. package/dist/Editor/Elements/Grid/GridItem.js +1 -2
  13. package/dist/Editor/Elements/Link/Link.js +70 -43
  14. package/dist/Editor/Elements/List/CheckList.js +2 -1
  15. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  16. package/dist/Editor/Elements/Search/SearchList.js +8 -1
  17. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  18. package/dist/Editor/Elements/SimpleText/style.js +5 -1
  19. package/dist/Editor/Elements/Table/Table.js +3 -3
  20. package/dist/Editor/Elements/Table/TableCell.js +14 -9
  21. package/dist/Editor/Elements/Title/title.js +13 -1
  22. package/dist/Editor/Elements/Variables/Style.js +28 -2
  23. package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
  24. package/dist/Editor/MiniEditor.js +4 -2
  25. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +37 -28
  26. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
  27. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
  28. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
  29. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
  30. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
  31. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +5 -0
  32. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
  33. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
  34. package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
  35. package/dist/Editor/common/FontLoader/FontList.js +3 -11
  36. package/dist/Editor/common/FontLoader/FontLoader.js +72 -53
  37. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
  38. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  39. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  40. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  41. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  42. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  43. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  44. package/dist/Editor/common/Uploader.js +8 -0
  45. package/dist/Editor/common/iconslist.js +1 -2
  46. package/dist/Editor/commonStyle.js +58 -57
  47. package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
  48. package/dist/Editor/helper/index.js +2 -2
  49. package/dist/Editor/helper/theme.js +24 -1
  50. package/dist/Editor/hooks/useMouseMove.js +5 -2
  51. package/dist/Editor/plugins/withLayout.js +1 -1
  52. package/dist/Editor/utils/SlateUtilityFunctions.js +10 -4
  53. package/dist/Editor/utils/button.js +4 -4
  54. package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
  55. package/dist/Editor/utils/draftToSlate.js +3 -2
  56. package/dist/Editor/utils/helper.js +60 -19
  57. package/dist/Editor/utils/pageSettings.js +14 -2
  58. package/dist/Editor/utils/table.js +21 -0
  59. package/package.json +1 -1
@@ -5,6 +5,7 @@ import { Box } from "@mui/material";
5
5
  import { isTextSelected } from "../../utils/helper";
6
6
  import { useEditorContext } from "../../hooks/useMouseMove";
7
7
  import SimpleTextStyle from "./style";
8
+ import { getBreakpointLineSpacing } from "../../helper/theme";
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -28,8 +29,14 @@ const SimpleText = props => {
28
29
  } = customProps;
29
30
  // const { element: pageSt } = getPageSettings(editor) || {};
30
31
  // const { pageColor } = pageSt?.pageProps || {};
32
+ const {
33
+ activeBreakPoint
34
+ } = useEditorContext();
35
+ const lineHeight = element?.children[0]?.lineHeight;
36
+ const lineH = getBreakpointLineSpacing(lineHeight, activeBreakPoint);
31
37
  const classes = SimpleTextStyle({
32
- pageColor: "#FFFFFF"
38
+ pageColor: "#FFFFFF",
39
+ lineHeight: lineH
33
40
  });
34
41
  const selected = useSelected();
35
42
  const path = ReactEditor.findPath(editor, element);
@@ -1,10 +1,12 @@
1
1
  import { invertColor } from "../../helper";
2
2
  const SimpleTextStyle = ({
3
- pageColor
3
+ pageColor,
4
+ lineHeight
4
5
  }) => ({
5
6
  root: {
6
7
  position: "relative",
7
8
  padding: "0px",
9
+ lineHeight: lineHeight,
8
10
  "&.dataView": {
9
11
  "& .placeholder-simple-text": {
10
12
  opacity: 0
@@ -33,6 +35,8 @@ const SimpleTextStyle = ({
33
35
  height: "24px",
34
36
  overflow: "hidden",
35
37
  fontSize: "14px",
38
+ display: "inline-flex",
39
+ alignItems: "center",
36
40
  "& .bg-pad-sl": {
37
41
  padding: "2px 4px 2px 4px",
38
42
  background: "transparent",
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from "react";
2
2
  import { Editor, Transforms } from "slate";
3
3
  import { ReactEditor, useSelected, useSlateStatic } from "slate-react";
4
4
  import { Box, IconButton, Tooltip, Table as TableComp, TableBody, useTheme, Popper, ClickAwayListener } from "@mui/material";
5
- import { TableUtil } from "../../utils/table";
5
+ import { TableUtil, getTableColumns, getTableRows } from "../../utils/table";
6
6
  import TablePopup from "./TablePopup";
7
7
  import { useEditorContext, useEditorSelection } from "../../hooks/useMouseMove";
8
8
  import TableStyles from "./Styles";
@@ -206,7 +206,7 @@ const Table = props => {
206
206
  }
207
207
  }, theme);
208
208
  const addRow = () => {
209
- const lastRow = element?.rows - 1;
209
+ const lastRow = getTableRows(element) - 1;
210
210
  const firstCol = 0;
211
211
  const lastRowPath = [...path, lastRow, firstCol];
212
212
  const position = Editor.start(editor, lastRowPath);
@@ -221,7 +221,7 @@ const Table = props => {
221
221
  Transforms.deselect(editor);
222
222
  };
223
223
  const addCol = () => {
224
- const lastCol = element?.columns - 1;
224
+ const lastCol = getTableColumns(element) - 1;
225
225
  const firstRow = 0;
226
226
  const lastColumnPath = [...path, firstRow, lastCol];
227
227
  const position = Editor.start(editor, lastColumnPath);
@@ -50,6 +50,7 @@ const TableCell = props => {
50
50
  const {
51
51
  readOnly
52
52
  } = customProps;
53
+ const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
53
54
  const {
54
55
  bgColor,
55
56
  borderColor,
@@ -247,20 +248,24 @@ const TableCell = props => {
247
248
  isDragging: false
248
249
  });
249
250
  };
250
- const tbProps = tableResizing || resizing || over || readOnly ? {
251
- ...commonTdProps,
252
- contentEditable: false
251
+ const eventProps = isMobile ? {
252
+ // mobile events for selection
253
+ onTouchStart: onMouseDownInCell,
254
+ onTouchMove: handleTouchMove,
255
+ onTouchEnd: handleTouchEnd
253
256
  } : {
254
- ...commonTdProps,
255
257
  onMouseEnter: () => onMouseEnter(path),
256
258
  onMouseLeave,
257
259
  onMouseDown: onMouseDownInCell,
258
260
  onMouseUp,
259
- onClick,
260
- // mobile events for selection
261
- onTouchStart: onMouseDownInCell,
262
- onTouchMove: handleTouchMove,
263
- onTouchEnd: handleTouchEnd
261
+ onClick
262
+ };
263
+ const tbProps = tableResizing || resizing || over || readOnly ? {
264
+ ...commonTdProps,
265
+ contentEditable: false
266
+ } : {
267
+ ...commonTdProps,
268
+ ...eventProps
264
269
  };
265
270
  const dndProps = {
266
271
  id: cellId,
@@ -1,12 +1,24 @@
1
1
  import React from "react";
2
+ import { Text } from "slate";
2
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
+ const isEmptyTextNode = node => {
5
+ if (Text.isText(node)) {
6
+ return !node.text.trim();
7
+ }
8
+ return false;
9
+ };
3
10
  const Title = props => {
4
11
  const {
12
+ element,
5
13
  attributes,
6
- children
14
+ children,
15
+ customProps
7
16
  } = props;
17
+ const isEmpty = !customProps?.readOnly && isEmptyTextNode(element?.children[0]) ? "empty" : "";
8
18
  return /*#__PURE__*/_jsx("div", {
9
19
  ...attributes,
20
+ placeholder: "Title",
21
+ className: `content-editable ${isEmpty}`,
10
22
  style: {
11
23
  fontWeight: "bold",
12
24
  fontSize: "20px"
@@ -1,4 +1,4 @@
1
- const VariableStyles = () => ({
1
+ const VariableStyles = theme => ({
2
2
  variablesItem: {
3
3
  color: "#2563EB",
4
4
  background: "#EEEEEE"
@@ -37,8 +37,34 @@ const VariableStyles = () => ({
37
37
  "& .MuiMenuItem-root": {
38
38
  color: "#64748B"
39
39
  },
40
+ "& .MuiPaper-root": {
41
+ borderRadius: '8px',
42
+ backgroundColor: `${theme?.palette?.editor?.miniToolBarBackground} !important`,
43
+ marginTop: '5px',
44
+ "@media only screen and (max-width: 599px)": {
45
+ padding: '10px 0px'
46
+ }
47
+ },
48
+ "& .MuiList-root": {
49
+ padding: '0px'
50
+ },
51
+ "& .MuiButtonBase-root": {
52
+ margin: '6px',
53
+ borderRadius: '8px',
54
+ padding: '6px 14px',
55
+ fontSize: '14px',
56
+ fontWeight: '400',
57
+ color: theme?.palette?.editor?.deletePopUpButtonTextColor,
58
+ "&:hover": {
59
+ background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
60
+ },
61
+ "@media only screen and (max-width: 599px)": {
62
+ minHeight: '30px',
63
+ margin: '0px 6px'
64
+ }
65
+ },
40
66
  "& .Mui-selected": {
41
- backgroundColor: "rgba(0, 0, 0, 0.04) !important"
67
+ backgroundColor: 'unset !important'
42
68
  }
43
69
  }
44
70
  });
@@ -3,11 +3,15 @@ import { useSlateStatic } from "slate-react";
3
3
  import { MenuItem, Select } from "@mui/material";
4
4
  import { insertVariables } from "../../utils/variables";
5
5
  import VariableStyles from "./Style";
6
- import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
6
+ import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
7
+ import { useEditorContext } from "../../hooks/useMouseMove";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const VariableButton = props => {
10
- const classes = VariableStyles();
11
+ const {
12
+ theme
13
+ } = useEditorContext();
14
+ const classes = VariableStyles(theme);
11
15
  const editor = useSlateStatic();
12
16
  const {
13
17
  options
@@ -24,13 +28,14 @@ const VariableButton = props => {
24
28
  value: "",
25
29
  sx: classes.variableBtn,
26
30
  onChange: updateVariable,
27
- IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownIcon, {}),
31
+ IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownRoundedIcon, {}),
28
32
  MenuProps: {
29
33
  sx: classes.variableMenuItem,
30
34
  PaperProps: {
31
35
  style: {
32
36
  maxHeight: 300,
33
- overflowY: "auto"
37
+ overflowY: "auto",
38
+ transformOrigin: 'top left'
34
39
  },
35
40
  sx: {
36
41
  "&::-webkit-scrollbar-track": {
@@ -40,6 +45,14 @@ const VariableButton = props => {
40
45
  borderRadius: "16px"
41
46
  }
42
47
  }
48
+ },
49
+ anchorOrigin: {
50
+ vertical: 'bottom',
51
+ horizontal: 'right'
52
+ },
53
+ transformOrigin: {
54
+ vertical: 'top',
55
+ horizontal: 'right'
43
56
  }
44
57
  },
45
58
  children: [/*#__PURE__*/_jsx(MenuItem, {
@@ -11,6 +11,7 @@ import withCommon from "./hooks/withCommon";
11
11
  import { serializeToText } from "./utils/serializeToText";
12
12
  import "./Editor.css";
13
13
  import { EditorProvider } from "./hooks/useMouseMove";
14
+ import { ensureWrappedVariables } from "./helper/ensureWrappedVariables";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
17
  const MiniEditor = props => {
@@ -36,7 +37,8 @@ const MiniEditor = props => {
36
37
  needLayout: false
37
38
  }));
38
39
  const [isInteracted, setIsInteracted] = useState(false);
39
- const [value, setValue] = useState(content);
40
+ const updatedContent = ensureWrappedVariables(content);
41
+ const [value, setValue] = useState(ensureWrappedVariables(updatedContent));
40
42
  const [deboundedValue] = useDebounce(value, 500);
41
43
  const isReadOnly = readOnly === "readonly";
42
44
  const customProps = {
@@ -149,7 +151,7 @@ const MiniEditor = props => {
149
151
  theme: theme,
150
152
  children: /*#__PURE__*/_jsxs(Slate, {
151
153
  editor: editor,
152
- initialValue: content,
154
+ initialValue: updatedContent,
153
155
  onChange: onChange,
154
156
  children: [/*#__PURE__*/_jsx(BasicToolbar, {
155
157
  ...props,
@@ -4,6 +4,7 @@ import TemplateCard from "./TemplateCard";
4
4
  import FullViewCard from "./FullViewCard";
5
5
  import ButtonTemplateCard from "./ButtonTemplatesCard";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { Fragment as _Fragment } from "react/jsx-runtime";
7
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
9
  const CATEGORIES_SORT_INDEX = {
9
10
  Brief: 1,
@@ -46,7 +47,7 @@ const ProgressBar = ({
46
47
  alignItems: "center",
47
48
  margin: 0,
48
49
  padding: 0,
49
- height: "50px",
50
+ height: "300px",
50
51
  overflow: "hidden"
51
52
  },
52
53
  children: /*#__PURE__*/_jsx(CircularProgress, {})
@@ -69,41 +70,49 @@ const AddTemplates = props => {
69
70
  const [categories, setCategories] = useState([]);
70
71
  const [category, setCategory] = useState("");
71
72
  const [templates, setTemplates] = useState([]);
72
- const [filteredTemplates, setFilteredTemplates] = useState([]);
73
73
  useEffect(() => {
74
- getTemplatesList();
74
+ getCategoryList();
75
75
  }, []);
76
- const sortCategory = (a, b) => {
77
- return (CATEGORIES_SORT_INDEX[a] || Infinity) - (CATEGORIES_SORT_INDEX[b] || Infinity);
76
+ const getCategoryList = async () => {
77
+ setLoading(true);
78
+ const categoryDB = await services("listCategory");
79
+ if (categoryDB?.data?.Template?.length > 0) {
80
+ setCategories(categoryDB.data.Template);
81
+ setCategory(categoryDB.data.Template[0]);
82
+ getTemplatesList(categoryDB.data.Template[0]);
83
+ }
84
+ setLoading(false);
78
85
  };
79
- const getTemplatesList = async () => {
86
+ const getTemplatesList = async selectedCategory => {
80
87
  setLoading(true);
81
- const result = await services("listTemplates", {});
82
- const tempList = result?.data?.filter(f => f.type === "Template");
83
- const lic = tempList?.reduce((a, b) => {
84
- if (a.indexOf(b.category) < 0) {
85
- a.push(b.category);
86
- }
87
- return a;
88
- }, []).sort(sortCategory);
89
- const ft = tempList?.filter(f => f.category === lic[0]);
90
- setTemplates(tempList);
91
- setCategories(lic);
92
- setCategory(lic[0]);
93
- setFilteredTemplates(ft);
88
+ const result = await services("listTemplates", {
89
+ category: selectedCategory
90
+ });
91
+ setTemplates(result?.data || []);
94
92
  setLoading(false);
95
93
  };
96
94
  const handleChange = (event, newValue) => {
95
+ setTemplates([]);
97
96
  onSearch("");
98
97
  setCategory(newValue);
99
- setFilteredTemplates(templates.filter(f => f.category === newValue));
98
+ getTemplatesList(newValue);
100
99
  };
101
- const onSelectTemplate = card => () => {
100
+ const onSelectTemplate = card => async () => {
102
101
  try {
103
- editor.insertNode(JSON.parse(card.content));
102
+ const {
103
+ data
104
+ } = await services("templateContent", {
105
+ id: card?.id
106
+ });
107
+ const content = data?.content;
108
+ if (content) {
109
+ editor.insertNode(JSON.parse(content));
110
+ } else {
111
+ console.log("No data found");
112
+ }
104
113
  onClose();
105
114
  } catch (err) {
106
- console.log(err);
115
+ console.log("Error inserting template content into editor:", err);
107
116
  }
108
117
  };
109
118
  const filterByTitle = f => {
@@ -173,16 +182,16 @@ const AddTemplates = props => {
173
182
  data: categories,
174
183
  handleChange: handleChange
175
184
  })
176
- }), /*#__PURE__*/_jsxs(Grid, {
185
+ }), /*#__PURE__*/_jsx(Grid, {
177
186
  container: true,
178
187
  spacing: 0,
179
188
  className: `${fullScreen ? "fullscreen" : ""}`,
180
189
  sx: classes.templateCardsWrpr,
181
- children: [/*#__PURE__*/_jsx(ProgressBar, {
190
+ children: loading ? /*#__PURE__*/_jsx(ProgressBar, {
182
191
  loading: loading
183
- }), filteredTemplates.filter(filterByTitle).map(m => {
184
- return renderTemplate(m);
185
- })]
192
+ }) : /*#__PURE__*/_jsx(_Fragment, {
193
+ children: templates.filter(filterByTitle).map(renderTemplate)
194
+ })
186
195
  })]
187
196
  });
188
197
  };
@@ -51,7 +51,8 @@ const alignmentOptions = [{
51
51
  }];
52
52
  function SelectAlignment({
53
53
  editor,
54
- classes
54
+ classes,
55
+ closeMainPopup
55
56
  }) {
56
57
  const selected = useMemo(() => {
57
58
  return alignmentOptions.find(t => isBlockActive(editor, t.value));
@@ -59,6 +60,7 @@ function SelectAlignment({
59
60
  const onChange = (format, option) => {
60
61
  if (option.type === "block") {
61
62
  toggleBlock(editor, format);
63
+ closeMainPopup();
62
64
  }
63
65
  };
64
66
  return /*#__PURE__*/_jsx(CustomSelectTool, {
@@ -59,7 +59,7 @@ function SelectFontSize({
59
59
  size = value;
60
60
  }
61
61
  });
62
- return parseInt(size);
62
+ return isNaN(parseInt(size)) ? 14 : parseInt(size);
63
63
  } catch (err) {
64
64
  return "";
65
65
  }
@@ -68,7 +68,8 @@ const listOptions = [{
68
68
  }];
69
69
  function SelectList({
70
70
  editor,
71
- classes
71
+ classes,
72
+ closeMainPopup
72
73
  }) {
73
74
  const selectedList = useMemo(() => {
74
75
  return listOptions.find(t => isBlockActive(editor, t.value));
@@ -79,6 +80,7 @@ function SelectList({
79
80
  } else if (option.type === "accordion") {
80
81
  insertAccordion(editor);
81
82
  }
83
+ closeMainPopup();
82
84
  };
83
85
  return /*#__PURE__*/_jsx(CustomSelectTool, {
84
86
  options: listOptions,
@@ -125,7 +125,6 @@ function SelectTypography({
125
125
  ...upData
126
126
  }
127
127
  });
128
- closeMainPopup();
129
128
  };
130
129
  const selectedBlock = useMemo(() => {
131
130
  return typographyOptions.find(t => {
@@ -167,6 +166,7 @@ function SelectTypography({
167
166
  const [sizeInNumber] = size.split("px");
168
167
  updateMarkData(Number(sizeInNumber));
169
168
  }
169
+ closeMainPopup();
170
170
  };
171
171
  return /*#__PURE__*/_jsx(CustomSelectTool, {
172
172
  options: typographyOptions,
@@ -14,6 +14,7 @@ import MiniColorPicker from "./MiniColorPicker";
14
14
  import SelectAlignment from "./SelectAlignment";
15
15
  import SelectFontSize from "./SelectFontSize";
16
16
  import InfinityAITool from "./InfinityAITool";
17
+ import { viewSlateSelection } from "../../../utils/helper";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
20
  const DEFAULT_COLOR = {
@@ -60,13 +61,15 @@ const MiniTextFormat = props => {
60
61
  className: "verticalLine"
61
62
  }), /*#__PURE__*/_jsx(SelectList, {
62
63
  classes: classes,
63
- editor: editor
64
+ editor: editor,
65
+ closeMainPopup: closeMainPopup
64
66
  }), /*#__PURE__*/_jsx("div", {
65
67
  className: "verticalLine mr-1"
66
68
  }), /*#__PURE__*/_jsx(SelectAlignment, {
67
69
  fontAlign: fontAlign,
68
70
  classes: classes,
69
- editor: editor
71
+ editor: editor,
72
+ closeMainPopup: closeMainPopup
70
73
  }), /*#__PURE__*/_jsx("div", {
71
74
  className: "verticalLine mr-1"
72
75
  }), /*#__PURE__*/_jsx(SelectFontSize, {
@@ -98,7 +101,10 @@ const MiniTextFormat = props => {
98
101
  editor: editor,
99
102
  customProps: customProps
100
103
  }, link.id), /*#__PURE__*/_jsx(IconButton, {
101
- onClick: e => setAnchorEl(document.getElementById("mini-text-editor-wrapper")),
104
+ onClick: e => {
105
+ viewSlateSelection();
106
+ setAnchorEl(document.getElementById("mini-text-editor-wrapper"));
107
+ },
102
108
  className: `textSettingsIcon ${open ? "btnActive" : ""}`,
103
109
  children: /*#__PURE__*/_jsx(TextToolIcon, {})
104
110
  }), /*#__PURE__*/_jsx(Popper, {
@@ -416,6 +416,11 @@ const usePopupStyle = theme => ({
416
416
  "& .MuiOutlinedInput-notchedOutline": {
417
417
  border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`
418
418
  },
419
+ '& .MuiInputBase-root': {
420
+ '& input': {
421
+ border: "none !important"
422
+ }
423
+ },
419
424
  "& svg": {
420
425
  width: "20px",
421
426
  height: "24px"
@@ -47,7 +47,7 @@ const TemplateCard = props => {
47
47
  }), /*#__PURE__*/_jsx(CardMedia, {
48
48
  className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
49
49
  component: "div",
50
- image: m?.thumbnail,
50
+ image: m?.compressedThum || m?.thumbnail,
51
51
  alt: m?.title,
52
52
  sx: classes.templateCardMedia
53
53
  }), /*#__PURE__*/_jsx(PreviewAndSelect, {
@@ -14,6 +14,8 @@ import SelectSuperSubscript from "./MiniTextFormat/SelectSuperSubscript";
14
14
  import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
15
15
  import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
16
16
  import { useEditorContext } from "../../hooks/useMouseMove";
17
+ import LineSpacing from "../../common/StyleBuilder/fieldTypes/lineSpacing";
18
+ import { getPageSettings } from "../../utils/pageSettings";
17
19
  import { jsx as _jsx } from "react/jsx-runtime";
18
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
21
  const allTools = toolbarGroups.flat();
@@ -31,10 +33,18 @@ const TextFormat = props => {
31
33
  const [anchorEl, setAnchorEl] = useState(null);
32
34
  const [type, setType] = useState(null);
33
35
  const open = Boolean(anchorEl);
36
+ const {
37
+ element: pageSt
38
+ } = getPageSettings(editor) || {};
39
+ const pageSettingLine = pageSt?.pageProps?.lineHeight;
34
40
  const {
35
41
  fontFamilies,
36
42
  theme
37
43
  } = useEditorContext();
44
+ const {
45
+ activeBreakPoint
46
+ } = useEditorContext();
47
+ const breakpoint = activeBreakPoint === "" ? "lg" : activeBreakPoint;
38
48
  const fontWeight = allTools.find(f => f.format === "fontWeight");
39
49
  const fontStyle = allTools.filter(f => f.type === "mark" && f.format !== "strikethrough" && f.format !== "superscript" && f.format !== "subscript");
40
50
  const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
@@ -51,6 +61,8 @@ const TextFormat = props => {
51
61
  color: "",
52
62
  bgColor: ""
53
63
  };
64
+ let lineSpacingValue = activeMark(editor, 'lineHeight');
65
+ lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
54
66
  const handleColorPicker = type => e => {
55
67
  setType(type);
56
68
  setAnchorEl(e.currentTarget);
@@ -91,6 +103,13 @@ const TextFormat = props => {
91
103
  value
92
104
  });
93
105
  };
106
+ const handleLineSpacing = data => {
107
+ const [[format, value]] = Object.entries(data);
108
+ addMarkData(editor, {
109
+ format,
110
+ value
111
+ });
112
+ };
94
113
  return /*#__PURE__*/_jsxs(Grid, {
95
114
  container: true,
96
115
  sx: classes.textFormatWrapper,
@@ -360,6 +379,32 @@ const TextFormat = props => {
360
379
  xs: 12,
361
380
  sx: classes.dividerGrid,
362
381
  children: /*#__PURE__*/_jsx(Divider, {})
382
+ }), /*#__PURE__*/_jsxs(Grid, {
383
+ item: true,
384
+ xs: 12,
385
+ children: [/*#__PURE__*/_jsx(Typography, {
386
+ variant: "body1",
387
+ color: "primary",
388
+ sx: classes.typoLabel,
389
+ children: "Line Spacing"
390
+ }), /*#__PURE__*/_jsx(Grid, {
391
+ item: true,
392
+ xs: 12,
393
+ className: "typo-icons",
394
+ sx: classes.evenSpace,
395
+ children: /*#__PURE__*/_jsx(LineSpacing, {
396
+ value: lineSpacingValue,
397
+ onChange: handleLineSpacing,
398
+ data: {
399
+ key: 'lineHeight'
400
+ }
401
+ })
402
+ })]
403
+ }), /*#__PURE__*/_jsx(Grid, {
404
+ item: true,
405
+ xs: 12,
406
+ sx: classes.dividerGrid,
407
+ children: /*#__PURE__*/_jsx(Divider, {})
363
408
  }), /*#__PURE__*/_jsx(Grid, {
364
409
  item: true,
365
410
  xs: 12,
@@ -9,6 +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
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const PopupTool = props => {
14
15
  const {
@@ -86,6 +87,7 @@ const PopupTool = props => {
86
87
  setAnchorEl(null);
87
88
  } else {
88
89
  updateAnchorEl();
90
+ hideSlateSelection(); // removes slate selection background, when there is no selection
89
91
  }
90
92
  }, [selection, event, selectedElement?.enable]);
91
93
  const handleClose = () => {
@@ -1,11 +1,3 @@
1
- export const defaultFonts = [
2
- // "EB Garamond",
3
- "Anton", "DM Serif Text", "Libre Baskerville", "Montserrat", "Open Sans", "Public Sans", "Raleway", "Space Mono", "Great Vibes", "Zeyada", "Allura", "Pinyon Script", "Dancing Script", "Gaegu", "Kite One", "Merriweather"];
4
- export const otherFonts = ["PoppinsRegular", "PoppinsBold", "Monaco", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door", "Helvetica", "Georgia", "Times New Roman", "Courier New", "Impact"];
5
- export const googleFontList = ["Roboto", "Noto Sans JP", "Poppins", "Lato", "Inter", "Roboto Condensed", "Roboto Mono", "Oswald", "Noto Sans", "Nunito", "Nunito Sans", "Ubuntu", "Rubik", "Playfair Display", "Noto Sans KR", "Roboto Slab", "PT Sans", "Kanit", "Work Sans", "Lora", "DM Sans", "Mulish", "Quicksand", "Fira Sans", "Noto Sans TC", "Inconsolata", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Karla", "Titillium Web", "Heebo", "Noto Serif", "Nanum Gothic", "Noto Color Emoji", "Agdasima", "Bebas Neue", "Libre Franklin", "Mukta", "Outfit", "Josefin Sans", "Source Code Pro", "Jost", "Space Grotesk", "Hind Siliguri", "Arimo", "Cabin", "Barlow Condensed", "Dosis", "Fira Sans Condensed", "Bitter", "Archivo", "Figtree", "Noto Serif JP", "PT Sans Narrow", "Abel", "Noto Sans SC",
6
- // "Source Sans 3",
7
- "Hind",
8
- // "Exo 2",
9
- "Teko", "Oxygen", "Cairo", "Crimson Text", "Plus Jakarta Sans", "Overpass", "Pacifico", "Prompt", "Red Hat Display", "Varela Round", "Cormorant Garamond", "Assistant", "Comfortaa", "Lexend", "Signika Negative",
10
- // "M PLUS Rounded 1c",
11
- "Fjalla One", "Caveat", "IBM Plex Mono", "Arvo", "Lobster", "Schibsted Grotesk", "Chakra Petch", "Maven Pro", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", 'Titillium Web', ...defaultFonts];
1
+ const otherFonts = ["PoppinsRegular", "PoppinsBold", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door"];
2
+ const mostUsedGoogleFonts = ["Roboto", "Poppins", "Lato", "Inter", "Nunito", "Ubuntu", "Oswald", "Rubik", "Roboto Slab", "PT Sans", "Work Sans", "Lora", "Mulish", "DM Sans", "Fira Sans", "Quicksand", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Libre Franklin", "Bebas Neue", "Cabin", "Titillium Web", "Heebo", "Noto Serif", "Jost", "Source Code Pro", "Josefin Sans", "Dosis", "Fira Sans Condensed", "Archivo", "Noto Serif JP", "Crimson Text", "Cairo", "Pacifico", "Red Hat Display", "Assistant", "Comfortaa", "Lexend", "Fjalla One", "Caveat", "Arvo", "Lobster", "Schibsted Grotesk", "EB Garamond", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", "Plus Jakarta Sans"];
3
+ export const googleFontList = [...mostUsedGoogleFonts, ...otherFonts];