@flozy/editor 7.0.5 → 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 +2 -5
- package/dist/Editor/Editor.css +1 -1
- 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 +1 -8
- 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/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 +0 -2
- 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 +2 -2
- 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/theme.js +1 -24
- package/dist/Editor/hooks/useMouseMove.js +2 -5
- package/dist/Editor/plugins/withHTML.js +1 -7
- package/dist/Editor/utils/SlateUtilityFunctions.js +7 -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 +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
- package/dist/Editor/helper/ensureWrappedVariables.js +0 -28
@@ -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,
|
@@ -9,7 +9,6 @@ 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 {
|
@@ -87,7 +86,6 @@ const PopupTool = props => {
|
|
87
86
|
setAnchorEl(null);
|
88
87
|
} else {
|
89
88
|
updateAnchorEl();
|
90
|
-
hideSlateSelection(); // removes slate selection background, when there is no selection
|
91
89
|
}
|
92
90
|
}, [selection, event, selectedElement?.enable]);
|
93
91
|
const handleClose = () => {
|
@@ -131,6 +131,7 @@ const MentionsPopup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
131
131
|
setOpenAI("fromElements");
|
132
132
|
}
|
133
133
|
insertMention(editor, char, type);
|
134
|
+
Transforms.insertText(editor, " "); //Added to insert space after inserting mention node
|
134
135
|
setMentions({
|
135
136
|
...mentions,
|
136
137
|
target: null
|
@@ -59,7 +59,6 @@ const useElementSettingsStyle = theme => ({
|
|
59
59
|
overflowX: "hidden",
|
60
60
|
overflowY: "auto",
|
61
61
|
background: theme?.palette?.editor?.background,
|
62
|
-
paddingLeft: "4px",
|
63
62
|
"& .MuiTypography-root, .MuiInputBase-root, input": {
|
64
63
|
color: theme?.palette?.editor?.textColor
|
65
64
|
},
|
@@ -3,7 +3,6 @@ import PersonalVideoIcon from "@mui/icons-material/PersonalVideo";
|
|
3
3
|
import PhoneIphoneIcon from "@mui/icons-material/PhoneIphone";
|
4
4
|
import useSwitchViewport from "./styles";
|
5
5
|
import { useEffect } from "react";
|
6
|
-
import { useEditorContext } from "../../../hooks/useMouseMove";
|
7
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
8
|
const SwitchViewport = props => {
|
@@ -12,9 +11,6 @@ const SwitchViewport = props => {
|
|
12
11
|
onChange
|
13
12
|
} = props;
|
14
13
|
const classes = useSwitchViewport();
|
15
|
-
const {
|
16
|
-
setActiveBreakPoint
|
17
|
-
} = useEditorContext();
|
18
14
|
useEffect(() => {
|
19
15
|
console.log(breakpoint);
|
20
16
|
}, [breakpoint]);
|
@@ -25,7 +21,6 @@ const SwitchViewport = props => {
|
|
25
21
|
children: /*#__PURE__*/_jsx(IconButton, {
|
26
22
|
className: `${!breakpoint || breakpoint === "lg" ? "active" : ""}`,
|
27
23
|
onClick: () => {
|
28
|
-
setActiveBreakPoint("");
|
29
24
|
onChange("");
|
30
25
|
},
|
31
26
|
children: /*#__PURE__*/_jsx(PersonalVideoIcon, {})
|
@@ -35,7 +30,6 @@ const SwitchViewport = props => {
|
|
35
30
|
children: /*#__PURE__*/_jsx(IconButton, {
|
36
31
|
className: `${breakpoint === "xs" ? "active" : ""}`,
|
37
32
|
onClick: () => {
|
38
|
-
setActiveBreakPoint("xs");
|
39
33
|
onChange("xs");
|
40
34
|
},
|
41
35
|
children: /*#__PURE__*/_jsx(PhoneIphoneIcon, {})
|
@@ -10,10 +10,11 @@ import { getBreakPointsValue, getTRBLBreakPoints, groupByBreakpoint } from "../.
|
|
10
10
|
import SectionStyle from "./styles";
|
11
11
|
import useWindowResize from "../../hooks/useWindowResize";
|
12
12
|
import { SectionSettingIcon } from "../iconListV2";
|
13
|
+
|
14
|
+
// const list_types = ["orderedList", "unorderedList"];
|
13
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
14
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
15
17
|
const Toolbar = ({
|
16
|
-
fromPopper,
|
17
18
|
readOnly,
|
18
19
|
showTool,
|
19
20
|
onSettings,
|
@@ -39,7 +40,6 @@ const Toolbar = ({
|
|
39
40
|
})
|
40
41
|
}) : null;
|
41
42
|
};
|
42
|
-
const list_types = ["orderedList", "unorderedList"];
|
43
43
|
const Section = props => {
|
44
44
|
const themeReact = useTheme();
|
45
45
|
const theme = props?.theme;
|
@@ -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;
|
@@ -49,11 +49,6 @@ 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
|
-
},
|
57
52
|
"& p": {
|
58
53
|
marginBottom: "7px",
|
59
54
|
marginTop: "4px"
|
@@ -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);
|
@@ -36,7 +36,6 @@ export const EditorProvider = ({
|
|
36
36
|
path: null
|
37
37
|
});
|
38
38
|
const [fontFamilies, setFontFamilies] = useState(defaultFontFamilies);
|
39
|
-
const [activeBreakPoint, setActiveBreakPoint] = useState("");
|
40
39
|
useEffect(() => {
|
41
40
|
window.updateSelectedItem = d => {
|
42
41
|
setSelectedElement(d);
|
@@ -99,10 +98,8 @@ export const EditorProvider = ({
|
|
99
98
|
setOpenAI,
|
100
99
|
updateDragging,
|
101
100
|
fontFamilies,
|
102
|
-
setFontFamilies
|
103
|
-
|
104
|
-
setActiveBreakPoint
|
105
|
-
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
|
101
|
+
setFontFamilies
|
102
|
+
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop]);
|
106
103
|
return /*#__PURE__*/_jsx(EditorContext.Provider, {
|
107
104
|
value: otherValues,
|
108
105
|
children: children
|
@@ -253,13 +253,7 @@ const withHtml = editor => {
|
|
253
253
|
return;
|
254
254
|
}
|
255
255
|
const fragment = deserialize(parsed.body);
|
256
|
-
const
|
257
|
-
if (normalizeFragment && isNonText) {
|
258
|
-
// When a non-text node is pasted into a list item, insert it into the next node.
|
259
|
-
insertAtNextNode(editor, fragment);
|
260
|
-
return;
|
261
|
-
}
|
262
|
-
const formattedFragment = normalizeFragment ? normalizeFragment(fragment) : fragment;
|
256
|
+
const formattedFragment = formatFragment[eltype] ? formatFragment[eltype](fragment) : fragment;
|
263
257
|
let is_img_table = false;
|
264
258
|
formattedFragment.map(f => {
|
265
259
|
if (f.type === "image" || f?.type?.includes("table")) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Editor, Transforms, Element as SlateElement
|
1
|
+
import { Editor, Transforms, Element as SlateElement } from "slate";
|
2
2
|
import { Box } from "@mui/material";
|
3
3
|
import { sizeMap } from "./font";
|
4
4
|
import Link from "../Elements/Link/Link";
|
@@ -38,7 +38,7 @@ import { getBreakPointsValue, groupByBreakpoint } from "../helper/theme";
|
|
38
38
|
import Variables from "../Elements/Variables/Variable";
|
39
39
|
import insertNewLine from "./insertNewLine";
|
40
40
|
import Divider from "../Elements/Divider/Divider";
|
41
|
-
import { getBorderColor
|
41
|
+
import { getBorderColor } from "./helper";
|
42
42
|
import Code from "../Elements/EmbedScript/Code";
|
43
43
|
import FreeGrid from "../Elements/FreeGrid/FreeGrid";
|
44
44
|
import FreeGridItem from "../Elements/FreeGrid/FreeGridItem";
|
@@ -161,17 +161,7 @@ export const activeMark = (editor, format) => {
|
|
161
161
|
};
|
162
162
|
try {
|
163
163
|
const marks = Editor.marks(editor);
|
164
|
-
|
165
|
-
const {
|
166
|
-
selection
|
167
|
-
} = editor || {};
|
168
|
-
if (format === "fontSize" && selection && !Range.isCollapsed(selection)) {
|
169
|
-
const slateDom = getSlateDom(editor, editor?.selection);
|
170
|
-
if (slateDom) {
|
171
|
-
const parentElement = slateDom.commonAncestorContainer.parentElement;
|
172
|
-
defaultValue = window.getComputedStyle(parentElement).fontSize;
|
173
|
-
}
|
174
|
-
}
|
164
|
+
const defaultValue = defaultMarkData[format];
|
175
165
|
return marks?.[format] ?? defaultValue;
|
176
166
|
} catch (err) {
|
177
167
|
console.log(err);
|
@@ -183,9 +173,10 @@ export const getMarked = (leaf, children, theme) => {
|
|
183
173
|
if (leaf.highlight) {
|
184
174
|
children = /*#__PURE__*/_jsx("span", {
|
185
175
|
style: {
|
186
|
-
color: "inherit"
|
187
|
-
background: "var(--slate-highlight-bg)"
|
176
|
+
color: "inherit"
|
188
177
|
},
|
178
|
+
className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
|
179
|
+
,
|
189
180
|
children: children
|
190
181
|
});
|
191
182
|
}
|
@@ -347,8 +338,7 @@ export const getBlock = props => {
|
|
347
338
|
borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
|
348
339
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
349
340
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
350
|
-
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
351
|
-
lineHeight: 1.43
|
341
|
+
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
352
342
|
},
|
353
343
|
children: children
|
354
344
|
});
|
@@ -408,9 +398,6 @@ export const getBlock = props => {
|
|
408
398
|
});
|
409
399
|
case "orderedList":
|
410
400
|
return /*#__PURE__*/_jsx("ol", {
|
411
|
-
style: {
|
412
|
-
lineHeight: 1.43
|
413
|
-
},
|
414
401
|
className: "listItemMargin",
|
415
402
|
type: "1",
|
416
403
|
...attributes,
|
@@ -418,9 +405,6 @@ export const getBlock = props => {
|
|
418
405
|
});
|
419
406
|
case "unorderedList":
|
420
407
|
return /*#__PURE__*/_jsx("ul", {
|
421
|
-
style: {
|
422
|
-
lineHeight: 1.43
|
423
|
-
},
|
424
408
|
className: "listItemMargin",
|
425
409
|
...attributes,
|
426
410
|
children: children
|
@@ -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,
|
@@ -713,47 +713,6 @@ export const getSlateDom = (editor, range) => {
|
|
713
713
|
console.log(err);
|
714
714
|
}
|
715
715
|
};
|
716
|
-
|
717
|
-
// The inputs inside the dynamic table lose focus after calling `setNodes` on the first `onChange` event.
|
718
|
-
// To replicate this issue, insert some paragraph nodes above the dynamic table, then type something in the title.
|
719
|
-
// After typing the first word, the input loses focus.
|
720
|
-
export const focusDynamicTableInput = e => {
|
721
|
-
setTimeout(() => {
|
722
|
-
const input = document.getElementById(e.target.id);
|
723
|
-
if (input) {
|
724
|
-
// Check if the input is not already focused
|
725
|
-
if (document.activeElement !== input) {
|
726
|
-
const length = input.value.length;
|
727
|
-
// Focus on the input
|
728
|
-
input.focus();
|
729
|
-
|
730
|
-
// number input not supports selection
|
731
|
-
if (e.target.type !== "number") {
|
732
|
-
// Set the cursor to the end
|
733
|
-
input.setSelectionRange(length, length);
|
734
|
-
}
|
735
|
-
}
|
736
|
-
}
|
737
|
-
}, 0);
|
738
|
-
};
|
739
|
-
export const clearWindowSelection = () => {
|
740
|
-
const selection = window.getSelection();
|
741
|
-
if (selection) {
|
742
|
-
selection.removeAllRanges(); // Clears the selection
|
743
|
-
}
|
744
|
-
};
|
745
|
-
|
746
|
-
export const viewSlateSelection = () => {
|
747
|
-
// 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
|
748
|
-
clearWindowSelection();
|
749
|
-
const selectionBg = "rgba(35, 131, 226, 0.35)";
|
750
|
-
const root = document.documentElement;
|
751
|
-
root.style.setProperty("--slate-highlight-bg", selectionBg);
|
752
|
-
};
|
753
|
-
export const hideSlateSelection = () => {
|
754
|
-
const root = document.documentElement;
|
755
|
-
root.style.setProperty("--slate-highlight-bg", "none");
|
756
|
-
};
|
757
716
|
export function handleNegativeInteger(val) {
|
758
717
|
return val < 0 ? 0 : val;
|
759
718
|
}
|
@@ -9,13 +9,7 @@ export const findPageSettings = editor => {
|
|
9
9
|
path: null,
|
10
10
|
element: {
|
11
11
|
pageProps: {
|
12
|
-
pageWidth: "fixed"
|
13
|
-
"lineHeight": {
|
14
|
-
"xs": 1.43,
|
15
|
-
"sm": 1.43,
|
16
|
-
"md": 1.43,
|
17
|
-
"lg": 1.43
|
18
|
-
}
|
12
|
+
pageWidth: "fixed"
|
19
13
|
}
|
20
14
|
}
|
21
15
|
};
|
@@ -40,13 +34,7 @@ export const getPageSettings = editor => {
|
|
40
34
|
path: null,
|
41
35
|
element: {
|
42
36
|
pageProps: {
|
43
|
-
pageWidth: "fixed"
|
44
|
-
"lineHeight": {
|
45
|
-
"xs": 1.43,
|
46
|
-
"sm": 1.43,
|
47
|
-
"md": 1.43,
|
48
|
-
"lg": 1.43
|
49
|
-
}
|
37
|
+
pageWidth: "fixed"
|
50
38
|
}
|
51
39
|
}
|
52
40
|
};
|
@@ -753,25 +753,4 @@ export const clearCellText = (editor, currentCellPath) => {
|
|
753
753
|
} catch (err) {
|
754
754
|
console.log(err);
|
755
755
|
}
|
756
|
-
};
|
757
|
-
export const getTableColumns = element => {
|
758
|
-
const {
|
759
|
-
columns,
|
760
|
-
children
|
761
|
-
} = element || {};
|
762
|
-
if (columns) {
|
763
|
-
return columns;
|
764
|
-
}
|
765
|
-
const firstRow = children?.length ? children[0] : {};
|
766
|
-
return firstRow?.children?.length || 0;
|
767
|
-
};
|
768
|
-
export const getTableRows = element => {
|
769
|
-
const {
|
770
|
-
rows,
|
771
|
-
children
|
772
|
-
} = element || {};
|
773
|
-
if (rows) {
|
774
|
-
return rows;
|
775
|
-
}
|
776
|
-
return children?.length || 0;
|
777
756
|
};
|