@flozy/editor 11.1.1 → 11.1.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 +6 -6
- package/dist/Editor/CommonEditor.js +82 -21
- package/dist/Editor/DialogWrapper.js +31 -25
- package/dist/Editor/Editor.css +37 -4
- package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Attachments/AttachmentStyles.js +16 -0
- package/dist/Editor/Elements/Attachments/Attachments.js +154 -11
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +8 -3
- package/dist/Editor/Elements/Button/EditorButton.js +22 -7
- 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/DataTypes/Components/Select.js +134 -55
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +7 -8
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +8 -3
- 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.css +5 -0
- package/dist/Editor/Elements/Embed/Embed.js +37 -43
- package/dist/Editor/Elements/Embed/Image.js +242 -22
- package/dist/Editor/Elements/Embed/Video.js +277 -32
- package/dist/Editor/Elements/Form/Form.js +10 -35
- package/dist/Editor/Elements/Form/FormField.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
- package/dist/Editor/Elements/Form/Workflow/constant.js +25 -1
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +34 -75
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +9 -5
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +3 -1
- package/dist/Editor/Elements/FreeGrid/helper.js +194 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +15 -0
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +2 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -3
- package/dist/Editor/Elements/Signature/SignaturePopup.js +2 -13
- package/dist/Editor/Elements/SimpleText/index.js +4 -1
- package/dist/Editor/Elements/Table/Table.js +2 -1
- package/dist/Editor/Elements/Table/TableCell.js +10 -3
- package/dist/Editor/Elements/Title/title.js +4 -5
- package/dist/Editor/Elements/TopBanner/TopBanner.js +4 -2
- package/dist/Editor/Elements/TopBanner/TopBannerButton.js +5 -3
- package/dist/Editor/Styles/EditorStyles.js +16 -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 +33 -29
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +25 -23
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +15 -5
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +65 -7
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +66 -12
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +7 -4
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/BackIcon.js +18 -0
- package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
- package/dist/Editor/common/ColorPickerButton.js +38 -19
- package/dist/Editor/common/CustomColorPicker/index.js +130 -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 +1 -0
- package/dist/Editor/common/Icon.js +28 -0
- package/dist/Editor/common/ImageSelector/ImageSelector.js +45 -7
- package/dist/Editor/common/ImageSelector/Options/Upload.js +26 -11
- package/dist/Editor/common/ImageSelector/Styles.js +3 -9
- 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 +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +20 -7
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +2 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +20 -7
- package/dist/Editor/common/RnD/GuideLines/styles.js +1 -1
- 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 +28 -11
- package/dist/Editor/common/RnD/Utils/index.js +3 -1
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +52 -63
- package/dist/Editor/common/RnD/VirtualElement/helper.js +248 -68
- package/dist/Editor/common/RnD/VirtualElement/styles.js +22 -0
- package/dist/Editor/common/RnD/index.js +61 -14
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +18 -4
- 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/color.js +36 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +15 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
- package/dist/Editor/common/StyleBuilder/formStyle.js +19 -13
- package/dist/Editor/common/StyleBuilder/index.js +8 -4
- package/dist/Editor/common/Uploader.js +118 -17
- package/dist/Editor/common/UploaderWithProgress.js +183 -0
- package/dist/Editor/common/iconslist.js +21 -0
- package/dist/Editor/commonStyle.js +37 -3
- package/dist/Editor/helper/index.js +4 -1
- package/dist/Editor/helper/theme.js +203 -2
- package/dist/Editor/hooks/useEditorTheme.js +153 -0
- package/dist/Editor/hooks/useMouseMove.js +12 -3
- package/dist/Editor/hooks/useTable.js +62 -1
- package/dist/Editor/hooks/useThemeValues.js +63 -0
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +56 -3
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/service/fileupload.js +70 -0
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +149 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
- package/dist/Editor/themeSettings/buttons/index.js +300 -0
- package/dist/Editor/themeSettings/buttons/style.js +23 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +310 -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 +380 -0
- package/dist/Editor/themeSettings/style.js +299 -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 +332 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +162 -38
- package/dist/Editor/utils/accordion.js +1 -1
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +76 -3
- package/dist/Editor/utils/insertAppHeader.js +8 -4
- package/package.json +1 -1
@@ -2,8 +2,11 @@ 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 } from "../../../helper/theme";
|
5
|
+
import { BREAKPOINTS_DEVICES, getBreakPointsValue, isTextCustomized as isCustomized, textThemeFields as themeFields } 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";
|
7
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
12
|
function Label({
|
@@ -18,26 +21,29 @@ function Label({
|
|
18
21
|
});
|
19
22
|
}
|
20
23
|
function DisplayHeaderLabel({
|
21
|
-
type
|
24
|
+
type,
|
25
|
+
isCustomized,
|
26
|
+
isPara = false
|
22
27
|
}) {
|
23
28
|
return /*#__PURE__*/_jsxs("div", {
|
24
|
-
children: ["H", /*#__PURE__*/_jsx("sub", {
|
29
|
+
children: [isCustomized ? "*" : "", isPara ? "P" : "H", /*#__PURE__*/_jsx("sub", {
|
25
30
|
children: type
|
26
31
|
})]
|
27
32
|
});
|
28
33
|
}
|
29
|
-
function getTypographyOptions(translation) {
|
30
|
-
|
34
|
+
function getTypographyOptions(isCustomized, translation) {
|
35
|
+
const typographyOptions = [{
|
31
36
|
id: 11,
|
32
37
|
format: "headingOne",
|
33
38
|
type: "block",
|
34
39
|
title: /*#__PURE__*/_jsx(Label, {
|
35
40
|
label: "H1",
|
36
|
-
type: "
|
41
|
+
type: "Heading",
|
37
42
|
translation: translation
|
38
43
|
}),
|
39
44
|
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
40
|
-
type: 1
|
45
|
+
type: 1,
|
46
|
+
isCustomized: isCustomized
|
41
47
|
}),
|
42
48
|
group: "typography",
|
43
49
|
value: "headingOne"
|
@@ -47,11 +53,12 @@ function getTypographyOptions(translation) {
|
|
47
53
|
type: "block",
|
48
54
|
title: /*#__PURE__*/_jsx(Label, {
|
49
55
|
label: "H2",
|
50
|
-
type: "
|
56
|
+
type: "Heading",
|
51
57
|
translation: translation
|
52
58
|
}),
|
53
59
|
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
54
|
-
type: 2
|
60
|
+
type: 2,
|
61
|
+
isCustomized: isCustomized
|
55
62
|
}),
|
56
63
|
group: "typography",
|
57
64
|
value: "headingTwo"
|
@@ -61,63 +68,156 @@ function getTypographyOptions(translation) {
|
|
61
68
|
type: "block",
|
62
69
|
title: /*#__PURE__*/_jsx(Label, {
|
63
70
|
label: "H3",
|
64
|
-
type: "
|
71
|
+
type: "Heading",
|
65
72
|
translation: translation
|
66
73
|
}),
|
67
74
|
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
68
|
-
type: 3
|
75
|
+
type: 3,
|
76
|
+
isCustomized: isCustomized
|
69
77
|
}),
|
70
78
|
group: "typography",
|
71
79
|
value: "headingThree"
|
72
80
|
}, {
|
73
|
-
id:
|
74
|
-
format: "
|
75
|
-
type: "
|
81
|
+
id: 17,
|
82
|
+
format: "headingFour",
|
83
|
+
type: "block",
|
76
84
|
title: /*#__PURE__*/_jsx(Label, {
|
77
|
-
label: "
|
78
|
-
type: "
|
85
|
+
label: "H4",
|
86
|
+
type: "Heading",
|
79
87
|
translation: translation
|
80
88
|
}),
|
81
|
-
label:
|
89
|
+
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
90
|
+
type: 4,
|
91
|
+
isCustomized: isCustomized
|
92
|
+
}),
|
82
93
|
group: "typography",
|
83
|
-
value: "
|
94
|
+
value: "headingFour"
|
84
95
|
}, {
|
85
|
-
id:
|
86
|
-
format: "
|
87
|
-
type: "
|
96
|
+
id: 18,
|
97
|
+
format: "headingFive",
|
98
|
+
type: "block",
|
88
99
|
title: /*#__PURE__*/_jsx(Label, {
|
89
|
-
label: "
|
90
|
-
type: "
|
100
|
+
label: "H5",
|
101
|
+
type: "Heading",
|
91
102
|
translation: translation
|
92
103
|
}),
|
93
|
-
label:
|
104
|
+
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
105
|
+
type: 5,
|
106
|
+
isCustomized: isCustomized
|
107
|
+
}),
|
94
108
|
group: "typography",
|
95
|
-
value: "
|
109
|
+
value: "headingFive"
|
96
110
|
}, {
|
97
|
-
id:
|
98
|
-
format: "
|
99
|
-
type: "
|
111
|
+
id: 19,
|
112
|
+
format: "headingSix",
|
113
|
+
type: "block",
|
100
114
|
title: /*#__PURE__*/_jsx(Label, {
|
101
|
-
label: "
|
102
|
-
type: "
|
115
|
+
label: "H6",
|
116
|
+
type: "Heading",
|
103
117
|
translation: translation
|
104
118
|
}),
|
105
|
-
label:
|
119
|
+
label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
|
120
|
+
type: 6,
|
121
|
+
isCustomized: isCustomized
|
122
|
+
}),
|
106
123
|
group: "typography",
|
107
|
-
value: "
|
108
|
-
}
|
124
|
+
value: "headingSix"
|
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;
|
109
204
|
}
|
110
205
|
function SelectTypography({
|
111
206
|
editor,
|
112
207
|
classes,
|
113
208
|
closeMainPopup,
|
209
|
+
type,
|
114
210
|
customProps
|
115
211
|
}) {
|
116
212
|
const [size] = useWindowResize();
|
213
|
+
const {
|
214
|
+
theme
|
215
|
+
} = useEditorTheme();
|
117
216
|
const {
|
118
217
|
translation
|
119
218
|
} = customProps;
|
120
|
-
const
|
219
|
+
const isTextCustomized = theme?.id ? isCustomized(editor) : false;
|
220
|
+
const typographyOptions = getTypographyOptions(isTextCustomized, translation);
|
121
221
|
const updateMarkData = newVal => {
|
122
222
|
const val = activeMark(editor, "fontSize");
|
123
223
|
let upData = {
|
@@ -139,7 +239,10 @@ function SelectTypography({
|
|
139
239
|
...upData
|
140
240
|
}
|
141
241
|
});
|
242
|
+
|
243
|
+
// closeMainPopup();
|
142
244
|
};
|
245
|
+
|
143
246
|
const selectedBlock = useMemo(() => {
|
144
247
|
return typographyOptions.find(t => {
|
145
248
|
if (t.type === "block") {
|
@@ -161,15 +264,13 @@ function SelectTypography({
|
|
161
264
|
});
|
162
265
|
}, [typographyOptions, activeMark, isBlockActive, editor]);
|
163
266
|
const onChange = (format, option) => {
|
164
|
-
// add/reset block elements
|
165
|
-
toggleBlock(editor, format);
|
166
267
|
if (option.type === "block") {
|
167
|
-
|
168
|
-
|
169
|
-
addMarkData(editor, {
|
170
|
-
format: "fontSize",
|
171
|
-
value: {}
|
268
|
+
themeFields.forEach(field => {
|
269
|
+
Editor.removeMark(editor, field);
|
172
270
|
});
|
271
|
+
|
272
|
+
// add/reset block elements
|
273
|
+
toggleBlock(editor, format);
|
173
274
|
} else if (option.type === "mark") {
|
174
275
|
const size = sizeMap[option.value] || "";
|
175
276
|
const [sizeInNumber] = size.split("px");
|
@@ -177,11 +278,35 @@ function SelectTypography({
|
|
177
278
|
}
|
178
279
|
closeMainPopup();
|
179
280
|
};
|
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
|
+
}
|
180
305
|
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
181
306
|
options: typographyOptions,
|
182
307
|
editor: editor,
|
183
308
|
onChange: onChange,
|
184
|
-
value:
|
309
|
+
value: typographyValue,
|
185
310
|
classes: classes
|
186
311
|
});
|
187
312
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Fade, Grid, IconButton, Paper, Popper } from "@mui/material";
|
1
|
+
import { Fade, Grid, IconButton, Paper, Popper, useTheme } 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 { viewSlateSelection } from "../../../utils/helper";
|
17
|
+
import { getSelectedElementColor, 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,12 +34,14 @@ 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();
|
37
38
|
const [size] = useWindowResize();
|
39
|
+
const theme = useTheme();
|
38
40
|
const removeFontStyles = ["superscript", "subscript"];
|
39
41
|
const fontStyle = allTools.filter(f => f.type === "mark" && !removeFontStyles.includes(f.format));
|
40
42
|
const link = allTools.find(f => f.format?.indexOf("link") >= 0);
|
41
43
|
const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
|
42
|
-
const activeColor =
|
44
|
+
const activeColor = getSelectedElementColor(editor, textColorFormat, theme);
|
43
45
|
const activeBg = activeMark(editor, textBgFormat) || DEFAULT_COLOR[textBgFormat];
|
44
46
|
return /*#__PURE__*/_jsx(Grid, {
|
45
47
|
container: true,
|
@@ -57,6 +59,7 @@ const MiniTextFormat = props => {
|
|
57
59
|
classes: classes,
|
58
60
|
editor: editor,
|
59
61
|
closeMainPopup: closeMainPopup,
|
62
|
+
type: "miniToolBar",
|
60
63
|
customProps: customProps
|
61
64
|
}), /*#__PURE__*/_jsx("div", {
|
62
65
|
className: "verticalLine"
|
@@ -77,7 +80,10 @@ const MiniTextFormat = props => {
|
|
77
80
|
className: "verticalLine mr-1"
|
78
81
|
}), /*#__PURE__*/_jsx(SelectFontSize, {
|
79
82
|
classes: classes,
|
80
|
-
editor: editor
|
83
|
+
editor: editor,
|
84
|
+
fromMiniTextFormat: true,
|
85
|
+
setResizedSize: setResizedSize,
|
86
|
+
resizedSize: resizedSize
|
81
87
|
}), /*#__PURE__*/_jsx("div", {
|
82
88
|
className: "verticalLine mr-1"
|
83
89
|
}), fontStyle?.map((m, i) => {
|
@@ -92,6 +98,7 @@ const MiniTextFormat = props => {
|
|
92
98
|
activeColor: activeColor,
|
93
99
|
id: "11_cc",
|
94
100
|
editor: editor,
|
101
|
+
type: "textColor",
|
95
102
|
customProps: customProps
|
96
103
|
}), /*#__PURE__*/_jsx(MiniColorPicker, {
|
97
104
|
format: textBgFormat,
|
@@ -138,7 +145,10 @@ const MiniTextFormat = props => {
|
|
138
145
|
editor: editor,
|
139
146
|
classes: classes,
|
140
147
|
closeMainPopup: closeMainPopup,
|
141
|
-
customProps: customProps
|
148
|
+
customProps: customProps,
|
149
|
+
fromMiniTextFormat: true,
|
150
|
+
setResizedSize: setResizedSize,
|
151
|
+
resizedSize: resizedSize
|
142
152
|
})]
|
143
153
|
})
|
144
154
|
})
|
@@ -98,6 +98,9 @@ const usePopupStyle = theme => ({
|
|
98
98
|
}
|
99
99
|
}
|
100
100
|
},
|
101
|
+
"& .MuiDivider-root": {
|
102
|
+
border: `0.5px solid ${theme?.palette?.editor?.deviderBgColor}`
|
103
|
+
},
|
101
104
|
"@media only screen and (max-width: 599px)": {
|
102
105
|
// margin: "10px !important",
|
103
106
|
background: "unset",
|
@@ -111,6 +114,7 @@ const usePopupStyle = theme => ({
|
|
111
114
|
width: "323px",
|
112
115
|
maxWidth: "100%",
|
113
116
|
overflowX: "hidden !important",
|
117
|
+
marginTop: "6px",
|
114
118
|
// 30% of window height
|
115
119
|
maxHeight: `${window.innerHeight * 0.45}px`,
|
116
120
|
overflow: "auto",
|
@@ -304,6 +308,21 @@ const usePopupStyle = theme => ({
|
|
304
308
|
paddingRight: "0px !important"
|
305
309
|
}
|
306
310
|
},
|
311
|
+
textFormatContainer: {
|
312
|
+
".saveThemeBtnsWrapper": {
|
313
|
+
position: "sticky",
|
314
|
+
bottom: "0px",
|
315
|
+
right: "0px",
|
316
|
+
boxShadow: `0px -3px 16px 0px ${theme?.palette?.editor?.cardShadow}`,
|
317
|
+
padding: "10px",
|
318
|
+
borderRadius: "8px 8px 19px 19px",
|
319
|
+
display: "flex",
|
320
|
+
justifyContent: "end",
|
321
|
+
alignItems: "center",
|
322
|
+
gap: "8px",
|
323
|
+
background: theme?.palette?.editor?.miniToolBarBackground
|
324
|
+
}
|
325
|
+
},
|
307
326
|
textFormatLabel: {
|
308
327
|
display: "flex",
|
309
328
|
alignItems: "center",
|
@@ -335,9 +354,10 @@ const usePopupStyle = theme => ({
|
|
335
354
|
borderBottom: `1px solid ${theme?.palette?.editor?.deviderBgColor} !important`
|
336
355
|
},
|
337
356
|
textFormatField: {
|
338
|
-
marginBottom: "8px"
|
339
|
-
marginTop: "8px"
|
357
|
+
marginBottom: "8px"
|
358
|
+
// marginTop: "8px",
|
340
359
|
},
|
360
|
+
|
341
361
|
textFormatField1: {
|
342
362
|
marginBottom: "16px",
|
343
363
|
marginTop: "10px"
|
@@ -537,7 +557,7 @@ const usePopupStyle = theme => ({
|
|
537
557
|
}
|
538
558
|
},
|
539
559
|
alignItems: "flexStart",
|
540
|
-
justifyContent: "center",
|
560
|
+
// justifyContent: "center",
|
541
561
|
flexDirection: "row",
|
542
562
|
"&:hover": {
|
543
563
|
background: "unset"
|
@@ -786,8 +806,13 @@ const usePopupStyle = theme => ({
|
|
786
806
|
padding: "0px"
|
787
807
|
},
|
788
808
|
defaultBtn: {
|
789
|
-
color: "#
|
790
|
-
textTransform: "none"
|
809
|
+
color: "#2563EB !important",
|
810
|
+
textTransform: "none",
|
811
|
+
textDecoration: "underline",
|
812
|
+
"&.Mui-disabled": {
|
813
|
+
color: "#A0AEC0 !important",
|
814
|
+
textDecoration: "none"
|
815
|
+
}
|
791
816
|
},
|
792
817
|
templateCardBtnGrp: {
|
793
818
|
display: "none",
|
@@ -864,7 +889,7 @@ const usePopupStyle = theme => ({
|
|
864
889
|
margin: "30px",
|
865
890
|
"& .MuiPaper-root": {
|
866
891
|
overflow: "auto",
|
867
|
-
backgroundColor: theme?.palette?.editor?.
|
892
|
+
backgroundColor: theme?.palette?.editor?.miniToolBarBackground,
|
868
893
|
borderRadius: "14px !important",
|
869
894
|
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`,
|
870
895
|
minWidth: "fit-content",
|
@@ -1132,12 +1157,45 @@ const usePopupStyle = theme => ({
|
|
1132
1157
|
miniFontSizeInput: {
|
1133
1158
|
"& input": {
|
1134
1159
|
fontSize: "14px",
|
1135
|
-
width: "
|
1160
|
+
width: "26px",
|
1136
1161
|
padding: "8px 4px"
|
1137
1162
|
},
|
1138
1163
|
"& fieldset": {
|
1139
1164
|
border: "none !important"
|
1140
1165
|
}
|
1166
|
+
},
|
1167
|
+
customCheckBox: {
|
1168
|
+
marginTop: "4px",
|
1169
|
+
padding: "0px",
|
1170
|
+
"& .MuiCheckbox-root": {
|
1171
|
+
padding: "8px 8px 8px 10px",
|
1172
|
+
"&:hover": {
|
1173
|
+
background: "unset !important"
|
1174
|
+
}
|
1175
|
+
},
|
1176
|
+
"& button": {
|
1177
|
+
width: "14px !important",
|
1178
|
+
height: "14px !important",
|
1179
|
+
borderRadius: "3px",
|
1180
|
+
border: `1px solid ${theme?.palette?.editor?.buttonBorder3}`,
|
1181
|
+
padding: "0px",
|
1182
|
+
"& svg": {
|
1183
|
+
width: "10px",
|
1184
|
+
height: "10px"
|
1185
|
+
}
|
1186
|
+
},
|
1187
|
+
"& .checkedIcon": {
|
1188
|
+
background: "#2563EB",
|
1189
|
+
borderColor: "#2563EB"
|
1190
|
+
},
|
1191
|
+
"& .unCheckedIcon": {
|
1192
|
+
background: theme?.palette?.editor?.checkedIconBg
|
1193
|
+
},
|
1194
|
+
"& p": {
|
1195
|
+
margin: "0px !important",
|
1196
|
+
color: theme?.palette?.editor?.tv_text,
|
1197
|
+
fontSize: "13px"
|
1198
|
+
}
|
1141
1199
|
}
|
1142
1200
|
});
|
1143
1201
|
export default usePopupStyle;
|
@@ -10,6 +10,8 @@ import { AllColors } from "../../Elements/Color Picker/ColorButtons";
|
|
10
10
|
import { fontFamilyMap } from "../../utils/font";
|
11
11
|
import { getBorderColor } from "../../utils/helper";
|
12
12
|
import SelectTypography from "./MiniTextFormat/SelectTypography";
|
13
|
+
import { isTextCustomized, saveToTheme } from "../../helper/theme";
|
14
|
+
import { useEditorTheme } from "../../hooks/useEditorTheme";
|
13
15
|
import SelectSuperSubscript from "./MiniTextFormat/SelectSuperSubscript";
|
14
16
|
import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
|
15
17
|
import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
|
@@ -29,7 +31,10 @@ const TextFormat = props => {
|
|
29
31
|
editor,
|
30
32
|
onClose,
|
31
33
|
closeMainPopup,
|
32
|
-
customProps
|
34
|
+
customProps,
|
35
|
+
setResizedSize,
|
36
|
+
resizedSize,
|
37
|
+
fromMiniTextFormat
|
33
38
|
} = props;
|
34
39
|
const [anchorEl, setAnchorEl] = useState(null);
|
35
40
|
const [type, setType] = useState(null);
|
@@ -43,7 +48,7 @@ const TextFormat = props => {
|
|
43
48
|
const pageSettingLine = pageSt?.pageProps?.lineHeight;
|
44
49
|
const {
|
45
50
|
fontFamilies,
|
46
|
-
theme
|
51
|
+
theme: appTheme
|
47
52
|
} = useEditorContext();
|
48
53
|
const breakpoint = getDevice(window.innerWidth);
|
49
54
|
const fontWeight = allTools.find(f => f.format === "fontWeight");
|
@@ -62,6 +67,11 @@ const TextFormat = props => {
|
|
62
67
|
color: "",
|
63
68
|
bgColor: ""
|
64
69
|
};
|
70
|
+
const {
|
71
|
+
theme,
|
72
|
+
updateTheme
|
73
|
+
} = useEditorTheme();
|
74
|
+
const customized = isTextCustomized(editor);
|
65
75
|
let lineSpacingValue = activeMark(editor, "lineHeight");
|
66
76
|
lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
|
67
77
|
const handleColorPicker = type => e => {
|
@@ -116,6 +126,51 @@ const TextFormat = props => {
|
|
116
126
|
sx: classes.textFormatWrapper,
|
117
127
|
className: "text-formatter-popup",
|
118
128
|
children: [/*#__PURE__*/_jsxs(Grid, {
|
129
|
+
item: true,
|
130
|
+
xs: 12,
|
131
|
+
children: [/*#__PURE__*/_jsxs(Grid, {
|
132
|
+
container: true,
|
133
|
+
justifyContent: "space-between",
|
134
|
+
alignItems: "center",
|
135
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
136
|
+
item: true,
|
137
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
138
|
+
variant: "body1",
|
139
|
+
color: "primary",
|
140
|
+
sx: classes.typoLabel,
|
141
|
+
children: "Style"
|
142
|
+
})
|
143
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
144
|
+
item: true,
|
145
|
+
children: theme?.id ? /*#__PURE__*/_jsx(Button, {
|
146
|
+
sx: classes.defaultBtn,
|
147
|
+
onClick: () => {
|
148
|
+
const {
|
149
|
+
field,
|
150
|
+
theme
|
151
|
+
} = saveToTheme(editor) || {};
|
152
|
+
updateTheme(theme, {
|
153
|
+
action: "ELEMENT_PROPS_CHANGE",
|
154
|
+
fieldName: field
|
155
|
+
});
|
156
|
+
},
|
157
|
+
disabled: !customized,
|
158
|
+
children: "Save to theme"
|
159
|
+
}) : null
|
160
|
+
})]
|
161
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
162
|
+
item: true,
|
163
|
+
xs: 12,
|
164
|
+
sx: classes.textFormatField,
|
165
|
+
children: /*#__PURE__*/_jsx(SelectTypography, {
|
166
|
+
editor: editor,
|
167
|
+
classes: classes,
|
168
|
+
closeMainPopup: closeMainPopup,
|
169
|
+
type: "fullWidth",
|
170
|
+
customProps: customProps
|
171
|
+
})
|
172
|
+
})]
|
173
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
119
174
|
item: true,
|
120
175
|
xs: 12,
|
121
176
|
children: [/*#__PURE__*/_jsxs(Grid, {
|
@@ -196,7 +251,10 @@ const TextFormat = props => {
|
|
196
251
|
format: "fontSize",
|
197
252
|
activeMark: activeMark,
|
198
253
|
editor: editor,
|
199
|
-
fullWidth: true
|
254
|
+
fullWidth: true,
|
255
|
+
fromMiniTextFormat: fromMiniTextFormat,
|
256
|
+
setResizedSize: setResizedSize,
|
257
|
+
resizedSize: resizedSize
|
200
258
|
})
|
201
259
|
})]
|
202
260
|
})]
|
@@ -242,7 +300,8 @@ const TextFormat = props => {
|
|
242
300
|
rounded: true,
|
243
301
|
title: translation("textColor"),
|
244
302
|
id: "11_cc",
|
245
|
-
classes: classes
|
303
|
+
classes: classes,
|
304
|
+
type: "textColor"
|
246
305
|
}, "11_cc")
|
247
306
|
})]
|
248
307
|
}), /*#__PURE__*/_jsxs(Grid, {
|
@@ -268,7 +327,7 @@ const TextFormat = props => {
|
|
268
327
|
children: /*#__PURE__*/_jsx(Button, {
|
269
328
|
sx: classes.defaultBtn2,
|
270
329
|
startIcon: /*#__PURE__*/_jsx(ColorResetIcon, {
|
271
|
-
stroke:
|
330
|
+
stroke: appTheme?.palette?.type === "dark" ? "#505359" : "#A2B0B9"
|
272
331
|
}),
|
273
332
|
onClick: handleDefault({
|
274
333
|
format: "bgColor"
|
@@ -358,12 +417,7 @@ const TextFormat = props => {
|
|
358
417
|
xs: 12,
|
359
418
|
className: "typo-icons",
|
360
419
|
sx: classes.evenSpace,
|
361
|
-
children: [
|
362
|
-
classes: classes,
|
363
|
-
editor: editor,
|
364
|
-
closeMainPopup: closeMainPopup || onClose,
|
365
|
-
customProps: customProps
|
366
|
-
}), fontStyle?.map((m, i) => {
|
420
|
+
children: [fontStyle?.map((m, i) => {
|
367
421
|
return /*#__PURE__*/_jsx(MarkButton, {
|
368
422
|
editor: editor,
|
369
423
|
...m,
|
@@ -402,7 +456,7 @@ const TextFormat = props => {
|
|
402
456
|
value: lineSpacingValue,
|
403
457
|
onChange: handleLineSpacing,
|
404
458
|
data: {
|
405
|
-
key:
|
459
|
+
key: "lineHeight"
|
406
460
|
}
|
407
461
|
})
|
408
462
|
})]
|