@flozy/editor 5.4.1 → 5.4.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 +29 -15
- package/dist/Editor/Editor.css +100 -18
- package/dist/Editor/Elements/AI/AIInput.js +0 -1
- package/dist/Editor/Elements/AI/CustomSelect.js +19 -11
- package/dist/Editor/Elements/AI/PopoverAIInput.js +58 -52
- 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 +9 -2
- 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 +7 -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 +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/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 +39 -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/FreeGrid/FreeGrid.js +1 -1
- 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 +2 -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/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
- 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 +8 -1
- package/dist/Editor/Elements/SimpleText/style.js +20 -1
- 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 +82 -79
- package/dist/Editor/Elements/Table/Table.js +258 -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 +15 -1
- 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 +3 -6
- package/dist/Editor/Toolbar/Mini/Styles.js +4 -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 +555 -57
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +73 -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/BrainIcon.js +2 -2
- package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
- package/dist/Editor/assets/svg/TableIcons.js +220 -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 +4 -4
- package/dist/Editor/common/Icon.js +23 -20
- 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 +143 -8
- package/dist/Editor/common/MentionsPopup/index.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +108 -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/SwitchViewport/SwitchViewport.js +14 -2
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -6
- package/dist/Editor/common/RnD/VirtualElement/index.js +5 -1
- package/dist/Editor/common/RnD/index.js +3 -2
- 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 +9 -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/card.js +10 -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/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -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/pageSettingsStyle.js +4 -0
- 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 +46 -36
- package/dist/Editor/common/iconListV2.js +616 -60
- package/dist/Editor/common/iconslist.js +23 -17
- package/dist/Editor/commonStyle.js +417 -11
- package/dist/Editor/helper/deserialize/index.js +25 -13
- package/dist/Editor/helper/enforceDateFormat.js +41 -0
- package/dist/Editor/helper/index.js +17 -4
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/hooks/useTable.js +210 -0
- package/dist/Editor/plugins/withCustomDeleteBackward.js +36 -4
- package/dist/Editor/plugins/withEmbeds.js +30 -26
- package/dist/Editor/plugins/withHTML.js +61 -10
- package/dist/Editor/plugins/withLayout.js +1 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +39 -12
- package/dist/Editor/utils/brains.js +1 -1
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +26 -1
- 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 +103 -2
- package/dist/Editor/utils/insertNewLine.js +19 -1
- package/dist/Editor/utils/pageSettings.js +14 -2
- 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,
|
@@ -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";
|
@@ -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]);
|
@@ -130,7 +139,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
130
139
|
pageColor,
|
131
140
|
color: pageTextColor,
|
132
141
|
pageWidth,
|
133
|
-
maxWidth: pageMaxWidth
|
142
|
+
maxWidth: pageMaxWidth,
|
143
|
+
lineHeight
|
134
144
|
} = pageSt?.pageProps || {
|
135
145
|
bannerSpacing: {
|
136
146
|
left: 0,
|
@@ -149,6 +159,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
149
159
|
setValue(draftToSlate({
|
150
160
|
data: content
|
151
161
|
}));
|
162
|
+
updateTopBanner(content, setTopBanner);
|
152
163
|
if (!isMobile && !ReactEditor.isFocused(editor)) {
|
153
164
|
ReactEditor.focus(editor);
|
154
165
|
}
|
@@ -297,10 +308,13 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
297
308
|
hideTools: updatedHideTools || []
|
298
309
|
}) : [];
|
299
310
|
const handleEditorChange = newValue => {
|
300
|
-
if (
|
301
|
-
|
302
|
-
|
303
|
-
|
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
|
+
}
|
304
318
|
}
|
305
319
|
}
|
306
320
|
};
|
@@ -319,6 +333,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
319
333
|
onDrawerOpen: onDrawerOpen,
|
320
334
|
ICON_API: "https://assets.agenciflow.com"
|
321
335
|
};
|
336
|
+
const lineH = getBreakpointLineSpacing(lineHeight, breakpoint);
|
322
337
|
const renderElement = useCallback(props => {
|
323
338
|
return /*#__PURE__*/_jsx(Element, {
|
324
339
|
...props,
|
@@ -410,10 +425,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
410
425
|
editorWrapper?.current?.classList.remove("hideScroll");
|
411
426
|
handleScrollStop();
|
412
427
|
};
|
413
|
-
const hasTopBanner = () =>
|
414
|
-
const tb = editor.children[0];
|
415
|
-
return tb?.type === "topbanner" ? tb : null;
|
416
|
-
};
|
428
|
+
const hasTopBanner = () => topBanner;
|
417
429
|
const renderTopBanner = () => {
|
418
430
|
const tb = hasTopBanner();
|
419
431
|
return tb ? /*#__PURE__*/_jsx(TopBanner, {
|
@@ -495,12 +507,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
495
507
|
,
|
496
508
|
children: /*#__PURE__*/_jsxs(Slate, {
|
497
509
|
editor: editor,
|
498
|
-
initialValue: debouncedValue?.current,
|
510
|
+
initialValue: getInitialValue(debouncedValue?.current, readOnly),
|
499
511
|
onChange: handleEditorChange,
|
500
512
|
children: [/*#__PURE__*/_jsx(DragAndDrop, {
|
501
513
|
children: /*#__PURE__*/_jsxs(Overlay, {
|
502
514
|
children: [/*#__PURE__*/_jsx(Box, {
|
503
|
-
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" : ""}`,
|
504
516
|
sx: classes.slateWrapper,
|
505
517
|
id: "slate-wrapper-scroll-container",
|
506
518
|
ref: editorWrapper,
|
@@ -524,6 +536,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
524
536
|
padding: {
|
525
537
|
...getTRBLBreakPoints(bannerSpacing)
|
526
538
|
},
|
539
|
+
lineHeight: lineH,
|
527
540
|
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
528
541
|
height: viewport.h ? `${viewport.h}px` : `100%`,
|
529
542
|
alignSelf: "center",
|
@@ -581,8 +594,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
581
594
|
setIsTextSelected: setIsTextSelected,
|
582
595
|
customProps: customProps,
|
583
596
|
editorWrapper: editorWrapper
|
584
|
-
}) : null, !readOnly
|
597
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
585
598
|
breakpoint: breakpoint,
|
599
|
+
show: showViewport,
|
586
600
|
onChange: b => onSwitchBreakpoint(b)
|
587
601
|
}) : null]
|
588
602
|
})
|
package/dist/Editor/Editor.css
CHANGED
@@ -31,7 +31,7 @@ blockquote {
|
|
31
31
|
border-left: 3px solid transparent;
|
32
32
|
margin-left: 0;
|
33
33
|
margin-right: 0;
|
34
|
-
padding-left: 10px;
|
34
|
+
/* padding-left: 10px; */
|
35
35
|
margin: 0px;
|
36
36
|
}
|
37
37
|
|
@@ -42,7 +42,7 @@ blockquote {
|
|
42
42
|
}
|
43
43
|
|
44
44
|
.editor-wrapper table {
|
45
|
-
border-collapse:
|
45
|
+
border-collapse: collapse;
|
46
46
|
}
|
47
47
|
|
48
48
|
.editor-wrapper .editor-wrapperbutton {
|
@@ -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);
|
@@ -225,9 +225,13 @@ blockquote {
|
|
225
225
|
background-color: #0052cc;
|
226
226
|
padding: 8px 12px;
|
227
227
|
color: #ffffff;
|
228
|
-
font-weight:
|
228
|
+
font-weight: 600;
|
229
|
+
font-size: 14px;
|
229
230
|
opacity: 1;
|
230
231
|
border-radius: 32px;
|
232
|
+
text-transform: math-auto;
|
233
|
+
height: 36px;
|
234
|
+
padding: 0px 12px;
|
231
235
|
}
|
232
236
|
|
233
237
|
.signature-btn-container button:hover {
|
@@ -351,13 +355,17 @@ blockquote {
|
|
351
355
|
height: 100%;
|
352
356
|
width: 100%;
|
353
357
|
border: 1px solid #2563EB;
|
354
|
-
border-radius:
|
358
|
+
border-radius: 7px;
|
355
359
|
}
|
356
360
|
|
357
361
|
.activeBrush svg {
|
358
362
|
stroke: #2563eb;
|
359
363
|
}
|
360
364
|
|
365
|
+
.brushIcon:hover {
|
366
|
+
background: unset;
|
367
|
+
}
|
368
|
+
|
361
369
|
.react-datepicker__input-container {
|
362
370
|
display: flex !important;
|
363
371
|
align-items: center;
|
@@ -383,7 +391,7 @@ blockquote {
|
|
383
391
|
|
384
392
|
.dialog-actions-si .MuiButtonBase-root {
|
385
393
|
opacity: 1;
|
386
|
-
padding:
|
394
|
+
padding: 0px 5px 0px 2px !important
|
387
395
|
}
|
388
396
|
|
389
397
|
.signature-tab {
|
@@ -397,9 +405,9 @@ blockquote {
|
|
397
405
|
.signature-tab2 {
|
398
406
|
/* display: flex; */
|
399
407
|
align-items: center;
|
400
|
-
border-width:
|
408
|
+
border-width: 1px;
|
401
409
|
border-style: solid;
|
402
|
-
border-color: #
|
410
|
+
border-color: #2563EB66;
|
403
411
|
justify-content: center;
|
404
412
|
flex-direction: column;
|
405
413
|
width: 100%;
|
@@ -491,11 +499,19 @@ blockquote {
|
|
491
499
|
text-transform: none;
|
492
500
|
}
|
493
501
|
|
494
|
-
.MuiButton-root.primaryBtn
|
495
|
-
.MuiButton-root.secondaryBtn.disabled {
|
502
|
+
.MuiButton-root.primaryBtn:disabled {
|
496
503
|
background: #eee !important;
|
504
|
+
box-shadow: none !important;
|
497
505
|
color: #ccc !important;
|
498
506
|
border: 1px solid #ccc !important;
|
507
|
+
cursor: not-allowed;
|
508
|
+
}
|
509
|
+
|
510
|
+
.MuiButton-root.primaryBtn.disabled,
|
511
|
+
.MuiButton-root.secondaryBtn.disabled {
|
512
|
+
background: #eee;
|
513
|
+
color: #ccc;
|
514
|
+
border: 1px solid #ccc;
|
499
515
|
}
|
500
516
|
|
501
517
|
.MuiButton-root.secondaryBtn {
|
@@ -516,7 +532,7 @@ blockquote {
|
|
516
532
|
}
|
517
533
|
|
518
534
|
.deleteBtn {
|
519
|
-
background: #
|
535
|
+
background: #d32f2f ;
|
520
536
|
border: 1px solid #d32f2f !important;
|
521
537
|
box-shadow: 0px 8px 24px rgba(30, 64, 175, 0.08);
|
522
538
|
border-radius: 8px !important;
|
@@ -526,6 +542,7 @@ blockquote {
|
|
526
542
|
margin-right: 15px !important;
|
527
543
|
color: #d32f2f;
|
528
544
|
width: auto !important;
|
545
|
+
text-transform: capitalize !important;
|
529
546
|
}
|
530
547
|
|
531
548
|
@media (max-width: 480px) {
|
@@ -623,7 +640,7 @@ blockquote {
|
|
623
640
|
}
|
624
641
|
|
625
642
|
.MuiIconButton-root.btnActive {
|
626
|
-
|
643
|
+
color: #2563EB !important;
|
627
644
|
}
|
628
645
|
|
629
646
|
.embed .element-toolbar {
|
@@ -663,7 +680,8 @@ blockquote {
|
|
663
680
|
}
|
664
681
|
|
665
682
|
.resize-br.img-resizer {
|
666
|
-
bottom:
|
683
|
+
bottom: 10px;
|
684
|
+
right: 5px;
|
667
685
|
}
|
668
686
|
|
669
687
|
.visible-on-hover {
|
@@ -858,7 +876,7 @@ blockquote {
|
|
858
876
|
|
859
877
|
.dialogComp .MuiInputBase-input {
|
860
878
|
border-radius: 8px;
|
861
|
-
box-shadow: 0px 4px 18px 0px rgba(0, 0, 0, 0.05);
|
879
|
+
/* box-shadow: 0px 4px 18px 0px rgba(0, 0, 0, 0.05); */
|
862
880
|
font-size: 12px;
|
863
881
|
font-weight: 500;
|
864
882
|
}
|
@@ -1023,11 +1041,11 @@ blockquote {
|
|
1023
1041
|
width: 200px;
|
1024
1042
|
cursor: pointer;
|
1025
1043
|
color: #464646;
|
1026
|
-
background-color: #fff;
|
1044
|
+
/* background-color: #fff; */
|
1027
1045
|
padding: 4px 6px;
|
1028
1046
|
border-radius: 12px;
|
1029
1047
|
span {
|
1030
|
-
text-transform:
|
1048
|
+
text-transform: math-auto;
|
1031
1049
|
}
|
1032
1050
|
@media only screen and (max-width: 599px) {
|
1033
1051
|
background-color: unset;
|
@@ -1049,7 +1067,7 @@ blockquote {
|
|
1049
1067
|
}
|
1050
1068
|
|
1051
1069
|
.textFontArrows .MuiIconButton-root {
|
1052
|
-
padding:
|
1070
|
+
padding: 0px;
|
1053
1071
|
}
|
1054
1072
|
|
1055
1073
|
.tools-drawer .MuiTypography-root {
|
@@ -1073,6 +1091,10 @@ blockquote {
|
|
1073
1091
|
font-size: 14px;
|
1074
1092
|
}
|
1075
1093
|
|
1094
|
+
.listItemMargin {
|
1095
|
+
margin: 0px;
|
1096
|
+
}
|
1097
|
+
|
1076
1098
|
.content-editable.empty {
|
1077
1099
|
position: relative;
|
1078
1100
|
}
|
@@ -1226,8 +1248,10 @@ blockquote {
|
|
1226
1248
|
position: absolute;
|
1227
1249
|
}
|
1228
1250
|
|
1229
|
-
.dividerComponent:hover .divider-settings
|
1251
|
+
.dividerComponent:hover .divider-settings,
|
1252
|
+
.dividerComponent:hover .element-selector {
|
1230
1253
|
display: block;
|
1254
|
+
pointer-events: auto;
|
1231
1255
|
}
|
1232
1256
|
|
1233
1257
|
@media (max-width: 899px) {
|
@@ -1238,3 +1262,61 @@ blockquote {
|
|
1238
1262
|
max-width: 100% !important;
|
1239
1263
|
}
|
1240
1264
|
}
|
1265
|
+
|
1266
|
+
.settingsHeader {
|
1267
|
+
font-size: 14px !important;
|
1268
|
+
font-weight: 500 !important;
|
1269
|
+
}
|
1270
|
+
.hideScroll {
|
1271
|
+
overflow-anchor: none;
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
.hideScroll::-webkit-scrollbar-track {
|
1275
|
+
background: none !important;
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
.hideScroll::-webkit-scrollbar-thumb {
|
1279
|
+
background: none !important;
|
1280
|
+
}
|
1281
|
+
|
1282
|
+
.hideScroll::-webkit-scrollbar-thumb:hover {
|
1283
|
+
background: none !important;
|
1284
|
+
}
|
1285
|
+
|
1286
|
+
.custom-scroll::-webkit-scrollbar {
|
1287
|
+
height: .6rem;
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
.custom-scroll::-webkit-scrollbar-thumb {
|
1291
|
+
background: #888;
|
1292
|
+
border-radius: 5px;
|
1293
|
+
cursor: pointer;
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
.custom-scroll::-webkit-scrollbar-track {
|
1297
|
+
background: #f1f1f1;
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
.custom-scroll:hover::-webkit-scrollbar-thumb {
|
1301
|
+
background: #A7AEC1;
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
::selection {
|
1305
|
+
color: inherit;
|
1306
|
+
background: rgba(35, 131, 226, 0.35) !important;
|
1307
|
+
}
|
1308
|
+
|
1309
|
+
::-moz-selection {
|
1310
|
+
background: rgba(35, 131, 226, 0.35) !important;
|
1311
|
+
color: inherit;
|
1312
|
+
}
|
1313
|
+
|
1314
|
+
::-webkit-selection {
|
1315
|
+
background: rgba(35, 131, 226, 0.35) !important;
|
1316
|
+
color: inherit;
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
.gradientFillBtn {
|
1320
|
+
background: linear-gradient(112.61deg, #2C63ED 19.3%, #8360FD 88.14%) !important;
|
1321
|
+
text-transform: math-auto !important;
|
1322
|
+
}
|
@@ -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,15 @@ function CustomSelect({
|
|
8
8
|
classes,
|
9
9
|
options,
|
10
10
|
onSend,
|
11
|
-
show
|
11
|
+
show,
|
12
|
+
btnProps = {}
|
12
13
|
}) {
|
14
|
+
const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
|
13
15
|
if (show) {
|
14
16
|
return /*#__PURE__*/_jsx(Box, {
|
15
17
|
component: "div",
|
16
|
-
sx: classes.customSelectContainer,
|
18
|
+
sx: !isMobile && classes.customSelectContainer,
|
19
|
+
className: "customSelectContainer",
|
17
20
|
children: options?.map((groupOption, index) => {
|
18
21
|
const {
|
19
22
|
options,
|
@@ -28,7 +31,8 @@ function CustomSelect({
|
|
28
31
|
return /*#__PURE__*/_jsx(DisplayOption, {
|
29
32
|
option: option,
|
30
33
|
classes: classes,
|
31
|
-
onSend: onSend
|
34
|
+
onSend: onSend,
|
35
|
+
btnProps: btnProps
|
32
36
|
}, i);
|
33
37
|
})]
|
34
38
|
}, index);
|
@@ -42,15 +46,18 @@ export default CustomSelect;
|
|
42
46
|
function DisplayOption({
|
43
47
|
option,
|
44
48
|
classes,
|
45
|
-
onSend
|
49
|
+
onSend,
|
50
|
+
btnProps = {}
|
46
51
|
}) {
|
47
52
|
const {
|
48
|
-
Icon
|
53
|
+
Icon,
|
54
|
+
Component
|
49
55
|
} = option;
|
50
56
|
const [open, setOpen] = useState(false);
|
51
57
|
const optionRef = useRef();
|
58
|
+
const showChild = option.options?.length || Component;
|
52
59
|
const openOptions = e => {
|
53
|
-
if (
|
60
|
+
if (showChild && !open) {
|
54
61
|
setOpen(e.currentTarget);
|
55
62
|
return;
|
56
63
|
}
|
@@ -66,7 +73,7 @@ function DisplayOption({
|
|
66
73
|
e.stopPropagation();
|
67
74
|
|
68
75
|
// is having child options
|
69
|
-
if (
|
76
|
+
if (showChild) {
|
70
77
|
openOptions(e);
|
71
78
|
return;
|
72
79
|
}
|
@@ -75,18 +82,19 @@ function DisplayOption({
|
|
75
82
|
},
|
76
83
|
id: "infinity-select-popover",
|
77
84
|
className: open ? "active" : "",
|
85
|
+
...btnProps,
|
78
86
|
children: [/*#__PURE__*/_jsxs("div", {
|
79
87
|
className: "option-label",
|
80
88
|
id: "infinity-select-popover",
|
81
89
|
children: [Icon && /*#__PURE__*/_jsx(Icon, {}), option.label]
|
82
|
-
}),
|
90
|
+
}), showChild ? /*#__PURE__*/_jsx(IconButton, {
|
83
91
|
children: /*#__PURE__*/_jsx(FaChevronRight, {
|
84
92
|
color: "#94A3B8",
|
85
93
|
size: 12
|
86
94
|
})
|
87
|
-
})]
|
95
|
+
}) : null]
|
88
96
|
}), /*#__PURE__*/_jsx(Popper, {
|
89
|
-
open: open &&
|
97
|
+
open: open && showChild,
|
90
98
|
anchorEl: open,
|
91
99
|
sx: {
|
92
100
|
zIndex: 9001,
|
@@ -96,7 +104,7 @@ function DisplayOption({
|
|
96
104
|
setOpen(null);
|
97
105
|
},
|
98
106
|
placement: "right-start",
|
99
|
-
children: /*#__PURE__*/_jsx(Box, {
|
107
|
+
children: Component ? /*#__PURE__*/_jsx(Component, {}) : /*#__PURE__*/_jsx(Box, {
|
100
108
|
children: /*#__PURE__*/_jsx(CustomSelect, {
|
101
109
|
options: option.options,
|
102
110
|
onSend: onSend,
|