@flozy/editor 7.0.6 → 7.0.7
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.
- package/dist/Editor/CommonEditor.js +19 -19
- package/dist/Editor/Editor.css +3 -4
- package/dist/Editor/Elements/AI/PopoverAIInput.js +12 -2
- package/dist/Editor/Elements/Button/EditorButton.js +0 -1
- package/dist/Editor/Elements/DataView/DataView.js +3 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +1 -5
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +1 -5
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +19 -23
- package/dist/Editor/Elements/Form/Form.js +0 -1
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -1
- package/dist/Editor/Elements/List/CheckList.js +1 -2
- package/dist/Editor/Elements/Search/SearchAttachment.js +0 -1
- package/dist/Editor/Elements/Search/SearchList.js +1 -8
- package/dist/Editor/Elements/SimpleText/index.js +7 -19
- package/dist/Editor/Elements/SimpleText/style.js +1 -5
- package/dist/Editor/Elements/Table/Table.js +15 -15
- package/dist/Editor/Elements/Table/TableCell.js +9 -14
- package/dist/Editor/MiniEditor.js +2 -4
- package/dist/Editor/Styles/EditorStyles.js +287 -291
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +28 -37
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +1 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +1 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +8 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -9
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +0 -45
- package/dist/Editor/Toolbar/PopupTool/index.js +32 -57
- package/dist/Editor/common/FontLoader/FontList.js +11 -11
- package/dist/Editor/common/FontLoader/FontLoader.js +75 -45
- package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
- package/dist/Editor/common/ImageSelector/UploadStyles.js +1 -2
- package/dist/Editor/common/MentionsPopup/index.js +1 -0
- package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +0 -6
- package/dist/Editor/common/Section/index.js +60 -89
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
- package/dist/Editor/commonStyle.js +0 -5
- package/dist/Editor/helper/deserialize/index.js +1 -1
- package/dist/Editor/helper/theme.js +1 -24
- package/dist/Editor/hooks/useDrag.js +17 -11
- package/dist/Editor/hooks/useEditorScroll.js +1 -2
- package/dist/Editor/hooks/useMouseMove.js +4 -6
- package/dist/Editor/plugins/withHTML.js +1 -7
- package/dist/Editor/utils/SlateUtilityFunctions.js +12 -23
- package/dist/Editor/utils/customHooks/useTableResize.js +1 -2
- package/dist/Editor/utils/helper.js +0 -41
- package/dist/Editor/utils/pageSettings.js +2 -14
- package/dist/Editor/utils/table.js +0 -21
- package/package.json +3 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
- package/dist/Editor/helper/ensureWrappedVariables.js +0 -28
@@ -4,7 +4,6 @@ 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";
|
8
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
8
|
const CATEGORIES_SORT_INDEX = {
|
10
9
|
Brief: 1,
|
@@ -47,7 +46,7 @@ const ProgressBar = ({
|
|
47
46
|
alignItems: "center",
|
48
47
|
margin: 0,
|
49
48
|
padding: 0,
|
50
|
-
height: "
|
49
|
+
height: "50px",
|
51
50
|
overflow: "hidden"
|
52
51
|
},
|
53
52
|
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
@@ -70,49 +69,41 @@ const AddTemplates = props => {
|
|
70
69
|
const [categories, setCategories] = useState([]);
|
71
70
|
const [category, setCategory] = useState("");
|
72
71
|
const [templates, setTemplates] = useState([]);
|
72
|
+
const [filteredTemplates, setFilteredTemplates] = useState([]);
|
73
73
|
useEffect(() => {
|
74
|
-
|
74
|
+
getTemplatesList();
|
75
75
|
}, []);
|
76
|
-
const
|
77
|
-
|
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);
|
76
|
+
const sortCategory = (a, b) => {
|
77
|
+
return (CATEGORIES_SORT_INDEX[a] || Infinity) - (CATEGORIES_SORT_INDEX[b] || Infinity);
|
85
78
|
};
|
86
|
-
const getTemplatesList = async
|
79
|
+
const getTemplatesList = async () => {
|
87
80
|
setLoading(true);
|
88
|
-
const result = await services("listTemplates", {
|
89
|
-
|
90
|
-
|
91
|
-
|
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);
|
92
94
|
setLoading(false);
|
93
95
|
};
|
94
96
|
const handleChange = (event, newValue) => {
|
95
|
-
setTemplates([]);
|
96
97
|
onSearch("");
|
97
98
|
setCategory(newValue);
|
98
|
-
|
99
|
+
setFilteredTemplates(templates.filter(f => f.category === newValue));
|
99
100
|
};
|
100
|
-
const onSelectTemplate = card =>
|
101
|
+
const onSelectTemplate = card => () => {
|
101
102
|
try {
|
102
|
-
|
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
|
-
}
|
103
|
+
editor.insertNode(JSON.parse(card.content));
|
113
104
|
onClose();
|
114
105
|
} catch (err) {
|
115
|
-
console.log(
|
106
|
+
console.log(err);
|
116
107
|
}
|
117
108
|
};
|
118
109
|
const filterByTitle = f => {
|
@@ -182,16 +173,16 @@ const AddTemplates = props => {
|
|
182
173
|
data: categories,
|
183
174
|
handleChange: handleChange
|
184
175
|
})
|
185
|
-
}), /*#__PURE__*/
|
176
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
186
177
|
container: true,
|
187
178
|
spacing: 0,
|
188
179
|
className: `${fullScreen ? "fullscreen" : ""}`,
|
189
180
|
sx: classes.templateCardsWrpr,
|
190
|
-
children:
|
181
|
+
children: [/*#__PURE__*/_jsx(ProgressBar, {
|
191
182
|
loading: loading
|
192
|
-
})
|
193
|
-
|
194
|
-
})
|
183
|
+
}), filteredTemplates.filter(filterByTitle).map(m => {
|
184
|
+
return renderTemplate(m);
|
185
|
+
})]
|
195
186
|
})]
|
196
187
|
});
|
197
188
|
};
|
@@ -51,8 +51,7 @@ const alignmentOptions = [{
|
|
51
51
|
}];
|
52
52
|
function SelectAlignment({
|
53
53
|
editor,
|
54
|
-
classes
|
55
|
-
closeMainPopup
|
54
|
+
classes
|
56
55
|
}) {
|
57
56
|
const selected = useMemo(() => {
|
58
57
|
return alignmentOptions.find(t => isBlockActive(editor, t.value));
|
@@ -60,7 +59,6 @@ function SelectAlignment({
|
|
60
59
|
const onChange = (format, option) => {
|
61
60
|
if (option.type === "block") {
|
62
61
|
toggleBlock(editor, format);
|
63
|
-
closeMainPopup();
|
64
62
|
}
|
65
63
|
};
|
66
64
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
@@ -68,8 +68,7 @@ const listOptions = [{
|
|
68
68
|
}];
|
69
69
|
function SelectList({
|
70
70
|
editor,
|
71
|
-
classes
|
72
|
-
closeMainPopup
|
71
|
+
classes
|
73
72
|
}) {
|
74
73
|
const selectedList = useMemo(() => {
|
75
74
|
return listOptions.find(t => isBlockActive(editor, t.value));
|
@@ -80,7 +79,6 @@ function SelectList({
|
|
80
79
|
} else if (option.type === "accordion") {
|
81
80
|
insertAccordion(editor);
|
82
81
|
}
|
83
|
-
closeMainPopup();
|
84
82
|
};
|
85
83
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
86
84
|
options: listOptions,
|
@@ -125,6 +125,7 @@ function SelectTypography({
|
|
125
125
|
...upData
|
126
126
|
}
|
127
127
|
});
|
128
|
+
closeMainPopup();
|
128
129
|
};
|
129
130
|
const selectedBlock = useMemo(() => {
|
130
131
|
return typographyOptions.find(t => {
|
@@ -151,17 +152,21 @@ function SelectTypography({
|
|
151
152
|
toggleBlock(editor, format);
|
152
153
|
if (option.type === "block") {
|
153
154
|
// reset old font size
|
154
|
-
|
155
|
+
let updatedValue = !selectedBlock ? {} : {
|
156
|
+
xs: "16px",
|
157
|
+
sm: "16px",
|
158
|
+
md: "16px",
|
159
|
+
lg: "16px"
|
160
|
+
};
|
155
161
|
addMarkData(editor, {
|
156
162
|
format: "fontSize",
|
157
|
-
value:
|
163
|
+
value: updatedValue
|
158
164
|
});
|
159
165
|
} else if (option.type === "mark") {
|
160
166
|
const size = sizeMap[option.value] || "";
|
161
167
|
const [sizeInNumber] = size.split("px");
|
162
168
|
updateMarkData(Number(sizeInNumber));
|
163
169
|
}
|
164
|
-
closeMainPopup();
|
165
170
|
};
|
166
171
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
167
172
|
options: typographyOptions,
|
@@ -14,7 +14,6 @@ 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";
|
18
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
19
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
20
19
|
const DEFAULT_COLOR = {
|
@@ -61,15 +60,13 @@ const MiniTextFormat = props => {
|
|
61
60
|
className: "verticalLine"
|
62
61
|
}), /*#__PURE__*/_jsx(SelectList, {
|
63
62
|
classes: classes,
|
64
|
-
editor: editor
|
65
|
-
closeMainPopup: closeMainPopup
|
63
|
+
editor: editor
|
66
64
|
}), /*#__PURE__*/_jsx("div", {
|
67
65
|
className: "verticalLine mr-1"
|
68
66
|
}), /*#__PURE__*/_jsx(SelectAlignment, {
|
69
67
|
fontAlign: fontAlign,
|
70
68
|
classes: classes,
|
71
|
-
editor: editor
|
72
|
-
closeMainPopup: closeMainPopup
|
69
|
+
editor: editor
|
73
70
|
}), /*#__PURE__*/_jsx("div", {
|
74
71
|
className: "verticalLine mr-1"
|
75
72
|
}), /*#__PURE__*/_jsx(SelectFontSize, {
|
@@ -101,10 +98,7 @@ const MiniTextFormat = props => {
|
|
101
98
|
editor: editor,
|
102
99
|
customProps: customProps
|
103
100
|
}, link.id), /*#__PURE__*/_jsx(IconButton, {
|
104
|
-
onClick: e =>
|
105
|
-
viewSlateSelection();
|
106
|
-
setAnchorEl(document.getElementById("mini-text-editor-wrapper"));
|
107
|
-
},
|
101
|
+
onClick: e => setAnchorEl(document.getElementById("mini-text-editor-wrapper")),
|
108
102
|
className: `textSettingsIcon ${open ? "btnActive" : ""}`,
|
109
103
|
children: /*#__PURE__*/_jsx(TextToolIcon, {})
|
110
104
|
}), /*#__PURE__*/_jsx(Popper, {
|
@@ -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?.
|
50
|
+
image: m?.thumbnail,
|
51
51
|
alt: m?.title,
|
52
52
|
sx: classes.templateCardMedia
|
53
53
|
}), /*#__PURE__*/_jsx(PreviewAndSelect, {
|
@@ -14,8 +14,6 @@ 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";
|
19
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
20
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
21
19
|
const allTools = toolbarGroups.flat();
|
@@ -33,18 +31,10 @@ const TextFormat = props => {
|
|
33
31
|
const [anchorEl, setAnchorEl] = useState(null);
|
34
32
|
const [type, setType] = useState(null);
|
35
33
|
const open = Boolean(anchorEl);
|
36
|
-
const {
|
37
|
-
element: pageSt
|
38
|
-
} = getPageSettings(editor) || {};
|
39
|
-
const pageSettingLine = pageSt?.pageProps?.lineHeight;
|
40
34
|
const {
|
41
35
|
fontFamilies,
|
42
36
|
theme
|
43
37
|
} = useEditorContext();
|
44
|
-
const {
|
45
|
-
activeBreakPoint
|
46
|
-
} = useEditorContext();
|
47
|
-
const breakpoint = activeBreakPoint === "" ? "lg" : activeBreakPoint;
|
48
38
|
const fontWeight = allTools.find(f => f.format === "fontWeight");
|
49
39
|
const fontStyle = allTools.filter(f => f.type === "mark" && f.format !== "strikethrough" && f.format !== "superscript" && f.format !== "subscript");
|
50
40
|
const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
|
@@ -61,8 +51,6 @@ const TextFormat = props => {
|
|
61
51
|
color: "",
|
62
52
|
bgColor: ""
|
63
53
|
};
|
64
|
-
let lineSpacingValue = activeMark(editor, 'lineHeight');
|
65
|
-
lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
|
66
54
|
const handleColorPicker = type => e => {
|
67
55
|
setType(type);
|
68
56
|
setAnchorEl(e.currentTarget);
|
@@ -103,13 +91,6 @@ const TextFormat = props => {
|
|
103
91
|
value
|
104
92
|
});
|
105
93
|
};
|
106
|
-
const handleLineSpacing = data => {
|
107
|
-
const [[format, value]] = Object.entries(data);
|
108
|
-
addMarkData(editor, {
|
109
|
-
format,
|
110
|
-
value
|
111
|
-
});
|
112
|
-
};
|
113
94
|
return /*#__PURE__*/_jsxs(Grid, {
|
114
95
|
container: true,
|
115
96
|
sx: classes.textFormatWrapper,
|
@@ -379,32 +360,6 @@ const TextFormat = props => {
|
|
379
360
|
xs: 12,
|
380
361
|
sx: classes.dividerGrid,
|
381
362
|
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, {})
|
408
363
|
}), /*#__PURE__*/_jsx(Grid, {
|
409
364
|
item: true,
|
410
365
|
xs: 12,
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import React, {
|
2
|
-
import { Popper,
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
import { Popper, Paper, ClickAwayListener } from "@mui/material";
|
3
3
|
import { Editor, Range, Transforms } from "slate";
|
4
4
|
import { ReactEditor, useSlate } from "slate-react";
|
5
5
|
import useDrag from "../../hooks/useDrag";
|
@@ -9,18 +9,19 @@ 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";
|
13
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
14
13
|
const PopupTool = props => {
|
15
14
|
const {
|
16
15
|
theme,
|
16
|
+
setIsTextSelected,
|
17
17
|
customProps,
|
18
18
|
editorWrapper
|
19
19
|
} = props;
|
20
20
|
const classes = usePopupStyles(theme);
|
21
21
|
const {
|
22
22
|
setPopupType,
|
23
|
-
openAI
|
23
|
+
openAI,
|
24
|
+
selectedElement
|
24
25
|
} = useEditorContext();
|
25
26
|
const [anchorEl, setAnchorEl] = useState(null);
|
26
27
|
const [open, setOpen] = useState(false);
|
@@ -31,18 +32,10 @@ const PopupTool = props => {
|
|
31
32
|
const [event] = useDrag(anchorEl);
|
32
33
|
const id = open ? "popup-edit-tool" : "";
|
33
34
|
const [size] = useWindowResize();
|
34
|
-
const {
|
35
|
-
selectedElement
|
36
|
-
} = useEditorContext();
|
37
|
-
console.log("Editor debug ====>", event, open, anchorEl, selection);
|
38
|
-
const updateAnchorEl = useCallback(() => {
|
35
|
+
const updateAnchorEl = isScroll => {
|
39
36
|
try {
|
40
|
-
const {
|
41
|
-
selection
|
42
|
-
} = editor;
|
43
37
|
const isHavingSelection = selection && !Range.isCollapsed(selection);
|
44
|
-
|
45
|
-
if (isHavingSelection) {
|
38
|
+
if (isHavingSelection && event === "end") {
|
46
39
|
const domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
47
40
|
const editorContainer = document.querySelector("#slate-wrapper-scroll-container")?.getBoundingClientRect();
|
48
41
|
const rect = domRange.getBoundingClientRect();
|
@@ -51,17 +44,21 @@ const PopupTool = props => {
|
|
51
44
|
rect.y = -500; // hide the popper
|
52
45
|
}
|
53
46
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
47
|
+
// Create a dummy anchor element to match Popper's requirements
|
48
|
+
const anchor = document.createElement("div");
|
49
|
+
anchor.style.position = "absolute";
|
50
|
+
anchor.style.top = `${rect.top + window.scrollY}px`;
|
51
|
+
anchor.style.left = `${rect.left + window.scrollX}px`;
|
52
|
+
document.body.appendChild(anchor);
|
53
|
+
if (!anchorEl || isScroll === "scroll") {
|
54
|
+
setAnchorEl(anchor);
|
55
|
+
setOpen(true);
|
56
|
+
}
|
60
57
|
}
|
61
58
|
} catch (err) {
|
62
59
|
console.log(err);
|
63
60
|
}
|
64
|
-
}
|
61
|
+
};
|
65
62
|
useEditorScroll(editorWrapper, updateAnchorEl);
|
66
63
|
useEffect(() => {
|
67
64
|
const userStoppedSelection = size?.device === "xs" ? true : event === "end"; // for mobile, when user starts the selection, we are gonna show the popup tool
|
@@ -76,44 +73,28 @@ const PopupTool = props => {
|
|
76
73
|
if (!isCarouselEdit) {
|
77
74
|
setOpen(true);
|
78
75
|
setPopupType("textFormat");
|
79
|
-
|
76
|
+
setIsTextSelected(true);
|
80
77
|
}
|
81
78
|
} else if (!anchorEl) {
|
82
79
|
setOpen(false);
|
83
80
|
setPopupType("");
|
84
|
-
|
81
|
+
setIsTextSelected(false);
|
85
82
|
}
|
86
83
|
}, [event, anchorEl]);
|
87
84
|
useEffect(() => {
|
88
|
-
|
89
|
-
if (!selection || Range.isCollapsed(selection) || Editor.string(editor, selection) === "") {
|
85
|
+
if (!selection || Range.isCollapsed(selection) || Editor.string(editor, selection) === "" || selectedElement?.enable === 1) {
|
90
86
|
setAnchorEl(null);
|
91
87
|
} else {
|
92
|
-
console.log("Editor updateAnchorEl", selection);
|
93
88
|
updateAnchorEl();
|
94
|
-
hideSlateSelection(); // removes slate selection background, when there is no selection
|
95
|
-
}
|
96
|
-
}, [editor?.selection]);
|
97
|
-
useEffect(() => {
|
98
|
-
const {
|
99
|
-
path,
|
100
|
-
enable
|
101
|
-
} = selectedElement || {};
|
102
|
-
const isFreeGridElement = path && path.split("|").length > 2;
|
103
|
-
if (enable === 1 && isFreeGridElement) {
|
104
|
-
console.log("Editor useEffect isFreeGridElement", selectedElement);
|
105
|
-
setAnchorEl(null);
|
106
89
|
}
|
107
|
-
}, [selection,
|
90
|
+
}, [selection, event, selectedElement?.enable]);
|
108
91
|
const handleClose = () => {
|
109
|
-
console.log("Editor closing");
|
110
92
|
// setAnchorEl(null);
|
111
93
|
setOpen(false);
|
112
94
|
setPopupType("");
|
113
95
|
};
|
114
96
|
return open && !openAI ? /*#__PURE__*/_jsx(ClickAwayListener, {
|
115
97
|
onClickAway: e => {
|
116
|
-
console.log("ClickAwayListener", e.target, document.body, e.target !== document.body);
|
117
98
|
// close the mini toolbar, if user clicks outside the editor (in Flozy app.)
|
118
99
|
if (e.target !== document.body) {
|
119
100
|
// e.target returns body, if the user clicks material ui select popup inside the tool bar, on that time, we don't need to close
|
@@ -132,24 +113,18 @@ const PopupTool = props => {
|
|
132
113
|
id: id,
|
133
114
|
open: open,
|
134
115
|
anchorEl: anchorEl,
|
135
|
-
transition: true,
|
136
116
|
sx: classes.popupWrapper,
|
137
117
|
placement: "top-start",
|
138
|
-
children: ({
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
editor: editor,
|
149
|
-
classes: classes,
|
150
|
-
closeMainPopup: handleClose,
|
151
|
-
customProps: customProps
|
152
|
-
})
|
118
|
+
children: /*#__PURE__*/_jsx(Paper, {
|
119
|
+
style: {
|
120
|
+
borderRadius: "6px",
|
121
|
+
border: "1px solid #8360FD"
|
122
|
+
},
|
123
|
+
children: /*#__PURE__*/_jsx(MiniTextFormat, {
|
124
|
+
editor: editor,
|
125
|
+
classes: classes,
|
126
|
+
closeMainPopup: handleClose,
|
127
|
+
customProps: customProps
|
153
128
|
})
|
154
129
|
})
|
155
130
|
})
|
@@ -1,11 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
export const
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
+
const systemFonts = ["Monaco", "Helvetica", "Georgia", "Times New Roman", "Courier New", "Impact"];
|
4
|
+
export const googleFontList = [...mostUsedGoogleFonts, ...otherFonts];
|
5
|
+
const fontList = [...mostUsedGoogleFonts, ...otherFonts, ...systemFonts];
|
6
|
+
export const defaultFontFamilies = {
|
7
|
+
id: 1,
|
8
|
+
format: "fontFamily",
|
9
|
+
type: "fontfamilydropdown",
|
10
|
+
options: fontList || []
|
11
|
+
};
|