@flozy/editor 3.8.7 → 3.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/ChatEditor.js +2 -2
- package/dist/Editor/CommonEditor.js +170 -166
- package/dist/Editor/DialogWrapper.js +4 -3
- package/dist/Editor/Editor.css +4 -7
- package/dist/Editor/Elements/AI/AIInput.js +5 -16
- package/dist/Editor/Elements/AI/PopoverAIInput.js +64 -67
- package/dist/Editor/Elements/AI/Styles.js +1 -2
- package/dist/Editor/Elements/AppHeader/AppHeader.js +40 -49
- package/dist/Editor/Elements/Button/EditorButton.js +33 -38
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +17 -60
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
- package/dist/Editor/Elements/Embed/Image.js +15 -14
- package/dist/Editor/Elements/Embed/Video.js +12 -8
- package/dist/Editor/Elements/Emoji/EmojiButton.js +11 -7
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +391 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +193 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +23 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +184 -0
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +36 -0
- package/dist/Editor/Elements/FreeGrid/Options/More.js +24 -0
- package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +47 -0
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +11 -0
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +75 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +159 -0
- package/dist/Editor/Elements/Grid/Grid.js +14 -34
- package/dist/Editor/Elements/Grid/GridItem.js +31 -23
- package/dist/Editor/Elements/Link/Link.js +1 -6
- package/dist/Editor/Elements/Link/LinkButton.js +2 -4
- package/dist/Editor/Elements/Link/LinkPopup.js +3 -10
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +3 -3
- package/dist/Editor/Elements/Signature/SignaturePopup.js +3 -14
- package/dist/Editor/Elements/SimpleText/index.js +9 -8
- package/dist/Editor/Elements/SimpleText/style.js +37 -0
- package/dist/Editor/Elements/Table/Styles.js +1 -23
- package/dist/Editor/Elements/Table/Table.js +1 -2
- package/dist/Editor/Elements/Table/TableCell.js +7 -69
- package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +0 -1
- package/dist/Editor/ErrorBoundary.js +30 -0
- package/dist/Editor/MiniEditor.js +1 -3
- package/dist/Editor/Styles/EditorStyles.js +23 -0
- package/dist/Editor/Toolbar/Basic/index.js +2 -4
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +18 -29
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -4
- package/dist/Editor/Toolbar/Mini/Options/Options.js +0 -10
- package/dist/Editor/Toolbar/Mini/Styles.js +0 -7
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +13 -20
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +8 -52
- package/dist/Editor/Toolbar/PopupTool/index.js +13 -6
- package/dist/Editor/Toolbar/Toolbar.js +7 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +11 -48
- package/dist/Editor/assets/svg/AIIcons.js +1 -153
- package/dist/Editor/assets/svg/AddTemplateIcon.js +10 -13
- package/dist/Editor/assets/svg/TextIcon.js +5 -8
- package/dist/Editor/common/ColorPickerButton.js +9 -25
- package/dist/Editor/common/DnD/DragHandleButton.js +47 -56
- package/dist/Editor/common/Icon.js +8 -41
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
- package/dist/Editor/common/LinkSettings/index.js +2 -4
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
- package/dist/Editor/common/LinkSettings/style.js +8 -11
- package/dist/Editor/common/MentionsPopup/index.js +12 -8
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +105 -0
- package/dist/Editor/common/RnD/ContextMenu/index.js +38 -0
- package/dist/Editor/common/RnD/ContextMenu/styles.js +21 -0
- package/dist/Editor/common/RnD/DragInfo/index.js +31 -0
- package/dist/Editor/common/RnD/DragInfo/styles.js +15 -0
- package/dist/Editor/common/RnD/DragOver/index.js +46 -0
- package/dist/Editor/common/RnD/DragOver/styles.js +23 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +82 -0
- package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +26 -0
- package/dist/Editor/common/RnD/ElementOptions/index.js +93 -0
- package/dist/Editor/common/RnD/ElementOptions/styles.js +41 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +153 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +58 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +7 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +46 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +46 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +46 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +30 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +46 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +13 -0
- package/dist/Editor/common/RnD/ElementSettings/index.js +17 -0
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +14 -0
- package/dist/Editor/common/RnD/ElementSettings/styles.js +76 -0
- package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +52 -0
- package/dist/Editor/common/RnD/GuideLines/index.js +33 -0
- package/dist/Editor/common/RnD/GuideLines/styles.js +60 -0
- package/dist/Editor/common/RnD/OptionsPopup/index.js +50 -0
- package/dist/Editor/common/RnD/OptionsPopup/style.js +36 -0
- package/dist/Editor/common/RnD/RnDCopy.js +23 -0
- package/dist/Editor/common/RnD/ShadowElement.js +34 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +40 -0
- package/dist/Editor/common/RnD/SwitchViewport/styles.js +24 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +63 -0
- package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +19 -0
- package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +13 -0
- package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +18 -0
- package/dist/Editor/common/RnD/TransformHandles/index.js +62 -0
- package/dist/Editor/common/RnD/Utils/alignmentDetection.js +26 -0
- package/dist/Editor/common/RnD/Utils/calculateDropItem.js +98 -0
- package/dist/Editor/common/RnD/Utils/collisionDetection.js +52 -0
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +148 -0
- package/dist/Editor/common/RnD/Utils/index.js +251 -0
- package/dist/Editor/common/RnD/VirtualElement/index.js +76 -0
- package/dist/Editor/common/RnD/VirtualElement/styles.js +27 -0
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +28 -0
- package/dist/Editor/common/RnD/index.js +503 -0
- package/dist/Editor/common/RnD/styles.js +4 -0
- package/dist/Editor/common/Section/index.js +28 -69
- package/dist/Editor/common/Section/styles.js +6 -12
- package/dist/Editor/common/Shorthands/elements.js +12 -54
- package/dist/Editor/common/StyleBuilder/boxStyle.js +30 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +16 -19
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -31
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/common/StyleBuilder/sectionStyle.js +13 -2
- package/dist/Editor/common/iconslist.js +31 -0
- package/dist/Editor/helper/RnD/focusOnNewItem.js +39 -0
- package/dist/Editor/helper/RnD/scrollToNewSection.js +24 -0
- package/dist/Editor/helper/breakpoint.js +5 -0
- package/dist/Editor/helper/index.js +139 -0
- package/dist/Editor/helper/theme.js +48 -185
- package/dist/Editor/hooks/useBreakpoints.js +34 -0
- package/dist/Editor/hooks/useMouseMove.js +37 -12
- package/dist/Editor/hooks/useWindowMessage.js +7 -10
- package/dist/Editor/hooks/withCommon.js +2 -1
- package/dist/Editor/hooks/withErrorHandling.js +14 -0
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +1 -1
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +168 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +47 -163
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/events.js +7 -54
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/freegrid.js +49 -0
- package/dist/Editor/utils/helper.js +31 -31
- package/dist/Editor/utils/table.js +43 -51
- package/package.json +6 -4
- package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +0 -73
- package/dist/Editor/Elements/AI/VoiceToText/index.js +0 -167
- package/dist/Editor/Elements/AI/VoiceToText/style.js +0 -40
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +0 -28
- package/dist/Editor/Elements/Redo/RedoButton.js +0 -14
- package/dist/Editor/Elements/Undo/UndoButton.js +0 -14
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
- package/dist/Editor/assets/svg/RedoIcon.js +0 -27
- package/dist/Editor/assets/svg/SettingsIcon.js +0 -28
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
- package/dist/Editor/assets/svg/UndoIcon.js +0 -27
- package/dist/Editor/common/CustomColorPicker/index.js +0 -106
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog/index.js +0 -94
- package/dist/Editor/common/CustomDialog/style.js +0 -67
- package/dist/Editor/common/CustomSelect.js +0 -33
- package/dist/Editor/hooks/useEditorTheme.js +0 -139
- package/dist/Editor/theme/index.js +0 -144
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
- package/dist/Editor/themeSettings/buttons/index.js +0 -290
- package/dist/Editor/themeSettings/buttons/style.js +0 -21
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
- package/dist/Editor/themeSettings/fonts/index.js +0 -213
- package/dist/Editor/themeSettings/fonts/style.js +0 -44
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -320
- package/dist/Editor/themeSettings/style.js +0 -152
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -356
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
- package/dist/Editor/themeSettingsAI/style.js +0 -247
|
@@ -49,8 +49,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
49
49
|
if (editor) {
|
|
50
50
|
insertEmoji(editor, emoji?.native, editor.selection);
|
|
51
51
|
if (editor.selection) {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const path = editor.selection.anchor.path;
|
|
53
|
+
const offset = editor.selection.anchor.offset + emoji?.native.length;
|
|
54
54
|
const position = {
|
|
55
55
|
anchor: {
|
|
56
56
|
path: [0],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
|
-
import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle
|
|
2
|
+
import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle } from "react";
|
|
3
|
+
import PropTypes, { object } from "prop-types";
|
|
3
4
|
import { createEditor, Transforms } from "slate";
|
|
4
5
|
import { Slate, Editable, ReactEditor } from "slate-react";
|
|
5
6
|
import { useDebounce, useDebouncedCallback } from "use-debounce";
|
|
@@ -18,7 +19,7 @@ import { getThumbnailImage, invertColor } from "./helper";
|
|
|
18
19
|
import PopupTool from "./Toolbar/PopupTool";
|
|
19
20
|
import "./font.css";
|
|
20
21
|
import "./Editor.css";
|
|
21
|
-
import { Box,
|
|
22
|
+
import { Box, Typography, useTheme } from "@mui/material";
|
|
22
23
|
import Shorthands from "./common/Shorthands";
|
|
23
24
|
import MiniToolbar from "./Toolbar/Mini/MiniToolbar";
|
|
24
25
|
import { EditorProvider } from "./hooks/useMouseMove";
|
|
@@ -26,21 +27,16 @@ import TopBanner from "./Elements/TopBanner/TopBanner";
|
|
|
26
27
|
import editorStyles from "./Styles/EditorStyles";
|
|
27
28
|
import DragAndDrop from "./common/DnD";
|
|
28
29
|
import Section from "./common/Section";
|
|
29
|
-
import "animate.css";
|
|
30
30
|
import decorators from "./utils/Decorators";
|
|
31
|
-
import { getTRBLBreakPoints
|
|
31
|
+
import { getTRBLBreakPoints } from "./helper/theme";
|
|
32
32
|
import { handleInsertLastElement, onDeleteKey, outsideEditorClickLabel } from "./utils/helper";
|
|
33
33
|
import useWindowResize from "./hooks/useWindowResize";
|
|
34
|
-
import { getTheme } from "./theme";
|
|
35
|
-
import { useTheme } from "@emotion/react";
|
|
36
|
-
import ThemeSettings from "./themeSettings";
|
|
37
|
-
import ThemeSettingsAI from "./themeSettingsAI";
|
|
38
|
-
import { Experimental_CssVarsProvider as CssVarsProvider, experimental_extendTheme as extendTheme } from "@mui/material/styles";
|
|
39
34
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
|
40
|
-
import
|
|
35
|
+
import RnDCopy from "./common/RnD/RnDCopy";
|
|
36
|
+
import "animate.css";
|
|
37
|
+
import SwitchViewport from "./common/RnD/SwitchViewport/SwitchViewport";
|
|
41
38
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
42
39
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
43
|
-
export const ThemeContext = /*#__PURE__*/createContext(null);
|
|
44
40
|
const Item = /*#__PURE__*/forwardRef(({
|
|
45
41
|
children,
|
|
46
42
|
...props
|
|
@@ -87,8 +83,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
87
83
|
toolbarOptions,
|
|
88
84
|
otherProps,
|
|
89
85
|
isIframe,
|
|
90
|
-
theme
|
|
91
|
-
showThemeButtons
|
|
86
|
+
theme
|
|
92
87
|
} = props;
|
|
93
88
|
const editorWrapper = useRef();
|
|
94
89
|
const mentionsRef = useRef();
|
|
@@ -108,6 +103,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
108
103
|
});
|
|
109
104
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
110
105
|
const [isTextSelected, setIsTextSelected] = useState(false);
|
|
106
|
+
const [breakpoint, setBreakpoint] = useState("");
|
|
111
107
|
const [size] = useWindowResize();
|
|
112
108
|
const {
|
|
113
109
|
needDotsBG,
|
|
@@ -119,7 +115,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
119
115
|
fullWidth = "80%",
|
|
120
116
|
hideTools
|
|
121
117
|
} = otherProps || {};
|
|
122
|
-
const [drag, setDrag] = useState(null);
|
|
123
118
|
const editor = useMemo(() => {
|
|
124
119
|
if (collaborativeEditor) return collaborativeEditor;
|
|
125
120
|
return withCommon(createEditor(), {
|
|
@@ -132,11 +127,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
132
127
|
const {
|
|
133
128
|
bannerSpacing,
|
|
134
129
|
pageBgImage,
|
|
135
|
-
pageColor
|
|
130
|
+
pageColor,
|
|
136
131
|
color: pageTextColor,
|
|
137
132
|
pageWidth,
|
|
138
|
-
maxWidth: pageMaxWidth
|
|
139
|
-
theme: selectedTheme
|
|
133
|
+
maxWidth: pageMaxWidth
|
|
140
134
|
} = pageSt?.pageProps || {
|
|
141
135
|
bannerSpacing: {
|
|
142
136
|
left: 0,
|
|
@@ -147,15 +141,16 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
147
141
|
};
|
|
148
142
|
const classes = editorStyles({
|
|
149
143
|
padHeight: !fullScreen ? otherProps?.padHeight : 20,
|
|
150
|
-
placeHolderColor: invertColor(pageColor
|
|
144
|
+
placeHolderColor: invertColor(pageColor || "#FFF"),
|
|
151
145
|
theme
|
|
152
146
|
});
|
|
153
|
-
const [openTheme, setOpenTheme] = useState(false);
|
|
154
|
-
const [openAITheme, setOpenAITheme] = useState(false);
|
|
155
147
|
useEffect(() => {
|
|
156
148
|
setValue(draftToSlate({
|
|
157
149
|
data: content
|
|
158
150
|
}));
|
|
151
|
+
if (!ReactEditor.isFocused(editor)) {
|
|
152
|
+
ReactEditor.focus(editor);
|
|
153
|
+
}
|
|
159
154
|
}, [id, content]);
|
|
160
155
|
useEffect(() => {
|
|
161
156
|
if (editorWrapper && editorWrapper?.current && JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
|
@@ -184,6 +179,17 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
184
179
|
});
|
|
185
180
|
return c;
|
|
186
181
|
};
|
|
182
|
+
|
|
183
|
+
// Example of resetting or re-rendering all nodes
|
|
184
|
+
const reRenderAllNodes = () => {
|
|
185
|
+
const newNodes = JSON.parse(JSON.stringify(value));
|
|
186
|
+
setValue(newNodes); // This will re-render the whole document
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const onSwitchBreakpoint = b => {
|
|
190
|
+
setBreakpoint(b);
|
|
191
|
+
reRenderAllNodes();
|
|
192
|
+
};
|
|
187
193
|
useImperativeHandle(ref, () => ({
|
|
188
194
|
async getThumbnail(needBackground = false, options = {}) {
|
|
189
195
|
try {
|
|
@@ -245,18 +251,15 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
245
251
|
h
|
|
246
252
|
});
|
|
247
253
|
},
|
|
254
|
+
switchViewport(bp) {
|
|
255
|
+
setBreakpoint(bp);
|
|
256
|
+
},
|
|
248
257
|
undo() {
|
|
249
258
|
editor?.undo();
|
|
250
259
|
},
|
|
251
260
|
redo() {
|
|
252
261
|
editor?.redo();
|
|
253
262
|
},
|
|
254
|
-
toggleTheme() {
|
|
255
|
-
setOpenTheme(!openTheme);
|
|
256
|
-
},
|
|
257
|
-
toggleAITheme() {
|
|
258
|
-
setOpenAITheme(!openAITheme);
|
|
259
|
-
},
|
|
260
263
|
getPageSettings: {
|
|
261
264
|
background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
|
|
262
265
|
}
|
|
@@ -323,6 +326,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
323
326
|
const onKeyDown = useCallback(event => {
|
|
324
327
|
const isMetaKey = event.metaKey && event.keyCode >= 65 && event.keyCode <= 90;
|
|
325
328
|
const isCtrlKey = event.ctrlKey || isMetaKey;
|
|
329
|
+
// for RnD item move front and back
|
|
330
|
+
const isUpandDown = event.metaKey && [38, 40].indexOf(event.keyCode) > -1;
|
|
326
331
|
if (target && chars.length > 0 && !isCtrlKey) {
|
|
327
332
|
mentionsEvent({
|
|
328
333
|
event,
|
|
@@ -334,7 +339,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
334
339
|
type,
|
|
335
340
|
mentionsRef
|
|
336
341
|
});
|
|
337
|
-
} else if (isCtrlKey) {
|
|
342
|
+
} else if (isCtrlKey || isUpandDown) {
|
|
338
343
|
commands({
|
|
339
344
|
event,
|
|
340
345
|
editor,
|
|
@@ -404,155 +409,154 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
404
409
|
}
|
|
405
410
|
return style;
|
|
406
411
|
}, [pageBgImage, pageColor]);
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
children: /*#__PURE__*/
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
children: [/*#__PURE__*/_jsx(Box, {
|
|
456
|
-
className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
|
|
457
|
-
sx: classes.slateWrapper,
|
|
458
|
-
id: "slate-wrapper-scroll-container"
|
|
459
|
-
// style={editorWrapperStyle}
|
|
460
|
-
,
|
|
461
|
-
ref: editorWrapper,
|
|
462
|
-
onClick: e => {
|
|
463
|
-
handleInsertLastElement(e, editor);
|
|
464
|
-
},
|
|
465
|
-
onScroll: handleScroll,
|
|
466
|
-
style: editorWrapperStyle,
|
|
412
|
+
const handleContextMenu = e => {
|
|
413
|
+
if (!readOnly) {
|
|
414
|
+
e.preventDefault();
|
|
415
|
+
e.stopPropagation();
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
return /*#__PURE__*/_jsx(EditorProvider, {
|
|
419
|
+
theme: theme,
|
|
420
|
+
editor: editor,
|
|
421
|
+
children: /*#__PURE__*/_jsx(DialogWrapper, {
|
|
422
|
+
classes: classes,
|
|
423
|
+
...props,
|
|
424
|
+
fullScreen: fullScreen,
|
|
425
|
+
footer: footer || "",
|
|
426
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
427
|
+
component: "div",
|
|
428
|
+
className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
|
|
429
|
+
sx: classes.root,
|
|
430
|
+
style: {
|
|
431
|
+
...dotBg
|
|
432
|
+
},
|
|
433
|
+
"data-breakpoint": breakpoint,
|
|
434
|
+
onContextMenu: handleContextMenu,
|
|
435
|
+
children: /*#__PURE__*/_jsxs(Slate, {
|
|
436
|
+
editor: editor,
|
|
437
|
+
initialValue: value,
|
|
438
|
+
onChange: handleEditorChange,
|
|
439
|
+
children: [/*#__PURE__*/_jsx(DragAndDrop, {
|
|
440
|
+
children: /*#__PURE__*/_jsxs(Overlay, {
|
|
441
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
442
|
+
className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
|
|
443
|
+
sx: classes.slateWrapper,
|
|
444
|
+
id: "slate-wrapper-scroll-container"
|
|
445
|
+
// style={editorWrapperStyle}
|
|
446
|
+
,
|
|
447
|
+
ref: editorWrapper,
|
|
448
|
+
onClick: e => {
|
|
449
|
+
handleInsertLastElement(e, editor);
|
|
450
|
+
},
|
|
451
|
+
onScroll: handleScroll,
|
|
452
|
+
style: editorWrapperStyle,
|
|
453
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
454
|
+
component: "div",
|
|
455
|
+
className: "max-content",
|
|
456
|
+
"data-info": outsideEditorClickLabel,
|
|
457
|
+
children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
|
|
458
|
+
className: "scroll-area",
|
|
459
|
+
"data-info": outsideEditorClickLabel,
|
|
467
460
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
468
461
|
component: "div",
|
|
469
|
-
className:
|
|
470
|
-
sx:
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
"data-info": outsideEditorClickLabel,
|
|
475
|
-
children: /*#__PURE__*/_jsxs(Box, {
|
|
476
|
-
component: "div",
|
|
477
|
-
className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
|
|
478
|
-
sx: {
|
|
479
|
-
backgroundColor: "transparent",
|
|
480
|
-
padding: {
|
|
481
|
-
...getTRBLBreakPoints(bannerSpacing)
|
|
482
|
-
},
|
|
483
|
-
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
|
484
|
-
height: viewport.h ? `${viewport.h}px` : `100%`,
|
|
485
|
-
alignSelf: "center",
|
|
486
|
-
transformOrigin: "left top",
|
|
487
|
-
transition: "all 0.3s",
|
|
488
|
-
minHeight: "87%",
|
|
489
|
-
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
|
|
490
|
-
},
|
|
491
|
-
"data-info": outsideEditorClickLabel,
|
|
492
|
-
children: [/*#__PURE__*/_jsx(Editable, {
|
|
493
|
-
className: "innert-editor-textbox",
|
|
494
|
-
readOnly: isReadOnly,
|
|
495
|
-
renderElement: renderElement,
|
|
496
|
-
renderLeaf: renderLeaf,
|
|
497
|
-
decorate: decorators,
|
|
498
|
-
onKeyDown: onKeyDown
|
|
499
|
-
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
|
500
|
-
ref: mentionsRef,
|
|
501
|
-
mentions: mentions,
|
|
502
|
-
setMentions: setMentions,
|
|
503
|
-
editor: editor,
|
|
504
|
-
target: target,
|
|
505
|
-
index: index,
|
|
506
|
-
chars: chars,
|
|
507
|
-
type: type,
|
|
508
|
-
theme: theme
|
|
509
|
-
}) : null]
|
|
510
|
-
})
|
|
511
|
-
}), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
|
|
512
|
-
customProps: customProps,
|
|
513
|
-
toolbarOptions: toolbarOptions,
|
|
514
|
-
theme: theme
|
|
515
|
-
}) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
|
|
516
|
-
otherProps: otherProps || {}
|
|
517
|
-
}), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
|
|
518
|
-
sx: {
|
|
519
|
-
color: "rgb(100, 116, 139)",
|
|
520
|
-
fontSize: "13px",
|
|
521
|
-
paddingBottom: hideMiniToolBar ? "0px" : "12px",
|
|
522
|
-
cursor: "pointer"
|
|
462
|
+
className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
|
|
463
|
+
sx: {
|
|
464
|
+
backgroundColor: "transparent",
|
|
465
|
+
padding: {
|
|
466
|
+
...getTRBLBreakPoints(bannerSpacing)
|
|
523
467
|
},
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
468
|
+
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
|
469
|
+
height: viewport.h ? `${viewport.h}px` : `100%`,
|
|
470
|
+
alignSelf: "center",
|
|
471
|
+
transformOrigin: "left top",
|
|
472
|
+
transition: "all 0.3s",
|
|
473
|
+
minHeight: "87%",
|
|
474
|
+
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
|
|
475
|
+
},
|
|
476
|
+
"data-info": outsideEditorClickLabel,
|
|
477
|
+
children: [/*#__PURE__*/_jsx(Editable, {
|
|
478
|
+
className: "innert-editor-textbox",
|
|
479
|
+
readOnly: isReadOnly,
|
|
480
|
+
renderElement: renderElement,
|
|
481
|
+
renderLeaf: renderLeaf,
|
|
482
|
+
decorate: decorators,
|
|
483
|
+
onKeyDown: onKeyDown
|
|
484
|
+
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
|
485
|
+
ref: mentionsRef,
|
|
486
|
+
mentions: mentions,
|
|
487
|
+
setMentions: setMentions,
|
|
531
488
|
editor: editor,
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
489
|
+
target: target,
|
|
490
|
+
index: index,
|
|
491
|
+
chars: chars,
|
|
492
|
+
type: type,
|
|
493
|
+
theme: theme
|
|
494
|
+
}) : null, /*#__PURE__*/_jsx(RnDCopy, {
|
|
495
|
+
readOnly: readOnly
|
|
537
496
|
})]
|
|
538
497
|
})
|
|
539
|
-
}), !
|
|
540
|
-
|
|
541
|
-
theme: theme
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
})
|
|
498
|
+
}), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
|
|
499
|
+
customProps: customProps,
|
|
500
|
+
theme: theme
|
|
501
|
+
}) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
|
|
502
|
+
otherProps: otherProps || {}
|
|
503
|
+
}), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
|
|
504
|
+
sx: {
|
|
505
|
+
color: "rgb(100, 116, 139)",
|
|
506
|
+
fontSize: "13px",
|
|
507
|
+
paddingBottom: hideMiniToolBar ? "0px" : "12px",
|
|
508
|
+
cursor: "pointer"
|
|
509
|
+
},
|
|
510
|
+
align: "center",
|
|
511
|
+
"data-info": outsideEditorClickLabel,
|
|
512
|
+
onClick: handleFooterClick,
|
|
513
|
+
children: footer
|
|
514
|
+
})]
|
|
545
515
|
})
|
|
546
|
-
}),
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
516
|
+
}), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
|
|
517
|
+
onDrawerOpen: onDrawerOpen,
|
|
518
|
+
theme: theme,
|
|
519
|
+
setIsTextSelected: setIsTextSelected,
|
|
520
|
+
customProps: customProps
|
|
521
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
|
522
|
+
breakpoint: breakpoint,
|
|
523
|
+
onChange: b => onSwitchBreakpoint(b)
|
|
524
|
+
}) : null]
|
|
525
|
+
})
|
|
526
|
+
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
|
527
|
+
...htmlAction,
|
|
528
|
+
handleCodeToText: handleCodeToText
|
|
529
|
+
})]
|
|
530
|
+
}, id)
|
|
553
531
|
})
|
|
554
532
|
})
|
|
555
533
|
});
|
|
556
534
|
});
|
|
557
535
|
CommonEditor.displayName = "CommonEditor";
|
|
536
|
+
CommonEditor.propTypes = {
|
|
537
|
+
/** Id of the content */
|
|
538
|
+
id: PropTypes.string,
|
|
539
|
+
/** Set to true for readonly mode */
|
|
540
|
+
readOnly: PropTypes.oneOf(["readonly", ""]),
|
|
541
|
+
/** It can be a draft js content or a slate js content */
|
|
542
|
+
content: PropTypes.any,
|
|
543
|
+
/** User details */
|
|
544
|
+
user: PropTypes.object,
|
|
545
|
+
/** API URL base for pages api calls */
|
|
546
|
+
apiHOST: PropTypes.string,
|
|
547
|
+
/** A callback function with updated edited content,
|
|
548
|
+
* this method will get called whenever the content changes happen and wait idle for 500ms
|
|
549
|
+
* uses the debounce mechanism
|
|
550
|
+
*/
|
|
551
|
+
onSave: PropTypes.func,
|
|
552
|
+
/**
|
|
553
|
+
* MUI theme object form parent application
|
|
554
|
+
*/
|
|
555
|
+
theme: PropTypes.object,
|
|
556
|
+
/**
|
|
557
|
+
* Editor component based props can be passed here
|
|
558
|
+
* @property {bool} isSignerDetailsRequired - To make username and email required in Forms
|
|
559
|
+
*/
|
|
560
|
+
otherProps: PropTypes.object
|
|
561
|
+
};
|
|
558
562
|
export default CommonEditor;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Dialog, DialogTitle, DialogContent, IconButton, Grid } from "@mui/material";
|
|
3
3
|
import CloseIcon from "@mui/icons-material/Close";
|
|
4
|
-
|
|
5
|
-
// import commonStyle from "./commonStyle";
|
|
4
|
+
import ViewportStimulator from "./common/RnD/Theme/ViewportStimulator";
|
|
6
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
7
|
const DialogWrapper = props => {
|
|
@@ -43,7 +42,9 @@ const DialogWrapper = props => {
|
|
|
43
42
|
}), /*#__PURE__*/_jsx(DialogContent, {
|
|
44
43
|
children: children
|
|
45
44
|
})]
|
|
46
|
-
}) :
|
|
45
|
+
}) : /*#__PURE__*/_jsx(ViewportStimulator, {
|
|
46
|
+
children: children
|
|
47
|
+
});
|
|
47
48
|
};
|
|
48
49
|
DialogWrapper.defaultProps = {
|
|
49
50
|
fullScreen: false,
|
package/dist/Editor/Editor.css
CHANGED
|
@@ -245,13 +245,6 @@ blockquote {
|
|
|
245
245
|
width: 17px !important;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
.react-datepicker__input-container input {
|
|
249
|
-
height: 40px !important;
|
|
250
|
-
border: 1px solid #ccc;
|
|
251
|
-
border-radius: 5px;
|
|
252
|
-
width: 100%;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
248
|
.close-popupbtn {
|
|
256
249
|
border-radius: 4px !important;
|
|
257
250
|
width: 24px;
|
|
@@ -1134,4 +1127,8 @@ blockquote {
|
|
|
1134
1127
|
|
|
1135
1128
|
.scrollSmooth {
|
|
1136
1129
|
scroll-behavior: smooth;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
.freegrid-section {
|
|
1133
|
+
max-width: 100% !important;
|
|
1137
1134
|
}
|
|
@@ -11,8 +11,6 @@ import CustomSelect from "./CustomSelect";
|
|
|
11
11
|
import { editContentOptions, newContentOptions, generatedContentOptions } from "./helper";
|
|
12
12
|
import useClickOutside from "../../hooks/useClickOutside";
|
|
13
13
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
14
|
-
// import { VoiceToText } from "./VoiceToText";
|
|
15
|
-
import { ChatMicIcon } from "../../assets/svg/AIIcons";
|
|
16
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
16
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -38,13 +36,12 @@ function getProps(openAI, generatedText) {
|
|
|
38
36
|
}
|
|
39
37
|
function AIInput({
|
|
40
38
|
onSend,
|
|
39
|
+
loading,
|
|
41
40
|
generatedText,
|
|
42
41
|
openAI,
|
|
43
42
|
inputValue,
|
|
44
43
|
onInputChange,
|
|
45
|
-
onClickOutside
|
|
46
|
-
startRecording,
|
|
47
|
-
...rest
|
|
44
|
+
onClickOutside
|
|
48
45
|
}, ref) {
|
|
49
46
|
const {
|
|
50
47
|
theme
|
|
@@ -70,7 +67,6 @@ function AIInput({
|
|
|
70
67
|
clearTimeout(timeoutId);
|
|
71
68
|
};
|
|
72
69
|
}, [openAI]);
|
|
73
|
-
const loading = rest?.loading || rest?.isAILoading;
|
|
74
70
|
const isSendBtnDisabled = !inputValue || loading;
|
|
75
71
|
const props = getProps(openAI, generatedText) || {};
|
|
76
72
|
const fromToolBar = openAI === "fromToolBar";
|
|
@@ -136,25 +132,18 @@ function AIInput({
|
|
|
136
132
|
handleSendBtnClick();
|
|
137
133
|
}
|
|
138
134
|
}
|
|
139
|
-
}), fromToolBar ? null : /*#__PURE__*/
|
|
135
|
+
}), fromToolBar ? null : /*#__PURE__*/_jsx(Box, {
|
|
140
136
|
component: "div",
|
|
141
137
|
style: classes.sendIconContainer,
|
|
142
138
|
className: "icons-elements",
|
|
143
|
-
children:
|
|
144
|
-
// sx={
|
|
145
|
-
// isSendBtnDisabled ? classes.sendBtnDisabled : classes.sendBtn
|
|
146
|
-
// }
|
|
147
|
-
, {
|
|
148
|
-
onClick: () => startRecording(),
|
|
149
|
-
children: /*#__PURE__*/_jsx(ChatMicIcon, {})
|
|
150
|
-
}), /*#__PURE__*/_jsx(IconButton, {
|
|
139
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
151
140
|
sx: isSendBtnDisabled ? classes.sendBtnDisabled : classes.sendBtn,
|
|
152
141
|
onClick: () => handleSendBtnClick(),
|
|
153
142
|
children: /*#__PURE__*/_jsx(IoSend, {
|
|
154
143
|
color: "#fff",
|
|
155
144
|
size: 14
|
|
156
145
|
})
|
|
157
|
-
})
|
|
146
|
+
})
|
|
158
147
|
})]
|
|
159
148
|
})]
|
|
160
149
|
}), size.device === "xs" ? null : /*#__PURE__*/_jsx(Box, {
|