@flozy/editor 3.6.6 → 3.6.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +166 -109
- package/dist/Editor/Elements/AppHeader/AppHeader.js +26 -4
- package/dist/Editor/Elements/Button/EditorButton.js +25 -14
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -17
- 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 +2 -1
- package/dist/Editor/Elements/Embed/Frames/ImageFrame.js +1 -0
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
- package/dist/Editor/Elements/Grid/Grid.js +2 -0
- 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 +11 -3
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
- package/dist/Editor/Elements/Table/TableCell.js +1 -1
- package/dist/Editor/MiniEditor.js +3 -1
- package/dist/Editor/Toolbar/Basic/index.js +4 -2
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +26 -2
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -11
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +20 -13
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +52 -7
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +4 -2
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
- package/dist/Editor/common/ColorPickerButton.js +25 -9
- 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 +1 -1
- package/dist/Editor/common/Icon.js +30 -2
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- 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/color.js +31 -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/helper/theme.js +190 -4
- package/dist/Editor/hooks/useEditorTheme.js +139 -0
- package/dist/Editor/hooks/useMouseMove.js +4 -1
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +47 -5
- 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 +157 -25
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +50 -12
- package/package.json +1 -1
@@ -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, 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
|
}
|
@@ -385,113 +403,152 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
385
403
|
}
|
386
404
|
return style;
|
387
405
|
}, [pageBgImage, pageColor]);
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
children: /*#__PURE__*/
|
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
|
-
|
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:
|
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(
|
446
|
-
className: "
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
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
|
-
}), !
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
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
|
-
}),
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
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();
|
@@ -148,10 +153,27 @@ function AppHeader(props) {
|
|
148
153
|
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(List, {
|
149
154
|
children: menus.map((item, i) => {
|
150
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
|
+
};
|
151
173
|
return /*#__PURE__*/_jsx(ListItem, {
|
152
174
|
disablePadding: true,
|
153
175
|
children: /*#__PURE__*/_jsx(ListItemButton, {
|
154
|
-
...
|
176
|
+
...props,
|
155
177
|
sx: {
|
156
178
|
textAlign: "center"
|
157
179
|
},
|
@@ -229,7 +251,7 @@ function AppHeader(props) {
|
|
229
251
|
style: {
|
230
252
|
display: "inline-flex",
|
231
253
|
alignItems: "center",
|
232
|
-
color: textColor,
|
254
|
+
color: textColor || "#000000",
|
233
255
|
fontSize: logoFontSize,
|
234
256
|
fontFamily: titleFontFamily,
|
235
257
|
justifyContent: isLogoRight ? "end" : "start"
|
@@ -277,7 +299,7 @@ function AppHeader(props) {
|
|
277
299
|
fontFamily: fontFamily,
|
278
300
|
textTransform: "none",
|
279
301
|
fontSize: fontSize || "16px",
|
280
|
-
color: textColor || "#
|
302
|
+
color: textColor || "#000",
|
281
303
|
background: bgColor || "none",
|
282
304
|
"& .m-settings": {
|
283
305
|
display: "none",
|
@@ -292,7 +314,7 @@ function AppHeader(props) {
|
|
292
314
|
background: "#FFF"
|
293
315
|
},
|
294
316
|
"&:hover": {
|
295
|
-
color: textColorHover || textColor || "#
|
317
|
+
color: textColorHover || textColor || "#000",
|
296
318
|
background: bgColorHover || bgColor || "none",
|
297
319
|
"& .m-settings": {
|
298
320
|
display: "block"
|
@@ -13,6 +13,9 @@ import { WorkflowIcon } from "../../common/iconslist";
|
|
13
13
|
import { getTRBLBreakPoints, getBreakPointsValue } from "../../helper/theme";
|
14
14
|
import { handleLinkType, windowVar } from "../../utils/helper";
|
15
15
|
import LinkSettings from "../../common/LinkSettings";
|
16
|
+
import { useEditorTheme } from "../../hooks/useEditorTheme";
|
17
|
+
import { getTheme } from "../../theme";
|
18
|
+
import { fontFamilyMap } from "../../utils/font";
|
16
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
17
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
18
21
|
const EditorButton = props => {
|
@@ -30,6 +33,12 @@ const EditorButton = props => {
|
|
30
33
|
const path = ReactEditor.findPath(editor, element);
|
31
34
|
const [edit, setEdit] = useState(false);
|
32
35
|
const [openNav, setOpenNav] = useState(false);
|
36
|
+
const {
|
37
|
+
theme
|
38
|
+
} = useEditorTheme();
|
39
|
+
const {
|
40
|
+
buttonTheme
|
41
|
+
} = getTheme(theme);
|
33
42
|
const {
|
34
43
|
label,
|
35
44
|
bgColor,
|
@@ -43,7 +52,7 @@ const EditorButton = props => {
|
|
43
52
|
fontFamily,
|
44
53
|
textColorHover,
|
45
54
|
bgColorHover,
|
46
|
-
buttonIcon,
|
55
|
+
// buttonIcon,
|
47
56
|
iconPosition = "start",
|
48
57
|
borderStyle,
|
49
58
|
borderWidth,
|
@@ -64,6 +73,7 @@ const EditorButton = props => {
|
|
64
73
|
};
|
65
74
|
const isTrigger = linkType === "actionTrigger";
|
66
75
|
const refURl = isTrigger ? buttonLink?.url : url;
|
76
|
+
const buttonIcon = element?.buttonIcon || buttonTheme?.buttonIcon;
|
67
77
|
const BtnIcon = buttonIcon ? buttonIcon : null;
|
68
78
|
windowVar.lastButtonProps = element;
|
69
79
|
const handleTrigger = async () => {
|
@@ -186,20 +196,9 @@ const EditorButton = props => {
|
|
186
196
|
children: [/*#__PURE__*/_jsxs(Box, {
|
187
197
|
sx: {
|
188
198
|
textDecoration: "none",
|
189
|
-
background: bgColor || "rgb(30, 75, 122)",
|
190
199
|
borderBlockStyle: "solid",
|
191
|
-
borderColor: borderColor || "transparent",
|
192
200
|
borderWidth: borderWidth !== undefined ? borderWidth : borderColor ? "1px" : "0px",
|
193
|
-
borderRadius: {
|
194
|
-
...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
|
195
|
-
},
|
196
201
|
borderStyle: borderStyle || "solid",
|
197
|
-
padding: {
|
198
|
-
...getTRBLBreakPoints(bannerSpacing)
|
199
|
-
},
|
200
|
-
color: `${textColor || "#FFFFFF"}`,
|
201
|
-
fontSize: textSize || "inherit",
|
202
|
-
fontFamily: fontFamily || "PoppinsRegular",
|
203
202
|
display: "inline-flex",
|
204
203
|
alignItems: "center",
|
205
204
|
position: "relative",
|
@@ -207,14 +206,26 @@ const EditorButton = props => {
|
|
207
206
|
display: "none"
|
208
207
|
},
|
209
208
|
"&:hover": {
|
210
|
-
color: `${textColorHover || textColor
|
211
|
-
background: bgColorHover || bgColor
|
209
|
+
color: `${textColorHover || textColor}`,
|
210
|
+
background: bgColorHover || bgColor,
|
212
211
|
"& .element-toolbar": {
|
213
212
|
display: "flex"
|
214
213
|
}
|
214
|
+
},
|
215
|
+
color: `${textColor} !important`,
|
216
|
+
fontSize: `${textSize}px !important`,
|
217
|
+
fontFamily: `${fontFamilyMap[fontFamily] || ""} !important`,
|
218
|
+
background: `${bgColor} !important`,
|
219
|
+
borderColor: `${borderColor} !important`,
|
220
|
+
borderRadius: {
|
221
|
+
...getBreakPointsValue(borderRadius || buttonTheme?.borderRadius || {}, null, "overrideBorderRadius", true)
|
222
|
+
},
|
223
|
+
padding: {
|
224
|
+
...getTRBLBreakPoints(bannerSpacing || buttonTheme?.bannerSpacing || {})
|
215
225
|
}
|
216
226
|
},
|
217
227
|
...buttonProps,
|
228
|
+
className: "button theme-element",
|
218
229
|
children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(MUIIcon, {
|
219
230
|
iconName: buttonIcon,
|
220
231
|
style: {
|
@@ -1,11 +1,15 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Box, IconButton, Popover } from "@mui/material";
|
1
|
+
import React, { useContext, useState } from "react";
|
2
|
+
import { Box, IconButton, Popover, Typography, useTheme } from "@mui/material";
|
3
3
|
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
4
4
|
import Button from "../../common/Button";
|
5
5
|
import { colors } from "./defaultColors";
|
6
6
|
import ColorPicker from "./colorPicker.svg";
|
7
|
+
import { ThemeContext } from "../../CommonEditor";
|
8
|
+
import { useSlateStatic } from "slate-react";
|
9
|
+
import { Transforms } from "slate";
|
7
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
13
|
let c = [];
|
10
14
|
const ColorChunks = (recentColors = []) => [...recentColors, ...colors].reduce((a, b, i) => {
|
11
15
|
if (i % 7 === 0) {
|
@@ -31,9 +35,7 @@ const SingleColorButton = ({
|
|
31
35
|
style: {
|
32
36
|
width: "100%",
|
33
37
|
display: "flex",
|
34
|
-
|
35
|
-
padding: padding || "8px",
|
36
|
-
justifyContent: "center"
|
38
|
+
padding: padding || "8px"
|
37
39
|
},
|
38
40
|
children: [crs.map(m => /*#__PURE__*/_jsx(Button, {
|
39
41
|
onClick: handleSelect(m),
|
@@ -109,11 +111,17 @@ const ColorButtons = props => {
|
|
109
111
|
forMiniTool,
|
110
112
|
openColorTool,
|
111
113
|
onClose,
|
112
|
-
onColorPickerClick
|
114
|
+
onColorPickerClick,
|
115
|
+
disableEditTheme
|
113
116
|
} = props;
|
114
117
|
const [row1, ...restRows] = ColorChunks([]);
|
115
118
|
const [anchorEl, setAnchorEl] = useState(null);
|
116
119
|
const open = Boolean(anchorEl);
|
120
|
+
const theme = useTheme();
|
121
|
+
const editor = useSlateStatic();
|
122
|
+
const {
|
123
|
+
setOpenTheme
|
124
|
+
} = useContext(ThemeContext);
|
117
125
|
const handleMore = e => {
|
118
126
|
setAnchorEl(e.currentTarget);
|
119
127
|
};
|
@@ -126,6 +134,7 @@ const ColorButtons = props => {
|
|
126
134
|
const handleSelect = color => () => {
|
127
135
|
onSelect(color);
|
128
136
|
};
|
137
|
+
const colorVars = theme?.vars?.colors || {};
|
129
138
|
return /*#__PURE__*/_jsxs(Box, {
|
130
139
|
component: "span",
|
131
140
|
sx: classes.colorButtons,
|
@@ -142,7 +151,7 @@ const ColorButtons = props => {
|
|
142
151
|
activeColor: activeColor
|
143
152
|
}, `si_btn_row1_${m}_${i}`);
|
144
153
|
})
|
145
|
-
}), /*#__PURE__*/
|
154
|
+
}), /*#__PURE__*/_jsx(Popover, {
|
146
155
|
open: open || openColorTool,
|
147
156
|
anchorEl: anchorEl || openColorTool,
|
148
157
|
onClose: handleClose,
|
@@ -156,9 +165,39 @@ const ColorButtons = props => {
|
|
156
165
|
},
|
157
166
|
sx: classes.colorPopper,
|
158
167
|
className: "colorPopper",
|
159
|
-
children:
|
168
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
160
169
|
sx: classes.colorButtonsInner,
|
161
|
-
children:
|
170
|
+
children: [Object.values(colorVars)?.length ? /*#__PURE__*/_jsxs(_Fragment, {
|
171
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
172
|
+
component: "div",
|
173
|
+
className: "singleColorTitleWrapper",
|
174
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
175
|
+
variant: "subtitle2",
|
176
|
+
children: "Theme colour"
|
177
|
+
}), disableEditTheme ? null : /*#__PURE__*/_jsx("div", {
|
178
|
+
className: "editBtn",
|
179
|
+
onClick: () => {
|
180
|
+
Transforms.deselect(editor, {
|
181
|
+
at: editor.selection
|
182
|
+
});
|
183
|
+
setOpenTheme("editThemeColor");
|
184
|
+
},
|
185
|
+
children: "Edit"
|
186
|
+
})]
|
187
|
+
}), /*#__PURE__*/_jsx(SingleColorButton, {
|
188
|
+
crs: Object.values(colorVars),
|
189
|
+
handleSelect: handleSelect,
|
190
|
+
classes: classes,
|
191
|
+
activeColor: activeColor
|
192
|
+
})]
|
193
|
+
}) : null, /*#__PURE__*/_jsx(Box, {
|
194
|
+
component: "div",
|
195
|
+
className: "singleColorTitleWrapper",
|
196
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
197
|
+
variant: "subtitle2",
|
198
|
+
children: "Custom colour"
|
199
|
+
})
|
200
|
+
}), restRows.map((m, i) => {
|
162
201
|
return /*#__PURE__*/_jsx(SingleColorButton, {
|
163
202
|
id: `p2_${id}`,
|
164
203
|
crs: m,
|
@@ -167,14 +206,18 @@ const ColorButtons = props => {
|
|
167
206
|
classes: classes,
|
168
207
|
activeColor: activeColor
|
169
208
|
}, `si_btn_${m}_${i}`);
|
170
|
-
})
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
209
|
+
}), forMiniTool ? /*#__PURE__*/_jsx(IconButton, {
|
210
|
+
onClick: onColorPickerClick,
|
211
|
+
style: {
|
212
|
+
alignSelf: "start",
|
213
|
+
margin: "6px"
|
214
|
+
},
|
215
|
+
children: /*#__PURE__*/_jsx("img", {
|
216
|
+
src: ColorPicker,
|
217
|
+
alt: "color wheel"
|
218
|
+
})
|
219
|
+
}) : null]
|
220
|
+
})
|
178
221
|
})]
|
179
222
|
});
|
180
223
|
};
|
@@ -60,4 +60,28 @@
|
|
60
60
|
padding: 0 15px !important;
|
61
61
|
width: 60px !important;
|
62
62
|
flex-shrink: 0;
|
63
|
-
}
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
.singleColorTitleWrapper {
|
67
|
+
display: flex;
|
68
|
+
justify-content: space-between;
|
69
|
+
align-items: center;
|
70
|
+
padding: 10px;
|
71
|
+
width: 100%;
|
72
|
+
border-bottom: 1px solid #DCE4EC;
|
73
|
+
}
|
74
|
+
|
75
|
+
.singleColorTitleWrapper .MuiTypography-root {
|
76
|
+
font-weight: 600;
|
77
|
+
}
|
78
|
+
|
79
|
+
.singleColorTitleWrapper .editBtn {
|
80
|
+
text-transform: none;
|
81
|
+
color: #2563EB;
|
82
|
+
text-decoration: underline;
|
83
|
+
padding: 0px;
|
84
|
+
min-width: unset;
|
85
|
+
cursor: pointer;
|
86
|
+
font-size: 14px;
|
87
|
+
}
|