@flozy/editor 3.6.5 → 3.6.7

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.
Files changed (81) hide show
  1. package/dist/Editor/ChatEditor.js +202 -0
  2. package/dist/Editor/CommonEditor.js +166 -109
  3. package/dist/Editor/Elements/AppHeader/AppHeader.js +39 -15
  4. package/dist/Editor/Elements/Button/EditorButton.js +25 -14
  5. package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -17
  6. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  7. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  8. package/dist/Editor/Elements/Color Picker/Styles.js +2 -1
  9. package/dist/Editor/Elements/Embed/Frames/ImageFrame.js +1 -0
  10. package/dist/Editor/Elements/Emoji/EmojiButton.js +2 -2
  11. package/dist/Editor/Elements/Emoji/EmojiPicker.js +16 -0
  12. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
  13. package/dist/Editor/Elements/Grid/Grid.js +2 -0
  14. package/dist/Editor/Elements/Grid/GridItem.js +3 -1
  15. package/dist/Editor/Elements/Link/Link.js +6 -1
  16. package/dist/Editor/Elements/Link/LinkButton.js +4 -2
  17. package/dist/Editor/Elements/Link/LinkPopup.js +11 -3
  18. package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
  19. package/dist/Editor/Elements/Table/TableCell.js +1 -1
  20. package/dist/Editor/MiniEditor.js +3 -1
  21. package/dist/Editor/Toolbar/Basic/index.js +4 -2
  22. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +26 -2
  23. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  24. package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -11
  25. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
  26. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
  27. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
  28. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +20 -13
  29. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +52 -7
  30. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
  31. package/dist/Editor/Toolbar/PopupTool/index.js +9 -2
  32. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  33. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  34. package/dist/Editor/common/ColorPickerButton.js +25 -9
  35. package/dist/Editor/common/CustomColorPicker/index.js +106 -0
  36. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  37. package/dist/Editor/common/CustomDialog/index.js +94 -0
  38. package/dist/Editor/common/CustomDialog/style.js +67 -0
  39. package/dist/Editor/common/CustomSelect.js +33 -0
  40. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  41. package/dist/Editor/common/Icon.js +30 -2
  42. package/dist/Editor/common/LinkSettings/NavComponents.js +54 -20
  43. package/dist/Editor/common/Shorthands/elements.js +54 -0
  44. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  45. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +13 -3
  46. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  47. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +31 -7
  48. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
  49. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
  50. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  51. package/dist/Editor/helper/theme.js +190 -4
  52. package/dist/Editor/hooks/useEditorTheme.js +139 -0
  53. package/dist/Editor/hooks/useMouseMove.js +4 -1
  54. package/dist/Editor/plugins/withEmbeds.js +1 -1
  55. package/dist/Editor/plugins/withHTML.js +47 -5
  56. package/dist/Editor/plugins/withTable.js +1 -1
  57. package/dist/Editor/theme/ThemeList.js +50 -173
  58. package/dist/Editor/theme/index.js +144 -0
  59. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  60. package/dist/Editor/themeSettings/buttons/index.js +290 -0
  61. package/dist/Editor/themeSettings/buttons/style.js +21 -0
  62. package/dist/Editor/themeSettings/colorTheme/index.js +290 -0
  63. package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
  64. package/dist/Editor/themeSettings/fonts/PreviewElement.js +123 -0
  65. package/dist/Editor/themeSettings/fonts/index.js +213 -0
  66. package/dist/Editor/themeSettings/fonts/style.js +44 -0
  67. package/dist/Editor/themeSettings/icons.js +60 -0
  68. package/dist/Editor/themeSettings/index.js +320 -0
  69. package/dist/Editor/themeSettings/style.js +152 -0
  70. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  71. package/dist/Editor/themeSettingsAI/index.js +356 -0
  72. package/dist/Editor/themeSettingsAI/saveTheme.js +190 -0
  73. package/dist/Editor/themeSettingsAI/style.js +247 -0
  74. package/dist/Editor/utils/SlateUtilityFunctions.js +157 -25
  75. package/dist/Editor/utils/button.js +1 -17
  76. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +361 -0
  77. package/dist/Editor/utils/font.js +40 -37
  78. package/dist/Editor/utils/helper.js +83 -22
  79. package/dist/Editor/utils/serializeToHTML.js +25 -13
  80. package/dist/index.js +5 -1
  81. package/package.json +1 -1
@@ -0,0 +1,202 @@
1
+ import React, { useCallback, useMemo, useRef, useState, useEffect, useImperativeHandle, forwardRef } from "react";
2
+ import { Editable, Slate } from 'slate-react';
3
+ import { createEditor } from 'slate';
4
+ import { useDebounce } from "use-debounce";
5
+ import withCommon from "./hooks/withCommon";
6
+ import { getBlock, getMarked } from "./utils/chatEditor/SlateUtilityFunctions";
7
+ import MiniTextFormat from "./Toolbar/PopupTool/MiniTextFormat";
8
+ import { commands, mentionsEvent } from "./utils/events";
9
+ import { insertEmoji } from "./utils/emoji";
10
+ import { draftToSlate } from "./utils/draftToSlate";
11
+ import MentionsPopup from "./common/MentionsPopup";
12
+ import { serializeToText } from "./utils/serializeToText";
13
+ import useMentions from "./hooks/useMentions";
14
+ import Shorthands from "./common/Shorthands";
15
+ import usePopupStyle from "./Toolbar/PopupTool/PopupToolStyle";
16
+ import { EditorProvider } from "./hooks/useMouseMove";
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
20
+ const {
21
+ id,
22
+ theme,
23
+ content,
24
+ readOnly,
25
+ otherProps,
26
+ needLayout = false,
27
+ toolBar = true,
28
+ onSave,
29
+ onsubmit
30
+ } = props;
31
+ const classes = usePopupStyle(theme);
32
+ const convertedContent = draftToSlate({
33
+ data: content
34
+ });
35
+ const [isInteracted, setIsInteracted] = useState(false);
36
+ const [value, setValue] = useState(convertedContent);
37
+ const [loadedValue] = useState(value);
38
+ const [deboundedValue] = useDebounce(value, 500);
39
+ const editor = useMemo(() => {
40
+ return withCommon(createEditor(), {
41
+ needLayout
42
+ });
43
+ }, []);
44
+ const isReadOnly = readOnly === "readonly";
45
+ useImperativeHandle(ref, () => ({
46
+ emojiClick: emoji => {
47
+ insertEmoji(editor, emoji?.native, editor.selection);
48
+ }
49
+ }));
50
+ useEffect(() => {
51
+ setValue(draftToSlate({
52
+ data: content
53
+ }));
54
+ }, [id, content]);
55
+ useEffect(() => {
56
+ if (JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
57
+ const {
58
+ value: strVal,
59
+ ...restVal
60
+ } = getOnSaveData(deboundedValue);
61
+ onSave(strVal, restVal);
62
+ }
63
+ }, [deboundedValue]);
64
+ const getOnSaveData = val => {
65
+ const text = serializeToText(val);
66
+ const title = val?.find(f => f.type === "title");
67
+ return {
68
+ value: JSON.stringify(val),
69
+ text: text,
70
+ title: serializeToText(title?.children) || "Untitled"
71
+ };
72
+ };
73
+ const {
74
+ CHARACTERS = [],
75
+ hideTools
76
+ // needLayout = true,
77
+ } = otherProps || {};
78
+ const mentionsRef = useRef();
79
+ const customProps = {
80
+ ...(otherProps || {}),
81
+ readOnly: isReadOnly,
82
+ editorPlaceholder: "Write Something",
83
+ page_id: 1
84
+ };
85
+ const [mentions, setMentions] = useMentions({
86
+ editor,
87
+ selection: editor?.selection
88
+ });
89
+ const {
90
+ search,
91
+ target,
92
+ index
93
+ } = mentions;
94
+ let {
95
+ type
96
+ } = mentions;
97
+ if (type && type === "elements" && hideTools.indexOf("slash") > -1) {
98
+ type = null;
99
+ }
100
+ const chars = type ? Shorthands[type]({
101
+ ...mentions,
102
+ CHARACTERS,
103
+ hideTools: hideTools
104
+ }) : [];
105
+ const Leaf = ({
106
+ attributes,
107
+ children,
108
+ leaf
109
+ }) => {
110
+ children = getMarked(leaf, children);
111
+ return /*#__PURE__*/_jsx("span", {
112
+ ...attributes,
113
+ children: children
114
+ });
115
+ };
116
+ const handleEditorChange = newValue => {
117
+ setValue(newValue);
118
+ if (!isInteracted) {
119
+ setIsInteracted(true);
120
+ }
121
+ };
122
+ const Element = props => {
123
+ return getBlock(props);
124
+ };
125
+ const renderElement = useCallback(props => {
126
+ return /*#__PURE__*/_jsx(Element, {
127
+ ...props,
128
+ customProps: customProps
129
+ });
130
+ }, []);
131
+ const renderLeaf = useCallback(props => {
132
+ return /*#__PURE__*/_jsx(Leaf, {
133
+ ...props,
134
+ customProps: customProps
135
+ });
136
+ }, []);
137
+ const onKeyDown = useCallback(event => {
138
+ const isMetaKey = event.metaKey && event.keyCode >= 65 && event.keyCode <= 90;
139
+ const isCtrlKey = event.ctrlKey || isMetaKey;
140
+ if (target && chars.length > 0 && !isCtrlKey) {
141
+ mentionsEvent({
142
+ event,
143
+ mentions,
144
+ setMentions,
145
+ chars,
146
+ target,
147
+ editor,
148
+ type,
149
+ mentionsRef
150
+ });
151
+ } else if (isCtrlKey) {
152
+ commands({
153
+ event,
154
+ editor
155
+ });
156
+ } else if (event.key === "Enter" && !event.shiftKey) {
157
+ const {
158
+ value: strVal,
159
+ ...restVal
160
+ } = getOnSaveData(value);
161
+ onsubmit(false, {
162
+ strVal,
163
+ restVal
164
+ });
165
+ }
166
+ }, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
167
+ const handleClose = () => {};
168
+ return /*#__PURE__*/_jsx(EditorProvider, {
169
+ theme: theme,
170
+ editor: editor,
171
+ children: /*#__PURE__*/_jsxs(Slate, {
172
+ editor: editor,
173
+ initialValue: value,
174
+ onChange: handleEditorChange,
175
+ children: [toolBar && /*#__PURE__*/_jsx(MiniTextFormat, {
176
+ classes: classes,
177
+ editor: editor,
178
+ closeMainPopup: handleClose
179
+ }), /*#__PURE__*/_jsx(Editable, {
180
+ className: "chatEditorRoot",
181
+ renderElement: renderElement,
182
+ renderLeaf: renderLeaf,
183
+ placeholder: "Start typing ...",
184
+ spellCheck: true,
185
+ autoFocus: true,
186
+ onKeyDown: onKeyDown
187
+ }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
188
+ ref: mentionsRef,
189
+ mentions: mentions,
190
+ setMentions: setMentions,
191
+ editor: editor,
192
+ target: target,
193
+ index: index,
194
+ chars: chars,
195
+ type: type,
196
+ theme: theme
197
+ }) : null]
198
+ }, id)
199
+ });
200
+ });
201
+ ChatEditor.displayName = "ChatEditor";
202
+ export default ChatEditor;
@@ -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, Button, Typography } from "@mui/material";
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, 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
- children = getMarked(leaf, children);
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
  }
@@ -385,113 +403,152 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
385
403
  }
386
404
  return style;
387
405
  }, [pageBgImage, pageColor]);
388
- return /*#__PURE__*/_jsx(EditorProvider, {
389
- theme: theme,
390
- editor: editor,
391
- children: /*#__PURE__*/_jsx(DialogWrapper, {
392
- classes: classes,
393
- ...props,
394
- fullScreen: fullScreen,
395
- footer: footer || "",
396
- children: /*#__PURE__*/_jsx(Box, {
397
- component: "div",
398
- className: `${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
399
- sx: classes.root,
400
- style: {
401
- ...dotBg
402
- },
403
- children: /*#__PURE__*/_jsxs(Slate, {
404
- editor: editor,
405
- initialValue: value,
406
- onChange: handleEditorChange,
407
- children: [/*#__PURE__*/_jsx(DragAndDrop, {
408
- children: /*#__PURE__*/_jsxs(Overlay, {
409
- children: [/*#__PURE__*/_jsx(Box, {
410
- className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
411
- sx: classes.slateWrapper,
412
- id: "slate-wrapper-scroll-container"
413
- // style={editorWrapperStyle}
414
- ,
415
- ref: editorWrapper,
416
- onClick: e => {
417
- handleInsertLastElement(e, editor);
418
- },
419
- onScroll: handleScroll,
420
- style: editorWrapperStyle,
421
- children: /*#__PURE__*/_jsxs(Box, {
422
- component: "div",
423
- className: "max-content",
424
- "data-info": outsideEditorClickLabel,
425
- children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
426
- className: "scroll-area",
427
- "data-info": outsideEditorClickLabel,
406
+ const themeProps = getTheme(selectedTheme);
407
+ return /*#__PURE__*/_jsx(ThemeContext.Provider, {
408
+ value: {
409
+ openTheme,
410
+ setOpenTheme
411
+ },
412
+ children: /*#__PURE__*/_jsx(CssVarsProvider, {
413
+ theme: extendTheme(selectedTheme?.theme?.cssVars || {}),
414
+ children: /*#__PURE__*/_jsxs(EditorProvider, {
415
+ theme: theme,
416
+ editor: editor,
417
+ children: [showThemeButtons ? /*#__PURE__*/_jsxs("div", {
418
+ style: {
419
+ display: "flex",
420
+ justifyContent: "end",
421
+ alignItems: "center",
422
+ gap: "8px",
423
+ width: "70vw",
424
+ margin: "auto"
425
+ },
426
+ children: [/*#__PURE__*/_jsx(IconButton, {
427
+ onClick: () => setOpenTheme(true),
428
+ children: /*#__PURE__*/_jsx(ThemePaintIcon, {})
429
+ }), /*#__PURE__*/_jsx(IconButton, {
430
+ onClick: () => setOpenAITheme(true),
431
+ style: {
432
+ marginTop: "4px"
433
+ },
434
+ children: /*#__PURE__*/_jsx(ThemeAIIcon, {})
435
+ })]
436
+ }) : null, /*#__PURE__*/_jsx(DialogWrapper, {
437
+ classes: classes,
438
+ ...props,
439
+ fullScreen: fullScreen,
440
+ footer: footer || "",
441
+ children: /*#__PURE__*/_jsx(Box, {
442
+ component: "div",
443
+ className: `${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
444
+ sx: classes.root,
445
+ style: {
446
+ ...dotBg
447
+ },
448
+ children: /*#__PURE__*/_jsxs(Slate, {
449
+ editor: editor,
450
+ initialValue: value,
451
+ onChange: handleEditorChange,
452
+ children: [/*#__PURE__*/_jsx(DragAndDrop, {
453
+ children: /*#__PURE__*/_jsxs(Overlay, {
454
+ children: [/*#__PURE__*/_jsx(Box, {
455
+ className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
456
+ sx: classes.slateWrapper,
457
+ id: "slate-wrapper-scroll-container"
458
+ // style={editorWrapperStyle}
459
+ ,
460
+ ref: editorWrapper,
461
+ onClick: e => {
462
+ handleInsertLastElement(e, editor);
463
+ },
464
+ onScroll: handleScroll,
465
+ style: editorWrapperStyle,
428
466
  children: /*#__PURE__*/_jsxs(Box, {
429
467
  component: "div",
430
- className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
431
- sx: {
432
- backgroundColor: "transparent",
433
- padding: {
434
- ...getTRBLBreakPoints(bannerSpacing)
435
- },
436
- width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
437
- height: viewport.h ? `${viewport.h}px` : `100%`,
438
- alignSelf: "center",
439
- transformOrigin: "left top",
440
- transition: "all 0.3s",
441
- minHeight: "87%",
442
- maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
443
- },
468
+ className: "max-content",
469
+ sx: themeProps?.sxProps || {},
444
470
  "data-info": outsideEditorClickLabel,
445
- children: [/*#__PURE__*/_jsx(Editable, {
446
- className: "innert-editor-textbox",
447
- readOnly: isReadOnly,
448
- renderElement: renderElement,
449
- renderLeaf: renderLeaf,
450
- decorate: decorators,
451
- onKeyDown: onKeyDown
452
- }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
453
- ref: mentionsRef,
454
- mentions: mentions,
455
- setMentions: setMentions,
456
- editor: editor,
457
- target: target,
458
- index: index,
459
- chars: chars,
460
- type: type,
471
+ children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
472
+ className: "scroll-area",
473
+ "data-info": outsideEditorClickLabel,
474
+ children: /*#__PURE__*/_jsxs(Box, {
475
+ component: "div",
476
+ className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
477
+ sx: {
478
+ backgroundColor: "transparent",
479
+ padding: {
480
+ ...getTRBLBreakPoints(bannerSpacing)
481
+ },
482
+ width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
483
+ height: viewport.h ? `${viewport.h}px` : `100%`,
484
+ alignSelf: "center",
485
+ transformOrigin: "left top",
486
+ transition: "all 0.3s",
487
+ minHeight: "87%",
488
+ maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
489
+ },
490
+ "data-info": outsideEditorClickLabel,
491
+ children: [/*#__PURE__*/_jsx(Editable, {
492
+ className: "innert-editor-textbox",
493
+ readOnly: isReadOnly,
494
+ renderElement: renderElement,
495
+ renderLeaf: renderLeaf,
496
+ decorate: decorators,
497
+ onKeyDown: onKeyDown
498
+ }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
499
+ ref: mentionsRef,
500
+ mentions: mentions,
501
+ setMentions: setMentions,
502
+ editor: editor,
503
+ target: target,
504
+ index: index,
505
+ chars: chars,
506
+ type: type,
507
+ theme: theme
508
+ }) : null]
509
+ })
510
+ }), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
511
+ customProps: customProps,
512
+ toolbarOptions: toolbarOptions,
461
513
  theme: theme
462
- }) : null]
514
+ }) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
515
+ otherProps: otherProps || {}
516
+ }), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
517
+ sx: {
518
+ color: "rgb(100, 116, 139)",
519
+ fontSize: "13px",
520
+ paddingBottom: hideMiniToolBar ? "0px" : "12px",
521
+ cursor: "pointer"
522
+ },
523
+ align: "center",
524
+ "data-info": outsideEditorClickLabel,
525
+ onClick: handleFooterClick,
526
+ children: footer
527
+ }), openTheme ? /*#__PURE__*/_jsx(ThemeSettings, {
528
+ open: openTheme,
529
+ setOpen: setOpenTheme,
530
+ editor: editor,
531
+ services: otherProps?.services
532
+ }) : null, /*#__PURE__*/_jsx(ThemeSettingsAI, {
533
+ openAITheme: openAITheme,
534
+ setOpenAITheme: setOpenAITheme,
535
+ onSaveTheme: otherProps?.onSaveTheme
536
+ })]
463
537
  })
464
- }), !hideMiniToolBar ? /*#__PURE__*/_jsx(MiniToolbar, {
465
- customProps: customProps,
466
- toolbarOptions: toolbarOptions,
467
- theme: theme
468
- }) : null, /*#__PURE__*/_jsx(PopoverAIInput, {
469
- otherProps: otherProps || {}
470
- }), footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
471
- sx: {
472
- color: "rgb(100, 116, 139)",
473
- fontSize: "13px",
474
- paddingBottom: hideMiniToolBar ? "0px" : "12px",
475
- cursor: "pointer"
476
- },
477
- align: "center",
478
- "data-info": outsideEditorClickLabel,
479
- onClick: handleFooterClick,
480
- children: footer
481
- })]
538
+ }), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
539
+ onDrawerOpen: onDrawerOpen,
540
+ theme: theme,
541
+ setIsTextSelected: setIsTextSelected,
542
+ customProps: customProps
543
+ }) : null]
482
544
  })
483
- }), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
484
- onDrawerOpen: onDrawerOpen,
485
- theme: theme,
486
- setIsTextSelected: setIsTextSelected,
487
- customProps: customProps
488
- }) : null]
489
- })
490
- }), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
491
- ...htmlAction,
492
- handleCodeToText: handleCodeToText
493
- })]
494
- }, id)
545
+ }), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
546
+ ...htmlAction,
547
+ handleCodeToText: handleCodeToText
548
+ })]
549
+ }, id)
550
+ })
551
+ })]
495
552
  })
496
553
  })
497
554
  });
@@ -62,6 +62,11 @@ function AppHeader(props) {
62
62
  const handleDrawerToggle = () => {
63
63
  setMobileOpen(prevState => !prevState);
64
64
  };
65
+ const closeDrawer = () => {
66
+ if (mobileOpen) {
67
+ handleDrawerToggle();
68
+ }
69
+ };
65
70
  const onSettings = e => {
66
71
  if (!readOnly) {
67
72
  e.stopPropagation();
@@ -146,19 +151,38 @@ function AppHeader(props) {
146
151
  src: appLogo
147
152
  }) : appTitle
148
153
  }), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(List, {
149
- children: menus.map((item, i) => /*#__PURE__*/_jsx(ListItem, {
150
- disablePadding: true,
151
- children: /*#__PURE__*/_jsx(ListItemButton, {
152
- component: "a",
153
- href: item.url,
154
- sx: {
155
- textAlign: "center"
156
- },
157
- children: /*#__PURE__*/_jsx(ListItemText, {
158
- primary: item.text
154
+ children: menus.map((item, i) => {
155
+ const buttonProps = handleLinkType(item.url, item.linkType, true, item.target === "_blank");
156
+ const onTouchEnd = e => {
157
+ if (buttonProps?.onTouchEnd) {
158
+ buttonProps?.onTouchEnd(e);
159
+ closeDrawer();
160
+ }
161
+ };
162
+ const onClick = e => {
163
+ if (buttonProps?.onClick) {
164
+ buttonProps?.onClick(e);
165
+ closeDrawer();
166
+ }
167
+ };
168
+ const props = {
169
+ ...buttonProps,
170
+ onTouchEnd,
171
+ onClick
172
+ };
173
+ return /*#__PURE__*/_jsx(ListItem, {
174
+ disablePadding: true,
175
+ children: /*#__PURE__*/_jsx(ListItemButton, {
176
+ ...props,
177
+ sx: {
178
+ textAlign: "center"
179
+ },
180
+ children: /*#__PURE__*/_jsx(ListItemText, {
181
+ primary: item.text
182
+ })
159
183
  })
160
- })
161
- }, `${item.text}_${i}`))
184
+ }, `${item.text}_${i}`);
185
+ })
162
186
  })]
163
187
  });
164
188
  const container = window !== undefined ? () => window().document.body : undefined;
@@ -227,7 +251,7 @@ function AppHeader(props) {
227
251
  style: {
228
252
  display: "inline-flex",
229
253
  alignItems: "center",
230
- color: textColor,
254
+ color: textColor || "#000000",
231
255
  fontSize: logoFontSize,
232
256
  fontFamily: titleFontFamily,
233
257
  justifyContent: isLogoRight ? "end" : "start"
@@ -275,7 +299,7 @@ function AppHeader(props) {
275
299
  fontFamily: fontFamily,
276
300
  textTransform: "none",
277
301
  fontSize: fontSize || "16px",
278
- color: textColor || "#FFF",
302
+ color: textColor || "#000",
279
303
  background: bgColor || "none",
280
304
  "& .m-settings": {
281
305
  display: "none",
@@ -290,7 +314,7 @@ function AppHeader(props) {
290
314
  background: "#FFF"
291
315
  },
292
316
  "&:hover": {
293
- color: textColorHover || textColor || "#FFF",
317
+ color: textColorHover || textColor || "#000",
294
318
  background: bgColorHover || bgColor || "none",
295
319
  "& .m-settings": {
296
320
  display: "block"