@flozy/editor 9.8.5 → 9.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/ChatEditor.js +17 -16
- package/dist/Editor/CommonEditor.js +119 -18
- package/dist/Editor/DialogWrapper.js +31 -25
- package/dist/Editor/Editor.css +16 -8
- package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Button/EditorButton.js +37 -25
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
- package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +4 -2
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +448 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +21 -6
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +3 -2
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +11 -0
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +8 -4
- package/dist/Editor/Elements/Embed/Image.js +2 -2
- package/dist/Editor/Elements/Embed/Video.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +48 -22
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +25 -4
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +46 -3
- package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -2
- package/dist/Editor/Elements/FreeGrid/styles.js +3 -0
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/List/CheckList.js +4 -1
- package/dist/Editor/Elements/Search/SearchButton.js +1 -1
- package/dist/Editor/Elements/Search/SearchList.js +3 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +2 -8
- package/dist/Editor/Elements/SimpleText/index.js +9 -1
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Title/title.js +9 -8
- package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
- package/dist/Editor/MiniEditor.js +2 -1
- package/dist/Editor/Styles/EditorStyles.js +5 -5
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +72 -12
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +95 -23
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/BackIcon.js +18 -0
- package/dist/Editor/assets/svg/ClearAllRounded.js +31 -0
- package/dist/Editor/assets/svg/ResetIconNew.js +23 -0
- package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
- package/dist/Editor/common/ColorPickerButton.js +38 -16
- package/dist/Editor/common/CustomColorPicker/index.js +131 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog2/index.js +94 -0
- package/dist/Editor/common/CustomDialog2/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +43 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
- package/dist/Editor/common/Icon.js +31 -1
- package/dist/Editor/common/ImageSelector/Styles.js +3 -9
- package/dist/Editor/common/MUIIcon/index.js +0 -3
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +24 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
- package/dist/Editor/common/RnD/ShadowElement.js +2 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +8 -2
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +73 -9
- package/dist/Editor/common/RnD/Utils/index.js +3 -0
- package/dist/Editor/common/RnD/VirtualElement/BoxHeaderAutoAlignment.js +43 -0
- package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +44 -0
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +134 -0
- package/dist/Editor/common/RnD/VirtualElement/helper.js +382 -0
- package/dist/Editor/common/RnD/VirtualElement/index.js +187 -103
- package/dist/Editor/common/RnD/VirtualElement/styles.js +155 -7
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +5 -3
- package/dist/Editor/common/RnD/index.js +59 -10
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- package/dist/Editor/common/SnackBar/index.js +43 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +7 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +5 -7
- package/dist/Editor/common/SwipeableDrawer/index.js +1 -1
- package/dist/Editor/common/Uploader.js +8 -0
- package/dist/Editor/common/iconslist.js +7 -8
- package/dist/Editor/commonStyle.js +95 -60
- package/dist/Editor/helper/textIndeces.js +58 -0
- package/dist/Editor/helper/theme.js +202 -2
- package/dist/Editor/hooks/useAutoScroll.js +38 -0
- package/dist/Editor/hooks/useEditorTheme.js +153 -0
- package/dist/Editor/hooks/useMouseMove.js +9 -3
- package/dist/Editor/hooks/useThemeValues.js +63 -0
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +11 -9
- package/dist/Editor/plugins/withLinks.js +9 -10
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +149 -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 +23 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +309 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
- package/dist/Editor/themeSettings/fonts/index.js +240 -0
- package/dist/Editor/themeSettings/fonts/style.js +62 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +361 -0
- package/dist/Editor/themeSettings/style.js +292 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +355 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
- package/dist/Editor/themeSettingsAI/style.js +324 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +171 -45
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/freegrid.js +2 -3
- package/dist/Editor/utils/helper.js +90 -19
- package/package.json +4 -4
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useCallback, useMemo, useRef, useImperativeHandle, forwardRef, useState } from "react";
|
2
|
-
import { Editable, Slate, ReactEditor } from
|
3
|
-
import { createEditor, Transforms, Editor } from
|
2
|
+
import { Editable, Slate, ReactEditor } from "slate-react";
|
3
|
+
import { createEditor, Transforms, Editor } from "slate";
|
4
4
|
import withCommon from "./hooks/withCommon";
|
5
5
|
import { getBlock, getMarked, serializeMentions } from "./utils/chatEditor/SlateUtilityFunctions";
|
6
6
|
import MiniTextFormat from "./Toolbar/PopupTool/MiniTextFormat";
|
@@ -33,15 +33,15 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
33
33
|
isMobile = false,
|
34
34
|
debounceTimeOut = 10,
|
35
35
|
isMarkDown = false,
|
36
|
-
markDownContent =
|
36
|
+
markDownContent = "",
|
37
37
|
translation
|
38
38
|
} = props;
|
39
39
|
const classes = usePopupStyle(theme);
|
40
40
|
const convertedContent = draftToSlate({
|
41
41
|
data: content && content?.length > 0 ? content : [{
|
42
|
-
type:
|
42
|
+
type: "paragraph",
|
43
43
|
children: [{
|
44
|
-
text:
|
44
|
+
text: ""
|
45
45
|
}]
|
46
46
|
}]
|
47
47
|
});
|
@@ -153,14 +153,6 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
153
153
|
// needLayout = true,
|
154
154
|
} = otherProps || {};
|
155
155
|
const mentionsRef = useRef();
|
156
|
-
const customProps = {
|
157
|
-
...(otherProps || {}),
|
158
|
-
hideTools: ["settings", "add_column", "drag", "resize"],
|
159
|
-
readOnly: isReadOnly,
|
160
|
-
editorPlaceholder: "Write Something",
|
161
|
-
page_id: 1,
|
162
|
-
translation: translation || translationMock
|
163
|
-
};
|
164
156
|
const [mentions, setMentions] = useMentions({
|
165
157
|
editor,
|
166
158
|
selection: editor?.selection
|
@@ -222,6 +214,15 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
222
214
|
debounced(newValue);
|
223
215
|
debouncedValue.current = newValue;
|
224
216
|
};
|
217
|
+
const dummyTranslation = () => {};
|
218
|
+
const customProps = {
|
219
|
+
...(otherProps || {}),
|
220
|
+
hideTools: ["settings", "add_column", "drag", "resize"],
|
221
|
+
readOnly: isReadOnly,
|
222
|
+
editorPlaceholder: "Write Something",
|
223
|
+
page_id: 1,
|
224
|
+
translation: translation || translationMock || dummyTranslation
|
225
|
+
};
|
225
226
|
const Element = props => {
|
226
227
|
return getBlock(props);
|
227
228
|
};
|
@@ -257,7 +258,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
257
258
|
editor
|
258
259
|
});
|
259
260
|
} else if (event.key === "Enter" && !isMobile) {
|
260
|
-
const isEmpty = debouncedValue?.current.length === 1 && debouncedValue?.current[0].type ===
|
261
|
+
const isEmpty = debouncedValue?.current.length === 1 && debouncedValue?.current[0].type === "paragraph" && debouncedValue?.current[0].children.length === 1 && debouncedValue?.current[0].children[0].text === "";
|
261
262
|
if (isEmpty) {
|
262
263
|
event.preventDefault();
|
263
264
|
return;
|
@@ -297,10 +298,10 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
297
298
|
}
|
298
299
|
};
|
299
300
|
|
301
|
+
const html = isMarkDown ? convertMDToHTML(markDownContent) : null;
|
300
302
|
const handleFocus = () => {
|
301
303
|
setIsFocused(true);
|
302
304
|
};
|
303
|
-
const html = isMarkDown ? convertMDToHTML(markDownContent) : null;
|
304
305
|
return !isMarkDown ? /*#__PURE__*/_jsx(EditorProvider, {
|
305
306
|
theme: theme,
|
306
307
|
editor: editor,
|
@@ -314,13 +315,13 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
314
315
|
closeMainPopup: handleClose,
|
315
316
|
customProps: customProps
|
316
317
|
}), /*#__PURE__*/_jsx(Editable, {
|
317
|
-
onFocus: handleFocus,
|
318
318
|
className: "chatEditorRoot",
|
319
319
|
renderElement: renderElement,
|
320
320
|
renderLeaf: renderLeaf,
|
321
321
|
decorate: decorators,
|
322
322
|
placeholder: "Start typing ...",
|
323
323
|
spellCheck: true,
|
324
|
+
onFocus: handleFocus,
|
324
325
|
onBlur: handleBlur,
|
325
326
|
onKeyDown: onKeyDown,
|
326
327
|
onPaste: handlePaste,
|
@@ -1,7 +1,7 @@
|
|
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 PropTypes from "prop-types";
|
4
|
-
import { createEditor, Range, Transforms } from "slate";
|
4
|
+
import { createEditor, Editor, Range, Transforms } from "slate";
|
5
5
|
import { Slate, Editable, ReactEditor } from "slate-react";
|
6
6
|
import { useDebouncedCallback } from "use-debounce";
|
7
7
|
import { getMarked, getBlock } from "./utils/SlateUtilityFunctions";
|
@@ -17,7 +17,7 @@ import { serializeToText } from "./utils/serializeToText";
|
|
17
17
|
import { getPageSettings } from "./utils/pageSettings";
|
18
18
|
import { getThumbnailImage, invertColor, pageTextStyle } from "./helper";
|
19
19
|
import PopupTool from "./Toolbar/PopupTool";
|
20
|
-
import { Box, Typography, useTheme } from "@mui/material";
|
20
|
+
import { Box, Typography, useTheme, IconButton } from "@mui/material";
|
21
21
|
import Shorthands from "./common/Shorthands";
|
22
22
|
import MiniToolbar from "./Toolbar/Mini/MiniToolbar";
|
23
23
|
import { EditorProvider } from "./hooks/useMouseMove";
|
@@ -26,9 +26,12 @@ import editorStyles from "./Styles/EditorStyles";
|
|
26
26
|
import DragAndDrop from "./common/DnD";
|
27
27
|
import Section from "./common/Section";
|
28
28
|
import decorators from "./utils/Decorators";
|
29
|
-
import {
|
29
|
+
import { getTRBLBreakPoints, getVariableValue, getBreakpointLineSpacing } from "./helper/theme";
|
30
30
|
import { getInitialValue, handleInsertLastElement, isEverythingSelected, isFreeGrid, isFreeGridFragment, isRestrictedNode, outsideEditorClickLabel } from "./utils/helper";
|
31
31
|
import useWindowResize from "./hooks/useWindowResize";
|
32
|
+
import { getTheme } from "./theme";
|
33
|
+
import ThemeSettings from "./themeSettings";
|
34
|
+
import ThemeSettingsAI from "./themeSettingsAI";
|
32
35
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
33
36
|
import RnDCopy from "./common/RnD/RnDCopy";
|
34
37
|
import SwitchViewport from "./common/RnD/SwitchViewport/SwitchViewport";
|
@@ -37,9 +40,12 @@ import "./font.css";
|
|
37
40
|
import "./Editor.css";
|
38
41
|
import "animate.css";
|
39
42
|
import FontLoader from "./common/FontLoader/FontLoader";
|
43
|
+
import { ThemeAIIcon, ThemePaintIcon } from "./assets/svg/ThemeIcons";
|
40
44
|
import { CustomDialogComponent } from "./common/CustomDialog";
|
45
|
+
import { extractTextWithPath, replaceTextPath } from "./helper/textIndeces.js";
|
41
46
|
import { jsx as _jsx } from "react/jsx-runtime";
|
42
47
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
48
|
+
export const ThemeContext = /*#__PURE__*/createContext(null);
|
43
49
|
const Item = /*#__PURE__*/forwardRef(({
|
44
50
|
children,
|
45
51
|
...props
|
@@ -81,6 +87,7 @@ const updateTopBanner = (content = [], setTopBanner) => {
|
|
81
87
|
return firstNode?.type === "topbanner" ? firstNode : null;
|
82
88
|
});
|
83
89
|
};
|
90
|
+
const dummyTranslation = () => {};
|
84
91
|
const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
85
92
|
const {
|
86
93
|
id,
|
@@ -94,6 +101,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
94
101
|
otherProps,
|
95
102
|
isIframe,
|
96
103
|
theme,
|
104
|
+
showThemeButtons,
|
97
105
|
showViewport = false,
|
98
106
|
overrideWrapperStyles = {},
|
99
107
|
translation
|
@@ -101,7 +109,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
101
109
|
const editorWrapper = useRef();
|
102
110
|
const mentionsRef = useRef();
|
103
111
|
const convertedContent = draftToSlate({
|
104
|
-
data: content
|
112
|
+
data: content,
|
113
|
+
needLayout: otherProps?.needLayout
|
105
114
|
});
|
106
115
|
const [value, setValue] = useState(convertedContent);
|
107
116
|
const [isInteracted, setIsInteracted] = useState(false);
|
@@ -129,7 +138,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
129
138
|
hideTools = [],
|
130
139
|
translationMock
|
131
140
|
} = otherProps || {};
|
132
|
-
const translationFn = translation || translationMock;
|
141
|
+
const translationFn = translation || translationMock || dummyTranslation;
|
133
142
|
const editor = useMemo(() => {
|
134
143
|
if (collaborativeEditor) return collaborativeEditor;
|
135
144
|
const editor = createEditor();
|
@@ -145,10 +154,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
145
154
|
const {
|
146
155
|
bannerSpacing,
|
147
156
|
pageBgImage,
|
148
|
-
pageColor,
|
157
|
+
pageColor = "",
|
149
158
|
color: pageTextColor,
|
150
159
|
pageWidth,
|
151
160
|
maxWidth: pageMaxWidth,
|
161
|
+
theme: selectedTheme,
|
152
162
|
lineHeight
|
153
163
|
} = pageSt?.pageProps || {
|
154
164
|
bannerSpacing: {
|
@@ -160,10 +170,17 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
160
170
|
};
|
161
171
|
const classes = editorStyles({
|
162
172
|
padHeight: !fullScreen ? otherProps?.padHeight : 20,
|
163
|
-
placeHolderColor: invertColor(pageColor || "#FFF"),
|
173
|
+
placeHolderColor: invertColor(pageColor.startsWith("var") ? getVariableValue(pageColor) : pageColor || "#FFF"),
|
164
174
|
theme,
|
165
175
|
overrideWrapperStyles
|
166
176
|
});
|
177
|
+
const [openTheme, setOpenTheme] = useState(false);
|
178
|
+
const [openAITheme, setOpenAITheme] = useState(false);
|
179
|
+
const [, setThemeUpdated] = useState(0);
|
180
|
+
const triggerRender = () => {
|
181
|
+
setThemeUpdated(prev => prev + 1); // Incrementing forces a re-render while updating theme
|
182
|
+
};
|
183
|
+
|
167
184
|
const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
|
168
185
|
useEffect(() => {
|
169
186
|
setValue(draftToSlate({
|
@@ -177,11 +194,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
177
194
|
const debounced = useDebouncedCallback(
|
178
195
|
// function
|
179
196
|
value => {
|
197
|
+
debouncedValue.current = value;
|
180
198
|
const {
|
181
199
|
value: strVal,
|
182
200
|
...restVal
|
183
201
|
} = getOnSaveData(value);
|
184
|
-
debouncedValue.current = value;
|
185
202
|
onSave(strVal, restVal);
|
186
203
|
},
|
187
204
|
// delay in ms
|
@@ -192,7 +209,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
192
209
|
return {
|
193
210
|
value: JSON.stringify(val),
|
194
211
|
text: text,
|
195
|
-
title: serializeToText(title?.children) || "
|
212
|
+
title: serializeToText(title?.children) || ""
|
196
213
|
};
|
197
214
|
};
|
198
215
|
const getTitleSaveData = title => {
|
@@ -224,7 +241,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
224
241
|
|
225
242
|
const onSwitchBreakpoint = b => {
|
226
243
|
setBreakpoint(b);
|
227
|
-
|
244
|
+
setTimeout(() => {
|
245
|
+
reRenderAllNodes();
|
246
|
+
}, 0);
|
228
247
|
};
|
229
248
|
useImperativeHandle(ref, () => ({
|
230
249
|
async getThumbnail(needBackground = false, options = {}) {
|
@@ -279,7 +298,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
279
298
|
},
|
280
299
|
toggleFullscreen() {
|
281
300
|
setFullScreen(!fullScreen);
|
282
|
-
Transforms.deselect(editor);
|
283
301
|
},
|
284
302
|
toggleToolbarShow() {
|
285
303
|
setToolbarShow(!toolbarShow);
|
@@ -303,6 +321,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
303
321
|
redo() {
|
304
322
|
editor?.redo();
|
305
323
|
},
|
324
|
+
toggleTheme() {
|
325
|
+
setOpenTheme(!openTheme);
|
326
|
+
},
|
327
|
+
toggleAITheme() {
|
328
|
+
setOpenAITheme(!openAITheme);
|
329
|
+
},
|
306
330
|
getPageSettings: {
|
307
331
|
background: pageBgImage && pageBgImage !== "none" ? `url(${pageBgImage})` : pageColor || ""
|
308
332
|
}
|
@@ -345,6 +369,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
345
369
|
const onDrawerOpen = status => {
|
346
370
|
setIsDrawerOpen(status);
|
347
371
|
};
|
372
|
+
const lineH = getBreakpointLineSpacing(lineHeight, breakpoint || (isMobile ? "xs" : ""));
|
348
373
|
const isReadOnly = readOnly === "readonly";
|
349
374
|
const customProps = {
|
350
375
|
...(otherProps || {}),
|
@@ -357,9 +382,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
357
382
|
onDrawerOpen: onDrawerOpen,
|
358
383
|
ICON_API: "https://assets.agenciflow.com",
|
359
384
|
translation: translationFn,
|
360
|
-
getTitleSaveData
|
385
|
+
getTitleSaveData,
|
386
|
+
customLineHeight: lineH
|
361
387
|
};
|
362
|
-
const lineH = getBreakpointLineSpacing(lineHeight, breakpoint);
|
363
388
|
const renderElement = useCallback(props => {
|
364
389
|
return /*#__PURE__*/_jsx(Element, {
|
365
390
|
...props,
|
@@ -502,6 +527,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
502
527
|
}
|
503
528
|
return style;
|
504
529
|
}, [pageBgImage, pageColor, pageTextColor]);
|
530
|
+
const themeProps = getTheme(selectedTheme);
|
505
531
|
|
506
532
|
// const handleContextMenu = (e) => {
|
507
533
|
// if (!readOnly) {
|
@@ -532,14 +558,75 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
532
558
|
console.log("handleCursorScroll", err);
|
533
559
|
}
|
534
560
|
};
|
561
|
+
window.getTextIndeces = () => {
|
562
|
+
try {
|
563
|
+
const textWithPaths = extractTextWithPath(editor.children, []);
|
564
|
+
return textWithPaths;
|
565
|
+
} catch (err) {
|
566
|
+
console.log(err);
|
567
|
+
}
|
568
|
+
};
|
569
|
+
window.replaceTextIndeces = (path_data = []) => {
|
570
|
+
try {
|
571
|
+
const replacedJson = replaceTextPath(JSON.parse(JSON.stringify(editor.children)), path_data);
|
572
|
+
|
573
|
+
// loop delete all
|
574
|
+
editor.children.forEach(() => {
|
575
|
+
Transforms.delete(editor, {
|
576
|
+
at: [0]
|
577
|
+
});
|
578
|
+
});
|
579
|
+
|
580
|
+
// Insert new nodes
|
581
|
+
Transforms.insertNodes(editor, replacedJson, {
|
582
|
+
at: [0]
|
583
|
+
});
|
584
|
+
} catch (err) {
|
585
|
+
console.log(err);
|
586
|
+
}
|
587
|
+
};
|
588
|
+
window.replaceEditorContent = (fragments = []) => {
|
589
|
+
try {
|
590
|
+
// loop delete all
|
591
|
+
editor.children.forEach(() => {
|
592
|
+
Transforms.delete(editor, {
|
593
|
+
at: [0]
|
594
|
+
});
|
595
|
+
});
|
596
|
+
|
597
|
+
// Insert new nodes
|
598
|
+
Transforms.insertNodes(editor, fragments, {
|
599
|
+
at: [0]
|
600
|
+
});
|
601
|
+
} catch (err) {
|
602
|
+
console.log(err);
|
603
|
+
}
|
604
|
+
};
|
535
605
|
return /*#__PURE__*/_jsxs(EditorProvider, {
|
536
606
|
theme: theme,
|
537
607
|
editor: editor,
|
538
|
-
|
608
|
+
openTheme: openTheme,
|
609
|
+
setOpenTheme: setOpenTheme,
|
610
|
+
triggerRender: triggerRender,
|
611
|
+
children: [showThemeButtons ? /*#__PURE__*/_jsxs("div", {
|
612
|
+
className: "theme-buttons",
|
613
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
614
|
+
onClick: () => setOpenTheme(true),
|
615
|
+
className: "themePaintIcon",
|
616
|
+
children: /*#__PURE__*/_jsx(ThemePaintIcon, {})
|
617
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
618
|
+
onClick: () => setOpenAITheme(true),
|
619
|
+
style: {
|
620
|
+
marginTop: "4px"
|
621
|
+
},
|
622
|
+
children: /*#__PURE__*/_jsx(ThemeAIIcon, {})
|
623
|
+
})]
|
624
|
+
}) : null, /*#__PURE__*/_jsx(DialogWrapper, {
|
539
625
|
classes: classes,
|
540
626
|
...props,
|
541
627
|
fullScreen: fullScreen,
|
542
628
|
footer: footer || "",
|
629
|
+
selectedTheme: selectedTheme,
|
543
630
|
children: /*#__PURE__*/_jsxs(Box, {
|
544
631
|
component: "div",
|
545
632
|
className: `et-wrpr stimulate-${breakpoint} ${editorClass || ""} ${isIframe ? "iframe-editor" : ""}`,
|
@@ -574,6 +661,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
574
661
|
children: /*#__PURE__*/_jsxs(Box, {
|
575
662
|
component: "div",
|
576
663
|
className: "max-content",
|
664
|
+
sx: themeProps?.sxProps || {},
|
577
665
|
"data-info": outsideEditorClickLabel,
|
578
666
|
children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
|
579
667
|
className: "scroll-area",
|
@@ -618,8 +706,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
618
706
|
chars: chars,
|
619
707
|
type: type,
|
620
708
|
theme: theme,
|
621
|
-
|
622
|
-
|
709
|
+
customProps: customProps,
|
710
|
+
otherProps: customProps
|
623
711
|
}) : null, /*#__PURE__*/_jsx(RnDCopy, {
|
624
712
|
readOnly: readOnly
|
625
713
|
})]
|
@@ -642,6 +730,18 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
642
730
|
"data-info": outsideEditorClickLabel,
|
643
731
|
onClick: handleFooterClick,
|
644
732
|
children: footer
|
733
|
+
}), openTheme ? /*#__PURE__*/_jsx(ThemeSettings, {
|
734
|
+
open: openTheme,
|
735
|
+
setOpen: setOpenTheme,
|
736
|
+
editor: editor,
|
737
|
+
services: otherProps?.services,
|
738
|
+
appTheme: theme,
|
739
|
+
customProps: customProps
|
740
|
+
}) : null, /*#__PURE__*/_jsx(ThemeSettingsAI, {
|
741
|
+
openAITheme: openAITheme,
|
742
|
+
setOpenAITheme: setOpenAITheme,
|
743
|
+
onSaveTheme: otherProps?.onSaveTheme,
|
744
|
+
theme: theme
|
645
745
|
})]
|
646
746
|
})
|
647
747
|
}), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
|
@@ -650,8 +750,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
650
750
|
setIsTextSelected: setIsTextSelected,
|
651
751
|
customProps: customProps,
|
652
752
|
editorWrapper: editorWrapper
|
653
|
-
}) : null, !readOnly
|
753
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
654
754
|
breakpoint: breakpoint,
|
755
|
+
show: showViewport,
|
655
756
|
onChange: b => onSwitchBreakpoint(b),
|
656
757
|
translation: translation || translationMock
|
657
758
|
}) : null]
|
@@ -2,6 +2,7 @@ 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
4
|
import ViewportStimulator from "./common/RnD/Theme/ViewportStimulator";
|
5
|
+
import MainThemeProvider from "./common/RnD/Theme/MainThemeProvider";
|
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 => {
|
@@ -9,40 +10,45 @@ const DialogWrapper = props => {
|
|
9
10
|
fullScreen,
|
10
11
|
onClose,
|
11
12
|
children,
|
12
|
-
classes
|
13
|
+
classes,
|
14
|
+
selectedTheme
|
13
15
|
} = props;
|
14
|
-
return fullScreen ? /*#__PURE__*/
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
},
|
22
|
-
sx: classes.fullScreenWrapper,
|
23
|
-
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
16
|
+
return fullScreen ? /*#__PURE__*/_jsx(MainThemeProvider, {
|
17
|
+
userSelectedTheme: selectedTheme,
|
18
|
+
children: /*#__PURE__*/_jsxs(Dialog, {
|
19
|
+
className: `dialogComp`,
|
20
|
+
open: fullScreen,
|
21
|
+
fullScreen: fullScreen,
|
22
|
+
onClose: onClose,
|
24
23
|
style: {
|
25
|
-
|
24
|
+
zIndex: 1000
|
26
25
|
},
|
27
|
-
|
26
|
+
sx: classes.fullScreenWrapper,
|
27
|
+
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
28
|
+
style: {
|
29
|
+
padding: "6px 8px"
|
30
|
+
},
|
28
31
|
children: /*#__PURE__*/_jsx(Grid, {
|
29
|
-
|
30
|
-
display: "flex",
|
31
|
-
justifyContent: "end"
|
32
|
-
},
|
33
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
34
|
-
onClick: onClose,
|
32
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
35
33
|
style: {
|
36
|
-
|
34
|
+
display: "flex",
|
35
|
+
justifyContent: "end"
|
37
36
|
},
|
38
|
-
children: /*#__PURE__*/_jsx(
|
37
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
38
|
+
onClick: onClose,
|
39
|
+
style: {
|
40
|
+
background: "rgba(255,255,255,0.5)"
|
41
|
+
},
|
42
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
43
|
+
})
|
39
44
|
})
|
40
45
|
})
|
41
|
-
})
|
42
|
-
|
43
|
-
|
44
|
-
})
|
46
|
+
}), /*#__PURE__*/_jsx(DialogContent, {
|
47
|
+
children: children
|
48
|
+
})]
|
49
|
+
})
|
45
50
|
}) : /*#__PURE__*/_jsx(ViewportStimulator, {
|
51
|
+
selectedTheme: selectedTheme,
|
46
52
|
children: children
|
47
53
|
});
|
48
54
|
};
|
package/dist/Editor/Editor.css
CHANGED
@@ -1342,21 +1342,29 @@ code.markcode {
|
|
1342
1342
|
background-color: #f3f3f3;
|
1343
1343
|
font-family: 'Source Code Pro' !important;
|
1344
1344
|
}
|
1345
|
+
|
1345
1346
|
/* Hide the popper when the reference is hidden */
|
1346
1347
|
.hide-popper-on-overlap[data-popper-escaped],
|
1347
1348
|
.hide-popper-on-overlap[data-popper-reference-hidden] {
|
1348
1349
|
visibility: hidden;
|
1349
1350
|
pointer-events: none;
|
1350
1351
|
}
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1352
|
+
|
1353
|
+
.theme-buttons {
|
1354
|
+
display: flex;
|
1355
|
+
justify-content: end;
|
1356
|
+
align-items: center;
|
1357
|
+
margin: auto;
|
1358
|
+
position: absolute;
|
1359
|
+
top: 60px;
|
1360
|
+
right: 20px;
|
1361
|
+
z-index: 1000;
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
.themePaintIcon:hover .iconBorder {
|
1365
|
+
fill: #2563EB;
|
1358
1366
|
}
|
1359
1367
|
|
1360
1368
|
.hyperLink {
|
1361
1369
|
word-break: break-all;
|
1362
|
-
}
|
1370
|
+
}
|
@@ -167,6 +167,7 @@ function PopoverAIInput({
|
|
167
167
|
const [generatedText, setGeneratedText] = useState("");
|
168
168
|
const [inputValue, setInputValue] = useState("");
|
169
169
|
const [selectedOption, setSelectedOption] = useState();
|
170
|
+
const [threadId, setThreadId] = useState("");
|
170
171
|
const selectedEleRef = useRef({});
|
171
172
|
const classes = Styles();
|
172
173
|
const editor = useSlate();
|
@@ -188,6 +189,7 @@ function PopoverAIInput({
|
|
188
189
|
useEffect(() => {
|
189
190
|
if (openAI) {
|
190
191
|
scrollToAIInput(editor);
|
192
|
+
setThreadId("");
|
191
193
|
}
|
192
194
|
}, [openAI]);
|
193
195
|
useEffect(() => {
|
@@ -196,8 +198,12 @@ function PopoverAIInput({
|
|
196
198
|
const framePayload = (type, option) => {
|
197
199
|
let payload = {
|
198
200
|
mode: option.mode || 0,
|
199
|
-
query: option?.inputValue || inputValue
|
201
|
+
query: option?.inputValue || inputValue,
|
202
|
+
useSession: true
|
200
203
|
};
|
204
|
+
if (threadId) {
|
205
|
+
payload.threadId = threadId;
|
206
|
+
}
|
201
207
|
if (option.mode === MODES.translate || option.mode === MODES.rephraseTone) {
|
202
208
|
payload.textOptionInput = type;
|
203
209
|
}
|
@@ -257,12 +263,14 @@ function PopoverAIInput({
|
|
257
263
|
setLoading(false);
|
258
264
|
setInputValue("");
|
259
265
|
let {
|
260
|
-
|
261
|
-
|
266
|
+
body: text,
|
267
|
+
threadId
|
268
|
+
} = result?.data || {};
|
262
269
|
if (!text) {
|
263
270
|
onClickOutside();
|
264
271
|
return;
|
265
272
|
}
|
273
|
+
setThreadId(threadId || "");
|
266
274
|
|
267
275
|
// if (!option.replace) {
|
268
276
|
if (type === "continue_writing") {
|
@@ -265,7 +265,7 @@ function AppHeader(props) {
|
|
265
265
|
style: {
|
266
266
|
display: "inline-flex",
|
267
267
|
alignItems: "center",
|
268
|
-
color: textColor,
|
268
|
+
color: textColor || "#000000",
|
269
269
|
fontSize: logoFontSize,
|
270
270
|
fontFamily: titleFontFamily,
|
271
271
|
justifyContent: isLogoRight ? "end" : "start"
|
@@ -320,7 +320,7 @@ function AppHeader(props) {
|
|
320
320
|
fontFamily: fontFamily,
|
321
321
|
textTransform: "none",
|
322
322
|
fontSize: fontSize || "16px",
|
323
|
-
color: textColor || "#
|
323
|
+
color: textColor || "#000",
|
324
324
|
background: bgColor || "none",
|
325
325
|
"& .m-settings": {
|
326
326
|
display: "none",
|
@@ -335,7 +335,7 @@ function AppHeader(props) {
|
|
335
335
|
background: "#FFF"
|
336
336
|
},
|
337
337
|
"&:hover": {
|
338
|
-
color: textColorHover || textColor || "#
|
338
|
+
color: textColorHover || textColor || "#000",
|
339
339
|
background: bgColorHover || bgColor || "none",
|
340
340
|
"& .m-settings": {
|
341
341
|
display: "block"
|