@flozy/editor 10.7.0 → 10.7.1
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 +126 -15
- package/dist/Editor/DialogWrapper.js +31 -25
- package/dist/Editor/Editor.css +45 -11
- package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
- package/dist/Editor/Elements/AI/Styles.js +1 -0
- package/dist/Editor/Elements/Accordion/Accordion.js +25 -17
- 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 +153 -11
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +8 -3
- package/dist/Editor/Elements/Button/EditorButton.js +23 -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/Embed/Embed.js +36 -43
- package/dist/Editor/Elements/Embed/Image.js +240 -23
- package/dist/Editor/Elements/Embed/Video.js +246 -15
- 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 +39 -33
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
- package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
- package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +9 -0
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +2 -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 +6 -6
- package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
- package/dist/Editor/MiniEditor.js +2 -1
- package/dist/Editor/Styles/EditorStyles.js +20 -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/Mini/MiniToolbar.js +2 -1
- 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/SelectList.js +4 -2
- 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 +69 -9
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +58 -10
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -2
- 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 -16
- 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 +3 -0
- package/dist/Editor/common/Icon.js +28 -0
- package/dist/Editor/common/ImageSelector/ImageSelector.js +46 -8
- package/dist/Editor/common/ImageSelector/Options/Upload.js +26 -11
- package/dist/Editor/common/ImageSelector/Styles.js +3 -9
- package/dist/Editor/common/LinkSettings/NavComponents.js +6 -2
- 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 +20 -7
- 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 +20 -7
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -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 +28 -18
- package/dist/Editor/common/RnD/Utils/index.js +3 -1
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +45 -58
- package/dist/Editor/common/RnD/VirtualElement/helper.js +320 -130
- package/dist/Editor/common/RnD/VirtualElement/styles.js +22 -0
- package/dist/Editor/common/RnD/index.js +48 -13
- 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/fieldTypes/backgroundImage.js +15 -2
- 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/embedUpload.js +115 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
- package/dist/Editor/common/StyleBuilder/index.js +8 -4
- package/dist/Editor/common/Uploader.js +125 -17
- package/dist/Editor/common/UploaderWithProgress.js +183 -0
- package/dist/Editor/common/iconslist.js +21 -0
- package/dist/Editor/commonStyle.js +107 -64
- package/dist/Editor/helper/index.js +10 -2
- package/dist/Editor/helper/textIndeces.js +58 -0
- package/dist/Editor/helper/theme.js +203 -2
- 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 +7 -3
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/service/fileupload.js +53 -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 +231 -25
- package/dist/Editor/utils/accordion.js +62 -34
- 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/helper.js +97 -21
- package/dist/Editor/utils/insertAppHeader.js +8 -4
- package/package.json +4 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -454
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Editor, Transforms, Element as SlateElement, Range } from "slate";
|
1
|
+
import { Editor, Transforms, Element as SlateElement, Range, Path } from "slate";
|
2
2
|
import { Box } from "@mui/material";
|
3
3
|
import { sizeMap } from "./font";
|
4
4
|
import Link from "../Elements/Link/Link";
|
@@ -34,12 +34,12 @@ import SimpleText from "../Elements/SimpleText";
|
|
34
34
|
import CheckList from "../Elements/List/CheckList";
|
35
35
|
import { getTextColor, isEmptyTextNode } from "../helper";
|
36
36
|
import Attachments from "../Elements/Attachments/Attachments";
|
37
|
-
import { getBreakpointLineSpacing, getBreakPointsValue, getDevice,
|
37
|
+
import { getBreakpointLineSpacing, getBreakPointsValue, getDevice, getElementProperty, textThemeFields } from "../helper/theme";
|
38
38
|
import Variables from "../Elements/Variables/Variable";
|
39
|
-
import insertNewLine from "./insertNewLine";
|
40
39
|
import Divider from "../Elements/Divider/Divider";
|
41
40
|
import { getBorderColor, getSlateDom } from "./helper";
|
42
41
|
import Code from "../Elements/EmbedScript/Code";
|
42
|
+
import { ReactEditor } from "slate-react";
|
43
43
|
import FreeGrid from "../Elements/FreeGrid/FreeGrid";
|
44
44
|
import FreeGridItem from "../Elements/FreeGrid/FreeGridItem";
|
45
45
|
import FreeGridBox from "../Elements/FreeGrid/FreeGridBox";
|
@@ -47,17 +47,70 @@ import DataView from "../Elements/DataView/DataView";
|
|
47
47
|
import ViewData from "../Elements/DataView/Layouts/ViewData";
|
48
48
|
import ColumnView from "../Elements/DataView/Layouts/ColumnView";
|
49
49
|
import SearchAttachment from "../Elements/Search/SearchAttachment";
|
50
|
-
|
50
|
+
import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
|
51
51
|
import { jsx as _jsx } from "react/jsx-runtime";
|
52
52
|
const alignment = ["alignLeft", "alignRight", "alignCenter", "alignJustify"];
|
53
|
-
const list_types = ["orderedList", "unorderedList"];
|
53
|
+
const list_types = ["orderedList", "unorderedList", "accordion-details"];
|
54
54
|
const LIST_FORMAT_TYPE = {
|
55
55
|
orderedList: "list-item",
|
56
56
|
unorderedList: "list-item"
|
57
57
|
};
|
58
|
-
|
58
|
+
|
59
|
+
// const NEWLINESAFTER = [
|
60
|
+
// "headingOne",
|
61
|
+
// "headingTwo",
|
62
|
+
// "headingThree",
|
63
|
+
// "headingFour",
|
64
|
+
// "headingFive",
|
65
|
+
// "headingSix",
|
66
|
+
// ];
|
67
|
+
|
68
|
+
const THEME_BLOCK_FIELDS = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "paragraphOne", "paragraphTwo", "paragraphThree"];
|
69
|
+
const convertAccordionToListItem = (editor, format) => {
|
70
|
+
const accordionLists = Array.from(Editor.nodes(editor, {
|
71
|
+
match: n => {
|
72
|
+
let accordionList = false;
|
73
|
+
if (n.type === "accordion") {
|
74
|
+
const [summary] = n.children;
|
75
|
+
accordionList = [format, "paragraph"].includes(summary.children?.[0]?.type);
|
76
|
+
}
|
77
|
+
return accordionList;
|
78
|
+
}
|
79
|
+
}));
|
80
|
+
accordionLists?.forEach(accordionList => {
|
81
|
+
const [node, path] = accordionList;
|
82
|
+
const [summary, details] = node.children;
|
83
|
+
const listItem = {
|
84
|
+
...(summary.children[0] || {})
|
85
|
+
};
|
86
|
+
const isPara = listItem.type === "paragraph";
|
87
|
+
if (isPara) {
|
88
|
+
listItem.type = "list-item";
|
89
|
+
}
|
90
|
+
|
91
|
+
// Replace the accordion with the format
|
92
|
+
Transforms.removeNodes(editor, {
|
93
|
+
at: path
|
94
|
+
});
|
95
|
+
Transforms.insertNodes(editor, listItem, {
|
96
|
+
at: path
|
97
|
+
});
|
98
|
+
if (isPara) {
|
99
|
+
Transforms.wrapNodes(editor, {
|
100
|
+
type: format,
|
101
|
+
children: []
|
102
|
+
}, {
|
103
|
+
at: path
|
104
|
+
});
|
105
|
+
}
|
106
|
+
const nextPath = Path.next(path);
|
107
|
+
Transforms.insertNodes(editor, details.children, {
|
108
|
+
at: nextPath
|
109
|
+
});
|
110
|
+
});
|
111
|
+
};
|
59
112
|
export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
60
|
-
|
113
|
+
let isActive = isBlockActive(editor, format);
|
61
114
|
const isList = list_types.includes(format);
|
62
115
|
const isIndent = alignment.includes(format);
|
63
116
|
const isAligned = alignment.some(alignmentType => isBlockActive(editor, alignmentType));
|
@@ -79,17 +132,33 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
79
132
|
});
|
80
133
|
return;
|
81
134
|
}
|
82
|
-
|
83
|
-
match: n =>
|
84
|
-
|
135
|
+
const [match] = Editor.nodes(editor, {
|
136
|
+
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && list_types.includes(n.type),
|
137
|
+
mode: "lowest" // To ensure it's the closest parent
|
85
138
|
});
|
86
139
|
|
140
|
+
if (match) {
|
141
|
+
const [matchNode, matchPath] = match;
|
142
|
+
if (matchNode.type !== "accordion-details") {
|
143
|
+
Transforms.unwrapNodes(editor, {
|
144
|
+
match: (n, n2) => {
|
145
|
+
const isList = !Editor.isEditor(n) && SlateElement.isElement(n) && list_types.includes(n.type);
|
146
|
+
return isList && n2.toString() === matchPath.toString();
|
147
|
+
},
|
148
|
+
split: true
|
149
|
+
});
|
150
|
+
} else {
|
151
|
+
isActive = false;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
87
155
|
// inserting blocks from "/"" commands remove searched word
|
88
156
|
if (!selection) {
|
89
157
|
Transforms.insertText(editor, "");
|
90
158
|
}
|
159
|
+
const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
|
91
160
|
Transforms.setNodes(editor, {
|
92
|
-
type: isActive ?
|
161
|
+
type: isActive ? forActiveType : isList ? LIST_FORMAT_TYPE[format] : format,
|
93
162
|
...attr
|
94
163
|
});
|
95
164
|
if (isList && !isActive) {
|
@@ -98,9 +167,12 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
98
167
|
children: []
|
99
168
|
});
|
100
169
|
}
|
101
|
-
|
102
|
-
|
103
|
-
|
170
|
+
|
171
|
+
// if (NEWLINESAFTER.indexOf(format) > -1) {
|
172
|
+
// insertNewLine(editor);
|
173
|
+
// }
|
174
|
+
|
175
|
+
convertAccordionToListItem(editor, format);
|
104
176
|
};
|
105
177
|
export const addMarkData = (editor, data) => {
|
106
178
|
try {
|
@@ -110,9 +182,14 @@ export const addMarkData = (editor, data) => {
|
|
110
182
|
}
|
111
183
|
};
|
112
184
|
export const toggleMark = (editor, format) => {
|
113
|
-
const isActive =
|
185
|
+
const isActive = isMarkBtnActive(editor, format);
|
114
186
|
if (isActive) {
|
115
|
-
|
187
|
+
const isThemeSupportedMark = textThemeFields.some(f => f === format);
|
188
|
+
if (isThemeSupportedMark) {
|
189
|
+
Editor.addMark(editor, format, false);
|
190
|
+
} else {
|
191
|
+
Editor.removeMark(editor, format);
|
192
|
+
}
|
116
193
|
} else {
|
117
194
|
Editor.addMark(editor, format, true);
|
118
195
|
}
|
@@ -126,12 +203,76 @@ export const isMarkActive = (editor, format) => {
|
|
126
203
|
return null;
|
127
204
|
}
|
128
205
|
};
|
206
|
+
export const isMarkBtnActive = (editor, format) => {
|
207
|
+
switch (format) {
|
208
|
+
case "bold":
|
209
|
+
{
|
210
|
+
const style = getSelectedElementStyle("font-weight", editor);
|
211
|
+
return style === "700";
|
212
|
+
}
|
213
|
+
case "italic":
|
214
|
+
{
|
215
|
+
const style = getSelectedElementStyle("font-style", editor);
|
216
|
+
return style === format;
|
217
|
+
}
|
218
|
+
// case "underline": {
|
219
|
+
// const style = getSelectedElementStyle("text-decoration");
|
220
|
+
|
221
|
+
// return style?.includes(format);
|
222
|
+
// }
|
223
|
+
// case "strikethrough": {
|
224
|
+
// const style = getSelectedElementStyle("text-decoration");
|
225
|
+
|
226
|
+
// return style?.includes("line-through");
|
227
|
+
// }
|
228
|
+
default:
|
229
|
+
return isMarkActive(editor, format);
|
230
|
+
}
|
231
|
+
};
|
232
|
+
export const getSelectedElementStyle = (styleProperty, editor, format) => {
|
233
|
+
try {
|
234
|
+
if (!editor.selection) {
|
235
|
+
return "";
|
236
|
+
}
|
237
|
+
if (Range.isCollapsed(editor.selection)) {
|
238
|
+
return "";
|
239
|
+
}
|
240
|
+
if (format) {
|
241
|
+
const value = activeMark(editor, format, true);
|
242
|
+
if (value) {
|
243
|
+
return value;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
const domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
247
|
+
const selectedDomNode = domRange.commonAncestorContainer;
|
248
|
+
|
249
|
+
// If it's a text node, get its parent element
|
250
|
+
const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
|
251
|
+
if (selectedElement) {
|
252
|
+
return getElementProperty(selectedElement, styleProperty);
|
253
|
+
}
|
254
|
+
} catch (err) {
|
255
|
+
console.log(err);
|
256
|
+
}
|
257
|
+
};
|
129
258
|
export const isBlockActive = (editor, format) => {
|
130
259
|
const [match] = Editor.nodes(editor, {
|
131
260
|
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
|
132
261
|
});
|
133
262
|
return !!match;
|
134
263
|
};
|
264
|
+
export const isListActive = editor => {
|
265
|
+
const list_types = ["orderedList", "unorderedList", "check-list-item", "accordion"];
|
266
|
+
const [match] = Editor.nodes(editor, {
|
267
|
+
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && list_types.includes(n.type),
|
268
|
+
mode: "lowest" // To ensure it's the closest parent
|
269
|
+
});
|
270
|
+
|
271
|
+
if (match) {
|
272
|
+
const [matchNode] = match;
|
273
|
+
return matchNode.type;
|
274
|
+
}
|
275
|
+
};
|
135
276
|
export const getBlockActive = (editor, format) => {
|
136
277
|
const [match] = Editor.nodes(editor, {
|
137
278
|
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
|
@@ -151,7 +292,7 @@ export const upateBlockActive = (editor, format, attr = {}) => {
|
|
151
292
|
});
|
152
293
|
}
|
153
294
|
};
|
154
|
-
export const activeMark = (editor, format) => {
|
295
|
+
export const activeMark = (editor, format, noDefaultValue) => {
|
155
296
|
const defaultMarkData = {
|
156
297
|
color: "#000000",
|
157
298
|
bgColor: "#FFFFFF",
|
@@ -161,7 +302,7 @@ export const activeMark = (editor, format) => {
|
|
161
302
|
};
|
162
303
|
try {
|
163
304
|
const marks = Editor.marks(editor);
|
164
|
-
let defaultValue = defaultMarkData[format];
|
305
|
+
let defaultValue = noDefaultValue ? "" : defaultMarkData[format];
|
165
306
|
const {
|
166
307
|
selection
|
167
308
|
} = editor || {};
|
@@ -178,6 +319,31 @@ export const activeMark = (editor, format) => {
|
|
178
319
|
return null;
|
179
320
|
}
|
180
321
|
};
|
322
|
+
|
323
|
+
// to avoid the styles, that automatically assign from themes
|
324
|
+
const getThemeMarkedLeaf = (leaf, children) => {
|
325
|
+
const {
|
326
|
+
italic,
|
327
|
+
bold
|
328
|
+
} = leaf || {};
|
329
|
+
const style = {};
|
330
|
+
if (italic === false) {
|
331
|
+
style.fontStyle = "normal";
|
332
|
+
}
|
333
|
+
if (bold === false) {
|
334
|
+
style.fontWeight = "normal";
|
335
|
+
}
|
336
|
+
if (Object.keys(style).length) {
|
337
|
+
children = /*#__PURE__*/_jsx(Box, {
|
338
|
+
component: "span",
|
339
|
+
sx: {
|
340
|
+
"& span": style
|
341
|
+
},
|
342
|
+
children: children
|
343
|
+
});
|
344
|
+
}
|
345
|
+
return children;
|
346
|
+
};
|
181
347
|
export const getMarked = (leaf, children, theme) => {
|
182
348
|
const className = leaf?.doublequote ? "doublequote" : "";
|
183
349
|
const lineH = leaf?.lineHeight;
|
@@ -207,6 +373,7 @@ export const getMarked = (leaf, children, theme) => {
|
|
207
373
|
children: children
|
208
374
|
});
|
209
375
|
}
|
376
|
+
children = getThemeMarkedLeaf(leaf, children);
|
210
377
|
if (leaf.strikethrough) {
|
211
378
|
children = /*#__PURE__*/_jsx("span", {
|
212
379
|
style: {
|
@@ -234,6 +401,15 @@ export const getMarked = (leaf, children, theme) => {
|
|
234
401
|
if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || lineHeight || className) {
|
235
402
|
const family = leaf?.fontFamily;
|
236
403
|
const textStyles = getTextColor(leaf?.color);
|
404
|
+
const fontSize = {
|
405
|
+
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
406
|
+
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
407
|
+
};
|
408
|
+
const fontSizesImportant = {};
|
409
|
+
Object.entries(fontSize).forEach(([key, value]) => {
|
410
|
+
fontSizesImportant[key] = `${value} !important`;
|
411
|
+
});
|
412
|
+
const fontSizeWithBreakpoints = wrapThemeBreakpoints(fontSizesImportant, "fontSize", theme);
|
237
413
|
children = /*#__PURE__*/_jsx("span", {
|
238
414
|
style: {
|
239
415
|
background: leaf.bgColor
|
@@ -242,12 +418,13 @@ export const getMarked = (leaf, children, theme) => {
|
|
242
418
|
className: `${className} leaf-item`,
|
243
419
|
component: "span",
|
244
420
|
sx: {
|
245
|
-
|
246
|
-
fontSize:
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
},
|
421
|
+
"& span": {
|
422
|
+
// fontSize: fontSizesImportant,
|
423
|
+
// ...groupByBreakpoint(fontSizesImportant, theme),
|
424
|
+
background: leaf.bgColor,
|
425
|
+
...fontSizeWithBreakpoints
|
426
|
+
},
|
427
|
+
...fontSizeWithBreakpoints,
|
251
428
|
// ...wrapThemeBreakpoints(
|
252
429
|
// {
|
253
430
|
// lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
@@ -299,6 +476,16 @@ export const getBlock = props => {
|
|
299
476
|
const {
|
300
477
|
translation
|
301
478
|
} = customProps;
|
479
|
+
const commonHeadingProps = () => ({
|
480
|
+
...attributes,
|
481
|
+
...element.attr,
|
482
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} theme-element`
|
483
|
+
});
|
484
|
+
const commonParaProps = paraType => ({
|
485
|
+
...attributes,
|
486
|
+
...element.attr,
|
487
|
+
className: `edt-paragraphs content-editable ${isEmpty ? "empty" : ""} theme-element ${paraType}`
|
488
|
+
});
|
302
489
|
const breakpoint = getDevice(window.innerWidth);
|
303
490
|
const lineH = element?.children[0]?.lineHeight;
|
304
491
|
const selectedLineHeight = getBreakpointLineSpacing(lineH, breakpoint);
|
@@ -351,6 +538,24 @@ export const getBlock = props => {
|
|
351
538
|
placeholder: translation("Heading 6"),
|
352
539
|
children: children
|
353
540
|
});
|
541
|
+
case "paragraphOne":
|
542
|
+
return /*#__PURE__*/_jsx("p", {
|
543
|
+
...commonParaProps("para1"),
|
544
|
+
placeholder: "Paragraph 1",
|
545
|
+
children: children
|
546
|
+
});
|
547
|
+
case "paragraphTwo":
|
548
|
+
return /*#__PURE__*/_jsx("p", {
|
549
|
+
...commonParaProps("para2"),
|
550
|
+
placeholder: "Paragraph 2",
|
551
|
+
children: children
|
552
|
+
});
|
553
|
+
case "paragraphThree":
|
554
|
+
return /*#__PURE__*/_jsx("p", {
|
555
|
+
...commonParaProps("para3"),
|
556
|
+
placeholder: "Paragraph 3",
|
557
|
+
children: children
|
558
|
+
});
|
354
559
|
case "blockquote":
|
355
560
|
return /*#__PURE__*/_jsx("blockquote", {
|
356
561
|
...attributes,
|
@@ -584,7 +789,8 @@ export const getBlock = props => {
|
|
584
789
|
case "docs":
|
585
790
|
case "pdf":
|
586
791
|
case "xls":
|
587
|
-
case "
|
792
|
+
case "doc":
|
793
|
+
case "ppt":
|
588
794
|
return /*#__PURE__*/_jsx(Attachments, {
|
589
795
|
...props
|
590
796
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Editor, Element, Path, Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
import { ALLOWED_TEXT_NODES, getNode, getNodeText, getNodeWithType
|
3
|
+
import { ALLOWED_TEXT_NODES, getNode, getNodeText, getNodeWithType } from "./helper";
|
4
4
|
import { isMobileWindow } from "../helper";
|
5
5
|
import { removeAccordion } from "./events";
|
6
6
|
import { ReactEditor } from "slate-react";
|
@@ -10,48 +10,76 @@ const focusAccordion = (editor, upPath) => {
|
|
10
10
|
offset: 0
|
11
11
|
});
|
12
12
|
};
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
type: "accordion",
|
13
|
+
const getAccordionNode = summaryNode => {
|
14
|
+
return {
|
15
|
+
type: "accordion",
|
16
|
+
children: [{
|
17
|
+
type: "accordion-summary",
|
18
|
+
children: summaryNode
|
19
|
+
}, {
|
20
|
+
type: "accordion-details",
|
18
21
|
children: [{
|
19
|
-
type: "
|
22
|
+
type: "paragraph",
|
20
23
|
children: [{
|
21
|
-
|
22
|
-
children: [{
|
23
|
-
text: selectedText || ""
|
24
|
-
}]
|
24
|
+
text: ""
|
25
25
|
}]
|
26
|
-
}
|
27
|
-
|
26
|
+
}]
|
27
|
+
}]
|
28
|
+
};
|
29
|
+
};
|
30
|
+
export const insertAccordion = (editor, path) => {
|
31
|
+
try {
|
32
|
+
const {
|
33
|
+
selection
|
34
|
+
} = editor;
|
35
|
+
let accordionPath;
|
36
|
+
if (path) {
|
37
|
+
const summaryNode = {
|
38
|
+
type: "paragraph",
|
28
39
|
children: [{
|
29
|
-
|
30
|
-
children: [{
|
31
|
-
text: ""
|
32
|
-
}]
|
40
|
+
text: ""
|
33
41
|
}]
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
const summaryIndex = upPath.length - 3;
|
47
|
-
upPath[summaryIndex] = upPath[summaryIndex] === 0 ? 0 : upPath[summaryIndex] - 1;
|
42
|
+
};
|
43
|
+
const accordion = getAccordionNode([summaryNode]);
|
44
|
+
Transforms.insertNodes(editor, accordion, {
|
45
|
+
at: path
|
46
|
+
});
|
47
|
+
accordionPath = path;
|
48
|
+
} else if (selection) {
|
49
|
+
const selectedNodes = Array.from(Editor.nodes(editor, {
|
50
|
+
at: selection,
|
51
|
+
match: n => Element.isElement(n),
|
52
|
+
mode: "lowest" // use 'lowest' to get individual blocks
|
53
|
+
}));
|
48
54
|
|
49
|
-
|
55
|
+
for (const [node, path] of selectedNodes) {
|
56
|
+
let currNode = node;
|
57
|
+
const isListItem = node.type === "list-item";
|
58
|
+
if (isListItem) {
|
59
|
+
currNode = {
|
60
|
+
type: "paragraph",
|
61
|
+
children: node.children
|
62
|
+
};
|
63
|
+
}
|
64
|
+
let accordion = getAccordionNode([currNode]);
|
65
|
+
Transforms.removeNodes(editor, {
|
66
|
+
at: path
|
67
|
+
});
|
68
|
+
Transforms.insertNodes(editor, accordion, {
|
69
|
+
at: path
|
70
|
+
});
|
71
|
+
accordionPath = path;
|
72
|
+
}
|
73
|
+
const lastNode = selectedNodes[selectedNodes.length - 1];
|
74
|
+
const lastNodePath = lastNode[1];
|
75
|
+
accordionPath = lastNodePath;
|
76
|
+
}
|
77
|
+
const focusPath = [...accordionPath, 0, 0, 0];
|
50
78
|
if (isMobileWindow()) {
|
51
79
|
// timeout to resolve focus issue in mobile
|
52
|
-
setTimeout(() => focusAccordion(editor,
|
80
|
+
setTimeout(() => focusAccordion(editor, focusPath), 0);
|
53
81
|
} else {
|
54
|
-
focusAccordion(editor,
|
82
|
+
focusAccordion(editor, focusPath);
|
55
83
|
}
|
56
84
|
insertNewLine(editor);
|
57
85
|
} catch (err) {
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Path, Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
import { windowVar } from "./helper";
|
4
3
|
import { getCurrentElementText } from "../plugins/withHTML";
|
5
4
|
export const insertButton = editor => {
|
6
5
|
const button = {
|
@@ -11,22 +10,7 @@ export const insertButton = editor => {
|
|
11
10
|
buttonLink: {
|
12
11
|
linkType: "webAddress"
|
13
12
|
},
|
14
|
-
iconPosition: "start"
|
15
|
-
bgColor: "#2563EB",
|
16
|
-
textColor: "#FFF",
|
17
|
-
borderRadius: {
|
18
|
-
topLeft: 30,
|
19
|
-
topRight: 30,
|
20
|
-
bottomLeft: 30,
|
21
|
-
bottomRight: 30
|
22
|
-
},
|
23
|
-
bannerSpacing: {
|
24
|
-
left: 16,
|
25
|
-
top: 8,
|
26
|
-
right: 16,
|
27
|
-
bottom: 8
|
28
|
-
},
|
29
|
-
...(windowVar.lastButtonProps || {})
|
13
|
+
iconPosition: "start"
|
30
14
|
};
|
31
15
|
const hasText = getCurrentElementText(editor);
|
32
16
|
const insertPath = hasText ? Path.next(Path.parent(editor?.selection.focus.path)) : editor?.selection.focus.path;
|
@@ -82,7 +82,8 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
|
|
82
82
|
};
|
83
83
|
export const draftToSlate = props => {
|
84
84
|
const {
|
85
|
-
data
|
85
|
+
data,
|
86
|
+
needLayout
|
86
87
|
} = props;
|
87
88
|
if (data?.blocks && data?.blocks?.length > 0) {
|
88
89
|
const converted = data?.blocks?.reduce((a, b) => {
|
@@ -104,7 +105,7 @@ export const draftToSlate = props => {
|
|
104
105
|
return data;
|
105
106
|
} else {
|
106
107
|
return [{
|
107
|
-
type: "paragraph",
|
108
|
+
type: needLayout ? "title" : "paragraph",
|
108
109
|
children: [{
|
109
110
|
text: ""
|
110
111
|
}]
|
@@ -7,43 +7,43 @@ export const sizeMap = {
|
|
7
7
|
export const fontFamilyMap = {
|
8
8
|
PoppinsRegular: "PoppinsRegular",
|
9
9
|
PoppinsBold: "PoppinsBold",
|
10
|
-
sans:
|
11
|
-
serif:
|
12
|
-
monospace:
|
13
|
-
roboto: "
|
14
|
-
qwitcher: "
|
15
|
-
garamond: "
|
16
|
-
anton: "
|
17
|
-
dmserif: "
|
18
|
-
inter: "
|
19
|
-
libre: "
|
20
|
-
montserrat: "
|
21
|
-
opensans: "
|
22
|
-
publicsans: "
|
23
|
-
raleway: "
|
24
|
-
spacemono: "
|
25
|
-
bulgarian: "
|
26
|
-
impact: "
|
27
|
-
redacted: "
|
28
|
-
greatVibes: "
|
29
|
-
zeyada: "
|
30
|
-
allura: "
|
31
|
-
pinyon: "
|
32
|
-
muellerhoff: "
|
33
|
-
dawning: "
|
10
|
+
sans: 'Helvetica, Arial, "sans serif"',
|
11
|
+
serif: 'Georgia, "Times New Roaman", serif',
|
12
|
+
monospace: 'Monaco, "Courier New", monospace',
|
13
|
+
roboto: "Roboto, sans-serif",
|
14
|
+
qwitcher: '"Qwitcher Grypen", cursive',
|
15
|
+
garamond: '"EB Garamond", serif',
|
16
|
+
anton: "Anton, sans-serif",
|
17
|
+
dmserif: '"DM Serif Text", serif',
|
18
|
+
inter: "Inter, sans-serif",
|
19
|
+
libre: '"Libre Baskerville", serif',
|
20
|
+
montserrat: "Montserrat, sans-serif",
|
21
|
+
opensans: '"Open Sans", sans-serif',
|
22
|
+
publicsans: '"Public Sans", sans-serif',
|
23
|
+
raleway: "Raleway, sans-serif",
|
24
|
+
spacemono: '"Space Mono", sans-serif',
|
25
|
+
bulgarian: '"Bulgarian Garamond", monospace',
|
26
|
+
impact: "Impact, serif",
|
27
|
+
redacted: '"Redacted Script", cursive',
|
28
|
+
greatVibes: '"Great Vibes", cursive',
|
29
|
+
zeyada: "Zeyada, cursive",
|
30
|
+
allura: "Allura, cursive",
|
31
|
+
pinyon: '"Pinyon Script", cursive',
|
32
|
+
muellerhoff: '"Herr Von Muellerhoff", cursive',
|
33
|
+
dawning: '"Dawning of a New Day", cursive',
|
34
34
|
// New Font Added for Type Signature
|
35
|
-
comingsoon: "
|
36
|
-
dancingScript: "
|
37
|
-
engagement: "
|
38
|
-
gaegu: "
|
39
|
-
ingridDarling: "
|
40
|
-
kitaOne: "
|
41
|
-
laBelleAurore: "
|
42
|
-
lobster: "
|
43
|
-
meaCulpa: "
|
44
|
-
meddon: "
|
45
|
-
merriWeather: "
|
46
|
-
theGirlNextDoor: "
|
35
|
+
comingsoon: '"Coming Soon", cursive',
|
36
|
+
dancingScript: '"Dancing Script", cursive',
|
37
|
+
engagement: "Engagement, cursive",
|
38
|
+
gaegu: "Gaegu, cursive",
|
39
|
+
ingridDarling: '"Ingrid Darling", cursive',
|
40
|
+
kitaOne: "Times",
|
41
|
+
laBelleAurore: '"La Belle Aurore", cursive',
|
42
|
+
lobster: "Lobster, cursive",
|
43
|
+
meaCulpa: '"Mea Culpa", cursive',
|
44
|
+
meddon: "Meddon, cursive",
|
45
|
+
merriWeather: "Merriweather, serif",
|
46
|
+
theGirlNextDoor: '"The Girl Next Door", cursive'
|
47
47
|
};
|
48
48
|
export const fontOptions = Object.keys(fontFamilyMap).map(m => {
|
49
49
|
return {
|
@@ -62,7 +62,10 @@ export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
|
|
62
62
|
export const headingMap = {
|
63
63
|
headingOne: "32px",
|
64
64
|
headingTwo: "24px",
|
65
|
-
headingThree: "19px"
|
65
|
+
headingThree: "19px",
|
66
|
+
headingFour: "16px",
|
67
|
+
headingFive: "13px",
|
68
|
+
headingSix: "11px"
|
66
69
|
};
|
67
70
|
export const fontWeightOptions = [{
|
68
71
|
text: "Bold",
|