@flozy/editor 5.7.4 → 5.7.6
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 +1 -1
- package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +24 -25
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
- package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
- package/dist/Editor/common/FontLoader/FontLoader.js +2 -2
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +0 -1
- package/dist/Editor/commonStyle.js +4 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +2 -3
- package/dist/Editor/utils/helper.js +18 -0
- package/package.json +1 -1
@@ -543,7 +543,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
543
543
|
transition: "all 0.3s",
|
544
544
|
minHeight: "87%",
|
545
545
|
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto",
|
546
|
-
paddingTop: hasTopBanner() ?
|
546
|
+
paddingTop: hasTopBanner() ? "20px !important" : isMobile ? "10px !important" : ""
|
547
547
|
},
|
548
548
|
"data-info": outsideEditorClickLabel,
|
549
549
|
children: [/*#__PURE__*/_jsx(Editable, {
|
@@ -6,7 +6,7 @@ import AIInput from "./AIInput";
|
|
6
6
|
import { ReactEditor, useSlate } from "slate-react";
|
7
7
|
import { Node, Range, Transforms } from "slate";
|
8
8
|
import { MODES } from "./helper";
|
9
|
-
import { getSelectedText, getSlateDom } from "../../utils/helper";
|
9
|
+
import { getSelectedText, getSlateDom, viewSlateSelection } from "../../utils/helper";
|
10
10
|
import { VoiceToText } from "./VoiceToText";
|
11
11
|
import deserialize from "../../helper/deserialize";
|
12
12
|
import useEditorScroll from "../../hooks/useEditorScroll";
|
@@ -286,17 +286,7 @@ function PopoverAIInput({
|
|
286
286
|
};
|
287
287
|
useEffect(() => {
|
288
288
|
if (openAI && getSelectedText(editor).trim()) {
|
289
|
-
|
290
|
-
const selectionBg = "rgba(35, 131, 226, 0.35)";
|
291
|
-
if (customSelection?.length) {
|
292
|
-
customSelection?.forEach(el => el.style.background = selectionBg);
|
293
|
-
|
294
|
-
// if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
|
295
|
-
const selection = window.getSelection();
|
296
|
-
if (selection) {
|
297
|
-
selection.removeAllRanges(); // Clears the selection
|
298
|
-
}
|
299
|
-
}
|
289
|
+
viewSlateSelection();
|
300
290
|
}
|
301
291
|
}, [editor.selection, openAI]);
|
302
292
|
return /*#__PURE__*/_jsxs("div", {
|
@@ -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: "
|
50
|
+
height: "300px",
|
50
51
|
overflow: "hidden"
|
51
52
|
},
|
52
53
|
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
@@ -69,34 +70,32 @@ 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
|
-
|
74
|
+
getCategoryList();
|
75
75
|
}, []);
|
76
|
-
const
|
77
|
-
|
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
|
-
|
83
|
-
|
84
|
-
|
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
|
-
|
98
|
+
getTemplatesList(newValue);
|
100
99
|
};
|
101
100
|
const onSelectTemplate = card => async () => {
|
102
101
|
try {
|
@@ -183,16 +182,16 @@ const AddTemplates = props => {
|
|
183
182
|
data: categories,
|
184
183
|
handleChange: handleChange
|
185
184
|
})
|
186
|
-
}), /*#__PURE__*/
|
185
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
187
186
|
container: true,
|
188
187
|
spacing: 0,
|
189
188
|
className: `${fullScreen ? "fullscreen" : ""}`,
|
190
189
|
sx: classes.templateCardsWrpr,
|
191
|
-
children:
|
190
|
+
children: loading ? /*#__PURE__*/_jsx(ProgressBar, {
|
192
191
|
loading: loading
|
193
|
-
})
|
194
|
-
|
195
|
-
})
|
192
|
+
}) : /*#__PURE__*/_jsx(_Fragment, {
|
193
|
+
children: templates.filter(filterByTitle).map(renderTemplate)
|
194
|
+
})
|
196
195
|
})]
|
197
196
|
});
|
198
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, {
|
@@ -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 =>
|
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, {
|
@@ -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 {
|
@@ -83,6 +84,7 @@ const PopupTool = props => {
|
|
83
84
|
setAnchorEl(null);
|
84
85
|
} else {
|
85
86
|
updateAnchorEl();
|
87
|
+
hideSlateSelection(); // removes slate selection background, when there is no selection
|
86
88
|
}
|
87
89
|
}, [selection]);
|
88
90
|
useEffect(() => {
|
@@ -75,7 +75,7 @@ const FontLoader = props => {
|
|
75
75
|
}).catch(err => {
|
76
76
|
// console.log(err);
|
77
77
|
});
|
78
|
-
setLoading(true);
|
78
|
+
// setLoading(true);
|
79
79
|
} else {
|
80
80
|
function correctFontArray(fontString) {
|
81
81
|
let fontsArray = fontString.split(",");
|
@@ -97,7 +97,7 @@ const FontLoader = props => {
|
|
97
97
|
families = families?.map(font => font?.replace(/\"/g, ""));
|
98
98
|
families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
|
99
99
|
families = families.filter(font => googleFontList.includes(font));
|
100
|
-
setLoading(true);
|
100
|
+
// setLoading(true);
|
101
101
|
loadFontsInBatches(families);
|
102
102
|
}
|
103
103
|
}, []);
|
@@ -147,7 +147,6 @@ export function onDropItem(props, parentClass) {
|
|
147
147
|
newPath = moveTo;
|
148
148
|
const appenBp = breakpoint === "lg" ? "" : `_${breakpoint}`;
|
149
149
|
const cCalx = isContainerElement(editor, moveTo, props, appenBp);
|
150
|
-
|
151
150
|
// const posX = parseInt(
|
152
151
|
// cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX
|
153
152
|
// );
|
@@ -59,6 +59,10 @@ const useCommonStyle = theme => ({
|
|
59
59
|
marginBottom: "7px",
|
60
60
|
marginTop: "4px"
|
61
61
|
},
|
62
|
+
"& p": {
|
63
|
+
marginBottom: "7px",
|
64
|
+
marginTop: "4px"
|
65
|
+
},
|
62
66
|
"& .muiIconsListParent": {
|
63
67
|
"& svg": {
|
64
68
|
color: `${theme?.palette?.editor?.svgTextAlignStrokeColor} !important`
|
@@ -173,10 +173,9 @@ export const getMarked = (leaf, children, theme) => {
|
|
173
173
|
if (leaf.highlight) {
|
174
174
|
children = /*#__PURE__*/_jsx("span", {
|
175
175
|
style: {
|
176
|
-
color: "inherit"
|
176
|
+
color: "inherit",
|
177
|
+
background: "var(--slate-highlight-bg)"
|
177
178
|
},
|
178
|
-
className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
|
179
|
-
,
|
180
179
|
children: children
|
181
180
|
});
|
182
181
|
}
|
@@ -738,4 +738,22 @@ export const focusDynamicTableInput = e => {
|
|
738
738
|
}
|
739
739
|
}
|
740
740
|
}, 0);
|
741
|
+
};
|
742
|
+
export const clearWindowSelection = () => {
|
743
|
+
const selection = window.getSelection();
|
744
|
+
if (selection) {
|
745
|
+
selection.removeAllRanges(); // Clears the selection
|
746
|
+
}
|
747
|
+
};
|
748
|
+
|
749
|
+
export const viewSlateSelection = () => {
|
750
|
+
// if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
|
751
|
+
clearWindowSelection();
|
752
|
+
const selectionBg = "rgba(35, 131, 226, 0.35)";
|
753
|
+
const root = document.documentElement;
|
754
|
+
root.style.setProperty("--slate-highlight-bg", selectionBg);
|
755
|
+
};
|
756
|
+
export const hideSlateSelection = () => {
|
757
|
+
const root = document.documentElement;
|
758
|
+
root.style.setProperty("--slate-highlight-bg", "none");
|
741
759
|
};
|