@flozy/editor 4.0.2 → 4.0.4
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 +14 -9
- package/dist/Editor/CommonEditor.js +185 -170
- package/dist/Editor/DialogWrapper.js +4 -3
- package/dist/Editor/Editor.css +5 -19
- package/dist/Editor/Elements/AI/PopoverAIInput.js +52 -41
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +4 -15
- package/dist/Editor/Elements/AppHeader/AppHeader.js +39 -26
- package/dist/Editor/Elements/Button/EditorButton.js +33 -38
- package/dist/Editor/Elements/Carousel/CarouselButton.js +0 -1
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -59
- 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/Form.js +43 -27
- package/dist/Editor/Elements/Form/FormField.js +21 -10
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
- package/dist/Editor/Elements/Form/Workflow/index.js +5 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +437 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +206 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +23 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +236 -0
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +44 -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 +19 -0
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +75 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +214 -0
- package/dist/Editor/Elements/Grid/Grid.js +11 -9
- 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 +15 -18
- package/dist/Editor/Elements/NewLine/NewLineButton.js +0 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +1 -1
- package/dist/Editor/Elements/SimpleText/index.js +18 -16
- package/dist/Editor/Elements/SimpleText/style.js +43 -0
- package/dist/Editor/ErrorBoundary.js +30 -0
- package/dist/Editor/MiniEditor.js +1 -3
- package/dist/Editor/Styles/EditorStyles.js +28 -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 +11 -5
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -3
- 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 +14 -26
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +2 -68
- package/dist/Editor/Toolbar/PopupTool/index.js +8 -0
- package/dist/Editor/Toolbar/Toolbar.js +7 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +16 -48
- package/dist/Editor/common/ColorPickerButton.js +9 -25
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/EditorCmds.js +0 -3
- package/dist/Editor/common/Icon.js +16 -34
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
- package/dist/Editor/common/LinkSettings/index.js +1 -2
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
- package/dist/Editor/common/MentionsPopup/index.js +12 -8
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +142 -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 +55 -0
- package/dist/Editor/common/RnD/DragOver/styles.js +23 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +102 -0
- package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +26 -0
- package/dist/Editor/common/RnD/ElementOptions/index.js +95 -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/SaveAsTemplate.js +36 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +60 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +9 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +48 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +30 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +17 -0
- package/dist/Editor/common/RnD/ElementSettings/index.js +17 -0
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +18 -0
- package/dist/Editor/common/RnD/ElementSettings/styles.js +94 -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 +62 -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 +20 -0
- package/dist/Editor/common/RnD/TransformHandles/index.js +67 -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 +181 -0
- package/dist/Editor/common/RnD/Utils/index.js +251 -0
- package/dist/Editor/common/RnD/VirtualElement/index.js +77 -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 +567 -0
- package/dist/Editor/common/RnD/styles.js +4 -0
- package/dist/Editor/common/Section/index.js +21 -12
- package/dist/Editor/common/Section/styles.js +7 -4
- 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 +36 -44
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +23 -33
- 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/saveAsTemplate.js +18 -5
- 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 +5 -3
- package/dist/Editor/common/StyleBuilder/sectionStyle.js +13 -2
- 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 -186
- package/dist/Editor/hooks/useBreakpoints.js +34 -0
- package/dist/Editor/hooks/useMouseMove.js +37 -12
- 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 +197 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +60 -164
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/events.js +5 -0
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/form.js +7 -2
- package/dist/Editor/utils/formfield.js +1 -1
- package/dist/Editor/utils/freegrid.js +91 -0
- package/dist/Editor/utils/helper.js +44 -30
- package/dist/Editor/utils/insertAppHeader.js +47 -40
- package/package.json +5 -2
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
- 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
|
@@ -110,12 +110,12 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}));
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
setIsExternalUpdate(true);
|
|
115
|
+
setValue(draftToSlate({
|
|
116
|
+
data: content
|
|
117
|
+
}));
|
|
118
|
+
}, [content]);
|
|
119
119
|
useEffect(() => {
|
|
120
120
|
if (JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
|
121
121
|
const {
|
|
@@ -178,9 +178,14 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
180
|
const handleEditorChange = newValue => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
if (isExternalUpdate) {
|
|
182
|
+
setIsExternalUpdate(false);
|
|
183
|
+
return;
|
|
184
|
+
} else {
|
|
185
|
+
setValue(newValue);
|
|
186
|
+
if (!isInteracted) {
|
|
187
|
+
setIsInteracted(true);
|
|
188
|
+
}
|
|
184
189
|
}
|
|
185
190
|
};
|
|
186
191
|
const Element = props => {
|
|
@@ -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 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";
|
|
@@ -16,9 +17,7 @@ import { serializeToText } from "./utils/serializeToText";
|
|
|
16
17
|
import { getPageSettings } from "./utils/pageSettings";
|
|
17
18
|
import { getThumbnailImage, invertColor } from "./helper";
|
|
18
19
|
import PopupTool from "./Toolbar/PopupTool";
|
|
19
|
-
import "
|
|
20
|
-
import "./Editor.css";
|
|
21
|
-
import { Box, IconButton, Typography } from "@mui/material";
|
|
20
|
+
import { Box, Typography, useTheme } from "@mui/material";
|
|
22
21
|
import Shorthands from "./common/Shorthands";
|
|
23
22
|
import MiniToolbar from "./Toolbar/Mini/MiniToolbar";
|
|
24
23
|
import { EditorProvider } from "./hooks/useMouseMove";
|
|
@@ -26,21 +25,19 @@ import TopBanner from "./Elements/TopBanner/TopBanner";
|
|
|
26
25
|
import editorStyles from "./Styles/EditorStyles";
|
|
27
26
|
import DragAndDrop from "./common/DnD";
|
|
28
27
|
import Section from "./common/Section";
|
|
29
|
-
import "animate.css";
|
|
30
28
|
import decorators from "./utils/Decorators";
|
|
31
|
-
import { getTRBLBreakPoints
|
|
32
|
-
import { handleInsertLastElement,
|
|
29
|
+
import { getTRBLBreakPoints } from "./helper/theme";
|
|
30
|
+
import { handleInsertLastElement, isFreeGridFragment, outsideEditorClickLabel } from "./utils/helper";
|
|
33
31
|
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
32
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
|
40
|
-
import
|
|
33
|
+
import RnDCopy from "./common/RnD/RnDCopy";
|
|
34
|
+
import SwitchViewport from "./common/RnD/SwitchViewport/SwitchViewport";
|
|
35
|
+
import { onInsertFragment } from "./utils/RnD/RnDCtrlCmds";
|
|
36
|
+
import "./font.css";
|
|
37
|
+
import "./Editor.css";
|
|
38
|
+
import "animate.css";
|
|
41
39
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
42
40
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
43
|
-
export const ThemeContext = /*#__PURE__*/createContext(null);
|
|
44
41
|
const Item = /*#__PURE__*/forwardRef(({
|
|
45
42
|
children,
|
|
46
43
|
...props
|
|
@@ -88,7 +85,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
88
85
|
otherProps,
|
|
89
86
|
isIframe,
|
|
90
87
|
theme,
|
|
91
|
-
|
|
88
|
+
showViewport = false
|
|
92
89
|
} = props;
|
|
93
90
|
const editorWrapper = useRef();
|
|
94
91
|
const mentionsRef = useRef();
|
|
@@ -108,6 +105,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
108
105
|
});
|
|
109
106
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
110
107
|
const [isTextSelected, setIsTextSelected] = useState(false);
|
|
108
|
+
const [breakpoint, setBreakpoint] = useState("");
|
|
111
109
|
const [size] = useWindowResize();
|
|
112
110
|
const {
|
|
113
111
|
needDotsBG,
|
|
@@ -119,7 +117,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
119
117
|
fullWidth = "80%",
|
|
120
118
|
hideTools
|
|
121
119
|
} = otherProps || {};
|
|
122
|
-
const [drag, setDrag] = useState(null);
|
|
123
120
|
const editor = useMemo(() => {
|
|
124
121
|
if (collaborativeEditor) return collaborativeEditor;
|
|
125
122
|
return withCommon(createEditor(), {
|
|
@@ -132,11 +129,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
132
129
|
const {
|
|
133
130
|
bannerSpacing,
|
|
134
131
|
pageBgImage,
|
|
135
|
-
pageColor
|
|
132
|
+
pageColor,
|
|
136
133
|
color: pageTextColor,
|
|
137
134
|
pageWidth,
|
|
138
|
-
maxWidth: pageMaxWidth
|
|
139
|
-
theme: selectedTheme
|
|
135
|
+
maxWidth: pageMaxWidth
|
|
140
136
|
} = pageSt?.pageProps || {
|
|
141
137
|
bannerSpacing: {
|
|
142
138
|
left: 0,
|
|
@@ -147,15 +143,16 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
147
143
|
};
|
|
148
144
|
const classes = editorStyles({
|
|
149
145
|
padHeight: !fullScreen ? otherProps?.padHeight : 20,
|
|
150
|
-
placeHolderColor: invertColor(pageColor
|
|
146
|
+
placeHolderColor: invertColor(pageColor || "#FFF"),
|
|
151
147
|
theme
|
|
152
148
|
});
|
|
153
|
-
const [openTheme, setOpenTheme] = useState(false);
|
|
154
|
-
const [openAITheme, setOpenAITheme] = useState(false);
|
|
155
149
|
useEffect(() => {
|
|
156
150
|
setValue(draftToSlate({
|
|
157
151
|
data: content
|
|
158
152
|
}));
|
|
153
|
+
if (!ReactEditor.isFocused(editor)) {
|
|
154
|
+
ReactEditor.focus(editor);
|
|
155
|
+
}
|
|
159
156
|
}, [id, content]);
|
|
160
157
|
useEffect(() => {
|
|
161
158
|
if (editorWrapper && editorWrapper?.current && JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
|
@@ -184,6 +181,17 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
184
181
|
});
|
|
185
182
|
return c;
|
|
186
183
|
};
|
|
184
|
+
|
|
185
|
+
// Example of resetting or re-rendering all nodes
|
|
186
|
+
const reRenderAllNodes = () => {
|
|
187
|
+
const newNodes = JSON.parse(JSON.stringify(value));
|
|
188
|
+
setValue(newNodes); // This will re-render the whole document
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const onSwitchBreakpoint = b => {
|
|
192
|
+
setBreakpoint(b);
|
|
193
|
+
reRenderAllNodes();
|
|
194
|
+
};
|
|
187
195
|
useImperativeHandle(ref, () => ({
|
|
188
196
|
async getThumbnail(needBackground = false, options = {}) {
|
|
189
197
|
try {
|
|
@@ -203,7 +211,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
203
211
|
insertFragments(fragments, clearAll = false, rest = {}) {
|
|
204
212
|
try {
|
|
205
213
|
if (!clearAll) {
|
|
206
|
-
if (
|
|
214
|
+
if (isFreeGridFragment(fragments)) {
|
|
215
|
+
onInsertFragment({
|
|
216
|
+
editor,
|
|
217
|
+
slateNodes: fragments[0] || fragments
|
|
218
|
+
});
|
|
219
|
+
} else if (rest?.nextLine) {
|
|
207
220
|
const {
|
|
208
221
|
anchor
|
|
209
222
|
} = editor?.selection || {};
|
|
@@ -245,18 +258,16 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
245
258
|
h
|
|
246
259
|
});
|
|
247
260
|
},
|
|
261
|
+
switchViewport(bp) {
|
|
262
|
+
console.log("switching breakpoint", bp);
|
|
263
|
+
onSwitchBreakpoint(bp);
|
|
264
|
+
},
|
|
248
265
|
undo() {
|
|
249
266
|
editor?.undo();
|
|
250
267
|
},
|
|
251
268
|
redo() {
|
|
252
269
|
editor?.redo();
|
|
253
270
|
},
|
|
254
|
-
toggleTheme() {
|
|
255
|
-
setOpenTheme(!openTheme);
|
|
256
|
-
},
|
|
257
|
-
toggleAITheme() {
|
|
258
|
-
setOpenAITheme(!openAITheme);
|
|
259
|
-
},
|
|
260
271
|
getPageSettings: {
|
|
261
272
|
background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
|
|
262
273
|
}
|
|
@@ -323,6 +334,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
323
334
|
const onKeyDown = useCallback(event => {
|
|
324
335
|
const isMetaKey = event.metaKey && event.keyCode >= 65 && event.keyCode <= 90;
|
|
325
336
|
const isCtrlKey = event.ctrlKey || isMetaKey;
|
|
337
|
+
// for RnD item move front and back
|
|
338
|
+
const isUpandDown = event.metaKey && [38, 40].indexOf(event.keyCode) > -1;
|
|
326
339
|
if (target && chars.length > 0 && !isCtrlKey) {
|
|
327
340
|
mentionsEvent({
|
|
328
341
|
event,
|
|
@@ -334,7 +347,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
334
347
|
type,
|
|
335
348
|
mentionsRef
|
|
336
349
|
});
|
|
337
|
-
} else if (isCtrlKey) {
|
|
350
|
+
} else if (isCtrlKey || isUpandDown) {
|
|
338
351
|
commands({
|
|
339
352
|
event,
|
|
340
353
|
editor,
|
|
@@ -352,6 +365,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
352
365
|
});
|
|
353
366
|
} else if (event.key === "Enter") {
|
|
354
367
|
enterEvent(event, editor, customProps?.isMobile);
|
|
368
|
+
} else if (event.key === 'Backspace') {
|
|
369
|
+
event.preventDefault();
|
|
370
|
+
editor.deleteBackward();
|
|
355
371
|
}
|
|
356
372
|
}, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
|
|
357
373
|
const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
|
|
@@ -404,7 +420,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
404
420
|
}
|
|
405
421
|
return style;
|
|
406
422
|
}, [pageBgImage, pageColor]);
|
|
407
|
-
const
|
|
423
|
+
const handleContextMenu = e => {
|
|
424
|
+
if (!readOnly) {
|
|
425
|
+
e.preventDefault();
|
|
426
|
+
e.stopPropagation();
|
|
427
|
+
}
|
|
428
|
+
};
|
|
408
429
|
const handleCursorScroll = container => {
|
|
409
430
|
try {
|
|
410
431
|
const cursorPosition = window.getSelection()?.getRangeAt(0).getBoundingClientRect();
|
|
@@ -419,155 +440,149 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
419
440
|
console.log(err);
|
|
420
441
|
}
|
|
421
442
|
};
|
|
422
|
-
return /*#__PURE__*/_jsx(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
editor: editor,
|
|
465
|
-
initialValue: value,
|
|
466
|
-
onChange: handleEditorChange,
|
|
467
|
-
children: [/*#__PURE__*/_jsx(DragAndDrop, {
|
|
468
|
-
children: /*#__PURE__*/_jsxs(Overlay, {
|
|
469
|
-
children: [/*#__PURE__*/_jsx(Box, {
|
|
470
|
-
className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
|
|
471
|
-
sx: classes.slateWrapper,
|
|
472
|
-
id: "slate-wrapper-scroll-container"
|
|
473
|
-
// style={editorWrapperStyle}
|
|
474
|
-
,
|
|
475
|
-
ref: editorWrapper,
|
|
476
|
-
onClick: e => {
|
|
477
|
-
handleInsertLastElement(e, editor);
|
|
478
|
-
},
|
|
479
|
-
onScroll: handleScroll,
|
|
480
|
-
style: editorWrapperStyle,
|
|
443
|
+
return /*#__PURE__*/_jsx(EditorProvider, {
|
|
444
|
+
theme: theme,
|
|
445
|
+
editor: editor,
|
|
446
|
+
children: /*#__PURE__*/_jsx(DialogWrapper, {
|
|
447
|
+
classes: classes,
|
|
448
|
+
...props,
|
|
449
|
+
fullScreen: fullScreen,
|
|
450
|
+
footer: footer || "",
|
|
451
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
452
|
+
component: "div",
|
|
453
|
+
className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
|
|
454
|
+
sx: classes.root,
|
|
455
|
+
style: {
|
|
456
|
+
...dotBg
|
|
457
|
+
},
|
|
458
|
+
"data-breakpoint": breakpoint,
|
|
459
|
+
onContextMenu: handleContextMenu,
|
|
460
|
+
children: /*#__PURE__*/_jsxs(Slate, {
|
|
461
|
+
editor: editor,
|
|
462
|
+
initialValue: value,
|
|
463
|
+
onChange: handleEditorChange,
|
|
464
|
+
children: [/*#__PURE__*/_jsx(DragAndDrop, {
|
|
465
|
+
children: /*#__PURE__*/_jsxs(Overlay, {
|
|
466
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
467
|
+
className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
|
|
468
|
+
sx: classes.slateWrapper,
|
|
469
|
+
id: "slate-wrapper-scroll-container"
|
|
470
|
+
// style={editorWrapperStyle}
|
|
471
|
+
,
|
|
472
|
+
ref: editorWrapper,
|
|
473
|
+
onClick: e => {
|
|
474
|
+
handleInsertLastElement(e, editor);
|
|
475
|
+
},
|
|
476
|
+
onScroll: handleScroll,
|
|
477
|
+
style: editorWrapperStyle,
|
|
478
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
479
|
+
component: "div",
|
|
480
|
+
className: "max-content",
|
|
481
|
+
"data-info": outsideEditorClickLabel,
|
|
482
|
+
children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
|
|
483
|
+
className: "scroll-area",
|
|
484
|
+
"data-info": outsideEditorClickLabel,
|
|
481
485
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
482
486
|
component: "div",
|
|
483
|
-
className:
|
|
484
|
-
sx:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
"data-info": outsideEditorClickLabel,
|
|
489
|
-
children: /*#__PURE__*/_jsxs(Box, {
|
|
490
|
-
component: "div",
|
|
491
|
-
className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
|
|
492
|
-
sx: {
|
|
493
|
-
backgroundColor: "transparent",
|
|
494
|
-
padding: {
|
|
495
|
-
...getTRBLBreakPoints(bannerSpacing)
|
|
496
|
-
},
|
|
497
|
-
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
|
498
|
-
height: viewport.h ? `${viewport.h}px` : `100%`,
|
|
499
|
-
alignSelf: "center",
|
|
500
|
-
transformOrigin: "left top",
|
|
501
|
-
transition: "all 0.3s",
|
|
502
|
-
minHeight: "87%",
|
|
503
|
-
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
|
|
504
|
-
},
|
|
505
|
-
"data-info": outsideEditorClickLabel,
|
|
506
|
-
children: [/*#__PURE__*/_jsx(Editable, {
|
|
507
|
-
className: "innert-editor-textbox",
|
|
508
|
-
readOnly: isReadOnly,
|
|
509
|
-
renderElement: renderElement,
|
|
510
|
-
renderLeaf: renderLeaf,
|
|
511
|
-
decorate: decorators,
|
|
512
|
-
onKeyDown: onKeyDown,
|
|
513
|
-
onSelect: () => handleCursorScroll(editorWrapper.current)
|
|
514
|
-
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
|
515
|
-
ref: mentionsRef,
|
|
516
|
-
mentions: mentions,
|
|
517
|
-
setMentions: setMentions,
|
|
518
|
-
editor: editor,
|
|
519
|
-
target: target,
|
|
520
|
-
index: index,
|
|
521
|
-
chars: chars,
|
|
522
|
-
type: type,
|
|
523
|
-
theme: theme
|
|
524
|
-
}) : null]
|
|
525
|
-
})
|
|
526
|
-
}), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
|
|
527
|
-
customProps: customProps,
|
|
528
|
-
toolbarOptions: toolbarOptions,
|
|
529
|
-
theme: theme
|
|
530
|
-
}) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
|
|
531
|
-
otherProps: otherProps || {}
|
|
532
|
-
}), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
|
|
533
|
-
sx: {
|
|
534
|
-
color: "rgb(100, 116, 139)",
|
|
535
|
-
fontSize: "13px",
|
|
536
|
-
paddingBottom: hideMiniToolBar ? "0px" : "12px",
|
|
537
|
-
cursor: "pointer"
|
|
487
|
+
className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
|
|
488
|
+
sx: {
|
|
489
|
+
backgroundColor: "transparent",
|
|
490
|
+
padding: {
|
|
491
|
+
...getTRBLBreakPoints(bannerSpacing)
|
|
538
492
|
},
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
493
|
+
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
|
494
|
+
height: viewport.h ? `${viewport.h}px` : `100%`,
|
|
495
|
+
alignSelf: "center",
|
|
496
|
+
transformOrigin: "left top",
|
|
497
|
+
transition: "all 0.3s",
|
|
498
|
+
minHeight: "87%",
|
|
499
|
+
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
|
|
500
|
+
},
|
|
501
|
+
"data-info": outsideEditorClickLabel,
|
|
502
|
+
children: [/*#__PURE__*/_jsx(Editable, {
|
|
503
|
+
className: "innert-editor-textbox",
|
|
504
|
+
readOnly: isReadOnly,
|
|
505
|
+
renderElement: renderElement,
|
|
506
|
+
renderLeaf: renderLeaf,
|
|
507
|
+
decorate: decorators,
|
|
508
|
+
onKeyDown: onKeyDown,
|
|
509
|
+
onSelect: () => handleCursorScroll(editorWrapper.current)
|
|
510
|
+
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
|
511
|
+
ref: mentionsRef,
|
|
512
|
+
mentions: mentions,
|
|
513
|
+
setMentions: setMentions,
|
|
546
514
|
editor: editor,
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
515
|
+
target: target,
|
|
516
|
+
index: index,
|
|
517
|
+
chars: chars,
|
|
518
|
+
type: type,
|
|
519
|
+
theme: theme
|
|
520
|
+
}) : null, /*#__PURE__*/_jsx(RnDCopy, {
|
|
521
|
+
readOnly: readOnly
|
|
552
522
|
})]
|
|
553
523
|
})
|
|
554
|
-
}), !
|
|
555
|
-
|
|
556
|
-
theme: theme
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
})
|
|
524
|
+
}), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
|
|
525
|
+
customProps: customProps,
|
|
526
|
+
theme: theme
|
|
527
|
+
}) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
|
|
528
|
+
otherProps: otherProps || {}
|
|
529
|
+
}), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
|
|
530
|
+
sx: {
|
|
531
|
+
color: "rgb(100, 116, 139)",
|
|
532
|
+
fontSize: "13px",
|
|
533
|
+
paddingBottom: hideMiniToolBar ? "0px" : "12px",
|
|
534
|
+
cursor: "pointer"
|
|
535
|
+
},
|
|
536
|
+
align: "center",
|
|
537
|
+
"data-info": outsideEditorClickLabel,
|
|
538
|
+
onClick: handleFooterClick,
|
|
539
|
+
children: footer
|
|
540
|
+
})]
|
|
560
541
|
})
|
|
561
|
-
}),
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
542
|
+
}), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
|
|
543
|
+
onDrawerOpen: onDrawerOpen,
|
|
544
|
+
theme: theme,
|
|
545
|
+
setIsTextSelected: setIsTextSelected,
|
|
546
|
+
customProps: customProps
|
|
547
|
+
}) : null, !readOnly && showViewport ? /*#__PURE__*/_jsx(SwitchViewport, {
|
|
548
|
+
breakpoint: breakpoint,
|
|
549
|
+
onChange: b => onSwitchBreakpoint(b)
|
|
550
|
+
}) : null]
|
|
551
|
+
})
|
|
552
|
+
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
|
553
|
+
...htmlAction,
|
|
554
|
+
handleCodeToText: handleCodeToText
|
|
555
|
+
})]
|
|
556
|
+
}, id)
|
|
568
557
|
})
|
|
569
558
|
})
|
|
570
559
|
});
|
|
571
560
|
});
|
|
572
561
|
CommonEditor.displayName = "CommonEditor";
|
|
562
|
+
CommonEditor.propTypes = {
|
|
563
|
+
/** Id of the content */
|
|
564
|
+
id: PropTypes.string,
|
|
565
|
+
/** Set to true for readonly mode */
|
|
566
|
+
readOnly: PropTypes.oneOf(["readonly", ""]),
|
|
567
|
+
/** It can be a draft js content or a slate js content */
|
|
568
|
+
content: PropTypes.any,
|
|
569
|
+
/** User details */
|
|
570
|
+
user: PropTypes.object,
|
|
571
|
+
/** API URL base for pages api calls */
|
|
572
|
+
apiHOST: PropTypes.string,
|
|
573
|
+
/** A callback function with updated edited content,
|
|
574
|
+
* this method will get called whenever the content changes happen and wait idle for 500ms
|
|
575
|
+
* uses the debounce mechanism
|
|
576
|
+
*/
|
|
577
|
+
onSave: PropTypes.func,
|
|
578
|
+
/**
|
|
579
|
+
* MUI theme object form parent application
|
|
580
|
+
*/
|
|
581
|
+
theme: PropTypes.object,
|
|
582
|
+
/**
|
|
583
|
+
* Editor component based props can be passed here
|
|
584
|
+
* @property {bool} isSignerDetailsRequired - To make username and email required in Forms
|
|
585
|
+
*/
|
|
586
|
+
otherProps: PropTypes.object
|
|
587
|
+
};
|
|
573
588
|
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
|
@@ -244,13 +244,6 @@ blockquote {
|
|
|
244
244
|
width: 17px !important;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
.react-datepicker__input-container input {
|
|
248
|
-
height: 40px !important;
|
|
249
|
-
border: 1px solid #ccc;
|
|
250
|
-
border-radius: 5px;
|
|
251
|
-
width: 100%;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
247
|
.close-popupbtn {
|
|
255
248
|
border-radius: 4px !important;
|
|
256
249
|
width: 24px;
|
|
@@ -858,17 +851,6 @@ blockquote {
|
|
|
858
851
|
text-align: center;
|
|
859
852
|
}
|
|
860
853
|
|
|
861
|
-
.removeScroll::-webkit-outer-spin-button,
|
|
862
|
-
.removeScroll::-webkit-inner-spin-button {
|
|
863
|
-
-webkit-appearance: none;
|
|
864
|
-
margin: 0;
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
/* For Firefox */
|
|
868
|
-
.removeScroll {
|
|
869
|
-
-moz-appearance: textfield;
|
|
870
|
-
}
|
|
871
|
-
|
|
872
854
|
.borderInput:focus-visible {
|
|
873
855
|
outline: none !important;
|
|
874
856
|
}
|
|
@@ -918,7 +900,7 @@ blockquote {
|
|
|
918
900
|
}
|
|
919
901
|
|
|
920
902
|
.sliderInput {
|
|
921
|
-
width:
|
|
903
|
+
width: 66px;
|
|
922
904
|
padding: 2px 10px;
|
|
923
905
|
margin-left: 18px;
|
|
924
906
|
box-shadow: 0px 4px 16px 0px #0000000d;
|
|
@@ -1166,4 +1148,8 @@ blockquote {
|
|
|
1166
1148
|
|
|
1167
1149
|
.scrollSmooth {
|
|
1168
1150
|
scroll-behavior: smooth;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
.freegrid-section {
|
|
1154
|
+
max-width: 100% !important;
|
|
1169
1155
|
}
|