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