@flozy/editor 4.0.2 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +14 -9
- package/dist/Editor/CommonEditor.js +110 -167
- package/dist/Editor/Editor.css +3 -43
- package/dist/Editor/Elements/AI/AIInput.js +33 -31
- package/dist/Editor/Elements/AI/CustomSelect.js +12 -19
- package/dist/Editor/Elements/AI/PopoverAIInput.js +97 -73
- package/dist/Editor/Elements/AI/Styles.js +2 -2
- package/dist/Editor/Elements/AI/helper.js +3 -5
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +4 -15
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Button/EditorButton.js +16 -28
- package/dist/Editor/Elements/Carousel/CarouselButton.js +1 -2
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +15 -60
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -3
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
- package/dist/Editor/Elements/Grid/Grid.js +0 -2
- package/dist/Editor/Elements/Grid/GridItem.js +1 -3
- 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 +14 -73
- package/dist/Editor/Elements/NewLine/NewLineButton.js +1 -2
- package/dist/Editor/Elements/Signature/Signature.css +6 -13
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +1 -2
- package/dist/Editor/Elements/Signature/SignaturePopup.js +30 -185
- package/dist/Editor/Elements/SimpleText/index.js +1 -11
- package/dist/Editor/Elements/SimpleText/style.js +1 -1
- package/dist/Editor/MiniEditor.js +1 -3
- package/dist/Editor/Toolbar/Basic/index.js +2 -4
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -7
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +5 -34
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +13 -12
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +13 -12
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/CustomSelectTool.js +0 -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 +2 -4
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +44 -123
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +44 -106
- package/dist/Editor/Toolbar/PopupTool/index.js +3 -5
- package/dist/Editor/Toolbar/toolbarGroups.js +11 -53
- package/dist/Editor/assets/svg/AIIcons.js +1 -153
- package/dist/Editor/common/ColorPickerButton.js +9 -25
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/EditorIcons.js +7 -7
- package/dist/Editor/common/Icon.js +24 -51
- package/dist/Editor/common/ImageList.js +3 -16
- package/dist/Editor/common/ImageSelector/ImageSelector.js +9 -30
- package/dist/Editor/common/ImageSelector/Styles.js +1 -2
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
- package/dist/Editor/common/LinkSettings/index.js +2 -4
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
- package/dist/Editor/common/LinkSettings/style.js +8 -11
- package/dist/Editor/common/MentionsPopup/Styles.js +1 -1
- package/dist/Editor/common/Shorthands/elements.js +9 -63
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +23 -39
- 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/textOptions.js +4 -14
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/commonStyle.js +0 -6
- package/dist/Editor/helper/theme.js +4 -191
- package/dist/Editor/hooks/useMouseMove.js +1 -4
- package/dist/Editor/hooks/useWindowMessage.js +7 -10
- 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/SlateUtilityFunctions.js +25 -161
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/helper.js +1 -30
- package/package.json +1 -2
- package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +0 -73
- package/dist/Editor/Elements/AI/VoiceToText/index.js +0 -184
- package/dist/Editor/Elements/AI/VoiceToText/style.js +0 -40
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +0 -28
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +0 -59
- 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/common/iconListV2.js +0 -843
- 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,5 @@
|
|
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
3
|
import { createEditor, Transforms } from "slate";
|
4
4
|
import { Slate, Editable, ReactEditor } from "slate-react";
|
5
5
|
import { useDebounce, useDebouncedCallback } from "use-debounce";
|
@@ -18,7 +18,7 @@ import { getThumbnailImage, invertColor } from "./helper";
|
|
18
18
|
import PopupTool from "./Toolbar/PopupTool";
|
19
19
|
import "./font.css";
|
20
20
|
import "./Editor.css";
|
21
|
-
import { Box,
|
21
|
+
import { Box, Button, Typography } from "@mui/material";
|
22
22
|
import Shorthands from "./common/Shorthands";
|
23
23
|
import MiniToolbar from "./Toolbar/Mini/MiniToolbar";
|
24
24
|
import { EditorProvider } from "./hooks/useMouseMove";
|
@@ -28,19 +28,12 @@ import DragAndDrop from "./common/DnD";
|
|
28
28
|
import Section from "./common/Section";
|
29
29
|
import "animate.css";
|
30
30
|
import decorators from "./utils/Decorators";
|
31
|
-
import { getTRBLBreakPoints
|
31
|
+
import { getTRBLBreakPoints } from "./helper/theme";
|
32
32
|
import { handleInsertLastElement, onDeleteKey, outsideEditorClickLabel } from "./utils/helper";
|
33
33
|
import useWindowResize from "./hooks/useWindowResize";
|
34
|
-
import { getTheme } from "./theme";
|
35
|
-
import { useTheme } from "@emotion/react";
|
36
|
-
import ThemeSettings from "./themeSettings";
|
37
|
-
import ThemeSettingsAI from "./themeSettingsAI";
|
38
|
-
import { Experimental_CssVarsProvider as CssVarsProvider, experimental_extendTheme as extendTheme } from "@mui/material/styles";
|
39
34
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
40
|
-
import { ThemeAIIcon, ThemePaintIcon } from "./assets/svg/ThemeIcons";
|
41
35
|
import { jsx as _jsx } from "react/jsx-runtime";
|
42
36
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
43
|
-
export const ThemeContext = /*#__PURE__*/createContext(null);
|
44
37
|
const Item = /*#__PURE__*/forwardRef(({
|
45
38
|
children,
|
46
39
|
...props
|
@@ -67,8 +60,7 @@ const Leaf = ({
|
|
67
60
|
children,
|
68
61
|
leaf
|
69
62
|
}) => {
|
70
|
-
|
71
|
-
children = getMarked(leaf, children, theme);
|
63
|
+
children = getMarked(leaf, children);
|
72
64
|
return /*#__PURE__*/_jsx("span", {
|
73
65
|
...attributes,
|
74
66
|
children: children
|
@@ -87,8 +79,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
87
79
|
toolbarOptions,
|
88
80
|
otherProps,
|
89
81
|
isIframe,
|
90
|
-
theme
|
91
|
-
showThemeButtons
|
82
|
+
theme
|
92
83
|
} = props;
|
93
84
|
const editorWrapper = useRef();
|
94
85
|
const mentionsRef = useRef();
|
@@ -132,11 +123,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
132
123
|
const {
|
133
124
|
bannerSpacing,
|
134
125
|
pageBgImage,
|
135
|
-
pageColor
|
126
|
+
pageColor,
|
136
127
|
color: pageTextColor,
|
137
128
|
pageWidth,
|
138
|
-
maxWidth: pageMaxWidth
|
139
|
-
theme: selectedTheme
|
129
|
+
maxWidth: pageMaxWidth
|
140
130
|
} = pageSt?.pageProps || {
|
141
131
|
bannerSpacing: {
|
142
132
|
left: 0,
|
@@ -147,11 +137,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
147
137
|
};
|
148
138
|
const classes = editorStyles({
|
149
139
|
padHeight: !fullScreen ? otherProps?.padHeight : 20,
|
150
|
-
placeHolderColor: invertColor(pageColor
|
140
|
+
placeHolderColor: invertColor(pageColor || "#FFF"),
|
151
141
|
theme
|
152
142
|
});
|
153
|
-
const [openTheme, setOpenTheme] = useState(false);
|
154
|
-
const [openAITheme, setOpenAITheme] = useState(false);
|
155
143
|
useEffect(() => {
|
156
144
|
setValue(draftToSlate({
|
157
145
|
data: content
|
@@ -251,12 +239,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
251
239
|
redo() {
|
252
240
|
editor?.redo();
|
253
241
|
},
|
254
|
-
toggleTheme() {
|
255
|
-
setOpenTheme(!openTheme);
|
256
|
-
},
|
257
|
-
toggleAITheme() {
|
258
|
-
setOpenAITheme(!openAITheme);
|
259
|
-
},
|
260
242
|
getPageSettings: {
|
261
243
|
background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
|
262
244
|
}
|
@@ -404,7 +386,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
404
386
|
}
|
405
387
|
return style;
|
406
388
|
}, [pageBgImage, pageColor]);
|
407
|
-
const themeProps = getTheme(selectedTheme);
|
408
389
|
const handleCursorScroll = container => {
|
409
390
|
try {
|
410
391
|
const cursorPosition = window.getSelection()?.getRangeAt(0).getBoundingClientRect();
|
@@ -419,152 +400,114 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
419
400
|
console.log(err);
|
420
401
|
}
|
421
402
|
};
|
422
|
-
return /*#__PURE__*/_jsx(
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
children: [/*#__PURE__*/_jsx(
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
},
|
463
|
-
children: /*#__PURE__*/_jsxs(Slate, {
|
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,
|
403
|
+
return /*#__PURE__*/_jsx(EditorProvider, {
|
404
|
+
theme: theme,
|
405
|
+
editor: editor,
|
406
|
+
children: /*#__PURE__*/_jsx(DialogWrapper, {
|
407
|
+
classes: classes,
|
408
|
+
...props,
|
409
|
+
fullScreen: fullScreen,
|
410
|
+
footer: footer || "",
|
411
|
+
children: /*#__PURE__*/_jsx(Box, {
|
412
|
+
component: "div",
|
413
|
+
className: `${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
|
414
|
+
sx: classes.root,
|
415
|
+
style: {
|
416
|
+
...dotBg
|
417
|
+
},
|
418
|
+
children: /*#__PURE__*/_jsxs(Slate, {
|
419
|
+
editor: editor,
|
420
|
+
initialValue: value,
|
421
|
+
onChange: handleEditorChange,
|
422
|
+
children: [/*#__PURE__*/_jsx(DragAndDrop, {
|
423
|
+
children: /*#__PURE__*/_jsxs(Overlay, {
|
424
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
425
|
+
className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
|
426
|
+
sx: classes.slateWrapper,
|
427
|
+
id: "slate-wrapper-scroll-container"
|
428
|
+
// style={editorWrapperStyle}
|
429
|
+
,
|
430
|
+
ref: editorWrapper,
|
431
|
+
onClick: e => {
|
432
|
+
handleInsertLastElement(e, editor);
|
433
|
+
},
|
434
|
+
onScroll: handleScroll,
|
435
|
+
style: editorWrapperStyle,
|
436
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
437
|
+
component: "div",
|
438
|
+
className: "max-content",
|
439
|
+
"data-info": outsideEditorClickLabel,
|
440
|
+
children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
|
441
|
+
className: "scroll-area",
|
442
|
+
"data-info": outsideEditorClickLabel,
|
481
443
|
children: /*#__PURE__*/_jsxs(Box, {
|
482
444
|
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"
|
445
|
+
className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
|
446
|
+
sx: {
|
447
|
+
backgroundColor: "transparent",
|
448
|
+
padding: {
|
449
|
+
...getTRBLBreakPoints(bannerSpacing)
|
538
450
|
},
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
451
|
+
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
452
|
+
height: viewport.h ? `${viewport.h}px` : `100%`,
|
453
|
+
alignSelf: "center",
|
454
|
+
transformOrigin: "left top",
|
455
|
+
transition: "all 0.3s",
|
456
|
+
minHeight: "87%",
|
457
|
+
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
|
458
|
+
},
|
459
|
+
"data-info": outsideEditorClickLabel,
|
460
|
+
children: [/*#__PURE__*/_jsx(Editable, {
|
461
|
+
className: "innert-editor-textbox",
|
462
|
+
readOnly: isReadOnly,
|
463
|
+
renderElement: renderElement,
|
464
|
+
renderLeaf: renderLeaf,
|
465
|
+
decorate: decorators,
|
466
|
+
onKeyDown: onKeyDown,
|
467
|
+
onSelect: () => handleCursorScroll(editorWrapper.current)
|
468
|
+
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
469
|
+
ref: mentionsRef,
|
470
|
+
mentions: mentions,
|
471
|
+
setMentions: setMentions,
|
546
472
|
editor: editor,
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
})]
|
473
|
+
target: target,
|
474
|
+
index: index,
|
475
|
+
chars: chars,
|
476
|
+
type: type,
|
477
|
+
theme: theme
|
478
|
+
}) : null]
|
553
479
|
})
|
554
|
-
}), !
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
480
|
+
}), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
|
481
|
+
customProps: customProps,
|
482
|
+
toolbarOptions: toolbarOptions,
|
483
|
+
theme: theme
|
484
|
+
}) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
|
485
|
+
otherProps: otherProps || {}
|
486
|
+
}), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
|
487
|
+
sx: {
|
488
|
+
color: "rgb(100, 116, 139)",
|
489
|
+
fontSize: "13px",
|
490
|
+
paddingBottom: hideMiniToolBar ? "0px" : "12px",
|
491
|
+
cursor: "pointer"
|
492
|
+
},
|
493
|
+
align: "center",
|
494
|
+
"data-info": outsideEditorClickLabel,
|
495
|
+
onClick: handleFooterClick,
|
496
|
+
children: footer
|
497
|
+
})]
|
560
498
|
})
|
561
|
-
}),
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
499
|
+
}), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
|
500
|
+
onDrawerOpen: onDrawerOpen,
|
501
|
+
theme: theme,
|
502
|
+
setIsTextSelected: setIsTextSelected,
|
503
|
+
customProps: customProps
|
504
|
+
}) : null]
|
505
|
+
})
|
506
|
+
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
507
|
+
...htmlAction,
|
508
|
+
handleCodeToText: handleCodeToText
|
509
|
+
})]
|
510
|
+
}, id)
|
568
511
|
})
|
569
512
|
})
|
570
513
|
});
|
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;
|
@@ -274,7 +267,7 @@ blockquote {
|
|
274
267
|
margin: 12px 0px;
|
275
268
|
padding: 0px 5px;
|
276
269
|
border: 0px solid #ccc;
|
277
|
-
min-height:
|
270
|
+
min-height: 100px;
|
278
271
|
}
|
279
272
|
|
280
273
|
.signature-signed-wrapper {
|
@@ -338,7 +331,7 @@ blockquote {
|
|
338
331
|
.signature-canvas {
|
339
332
|
height: 100%;
|
340
333
|
width: 100%;
|
341
|
-
border: 1px solid #
|
334
|
+
border: 1px solid #0052cc;
|
342
335
|
border-radius: 12px;
|
343
336
|
}
|
344
337
|
|
@@ -371,7 +364,6 @@ blockquote {
|
|
371
364
|
|
372
365
|
.dialog-actions-si .MuiButtonBase-root {
|
373
366
|
opacity: 1;
|
374
|
-
padding: 6px 5px 0px 3px !important
|
375
367
|
}
|
376
368
|
|
377
369
|
.signature-tab {
|
@@ -382,19 +374,6 @@ blockquote {
|
|
382
374
|
width: 100%;
|
383
375
|
}
|
384
376
|
|
385
|
-
.signature-tab2 {
|
386
|
-
/* display: flex; */
|
387
|
-
align-items: center;
|
388
|
-
border-width: 0px, 0px, 0px, 0px;
|
389
|
-
border-style: solid;
|
390
|
-
border-color: #2563EB;
|
391
|
-
justify-content: center;
|
392
|
-
flex-direction: column;
|
393
|
-
width: 100%;
|
394
|
-
border-radius: 7px;
|
395
|
-
padding: 10px;
|
396
|
-
}
|
397
|
-
|
398
377
|
.upload-sign-img-wrapper {
|
399
378
|
text-align: center;
|
400
379
|
}
|
@@ -460,10 +439,6 @@ blockquote {
|
|
460
439
|
color: #ffffff !important;
|
461
440
|
border: 1px solid #2563eb !important;
|
462
441
|
width: auto !important;
|
463
|
-
padding: 2px 0px 0px 0px !important;
|
464
|
-
min-width: 89px !important;
|
465
|
-
font-family: Inter, sans-serif;
|
466
|
-
text-transform: none;
|
467
442
|
}
|
468
443
|
|
469
444
|
.MuiButton-root.primaryBtn.disabled,
|
@@ -484,10 +459,6 @@ blockquote {
|
|
484
459
|
margin-right: 15px !important;
|
485
460
|
color: #2563eb;
|
486
461
|
width: auto !important;
|
487
|
-
padding: 2px 0px 0px 0px !important;
|
488
|
-
min-width: 89px !important;
|
489
|
-
font-family: Inter, sans-serif;
|
490
|
-
text-transform: none;
|
491
462
|
}
|
492
463
|
|
493
464
|
.deleteBtn {
|
@@ -858,17 +829,6 @@ blockquote {
|
|
858
829
|
text-align: center;
|
859
830
|
}
|
860
831
|
|
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
832
|
.borderInput:focus-visible {
|
873
833
|
outline: none !important;
|
874
834
|
}
|
@@ -918,7 +878,7 @@ blockquote {
|
|
918
878
|
}
|
919
879
|
|
920
880
|
.sliderInput {
|
921
|
-
width:
|
881
|
+
width: 66px;
|
922
882
|
padding: 2px 10px;
|
923
883
|
margin-left: 18px;
|
924
884
|
box-shadow: 0px 4px 16px 0px #0000000d;
|
@@ -4,13 +4,13 @@ import Icon from "../../common/Icon";
|
|
4
4
|
// import { TbRotateClockwise } from "react-icons/tb";
|
5
5
|
// import { FaRegCircleCheck } from "react-icons/fa6";
|
6
6
|
import { IoSend } from "react-icons/io5";
|
7
|
-
import React, { forwardRef, useEffect, useRef
|
7
|
+
import React, { forwardRef, useEffect, useRef } from "react";
|
8
8
|
import WaveLoading from "../../common/WaveLoading";
|
9
|
+
import useWindowResize from "../../hooks/useWindowResize";
|
9
10
|
import CustomSelect from "./CustomSelect";
|
10
11
|
import { editContentOptions, newContentOptions, generatedContentOptions } from "./helper";
|
11
12
|
import useClickOutside from "../../hooks/useClickOutside";
|
12
13
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
13
|
-
import { ChatMicIcon } from "../../assets/svg/AIIcons";
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
16
16
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -18,7 +18,7 @@ function getProps(openAI, generatedText) {
|
|
18
18
|
const dropDownProps = {
|
19
19
|
fromElements: {
|
20
20
|
options: newContentOptions,
|
21
|
-
show:
|
21
|
+
show: window.getSelection().toString().length
|
22
22
|
},
|
23
23
|
fromToolBar: {
|
24
24
|
options: editContentOptions,
|
@@ -36,21 +36,20 @@ function getProps(openAI, generatedText) {
|
|
36
36
|
}
|
37
37
|
function AIInput({
|
38
38
|
onSend,
|
39
|
+
loading,
|
39
40
|
generatedText,
|
40
41
|
openAI,
|
41
42
|
inputValue,
|
42
43
|
onInputChange,
|
43
|
-
onClickOutside
|
44
|
-
startRecording,
|
45
|
-
loading
|
44
|
+
onClickOutside
|
46
45
|
}, ref) {
|
47
46
|
const {
|
48
47
|
theme
|
49
48
|
} = useEditorContext();
|
50
49
|
const classes = Styles(theme);
|
51
50
|
const inputRef = useRef();
|
51
|
+
const [size] = useWindowResize();
|
52
52
|
const inputWrapperRef = useRef();
|
53
|
-
const [contentHeight, setContentHeight] = useState("100px");
|
54
53
|
const refs = useClickOutside({
|
55
54
|
onClickOutside,
|
56
55
|
omitIds: ["infinity-select-popover"],
|
@@ -75,28 +74,35 @@ function AIInput({
|
|
75
74
|
if (isSendBtnDisabled) {
|
76
75
|
return;
|
77
76
|
}
|
78
|
-
onSend("", {
|
77
|
+
onSend("", {
|
78
|
+
replace: true,
|
79
|
+
isSendBtn: true
|
80
|
+
});
|
79
81
|
};
|
80
|
-
useEffect(() => {
|
81
|
-
const selectWrapper = refs?.length ? refs[1]?.current : null;
|
82
|
-
const slateWrapper = document.getElementById("slate-wrapper-scroll-container");
|
83
|
-
if (selectWrapper && slateWrapper) {
|
84
|
-
const height = slateWrapper.offsetHeight - selectWrapper.offsetHeight - 80;
|
85
|
-
setContentHeight(height + "px");
|
86
|
-
}
|
87
|
-
}, [refs, generatedText]);
|
88
82
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
89
|
-
children: [/*#__PURE__*/
|
83
|
+
children: [size.device === "xs" ? /*#__PURE__*/_jsx(Box, {
|
84
|
+
component: "div",
|
85
|
+
ref: refs[1],
|
86
|
+
sx: classes.customSelectWrapper,
|
87
|
+
children: /*#__PURE__*/_jsx(CustomSelect, {
|
88
|
+
...props,
|
89
|
+
onSend: onSend,
|
90
|
+
classes: classes
|
91
|
+
})
|
92
|
+
}) : null, /*#__PURE__*/_jsxs(Box, {
|
90
93
|
component: "div",
|
91
94
|
sx: classes.aiContainer,
|
92
95
|
children: [generatedText ? /*#__PURE__*/_jsx(Typography, {
|
93
96
|
sx: classes.generatedText,
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
97
|
+
children: /*#__PURE__*/_jsx("pre", {
|
98
|
+
style: {
|
99
|
+
whiteSpace: "pre-wrap",
|
100
|
+
wordWrap: "break-word",
|
101
|
+
fontFamily: "inherit",
|
102
|
+
margin: 0
|
103
|
+
},
|
104
|
+
children: generatedText
|
105
|
+
})
|
100
106
|
}) : null, /*#__PURE__*/_jsxs(Box, {
|
101
107
|
component: "form",
|
102
108
|
sx: classes.aiInputWrapper,
|
@@ -126,25 +132,21 @@ function AIInput({
|
|
126
132
|
handleSendBtnClick();
|
127
133
|
}
|
128
134
|
}
|
129
|
-
}), fromToolBar ? null : /*#__PURE__*/
|
135
|
+
}), fromToolBar ? null : /*#__PURE__*/_jsx(Box, {
|
130
136
|
component: "div",
|
131
137
|
style: classes.sendIconContainer,
|
132
138
|
className: "icons-elements",
|
133
|
-
children:
|
134
|
-
disabled: loading,
|
135
|
-
onClick: () => startRecording(),
|
136
|
-
children: /*#__PURE__*/_jsx(ChatMicIcon, {})
|
137
|
-
}), /*#__PURE__*/_jsx(IconButton, {
|
139
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
138
140
|
sx: isSendBtnDisabled ? classes.sendBtnDisabled : classes.sendBtn,
|
139
141
|
onClick: () => handleSendBtnClick(),
|
140
142
|
children: /*#__PURE__*/_jsx(IoSend, {
|
141
143
|
color: "#fff",
|
142
144
|
size: 14
|
143
145
|
})
|
144
|
-
})
|
146
|
+
})
|
145
147
|
})]
|
146
148
|
})]
|
147
|
-
}), /*#__PURE__*/_jsx(Box, {
|
149
|
+
}), size.device === "xs" ? null : /*#__PURE__*/_jsx(Box, {
|
148
150
|
component: "div",
|
149
151
|
ref: refs[1],
|
150
152
|
sx: classes.customSelectWrapper,
|