@flozy/editor 7.0.7 → 7.0.9
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 +5 -4
- package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
- package/dist/Editor/Elements/Button/EditorButton.js +1 -0
- package/dist/Editor/Elements/DataView/DataView.js +4 -3
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
- package/dist/Editor/Elements/Search/SearchList.js +8 -1
- package/dist/Editor/Elements/SimpleText/index.js +19 -7
- package/dist/Editor/Elements/SimpleText/style.js +5 -1
- package/dist/Editor/Elements/Table/Table.js +15 -15
- package/dist/Editor/Elements/Table/TableCell.js +14 -9
- package/dist/Editor/MiniEditor.js +4 -2
- package/dist/Editor/Styles/EditorStyles.js +291 -287
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +37 -28
- 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 +3 -8
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +39 -29
- package/dist/Editor/common/FontLoader/FontList.js +11 -11
- package/dist/Editor/common/FontLoader/FontLoader.js +45 -75
- package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
- package/dist/Editor/common/ImageSelector/UploadStyles.js +2 -1
- package/dist/Editor/common/MentionsPopup/index.js +0 -1
- package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +6 -0
- package/dist/Editor/common/Section/index.js +89 -60
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
- package/dist/Editor/commonStyle.js +5 -0
- package/dist/Editor/helper/deserialize/index.js +1 -1
- package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useEditorScroll.js +1 -1
- package/dist/Editor/hooks/useMouseMove.js +6 -4
- package/dist/Editor/plugins/withHTML.js +7 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +23 -12
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
- package/dist/Editor/utils/helper.js +41 -0
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/dist/Editor/utils/table.js +21 -0
- package/package.json +2 -2
@@ -26,7 +26,7 @@ import editorStyles from "./Styles/EditorStyles";
|
|
26
26
|
import DragAndDrop from "./common/DnD";
|
27
27
|
import Section from "./common/Section";
|
28
28
|
import decorators from "./utils/Decorators";
|
29
|
-
import { getTRBLBreakPoints } from "./helper/theme";
|
29
|
+
import { getBreakpointLineSpacing, getTRBLBreakPoints } from "./helper/theme";
|
30
30
|
import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isRestrictedNode, outsideEditorClickLabel } from "./utils/helper";
|
31
31
|
import useWindowResize from "./hooks/useWindowResize";
|
32
32
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
@@ -54,14 +54,13 @@ const Item = /*#__PURE__*/forwardRef(({
|
|
54
54
|
});
|
55
55
|
});
|
56
56
|
Item.displayName = "Item";
|
57
|
-
const Element =
|
57
|
+
const Element = props => {
|
58
58
|
return /*#__PURE__*/_jsx(Section, {
|
59
59
|
...props,
|
60
60
|
children: getBlock(props)
|
61
61
|
});
|
62
|
-
}
|
63
|
-
|
64
|
-
const Leaf = /*#__PURE__*/React.memo(({
|
62
|
+
};
|
63
|
+
const Leaf = ({
|
65
64
|
attributes,
|
66
65
|
children,
|
67
66
|
leaf
|
@@ -72,8 +71,7 @@ const Leaf = /*#__PURE__*/React.memo(({
|
|
72
71
|
...attributes,
|
73
72
|
children: children
|
74
73
|
});
|
75
|
-
}
|
76
|
-
Leaf.displayName = "Leaf";
|
74
|
+
};
|
77
75
|
const updateTopBanner = (content = [], setTopBanner) => {
|
78
76
|
setTopBanner(() => {
|
79
77
|
const firstNode = content ? content[0] : {};
|
@@ -93,7 +91,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
93
91
|
otherProps,
|
94
92
|
isIframe,
|
95
93
|
theme,
|
96
|
-
showViewport = false
|
94
|
+
showViewport = false,
|
95
|
+
overrideWrapperStyles = {}
|
97
96
|
} = props;
|
98
97
|
const editorWrapper = useRef();
|
99
98
|
const mentionsRef = useRef();
|
@@ -141,7 +140,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
141
140
|
pageColor,
|
142
141
|
color: pageTextColor,
|
143
142
|
pageWidth,
|
144
|
-
maxWidth: pageMaxWidth
|
143
|
+
maxWidth: pageMaxWidth,
|
144
|
+
lineHeight
|
145
145
|
} = pageSt?.pageProps || {
|
146
146
|
bannerSpacing: {
|
147
147
|
left: 0,
|
@@ -153,7 +153,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
153
153
|
const classes = editorStyles({
|
154
154
|
padHeight: !fullScreen ? otherProps?.padHeight : 20,
|
155
155
|
placeHolderColor: invertColor(pageColor || "#FFF"),
|
156
|
-
theme
|
156
|
+
theme,
|
157
|
+
overrideWrapperStyles
|
157
158
|
});
|
158
159
|
const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
|
159
160
|
useEffect(() => {
|
@@ -313,7 +314,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
313
314
|
updateTopBanner(newValue, setTopBanner);
|
314
315
|
debounced(newValue);
|
315
316
|
if (!isInteracted) {
|
316
|
-
|
317
|
+
setIsInteracted(true);
|
317
318
|
}
|
318
319
|
}
|
319
320
|
};
|
@@ -332,6 +333,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
332
333
|
onDrawerOpen: onDrawerOpen,
|
333
334
|
ICON_API: "https://assets.agenciflow.com"
|
334
335
|
};
|
336
|
+
const lineH = getBreakpointLineSpacing(lineHeight, breakpoint);
|
335
337
|
const renderElement = useCallback(props => {
|
336
338
|
return /*#__PURE__*/_jsx(Element, {
|
337
339
|
...props,
|
@@ -493,7 +495,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
493
495
|
...props,
|
494
496
|
fullScreen: fullScreen,
|
495
497
|
footer: footer || "",
|
496
|
-
children: /*#__PURE__*/
|
498
|
+
children: /*#__PURE__*/_jsx(Box, {
|
497
499
|
component: "div",
|
498
500
|
className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
|
499
501
|
sx: classes.root,
|
@@ -503,7 +505,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
503
505
|
"data-breakpoint": breakpoint
|
504
506
|
// onContextMenu={handleContextMenu}
|
505
507
|
,
|
506
|
-
children:
|
508
|
+
children: /*#__PURE__*/_jsxs(Slate, {
|
507
509
|
editor: editor,
|
508
510
|
initialValue: getInitialValue(debouncedValue?.current, readOnly),
|
509
511
|
onChange: handleEditorChange,
|
@@ -534,6 +536,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
534
536
|
padding: {
|
535
537
|
...getTRBLBreakPoints(bannerSpacing)
|
536
538
|
},
|
539
|
+
lineHeight: lineH,
|
537
540
|
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
538
541
|
height: viewport.h ? `${viewport.h}px` : `100%`,
|
539
542
|
alignSelf: "center",
|
@@ -603,13 +606,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
603
606
|
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
604
607
|
...htmlAction,
|
605
608
|
handleCodeToText: handleCodeToText
|
609
|
+
}), /*#__PURE__*/_jsx(FontLoader, {
|
610
|
+
...props
|
606
611
|
})]
|
607
|
-
}, id)
|
608
|
-
otherProps: {
|
609
|
-
services: otherProps?.services
|
610
|
-
},
|
611
|
-
readOnly: readOnly
|
612
|
-
})]
|
612
|
+
}, id)
|
613
613
|
})
|
614
614
|
})
|
615
615
|
});
|
package/dist/Editor/Editor.css
CHANGED
@@ -995,7 +995,7 @@ blockquote {
|
|
995
995
|
|
996
996
|
.sliderInput {
|
997
997
|
width: 66px !important;
|
998
|
-
padding: 2px
|
998
|
+
padding: 2px 0px 2px 4px;
|
999
999
|
margin-left: 18px;
|
1000
1000
|
box-shadow: 0px 4px 16px 0px #0000000d;
|
1001
1001
|
border: 1px solid #6f6f6f33;
|
@@ -1279,9 +1279,10 @@ blockquote {
|
|
1279
1279
|
background: none !important;
|
1280
1280
|
}
|
1281
1281
|
@media (max-width: 899px) {
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1282
|
+
/* Qa validation required */
|
1283
|
+
/* .MuiPopover-root {
|
1284
|
+
z-index: 1302 !important;
|
1285
|
+
} */
|
1285
1286
|
|
1286
1287
|
canvas {
|
1287
1288
|
max-width: 100% !important;
|
@@ -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", {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Node, Path, Transforms } from "slate";
|
3
|
-
import { ReactEditor,
|
3
|
+
import { ReactEditor, useSlate } from "slate-react";
|
4
4
|
import { Box, useTheme } from "@mui/material";
|
5
5
|
import { DataViewProvider } from "./Providers/DataViewProvider";
|
6
6
|
import useDataViewStyles from "./styles";
|
@@ -15,7 +15,7 @@ const DataView = props => {
|
|
15
15
|
theme: appTheme
|
16
16
|
} = useEditorContext();
|
17
17
|
const theme = useTheme();
|
18
|
-
const editor =
|
18
|
+
const editor = useSlate();
|
19
19
|
const {
|
20
20
|
attributes,
|
21
21
|
children,
|
@@ -113,7 +113,8 @@ const DataView = props => {
|
|
113
113
|
onDuplicate: onDuplicate,
|
114
114
|
readOnly: readOnly,
|
115
115
|
title: title,
|
116
|
-
onTitleChange: onTitleChange
|
116
|
+
onTitleChange: onTitleChange,
|
117
|
+
path: path
|
117
118
|
}), /*#__PURE__*/_jsx(LayoutView, {
|
118
119
|
readOnly: readOnly,
|
119
120
|
children: children
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { TextField } from "@mui/material";
|
3
3
|
import { useDataView } from "../../Providers/DataViewProvider";
|
4
|
+
import { focusDynamicTableInput } from "../../../../utils/helper";
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
6
|
const NumberType = props => {
|
6
7
|
const {
|
@@ -16,6 +17,7 @@ const NumberType = props => {
|
|
16
17
|
onChange(rowIndex, {
|
17
18
|
[property]: e?.target?.value
|
18
19
|
});
|
20
|
+
focusDynamicTableInput(e);
|
19
21
|
};
|
20
22
|
return /*#__PURE__*/_jsx(TextField, {
|
21
23
|
type: "number",
|
@@ -24,7 +26,9 @@ const NumberType = props => {
|
|
24
26
|
value: value,
|
25
27
|
size: "small",
|
26
28
|
onChange: handleChange,
|
27
|
-
disabled: readOnly
|
29
|
+
disabled: readOnly,
|
30
|
+
id: `tv-number-input-${rowIndex}-${property}` // * should be unique
|
28
31
|
});
|
29
32
|
};
|
33
|
+
|
30
34
|
export default NumberType;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { TextField } from "@mui/material";
|
3
3
|
import { useDataView } from "../../Providers/DataViewProvider";
|
4
|
+
import { focusDynamicTableInput } from "../../../../utils/helper";
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
6
|
const TextType = props => {
|
6
7
|
const {
|
@@ -16,6 +17,7 @@ const TextType = props => {
|
|
16
17
|
onChange(rowIndex, {
|
17
18
|
[property]: e?.target?.value
|
18
19
|
});
|
20
|
+
focusDynamicTableInput(e);
|
19
21
|
};
|
20
22
|
const formatValue = () => {
|
21
23
|
if (typeof value === "string") {
|
@@ -30,7 +32,9 @@ const TextType = props => {
|
|
30
32
|
value: formatValue(value),
|
31
33
|
size: "small",
|
32
34
|
onChange: handleChange,
|
33
|
-
disabled: readOnly
|
35
|
+
disabled: readOnly,
|
36
|
+
id: `tv-text-input-${rowIndex}-${property}` // * should be unique
|
34
37
|
});
|
35
38
|
};
|
39
|
+
|
36
40
|
export default TextType;
|
@@ -5,6 +5,7 @@ import FilterSort from "./FilterSort";
|
|
5
5
|
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
|
6
6
|
import Icon from "../../../common/Icon";
|
7
7
|
import { useEditorContext } from "../../../hooks/useMouseMove";
|
8
|
+
import { focusDynamicTableInput } from "../../../utils/helper";
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
const FilterView = props => {
|
@@ -15,7 +16,8 @@ const FilterView = props => {
|
|
15
16
|
onEnter,
|
16
17
|
readOnly,
|
17
18
|
title,
|
18
|
-
onTitleChange
|
19
|
+
onTitleChange,
|
20
|
+
path
|
19
21
|
} = props;
|
20
22
|
const {
|
21
23
|
sort,
|
@@ -70,6 +72,7 @@ const FilterView = props => {
|
|
70
72
|
};
|
71
73
|
const handleTitleChange = e => {
|
72
74
|
onTitleChange(e?.target?.value);
|
75
|
+
focusDynamicTableInput(e);
|
73
76
|
};
|
74
77
|
const handleEnter = e => {
|
75
78
|
if (e?.key === "Enter") {
|
@@ -96,24 +99,25 @@ const FilterView = props => {
|
|
96
99
|
},
|
97
100
|
value: title,
|
98
101
|
onChange: handleTitleChange,
|
99
|
-
onKeyUp: handleEnter
|
102
|
+
onKeyUp: handleEnter,
|
103
|
+
id: `tv-title-input-${path.join("|")}`
|
100
104
|
}) : title || "Untitled"
|
101
105
|
}), /*#__PURE__*/_jsxs(Box, {
|
102
106
|
className: "tv-fi-wrpr",
|
103
107
|
sx: {
|
104
|
-
alignItems:
|
108
|
+
alignItems: "center"
|
105
109
|
},
|
106
110
|
children: [/*#__PURE__*/_jsxs(Box, {
|
107
111
|
className: `tv-sb mr ${toggle ? "open" : ""}`,
|
108
112
|
sx: {
|
109
|
-
minHeight:
|
113
|
+
minHeight: "32px"
|
110
114
|
},
|
111
115
|
children: [/*#__PURE__*/_jsx(IconButton, {
|
112
116
|
type: "button",
|
113
117
|
sx: {
|
114
|
-
|
115
|
-
width:
|
116
|
-
height:
|
118
|
+
"& svg": {
|
119
|
+
width: "14px",
|
120
|
+
height: "14px"
|
117
121
|
}
|
118
122
|
},
|
119
123
|
"aria-label": "search",
|
@@ -137,12 +141,12 @@ const FilterView = props => {
|
|
137
141
|
className: ` ${sort?.length > 0 ? "active" : ""}`,
|
138
142
|
onClick: handleSortClick,
|
139
143
|
sx: {
|
140
|
-
|
144
|
+
"& svg": {
|
141
145
|
strokeWidth: 1.2
|
142
146
|
}
|
143
147
|
},
|
144
148
|
children: /*#__PURE__*/_jsx(Icon, {
|
145
|
-
icon:
|
149
|
+
icon: "sortBy"
|
146
150
|
})
|
147
151
|
}), /*#__PURE__*/_jsx(FilterSort, {
|
148
152
|
open: open,
|
@@ -152,7 +156,7 @@ const FilterView = props => {
|
|
152
156
|
}), !readOnly ? /*#__PURE__*/_jsx(IconButton, {
|
153
157
|
className: "mr",
|
154
158
|
sx: {
|
155
|
-
|
159
|
+
"& svg": {
|
156
160
|
fill: theme?.palette?.editor?.tv_stroke
|
157
161
|
}
|
158
162
|
},
|
@@ -162,7 +166,7 @@ const FilterView = props => {
|
|
162
166
|
className: "mr",
|
163
167
|
onClick: handleDeleteRow,
|
164
168
|
children: /*#__PURE__*/_jsx(Icon, {
|
165
|
-
icon:
|
169
|
+
icon: "trashIcon"
|
166
170
|
})
|
167
171
|
}) : null, !readOnly ? /*#__PURE__*/_jsxs(Menu, {
|
168
172
|
sx: classes.basicMenu,
|
@@ -185,24 +189,24 @@ const FilterView = props => {
|
|
185
189
|
onClick: onMenuClick("Duplicate"),
|
186
190
|
children: [" ", /*#__PURE__*/_jsx(Box, {
|
187
191
|
sx: {
|
188
|
-
marginRight:
|
189
|
-
display:
|
190
|
-
alignItems:
|
192
|
+
marginRight: "5px",
|
193
|
+
display: " flex",
|
194
|
+
alignItems: "center"
|
191
195
|
},
|
192
196
|
children: /*#__PURE__*/_jsx(Icon, {
|
193
|
-
icon:
|
197
|
+
icon: "duplicateIcon"
|
194
198
|
})
|
195
199
|
}), "Duplicate"]
|
196
200
|
}), /*#__PURE__*/_jsxs(MenuItem, {
|
197
201
|
onClick: onMenuClick("Delete"),
|
198
202
|
children: [" ", /*#__PURE__*/_jsx(Box, {
|
199
203
|
sx: {
|
200
|
-
marginRight:
|
201
|
-
display:
|
202
|
-
alignItems:
|
204
|
+
marginRight: "5px",
|
205
|
+
display: " flex",
|
206
|
+
alignItems: "center"
|
203
207
|
},
|
204
208
|
children: /*#__PURE__*/_jsx(Icon, {
|
205
|
-
icon:
|
209
|
+
icon: "trashIcon"
|
206
210
|
})
|
207
211
|
}), "Delete"]
|
208
212
|
})]
|
@@ -49,6 +49,7 @@ const SearchAttachment = props => {
|
|
49
49
|
background: `${theme?.palette?.containers?.slashBrainCardBg} !important`,
|
50
50
|
cursor: 'pointer',
|
51
51
|
margin: '4px 0px',
|
52
|
+
lineHeight: 1.43,
|
52
53
|
"&.MuiPaper-root.MuiPaper-rounded": {
|
53
54
|
borderRadius: "7px !important",
|
54
55
|
paddingTop: '0px !important'
|
@@ -185,6 +185,9 @@ const SearchAndDocList = ({
|
|
185
185
|
gap: 1,
|
186
186
|
children: [/*#__PURE__*/_jsx(Grid, {
|
187
187
|
item: true,
|
188
|
+
sx: {
|
189
|
+
maxWidth: 'calc(100% - 45px)'
|
190
|
+
},
|
188
191
|
children: /*#__PURE__*/_jsxs(Grid, {
|
189
192
|
container: true,
|
190
193
|
alignItems: "center",
|
@@ -207,6 +210,9 @@ const SearchAndDocList = ({
|
|
207
210
|
})
|
208
211
|
}), /*#__PURE__*/_jsx(Grid, {
|
209
212
|
item: true,
|
213
|
+
sx: {
|
214
|
+
maxWidth: '100%'
|
215
|
+
},
|
210
216
|
children: /*#__PURE__*/_jsx(Typography, {
|
211
217
|
sx: {
|
212
218
|
fontSize: "12px",
|
@@ -219,7 +225,8 @@ const SearchAndDocList = ({
|
|
219
225
|
maxWidth: '230px',
|
220
226
|
textAlign: 'left',
|
221
227
|
'@media only screen and (min-width: 350px) and (max-width: 899px)': {
|
222
|
-
maxWidth: '100%'
|
228
|
+
maxWidth: '100%',
|
229
|
+
width: '100%'
|
223
230
|
}
|
224
231
|
},
|
225
232
|
children: title
|
@@ -1,16 +1,18 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { useSlateStatic, useSelected, ReactEditor } from "slate-react";
|
3
3
|
import { Box } from "@mui/material";
|
4
|
-
|
4
|
+
import { getPageSettings } from "../../utils/pageSettings";
|
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";
|
11
12
|
import { createElement as _createElement } from "react";
|
12
13
|
const SimpleText = props => {
|
13
14
|
const {
|
15
|
+
theme,
|
14
16
|
openAI
|
15
17
|
} = useEditorContext() || {};
|
16
18
|
const editor = useSlateStatic();
|
@@ -26,10 +28,20 @@ const SimpleText = props => {
|
|
26
28
|
readOnly,
|
27
29
|
editorPlaceholder
|
28
30
|
} = customProps;
|
29
|
-
|
30
|
-
|
31
|
+
const {
|
32
|
+
element: pageSt
|
33
|
+
} = getPageSettings(editor) || {};
|
34
|
+
const {
|
35
|
+
pageColor
|
36
|
+
} = pageSt?.pageProps || {};
|
37
|
+
const {
|
38
|
+
activeBreakPoint
|
39
|
+
} = useEditorContext();
|
40
|
+
const lineHeight = element?.children[0]?.lineHeight;
|
41
|
+
const lineH = getBreakpointLineSpacing(lineHeight, activeBreakPoint);
|
31
42
|
const classes = SimpleTextStyle({
|
32
|
-
pageColor: "#FFFFFF"
|
43
|
+
pageColor: pageColor || theme?.palette?.editor?.background || "#FFFFFF",
|
44
|
+
lineHeight: lineH
|
33
45
|
});
|
34
46
|
const selected = useSelected();
|
35
47
|
const path = ReactEditor.findPath(editor, element);
|
@@ -47,14 +59,14 @@ const SimpleText = props => {
|
|
47
59
|
contentEditable: false,
|
48
60
|
className: "placeholder-simple-text",
|
49
61
|
children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? /*#__PURE__*/_jsxs(_Fragment, {
|
50
|
-
children: ["Type
|
62
|
+
children: ["Type ", /*#__PURE__*/_jsx("span", {
|
51
63
|
style: {
|
52
|
-
backgroundColor:
|
64
|
+
backgroundColor: '#F2F6FA',
|
53
65
|
padding: "0px 2px",
|
54
66
|
borderRadius: "2px"
|
55
67
|
},
|
56
68
|
children: "/"
|
57
|
-
}), "
|
69
|
+
}), " to browse elements"]
|
58
70
|
}) : "" : ""
|
59
71
|
}));
|
60
72
|
};
|
@@ -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";
|
@@ -30,16 +30,14 @@ const ToolTableComponent = props => {
|
|
30
30
|
const {
|
31
31
|
updateTableSelection
|
32
32
|
} = useTable();
|
33
|
-
return /*#__PURE__*/_jsx(
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
updateTableSelection(getDefaultTableSelection());
|
40
|
-
}
|
33
|
+
return /*#__PURE__*/_jsx(TableTool, {
|
34
|
+
theme: editorTheme,
|
35
|
+
handleToolAction: (type, option) => {
|
36
|
+
handleAction(type, option);
|
37
|
+
if (type === "duplicate") {
|
38
|
+
updateTableSelection(getDefaultTableSelection());
|
41
39
|
}
|
42
|
-
}
|
40
|
+
}
|
43
41
|
});
|
44
42
|
};
|
45
43
|
const MoreTableSettings = props => {
|
@@ -74,9 +72,11 @@ const MoreTableSettings = props => {
|
|
74
72
|
placement: "bottom-start",
|
75
73
|
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
76
74
|
onClickAway: () => setExpandTools(false),
|
77
|
-
children: /*#__PURE__*/_jsx(
|
78
|
-
|
79
|
-
|
75
|
+
children: /*#__PURE__*/_jsx("div", {
|
76
|
+
children: /*#__PURE__*/_jsx(ToolTableComponent, {
|
77
|
+
handleAction: handleAction,
|
78
|
+
editorTheme: editorTheme
|
79
|
+
})
|
80
80
|
})
|
81
81
|
})
|
82
82
|
});
|
@@ -206,7 +206,7 @@ const Table = props => {
|
|
206
206
|
}
|
207
207
|
}, theme);
|
208
208
|
const addRow = () => {
|
209
|
-
const lastRow = element
|
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
|
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
|
251
|
-
|
252
|
-
|
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
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
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,
|