@flozy/editor 5.5.8 → 5.6.0
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 +26 -13
- package/dist/Editor/Editor.css +106 -20
- package/dist/Editor/Elements/AI/AIInput.js +0 -1
- package/dist/Editor/Elements/AI/CustomSelect.js +17 -10
- package/dist/Editor/Elements/AI/PopoverAIInput.js +59 -53
- package/dist/Editor/Elements/AI/Styles.js +24 -6
- package/dist/Editor/Elements/Accordion/Accordion.js +8 -1
- package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
- package/dist/Editor/Elements/Button/EditorButton.js +6 -1
- package/dist/Editor/Elements/Carousel/CarouselItem.js +11 -3
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +7 -5
- package/dist/Editor/Elements/Color Picker/Styles.js +8 -3
- package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -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 +83 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +180 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +62 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +68 -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 +86 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +71 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +138 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +213 -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 +44 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +146 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +79 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +57 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +174 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +241 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +45 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +32 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +217 -0
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +131 -0
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +253 -0
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +85 -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 +277 -0
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +88 -0
- package/dist/Editor/Elements/DataView/styles.js +169 -0
- package/dist/Editor/Elements/Divider/Divider.js +36 -20
- package/dist/Editor/Elements/Embed/Image.js +51 -16
- package/dist/Editor/Elements/Embed/Video.js +26 -3
- package/dist/Editor/Elements/Form/Form.js +38 -2
- package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormDate.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormEmail.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormText.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +6 -1
- package/dist/Editor/Elements/Form/FormPopup.js +12 -9
- package/dist/Editor/Elements/Form/Workflow/Styles.js +2 -0
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -2
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -1
- package/dist/Editor/Elements/Grid/GridButton.js +2 -2
- package/dist/Editor/Elements/Grid/GridItem.js +47 -36
- package/dist/Editor/Elements/Grid/Styles.js +50 -0
- package/dist/Editor/Elements/Link/LinkButton.js +1 -1
- package/dist/Editor/Elements/Search/SearchButton.js +1 -0
- package/dist/Editor/Elements/Signature/Signature.css +1 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
- package/dist/Editor/Elements/Signature/SignaturePopup.js +17 -52
- package/dist/Editor/Elements/SimpleText/index.js +3 -2
- package/dist/Editor/Elements/SimpleText/style.js +15 -0
- package/dist/Editor/Elements/Table/AddRowCol.js +77 -0
- package/dist/Editor/Elements/Table/DragButton.js +142 -0
- package/dist/Editor/Elements/Table/DragStyles.js +70 -0
- package/dist/Editor/Elements/Table/Draggable.js +25 -0
- package/dist/Editor/Elements/Table/Droppable.js +53 -0
- package/dist/Editor/Elements/Table/Styles.js +88 -78
- package/dist/Editor/Elements/Table/Table.js +263 -140
- package/dist/Editor/Elements/Table/TableCell.js +365 -111
- package/dist/Editor/Elements/Table/TablePopup.js +9 -3
- package/dist/Editor/Elements/Table/TableRow.js +10 -2
- package/dist/Editor/Elements/Table/TableTool.js +101 -0
- package/dist/Editor/Elements/Table/tableHelper.js +71 -0
- package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
- package/dist/Editor/MiniEditor.js +21 -2
- package/dist/Editor/Styles/EditorStyles.js +13 -4
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +10 -0
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +7 -12
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +26 -4
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +3 -0
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -5
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +8 -8
- package/dist/Editor/Toolbar/Mini/Styles.js +9 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +7 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +6 -4
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +19 -15
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +547 -58
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +28 -16
- package/dist/Editor/Toolbar/PopupTool/index.js +3 -5
- package/dist/Editor/Toolbar/Toolbar.js +6 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
- package/dist/Editor/assets/svg/ArrowDownIcon.js +25 -0
- package/dist/Editor/assets/svg/ArrowUpIcon.js +25 -0
- package/dist/Editor/assets/svg/BrainIcon.js +2 -2
- package/dist/Editor/assets/svg/CalenderIconTick.js +64 -0
- package/dist/Editor/assets/svg/ChervDown.js +18 -0
- package/dist/Editor/assets/svg/ChervUp.js +18 -0
- package/dist/Editor/assets/svg/DataTableIcon.js +50 -0
- package/dist/Editor/assets/svg/DuplicateIcon.js +23 -0
- package/dist/Editor/assets/svg/EyeIcon.js +23 -0
- package/dist/Editor/assets/svg/EyeSlash.js +43 -0
- package/dist/Editor/assets/svg/HashtagIcon.js +33 -0
- package/dist/Editor/assets/svg/PlusIcon.js +23 -0
- package/dist/Editor/assets/svg/SelectRoundedIcon.js +24 -0
- package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
- package/dist/Editor/assets/svg/SortByIcon.js +33 -0
- package/dist/Editor/assets/svg/TableIcons.js +220 -0
- package/dist/Editor/assets/svg/TickOutlined.js +23 -0
- package/dist/Editor/assets/svg/TrashCanIcon.js +38 -0
- package/dist/Editor/common/ColorPickerButton.js +85 -45
- package/dist/Editor/common/DnD/Draggable.js +2 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +2 -2
- package/dist/Editor/common/Icon.js +54 -21
- package/dist/Editor/common/ImageSelector/Options/Upload.js +2 -1
- package/dist/Editor/common/ImageSelector/Styles.js +47 -6
- package/dist/Editor/common/ImageSelector/UploadStyles.js +18 -6
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -1
- package/dist/Editor/common/LinkSettings/index.js +2 -1
- package/dist/Editor/common/MentionsPopup/Styles.js +142 -8
- package/dist/Editor/common/MentionsPopup/index.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +107 -12
- package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
- package/dist/Editor/common/RnD/ShadowElement.js +1 -1
- package/dist/Editor/common/RnD/VirtualElement/index.js +5 -1
- package/dist/Editor/common/RnD/index.js +4 -3
- package/dist/Editor/common/Section/index.js +3 -3
- package/dist/Editor/common/Section/styles.js +5 -1
- package/dist/Editor/common/Select/index.js +20 -0
- package/dist/Editor/common/Select/styles.js +17 -0
- package/dist/Editor/common/Shorthands/elements.js +13 -1
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +4 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +35 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +22 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +21 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +20 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +12 -2
- package/dist/Editor/common/StyleBuilder/formStyle.js +268 -149
- package/dist/Editor/common/StyleBuilder/index.js +101 -20
- package/dist/Editor/common/StyleBuilder/tableStyle.js +69 -25
- package/dist/Editor/common/SwipeableDrawer/style.js +15 -4
- package/dist/Editor/common/ToolbarIcon.js +1 -1
- package/dist/Editor/common/Uploader.js +39 -37
- package/dist/Editor/common/iconListV2.js +598 -74
- package/dist/Editor/common/iconslist.js +25 -19
- package/dist/Editor/commonStyle.js +421 -15
- package/dist/Editor/helper/deserialize/index.js +31 -2
- package/dist/Editor/helper/enforceDateFormat.js +41 -0
- package/dist/Editor/helper/index.js +15 -2
- package/dist/Editor/helper/theme.js +15 -1
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/hooks/useTable.js +210 -0
- package/dist/Editor/plugins/withCustomDeleteBackward.js +1 -1
- package/dist/Editor/plugins/withEmbeds.js +30 -26
- package/dist/Editor/plugins/withHTML.js +100 -12
- package/dist/Editor/plugins/withLayout.js +1 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +31 -11
- package/dist/Editor/utils/brains.js +1 -1
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +75 -6
- package/dist/Editor/utils/customHooks/useResize.js +7 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +6 -2
- package/dist/Editor/utils/dataView.js +43 -0
- package/dist/Editor/utils/embed.js +2 -1
- package/dist/Editor/utils/events.js +0 -1
- package/dist/Editor/utils/font.js +11 -4
- package/dist/Editor/utils/formfield.js +8 -4
- package/dist/Editor/utils/helper.js +100 -2
- package/dist/Editor/utils/insertNewLine.js +19 -1
- package/dist/Editor/utils/serializeToText.js +2 -0
- package/dist/Editor/utils/table.js +228 -24
- package/package.json +2 -2
@@ -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,
|
@@ -27,7 +27,7 @@ import DragAndDrop from "./common/DnD";
|
|
27
27
|
import Section from "./common/Section";
|
28
28
|
import decorators from "./utils/Decorators";
|
29
29
|
import { getTRBLBreakPoints } from "./helper/theme";
|
30
|
-
import { handleInsertLastElement, isFreeGrid, isFreeGridFragment, isPageSettings, outsideEditorClickLabel } from "./utils/helper";
|
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";
|
@@ -72,6 +72,12 @@ const Leaf = ({
|
|
72
72
|
children: children
|
73
73
|
});
|
74
74
|
};
|
75
|
+
const updateTopBanner = (content = [], setTopBanner) => {
|
76
|
+
setTopBanner(() => {
|
77
|
+
const firstNode = content ? content[0] : {};
|
78
|
+
return firstNode?.type === "topbanner" ? firstNode : null;
|
79
|
+
});
|
80
|
+
};
|
75
81
|
const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
76
82
|
const {
|
77
83
|
id,
|
@@ -103,6 +109,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
103
109
|
});
|
104
110
|
const [isTextSelected, setIsTextSelected] = useState(false);
|
105
111
|
const [breakpoint, setBreakpoint] = useState("");
|
112
|
+
const [topBanner, setTopBanner] = useState();
|
106
113
|
const debouncedValue = useRef(value);
|
107
114
|
const [size] = useWindowResize();
|
108
115
|
const {
|
@@ -117,7 +124,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
117
124
|
} = otherProps || {};
|
118
125
|
const editor = useMemo(() => {
|
119
126
|
if (collaborativeEditor) return collaborativeEditor;
|
120
|
-
|
127
|
+
const editor = createEditor();
|
128
|
+
editor.needLayout = needLayout;
|
129
|
+
return withCommon(editor, {
|
121
130
|
needLayout
|
122
131
|
});
|
123
132
|
}, [collaborativeEditor]);
|
@@ -149,6 +158,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
149
158
|
setValue(draftToSlate({
|
150
159
|
data: content
|
151
160
|
}));
|
161
|
+
updateTopBanner(content, setTopBanner);
|
152
162
|
if (!isMobile && !ReactEditor.isFocused(editor)) {
|
153
163
|
ReactEditor.focus(editor);
|
154
164
|
}
|
@@ -297,10 +307,13 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
297
307
|
hideTools: updatedHideTools || []
|
298
308
|
}) : [];
|
299
309
|
const handleEditorChange = newValue => {
|
300
|
-
if (
|
301
|
-
|
302
|
-
|
303
|
-
|
310
|
+
if (!readOnly) {
|
311
|
+
if (JSON.stringify(newValue) !== JSON.stringify(debouncedValue?.current)) {
|
312
|
+
updateTopBanner(newValue, setTopBanner);
|
313
|
+
debounced(newValue);
|
314
|
+
if (!isInteracted) {
|
315
|
+
setIsInteracted(true);
|
316
|
+
}
|
304
317
|
}
|
305
318
|
}
|
306
319
|
};
|
@@ -410,10 +423,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
410
423
|
editorWrapper?.current?.classList.remove("hideScroll");
|
411
424
|
handleScrollStop();
|
412
425
|
};
|
413
|
-
const hasTopBanner = () =>
|
414
|
-
const tb = editor.children[0];
|
415
|
-
return tb?.type === "topbanner" ? tb : null;
|
416
|
-
};
|
426
|
+
const hasTopBanner = () => topBanner;
|
417
427
|
const renderTopBanner = () => {
|
418
428
|
const tb = hasTopBanner();
|
419
429
|
return tb ? /*#__PURE__*/_jsx(TopBanner, {
|
@@ -495,12 +505,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
495
505
|
,
|
496
506
|
children: /*#__PURE__*/_jsxs(Slate, {
|
497
507
|
editor: editor,
|
498
|
-
initialValue: debouncedValue?.current,
|
508
|
+
initialValue: getInitialValue(debouncedValue?.current, readOnly),
|
499
509
|
onChange: handleEditorChange,
|
500
510
|
children: [/*#__PURE__*/_jsx(DragAndDrop, {
|
501
511
|
children: /*#__PURE__*/_jsxs(Overlay, {
|
502
512
|
children: [/*#__PURE__*/_jsx(Box, {
|
503
|
-
className: `pc-${editorClass || ""} ${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} scrollable-content scrollSmooth`,
|
513
|
+
className: `pc-${editorClass || ""} ${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} scrollable-content scrollSmooth ${readOnly ? "readOnlyContainer" : ""}`,
|
504
514
|
sx: classes.slateWrapper,
|
505
515
|
id: "slate-wrapper-scroll-container",
|
506
516
|
ref: editorWrapper,
|
@@ -540,7 +550,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
540
550
|
renderLeaf: renderLeaf,
|
541
551
|
decorate: d => decorators(d, editor),
|
542
552
|
onKeyDown: onKeyDown,
|
543
|
-
onSelect: () => handleCursorScroll(editorWrapper.current)
|
553
|
+
onSelect: () => handleCursorScroll(editorWrapper.current),
|
554
|
+
scrollSelectionIntoView: () => {
|
555
|
+
// disable the scrollSelectionIntoView, to resolve editor auto scroll on free-grid
|
556
|
+
}
|
544
557
|
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
545
558
|
ref: mentionsRef,
|
546
559
|
mentions: mentions,
|
package/dist/Editor/Editor.css
CHANGED
@@ -18,7 +18,10 @@
|
|
18
18
|
.ml-1 {
|
19
19
|
margin-left: 10px;
|
20
20
|
}
|
21
|
-
|
21
|
+
.m-0
|
22
|
+
{
|
23
|
+
margin: 0px
|
24
|
+
}
|
22
25
|
.dflex {
|
23
26
|
display: flex;
|
24
27
|
}
|
@@ -31,7 +34,7 @@ blockquote {
|
|
31
34
|
border-left: 3px solid transparent;
|
32
35
|
margin-left: 0;
|
33
36
|
margin-right: 0;
|
34
|
-
padding-left: 10px;
|
37
|
+
/* padding-left: 10px; */
|
35
38
|
margin: 0px;
|
36
39
|
}
|
37
40
|
|
@@ -42,7 +45,7 @@ blockquote {
|
|
42
45
|
}
|
43
46
|
|
44
47
|
.editor-wrapper table {
|
45
|
-
border-collapse:
|
48
|
+
border-collapse: collapse;
|
46
49
|
}
|
47
50
|
|
48
51
|
.editor-wrapper .editor-wrapperbutton {
|
@@ -149,7 +152,7 @@ blockquote {
|
|
149
152
|
.grid-item-toolbar button,
|
150
153
|
.element-toolbar button,
|
151
154
|
.element-toolbar a {
|
152
|
-
border-radius:
|
155
|
+
border-radius: 50%;
|
153
156
|
border: 1px solid rgba(37, 99, 235, 0.32);
|
154
157
|
background: #fff;
|
155
158
|
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.16);
|
@@ -225,9 +228,13 @@ blockquote {
|
|
225
228
|
background-color: #0052cc;
|
226
229
|
padding: 8px 12px;
|
227
230
|
color: #ffffff;
|
228
|
-
font-weight:
|
231
|
+
font-weight: 600;
|
232
|
+
font-size: 14px;
|
229
233
|
opacity: 1;
|
230
234
|
border-radius: 32px;
|
235
|
+
text-transform: math-auto;
|
236
|
+
height: 36px;
|
237
|
+
padding: 0px 12px;
|
231
238
|
}
|
232
239
|
|
233
240
|
.signature-btn-container button:hover {
|
@@ -351,13 +358,17 @@ blockquote {
|
|
351
358
|
height: 100%;
|
352
359
|
width: 100%;
|
353
360
|
border: 1px solid #2563EB;
|
354
|
-
border-radius:
|
361
|
+
border-radius: 7px;
|
355
362
|
}
|
356
363
|
|
357
364
|
.activeBrush svg {
|
358
365
|
stroke: #2563eb;
|
359
366
|
}
|
360
367
|
|
368
|
+
.brushIcon:hover {
|
369
|
+
background: unset;
|
370
|
+
}
|
371
|
+
|
361
372
|
.react-datepicker__input-container {
|
362
373
|
display: flex !important;
|
363
374
|
align-items: center;
|
@@ -383,7 +394,7 @@ blockquote {
|
|
383
394
|
|
384
395
|
.dialog-actions-si .MuiButtonBase-root {
|
385
396
|
opacity: 1;
|
386
|
-
padding:
|
397
|
+
padding: 0px 5px 0px 2px !important
|
387
398
|
}
|
388
399
|
|
389
400
|
.signature-tab {
|
@@ -397,9 +408,9 @@ blockquote {
|
|
397
408
|
.signature-tab2 {
|
398
409
|
/* display: flex; */
|
399
410
|
align-items: center;
|
400
|
-
border-width:
|
411
|
+
border-width: 1px;
|
401
412
|
border-style: solid;
|
402
|
-
border-color: #
|
413
|
+
border-color: #2563EB66;
|
403
414
|
justify-content: center;
|
404
415
|
flex-direction: column;
|
405
416
|
width: 100%;
|
@@ -491,11 +502,19 @@ blockquote {
|
|
491
502
|
text-transform: none;
|
492
503
|
}
|
493
504
|
|
494
|
-
.MuiButton-root.primaryBtn
|
495
|
-
.MuiButton-root.secondaryBtn.disabled {
|
505
|
+
.MuiButton-root.primaryBtn:disabled {
|
496
506
|
background: #eee !important;
|
507
|
+
box-shadow: none !important;
|
497
508
|
color: #ccc !important;
|
498
509
|
border: 1px solid #ccc !important;
|
510
|
+
cursor: not-allowed;
|
511
|
+
}
|
512
|
+
|
513
|
+
.MuiButton-root.primaryBtn.disabled,
|
514
|
+
.MuiButton-root.secondaryBtn.disabled {
|
515
|
+
background: #eee;
|
516
|
+
color: #ccc;
|
517
|
+
border: 1px solid #ccc;
|
499
518
|
}
|
500
519
|
|
501
520
|
.MuiButton-root.secondaryBtn {
|
@@ -516,7 +535,7 @@ blockquote {
|
|
516
535
|
}
|
517
536
|
|
518
537
|
.deleteBtn {
|
519
|
-
background: #
|
538
|
+
background: #d32f2f ;
|
520
539
|
border: 1px solid #d32f2f !important;
|
521
540
|
box-shadow: 0px 8px 24px rgba(30, 64, 175, 0.08);
|
522
541
|
border-radius: 8px !important;
|
@@ -526,6 +545,7 @@ blockquote {
|
|
526
545
|
margin-right: 15px !important;
|
527
546
|
color: #d32f2f;
|
528
547
|
width: auto !important;
|
548
|
+
text-transform: capitalize !important;
|
529
549
|
}
|
530
550
|
|
531
551
|
@media (max-width: 480px) {
|
@@ -623,7 +643,7 @@ blockquote {
|
|
623
643
|
}
|
624
644
|
|
625
645
|
.MuiIconButton-root.btnActive {
|
626
|
-
|
646
|
+
color: #2563EB !important;
|
627
647
|
}
|
628
648
|
|
629
649
|
.embed .element-toolbar {
|
@@ -663,7 +683,8 @@ blockquote {
|
|
663
683
|
}
|
664
684
|
|
665
685
|
.resize-br.img-resizer {
|
666
|
-
bottom:
|
686
|
+
bottom: 10px;
|
687
|
+
right: 5px;
|
667
688
|
}
|
668
689
|
|
669
690
|
.visible-on-hover {
|
@@ -858,8 +879,8 @@ blockquote {
|
|
858
879
|
|
859
880
|
.dialogComp .MuiInputBase-input {
|
860
881
|
border-radius: 8px;
|
861
|
-
box-shadow: 0px 4px 18px 0px rgba(0, 0, 0, 0.05);
|
862
|
-
font-size:
|
882
|
+
/* box-shadow: 0px 4px 18px 0px rgba(0, 0, 0, 0.05); */
|
883
|
+
font-size: 14px;
|
863
884
|
font-weight: 500;
|
864
885
|
}
|
865
886
|
|
@@ -1023,11 +1044,11 @@ blockquote {
|
|
1023
1044
|
width: 200px;
|
1024
1045
|
cursor: pointer;
|
1025
1046
|
color: #464646;
|
1026
|
-
background-color: #fff;
|
1047
|
+
/* background-color: #fff; */
|
1027
1048
|
padding: 4px 6px;
|
1028
1049
|
border-radius: 12px;
|
1029
1050
|
span {
|
1030
|
-
text-transform:
|
1051
|
+
text-transform: math-auto;
|
1031
1052
|
}
|
1032
1053
|
@media only screen and (max-width: 599px) {
|
1033
1054
|
background-color: unset;
|
@@ -1049,7 +1070,7 @@ blockquote {
|
|
1049
1070
|
}
|
1050
1071
|
|
1051
1072
|
.textFontArrows .MuiIconButton-root {
|
1052
|
-
padding:
|
1073
|
+
padding: 0px;
|
1053
1074
|
}
|
1054
1075
|
|
1055
1076
|
.tools-drawer .MuiTypography-root {
|
@@ -1073,6 +1094,10 @@ blockquote {
|
|
1073
1094
|
font-size: 14px;
|
1074
1095
|
}
|
1075
1096
|
|
1097
|
+
.listItemMargin {
|
1098
|
+
margin: 0px;
|
1099
|
+
}
|
1100
|
+
|
1076
1101
|
.content-editable.empty {
|
1077
1102
|
position: relative;
|
1078
1103
|
}
|
@@ -1226,15 +1251,76 @@ blockquote {
|
|
1226
1251
|
position: absolute;
|
1227
1252
|
}
|
1228
1253
|
|
1229
|
-
.dividerComponent:hover .divider-settings
|
1254
|
+
.dividerComponent:hover .divider-settings,
|
1255
|
+
.dividerComponent:hover .element-selector {
|
1230
1256
|
display: block;
|
1257
|
+
pointer-events: auto;
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
.hideScroll {
|
1261
|
+
overflow-anchor: none;
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
.hideScroll::-webkit-scrollbar-track {
|
1265
|
+
background: none !important;
|
1231
1266
|
}
|
1232
1267
|
|
1268
|
+
.hideScroll::-webkit-scrollbar-thumb {
|
1269
|
+
background: none !important;
|
1270
|
+
}
|
1271
|
+
|
1272
|
+
.hideScroll::-webkit-scrollbar-thumb:hover {
|
1273
|
+
background: none !important;
|
1274
|
+
}
|
1233
1275
|
@media (max-width: 899px) {
|
1234
1276
|
.MuiPopover-root {
|
1235
1277
|
z-index: 1302 !important;
|
1236
1278
|
}
|
1279
|
+
|
1237
1280
|
canvas {
|
1238
1281
|
max-width: 100% !important;
|
1239
1282
|
}
|
1240
1283
|
}
|
1284
|
+
|
1285
|
+
.settingsHeader {
|
1286
|
+
font-size: 14px !important;
|
1287
|
+
font-weight: 500 !important;
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
.custom-scroll::-webkit-scrollbar {
|
1291
|
+
height: .6rem;
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
.custom-scroll::-webkit-scrollbar-thumb {
|
1295
|
+
background: #888;
|
1296
|
+
border-radius: 5px;
|
1297
|
+
cursor: pointer;
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
.custom-scroll::-webkit-scrollbar-track {
|
1301
|
+
background: #f1f1f1;
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
.custom-scroll:hover::-webkit-scrollbar-thumb {
|
1305
|
+
background: #A7AEC1;
|
1306
|
+
}
|
1307
|
+
|
1308
|
+
::selection {
|
1309
|
+
color: inherit;
|
1310
|
+
background: rgba(35, 131, 226, 0.35) !important;
|
1311
|
+
}
|
1312
|
+
|
1313
|
+
::-moz-selection {
|
1314
|
+
background: rgba(35, 131, 226, 0.35) !important;
|
1315
|
+
color: inherit;
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
::-webkit-selection {
|
1319
|
+
background: rgba(35, 131, 226, 0.35) !important;
|
1320
|
+
color: inherit;
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
.gradientFillBtn {
|
1324
|
+
background: linear-gradient(112.61deg, #2C63ED 19.3%, #8360FD 88.14%) !important;
|
1325
|
+
text-transform: math-auto !important;
|
1326
|
+
}
|
@@ -71,7 +71,6 @@ function AIInput({
|
|
71
71
|
}, [openAI]);
|
72
72
|
const isSendBtnDisabled = !inputValue || loading;
|
73
73
|
const props = getProps(openAI, generatedText) || {};
|
74
|
-
const fromToolBar = openAI === "fromToolBar";
|
75
74
|
const handleSendBtnClick = () => {
|
76
75
|
if (isSendBtnDisabled) {
|
77
76
|
return;
|
@@ -8,12 +8,14 @@ function CustomSelect({
|
|
8
8
|
classes,
|
9
9
|
options,
|
10
10
|
onSend,
|
11
|
-
show
|
11
|
+
show,
|
12
|
+
btnProps = {}
|
12
13
|
}) {
|
13
14
|
if (show) {
|
14
15
|
return /*#__PURE__*/_jsx(Box, {
|
15
16
|
component: "div",
|
16
17
|
sx: classes.customSelectContainer,
|
18
|
+
className: "customSelectContainer",
|
17
19
|
children: options?.map((groupOption, index) => {
|
18
20
|
const {
|
19
21
|
options,
|
@@ -28,7 +30,8 @@ function CustomSelect({
|
|
28
30
|
return /*#__PURE__*/_jsx(DisplayOption, {
|
29
31
|
option: option,
|
30
32
|
classes: classes,
|
31
|
-
onSend: onSend
|
33
|
+
onSend: onSend,
|
34
|
+
btnProps: btnProps
|
32
35
|
}, i);
|
33
36
|
})]
|
34
37
|
}, index);
|
@@ -42,15 +45,18 @@ export default CustomSelect;
|
|
42
45
|
function DisplayOption({
|
43
46
|
option,
|
44
47
|
classes,
|
45
|
-
onSend
|
48
|
+
onSend,
|
49
|
+
btnProps = {}
|
46
50
|
}) {
|
47
51
|
const {
|
48
|
-
Icon
|
52
|
+
Icon,
|
53
|
+
Component
|
49
54
|
} = option;
|
50
55
|
const [open, setOpen] = useState(false);
|
51
56
|
const optionRef = useRef();
|
57
|
+
const showChild = option.options?.length || Component;
|
52
58
|
const openOptions = e => {
|
53
|
-
if (
|
59
|
+
if (showChild && !open) {
|
54
60
|
setOpen(e.currentTarget);
|
55
61
|
return;
|
56
62
|
}
|
@@ -66,7 +72,7 @@ function DisplayOption({
|
|
66
72
|
e.stopPropagation();
|
67
73
|
|
68
74
|
// is having child options
|
69
|
-
if (
|
75
|
+
if (showChild) {
|
70
76
|
openOptions(e);
|
71
77
|
return;
|
72
78
|
}
|
@@ -75,18 +81,19 @@ function DisplayOption({
|
|
75
81
|
},
|
76
82
|
id: "infinity-select-popover",
|
77
83
|
className: open ? "active" : "",
|
84
|
+
...btnProps,
|
78
85
|
children: [/*#__PURE__*/_jsxs("div", {
|
79
86
|
className: "option-label",
|
80
87
|
id: "infinity-select-popover",
|
81
88
|
children: [Icon && /*#__PURE__*/_jsx(Icon, {}), option.label]
|
82
|
-
}),
|
89
|
+
}), showChild ? /*#__PURE__*/_jsx(IconButton, {
|
83
90
|
children: /*#__PURE__*/_jsx(FaChevronRight, {
|
84
91
|
color: "#94A3B8",
|
85
92
|
size: 12
|
86
93
|
})
|
87
|
-
})]
|
94
|
+
}) : null]
|
88
95
|
}), /*#__PURE__*/_jsx(Popper, {
|
89
|
-
open: open &&
|
96
|
+
open: open && showChild,
|
90
97
|
anchorEl: open,
|
91
98
|
sx: {
|
92
99
|
zIndex: 9001,
|
@@ -96,7 +103,7 @@ function DisplayOption({
|
|
96
103
|
setOpen(null);
|
97
104
|
},
|
98
105
|
placement: "right-start",
|
99
|
-
children: /*#__PURE__*/_jsx(Box, {
|
106
|
+
children: Component ? /*#__PURE__*/_jsx(Component, {}) : /*#__PURE__*/_jsx(Box, {
|
100
107
|
children: /*#__PURE__*/_jsx(CustomSelect, {
|
101
108
|
options: option.options,
|
102
109
|
onSend: onSend,
|