@flozy/editor 5.9.1 → 5.9.3
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 +22 -15
- package/dist/Editor/Editor.css +22 -16
- package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
- package/dist/Editor/Elements/Button/EditorButton.js +3 -1
- package/dist/Editor/Elements/DataView/DataView.js +4 -3
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +8 -14
- 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/Grid/GridItem.js +1 -2
- package/dist/Editor/Elements/Link/Link.js +70 -43
- 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 +13 -11
- package/dist/Editor/Elements/SimpleText/style.js +5 -1
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Table/TableCell.js +14 -9
- package/dist/Editor/Elements/Title/title.js +13 -1
- package/dist/Editor/Elements/Variables/Style.js +28 -2
- package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
- package/dist/Editor/MiniEditor.js +4 -2
- 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 +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +5 -0
- 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 +31 -37
- package/dist/Editor/common/FontLoader/FontList.js +3 -11
- package/dist/Editor/common/FontLoader/FontLoader.js +75 -43
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
- package/dist/Editor/common/Section/index.js +78 -97
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
- 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/common/Uploader.js +8 -0
- package/dist/Editor/common/iconslist.js +1 -2
- package/dist/Editor/commonStyle.js +58 -57
- package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useEditorScroll.js +1 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +15 -4
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/helper.js +60 -19
- 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,13 +54,14 @@ const Item = /*#__PURE__*/forwardRef(({
|
|
54
54
|
});
|
55
55
|
});
|
56
56
|
Item.displayName = "Item";
|
57
|
-
const Element = props => {
|
57
|
+
const Element = /*#__PURE__*/React.memo(props => {
|
58
58
|
return /*#__PURE__*/_jsx(Section, {
|
59
59
|
...props,
|
60
60
|
children: getBlock(props)
|
61
61
|
});
|
62
|
-
};
|
63
|
-
|
62
|
+
});
|
63
|
+
Element.displayName = "Element";
|
64
|
+
const Leaf = /*#__PURE__*/React.memo(({
|
64
65
|
attributes,
|
65
66
|
children,
|
66
67
|
leaf
|
@@ -71,12 +72,13 @@ const Leaf = ({
|
|
71
72
|
...attributes,
|
72
73
|
children: children
|
73
74
|
});
|
74
|
-
};
|
75
|
+
});
|
76
|
+
Leaf.displayName = "Leaf";
|
75
77
|
const updateTopBanner = (content = [], setTopBanner) => {
|
76
|
-
setTopBanner(() => {
|
77
|
-
|
78
|
-
|
79
|
-
});
|
78
|
+
// setTopBanner(() => {
|
79
|
+
// const firstNode = content ? content[0] : {};
|
80
|
+
// return firstNode?.type === "topbanner" ? firstNode : null;
|
81
|
+
// });
|
80
82
|
};
|
81
83
|
const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
82
84
|
const {
|
@@ -96,7 +98,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
96
98
|
const editorWrapper = useRef();
|
97
99
|
const mentionsRef = useRef();
|
98
100
|
const convertedContent = draftToSlate({
|
99
|
-
data: content
|
101
|
+
data: content,
|
102
|
+
needLayout: otherProps?.needLayout
|
100
103
|
});
|
101
104
|
const [value, setValue] = useState(convertedContent);
|
102
105
|
const [isInteracted, setIsInteracted] = useState(false);
|
@@ -139,7 +142,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
139
142
|
pageColor,
|
140
143
|
color: pageTextColor,
|
141
144
|
pageWidth,
|
142
|
-
maxWidth: pageMaxWidth
|
145
|
+
maxWidth: pageMaxWidth,
|
146
|
+
lineHeight
|
143
147
|
} = pageSt?.pageProps || {
|
144
148
|
bannerSpacing: {
|
145
149
|
left: 0,
|
@@ -166,11 +170,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
166
170
|
const debounced = useDebouncedCallback(
|
167
171
|
// function
|
168
172
|
value => {
|
173
|
+
debouncedValue.current = value;
|
169
174
|
const {
|
170
175
|
value: strVal,
|
171
176
|
...restVal
|
172
177
|
} = getOnSaveData(value);
|
173
|
-
debouncedValue.current = value;
|
174
178
|
onSave(strVal, restVal);
|
175
179
|
},
|
176
180
|
// delay in ms
|
@@ -181,7 +185,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
181
185
|
return {
|
182
186
|
value: JSON.stringify(val),
|
183
187
|
text: text,
|
184
|
-
title: serializeToText(title?.children) || "
|
188
|
+
title: serializeToText(title?.children) || ""
|
185
189
|
};
|
186
190
|
};
|
187
191
|
const getPreviewImage = async (needBackground = false, options = {}) => {
|
@@ -311,7 +315,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
311
315
|
updateTopBanner(newValue, setTopBanner);
|
312
316
|
debounced(newValue);
|
313
317
|
if (!isInteracted) {
|
314
|
-
setIsInteracted(true);
|
318
|
+
// setIsInteracted(true);
|
315
319
|
}
|
316
320
|
}
|
317
321
|
};
|
@@ -330,6 +334,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
330
334
|
onDrawerOpen: onDrawerOpen,
|
331
335
|
ICON_API: "https://assets.agenciflow.com"
|
332
336
|
};
|
337
|
+
const lineH = getBreakpointLineSpacing(lineHeight, breakpoint);
|
333
338
|
const renderElement = useCallback(props => {
|
334
339
|
return /*#__PURE__*/_jsx(Element, {
|
335
340
|
...props,
|
@@ -532,6 +537,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
532
537
|
padding: {
|
533
538
|
...getTRBLBreakPoints(bannerSpacing)
|
534
539
|
},
|
540
|
+
lineHeight: lineH,
|
535
541
|
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
536
542
|
height: viewport.h ? `${viewport.h}px` : `100%`,
|
537
543
|
alignSelf: "center",
|
@@ -593,8 +599,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
593
599
|
setIsTextSelected: setIsTextSelected,
|
594
600
|
customProps: customProps,
|
595
601
|
editorWrapper: editorWrapper
|
596
|
-
}) : null, !readOnly
|
602
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
597
603
|
breakpoint: breakpoint,
|
604
|
+
show: showViewport,
|
598
605
|
onChange: b => onSwitchBreakpoint(b)
|
599
606
|
}) : null]
|
600
607
|
})
|
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;
|
@@ -1263,6 +1263,19 @@ blockquote {
|
|
1263
1263
|
pointer-events: auto;
|
1264
1264
|
}
|
1265
1265
|
|
1266
|
+
@media (max-width: 899px) {
|
1267
|
+
.MuiPopover-root {
|
1268
|
+
z-index: 1302 !important;
|
1269
|
+
}
|
1270
|
+
canvas {
|
1271
|
+
max-width: 100% !important;
|
1272
|
+
}
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
.settingsHeader {
|
1276
|
+
font-size: 14px !important;
|
1277
|
+
font-weight: 500 !important;
|
1278
|
+
}
|
1266
1279
|
.hideScroll {
|
1267
1280
|
overflow-anchor: none;
|
1268
1281
|
}
|
@@ -1278,20 +1291,6 @@ blockquote {
|
|
1278
1291
|
.hideScroll::-webkit-scrollbar-thumb:hover {
|
1279
1292
|
background: none !important;
|
1280
1293
|
}
|
1281
|
-
@media (max-width: 899px) {
|
1282
|
-
.MuiPopover-root {
|
1283
|
-
z-index: 1302 !important;
|
1284
|
-
}
|
1285
|
-
|
1286
|
-
canvas {
|
1287
|
-
max-width: 100% !important;
|
1288
|
-
}
|
1289
|
-
}
|
1290
|
-
|
1291
|
-
.settingsHeader {
|
1292
|
-
font-size: 14px !important;
|
1293
|
-
font-weight: 500 !important;
|
1294
|
-
}
|
1295
1294
|
|
1296
1295
|
.custom-scroll::-webkit-scrollbar {
|
1297
1296
|
height: .6rem;
|
@@ -1338,4 +1337,11 @@ code.markcode {
|
|
1338
1337
|
display: block;
|
1339
1338
|
background-color: #f3f3f3;
|
1340
1339
|
font-family: 'Source Code Pro' !important;
|
1341
|
-
}
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
/* Hide the popper when the reference is hidden */
|
1343
|
+
.hide-popper-on-overlap[data-popper-escaped],
|
1344
|
+
.hide-popper-on-overlap[data-popper-reference-hidden] {
|
1345
|
+
visibility: hidden;
|
1346
|
+
pointer-events: none;
|
1347
|
+
}
|
@@ -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", {
|
@@ -162,6 +162,7 @@ const EditorButton = props => {
|
|
162
162
|
display: "inline-flex",
|
163
163
|
color: "rgba(0, 0, 0, 0.54)",
|
164
164
|
marginBottom: "0px !important",
|
165
|
+
...classes.buttonMoreOption,
|
165
166
|
...classes.buttonMoreOption3
|
166
167
|
},
|
167
168
|
...btnProps,
|
@@ -264,11 +265,12 @@ const EditorButton = props => {
|
|
264
265
|
...btnSp,
|
265
266
|
borderStyle: borderStyle || "solid",
|
266
267
|
color: `${textColor || "#FFFFFF"}`,
|
267
|
-
fontSize: textSize || "
|
268
|
+
fontSize: textSize || "12px",
|
268
269
|
fontFamily: fontFamily || "PoppinsRegular",
|
269
270
|
display: "inline-flex",
|
270
271
|
alignItems: "center",
|
271
272
|
position: "relative",
|
273
|
+
lineHeight: 1.43,
|
272
274
|
"& .element-toolbar": {
|
273
275
|
display: "none"
|
274
276
|
},
|
@@ -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
|
@@ -104,9 +104,9 @@ export default function Select(props) {
|
|
104
104
|
return /*#__PURE__*/_jsx(Box, {
|
105
105
|
className: "tv-ms-tag-wrpr",
|
106
106
|
sx: {
|
107
|
-
|
108
|
-
marginRight:
|
109
|
-
|
107
|
+
'& svg': {
|
108
|
+
marginRight: '5px',
|
109
|
+
'& path': {
|
110
110
|
stroke: "#000"
|
111
111
|
}
|
112
112
|
}
|
@@ -125,21 +125,15 @@ export default function Select(props) {
|
|
125
125
|
sx: {
|
126
126
|
background: option?.color || appTheme?.palette?.editor?.tv_border1,
|
127
127
|
border: "none",
|
128
|
-
|
129
|
-
paddingLeft:
|
130
|
-
paddingRight: disabled ? "12px !important" : ""
|
128
|
+
'& .MuiChip-label': {
|
129
|
+
paddingLeft: '12px !important'
|
131
130
|
}
|
132
131
|
},
|
133
132
|
avatar: /*#__PURE__*/_jsx(AvatarIcon, {
|
134
133
|
option: option,
|
135
134
|
avatar: optionAvatar
|
136
135
|
}),
|
137
|
-
deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {
|
138
|
-
style: {
|
139
|
-
cursor: "pointer",
|
140
|
-
display: disabled ? "none" : ""
|
141
|
-
}
|
142
|
-
})
|
136
|
+
deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {})
|
143
137
|
}, key) : null;
|
144
138
|
})
|
145
139
|
});
|
@@ -155,8 +149,8 @@ export default function Select(props) {
|
|
155
149
|
label: option.label || option.value || "",
|
156
150
|
sx: {
|
157
151
|
background: option.color || appTheme?.palette?.editor?.tv_border1,
|
158
|
-
|
159
|
-
paddingLeft:
|
152
|
+
'& .MuiChip-label': {
|
153
|
+
paddingLeft: '12px !important'
|
160
154
|
}
|
161
155
|
},
|
162
156
|
avatar: /*#__PURE__*/_jsx(AvatarIcon, {
|
@@ -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
|
})]
|
@@ -50,8 +50,7 @@ const GridItemToolbar = props => {
|
|
50
50
|
open: true,
|
51
51
|
placement: "top-end",
|
52
52
|
sx: classes.popTools,
|
53
|
-
className: "gi-tool-pp",
|
54
|
-
disablePortal: true,
|
53
|
+
className: "gi-tool-pp hide-popper-on-overlap",
|
55
54
|
contentEditable: false,
|
56
55
|
children: /*#__PURE__*/_jsxs(Box, {
|
57
56
|
className: "ico-grp-ss",
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import React, { useState } from "react";
|
1
|
+
import React, { useRef, useState } from "react";
|
2
2
|
import { Node, Transforms } from "slate";
|
3
|
-
import { ReactEditor,
|
4
|
-
import { Box, IconButton, Tooltip } from "@mui/material";
|
3
|
+
import { ReactEditor, useSelected, useSlateStatic } from "slate-react";
|
4
|
+
import { Box, IconButton, Popper, Tooltip } from "@mui/material";
|
5
5
|
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
6
6
|
import EditIcon from "@mui/icons-material/Edit";
|
7
7
|
import LinkOffIcon from "@mui/icons-material/LinkOff";
|
@@ -11,6 +11,62 @@ import { getLinkType, handleLinkType } from "../../utils/helper";
|
|
11
11
|
import LinkSettings from "../../common/LinkSettings";
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
|
+
const Toolbar = props => {
|
15
|
+
const {
|
16
|
+
urlPath,
|
17
|
+
linkType,
|
18
|
+
showInNewTab,
|
19
|
+
selected,
|
20
|
+
linkRef,
|
21
|
+
onEditLink,
|
22
|
+
editor
|
23
|
+
} = props;
|
24
|
+
const btnProps = handleLinkType(urlPath, linkType, true, showInNewTab === "_blank");
|
25
|
+
const navType = getLinkType(linkType, urlPath);
|
26
|
+
const hideOpenLink = navType === "page" || !navType;
|
27
|
+
return selected ? /*#__PURE__*/_jsx(Popper, {
|
28
|
+
anchorEl: linkRef?.current,
|
29
|
+
open: true,
|
30
|
+
placement: "top-start",
|
31
|
+
className: "hide-popper-on-overlap",
|
32
|
+
contentEditable: false,
|
33
|
+
style: {
|
34
|
+
zIndex: 1
|
35
|
+
},
|
36
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
37
|
+
className: "element-toolbar hr",
|
38
|
+
style: {
|
39
|
+
width: "150px",
|
40
|
+
display: "flex",
|
41
|
+
position: "unset"
|
42
|
+
},
|
43
|
+
component: "div",
|
44
|
+
children: [hideOpenLink ? null : /*#__PURE__*/_jsx(Tooltip, {
|
45
|
+
title: "Open",
|
46
|
+
children: /*#__PURE__*/_jsx(Box, {
|
47
|
+
sx: {
|
48
|
+
display: "inline-flex",
|
49
|
+
color: "rgba(0, 0, 0, 0.54)"
|
50
|
+
},
|
51
|
+
...btnProps,
|
52
|
+
children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
|
53
|
+
})
|
54
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
55
|
+
title: "Edit",
|
56
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
57
|
+
onClick: onEditLink,
|
58
|
+
children: /*#__PURE__*/_jsx(EditIcon, {})
|
59
|
+
})
|
60
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
61
|
+
title: "Remove",
|
62
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
63
|
+
onClick: () => removeLink(editor),
|
64
|
+
children: /*#__PURE__*/_jsx(LinkOffIcon, {})
|
65
|
+
})
|
66
|
+
})]
|
67
|
+
})
|
68
|
+
}) : null;
|
69
|
+
};
|
14
70
|
const linkStyles = () => ({
|
15
71
|
linkBtn: {
|
16
72
|
border: "none",
|
@@ -40,7 +96,6 @@ const Link = props => {
|
|
40
96
|
} = customProps;
|
41
97
|
const editor = useSlateStatic();
|
42
98
|
const selected = useSelected();
|
43
|
-
const focused = useFocused();
|
44
99
|
const [showInput, setShowInput] = useState(false);
|
45
100
|
const [linkData, setLinkData] = useState({
|
46
101
|
name: "",
|
@@ -53,6 +108,7 @@ const Link = props => {
|
|
53
108
|
const showInNewTab = element?.showInNewTab || element?.target;
|
54
109
|
const linkType = element?.linkType;
|
55
110
|
const classes = linkStyles();
|
111
|
+
const linkRef = useRef(null);
|
56
112
|
const updateLink = data => {
|
57
113
|
Transforms.setNodes(editor, data, {
|
58
114
|
at: path
|
@@ -77,54 +133,25 @@ const Link = props => {
|
|
77
133
|
const handleClose = () => {
|
78
134
|
setShowInput(false);
|
79
135
|
};
|
80
|
-
const Toolbar = () => {
|
81
|
-
const btnProps = handleLinkType(urlPath, linkType, true, showInNewTab === "_blank");
|
82
|
-
const navType = getLinkType(linkType, urlPath);
|
83
|
-
const hideOpenLink = navType === "page" || !navType;
|
84
|
-
return selected && focused ? /*#__PURE__*/_jsxs("div", {
|
85
|
-
className: "element-toolbar hr",
|
86
|
-
contentEditable: false,
|
87
|
-
style: {
|
88
|
-
width: "150px",
|
89
|
-
top: "100%",
|
90
|
-
left: "0px",
|
91
|
-
display: "flex"
|
92
|
-
},
|
93
|
-
children: [hideOpenLink ? null : /*#__PURE__*/_jsx(Tooltip, {
|
94
|
-
title: "Open",
|
95
|
-
children: /*#__PURE__*/_jsx(Box, {
|
96
|
-
sx: {
|
97
|
-
display: "inline-flex",
|
98
|
-
color: "rgba(0, 0, 0, 0.54)"
|
99
|
-
},
|
100
|
-
...btnProps,
|
101
|
-
children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
|
102
|
-
})
|
103
|
-
}), /*#__PURE__*/_jsx(Tooltip, {
|
104
|
-
title: "Edit",
|
105
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
106
|
-
onClick: onEditLink,
|
107
|
-
children: /*#__PURE__*/_jsx(EditIcon, {})
|
108
|
-
})
|
109
|
-
}), /*#__PURE__*/_jsx(Tooltip, {
|
110
|
-
title: "Remove",
|
111
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
112
|
-
onClick: () => removeLink(editor),
|
113
|
-
children: /*#__PURE__*/_jsx(LinkOffIcon, {})
|
114
|
-
})
|
115
|
-
})]
|
116
|
-
}) : null;
|
117
|
-
};
|
118
136
|
const buttonProps = handleLinkType(urlPath, linkType, readOnly, showInNewTab === "_blank");
|
119
137
|
return /*#__PURE__*/_jsxs("div", {
|
120
138
|
className: "link",
|
139
|
+
ref: linkRef,
|
121
140
|
children: [/*#__PURE__*/_jsx(Box, {
|
122
141
|
...attributes,
|
123
142
|
...element.attr,
|
124
143
|
sx: classes.linkBtn,
|
125
144
|
...buttonProps,
|
126
145
|
children: children
|
127
|
-
}), /*#__PURE__*/_jsx(Toolbar, {
|
146
|
+
}), /*#__PURE__*/_jsx(Toolbar, {
|
147
|
+
urlPath: urlPath,
|
148
|
+
linkType: linkType,
|
149
|
+
showInNewTab: showInNewTab,
|
150
|
+
selected: selected,
|
151
|
+
linkRef: linkRef,
|
152
|
+
onEditLink: onEditLink,
|
153
|
+
editor: editor
|
154
|
+
}), showInput ? /*#__PURE__*/_jsx(LinkSettings, {
|
128
155
|
handleClose: handleClose,
|
129
156
|
onSave: ({
|
130
157
|
linkType,
|