@flozy/editor 3.8.8 → 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 +31 -57
- package/dist/Editor/CommonEditor.js +69 -8
- package/dist/Editor/DialogWrapper.js +4 -3
- package/dist/Editor/Editor.css +5 -12
- package/dist/Editor/Elements/AI/PopoverAIInput.js +47 -36
- package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +6 -20
- package/dist/Editor/Elements/AppHeader/AppHeader.js +36 -23
- package/dist/Editor/Elements/Button/EditorButton.js +23 -16
- 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/Emoji/EmojiPicker.js +2 -4
- package/dist/Editor/Elements/Form/Form.js +1 -1
- 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 +12 -8
- package/dist/Editor/Elements/Grid/GridItem.js +31 -21
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -5
- package/dist/Editor/Elements/SimpleText/index.js +9 -8
- package/dist/Editor/Elements/SimpleText/style.js +37 -0
- package/dist/Editor/ErrorBoundary.js +30 -0
- package/dist/Editor/Styles/EditorStyles.js +23 -0
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -25
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +1 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +8 -0
- package/dist/Editor/Toolbar/Toolbar.js +7 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +5 -0
- package/dist/Editor/common/Icon.js +9 -2
- package/dist/Editor/common/MentionsPopup/MentionsListCard.js +1 -6
- 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 +21 -12
- package/dist/Editor/common/Section/styles.js +6 -1
- package/dist/Editor/common/Shorthands/elements.js +12 -0
- package/dist/Editor/common/StyleBuilder/boxStyle.js +30 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +32 -31
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +16 -18
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +3 -14
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -2
- package/dist/Editor/common/StyleBuilder/index.js +2 -2
- 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 -22
- package/dist/Editor/helper/theme.js +50 -2
- package/dist/Editor/hooks/useBreakpoints.js +34 -0
- package/dist/Editor/hooks/useMouseMove.js +36 -8
- package/dist/Editor/hooks/withCommon.js +2 -1
- package/dist/Editor/hooks/withErrorHandling.js +14 -0
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +168 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +31 -5
- package/dist/Editor/utils/draftToSlate.js +1 -1
- package/dist/Editor/utils/events.js +5 -0
- package/dist/Editor/utils/freegrid.js +49 -0
- package/dist/Editor/utils/helper.js +29 -0
- package/package.json +5 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useRef, useState, useEffect, useImperativeHandle, forwardRef } from "react";
|
|
2
2
|
import { Editable, Slate, ReactEditor } from 'slate-react';
|
|
3
|
-
import { createEditor, Transforms
|
|
3
|
+
import { createEditor, Transforms } from 'slate';
|
|
4
4
|
import { useDebounce } from "use-debounce";
|
|
5
5
|
import withCommon from "./hooks/withCommon";
|
|
6
6
|
import { getBlock, getMarked } from "./utils/chatEditor/SlateUtilityFunctions";
|
|
@@ -31,12 +31,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
31
31
|
} = props;
|
|
32
32
|
const classes = usePopupStyle(theme);
|
|
33
33
|
const convertedContent = draftToSlate({
|
|
34
|
-
data: content
|
|
35
|
-
type: 'paragraph',
|
|
36
|
-
children: [{
|
|
37
|
-
text: ''
|
|
38
|
-
}]
|
|
39
|
-
}]
|
|
34
|
+
data: content
|
|
40
35
|
});
|
|
41
36
|
const [isInteracted, setIsInteracted] = useState(false);
|
|
42
37
|
const [value, setValue] = useState(convertedContent);
|
|
@@ -52,11 +47,10 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
52
47
|
useImperativeHandle(ref, () => ({
|
|
53
48
|
emojiClick: emoji => {
|
|
54
49
|
if (editor) {
|
|
55
|
-
ReactEditor.focus(editor);
|
|
56
50
|
insertEmoji(editor, emoji?.native, editor.selection);
|
|
57
51
|
if (editor.selection) {
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
const path = editor.selection.anchor.path;
|
|
53
|
+
const offset = editor.selection.anchor.offset + emoji?.native.length;
|
|
60
54
|
const position = {
|
|
61
55
|
anchor: {
|
|
62
56
|
path: [0],
|
|
@@ -73,57 +67,37 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
73
67
|
ReactEditor.focus(editor);
|
|
74
68
|
}
|
|
75
69
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
} = getOnSaveData(value);
|
|
81
|
-
onsubmit(false, {
|
|
82
|
-
strVal,
|
|
83
|
-
restVal
|
|
84
|
-
});
|
|
70
|
+
setContent: newContent => {
|
|
71
|
+
setIsExternalUpdate(true);
|
|
72
|
+
setValue(newContent);
|
|
73
|
+
ReactEditor.focus(editor);
|
|
85
74
|
},
|
|
86
75
|
// Focus enable
|
|
87
|
-
enableFocus: () => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
Transforms.select(editor, position);
|
|
100
|
-
ReactEditor.focus(editor);
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
clearAll: (content = null, clear = true) => {
|
|
76
|
+
// enableFocus: () => {
|
|
77
|
+
// if (editor) {
|
|
78
|
+
// const position = {
|
|
79
|
+
// anchor: { path: [0], offset: 0 },
|
|
80
|
+
// focus: { path: [0], offset: 0 },
|
|
81
|
+
// };
|
|
82
|
+
// Transforms.select(editor, position);
|
|
83
|
+
// ReactEditor.focus(editor);
|
|
84
|
+
// }
|
|
85
|
+
// },
|
|
86
|
+
|
|
87
|
+
clearAll: () => {
|
|
104
88
|
if (!editor) return;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Transforms.removeNodes(editor, {
|
|
109
|
-
at: [0]
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
const newValue = draftToSlate({
|
|
114
|
-
data: content
|
|
89
|
+
while (editor.children.length > 0) {
|
|
90
|
+
Transforms.removeNodes(editor, {
|
|
91
|
+
at: [0]
|
|
115
92
|
});
|
|
116
|
-
setValue(newValue);
|
|
117
|
-
setTimeout(() => {
|
|
118
|
-
if (editor.children.length === 0) {
|
|
119
|
-
Transforms.insertNodes(editor, newValue);
|
|
120
|
-
}
|
|
121
|
-
Transforms.select(editor, Editor.end(editor, []));
|
|
122
|
-
ReactEditor.focus(editor);
|
|
123
|
-
}, 300);
|
|
124
|
-
} catch {
|
|
125
|
-
console.log("error:");
|
|
126
93
|
}
|
|
94
|
+
Transforms.insertNodes(editor, {
|
|
95
|
+
type: 'paragraph',
|
|
96
|
+
children: [{
|
|
97
|
+
text: ''
|
|
98
|
+
}]
|
|
99
|
+
});
|
|
100
|
+
ReactEditor.focus(editor);
|
|
127
101
|
}
|
|
128
102
|
}));
|
|
129
103
|
useEffect(() => {
|
|
@@ -131,7 +105,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
131
105
|
setValue(draftToSlate({
|
|
132
106
|
data: content
|
|
133
107
|
}));
|
|
134
|
-
}, [content]);
|
|
108
|
+
}, [id, content]);
|
|
135
109
|
useEffect(() => {
|
|
136
110
|
if (JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
|
137
111
|
const {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
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,12 +27,14 @@ 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
31
|
import { getTRBLBreakPoints } from "./helper/theme";
|
|
32
32
|
import { handleInsertLastElement, onDeleteKey, outsideEditorClickLabel } from "./utils/helper";
|
|
33
33
|
import useWindowResize from "./hooks/useWindowResize";
|
|
34
34
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
|
35
|
+
import RnDCopy from "./common/RnD/RnDCopy";
|
|
36
|
+
import "animate.css";
|
|
37
|
+
import SwitchViewport from "./common/RnD/SwitchViewport/SwitchViewport";
|
|
35
38
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
36
39
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
37
40
|
const Item = /*#__PURE__*/forwardRef(({
|
|
@@ -60,7 +63,8 @@ const Leaf = ({
|
|
|
60
63
|
children,
|
|
61
64
|
leaf
|
|
62
65
|
}) => {
|
|
63
|
-
|
|
66
|
+
const theme = useTheme();
|
|
67
|
+
children = getMarked(leaf, children, theme);
|
|
64
68
|
return /*#__PURE__*/_jsx("span", {
|
|
65
69
|
...attributes,
|
|
66
70
|
children: children
|
|
@@ -99,6 +103,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
99
103
|
});
|
|
100
104
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
101
105
|
const [isTextSelected, setIsTextSelected] = useState(false);
|
|
106
|
+
const [breakpoint, setBreakpoint] = useState("");
|
|
102
107
|
const [size] = useWindowResize();
|
|
103
108
|
const {
|
|
104
109
|
needDotsBG,
|
|
@@ -110,7 +115,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
110
115
|
fullWidth = "80%",
|
|
111
116
|
hideTools
|
|
112
117
|
} = otherProps || {};
|
|
113
|
-
const [drag, setDrag] = useState(null);
|
|
114
118
|
const editor = useMemo(() => {
|
|
115
119
|
if (collaborativeEditor) return collaborativeEditor;
|
|
116
120
|
return withCommon(createEditor(), {
|
|
@@ -144,6 +148,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
144
148
|
setValue(draftToSlate({
|
|
145
149
|
data: content
|
|
146
150
|
}));
|
|
151
|
+
if (!ReactEditor.isFocused(editor)) {
|
|
152
|
+
ReactEditor.focus(editor);
|
|
153
|
+
}
|
|
147
154
|
}, [id, content]);
|
|
148
155
|
useEffect(() => {
|
|
149
156
|
if (editorWrapper && editorWrapper?.current && JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
|
@@ -172,6 +179,17 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
172
179
|
});
|
|
173
180
|
return c;
|
|
174
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
|
+
};
|
|
175
193
|
useImperativeHandle(ref, () => ({
|
|
176
194
|
async getThumbnail(needBackground = false, options = {}) {
|
|
177
195
|
try {
|
|
@@ -233,6 +251,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
233
251
|
h
|
|
234
252
|
});
|
|
235
253
|
},
|
|
254
|
+
switchViewport(bp) {
|
|
255
|
+
setBreakpoint(bp);
|
|
256
|
+
},
|
|
236
257
|
undo() {
|
|
237
258
|
editor?.undo();
|
|
238
259
|
},
|
|
@@ -305,6 +326,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
305
326
|
const onKeyDown = useCallback(event => {
|
|
306
327
|
const isMetaKey = event.metaKey && event.keyCode >= 65 && event.keyCode <= 90;
|
|
307
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;
|
|
308
331
|
if (target && chars.length > 0 && !isCtrlKey) {
|
|
309
332
|
mentionsEvent({
|
|
310
333
|
event,
|
|
@@ -316,7 +339,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
316
339
|
type,
|
|
317
340
|
mentionsRef
|
|
318
341
|
});
|
|
319
|
-
} else if (isCtrlKey) {
|
|
342
|
+
} else if (isCtrlKey || isUpandDown) {
|
|
320
343
|
commands({
|
|
321
344
|
event,
|
|
322
345
|
editor,
|
|
@@ -386,6 +409,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
386
409
|
}
|
|
387
410
|
return style;
|
|
388
411
|
}, [pageBgImage, pageColor]);
|
|
412
|
+
const handleContextMenu = e => {
|
|
413
|
+
if (!readOnly) {
|
|
414
|
+
e.preventDefault();
|
|
415
|
+
e.stopPropagation();
|
|
416
|
+
}
|
|
417
|
+
};
|
|
389
418
|
return /*#__PURE__*/_jsx(EditorProvider, {
|
|
390
419
|
theme: theme,
|
|
391
420
|
editor: editor,
|
|
@@ -396,11 +425,13 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
396
425
|
footer: footer || "",
|
|
397
426
|
children: /*#__PURE__*/_jsx(Box, {
|
|
398
427
|
component: "div",
|
|
399
|
-
className:
|
|
428
|
+
className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
|
|
400
429
|
sx: classes.root,
|
|
401
430
|
style: {
|
|
402
431
|
...dotBg
|
|
403
432
|
},
|
|
433
|
+
"data-breakpoint": breakpoint,
|
|
434
|
+
onContextMenu: handleContextMenu,
|
|
404
435
|
children: /*#__PURE__*/_jsxs(Slate, {
|
|
405
436
|
editor: editor,
|
|
406
437
|
initialValue: value,
|
|
@@ -460,11 +491,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
460
491
|
chars: chars,
|
|
461
492
|
type: type,
|
|
462
493
|
theme: theme
|
|
463
|
-
}) : null
|
|
494
|
+
}) : null, /*#__PURE__*/_jsx(RnDCopy, {
|
|
495
|
+
readOnly: readOnly
|
|
496
|
+
})]
|
|
464
497
|
})
|
|
465
498
|
}), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
|
|
466
499
|
customProps: customProps,
|
|
467
|
-
toolbarOptions: toolbarOptions,
|
|
468
500
|
theme: theme
|
|
469
501
|
}) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
|
|
470
502
|
otherProps: otherProps || {}
|
|
@@ -486,6 +518,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
486
518
|
theme: theme,
|
|
487
519
|
setIsTextSelected: setIsTextSelected,
|
|
488
520
|
customProps: customProps
|
|
521
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
|
522
|
+
breakpoint: breakpoint,
|
|
523
|
+
onChange: b => onSwitchBreakpoint(b)
|
|
489
524
|
}) : null]
|
|
490
525
|
})
|
|
491
526
|
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
|
@@ -498,4 +533,30 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
498
533
|
});
|
|
499
534
|
});
|
|
500
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
|
+
};
|
|
501
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
|
@@ -830,17 +830,6 @@ blockquote {
|
|
|
830
830
|
text-align: center;
|
|
831
831
|
}
|
|
832
832
|
|
|
833
|
-
.removeScroll::-webkit-outer-spin-button,
|
|
834
|
-
.removeScroll::-webkit-inner-spin-button {
|
|
835
|
-
-webkit-appearance: none;
|
|
836
|
-
margin: 0;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
/* For Firefox */
|
|
840
|
-
.removeScroll {
|
|
841
|
-
-moz-appearance: textfield;
|
|
842
|
-
}
|
|
843
|
-
|
|
844
833
|
.borderInput:focus-visible {
|
|
845
834
|
outline: none !important;
|
|
846
835
|
}
|
|
@@ -890,7 +879,7 @@ blockquote {
|
|
|
890
879
|
}
|
|
891
880
|
|
|
892
881
|
.sliderInput {
|
|
893
|
-
width:
|
|
882
|
+
width: 66px;
|
|
894
883
|
padding: 2px 10px;
|
|
895
884
|
margin-left: 18px;
|
|
896
885
|
box-shadow: 0px 4px 16px 0px #0000000d;
|
|
@@ -1138,4 +1127,8 @@ blockquote {
|
|
|
1138
1127
|
|
|
1139
1128
|
.scrollSmooth {
|
|
1140
1129
|
scroll-behavior: smooth;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
.freegrid-section {
|
|
1133
|
+
max-width: 100% !important;
|
|
1141
1134
|
}
|
|
@@ -51,43 +51,51 @@ const insertAtNextLine = (editor, text) => {
|
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
const getNextLine = editor => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
try {
|
|
55
|
+
const {
|
|
56
|
+
selection
|
|
57
|
+
} = editor;
|
|
58
|
+
const {
|
|
59
|
+
focus
|
|
60
|
+
} = selection;
|
|
61
|
+
if (focus?.path?.length > 0) {
|
|
62
|
+
const {
|
|
63
|
+
text = ""
|
|
64
|
+
} = Node.get(editor, focus.path);
|
|
65
|
+
let nextLineIndex = 0;
|
|
66
|
+
let indexOfNextLine = 0;
|
|
67
|
+
if (text?.length) {
|
|
68
|
+
// split the text based on caret position
|
|
69
|
+
const textBeforeCaret = text.substring(0, focus.offset);
|
|
70
|
+
const textAfterCaret = text.substring(focus.offset);
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
// getting the index of the next line after the caret position
|
|
73
|
+
indexOfNextLine = textAfterCaret?.indexOf("\n");
|
|
74
|
+
if (indexOfNextLine >= 0) {
|
|
75
|
+
// index of next line
|
|
76
|
+
nextLineIndex = textBeforeCaret?.length + indexOfNextLine;
|
|
77
|
+
} else {
|
|
78
|
+
nextLineIndex = text?.length;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const data = {
|
|
82
|
+
...focus,
|
|
83
|
+
offset: nextLineIndex
|
|
84
|
+
};
|
|
85
|
+
const at = {
|
|
86
|
+
anchor: data,
|
|
87
|
+
focus: data
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
at,
|
|
91
|
+
indexOfNextLine
|
|
92
|
+
};
|
|
77
93
|
}
|
|
94
|
+
return null;
|
|
95
|
+
} catch (err) {
|
|
96
|
+
console.log(err);
|
|
97
|
+
return null;
|
|
78
98
|
}
|
|
79
|
-
const data = {
|
|
80
|
-
...focus,
|
|
81
|
-
offset: nextLineIndex
|
|
82
|
-
};
|
|
83
|
-
const at = {
|
|
84
|
-
anchor: data,
|
|
85
|
-
focus: data
|
|
86
|
-
};
|
|
87
|
-
return {
|
|
88
|
-
at,
|
|
89
|
-
indexOfNextLine
|
|
90
|
-
};
|
|
91
99
|
};
|
|
92
100
|
const updateAnchorEl = (setAnchorEl, editor) => {
|
|
93
101
|
try {
|
|
@@ -95,13 +103,16 @@ const updateAnchorEl = (setAnchorEl, editor) => {
|
|
|
95
103
|
return;
|
|
96
104
|
}
|
|
97
105
|
const selection = window.getSelection();
|
|
98
|
-
if (selection.rangeCount) {
|
|
106
|
+
if (selection.rangeCount && selection.anchorOffset !== selection.focusOffset) {
|
|
99
107
|
let caret;
|
|
100
108
|
if (getSelectedText(editor)) {
|
|
101
109
|
// selected text as caret
|
|
102
110
|
caret = selection.getRangeAt(0);
|
|
103
111
|
} else {
|
|
104
|
-
|
|
112
|
+
const sel = getNextLine(editor);
|
|
113
|
+
if (sel) {
|
|
114
|
+
caret = ReactEditor.toDOMRange(editor, sel.at);
|
|
115
|
+
}
|
|
105
116
|
}
|
|
106
117
|
const getBoundingClientRect = () => {
|
|
107
118
|
const editorContainer = document.querySelector("#slate-wrapper-scroll-container")?.getBoundingClientRect();
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { getBorderColor, getTextColor } from "../../helper";
|
|
3
|
-
import { Box } from "@mui/material";
|
|
4
|
-
import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
|
|
5
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
3
|
const AccordionSummary = props => {
|
|
7
4
|
const {
|
|
@@ -12,29 +9,18 @@ const AccordionSummary = props => {
|
|
|
12
9
|
const {
|
|
13
10
|
textColor,
|
|
14
11
|
bgColor,
|
|
15
|
-
borderColor
|
|
16
|
-
borderRadius,
|
|
17
|
-
bannerSpacing
|
|
12
|
+
borderColor
|
|
18
13
|
} = element;
|
|
19
|
-
|
|
20
|
-
const borderStyle = getBorderColor(borderColor);
|
|
21
|
-
return /*#__PURE__*/_jsx(Box, {
|
|
14
|
+
return /*#__PURE__*/_jsx("div", {
|
|
22
15
|
className: `accordion-summary-container`,
|
|
23
16
|
...attributes,
|
|
24
|
-
|
|
17
|
+
style: {
|
|
25
18
|
width: "100%",
|
|
26
19
|
position: "relative",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
padding: {
|
|
31
|
-
...getTRBLBreakPoints(bannerSpacing)
|
|
32
|
-
},
|
|
33
|
-
background: bgColor,
|
|
34
|
-
...borderStyle,
|
|
35
|
-
'& span[data-slate-string="true"]': textStyles
|
|
20
|
+
backgroundColor: bgColor,
|
|
21
|
+
border: `1px solid ${borderColor}`,
|
|
22
|
+
color: textColor
|
|
36
23
|
},
|
|
37
|
-
component: "div",
|
|
38
24
|
children: children
|
|
39
25
|
});
|
|
40
26
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useState } from "react";
|
|
2
2
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
|
3
3
|
import { Transforms, Editor, Element } from "slate";
|
|
4
|
+
import { useTheme } from "@mui/material";
|
|
4
5
|
import AppBar from "@mui/material/AppBar";
|
|
5
6
|
import Box from "@mui/material/Box";
|
|
6
7
|
import CssBaseline from "@mui/material/CssBaseline";
|
|
@@ -16,7 +17,7 @@ import Toolbar from "@mui/material/Toolbar";
|
|
|
16
17
|
import Typography from "@mui/material/Typography";
|
|
17
18
|
import Button from "@mui/material/Button";
|
|
18
19
|
import AppHeaderPopup from "./AppHeaderPopup";
|
|
19
|
-
import { getTRBLBreakPoints } from "../../helper/theme";
|
|
20
|
+
import { getTRBLBreakPoints, groupByBreakpoint } from "../../helper/theme";
|
|
20
21
|
import { handleLinkType } from "../../utils/helper";
|
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -24,6 +25,7 @@ import { createElement as _createElement } from "react";
|
|
|
24
25
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
25
26
|
const drawerWidth = 240;
|
|
26
27
|
function AppHeader(props) {
|
|
28
|
+
const theme = useTheme();
|
|
27
29
|
const navWrprRef = useRef(null);
|
|
28
30
|
const [openSetttings, setOpenSettings] = useState(false);
|
|
29
31
|
const {
|
|
@@ -121,11 +123,6 @@ function AppHeader(props) {
|
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
};
|
|
124
|
-
|
|
125
|
-
// const onMenuSettings = (menuItem, i) => (event) => {
|
|
126
|
-
// event.preventDefault();
|
|
127
|
-
// };
|
|
128
|
-
|
|
129
126
|
const drawer = /*#__PURE__*/_jsxs(Box, {
|
|
130
127
|
onClick: handleDrawerToggle,
|
|
131
128
|
sx: {
|
|
@@ -164,15 +161,20 @@ function AppHeader(props) {
|
|
|
164
161
|
})]
|
|
165
162
|
});
|
|
166
163
|
const container = window !== undefined ? () => window().document.body : undefined;
|
|
167
|
-
// const elevateStyle = useEleveateScroll({
|
|
168
|
-
// ...props,
|
|
169
|
-
// parentRef: navWrprRef,
|
|
170
|
-
// needElevation: readOnly,
|
|
171
|
-
// });
|
|
172
|
-
|
|
173
164
|
const elevateStyle = {
|
|
174
165
|
position: "relative"
|
|
175
166
|
};
|
|
167
|
+
const appbarSp = groupByBreakpoint({
|
|
168
|
+
padding: {
|
|
169
|
+
...getTRBLBreakPoints(bannerSpacing)
|
|
170
|
+
}
|
|
171
|
+
}, theme);
|
|
172
|
+
const toolbarSp = groupByBreakpoint({
|
|
173
|
+
flexDirection: {
|
|
174
|
+
xs: "row-reverse !important",
|
|
175
|
+
lg: "unset"
|
|
176
|
+
}
|
|
177
|
+
}, theme);
|
|
176
178
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
177
179
|
children: [/*#__PURE__*/_jsxs(Box, {
|
|
178
180
|
sx: {
|
|
@@ -194,13 +196,14 @@ function AppHeader(props) {
|
|
|
194
196
|
...elevateStyle,
|
|
195
197
|
background: bgColor,
|
|
196
198
|
boxShadow: "none",
|
|
197
|
-
|
|
198
|
-
...getTRBLBreakPoints(bannerSpacing)
|
|
199
|
-
},
|
|
199
|
+
...appbarSp,
|
|
200
200
|
zIndex: 999
|
|
201
201
|
},
|
|
202
202
|
onClick: onSettings,
|
|
203
203
|
children: /*#__PURE__*/_jsxs(Toolbar, {
|
|
204
|
+
sx: {
|
|
205
|
+
...toolbarSp
|
|
206
|
+
},
|
|
204
207
|
style: {
|
|
205
208
|
flexDirection: isLogoRight ? "row-reverse" : "row",
|
|
206
209
|
paddingLeft: "0px",
|
|
@@ -217,8 +220,11 @@ function AppHeader(props) {
|
|
|
217
220
|
},
|
|
218
221
|
sx: {
|
|
219
222
|
mr: 2,
|
|
220
|
-
|
|
221
|
-
|
|
223
|
+
[theme.breakpoints.up("sm")]: {
|
|
224
|
+
display: "none"
|
|
225
|
+
},
|
|
226
|
+
[theme.breakpoints.between("xs", "md")]: {
|
|
227
|
+
display: "block"
|
|
222
228
|
}
|
|
223
229
|
},
|
|
224
230
|
children: /*#__PURE__*/_jsx(MenuIcon, {})
|
|
@@ -236,9 +242,14 @@ function AppHeader(props) {
|
|
|
236
242
|
},
|
|
237
243
|
sx: {
|
|
238
244
|
flexGrow: 1,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
245
|
+
[theme.breakpoints.up("sm")]: {
|
|
246
|
+
display: "block"
|
|
247
|
+
},
|
|
248
|
+
[theme.breakpoints.between("xs", "md")]: {
|
|
249
|
+
display: "none"
|
|
250
|
+
},
|
|
251
|
+
"& img": {
|
|
252
|
+
marginRight: "7px"
|
|
242
253
|
}
|
|
243
254
|
},
|
|
244
255
|
className: "app-logo",
|
|
@@ -252,9 +263,11 @@ function AppHeader(props) {
|
|
|
252
263
|
}) : null, appTitle]
|
|
253
264
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
254
265
|
sx: {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
266
|
+
[theme.breakpoints.up("sm")]: {
|
|
267
|
+
display: "block"
|
|
268
|
+
},
|
|
269
|
+
[theme.breakpoints.between("xs", "md")]: {
|
|
270
|
+
display: "none"
|
|
258
271
|
}
|
|
259
272
|
},
|
|
260
273
|
children: [isDrawer ? /*#__PURE__*/_jsx(IconButton, {
|