@flozy/editor 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +3 -19
- package/dist/Editor/CommonEditor.js +181 -109
- package/dist/Editor/Editor.css +31 -3
- package/dist/Editor/Elements/AI/AIInput.js +31 -33
- package/dist/Editor/Elements/AI/CustomSelect.js +19 -12
- package/dist/Editor/Elements/AI/PopoverAIInput.js +73 -97
- package/dist/Editor/Elements/AI/Styles.js +2 -2
- package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +73 -0
- package/dist/Editor/Elements/AI/VoiceToText/index.js +184 -0
- package/dist/Editor/Elements/AI/VoiceToText/style.js +40 -0
- package/dist/Editor/Elements/AI/helper.js +5 -3
- package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +5 -10
- package/dist/Editor/Elements/AppHeader/AppHeader.js +26 -4
- package/dist/Editor/Elements/Button/EditorButton.js +28 -16
- package/dist/Editor/Elements/Carousel/CarouselButton.js +2 -1
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -15
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +3 -1
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +2 -4
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
- package/dist/Editor/Elements/Grid/Grid.js +27 -3
- package/dist/Editor/Elements/Grid/GridItem.js +3 -1
- package/dist/Editor/Elements/Link/Link.js +6 -1
- package/dist/Editor/Elements/Link/LinkButton.js +4 -2
- package/dist/Editor/Elements/Link/LinkPopup.js +73 -14
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
- package/dist/Editor/Elements/List/CheckList.js +1 -2
- package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +3 -3
- package/dist/Editor/Elements/Redo/RedoButton.js +14 -0
- package/dist/Editor/Elements/Signature/Signature.css +13 -6
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +2 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +185 -30
- package/dist/Editor/Elements/SimpleText/index.js +11 -1
- package/dist/Editor/Elements/SimpleText/style.js +1 -1
- package/dist/Editor/Elements/Table/Styles.js +23 -1
- package/dist/Editor/Elements/Table/Table.js +2 -1
- package/dist/Editor/Elements/Table/TableCell.js +69 -7
- package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +1 -0
- package/dist/Editor/Elements/Undo/UndoButton.js +14 -0
- package/dist/Editor/MiniEditor.js +3 -1
- package/dist/Editor/Styles/EditorStyles.js +1 -1
- package/dist/Editor/Toolbar/Basic/index.js +4 -2
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +31 -20
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +36 -5
- package/dist/Editor/Toolbar/Mini/Options/Options.js +10 -0
- package/dist/Editor/Toolbar/Mini/Styles.js +7 -0
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +12 -13
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +12 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/CustomSelectTool.js +3 -0
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +59 -0
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +123 -44
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +106 -44
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +7 -6
- package/dist/Editor/Toolbar/toolbarGroups.js +53 -11
- package/dist/Editor/assets/svg/AIIcons.js +153 -1
- package/dist/Editor/assets/svg/AddTemplateIcon.js +13 -10
- package/dist/Editor/assets/svg/RedoIcon.js +27 -0
- package/dist/Editor/assets/svg/SettingsIcon.js +28 -0
- package/dist/Editor/assets/svg/TextIcon.js +8 -5
- package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
- package/dist/Editor/assets/svg/UndoIcon.js +27 -0
- package/dist/Editor/common/ColorPickerButton.js +26 -18
- package/dist/Editor/common/CustomColorPicker/index.js +106 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog/index.js +94 -0
- package/dist/Editor/common/CustomDialog/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +33 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +56 -47
- package/dist/Editor/common/EditorIcons.js +7 -7
- package/dist/Editor/common/Icon.js +64 -25
- package/dist/Editor/common/ImageList.js +16 -3
- package/dist/Editor/common/ImageSelector/ImageSelector.js +30 -9
- package/dist/Editor/common/ImageSelector/Styles.js +2 -1
- package/dist/Editor/common/LinkSettings/NavComponents.js +5 -2
- package/dist/Editor/common/LinkSettings/index.js +4 -2
- package/dist/Editor/common/LinkSettings/navOptions.js +7 -2
- package/dist/Editor/common/LinkSettings/style.js +11 -8
- package/dist/Editor/common/MentionsPopup/Styles.js +1 -1
- package/dist/Editor/common/Section/index.js +57 -7
- package/dist/Editor/common/Section/styles.js +11 -0
- package/dist/Editor/common/Shorthands/elements.js +63 -9
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +1 -2
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +13 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +29 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/common/iconListV2.js +843 -0
- package/dist/Editor/common/iconslist.js +0 -31
- package/dist/Editor/commonStyle.js +6 -0
- package/dist/Editor/helper/index.js +0 -22
- package/dist/Editor/helper/theme.js +189 -3
- package/dist/Editor/hooks/useEditorTheme.js +139 -0
- package/dist/Editor/hooks/useMouseMove.js +4 -1
- package/dist/Editor/hooks/useWindowMessage.js +10 -7
- 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 +50 -173
- package/dist/Editor/theme/index.js +144 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
- package/dist/Editor/themeSettings/buttons/index.js +290 -0
- package/dist/Editor/themeSettings/buttons/style.js +21 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +290 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +123 -0
- package/dist/Editor/themeSettings/fonts/index.js +213 -0
- package/dist/Editor/themeSettings/fonts/style.js +44 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +320 -0
- package/dist/Editor/themeSettings/style.js +152 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +356 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +190 -0
- package/dist/Editor/themeSettingsAI/style.js +247 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +169 -27
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/events.js +54 -2
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +31 -2
- package/dist/Editor/utils/table.js +51 -43
- package/package.json +4 -3
@@ -27,8 +27,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
27
27
|
toolBar = true,
|
28
28
|
onSave,
|
29
29
|
onsubmit,
|
30
|
-
onBlur = () => {}
|
31
|
-
isMobile = false
|
30
|
+
onBlur = () => {}
|
32
31
|
} = props;
|
33
32
|
const classes = usePopupStyle(theme);
|
34
33
|
const convertedContent = draftToSlate({
|
@@ -55,22 +54,6 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
55
54
|
if (editor) {
|
56
55
|
ReactEditor.focus(editor);
|
57
56
|
insertEmoji(editor, emoji?.native, editor.selection);
|
58
|
-
if (editor.selection) {
|
59
|
-
// const path = editor.selection.anchor.path;
|
60
|
-
// const offset = editor.selection.anchor.offset + emoji?.native.length;
|
61
|
-
const position = {
|
62
|
-
anchor: {
|
63
|
-
path: [0],
|
64
|
-
offset: 0
|
65
|
-
},
|
66
|
-
focus: {
|
67
|
-
path: [0],
|
68
|
-
offset: 0
|
69
|
-
}
|
70
|
-
};
|
71
|
-
// Create a new selection
|
72
|
-
Transforms.select(editor, position);
|
73
|
-
}
|
74
57
|
ReactEditor.focus(editor);
|
75
58
|
}
|
76
59
|
},
|
@@ -234,7 +217,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
234
217
|
event,
|
235
218
|
editor
|
236
219
|
});
|
237
|
-
} else if (event.key === "Enter"
|
220
|
+
} else if (event.key === "Enter") {
|
238
221
|
const isEmpty = value.length === 1 && value[0].type === 'paragraph' && value[0].children.length === 1 && value[0].children[0].text === '';
|
239
222
|
if (isEmpty) {
|
240
223
|
event.preventDefault();
|
@@ -281,6 +264,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
281
264
|
renderLeaf: renderLeaf,
|
282
265
|
placeholder: "Start typing ...",
|
283
266
|
spellCheck: true,
|
267
|
+
autoFocus: true,
|
284
268
|
onBlur: handleBlur,
|
285
269
|
onKeyDown: onKeyDown
|
286
270
|
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
2
|
-
import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle } from "react";
|
2
|
+
import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle, createContext } 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, IconButton, 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,12 +28,19 @@ 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 } from "./helper/theme";
|
31
|
+
import { getTRBLBreakPoints, getVariableValue } 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";
|
34
39
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
40
|
+
import { ThemeAIIcon, ThemePaintIcon } from "./assets/svg/ThemeIcons";
|
35
41
|
import { jsx as _jsx } from "react/jsx-runtime";
|
36
42
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
43
|
+
export const ThemeContext = /*#__PURE__*/createContext(null);
|
37
44
|
const Item = /*#__PURE__*/forwardRef(({
|
38
45
|
children,
|
39
46
|
...props
|
@@ -60,7 +67,8 @@ const Leaf = ({
|
|
60
67
|
children,
|
61
68
|
leaf
|
62
69
|
}) => {
|
63
|
-
|
70
|
+
const theme = useTheme();
|
71
|
+
children = getMarked(leaf, children, theme);
|
64
72
|
return /*#__PURE__*/_jsx("span", {
|
65
73
|
...attributes,
|
66
74
|
children: children
|
@@ -79,7 +87,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
79
87
|
toolbarOptions,
|
80
88
|
otherProps,
|
81
89
|
isIframe,
|
82
|
-
theme
|
90
|
+
theme,
|
91
|
+
showThemeButtons
|
83
92
|
} = props;
|
84
93
|
const editorWrapper = useRef();
|
85
94
|
const mentionsRef = useRef();
|
@@ -123,10 +132,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
123
132
|
const {
|
124
133
|
bannerSpacing,
|
125
134
|
pageBgImage,
|
126
|
-
pageColor,
|
135
|
+
pageColor = "",
|
127
136
|
color: pageTextColor,
|
128
137
|
pageWidth,
|
129
|
-
maxWidth: pageMaxWidth
|
138
|
+
maxWidth: pageMaxWidth,
|
139
|
+
theme: selectedTheme
|
130
140
|
} = pageSt?.pageProps || {
|
131
141
|
bannerSpacing: {
|
132
142
|
left: 0,
|
@@ -137,9 +147,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
137
147
|
};
|
138
148
|
const classes = editorStyles({
|
139
149
|
padHeight: !fullScreen ? otherProps?.padHeight : 20,
|
140
|
-
placeHolderColor: invertColor(pageColor || "#FFF"),
|
150
|
+
placeHolderColor: invertColor(pageColor.startsWith("var") ? getVariableValue(pageColor) : pageColor || "#FFF"),
|
141
151
|
theme
|
142
152
|
});
|
153
|
+
const [openTheme, setOpenTheme] = useState(false);
|
154
|
+
const [openAITheme, setOpenAITheme] = useState(false);
|
143
155
|
useEffect(() => {
|
144
156
|
setValue(draftToSlate({
|
145
157
|
data: content
|
@@ -239,6 +251,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
239
251
|
redo() {
|
240
252
|
editor?.redo();
|
241
253
|
},
|
254
|
+
toggleTheme() {
|
255
|
+
setOpenTheme(!openTheme);
|
256
|
+
},
|
257
|
+
toggleAITheme() {
|
258
|
+
setOpenAITheme(!openAITheme);
|
259
|
+
},
|
242
260
|
getPageSettings: {
|
243
261
|
background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
|
244
262
|
}
|
@@ -386,113 +404,167 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
386
404
|
}
|
387
405
|
return style;
|
388
406
|
}, [pageBgImage, pageColor]);
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
407
|
+
const themeProps = getTheme(selectedTheme);
|
408
|
+
const handleCursorScroll = container => {
|
409
|
+
try {
|
410
|
+
const cursorPosition = window.getSelection()?.getRangeAt(0).getBoundingClientRect();
|
411
|
+
const containerBottom = container.getBoundingClientRect().bottom;
|
412
|
+
if (cursorPosition?.bottom > containerBottom - 250) {
|
413
|
+
container.scrollBy({
|
414
|
+
top: 200,
|
415
|
+
behavior: "smooth"
|
416
|
+
});
|
417
|
+
}
|
418
|
+
} catch (err) {
|
419
|
+
console.log(err);
|
420
|
+
}
|
421
|
+
};
|
422
|
+
return /*#__PURE__*/_jsx(ThemeContext.Provider, {
|
423
|
+
value: {
|
424
|
+
openTheme,
|
425
|
+
setOpenTheme
|
426
|
+
},
|
427
|
+
children: /*#__PURE__*/_jsx(CssVarsProvider, {
|
428
|
+
theme: extendTheme(selectedTheme?.theme?.cssVars || {}),
|
429
|
+
children: /*#__PURE__*/_jsxs(EditorProvider, {
|
430
|
+
theme: theme,
|
431
|
+
editor: editor,
|
432
|
+
children: [showThemeButtons ? /*#__PURE__*/_jsxs("div", {
|
433
|
+
style: {
|
434
|
+
display: "flex",
|
435
|
+
justifyContent: "end",
|
436
|
+
alignItems: "center",
|
437
|
+
gap: "8px",
|
438
|
+
width: "70vw",
|
439
|
+
margin: "auto"
|
440
|
+
},
|
441
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
442
|
+
onClick: () => setOpenTheme(true),
|
443
|
+
children: /*#__PURE__*/_jsx(ThemePaintIcon, {})
|
444
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
445
|
+
onClick: () => setOpenAITheme(true),
|
446
|
+
style: {
|
447
|
+
marginTop: "4px"
|
448
|
+
},
|
449
|
+
children: /*#__PURE__*/_jsx(ThemeAIIcon, {})
|
450
|
+
})]
|
451
|
+
}) : null, /*#__PURE__*/_jsx(DialogWrapper, {
|
452
|
+
classes: classes,
|
453
|
+
...props,
|
454
|
+
fullScreen: fullScreen,
|
455
|
+
footer: footer || "",
|
456
|
+
children: /*#__PURE__*/_jsx(Box, {
|
457
|
+
component: "div",
|
458
|
+
className: `${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
|
459
|
+
sx: classes.root,
|
460
|
+
style: {
|
461
|
+
...dotBg
|
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,
|
429
481
|
children: /*#__PURE__*/_jsxs(Box, {
|
430
482
|
component: "div",
|
431
|
-
className:
|
432
|
-
sx: {
|
433
|
-
backgroundColor: "transparent",
|
434
|
-
padding: {
|
435
|
-
...getTRBLBreakPoints(bannerSpacing)
|
436
|
-
},
|
437
|
-
width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
|
438
|
-
height: viewport.h ? `${viewport.h}px` : `100%`,
|
439
|
-
alignSelf: "center",
|
440
|
-
transformOrigin: "left top",
|
441
|
-
transition: "all 0.3s",
|
442
|
-
minHeight: "87%",
|
443
|
-
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
|
444
|
-
},
|
483
|
+
className: "max-content",
|
484
|
+
sx: themeProps?.sxProps || {},
|
445
485
|
"data-info": outsideEditorClickLabel,
|
446
|
-
children: [/*#__PURE__*/_jsx(
|
447
|
-
className: "
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
486
|
+
children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
|
487
|
+
className: "scroll-area",
|
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,
|
462
529
|
theme: theme
|
463
|
-
}) : null
|
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"
|
538
|
+
},
|
539
|
+
align: "center",
|
540
|
+
"data-info": outsideEditorClickLabel,
|
541
|
+
onClick: handleFooterClick,
|
542
|
+
children: footer
|
543
|
+
}), openTheme ? /*#__PURE__*/_jsx(ThemeSettings, {
|
544
|
+
open: openTheme,
|
545
|
+
setOpen: setOpenTheme,
|
546
|
+
editor: editor,
|
547
|
+
services: otherProps?.services
|
548
|
+
}) : null, /*#__PURE__*/_jsx(ThemeSettingsAI, {
|
549
|
+
openAITheme: openAITheme,
|
550
|
+
setOpenAITheme: setOpenAITheme,
|
551
|
+
onSaveTheme: otherProps?.onSaveTheme
|
552
|
+
})]
|
464
553
|
})
|
465
|
-
}), !
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
}), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
|
472
|
-
sx: {
|
473
|
-
color: "rgb(100, 116, 139)",
|
474
|
-
fontSize: "13px",
|
475
|
-
paddingBottom: hideMiniToolBar ? "0px" : "12px",
|
476
|
-
cursor: "pointer"
|
477
|
-
},
|
478
|
-
align: "center",
|
479
|
-
"data-info": outsideEditorClickLabel,
|
480
|
-
onClick: handleFooterClick,
|
481
|
-
children: footer
|
482
|
-
})]
|
554
|
+
}), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
|
555
|
+
onDrawerOpen: onDrawerOpen,
|
556
|
+
theme: theme,
|
557
|
+
setIsTextSelected: setIsTextSelected,
|
558
|
+
customProps: customProps
|
559
|
+
}) : null]
|
483
560
|
})
|
484
|
-
}),
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
492
|
-
...htmlAction,
|
493
|
-
handleCodeToText: handleCodeToText
|
494
|
-
})]
|
495
|
-
}, id)
|
561
|
+
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
562
|
+
...htmlAction,
|
563
|
+
handleCodeToText: handleCodeToText
|
564
|
+
})]
|
565
|
+
}, id)
|
566
|
+
})
|
567
|
+
})]
|
496
568
|
})
|
497
569
|
})
|
498
570
|
});
|
package/dist/Editor/Editor.css
CHANGED
@@ -55,7 +55,6 @@ blockquote {
|
|
55
55
|
}
|
56
56
|
|
57
57
|
.editor-wrapper {
|
58
|
-
background: #ffffff;
|
59
58
|
min-height: 400px;
|
60
59
|
height: fit-content;
|
61
60
|
max-width: 100%;
|
@@ -245,6 +244,13 @@ blockquote {
|
|
245
244
|
width: 17px !important;
|
246
245
|
}
|
247
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
|
+
|
248
254
|
.close-popupbtn {
|
249
255
|
border-radius: 4px !important;
|
250
256
|
width: 24px;
|
@@ -268,7 +274,7 @@ blockquote {
|
|
268
274
|
margin: 12px 0px;
|
269
275
|
padding: 0px 5px;
|
270
276
|
border: 0px solid #ccc;
|
271
|
-
min-height:
|
277
|
+
min-height: 211px;
|
272
278
|
}
|
273
279
|
|
274
280
|
.signature-signed-wrapper {
|
@@ -332,7 +338,7 @@ blockquote {
|
|
332
338
|
.signature-canvas {
|
333
339
|
height: 100%;
|
334
340
|
width: 100%;
|
335
|
-
border: 1px solid #
|
341
|
+
border: 1px solid #2563EB;
|
336
342
|
border-radius: 12px;
|
337
343
|
}
|
338
344
|
|
@@ -365,6 +371,7 @@ blockquote {
|
|
365
371
|
|
366
372
|
.dialog-actions-si .MuiButtonBase-root {
|
367
373
|
opacity: 1;
|
374
|
+
padding: 6px 5px 0px 3px !important
|
368
375
|
}
|
369
376
|
|
370
377
|
.signature-tab {
|
@@ -375,6 +382,19 @@ blockquote {
|
|
375
382
|
width: 100%;
|
376
383
|
}
|
377
384
|
|
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
|
+
|
378
398
|
.upload-sign-img-wrapper {
|
379
399
|
text-align: center;
|
380
400
|
}
|
@@ -440,6 +460,10 @@ blockquote {
|
|
440
460
|
color: #ffffff !important;
|
441
461
|
border: 1px solid #2563eb !important;
|
442
462
|
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;
|
443
467
|
}
|
444
468
|
|
445
469
|
.MuiButton-root.primaryBtn.disabled,
|
@@ -460,6 +484,10 @@ blockquote {
|
|
460
484
|
margin-right: 15px !important;
|
461
485
|
color: #2563eb;
|
462
486
|
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;
|
463
491
|
}
|
464
492
|
|
465
493
|
.deleteBtn {
|
@@ -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 } from "react";
|
7
|
+
import React, { forwardRef, useEffect, useRef, useState } from "react";
|
8
8
|
import WaveLoading from "../../common/WaveLoading";
|
9
|
-
import useWindowResize from "../../hooks/useWindowResize";
|
10
9
|
import CustomSelect from "./CustomSelect";
|
11
10
|
import { editContentOptions, newContentOptions, generatedContentOptions } from "./helper";
|
12
11
|
import useClickOutside from "../../hooks/useClickOutside";
|
13
12
|
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: generatedText?.length
|
22
22
|
},
|
23
23
|
fromToolBar: {
|
24
24
|
options: editContentOptions,
|
@@ -36,20 +36,21 @@ function getProps(openAI, generatedText) {
|
|
36
36
|
}
|
37
37
|
function AIInput({
|
38
38
|
onSend,
|
39
|
-
loading,
|
40
39
|
generatedText,
|
41
40
|
openAI,
|
42
41
|
inputValue,
|
43
42
|
onInputChange,
|
44
|
-
onClickOutside
|
43
|
+
onClickOutside,
|
44
|
+
startRecording,
|
45
|
+
loading
|
45
46
|
}, ref) {
|
46
47
|
const {
|
47
48
|
theme
|
48
49
|
} = useEditorContext();
|
49
50
|
const classes = Styles(theme);
|
50
51
|
const inputRef = useRef();
|
51
|
-
const [size] = useWindowResize();
|
52
52
|
const inputWrapperRef = useRef();
|
53
|
+
const [contentHeight, setContentHeight] = useState("100px");
|
53
54
|
const refs = useClickOutside({
|
54
55
|
onClickOutside,
|
55
56
|
omitIds: ["infinity-select-popover"],
|
@@ -74,35 +75,28 @@ function AIInput({
|
|
74
75
|
if (isSendBtnDisabled) {
|
75
76
|
return;
|
76
77
|
}
|
77
|
-
onSend("", {
|
78
|
-
replace: true,
|
79
|
-
isSendBtn: true
|
80
|
-
});
|
78
|
+
onSend("", {});
|
81
79
|
};
|
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]);
|
82
88
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
83
|
-
children: [
|
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, {
|
89
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
93
90
|
component: "div",
|
94
91
|
sx: classes.aiContainer,
|
95
92
|
children: [generatedText ? /*#__PURE__*/_jsx(Typography, {
|
96
93
|
sx: classes.generatedText,
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
},
|
104
|
-
children: generatedText
|
105
|
-
})
|
94
|
+
style: {
|
95
|
+
maxHeight: contentHeight
|
96
|
+
},
|
97
|
+
dangerouslySetInnerHTML: {
|
98
|
+
__html: generatedText
|
99
|
+
}
|
106
100
|
}) : null, /*#__PURE__*/_jsxs(Box, {
|
107
101
|
component: "form",
|
108
102
|
sx: classes.aiInputWrapper,
|
@@ -132,21 +126,25 @@ function AIInput({
|
|
132
126
|
handleSendBtnClick();
|
133
127
|
}
|
134
128
|
}
|
135
|
-
}), fromToolBar ? null : /*#__PURE__*/
|
129
|
+
}), fromToolBar ? null : /*#__PURE__*/_jsxs(Box, {
|
136
130
|
component: "div",
|
137
131
|
style: classes.sendIconContainer,
|
138
132
|
className: "icons-elements",
|
139
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
133
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
134
|
+
disabled: loading,
|
135
|
+
onClick: () => startRecording(),
|
136
|
+
children: /*#__PURE__*/_jsx(ChatMicIcon, {})
|
137
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
140
138
|
sx: isSendBtnDisabled ? classes.sendBtnDisabled : classes.sendBtn,
|
141
139
|
onClick: () => handleSendBtnClick(),
|
142
140
|
children: /*#__PURE__*/_jsx(IoSend, {
|
143
141
|
color: "#fff",
|
144
142
|
size: 14
|
145
143
|
})
|
146
|
-
})
|
144
|
+
})]
|
147
145
|
})]
|
148
146
|
})]
|
149
|
-
}),
|
147
|
+
}), /*#__PURE__*/_jsx(Box, {
|
150
148
|
component: "div",
|
151
149
|
ref: refs[1],
|
152
150
|
sx: classes.customSelectWrapper,
|