@flozy/editor 11.2.1 → 11.2.2
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 +7 -7
- package/dist/Editor/CommonEditor.js +24 -86
- package/dist/Editor/DialogWrapper.js +25 -31
- package/dist/Editor/Editor.css +4 -37
- package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Attachments/Attachments.js +11 -154
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +3 -8
- package/dist/Editor/Elements/Button/EditorButton.js +7 -22
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -61
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
- package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +55 -134
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +8 -7
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +3 -8
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +1 -1
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +1 -1
- package/dist/Editor/Elements/Embed/Embed.js +43 -37
- package/dist/Editor/Elements/Embed/Image.js +22 -242
- package/dist/Editor/Elements/Embed/Video.js +32 -277
- package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +6 -9
- package/dist/Editor/Elements/EmbedScript/styles.js +1 -17
- package/dist/Editor/Elements/Form/FormField.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -25
- package/dist/Editor/Elements/Form/Workflow/constant.js +1 -25
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +76 -37
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +5 -9
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -3
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -15
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -2
- package/dist/Editor/Elements/Table/Table.js +1 -2
- package/dist/Editor/Elements/Table/TableCell.js +3 -10
- package/dist/Editor/Elements/Title/title.js +5 -4
- package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -4
- package/dist/Editor/Elements/TopBanner/TopBannerButton.js +3 -5
- package/dist/Editor/Styles/EditorStyles.js +5 -19
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +29 -33
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +1 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +23 -25
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +5 -15
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +7 -65
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +12 -66
- package/dist/Editor/Toolbar/PopupTool/index.js +4 -6
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
- package/dist/Editor/common/ColorPickerButton.js +19 -38
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +0 -1
- package/dist/Editor/common/Icon.js +0 -28
- package/dist/Editor/common/ImageSelector/ImageSelector.js +7 -45
- package/dist/Editor/common/ImageSelector/Options/Upload.js +11 -26
- package/dist/Editor/common/ImageSelector/Styles.js +9 -3
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +7 -20
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +0 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +7 -20
- package/dist/Editor/common/RnD/GuideLines/styles.js +1 -1
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +11 -28
- package/dist/Editor/common/RnD/Utils/index.js +1 -3
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +63 -52
- package/dist/Editor/common/RnD/VirtualElement/helper.js +68 -248
- package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -22
- package/dist/Editor/common/RnD/index.js +14 -61
- package/dist/Editor/common/Shorthands/elements.js +3 -55
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -4
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +0 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +0 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
- package/dist/Editor/common/StyleBuilder/formStyle.js +13 -19
- package/dist/Editor/common/StyleBuilder/index.js +4 -8
- package/dist/Editor/common/Uploader.js +17 -118
- package/dist/Editor/common/iconslist.js +0 -21
- package/dist/Editor/commonStyle.js +53 -111
- package/dist/Editor/helper/index.js +1 -4
- package/dist/Editor/helper/theme.js +2 -203
- package/dist/Editor/hooks/useMouseMove.js +3 -12
- package/dist/Editor/hooks/useTable.js +1 -62
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +3 -56
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/service/fileupload.js +0 -70
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +40 -165
- package/dist/Editor/utils/accordion.js +1 -1
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/formfield.js +2 -2
- package/dist/Editor/utils/helper.js +3 -101
- package/dist/Editor/utils/insertAppHeader.js +4 -8
- package/package.json +1 -1
- package/dist/Editor/Elements/Attachments/AttachmentStyles.js +0 -16
- package/dist/Editor/Elements/FreeGrid/helper.js +0 -194
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -439
- package/dist/Editor/assets/svg/BackIcon.js +0 -18
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -293
- package/dist/Editor/common/CustomColorPicker/index.js +0 -130
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog2/index.js +0 -94
- package/dist/Editor/common/CustomDialog2/style.js +0 -67
- package/dist/Editor/common/CustomSelect.js +0 -43
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
- package/dist/Editor/common/UploaderWithProgress.js +0 -183
- package/dist/Editor/hooks/useEditorTheme.js +0 -153
- package/dist/Editor/hooks/useThemeValues.js +0 -63
- package/dist/Editor/theme/index.js +0 -149
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -82
- package/dist/Editor/themeSettings/buttons/index.js +0 -300
- package/dist/Editor/themeSettings/buttons/style.js +0 -23
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
- package/dist/Editor/themeSettings/fonts/index.js +0 -240
- package/dist/Editor/themeSettings/fonts/style.js +0 -62
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -380
- package/dist/Editor/themeSettings/style.js +0 -299
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -355
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -202
- package/dist/Editor/themeSettingsAI/style.js +0 -332
@@ -1,36 +1,27 @@
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
2
2
|
import { TextField, IconButton } from "@mui/material";
|
3
|
-
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
|
4
|
-
import {
|
3
|
+
import { addMarkData, activeMark, isBlockActive } from "../../utils/SlateUtilityFunctions.js";
|
4
|
+
import { headingMap, sizeMap } from "../../utils/font.js";
|
5
|
+
import { getBreakPointsValue } from "../../helper/theme.js";
|
5
6
|
import useWindowResize from "../../hooks/useWindowResize.js";
|
6
7
|
import { BREAKPOINTS_DEVICES } from "../../helper/theme.js";
|
7
8
|
import { TextSizeDownArrow, TextSizeUpArrow } from "../../common/iconListV2.js";
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
11
|
-
const TextSize =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
fromMiniTextFormat,
|
18
|
-
setResizedSize,
|
19
|
-
resizedSize
|
20
|
-
} = props;
|
21
|
-
const [fontSize, setFontSize] = useState();
|
22
|
-
const sizeValue = fromMiniTextFormat ? resizedSize : fontSize;
|
23
|
-
const setSizeValue = fromMiniTextFormat ? setResizedSize : setFontSize;
|
24
|
-
const timerRef = useRef();
|
12
|
+
const TextSize = ({
|
13
|
+
classes,
|
14
|
+
editor,
|
15
|
+
format,
|
16
|
+
fullWidth
|
17
|
+
}) => {
|
25
18
|
const [size] = useWindowResize();
|
26
19
|
const val = activeMark(editor, format);
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
const value = getTextSizeVal(editor);
|
20
|
+
const value = getBreakPointsValue(val, size?.device);
|
21
|
+
const [fontSize, setFontSize] = useState();
|
22
|
+
const timerRef = useRef();
|
32
23
|
useEffect(() => {
|
33
|
-
|
24
|
+
setFontSize(getSizeVal());
|
34
25
|
}, [value]);
|
35
26
|
const updateMarkData = newVal => {
|
36
27
|
let upData = {
|
@@ -57,33 +48,38 @@ const TextSize = props => {
|
|
57
48
|
if (value) {
|
58
49
|
let inc = parseInt(value);
|
59
50
|
inc = inc > 200 ? 200 : inc;
|
60
|
-
setSizeValue(inc);
|
61
51
|
updateMarkData(inc);
|
62
52
|
} else {
|
63
|
-
|
53
|
+
setFontSize(null);
|
64
54
|
}
|
65
55
|
};
|
66
56
|
const getSizeVal = () => {
|
67
57
|
try {
|
68
|
-
|
58
|
+
let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
|
59
|
+
Object.entries(headingMap).forEach(([format, value]) => {
|
60
|
+
if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
|
61
|
+
size = value;
|
62
|
+
}
|
63
|
+
});
|
64
|
+
return parseInt(size);
|
69
65
|
} catch (err) {
|
70
66
|
return "";
|
71
67
|
}
|
72
68
|
};
|
69
|
+
const combinedOldVal = getSizeVal();
|
73
70
|
const onIncreaseSize = () => {
|
74
|
-
|
75
|
-
|
76
|
-
updateMarkData(
|
71
|
+
let inc = (combinedOldVal || 0) + 1;
|
72
|
+
inc = inc > 200 ? 200 : inc;
|
73
|
+
updateMarkData(inc);
|
77
74
|
};
|
78
75
|
const onDecreaseSize = () => {
|
79
|
-
const
|
80
|
-
|
81
|
-
updateMarkData(newValue);
|
76
|
+
const newVal = combinedOldVal - 1 < 0 ? 0 : combinedOldVal - 1;
|
77
|
+
updateMarkData(newVal);
|
82
78
|
};
|
83
79
|
const onChange = e => {
|
84
80
|
clearTimeout(timerRef.current);
|
85
81
|
const value = e.target.value;
|
86
|
-
|
82
|
+
setFontSize(value);
|
87
83
|
timerRef.current = setTimeout(() => {
|
88
84
|
onChangeSize(value);
|
89
85
|
}, 500);
|
@@ -91,7 +87,7 @@ const TextSize = props => {
|
|
91
87
|
return /*#__PURE__*/_jsx(_Fragment, {
|
92
88
|
children: /*#__PURE__*/_jsx(TextField, {
|
93
89
|
sx: classes?.textSize,
|
94
|
-
value:
|
90
|
+
value: fontSize,
|
95
91
|
onChange: onChange,
|
96
92
|
size: "small",
|
97
93
|
inputProps: {
|
@@ -12,7 +12,6 @@ function MiniColorPicker(props) {
|
|
12
12
|
classes,
|
13
13
|
id,
|
14
14
|
editor,
|
15
|
-
type,
|
16
15
|
customProps
|
17
16
|
} = props;
|
18
17
|
const [openColorTool, setOpenColorTool] = useState(null);
|
@@ -39,8 +38,7 @@ function MiniColorPicker(props) {
|
|
39
38
|
classes: classes,
|
40
39
|
forMiniTool: true,
|
41
40
|
openColorTool: openColorTool,
|
42
|
-
closeColorTool: () => setOpenColorTool(null)
|
43
|
-
type: type
|
41
|
+
closeColorTool: () => setOpenColorTool(null)
|
44
42
|
}, id)]
|
45
43
|
});
|
46
44
|
}
|
@@ -1,30 +1,25 @@
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
2
|
-
import { activeMark, addMarkData } from "../../../utils/SlateUtilityFunctions";
|
2
|
+
import { activeMark, addMarkData, isBlockActive } from "../../../utils/SlateUtilityFunctions";
|
3
3
|
import { Button, IconButton, Popover, TextField } from "@mui/material";
|
4
4
|
import DownArrowIcon from "../../../assets/svg/DownArrowIcon";
|
5
5
|
import useWindowResize from "../../../hooks/useWindowResize";
|
6
|
-
import { BREAKPOINTS_DEVICES, getBreakPointsValue
|
6
|
+
import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme";
|
7
|
+
import { headingMap, sizeMap } from "../../../utils/font";
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
10
|
const fontSizeOptions = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
|
10
|
-
function SelectFontSize(
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
fromMiniTextFormat,
|
15
|
-
setResizedSize,
|
16
|
-
resizedSize
|
17
|
-
} = props;
|
11
|
+
function SelectFontSize({
|
12
|
+
editor,
|
13
|
+
classes
|
14
|
+
}) {
|
18
15
|
const format = "fontSize";
|
19
16
|
const [fontSize, setFontSize] = useState();
|
20
|
-
const sizeValue = fromMiniTextFormat ? resizedSize : fontSize;
|
21
|
-
const setSizeValue = fromMiniTextFormat ? setResizedSize : setFontSize;
|
22
17
|
const [anchorEl, setAnchorEl] = useState(null);
|
23
18
|
const open = Boolean(anchorEl);
|
24
19
|
const containerRef = useRef();
|
25
20
|
const [size] = useWindowResize();
|
26
21
|
const val = activeMark(editor, format);
|
27
|
-
const value =
|
22
|
+
const value = getBreakPointsValue(val, size?.device);
|
28
23
|
const timerRef = useRef();
|
29
24
|
const updateMarkData = newVal => {
|
30
25
|
let upData = {
|
@@ -51,28 +46,31 @@ function SelectFontSize(props) {
|
|
51
46
|
if (value) {
|
52
47
|
let inc = parseInt(value);
|
53
48
|
inc = inc > 200 ? 200 : inc;
|
54
|
-
setSizeValue(inc);
|
55
49
|
updateMarkData(inc);
|
56
50
|
} else {
|
57
|
-
|
51
|
+
setFontSize(null);
|
58
52
|
}
|
59
53
|
};
|
60
54
|
const getSizeVal = () => {
|
61
55
|
try {
|
62
|
-
|
56
|
+
let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
|
57
|
+
Object.entries(headingMap).forEach(([format, value]) => {
|
58
|
+
if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
|
59
|
+
size = value;
|
60
|
+
}
|
61
|
+
});
|
62
|
+
return isNaN(parseInt(size)) ? 14 : parseInt(size);
|
63
63
|
} catch (err) {
|
64
64
|
return "";
|
65
65
|
}
|
66
66
|
};
|
67
67
|
useEffect(() => {
|
68
|
-
|
69
|
-
setSizeValue(getSizeVal());
|
70
|
-
}
|
68
|
+
setFontSize(getSizeVal());
|
71
69
|
}, [value]);
|
72
70
|
const onChange = e => {
|
73
71
|
clearTimeout(timerRef.current);
|
74
72
|
const value = e.target.value;
|
75
|
-
|
73
|
+
setFontSize(value);
|
76
74
|
timerRef.current = setTimeout(() => {
|
77
75
|
onChangeSize(value);
|
78
76
|
}, 500);
|
@@ -85,7 +83,7 @@ function SelectFontSize(props) {
|
|
85
83
|
},
|
86
84
|
children: [/*#__PURE__*/_jsx(TextField, {
|
87
85
|
sx: classes?.miniFontSizeInput,
|
88
|
-
value:
|
86
|
+
value: fontSize,
|
89
87
|
onChange: onChange,
|
90
88
|
size: "small"
|
91
89
|
}), /*#__PURE__*/_jsx(IconButton, {
|
@@ -99,16 +97,16 @@ function SelectFontSize(props) {
|
|
99
97
|
anchorEl: anchorEl,
|
100
98
|
onClose: () => setAnchorEl(null),
|
101
99
|
anchorOrigin: {
|
102
|
-
vertical:
|
103
|
-
horizontal:
|
100
|
+
vertical: 'bottom',
|
101
|
+
horizontal: 'left'
|
104
102
|
},
|
105
103
|
sx: classes.customSelectPopoverWrapper,
|
106
104
|
children: fontSizeOptions.map((s, i) => {
|
107
105
|
return /*#__PURE__*/_jsx("div", {
|
108
106
|
children: /*#__PURE__*/_jsx(Button, {
|
109
|
-
className: `customSelectOptionLabel ${
|
107
|
+
className: `customSelectOptionLabel ${fontSize === s ? "selected" : ""}`,
|
110
108
|
onClick: () => {
|
111
|
-
|
109
|
+
setFontSize(s);
|
112
110
|
onChangeSize(s);
|
113
111
|
},
|
114
112
|
children: s
|
@@ -2,11 +2,8 @@ import { useMemo } from "react";
|
|
2
2
|
import { activeMark, addMarkData, isBlockActive, toggleBlock } from "../../../utils/SlateUtilityFunctions";
|
3
3
|
import CustomSelectTool from "./CustomSelectTool";
|
4
4
|
import useWindowResize from "../../../hooks/useWindowResize";
|
5
|
-
import { BREAKPOINTS_DEVICES, getBreakPointsValue
|
5
|
+
import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme";
|
6
6
|
import { sizeMap } from "../../../utils/font";
|
7
|
-
import { Editor } from "slate";
|
8
|
-
import { useEditorTheme } from "../../../hooks/useEditorTheme";
|
9
|
-
import { MenuItem, Select } from "@mui/material";
|
10
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
11
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
9
|
function Label({
|
@@ -21,29 +18,26 @@ function Label({
|
|
21
18
|
});
|
22
19
|
}
|
23
20
|
function DisplayHeaderLabel({
|
24
|
-
type
|
25
|
-
isCustomized,
|
26
|
-
isPara = false
|
21
|
+
type
|
27
22
|
}) {
|
28
23
|
return /*#__PURE__*/_jsxs("div", {
|
29
|
-
children: [
|
24
|
+
children: ["H", /*#__PURE__*/_jsx("sub", {
|
30
25
|
children: type
|
31
26
|
})]
|
32
27
|
});
|
33
28
|
}
|
34
|
-
function getTypographyOptions(
|
35
|
-
|
29
|
+
function getTypographyOptions(translation) {
|
30
|
+
return [{
|
36
31
|
id: 11,
|
37
32
|
format: "headingOne",
|
38
33
|
type: "block",
|
39
34
|
title: /*#__PURE__*/_jsx(Label, {
|
40
35
|
label: "H1",
|
41
|
-
type: "
|
36
|
+
type: "Header",
|
42
37
|
translation: translation
|
43
38
|
}),
|
44
39
|
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
45
|
-
type: 1
|
46
|
-
isCustomized: isCustomized
|
40
|
+
type: 1
|
47
41
|
}),
|
48
42
|
group: "typography",
|
49
43
|
value: "headingOne"
|
@@ -53,12 +47,11 @@ function getTypographyOptions(isCustomized, translation) {
|
|
53
47
|
type: "block",
|
54
48
|
title: /*#__PURE__*/_jsx(Label, {
|
55
49
|
label: "H2",
|
56
|
-
type: "
|
50
|
+
type: "Header",
|
57
51
|
translation: translation
|
58
52
|
}),
|
59
53
|
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
60
|
-
type: 2
|
61
|
-
isCustomized: isCustomized
|
54
|
+
type: 2
|
62
55
|
}),
|
63
56
|
group: "typography",
|
64
57
|
value: "headingTwo"
|
@@ -68,156 +61,63 @@ function getTypographyOptions(isCustomized, translation) {
|
|
68
61
|
type: "block",
|
69
62
|
title: /*#__PURE__*/_jsx(Label, {
|
70
63
|
label: "H3",
|
71
|
-
type: "
|
64
|
+
type: "Header",
|
72
65
|
translation: translation
|
73
66
|
}),
|
74
67
|
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
75
|
-
type: 3
|
76
|
-
isCustomized: isCustomized
|
68
|
+
type: 3
|
77
69
|
}),
|
78
70
|
group: "typography",
|
79
71
|
value: "headingThree"
|
80
72
|
}, {
|
81
|
-
id:
|
82
|
-
format: "
|
83
|
-
type: "
|
73
|
+
id: 14,
|
74
|
+
format: "fontSize",
|
75
|
+
type: "mark",
|
84
76
|
title: /*#__PURE__*/_jsx(Label, {
|
85
|
-
label: "
|
86
|
-
type: "
|
77
|
+
label: "L",
|
78
|
+
type: "Large",
|
87
79
|
translation: translation
|
88
80
|
}),
|
89
|
-
label:
|
90
|
-
type: 4,
|
91
|
-
isCustomized: isCustomized
|
92
|
-
}),
|
81
|
+
label: "L",
|
93
82
|
group: "typography",
|
94
|
-
value: "
|
83
|
+
value: "huge"
|
95
84
|
}, {
|
96
|
-
id:
|
97
|
-
format: "
|
98
|
-
type: "
|
85
|
+
id: 15,
|
86
|
+
format: "fontSize",
|
87
|
+
type: "mark",
|
99
88
|
title: /*#__PURE__*/_jsx(Label, {
|
100
|
-
label: "
|
101
|
-
type: "
|
89
|
+
label: "M",
|
90
|
+
type: "Medium",
|
102
91
|
translation: translation
|
103
92
|
}),
|
104
|
-
label:
|
105
|
-
type: 5,
|
106
|
-
isCustomized: isCustomized
|
107
|
-
}),
|
93
|
+
label: "M",
|
108
94
|
group: "typography",
|
109
|
-
value: "
|
95
|
+
value: "medium"
|
110
96
|
}, {
|
111
|
-
id:
|
112
|
-
format: "
|
113
|
-
type: "
|
97
|
+
id: 16,
|
98
|
+
format: "fontSize",
|
99
|
+
type: "mark",
|
114
100
|
title: /*#__PURE__*/_jsx(Label, {
|
115
|
-
label: "
|
116
|
-
type: "
|
101
|
+
label: "S",
|
102
|
+
type: "Small",
|
117
103
|
translation: translation
|
118
104
|
}),
|
119
|
-
label:
|
120
|
-
type: 6,
|
121
|
-
isCustomized: isCustomized
|
122
|
-
}),
|
105
|
+
label: "S",
|
123
106
|
group: "typography",
|
124
|
-
value: "
|
125
|
-
}
|
126
|
-
id: 20,
|
127
|
-
format: "paragraphOne",
|
128
|
-
type: "block",
|
129
|
-
title: /*#__PURE__*/_jsx(Label, {
|
130
|
-
label: "P1",
|
131
|
-
type: "Paragraph",
|
132
|
-
translation: translation
|
133
|
-
}),
|
134
|
-
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
135
|
-
type: 1,
|
136
|
-
isCustomized: isCustomized,
|
137
|
-
isPara: true
|
138
|
-
}),
|
139
|
-
group: "typography",
|
140
|
-
value: "paragraphOne"
|
141
|
-
}, {
|
142
|
-
id: 21,
|
143
|
-
format: "paragraphTwo",
|
144
|
-
type: "block",
|
145
|
-
title: /*#__PURE__*/_jsx(Label, {
|
146
|
-
label: "P2",
|
147
|
-
type: "Paragraph",
|
148
|
-
translation: translation
|
149
|
-
}),
|
150
|
-
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
151
|
-
type: 2,
|
152
|
-
isCustomized: isCustomized,
|
153
|
-
isPara: true
|
154
|
-
}),
|
155
|
-
group: "typography",
|
156
|
-
value: "paragraphTwo"
|
157
|
-
}, {
|
158
|
-
id: 22,
|
159
|
-
format: "paragraphThree",
|
160
|
-
type: "block",
|
161
|
-
title: /*#__PURE__*/_jsx(Label, {
|
162
|
-
label: "P3",
|
163
|
-
type: "Paragraph",
|
164
|
-
translation: translation
|
165
|
-
}),
|
166
|
-
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
167
|
-
type: 3,
|
168
|
-
isCustomized: isCustomized,
|
169
|
-
isPara: true
|
170
|
-
}),
|
171
|
-
group: "typography",
|
172
|
-
value: "paragraphThree"
|
173
|
-
}
|
174
|
-
// {
|
175
|
-
// id: 14,
|
176
|
-
// format: "fontSize",
|
177
|
-
// type: "mark",
|
178
|
-
// title: <Label label="L" type="Large" />,
|
179
|
-
// label: "L",
|
180
|
-
// group: "typography",
|
181
|
-
// value: "huge",
|
182
|
-
// },
|
183
|
-
// {
|
184
|
-
// id: 15,
|
185
|
-
// format: "fontSize",
|
186
|
-
// type: "mark",
|
187
|
-
// title: <Label label="M" type="Medium" />,
|
188
|
-
// label: "M",
|
189
|
-
// group: "typography",
|
190
|
-
// value: "medium",
|
191
|
-
// },
|
192
|
-
// {
|
193
|
-
// id: 16,
|
194
|
-
// format: "fontSize",
|
195
|
-
// type: "mark",
|
196
|
-
// title: <Label label="S" type="Small" />,
|
197
|
-
// label: "S",
|
198
|
-
// group: "typography",
|
199
|
-
// value: "small",
|
200
|
-
// },
|
201
|
-
];
|
202
|
-
|
203
|
-
return typographyOptions;
|
107
|
+
value: "small"
|
108
|
+
}];
|
204
109
|
}
|
205
110
|
function SelectTypography({
|
206
111
|
editor,
|
207
112
|
classes,
|
208
113
|
closeMainPopup,
|
209
|
-
type,
|
210
114
|
customProps
|
211
115
|
}) {
|
212
116
|
const [size] = useWindowResize();
|
213
|
-
const {
|
214
|
-
theme
|
215
|
-
} = useEditorTheme();
|
216
117
|
const {
|
217
118
|
translation
|
218
119
|
} = customProps;
|
219
|
-
const
|
220
|
-
const typographyOptions = getTypographyOptions(isTextCustomized, translation);
|
120
|
+
const typographyOptions = getTypographyOptions(translation);
|
221
121
|
const updateMarkData = newVal => {
|
222
122
|
const val = activeMark(editor, "fontSize");
|
223
123
|
let upData = {
|
@@ -239,10 +139,7 @@ function SelectTypography({
|
|
239
139
|
...upData
|
240
140
|
}
|
241
141
|
});
|
242
|
-
|
243
|
-
// closeMainPopup();
|
244
142
|
};
|
245
|
-
|
246
143
|
const selectedBlock = useMemo(() => {
|
247
144
|
return typographyOptions.find(t => {
|
248
145
|
if (t.type === "block") {
|
@@ -264,13 +161,15 @@ function SelectTypography({
|
|
264
161
|
});
|
265
162
|
}, [typographyOptions, activeMark, isBlockActive, editor]);
|
266
163
|
const onChange = (format, option) => {
|
164
|
+
// add/reset block elements
|
165
|
+
toggleBlock(editor, format);
|
267
166
|
if (option.type === "block") {
|
268
|
-
|
269
|
-
|
167
|
+
// reset old font size
|
168
|
+
// let updatedValue = !selectedBlock ? {} : { xs: "16px", sm: "16px", md: "16px", lg: "16px" }
|
169
|
+
addMarkData(editor, {
|
170
|
+
format: "fontSize",
|
171
|
+
value: {}
|
270
172
|
});
|
271
|
-
|
272
|
-
// add/reset block elements
|
273
|
-
toggleBlock(editor, format);
|
274
173
|
} else if (option.type === "mark") {
|
275
174
|
const size = sizeMap[option.value] || "";
|
276
175
|
const [sizeInNumber] = size.split("px");
|
@@ -278,35 +177,11 @@ function SelectTypography({
|
|
278
177
|
}
|
279
178
|
closeMainPopup();
|
280
179
|
};
|
281
|
-
const typographyValue = selectedBlock?.value || "headingOne";
|
282
|
-
if (type === "fullWidth") {
|
283
|
-
return /*#__PURE__*/_jsx(Select, {
|
284
|
-
value: typographyValue,
|
285
|
-
className: "editor-dd",
|
286
|
-
onChange: e => {
|
287
|
-
const {
|
288
|
-
value
|
289
|
-
} = e.target;
|
290
|
-
const option = typographyOptions?.find(o => o.value === value);
|
291
|
-
onChange(value, option);
|
292
|
-
},
|
293
|
-
style: {
|
294
|
-
width: "100%",
|
295
|
-
height: "36px",
|
296
|
-
borderRadius: "10px",
|
297
|
-
fontSize: "14px"
|
298
|
-
},
|
299
|
-
children: typographyOptions.map((item, index) => /*#__PURE__*/_jsxs(MenuItem, {
|
300
|
-
value: item.value,
|
301
|
-
children: [item.title, " ", isTextCustomized && item.value === typographyValue ? " *" : ""]
|
302
|
-
}, index))
|
303
|
-
});
|
304
|
-
}
|
305
180
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
306
181
|
options: typographyOptions,
|
307
182
|
editor: editor,
|
308
183
|
onChange: onChange,
|
309
|
-
value:
|
184
|
+
value: selectedBlock?.value || "headingOne",
|
310
185
|
classes: classes
|
311
186
|
});
|
312
187
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Fade, Grid, IconButton, Paper, Popper
|
1
|
+
import { Fade, Grid, IconButton, Paper, Popper } from "@mui/material";
|
2
2
|
import SelectTypography from "./SelectTypography";
|
3
3
|
import SelectList from "./SelectList";
|
4
4
|
import { toolbarGroups } from "../../toolbarGroups";
|
@@ -14,7 +14,7 @@ import MiniColorPicker from "./MiniColorPicker";
|
|
14
14
|
import SelectAlignment from "./SelectAlignment";
|
15
15
|
import SelectFontSize from "./SelectFontSize";
|
16
16
|
import InfinityAITool from "./InfinityAITool";
|
17
|
-
import {
|
17
|
+
import { viewSlateSelection } from "../../../utils/helper";
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
20
20
|
const DEFAULT_COLOR = {
|
@@ -34,14 +34,12 @@ const MiniTextFormat = props => {
|
|
34
34
|
const [anchorEl, setAnchorEl] = useState(null);
|
35
35
|
const open = Boolean(anchorEl);
|
36
36
|
const id = open ? "popup-edit-tool" : "";
|
37
|
-
const [resizedSize, setResizedSize] = useState();
|
38
37
|
const [size] = useWindowResize();
|
39
|
-
const theme = useTheme();
|
40
38
|
const removeFontStyles = ["superscript", "subscript"];
|
41
39
|
const fontStyle = allTools.filter(f => f.type === "mark" && !removeFontStyles.includes(f.format));
|
42
40
|
const link = allTools.find(f => f.format?.indexOf("link") >= 0);
|
43
41
|
const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
|
44
|
-
const activeColor =
|
42
|
+
const activeColor = activeMark(editor, textColorFormat) || DEFAULT_COLOR[textColorFormat];
|
45
43
|
const activeBg = activeMark(editor, textBgFormat) || DEFAULT_COLOR[textBgFormat];
|
46
44
|
return /*#__PURE__*/_jsx(Grid, {
|
47
45
|
container: true,
|
@@ -59,7 +57,6 @@ const MiniTextFormat = props => {
|
|
59
57
|
classes: classes,
|
60
58
|
editor: editor,
|
61
59
|
closeMainPopup: closeMainPopup,
|
62
|
-
type: "miniToolBar",
|
63
60
|
customProps: customProps
|
64
61
|
}), /*#__PURE__*/_jsx("div", {
|
65
62
|
className: "verticalLine"
|
@@ -80,10 +77,7 @@ const MiniTextFormat = props => {
|
|
80
77
|
className: "verticalLine mr-1"
|
81
78
|
}), /*#__PURE__*/_jsx(SelectFontSize, {
|
82
79
|
classes: classes,
|
83
|
-
editor: editor
|
84
|
-
fromMiniTextFormat: true,
|
85
|
-
setResizedSize: setResizedSize,
|
86
|
-
resizedSize: resizedSize
|
80
|
+
editor: editor
|
87
81
|
}), /*#__PURE__*/_jsx("div", {
|
88
82
|
className: "verticalLine mr-1"
|
89
83
|
}), fontStyle?.map((m, i) => {
|
@@ -98,7 +92,6 @@ const MiniTextFormat = props => {
|
|
98
92
|
activeColor: activeColor,
|
99
93
|
id: "11_cc",
|
100
94
|
editor: editor,
|
101
|
-
type: "textColor",
|
102
95
|
customProps: customProps
|
103
96
|
}), /*#__PURE__*/_jsx(MiniColorPicker, {
|
104
97
|
format: textBgFormat,
|
@@ -145,10 +138,7 @@ const MiniTextFormat = props => {
|
|
145
138
|
editor: editor,
|
146
139
|
classes: classes,
|
147
140
|
closeMainPopup: closeMainPopup,
|
148
|
-
customProps: customProps
|
149
|
-
fromMiniTextFormat: true,
|
150
|
-
setResizedSize: setResizedSize,
|
151
|
-
resizedSize: resizedSize
|
141
|
+
customProps: customProps
|
152
142
|
})]
|
153
143
|
})
|
154
144
|
})
|