@flozy/editor 5.3.0 → 5.3.2
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 +25 -34
- package/dist/Editor/CommonEditor.js +20 -12
- package/dist/Editor/Editor.css +28 -15
- package/dist/Editor/Elements/AI/AIInput.js +0 -3
- package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
- package/dist/Editor/Elements/Button/EditorButton.js +8 -2
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +4 -2
- package/dist/Editor/Elements/DataView/DataView.js +124 -0
- package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +67 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +35 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +74 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -0
- package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +37 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +60 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +112 -0
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +80 -0
- package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
- package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +281 -0
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +74 -0
- package/dist/Editor/Elements/DataView/styles.js +154 -0
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +2 -1
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
- package/dist/Editor/Elements/SimpleText/index.js +8 -1
- package/dist/Editor/Elements/SimpleText/style.js +10 -1
- package/dist/Editor/Elements/Table/Table.js +1 -1
- package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
- package/dist/Editor/Styles/EditorStyles.js +7 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -0
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
- package/dist/Editor/Toolbar/Toolbar.js +6 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
- package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
- package/dist/Editor/common/Icon.js +6 -0
- package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
- package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
- package/dist/Editor/common/RnD/ShadowElement.js +1 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -6
- package/dist/Editor/common/RnD/index.js +3 -2
- package/dist/Editor/common/Shorthands/elements.js +13 -1
- 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/iconListV2.js +53 -53
- package/dist/Editor/common/iconslist.js +6 -3
- package/dist/Editor/commonStyle.js +9 -0
- package/dist/Editor/helper/enforceDateFormat.js +41 -0
- package/dist/Editor/helper/index.js +16 -3
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/plugins/withEmbeds.js +30 -26
- package/dist/Editor/plugins/withHTML.js +47 -12
- package/dist/Editor/plugins/withLayout.js +42 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +27 -4
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +26 -1
- package/dist/Editor/utils/dataView.js +43 -0
- package/dist/Editor/utils/events.js +0 -1
- package/dist/Editor/utils/helper.js +51 -1
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/dist/Editor/utils/serializeToText.js +2 -0
- package/package.json +1 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useRef, useState, useEffect, useImperativeHandle, forwardRef } from "react";
|
|
2
2
|
import { Editable, Slate, ReactEditor } from 'slate-react';
|
|
3
3
|
import { createEditor, Transforms, Editor } from 'slate';
|
|
4
|
-
import { useDebounce } from "use-debounce";
|
|
5
4
|
import withCommon from "./hooks/withCommon";
|
|
6
|
-
import { getBlock, getMarked } from "./utils/chatEditor/SlateUtilityFunctions";
|
|
5
|
+
import { getBlock, getMarked, serializeMentions } from "./utils/chatEditor/SlateUtilityFunctions";
|
|
7
6
|
import MiniTextFormat from "./Toolbar/PopupTool/MiniTextFormat";
|
|
8
7
|
import { commands, mentionsEvent } from "./utils/events";
|
|
9
8
|
import { insertEmoji } from "./utils/emoji";
|
|
@@ -15,6 +14,7 @@ import Shorthands from "./common/Shorthands";
|
|
|
15
14
|
import usePopupStyle from "./Toolbar/PopupTool/PopupToolStyle";
|
|
16
15
|
import { EditorProvider } from "./hooks/useMouseMove";
|
|
17
16
|
import decorators from "./utils/Decorators";
|
|
17
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -42,8 +42,18 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
42
42
|
});
|
|
43
43
|
const [isInteracted, setIsInteracted] = useState(false);
|
|
44
44
|
const [value, setValue] = useState(convertedContent);
|
|
45
|
-
const
|
|
46
|
-
const
|
|
45
|
+
const debouncedValue = useRef(value);
|
|
46
|
+
const debounced = useDebouncedCallback(
|
|
47
|
+
// function
|
|
48
|
+
value => {
|
|
49
|
+
const {
|
|
50
|
+
value: strVal,
|
|
51
|
+
...restVal
|
|
52
|
+
} = getOnSaveData(value);
|
|
53
|
+
onSave(strVal, restVal);
|
|
54
|
+
},
|
|
55
|
+
// delay in ms
|
|
56
|
+
500);
|
|
47
57
|
const editor = useMemo(() => {
|
|
48
58
|
return withCommon(createEditor(), {
|
|
49
59
|
needLayout,
|
|
@@ -63,7 +73,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
63
73
|
const {
|
|
64
74
|
value: strVal,
|
|
65
75
|
...restVal
|
|
66
|
-
} = getOnSaveData(
|
|
76
|
+
} = getOnSaveData(debouncedValue?.current);
|
|
67
77
|
onsubmit(false, {
|
|
68
78
|
strVal,
|
|
69
79
|
restVal
|
|
@@ -99,7 +109,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
99
109
|
const newValue = draftToSlate({
|
|
100
110
|
data: content
|
|
101
111
|
});
|
|
102
|
-
|
|
112
|
+
debounced(newValue);
|
|
113
|
+
|
|
103
114
|
// setTimeout(() => {
|
|
104
115
|
if (editor.children.length === 0) {
|
|
105
116
|
Transforms.insertNodes(editor, newValue);
|
|
@@ -112,27 +123,14 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
112
123
|
}
|
|
113
124
|
}
|
|
114
125
|
}));
|
|
115
|
-
|
|
116
|
-
// useEffect(() => {
|
|
117
|
-
// setIsExternalUpdate(true);
|
|
118
|
-
// setValue(draftToSlate({ data: content }));
|
|
119
|
-
// }, [content]);
|
|
120
|
-
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
if (JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
|
123
|
-
const {
|
|
124
|
-
value: strVal,
|
|
125
|
-
...restVal
|
|
126
|
-
} = getOnSaveData(deboundedValue);
|
|
127
|
-
onSave(strVal, restVal);
|
|
128
|
-
}
|
|
129
|
-
}, [deboundedValue]);
|
|
130
126
|
const getOnSaveData = val => {
|
|
131
127
|
const text = serializeToText(val);
|
|
128
|
+
const mentions = serializeMentions(val);
|
|
132
129
|
const title = val?.find(f => f.type === "title");
|
|
133
130
|
return {
|
|
134
131
|
value: JSON.stringify(val),
|
|
135
132
|
text: text,
|
|
133
|
+
mentions: mentions,
|
|
136
134
|
title: serializeToText(title?.children) || "Untitled"
|
|
137
135
|
};
|
|
138
136
|
};
|
|
@@ -180,15 +178,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
180
178
|
});
|
|
181
179
|
};
|
|
182
180
|
const handleEditorChange = newValue => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const {
|
|
186
|
-
value: strVal,
|
|
187
|
-
...restVal
|
|
188
|
-
} = getOnSaveData(newValue);
|
|
189
|
-
onSave(strVal, restVal);
|
|
190
|
-
}
|
|
191
|
-
setValue(newValue);
|
|
181
|
+
debounced(newValue);
|
|
182
|
+
debouncedValue.current = newValue;
|
|
192
183
|
if (!isInteracted) {
|
|
193
184
|
setIsInteracted(true);
|
|
194
185
|
}
|
|
@@ -228,7 +219,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
228
219
|
editor
|
|
229
220
|
});
|
|
230
221
|
} else if (event.key === "Enter" && !isMobile) {
|
|
231
|
-
const isEmpty =
|
|
222
|
+
const isEmpty = debouncedValue?.current.length === 1 && debouncedValue?.current[0].type === 'paragraph' && debouncedValue?.current[0].children.length === 1 && debouncedValue?.current[0].children[0].text === '';
|
|
232
223
|
if (isEmpty) {
|
|
233
224
|
event.preventDefault();
|
|
234
225
|
return;
|
|
@@ -237,7 +228,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
237
228
|
const {
|
|
238
229
|
value: strVal,
|
|
239
230
|
...restVal
|
|
240
|
-
} = getOnSaveData(
|
|
231
|
+
} = getOnSaveData(debouncedValue?.current);
|
|
241
232
|
onsubmit(false, {
|
|
242
233
|
strVal,
|
|
243
234
|
restVal
|
|
@@ -251,7 +242,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
251
242
|
const {
|
|
252
243
|
value: strVal,
|
|
253
244
|
...restVal
|
|
254
|
-
} = getOnSaveData(
|
|
245
|
+
} = getOnSaveData(debouncedValue?.current);
|
|
255
246
|
onBlur({
|
|
256
247
|
strVal,
|
|
257
248
|
restVal
|
|
@@ -272,7 +263,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
272
263
|
editor: editor,
|
|
273
264
|
children: /*#__PURE__*/_jsxs(Slate, {
|
|
274
265
|
editor: editor,
|
|
275
|
-
initialValue:
|
|
266
|
+
initialValue: debouncedValue?.current,
|
|
276
267
|
onChange: handleEditorChange,
|
|
277
268
|
children: [toolBar && /*#__PURE__*/_jsx(MiniTextFormat, {
|
|
278
269
|
classes: classes,
|
|
@@ -26,8 +26,8 @@ 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";
|
|
30
|
-
import { handleInsertLastElement, isFreeGrid, isFreeGridFragment, isPageSettings, outsideEditorClickLabel } from "./utils/helper";
|
|
29
|
+
import { getBreakpointLineSpacing, getTRBLBreakPoints } from "./helper/theme";
|
|
30
|
+
import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isPageSettings, outsideEditorClickLabel } from "./utils/helper";
|
|
31
31
|
import useWindowResize from "./hooks/useWindowResize";
|
|
32
32
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
|
33
33
|
import RnDCopy from "./common/RnD/RnDCopy";
|
|
@@ -124,7 +124,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
124
124
|
} = otherProps || {};
|
|
125
125
|
const editor = useMemo(() => {
|
|
126
126
|
if (collaborativeEditor) return collaborativeEditor;
|
|
127
|
-
|
|
127
|
+
const editor = createEditor();
|
|
128
|
+
editor.needLayout = needLayout;
|
|
129
|
+
return withCommon(editor, {
|
|
128
130
|
needLayout
|
|
129
131
|
});
|
|
130
132
|
}, [collaborativeEditor]);
|
|
@@ -137,7 +139,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
137
139
|
pageColor,
|
|
138
140
|
color: pageTextColor,
|
|
139
141
|
pageWidth,
|
|
140
|
-
maxWidth: pageMaxWidth
|
|
142
|
+
maxWidth: pageMaxWidth,
|
|
143
|
+
lineHeight
|
|
141
144
|
} = pageSt?.pageProps || {
|
|
142
145
|
bannerSpacing: {
|
|
143
146
|
left: 0,
|
|
@@ -305,11 +308,13 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
305
308
|
hideTools: updatedHideTools || []
|
|
306
309
|
}) : [];
|
|
307
310
|
const handleEditorChange = newValue => {
|
|
308
|
-
if (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
if (!readOnly) {
|
|
312
|
+
if (JSON.stringify(newValue) !== JSON.stringify(debouncedValue?.current)) {
|
|
313
|
+
updateTopBanner(newValue, setTopBanner);
|
|
314
|
+
debounced(newValue);
|
|
315
|
+
if (!isInteracted) {
|
|
316
|
+
setIsInteracted(true);
|
|
317
|
+
}
|
|
313
318
|
}
|
|
314
319
|
}
|
|
315
320
|
};
|
|
@@ -328,6 +333,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
328
333
|
onDrawerOpen: onDrawerOpen,
|
|
329
334
|
ICON_API: "https://assets.agenciflow.com"
|
|
330
335
|
};
|
|
336
|
+
const lineH = getBreakpointLineSpacing(lineHeight, breakpoint);
|
|
331
337
|
const renderElement = useCallback(props => {
|
|
332
338
|
return /*#__PURE__*/_jsx(Element, {
|
|
333
339
|
...props,
|
|
@@ -501,12 +507,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
501
507
|
,
|
|
502
508
|
children: /*#__PURE__*/_jsxs(Slate, {
|
|
503
509
|
editor: editor,
|
|
504
|
-
initialValue: debouncedValue?.current,
|
|
510
|
+
initialValue: getInitialValue(debouncedValue?.current, readOnly),
|
|
505
511
|
onChange: handleEditorChange,
|
|
506
512
|
children: [/*#__PURE__*/_jsx(DragAndDrop, {
|
|
507
513
|
children: /*#__PURE__*/_jsxs(Overlay, {
|
|
508
514
|
children: [/*#__PURE__*/_jsx(Box, {
|
|
509
|
-
className: `pc-${editorClass || ""} ${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} scrollable-content scrollSmooth`,
|
|
515
|
+
className: `pc-${editorClass || ""} ${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} scrollable-content scrollSmooth ${readOnly ? "readOnlyContainer" : ""}`,
|
|
510
516
|
sx: classes.slateWrapper,
|
|
511
517
|
id: "slate-wrapper-scroll-container",
|
|
512
518
|
ref: editorWrapper,
|
|
@@ -530,6 +536,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
530
536
|
padding: {
|
|
531
537
|
...getTRBLBreakPoints(bannerSpacing)
|
|
532
538
|
},
|
|
539
|
+
lineHeight: lineH,
|
|
533
540
|
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
|
534
541
|
height: viewport.h ? `${viewport.h}px` : `100%`,
|
|
535
542
|
alignSelf: "center",
|
|
@@ -587,8 +594,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
587
594
|
setIsTextSelected: setIsTextSelected,
|
|
588
595
|
customProps: customProps,
|
|
589
596
|
editorWrapper: editorWrapper
|
|
590
|
-
}) : null, !readOnly
|
|
597
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
|
591
598
|
breakpoint: breakpoint,
|
|
599
|
+
show: showViewport,
|
|
592
600
|
onChange: b => onSwitchBreakpoint(b)
|
|
593
601
|
}) : null]
|
|
594
602
|
})
|
package/dist/Editor/Editor.css
CHANGED
|
@@ -149,7 +149,7 @@ blockquote {
|
|
|
149
149
|
.grid-item-toolbar button,
|
|
150
150
|
.element-toolbar button,
|
|
151
151
|
.element-toolbar a {
|
|
152
|
-
border-radius:
|
|
152
|
+
border-radius: 50%;
|
|
153
153
|
border: 1px solid rgba(37, 99, 235, 0.32);
|
|
154
154
|
background: #fff;
|
|
155
155
|
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.16);
|
|
@@ -1236,6 +1236,19 @@ blockquote {
|
|
|
1236
1236
|
pointer-events: auto;
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
1239
|
+
@media (max-width: 899px) {
|
|
1240
|
+
.MuiPopover-root {
|
|
1241
|
+
z-index: 1302 !important;
|
|
1242
|
+
}
|
|
1243
|
+
canvas {
|
|
1244
|
+
max-width: 100% !important;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
.settingsHeader {
|
|
1249
|
+
font-size: 14px !important;
|
|
1250
|
+
font-weight: 500 !important;
|
|
1251
|
+
}
|
|
1239
1252
|
.hideScroll {
|
|
1240
1253
|
overflow-anchor: none;
|
|
1241
1254
|
}
|
|
@@ -1251,20 +1264,6 @@ blockquote {
|
|
|
1251
1264
|
.hideScroll::-webkit-scrollbar-thumb:hover {
|
|
1252
1265
|
background: none !important;
|
|
1253
1266
|
}
|
|
1254
|
-
@media (max-width: 899px) {
|
|
1255
|
-
.MuiPopover-root {
|
|
1256
|
-
z-index: 1302 !important;
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
canvas {
|
|
1260
|
-
max-width: 100% !important;
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
.settingsHeader {
|
|
1265
|
-
font-size: 14px !important;
|
|
1266
|
-
font-weight: 500 !important;
|
|
1267
|
-
}
|
|
1268
1267
|
|
|
1269
1268
|
.custom-scroll::-webkit-scrollbar {
|
|
1270
1269
|
height: .6rem;
|
|
@@ -1284,3 +1283,17 @@ blockquote {
|
|
|
1284
1283
|
background: #A7AEC1;
|
|
1285
1284
|
}
|
|
1286
1285
|
|
|
1286
|
+
::selection {
|
|
1287
|
+
color: inherit;
|
|
1288
|
+
background: rgba(35, 131, 226, 0.35) !important;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
::-moz-selection {
|
|
1292
|
+
background: rgba(35, 131, 226, 0.35) !important;
|
|
1293
|
+
color: inherit;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
::-webkit-selection {
|
|
1297
|
+
background: rgba(35, 131, 226, 0.35) !important;
|
|
1298
|
+
color: inherit;
|
|
1299
|
+
}
|
|
@@ -71,9 +71,6 @@ function AIInput({
|
|
|
71
71
|
}, [openAI]);
|
|
72
72
|
const isSendBtnDisabled = !inputValue || loading;
|
|
73
73
|
const props = getProps(openAI, generatedText) || {};
|
|
74
|
-
|
|
75
|
-
// const fromToolBar = openAI === "fromToolBar";
|
|
76
|
-
|
|
77
74
|
const handleSendBtnClick = () => {
|
|
78
75
|
if (isSendBtnDisabled) {
|
|
79
76
|
return;
|
|
@@ -250,10 +250,10 @@ function AppHeader(props) {
|
|
|
250
250
|
},
|
|
251
251
|
sx: {
|
|
252
252
|
mr: 2,
|
|
253
|
-
[theme
|
|
253
|
+
[theme?.breakpoints?.up("sm")]: {
|
|
254
254
|
display: "none"
|
|
255
255
|
},
|
|
256
|
-
[theme
|
|
256
|
+
[theme?.breakpoints.between("xs", "md")]: {
|
|
257
257
|
display: "block"
|
|
258
258
|
}
|
|
259
259
|
},
|
|
@@ -272,10 +272,10 @@ function AppHeader(props) {
|
|
|
272
272
|
},
|
|
273
273
|
sx: {
|
|
274
274
|
flexGrow: 1,
|
|
275
|
-
[theme
|
|
275
|
+
[theme?.breakpoints?.up("sm")]: {
|
|
276
276
|
display: "block"
|
|
277
277
|
},
|
|
278
|
-
[theme
|
|
278
|
+
[theme?.breakpoints?.between("xs", "md")]: {
|
|
279
279
|
display: "none"
|
|
280
280
|
},
|
|
281
281
|
"& img": {
|
|
@@ -293,10 +293,10 @@ function AppHeader(props) {
|
|
|
293
293
|
}) : null, appTitle]
|
|
294
294
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
295
295
|
sx: {
|
|
296
|
-
[theme
|
|
296
|
+
[theme?.breakpoints?.up("sm")]: {
|
|
297
297
|
display: "block"
|
|
298
298
|
},
|
|
299
|
-
[theme
|
|
299
|
+
[theme?.breakpoints?.between("xs", "md")]: {
|
|
300
300
|
display: "none"
|
|
301
301
|
}
|
|
302
302
|
},
|
|
@@ -11,6 +11,7 @@ import { handleLinkType, windowVar } from "../../utils/helper";
|
|
|
11
11
|
import LinkSettings from "../../common/LinkSettings";
|
|
12
12
|
import Icon from "../../common/Icon";
|
|
13
13
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
14
|
+
import useCommonStyle from "../../commonStyle";
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -36,6 +37,7 @@ const EditorButton = props => {
|
|
|
36
37
|
const [edit, setEdit] = useState(false);
|
|
37
38
|
const [openNav, setOpenNav] = useState(false);
|
|
38
39
|
const [openMoreOptions, setOpenMoreOptions] = useState(false);
|
|
40
|
+
const classes = useCommonStyle(appTheme);
|
|
39
41
|
const {
|
|
40
42
|
label,
|
|
41
43
|
bgColor,
|
|
@@ -136,6 +138,7 @@ const EditorButton = props => {
|
|
|
136
138
|
arrow: true,
|
|
137
139
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
138
140
|
onClick: onMenuClick("edit"),
|
|
141
|
+
sx: classes.buttonMoreOption,
|
|
139
142
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
140
143
|
icon: "pagesSettings"
|
|
141
144
|
})
|
|
@@ -145,6 +148,7 @@ const EditorButton = props => {
|
|
|
145
148
|
arrow: true,
|
|
146
149
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
147
150
|
onClick: onMenuClick("nav"),
|
|
151
|
+
sx: classes.buttonMoreOption,
|
|
148
152
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
149
153
|
icon: "link"
|
|
150
154
|
})
|
|
@@ -157,7 +161,8 @@ const EditorButton = props => {
|
|
|
157
161
|
sx: {
|
|
158
162
|
display: "inline-flex",
|
|
159
163
|
color: "rgba(0, 0, 0, 0.54)",
|
|
160
|
-
marginBottom: "0px !important"
|
|
164
|
+
marginBottom: "0px !important",
|
|
165
|
+
...classes.buttonMoreOption
|
|
161
166
|
},
|
|
162
167
|
...btnProps,
|
|
163
168
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
@@ -259,11 +264,12 @@ const EditorButton = props => {
|
|
|
259
264
|
...btnSp,
|
|
260
265
|
borderStyle: borderStyle || "solid",
|
|
261
266
|
color: `${textColor || "#FFFFFF"}`,
|
|
262
|
-
fontSize: textSize || "
|
|
267
|
+
fontSize: textSize || "12px",
|
|
263
268
|
fontFamily: fontFamily || "PoppinsRegular",
|
|
264
269
|
display: "inline-flex",
|
|
265
270
|
alignItems: "center",
|
|
266
271
|
position: "relative",
|
|
272
|
+
lineHeight: 1.43,
|
|
267
273
|
"& .element-toolbar": {
|
|
268
274
|
display: "none"
|
|
269
275
|
},
|
|
@@ -109,11 +109,13 @@ const ColorButtons = props => {
|
|
|
109
109
|
forMiniTool,
|
|
110
110
|
openColorTool,
|
|
111
111
|
onClose,
|
|
112
|
-
onColorPickerClick
|
|
112
|
+
onColorPickerClick,
|
|
113
|
+
defaultColors = []
|
|
113
114
|
} = props;
|
|
114
115
|
const [row1, ...restRows] = ColorChunks([]);
|
|
115
116
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
116
117
|
const open = Boolean(anchorEl);
|
|
118
|
+
const firstRow = defaultColors?.length ? defaultColors : row1;
|
|
117
119
|
const handleMore = e => {
|
|
118
120
|
setAnchorEl(e.currentTarget);
|
|
119
121
|
};
|
|
@@ -131,7 +133,7 @@ const ColorButtons = props => {
|
|
|
131
133
|
sx: classes.colorButtons,
|
|
132
134
|
children: [forMiniTool ? null : /*#__PURE__*/_jsx(Box, {
|
|
133
135
|
className: "buttonsWrpr first",
|
|
134
|
-
children: [
|
|
136
|
+
children: [firstRow].map((m, i) => {
|
|
135
137
|
return /*#__PURE__*/_jsx(SingleColorButton, {
|
|
136
138
|
id: `p1_${id}`,
|
|
137
139
|
crs: m,
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Node, Path, Transforms } from "slate";
|
|
3
|
+
import { ReactEditor, useSlateStatic } from "slate-react";
|
|
4
|
+
import { Box, useTheme } from "@mui/material";
|
|
5
|
+
import { DataViewProvider } from "./Providers/DataViewProvider";
|
|
6
|
+
import useDataViewStyles from "./styles";
|
|
7
|
+
import LayoutView from "./Layouts";
|
|
8
|
+
import FilterView from "./Layouts/FilterView";
|
|
9
|
+
import { insertLineBreakAtEndOfPath } from "../../utils/helper";
|
|
10
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const DataView = props => {
|
|
14
|
+
const {
|
|
15
|
+
theme: appTheme
|
|
16
|
+
} = useEditorContext();
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const editor = useSlateStatic();
|
|
19
|
+
const {
|
|
20
|
+
attributes,
|
|
21
|
+
children,
|
|
22
|
+
element,
|
|
23
|
+
customProps
|
|
24
|
+
} = props;
|
|
25
|
+
const {
|
|
26
|
+
CHARACTERS,
|
|
27
|
+
readOnly
|
|
28
|
+
} = customProps || {};
|
|
29
|
+
const {
|
|
30
|
+
properties,
|
|
31
|
+
layouts,
|
|
32
|
+
rows,
|
|
33
|
+
title
|
|
34
|
+
} = element;
|
|
35
|
+
const classes = useDataViewStyles(theme, appTheme);
|
|
36
|
+
const path = ReactEditor.findPath(editor, element);
|
|
37
|
+
const users = CHARACTERS?.map(m => {
|
|
38
|
+
const name = [m?.first_name || "", m?.last_name || ""]?.join(" ").trim();
|
|
39
|
+
return {
|
|
40
|
+
value: m?.email,
|
|
41
|
+
name: name || m?.username || m?.email,
|
|
42
|
+
avatar: m?.avatar || null
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
const onDuplicate = () => {
|
|
46
|
+
try {
|
|
47
|
+
const newPath = ReactEditor.findPath(editor, element);
|
|
48
|
+
const dataViewNode = Node.get(editor, newPath);
|
|
49
|
+
const cloneNode = JSON.parse(JSON.stringify(dataViewNode));
|
|
50
|
+
const toPath = Path.next(Path.parent(newPath));
|
|
51
|
+
Transforms.insertNodes(editor, [{
|
|
52
|
+
type: "paragraph",
|
|
53
|
+
children: [{
|
|
54
|
+
...cloneNode
|
|
55
|
+
}]
|
|
56
|
+
}], {
|
|
57
|
+
at: toPath
|
|
58
|
+
});
|
|
59
|
+
} catch (err) {
|
|
60
|
+
console.log(err);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const onDelete = () => {
|
|
64
|
+
try {
|
|
65
|
+
const newPath = ReactEditor.findPath(editor, element);
|
|
66
|
+
Transforms.removeNodes(editor, {
|
|
67
|
+
at: newPath
|
|
68
|
+
});
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.log(err);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const onEnter = () => {
|
|
74
|
+
try {
|
|
75
|
+
const newPath = ReactEditor.findPath(editor, element);
|
|
76
|
+
const toPath = Path.previous(Path.parent(newPath));
|
|
77
|
+
insertLineBreakAtEndOfPath(editor, toPath);
|
|
78
|
+
} catch (err) {
|
|
79
|
+
console.log(err);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const onTitleChange = value => {
|
|
83
|
+
try {
|
|
84
|
+
Transforms.setNodes(editor, {
|
|
85
|
+
title: value
|
|
86
|
+
}, {
|
|
87
|
+
at: path
|
|
88
|
+
});
|
|
89
|
+
} catch (err) {
|
|
90
|
+
console.log(err);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
94
|
+
...attributes,
|
|
95
|
+
className: "fe-dataview",
|
|
96
|
+
sx: classes.root,
|
|
97
|
+
contentEditable: false,
|
|
98
|
+
"data-title": title,
|
|
99
|
+
children: /*#__PURE__*/_jsxs(DataViewProvider, {
|
|
100
|
+
data: {
|
|
101
|
+
properties,
|
|
102
|
+
layouts,
|
|
103
|
+
rows
|
|
104
|
+
},
|
|
105
|
+
path: path,
|
|
106
|
+
editor: editor,
|
|
107
|
+
title: title,
|
|
108
|
+
users: users,
|
|
109
|
+
children: [/*#__PURE__*/_jsx(FilterView, {
|
|
110
|
+
classes: classes,
|
|
111
|
+
onEnter: onEnter,
|
|
112
|
+
onDelete: onDelete,
|
|
113
|
+
onDuplicate: onDuplicate,
|
|
114
|
+
readOnly: readOnly,
|
|
115
|
+
title: title,
|
|
116
|
+
onTitleChange: onTitleChange
|
|
117
|
+
}), /*#__PURE__*/_jsx(LayoutView, {
|
|
118
|
+
readOnly: readOnly,
|
|
119
|
+
children: children
|
|
120
|
+
})]
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
export default DataView;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ToolbarIcon from "../../common/ToolbarIcon";
|
|
3
|
+
import Icon from "../../common/Icon";
|
|
4
|
+
import { insertDataView } from "../../utils/dataView";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const DataViewButton = props => {
|
|
7
|
+
const {
|
|
8
|
+
editor,
|
|
9
|
+
icoBtnType
|
|
10
|
+
} = props;
|
|
11
|
+
const onClick = () => {
|
|
12
|
+
insertDataView(editor);
|
|
13
|
+
};
|
|
14
|
+
return /*#__PURE__*/_jsx(ToolbarIcon, {
|
|
15
|
+
title: "Dynamic Table",
|
|
16
|
+
onClick: onClick,
|
|
17
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
18
|
+
icon: "dataView"
|
|
19
|
+
}),
|
|
20
|
+
icoBtnType: icoBtnType
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export default DataViewButton;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Box, Checkbox, Popper, useTheme } from "@mui/material";
|
|
3
|
+
import CheckBoxTwoToneIcon from "@mui/icons-material/CheckBoxTwoTone";
|
|
4
|
+
import DataTypes from "./DataTypes";
|
|
5
|
+
import useColumnStyles from "./colStyles";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const ColumnView = props => {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const {
|
|
11
|
+
needAnchor,
|
|
12
|
+
rowIndex,
|
|
13
|
+
row,
|
|
14
|
+
property,
|
|
15
|
+
onSelect,
|
|
16
|
+
selected,
|
|
17
|
+
readOnly
|
|
18
|
+
} = props;
|
|
19
|
+
const DataType = DataTypes[property?.type] || DataTypes["text"];
|
|
20
|
+
const anchorRef = useRef(null);
|
|
21
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
22
|
+
const open = Boolean(anchorEl);
|
|
23
|
+
const classes = useColumnStyles(theme);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (anchorRef?.current) {
|
|
26
|
+
setAnchorEl(anchorRef?.current);
|
|
27
|
+
}
|
|
28
|
+
}, [anchorRef?.current]);
|
|
29
|
+
const handleSelect = id => e => {
|
|
30
|
+
onSelect(id, e.target.checked);
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
33
|
+
component: "td",
|
|
34
|
+
children: [needAnchor ? /*#__PURE__*/_jsx("span", {
|
|
35
|
+
ref: anchorRef,
|
|
36
|
+
style: {
|
|
37
|
+
position: "absolute",
|
|
38
|
+
width: "1px"
|
|
39
|
+
}
|
|
40
|
+
}) : null, /*#__PURE__*/_jsx(DataType, {
|
|
41
|
+
options: property?.options,
|
|
42
|
+
property: property?.key,
|
|
43
|
+
value: row[property?.key] || "",
|
|
44
|
+
rowIndex: rowIndex,
|
|
45
|
+
label: property?.label,
|
|
46
|
+
readOnly: readOnly
|
|
47
|
+
}), needAnchor && !readOnly ? /*#__PURE__*/_jsx(Popper, {
|
|
48
|
+
sx: classes.root,
|
|
49
|
+
open: open,
|
|
50
|
+
anchorEl: anchorEl,
|
|
51
|
+
placement: "left",
|
|
52
|
+
className: `tv-tr-pop ${selected ? "active" : ""}`,
|
|
53
|
+
disablePortal: true,
|
|
54
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
55
|
+
onClick: handleSelect(row?.id),
|
|
56
|
+
size: "small",
|
|
57
|
+
className: "tv-ck-box",
|
|
58
|
+
sx: {
|
|
59
|
+
mr: 0
|
|
60
|
+
},
|
|
61
|
+
checked: selected,
|
|
62
|
+
checkedIcon: /*#__PURE__*/_jsx(CheckBoxTwoToneIcon, {})
|
|
63
|
+
})
|
|
64
|
+
}) : null]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
export default ColumnView;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useDataView } from "../../Providers/DataViewProvider";
|
|
3
|
+
import Checkbox from "@mui/material/Checkbox";
|
|
4
|
+
import Icon from "../../../../common/Icon";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const CheckType = props => {
|
|
7
|
+
const {
|
|
8
|
+
rowIndex,
|
|
9
|
+
property,
|
|
10
|
+
value,
|
|
11
|
+
readOnly
|
|
12
|
+
} = props;
|
|
13
|
+
const {
|
|
14
|
+
onChange
|
|
15
|
+
} = useDataView();
|
|
16
|
+
const handleChange = e => {
|
|
17
|
+
onChange(rowIndex, {
|
|
18
|
+
[property]: e?.target?.checked
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/_jsx(Checkbox, {
|
|
22
|
+
checked: value || false,
|
|
23
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
24
|
+
icon: "checkListButton"
|
|
25
|
+
}),
|
|
26
|
+
checkedIcon: /*#__PURE__*/_jsx(Icon, {
|
|
27
|
+
icon: "checkListButtonActive"
|
|
28
|
+
}),
|
|
29
|
+
onChange: handleChange,
|
|
30
|
+
disabled: readOnly
|
|
31
|
+
}, rowIndex);
|
|
32
|
+
};
|
|
33
|
+
export default CheckType;
|