@flozy/editor 5.8.3 → 5.8.5
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/ChatEditor.js +3 -6
- package/dist/Editor/CommonEditor.js +6 -11
- package/dist/Editor/Editor.css +15 -23
- package/dist/Editor/Elements/AI/PopoverAIInput.js +12 -2
- package/dist/Editor/Elements/Button/EditorButton.js +1 -3
- 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 +1 -8
- package/dist/Editor/Elements/SimpleText/style.js +1 -5
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Table/TableCell.js +9 -14
- package/dist/Editor/Elements/Title/title.js +1 -13
- package/dist/Editor/Elements/Variables/Style.js +2 -21
- package/dist/Editor/Elements/Variables/VariableButton.js +4 -17
- package/dist/Editor/MiniEditor.js +2 -4
- 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 +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -9
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +0 -5
- 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 +0 -2
- package/dist/Editor/common/FontLoader/FontList.js +11 -3
- package/dist/Editor/common/FontLoader/FontLoader.js +11 -37
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +0 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -14
- package/dist/Editor/common/Section/index.js +29 -39
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
- package/dist/Editor/common/Uploader.js +0 -8
- package/dist/Editor/commonStyle.js +12 -13
- package/dist/Editor/helper/deserialize/index.js +5 -18
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +1 -24
- package/dist/Editor/hooks/useMouseMove.js +2 -5
- package/dist/Editor/plugins/withHTML.js +1 -8
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +4 -41
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +1 -2
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/helper.js +19 -60
- package/dist/Editor/utils/pageSettings.js +2 -14
- package/dist/Editor/utils/table.js +0 -21
- package/package.json +2 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
- package/dist/Editor/helper/ensureWrappedVariables.js +0 -28
- package/dist/Editor/helper/markdown.js +0 -45
@@ -13,35 +13,6 @@ import { SectionSettingIcon } from "../iconListV2";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
15
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
16
|
-
const Toolbar = ({
|
17
|
-
fromPopper,
|
18
|
-
readOnly,
|
19
|
-
showTool,
|
20
|
-
onSettings
|
21
|
-
}) => {
|
22
|
-
return !readOnly && !showTool ? /*#__PURE__*/_jsx(Box, {
|
23
|
-
component: "div",
|
24
|
-
className: `element-toolbar no-border-button hr section-tw sectionIcon`,
|
25
|
-
contentEditable: false,
|
26
|
-
style: fromPopper ? {
|
27
|
-
position: "unset",
|
28
|
-
marginLeft: "28px",
|
29
|
-
paddingTop: "4px",
|
30
|
-
marginRight: "10px",
|
31
|
-
height: "100%"
|
32
|
-
} : {
|
33
|
-
left: "-28px",
|
34
|
-
top: "1px"
|
35
|
-
},
|
36
|
-
children: /*#__PURE__*/_jsx(Tooltip, {
|
37
|
-
title: "Section Settings",
|
38
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
39
|
-
onClick: onSettings,
|
40
|
-
children: /*#__PURE__*/_jsx(SectionSettingIcon, {})
|
41
|
-
})
|
42
|
-
})
|
43
|
-
}) : null;
|
44
|
-
};
|
45
16
|
const list_types = ["orderedList", "unorderedList"];
|
46
17
|
const Section = props => {
|
47
18
|
const themeReact = useTheme();
|
@@ -86,6 +57,32 @@ const Section = props => {
|
|
86
57
|
const onSettings = () => {
|
87
58
|
setOpenSettings(true);
|
88
59
|
};
|
60
|
+
const Toolbar = ({
|
61
|
+
fromPopper
|
62
|
+
}) => {
|
63
|
+
return !readOnly && !showTool ? /*#__PURE__*/_jsx(Box, {
|
64
|
+
component: "div",
|
65
|
+
className: `element-toolbar no-border-button hr section-tw sectionIcon`,
|
66
|
+
contentEditable: false,
|
67
|
+
style: fromPopper ? {
|
68
|
+
position: "unset",
|
69
|
+
marginLeft: "28px",
|
70
|
+
paddingTop: "4px",
|
71
|
+
marginRight: "10px",
|
72
|
+
height: "100%"
|
73
|
+
} : {
|
74
|
+
left: "-28px",
|
75
|
+
top: "1px"
|
76
|
+
},
|
77
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
78
|
+
title: "Section Settings",
|
79
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
80
|
+
onClick: onSettings,
|
81
|
+
children: /*#__PURE__*/_jsx(SectionSettingIcon, {})
|
82
|
+
})
|
83
|
+
})
|
84
|
+
}) : null;
|
85
|
+
};
|
89
86
|
const onSave = data => {
|
90
87
|
const updateData = {
|
91
88
|
...data
|
@@ -170,26 +167,19 @@ const Section = props => {
|
|
170
167
|
bgcolor: "background.paper",
|
171
168
|
height: "30px",
|
172
169
|
position: "relative",
|
173
|
-
background: theme?.palette?.type ===
|
170
|
+
background: theme?.palette?.type === 'dark' ? theme?.palette?.editor?.miniToolBarBackground : '#F6F6F6'
|
174
171
|
},
|
175
172
|
children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
|
176
173
|
...props,
|
177
174
|
fromPopper: true
|
178
175
|
}) : null, /*#__PURE__*/_jsx(Toolbar, {
|
179
|
-
fromPopper: true
|
180
|
-
readOnly: readOnly,
|
181
|
-
showTool: showTool,
|
182
|
-
onSettings: onSettings
|
176
|
+
fromPopper: true
|
183
177
|
})]
|
184
178
|
})
|
185
179
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
186
180
|
children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
|
187
181
|
...props
|
188
|
-
}) : null, /*#__PURE__*/_jsx(Toolbar, {
|
189
|
-
readOnly: readOnly,
|
190
|
-
showTool: showTool,
|
191
|
-
onSettings: onSettings
|
192
|
-
})]
|
182
|
+
}) : null, /*#__PURE__*/_jsx(Toolbar, {})]
|
193
183
|
}), children]
|
194
184
|
}), openSetttings ? /*#__PURE__*/_jsx(SectionPopup, {
|
195
185
|
element: {
|
@@ -73,11 +73,6 @@ const BackgroundImage = props => {
|
|
73
73
|
children: "REMOVE"
|
74
74
|
}) : /*#__PURE__*/_jsx(Grid, {
|
75
75
|
className: "uploadImageText",
|
76
|
-
sx: {
|
77
|
-
padding: 0,
|
78
|
-
background: `${theme?.palette?.editor?.inputFieldBgColor}`,
|
79
|
-
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
|
80
|
-
},
|
81
76
|
children: /*#__PURE__*/_jsxs(Button, {
|
82
77
|
component: "label",
|
83
78
|
variant: "text",
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Box, Card, Checkbox, FormControlLabel, Grid, Tooltip, Typography } from "@mui/material";
|
2
2
|
import React from "react";
|
3
3
|
import Icon from "../../Icon";
|
4
|
-
import { useEditorContext } from "../../../hooks/useMouseMove";
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
5
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
7
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -16,10 +15,7 @@ const RenderCard = ({
|
|
16
15
|
return /*#__PURE__*/_jsx(Card, {
|
17
16
|
sx: {
|
18
17
|
position: 'relative',
|
19
|
-
padding: "10px"
|
20
|
-
'& .MuiCheckbox-root svg': {
|
21
|
-
fill: 'unset !important'
|
22
|
-
}
|
18
|
+
padding: "10px"
|
23
19
|
},
|
24
20
|
children: /*#__PURE__*/_jsx(FormControlLabel, {
|
25
21
|
control: /*#__PURE__*/_jsx(Checkbox, {
|
@@ -85,9 +81,6 @@ const CardsMapping = props => {
|
|
85
81
|
selectedCard,
|
86
82
|
infoIcon
|
87
83
|
} = data;
|
88
|
-
const {
|
89
|
-
theme
|
90
|
-
} = useEditorContext();
|
91
84
|
const activeCard = value === selectedCard;
|
92
85
|
const handleChange = e => {
|
93
86
|
if (selectedCard === data?.value) {
|
@@ -106,8 +99,7 @@ const CardsMapping = props => {
|
|
106
99
|
sx: {
|
107
100
|
marginBottom: "12px",
|
108
101
|
"& .MuiPaper-root": {
|
109
|
-
|
110
|
-
border: activeCard ? "1px solid #2563EB" : `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
|
102
|
+
border: activeCard ? "1px solid #2563EB" : "1px solid #C8D8FA",
|
111
103
|
borderRadius: "8px",
|
112
104
|
boxShadow: activeCard ? "0px 4px 16px 0px #2563EB40" : "unset"
|
113
105
|
}
|
@@ -18,7 +18,6 @@ import FontSize from "./fontSize";
|
|
18
18
|
import SelectSwitch from "./selectSwitch";
|
19
19
|
import CardsMapping from "./card";
|
20
20
|
import MetaDataMapping from "./metaDataMapping";
|
21
|
-
import LineSpacing from "./lineSpacing";
|
22
21
|
const FieldMap = {
|
23
22
|
text: Text,
|
24
23
|
bannerSpacing: BannerSpacing,
|
@@ -39,7 +38,6 @@ const FieldMap = {
|
|
39
38
|
fontSize: FontSize,
|
40
39
|
selectSwitch: SelectSwitch,
|
41
40
|
card: CardsMapping,
|
42
|
-
metadatamapping: MetaDataMapping
|
43
|
-
lineSpacing: LineSpacing
|
41
|
+
metadatamapping: MetaDataMapping
|
44
42
|
};
|
45
43
|
export default FieldMap;
|
@@ -4,7 +4,6 @@ import { convertBase64 } from "../utils/helper";
|
|
4
4
|
import { uploadFile } from "../service/fileupload";
|
5
5
|
import Icon from "./Icon";
|
6
6
|
import UploadStyles from "../common/ImageSelector/UploadStyles";
|
7
|
-
import { useEditorContext } from "../hooks/useMouseMove";
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
8
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
10
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -19,9 +18,6 @@ const Uploader = props => {
|
|
19
18
|
const [base64, setBase64] = useState(value?.url);
|
20
19
|
const [fileName, setFileName] = useState("");
|
21
20
|
const [uploading, setUploading] = useState(false);
|
22
|
-
const {
|
23
|
-
theme
|
24
|
-
} = useEditorContext();
|
25
21
|
const handleChange = async e => {
|
26
22
|
const uFile = e.target.files[0];
|
27
23
|
const strImage = await convertBase64(uFile);
|
@@ -103,10 +99,6 @@ const Uploader = props => {
|
|
103
99
|
className: "uploadImageSection",
|
104
100
|
children: base64 ? renderThumb() : /*#__PURE__*/_jsx(Grid, {
|
105
101
|
className: "uploadImageText",
|
106
|
-
sx: {
|
107
|
-
background: `${theme?.palette?.editor?.inputFieldBgColor}`,
|
108
|
-
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
|
109
|
-
},
|
110
102
|
children: /*#__PURE__*/_jsxs(Button, {
|
111
103
|
component: "label",
|
112
104
|
variant: "text",
|
@@ -49,19 +49,15 @@ const useCommonStyle = theme => ({
|
|
49
49
|
fontWeight: "500",
|
50
50
|
fontFamily: "Inter, sans-serif"
|
51
51
|
},
|
52
|
-
"& .MuiPaper-root": {
|
53
|
-
border: `unset !important`,
|
54
|
-
borderRadius: '0px',
|
55
|
-
height: 'fit-content',
|
56
|
-
padding: '2px'
|
57
|
-
},
|
58
52
|
"& p": {
|
59
53
|
marginBottom: "7px",
|
60
54
|
marginTop: "4px"
|
61
55
|
},
|
62
|
-
"&
|
63
|
-
|
64
|
-
|
56
|
+
"& .MuiPaper-root": {
|
57
|
+
border: 'unset !important',
|
58
|
+
borderRadius: '0px',
|
59
|
+
height: 'fit-content',
|
60
|
+
padding: '2px'
|
65
61
|
},
|
66
62
|
"& .muiIconsListParent": {
|
67
63
|
"& svg": {
|
@@ -75,6 +71,9 @@ const useCommonStyle = theme => ({
|
|
75
71
|
},
|
76
72
|
"&::-webkit-scrollbar-thumb": {
|
77
73
|
background: `${theme?.palette?.editor?.brainPopupScroll} !important`
|
74
|
+
},
|
75
|
+
"&::-webkit-scrollbar-track": {
|
76
|
+
visibility: "hidden"
|
78
77
|
}
|
79
78
|
},
|
80
79
|
"& .MuiGrid-root>.MuiGrid-item": {
|
@@ -471,6 +470,10 @@ const useCommonStyle = theme => ({
|
|
471
470
|
}
|
472
471
|
}
|
473
472
|
},
|
473
|
+
pageSettingPopUpRoot: {
|
474
|
+
padding: "16px 8px 16px 10px!important",
|
475
|
+
height: "100%"
|
476
|
+
},
|
474
477
|
buttonMoreOption: {
|
475
478
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
476
479
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
@@ -483,10 +486,6 @@ const useCommonStyle = theme => ({
|
|
483
486
|
}
|
484
487
|
}
|
485
488
|
},
|
486
|
-
pageSettingPopUpRoot: {
|
487
|
-
padding: "16px 8px 16px 10px!important",
|
488
|
-
height: "100%"
|
489
|
-
},
|
490
489
|
buttonMoreOption2: {
|
491
490
|
background: `${theme?.palette?.editor?.aiInputBackground} !important`,
|
492
491
|
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
@@ -90,18 +90,9 @@ const ELEMENT_TAGS = {
|
|
90
90
|
type: "image",
|
91
91
|
url: el.getAttribute("src")
|
92
92
|
}),
|
93
|
-
LI:
|
94
|
-
|
95
|
-
|
96
|
-
return {
|
97
|
-
type: "check-list-item",
|
98
|
-
checked: checkListItem?.dataset?.checked === "true"
|
99
|
-
};
|
100
|
-
}
|
101
|
-
return {
|
102
|
-
type: "list-item"
|
103
|
-
};
|
104
|
-
},
|
93
|
+
LI: () => ({
|
94
|
+
type: "list-item"
|
95
|
+
}),
|
105
96
|
UL: () => ({
|
106
97
|
type: "unorderedList"
|
107
98
|
}),
|
@@ -118,7 +109,7 @@ const ELEMENT_TAGS = {
|
|
118
109
|
"GOOGLE-SHEETS-HTML-ORIGIN": paragraphType,
|
119
110
|
TABLE: (el, children = []) => {
|
120
111
|
try {
|
121
|
-
const bodyChild =
|
112
|
+
const bodyChild = children || [];
|
122
113
|
const firstRowChildren = bodyChild[0]?.children || [];
|
123
114
|
return {
|
124
115
|
type: "table",
|
@@ -138,11 +129,7 @@ const ELEMENT_TAGS = {
|
|
138
129
|
}),
|
139
130
|
TD: handleTableCell,
|
140
131
|
COLGROUP: paragraphType,
|
141
|
-
COL: paragraphType
|
142
|
-
HR: () => ({
|
143
|
-
type: "divider",
|
144
|
-
borderColor: "#CCC"
|
145
|
-
})
|
132
|
+
COL: paragraphType
|
146
133
|
};
|
147
134
|
|
148
135
|
// COMPAT: `B` is omitted here because Google Docs uses `<b>` in weird ways.
|
@@ -337,14 +337,14 @@ export const isCarouselSelected = editor => {
|
|
337
337
|
return false;
|
338
338
|
}
|
339
339
|
const [nodeEntry] = Editor.nodes(editor, {
|
340
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type ===
|
340
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'carousel'
|
341
341
|
});
|
342
342
|
if (!nodeEntry) {
|
343
343
|
return false;
|
344
344
|
}
|
345
345
|
const [node] = nodeEntry;
|
346
346
|
const carouselDom = ReactEditor.toDOMNode(editor, node);
|
347
|
-
const isEdit = carouselDom.classList.contains(
|
347
|
+
const isEdit = carouselDom.classList.contains('carousel_slider_edit');
|
348
348
|
return !isEdit;
|
349
349
|
} catch (err) {
|
350
350
|
console.log(err);
|
@@ -161,27 +161,4 @@ export const groupByBreakpoint = (styleProps, theme) => {
|
|
161
161
|
}
|
162
162
|
};
|
163
163
|
};
|
164
|
-
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
165
|
-
export const getBreakpointLineSpacing = (value, breakpoint) => {
|
166
|
-
try {
|
167
|
-
const values = getBreakPointsValue(value, breakpoint);
|
168
|
-
const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
|
169
|
-
if (values[b] || values["lg"]) {
|
170
|
-
const value = values[b] || values["lg"];
|
171
|
-
return {
|
172
|
-
...a,
|
173
|
-
[b]: value
|
174
|
-
};
|
175
|
-
} else {
|
176
|
-
return a;
|
177
|
-
}
|
178
|
-
}, {});
|
179
|
-
if (breakpoint) {
|
180
|
-
return value[breakpoint] || value["lg"] || value;
|
181
|
-
} else {
|
182
|
-
return cssVal["lg"];
|
183
|
-
}
|
184
|
-
} catch (err) {
|
185
|
-
// console.log(err);
|
186
|
-
}
|
187
|
-
};
|
164
|
+
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
@@ -35,7 +35,6 @@ export const EditorProvider = ({
|
|
35
35
|
path: null
|
36
36
|
});
|
37
37
|
const [fontFamilies, setFontFamilies] = useState({});
|
38
|
-
const [activeBreakPoint, setActiveBreakPoint] = useState("");
|
39
38
|
useEffect(() => {
|
40
39
|
window.updateSelectedItem = d => {
|
41
40
|
setSelectedElement(d);
|
@@ -98,10 +97,8 @@ export const EditorProvider = ({
|
|
98
97
|
setOpenAI,
|
99
98
|
updateDragging,
|
100
99
|
fontFamilies,
|
101
|
-
setFontFamilies
|
102
|
-
|
103
|
-
setActiveBreakPoint
|
104
|
-
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
|
100
|
+
setFontFamilies
|
101
|
+
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop]);
|
105
102
|
return /*#__PURE__*/_jsx(EditorContext.Provider, {
|
106
103
|
value: otherValues,
|
107
104
|
children: children
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { Transforms, Editor, Element, Node, Path } from "slate";
|
2
2
|
import deserialize from "../helper/deserialize";
|
3
3
|
import { decodeAndParseBase64 } from "../utils/helper";
|
4
|
-
import convertMDToHTML from "../helper/markdown";
|
5
4
|
const avoidDefaultInsert = ["table", "grid"];
|
6
5
|
const NON_TEXT_TAGS = ["ol", "ul", "img", "table", "video", "a", "button", "GOOGLE-SHEETS-HTML-ORIGIN"];
|
7
6
|
const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree"];
|
@@ -275,15 +274,9 @@ const withHtml = editor => {
|
|
275
274
|
Transforms.insertFragment(editor, formattedFragment);
|
276
275
|
return;
|
277
276
|
} else {
|
278
|
-
|
279
|
-
let parsed = new DOMParser().parseFromString(html, "text/html");
|
280
|
-
parsed = parseCopiedHTML(html);
|
281
|
-
const fragment = deserialize(parsed.body);
|
282
|
-
Transforms.insertFragment(editor, fragment);
|
283
|
-
// insertData(data);
|
277
|
+
insertData(data);
|
284
278
|
}
|
285
279
|
};
|
286
|
-
|
287
280
|
return editor;
|
288
281
|
};
|
289
282
|
export default withHtml;
|
@@ -173,9 +173,10 @@ export const getMarked = (leaf, children, theme) => {
|
|
173
173
|
if (leaf.highlight) {
|
174
174
|
children = /*#__PURE__*/_jsx("span", {
|
175
175
|
style: {
|
176
|
-
color: "inherit"
|
177
|
-
background: "var(--slate-highlight-bg)"
|
176
|
+
color: "inherit"
|
178
177
|
},
|
178
|
+
className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
|
179
|
+
,
|
179
180
|
children: children
|
180
181
|
});
|
181
182
|
}
|
@@ -301,30 +302,6 @@ export const getBlock = props => {
|
|
301
302
|
placeholder: "Heading 3",
|
302
303
|
children: children
|
303
304
|
});
|
304
|
-
case "headingFour":
|
305
|
-
return /*#__PURE__*/_jsx("h4", {
|
306
|
-
...attributes,
|
307
|
-
...element.attr,
|
308
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
309
|
-
placeholder: "Heading 4",
|
310
|
-
children: children
|
311
|
-
});
|
312
|
-
case "headingFive":
|
313
|
-
return /*#__PURE__*/_jsx("h5", {
|
314
|
-
...attributes,
|
315
|
-
...element.attr,
|
316
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
317
|
-
placeholder: "Heading 5",
|
318
|
-
children: children
|
319
|
-
});
|
320
|
-
case "headingSix":
|
321
|
-
return /*#__PURE__*/_jsx("h6", {
|
322
|
-
...attributes,
|
323
|
-
...element.attr,
|
324
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
325
|
-
placeholder: "Heading 6",
|
326
|
-
children: children
|
327
|
-
});
|
328
305
|
case "blockquote":
|
329
306
|
return /*#__PURE__*/_jsx("blockquote", {
|
330
307
|
...attributes,
|
@@ -337,8 +314,7 @@ export const getBlock = props => {
|
|
337
314
|
borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
|
338
315
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
339
316
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
340
|
-
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
341
|
-
lineHeight: 1.43
|
317
|
+
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
342
318
|
},
|
343
319
|
children: children
|
344
320
|
});
|
@@ -398,9 +374,6 @@ export const getBlock = props => {
|
|
398
374
|
});
|
399
375
|
case "orderedList":
|
400
376
|
return /*#__PURE__*/_jsx("ol", {
|
401
|
-
style: {
|
402
|
-
lineHeight: 1.43
|
403
|
-
},
|
404
377
|
className: "listItemMargin",
|
405
378
|
type: "1",
|
406
379
|
...attributes,
|
@@ -408,9 +381,6 @@ export const getBlock = props => {
|
|
408
381
|
});
|
409
382
|
case "unorderedList":
|
410
383
|
return /*#__PURE__*/_jsx("ul", {
|
411
|
-
style: {
|
412
|
-
lineHeight: 1.43
|
413
|
-
},
|
414
384
|
className: "listItemMargin",
|
415
385
|
...attributes,
|
416
386
|
children: children
|
@@ -612,13 +582,6 @@ export const getBlock = props => {
|
|
612
582
|
return /*#__PURE__*/_jsx(ColumnView, {
|
613
583
|
...props
|
614
584
|
});
|
615
|
-
case "code":
|
616
|
-
return /*#__PURE__*/_jsx("code", {
|
617
|
-
...attributes,
|
618
|
-
...element.attr,
|
619
|
-
className: "markcode",
|
620
|
-
children: children
|
621
|
-
});
|
622
585
|
default:
|
623
586
|
return /*#__PURE__*/_jsx(SimpleText, {
|
624
587
|
...props,
|
@@ -43,8 +43,7 @@ const useTableResize = ({
|
|
43
43
|
minWidth
|
44
44
|
} = minMaxProps || {};
|
45
45
|
setSize(currentSize => {
|
46
|
-
const
|
47
|
-
const calcWidth = width + e.movementX;
|
46
|
+
const calcWidth = currentSize?.width + e.movementX;
|
48
47
|
return {
|
49
48
|
width: minWidth && calcWidth < minWidth ? minWidth : calcWidth,
|
50
49
|
height: currentSize.height + e.movementY,
|
@@ -82,8 +82,7 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
|
|
82
82
|
};
|
83
83
|
export const draftToSlate = props => {
|
84
84
|
const {
|
85
|
-
data
|
86
|
-
needLayout
|
85
|
+
data
|
87
86
|
} = props;
|
88
87
|
if (data?.blocks && data?.blocks?.length > 0) {
|
89
88
|
const converted = data?.blocks?.reduce((a, b) => {
|
@@ -105,7 +104,7 @@ export const draftToSlate = props => {
|
|
105
104
|
return data;
|
106
105
|
} else {
|
107
106
|
return [{
|
108
|
-
type:
|
107
|
+
type: "paragraph",
|
109
108
|
children: [{
|
110
109
|
text: ""
|
111
110
|
}]
|
@@ -625,10 +625,6 @@ export const isRestrictedNode = (event, editor) => {
|
|
625
625
|
return isNodeRestricted;
|
626
626
|
}
|
627
627
|
};
|
628
|
-
export function capitalizeFirstLetter(str) {
|
629
|
-
if (!str) return str;
|
630
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
631
|
-
}
|
632
628
|
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
633
629
|
try {
|
634
630
|
const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
|
@@ -647,13 +643,6 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
|
|
647
643
|
console.log(err);
|
648
644
|
}
|
649
645
|
};
|
650
|
-
export function isHavingSelection(editor) {
|
651
|
-
try {
|
652
|
-
return editor?.selection && !Range.isCollapsed(editor.selection);
|
653
|
-
} catch (err) {
|
654
|
-
console.log(err);
|
655
|
-
}
|
656
|
-
}
|
657
646
|
const omitNodes = ["site-settings", "page-settings"];
|
658
647
|
export function getInitialValue(value = [], readOnly) {
|
659
648
|
if (readOnly === "readonly" && value?.length) {
|
@@ -684,17 +673,20 @@ export function getInitialValue(value = [], readOnly) {
|
|
684
673
|
}
|
685
674
|
return value;
|
686
675
|
}
|
676
|
+
export function capitalizeFirstLetter(str) {
|
677
|
+
if (!str) return str;
|
678
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
679
|
+
}
|
680
|
+
export function isHavingSelection(editor) {
|
681
|
+
try {
|
682
|
+
return editor?.selection && !Range.isCollapsed(editor.selection);
|
683
|
+
} catch (err) {
|
684
|
+
console.log(err);
|
685
|
+
}
|
686
|
+
}
|
687
687
|
export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
|
688
688
|
return `${defaultCls} ${selected ? selectedClsName : ""}`;
|
689
689
|
}
|
690
|
-
export function handleNegativeInteger(val) {
|
691
|
-
return val < 0 ? 0 : val;
|
692
|
-
}
|
693
|
-
export const containsSurrogatePair = text => {
|
694
|
-
// Match surrogate pairs (high and low surrogate)
|
695
|
-
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
696
|
-
return surrogatePairRegex.test(text);
|
697
|
-
};
|
698
690
|
export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
699
691
|
try {
|
700
692
|
const options = {
|
@@ -708,6 +700,11 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
|
708
700
|
return [];
|
709
701
|
}
|
710
702
|
};
|
703
|
+
export const containsSurrogatePair = text => {
|
704
|
+
// Match surrogate pairs (high and low surrogate)
|
705
|
+
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
706
|
+
return surrogatePairRegex.test(text);
|
707
|
+
};
|
711
708
|
export const getSlateDom = (editor, range) => {
|
712
709
|
try {
|
713
710
|
const slateDom = ReactEditor.toDOMRange(editor, range);
|
@@ -716,44 +713,6 @@ export const getSlateDom = (editor, range) => {
|
|
716
713
|
console.log(err);
|
717
714
|
}
|
718
715
|
};
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
// After typing the first word, the input loses focus.
|
723
|
-
export const focusDynamicTableInput = e => {
|
724
|
-
setTimeout(() => {
|
725
|
-
const input = document.getElementById(e.target.id);
|
726
|
-
if (input) {
|
727
|
-
// Check if the input is not already focused
|
728
|
-
if (document.activeElement !== input) {
|
729
|
-
const length = input.value.length;
|
730
|
-
// Focus on the input
|
731
|
-
input.focus();
|
732
|
-
|
733
|
-
// number input not supports selection
|
734
|
-
if (e.target.type !== "number") {
|
735
|
-
// Set the cursor to the end
|
736
|
-
input.setSelectionRange(length, length);
|
737
|
-
}
|
738
|
-
}
|
739
|
-
}
|
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");
|
759
|
-
};
|
716
|
+
export function handleNegativeInteger(val) {
|
717
|
+
return val < 0 ? 0 : val;
|
718
|
+
}
|