@flozy/editor 10.8.8 → 10.8.9
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 +16 -17
- package/dist/Editor/CommonEditor.js +27 -138
- package/dist/Editor/DialogWrapper.js +25 -31
- package/dist/Editor/Editor.css +11 -39
- package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
- package/dist/Editor/Elements/AI/Styles.js +0 -1
- package/dist/Editor/Elements/Accordion/Accordion.js +22 -28
- package/dist/Editor/Elements/Accordion/AccordionButton.js +3 -12
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Attachments/Attachments.js +11 -153
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +3 -8
- package/dist/Editor/Elements/Button/EditorButton.js +7 -23
- 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/MultiSelect.js +454 -0
- 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 -36
- package/dist/Editor/Elements/Embed/Image.js +23 -240
- package/dist/Editor/Elements/Embed/Video.js +15 -246
- package/dist/Editor/Elements/Form/FormField.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
- package/dist/Editor/Elements/Form/Workflow/constant.js +1 -25
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +33 -39
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -7
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +0 -1
- package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -9
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -2
- 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/TopBanner/TopBanner.js +2 -4
- package/dist/Editor/Elements/TopBanner/TopBannerButton.js +3 -5
- package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
- package/dist/Editor/MiniEditor.js +1 -2
- package/dist/Editor/Styles/EditorStyles.js +5 -20
- 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 +2 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +23 -23
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +7 -25
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +8 -24
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -70
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +14 -73
- package/dist/Editor/Toolbar/PopupTool/index.js +2 -5
- package/dist/Editor/Toolbar/toolbarGroups.js +10 -56
- package/dist/Editor/common/ColorPickerButton.js +16 -38
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +0 -4
- 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/LinkSettings/NavComponents.js +2 -6
- package/dist/Editor/common/MentionsPopup/index.js +1 -9
- 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 -4
- 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 +1 -9
- 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/SwitchViewport/SwitchViewport.js +2 -11
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +18 -28
- package/dist/Editor/common/RnD/Utils/index.js +1 -3
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +58 -45
- package/dist/Editor/common/RnD/VirtualElement/helper.js +130 -320
- package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -22
- package/dist/Editor/common/RnD/index.js +13 -48
- package/dist/Editor/common/Shorthands/elements.js +4 -62
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +2 -15
- 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/card.js +8 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +0 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
- package/dist/Editor/common/StyleBuilder/index.js +4 -8
- package/dist/Editor/common/Uploader.js +17 -125
- package/dist/Editor/common/iconslist.js +0 -21
- package/dist/Editor/commonStyle.js +64 -107
- package/dist/Editor/helper/index.js +2 -10
- package/dist/Editor/helper/theme.js +2 -203
- package/dist/Editor/hooks/useMouseMove.js +3 -9
- package/dist/Editor/plugins/withEmbeds.js +1 -12
- package/dist/Editor/plugins/withHTML.js +3 -58
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/service/fileupload.js +0 -53
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +21 -183
- package/dist/Editor/utils/accordion.js +40 -68
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/events.js +89 -94
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/helper.js +21 -97
- package/dist/Editor/utils/insertAppHeader.js +4 -8
- package/package.json +4 -4
- package/dist/Editor/Elements/Attachments/AttachmentStyles.js +0 -16
- package/dist/Editor/Elements/FreeGrid/helper.js +0 -115
- 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/StyleBuilder/fieldTypes/embedUpload.js +0 -115
- package/dist/Editor/common/UploaderWithProgress.js +0 -183
- package/dist/Editor/helper/textIndeces.js +0 -58
- 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
@@ -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, groupByBreakpoint } from "../helper/theme";
|
38
38
|
import Variables from "../Elements/Variables/Variable";
|
39
|
+
import insertNewLine from "./insertNewLine";
|
39
40
|
import Divider from "../Elements/Divider/Divider";
|
40
41
|
import { getBorderColor, getSlateDom } from "./helper";
|
41
42
|
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,27 +47,17 @@ 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
|
-
import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
|
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
|
-
|
53
|
+
const list_types = ["orderedList", "unorderedList"];
|
54
54
|
const LIST_FORMAT_TYPE = {
|
55
55
|
orderedList: "list-item",
|
56
56
|
unorderedList: "list-item"
|
57
57
|
};
|
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"];
|
58
|
+
const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix"];
|
69
59
|
export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
70
|
-
|
60
|
+
const isActive = isBlockActive(editor, format);
|
71
61
|
const isList = list_types.includes(format);
|
72
62
|
const isIndent = alignment.includes(format);
|
73
63
|
const isAligned = alignment.some(alignmentType => isBlockActive(editor, alignmentType));
|
@@ -98,9 +88,8 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
98
88
|
if (!selection) {
|
99
89
|
Transforms.insertText(editor, "");
|
100
90
|
}
|
101
|
-
const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
|
102
91
|
Transforms.setNodes(editor, {
|
103
|
-
type: isActive ?
|
92
|
+
type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
|
104
93
|
...attr
|
105
94
|
});
|
106
95
|
if (isList && !isActive) {
|
@@ -109,12 +98,10 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
109
98
|
children: []
|
110
99
|
});
|
111
100
|
}
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
// }
|
101
|
+
if (NEWLINESAFTER.indexOf(format) > -1) {
|
102
|
+
insertNewLine(editor);
|
103
|
+
}
|
116
104
|
};
|
117
|
-
|
118
105
|
export const addMarkData = (editor, data) => {
|
119
106
|
try {
|
120
107
|
Editor.addMark(editor, data.format, data.value);
|
@@ -123,14 +110,9 @@ export const addMarkData = (editor, data) => {
|
|
123
110
|
}
|
124
111
|
};
|
125
112
|
export const toggleMark = (editor, format) => {
|
126
|
-
const isActive =
|
113
|
+
const isActive = isMarkActive(editor, format);
|
127
114
|
if (isActive) {
|
128
|
-
|
129
|
-
if (isThemeSupportedMark) {
|
130
|
-
Editor.addMark(editor, format, false);
|
131
|
-
} else {
|
132
|
-
Editor.removeMark(editor, format);
|
133
|
-
}
|
115
|
+
Editor.removeMark(editor, format);
|
134
116
|
} else {
|
135
117
|
Editor.addMark(editor, format, true);
|
136
118
|
}
|
@@ -144,91 +126,12 @@ export const isMarkActive = (editor, format) => {
|
|
144
126
|
return null;
|
145
127
|
}
|
146
128
|
};
|
147
|
-
export const isMarkBtnActive = (editor, format) => {
|
148
|
-
switch (format) {
|
149
|
-
case "bold":
|
150
|
-
{
|
151
|
-
const style = getSelectedElementStyle("font-weight", editor);
|
152
|
-
return style === "700";
|
153
|
-
}
|
154
|
-
case "italic":
|
155
|
-
{
|
156
|
-
const style = getSelectedElementStyle("font-style", editor);
|
157
|
-
return style === format;
|
158
|
-
}
|
159
|
-
// case "underline": {
|
160
|
-
// const style = getSelectedElementStyle("text-decoration");
|
161
|
-
|
162
|
-
// return style?.includes(format);
|
163
|
-
// }
|
164
|
-
// case "strikethrough": {
|
165
|
-
// const style = getSelectedElementStyle("text-decoration");
|
166
|
-
|
167
|
-
// return style?.includes("line-through");
|
168
|
-
// }
|
169
|
-
default:
|
170
|
-
return isMarkActive(editor, format);
|
171
|
-
}
|
172
|
-
};
|
173
|
-
export const getSelectedElementStyle = (styleProperty, editor, format) => {
|
174
|
-
try {
|
175
|
-
if (!editor.selection) {
|
176
|
-
return "";
|
177
|
-
}
|
178
|
-
if (Range.isCollapsed(editor.selection)) {
|
179
|
-
return "";
|
180
|
-
}
|
181
|
-
if (format) {
|
182
|
-
const value = activeMark(editor, format, true);
|
183
|
-
if (value) {
|
184
|
-
return value;
|
185
|
-
}
|
186
|
-
}
|
187
|
-
const domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
188
|
-
const selectedDomNode = domRange.commonAncestorContainer;
|
189
|
-
|
190
|
-
// If it's a text node, get its parent element
|
191
|
-
const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
|
192
|
-
if (selectedElement) {
|
193
|
-
return getElementProperty(selectedElement, styleProperty);
|
194
|
-
}
|
195
|
-
} catch (err) {
|
196
|
-
console.log(err);
|
197
|
-
}
|
198
|
-
};
|
199
129
|
export const isBlockActive = (editor, format) => {
|
200
130
|
const [match] = Editor.nodes(editor, {
|
201
131
|
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
|
202
132
|
});
|
203
133
|
return !!match;
|
204
134
|
};
|
205
|
-
export const isListActive = editor => {
|
206
|
-
const list_types = ["orderedList", "unorderedList", "check-list-item", "accordion"];
|
207
|
-
const [match] = Editor.nodes(editor, {
|
208
|
-
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && list_types.includes(n.type),
|
209
|
-
mode: "lowest" // To ensure it's the closest parent
|
210
|
-
});
|
211
|
-
|
212
|
-
if (match) {
|
213
|
-
const [matchNode] = match;
|
214
|
-
return matchNode.type;
|
215
|
-
}
|
216
|
-
};
|
217
|
-
export const getListType = editor => {
|
218
|
-
const [accordionSummary] = Editor.nodes(editor, {
|
219
|
-
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === "accordion-summary"
|
220
|
-
});
|
221
|
-
if (accordionSummary) {
|
222
|
-
return "accordion-summary";
|
223
|
-
}
|
224
|
-
const listItems = ["list-item", "check-list-item"];
|
225
|
-
const [listItem] = Editor.nodes(editor, {
|
226
|
-
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && listItems.includes(n.type)
|
227
|
-
});
|
228
|
-
if (listItem) {
|
229
|
-
return "list-item";
|
230
|
-
}
|
231
|
-
};
|
232
135
|
export const getBlockActive = (editor, format) => {
|
233
136
|
const [match] = Editor.nodes(editor, {
|
234
137
|
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
|
@@ -248,7 +151,7 @@ export const upateBlockActive = (editor, format, attr = {}) => {
|
|
248
151
|
});
|
249
152
|
}
|
250
153
|
};
|
251
|
-
export const activeMark = (editor, format
|
154
|
+
export const activeMark = (editor, format) => {
|
252
155
|
const defaultMarkData = {
|
253
156
|
color: "#000000",
|
254
157
|
bgColor: "#FFFFFF",
|
@@ -258,7 +161,7 @@ export const activeMark = (editor, format, noDefaultValue) => {
|
|
258
161
|
};
|
259
162
|
try {
|
260
163
|
const marks = Editor.marks(editor);
|
261
|
-
let defaultValue =
|
164
|
+
let defaultValue = defaultMarkData[format];
|
262
165
|
const {
|
263
166
|
selection
|
264
167
|
} = editor || {};
|
@@ -275,31 +178,6 @@ export const activeMark = (editor, format, noDefaultValue) => {
|
|
275
178
|
return null;
|
276
179
|
}
|
277
180
|
};
|
278
|
-
|
279
|
-
// to avoid the styles, that automatically assign from themes
|
280
|
-
const getThemeMarkedLeaf = (leaf, children) => {
|
281
|
-
const {
|
282
|
-
italic,
|
283
|
-
bold
|
284
|
-
} = leaf || {};
|
285
|
-
const style = {};
|
286
|
-
if (italic === false) {
|
287
|
-
style.fontStyle = "normal";
|
288
|
-
}
|
289
|
-
if (bold === false) {
|
290
|
-
style.fontWeight = "normal";
|
291
|
-
}
|
292
|
-
if (Object.keys(style).length) {
|
293
|
-
children = /*#__PURE__*/_jsx(Box, {
|
294
|
-
component: "span",
|
295
|
-
sx: {
|
296
|
-
"& span": style
|
297
|
-
},
|
298
|
-
children: children
|
299
|
-
});
|
300
|
-
}
|
301
|
-
return children;
|
302
|
-
};
|
303
181
|
export const getMarked = (leaf, children, theme) => {
|
304
182
|
const className = leaf?.doublequote ? "doublequote" : "";
|
305
183
|
const lineH = leaf?.lineHeight;
|
@@ -329,7 +207,6 @@ export const getMarked = (leaf, children, theme) => {
|
|
329
207
|
children: children
|
330
208
|
});
|
331
209
|
}
|
332
|
-
children = getThemeMarkedLeaf(leaf, children);
|
333
210
|
if (leaf.strikethrough) {
|
334
211
|
children = /*#__PURE__*/_jsx("span", {
|
335
212
|
style: {
|
@@ -357,15 +234,6 @@ export const getMarked = (leaf, children, theme) => {
|
|
357
234
|
if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || lineHeight || className) {
|
358
235
|
const family = leaf?.fontFamily;
|
359
236
|
const textStyles = getTextColor(leaf?.color);
|
360
|
-
const fontSize = {
|
361
|
-
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
362
|
-
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
363
|
-
};
|
364
|
-
const fontSizesImportant = {};
|
365
|
-
Object.entries(fontSize).forEach(([key, value]) => {
|
366
|
-
fontSizesImportant[key] = `${value} !important`;
|
367
|
-
});
|
368
|
-
const fontSizeWithBreakpoints = wrapThemeBreakpoints(fontSizesImportant, "fontSize", theme);
|
369
237
|
children = /*#__PURE__*/_jsx("span", {
|
370
238
|
style: {
|
371
239
|
background: leaf.bgColor
|
@@ -374,13 +242,12 @@ export const getMarked = (leaf, children, theme) => {
|
|
374
242
|
className: `${className} leaf-item`,
|
375
243
|
component: "span",
|
376
244
|
sx: {
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
},
|
383
|
-
...fontSizeWithBreakpoints,
|
245
|
+
...groupByBreakpoint({
|
246
|
+
fontSize: {
|
247
|
+
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
248
|
+
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
249
|
+
}
|
250
|
+
}, theme),
|
384
251
|
// ...wrapThemeBreakpoints(
|
385
252
|
// {
|
386
253
|
// lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
@@ -432,16 +299,6 @@ export const getBlock = props => {
|
|
432
299
|
const {
|
433
300
|
translation
|
434
301
|
} = customProps;
|
435
|
-
const commonHeadingProps = () => ({
|
436
|
-
...attributes,
|
437
|
-
...element.attr,
|
438
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} theme-element`
|
439
|
-
});
|
440
|
-
const commonParaProps = paraType => ({
|
441
|
-
...attributes,
|
442
|
-
...element.attr,
|
443
|
-
className: `edt-paragraphs content-editable ${isEmpty ? "empty" : ""} theme-element ${paraType}`
|
444
|
-
});
|
445
302
|
const breakpoint = getDevice(window.innerWidth);
|
446
303
|
const lineH = element?.children[0]?.lineHeight;
|
447
304
|
const selectedLineHeight = getBreakpointLineSpacing(lineH, breakpoint);
|
@@ -494,24 +351,6 @@ export const getBlock = props => {
|
|
494
351
|
placeholder: translation("Heading 6"),
|
495
352
|
children: children
|
496
353
|
});
|
497
|
-
case "paragraphOne":
|
498
|
-
return /*#__PURE__*/_jsx("p", {
|
499
|
-
...commonParaProps("para1"),
|
500
|
-
placeholder: "Paragraph 1",
|
501
|
-
children: children
|
502
|
-
});
|
503
|
-
case "paragraphTwo":
|
504
|
-
return /*#__PURE__*/_jsx("p", {
|
505
|
-
...commonParaProps("para2"),
|
506
|
-
placeholder: "Paragraph 2",
|
507
|
-
children: children
|
508
|
-
});
|
509
|
-
case "paragraphThree":
|
510
|
-
return /*#__PURE__*/_jsx("p", {
|
511
|
-
...commonParaProps("para3"),
|
512
|
-
placeholder: "Paragraph 3",
|
513
|
-
children: children
|
514
|
-
});
|
515
354
|
case "blockquote":
|
516
355
|
return /*#__PURE__*/_jsx("blockquote", {
|
517
356
|
...attributes,
|
@@ -745,8 +584,7 @@ export const getBlock = props => {
|
|
745
584
|
case "docs":
|
746
585
|
case "pdf":
|
747
586
|
case "xls":
|
748
|
-
case "
|
749
|
-
case "ppt":
|
587
|
+
case "csv":
|
750
588
|
return /*#__PURE__*/_jsx(Attachments, {
|
751
589
|
...props
|
752
590
|
});
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { Editor, Element, Path, Transforms } from "slate";
|
2
|
-
import
|
2
|
+
import insertNewLine from "./insertNewLine";
|
3
|
+
import { ALLOWED_TEXT_NODES, getNode, getNodeText, getNodeWithType, getSelectedText } from "./helper";
|
4
|
+
import { isMobileWindow } from "../helper";
|
3
5
|
import { removeAccordion } from "./events";
|
4
6
|
import { ReactEditor } from "slate-react";
|
5
7
|
const focusAccordion = (editor, upPath) => {
|
@@ -7,74 +9,51 @@ const focusAccordion = (editor, upPath) => {
|
|
7
9
|
path: upPath,
|
8
10
|
offset: 0
|
9
11
|
});
|
10
|
-
ReactEditor.focus(editor);
|
11
12
|
};
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
type: "accordion
|
17
|
-
children: summaryNode
|
18
|
-
}, {
|
19
|
-
type: "accordion-details",
|
13
|
+
export const insertAccordion = (editor, path) => {
|
14
|
+
try {
|
15
|
+
const selectedText = getSelectedText(editor);
|
16
|
+
const accordion = {
|
17
|
+
type: "accordion",
|
20
18
|
children: [{
|
21
|
-
type: "
|
19
|
+
type: "accordion-summary",
|
22
20
|
children: [{
|
23
|
-
|
21
|
+
type: "paragraph",
|
22
|
+
children: [{
|
23
|
+
text: selectedText || ""
|
24
|
+
}]
|
24
25
|
}]
|
25
|
-
}
|
26
|
-
|
27
|
-
};
|
28
|
-
};
|
29
|
-
export const insertAccordion = (editor, path) => {
|
30
|
-
try {
|
31
|
-
const {
|
32
|
-
selection
|
33
|
-
} = editor;
|
34
|
-
let accordionPath;
|
35
|
-
if (path) {
|
36
|
-
const summaryNode = {
|
37
|
-
type: "paragraph",
|
26
|
+
}, {
|
27
|
+
type: "accordion-details",
|
38
28
|
children: [{
|
39
|
-
|
29
|
+
type: "paragraph",
|
30
|
+
children: [{
|
31
|
+
text: ""
|
32
|
+
}]
|
40
33
|
}]
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
// const isListItem = node.type === "list-item";
|
56
|
-
// if (isListItem) {
|
57
|
-
// currNode = {
|
58
|
-
// type: "paragraph",
|
59
|
-
// children: node.children,
|
60
|
-
// };
|
61
|
-
// }
|
34
|
+
}]
|
35
|
+
};
|
36
|
+
const props = path ? {
|
37
|
+
at: path,
|
38
|
+
select: true
|
39
|
+
} : {
|
40
|
+
select: true
|
41
|
+
};
|
42
|
+
Transforms.insertNodes(editor, accordion, props);
|
43
|
+
const curPath = [...editor?.selection?.anchor?.path];
|
44
|
+
const upPath = [...curPath];
|
45
|
+
// get title index
|
46
|
+
const summaryIndex = upPath.length - 3;
|
47
|
+
upPath[summaryIndex] = upPath[summaryIndex] === 0 ? 0 : upPath[summaryIndex] - 1;
|
62
48
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
});
|
70
|
-
accordionPath = path;
|
71
|
-
}
|
72
|
-
const lastNode = selectedNodes[selectedNodes.length - 1];
|
73
|
-
const lastNodePath = lastNode[1];
|
74
|
-
accordionPath = lastNodePath;
|
49
|
+
// select accordion title by default
|
50
|
+
if (isMobileWindow()) {
|
51
|
+
// timeout to resolve focus issue in mobile
|
52
|
+
setTimeout(() => focusAccordion(editor, upPath), 0);
|
53
|
+
} else {
|
54
|
+
focusAccordion(editor, upPath);
|
75
55
|
}
|
76
|
-
|
77
|
-
focusAccordion(editor, focusPath);
|
56
|
+
insertNewLine(editor);
|
78
57
|
} catch (err) {
|
79
58
|
console.log(err);
|
80
59
|
}
|
@@ -154,11 +133,4 @@ export const onDeleteBackwardAccordion = editor => {
|
|
154
133
|
} catch (err) {
|
155
134
|
console.log(err);
|
156
135
|
}
|
157
|
-
};
|
158
|
-
export const toggleAccordion = editor => {
|
159
|
-
const parentAccordion = Editor.above(editor, {
|
160
|
-
match: node => Element.isElement(node) && node.type === "accordion"
|
161
|
-
});
|
162
|
-
const [, accordionPath] = parentAccordion;
|
163
|
-
removeAccordion(editor, accordionPath);
|
164
136
|
};
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Path, Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
+
import { windowVar } from "./helper";
|
3
4
|
import { getCurrentElementText } from "../plugins/withHTML";
|
4
5
|
export const insertButton = editor => {
|
5
6
|
const button = {
|
@@ -10,7 +11,22 @@ export const insertButton = editor => {
|
|
10
11
|
buttonLink: {
|
11
12
|
linkType: "webAddress"
|
12
13
|
},
|
13
|
-
iconPosition: "start"
|
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 || {})
|
14
30
|
};
|
15
31
|
const hasText = getCurrentElementText(editor);
|
16
32
|
const insertPath = hasText ? Path.next(Path.parent(editor?.selection.focus.path)) : editor?.selection.focus.path;
|
@@ -82,8 +82,7 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
|
|
82
82
|
};
|
83
83
|
export const draftToSlate = props => {
|
84
84
|
const {
|
85
|
-
data
|
86
|
-
needLayout
|
85
|
+
data
|
87
86
|
} = props;
|
88
87
|
if (data?.blocks && data?.blocks?.length > 0) {
|
89
88
|
const converted = data?.blocks?.reduce((a, b) => {
|
@@ -105,7 +104,7 @@ export const draftToSlate = props => {
|
|
105
104
|
return data;
|
106
105
|
} else {
|
107
106
|
return [{
|
108
|
-
type:
|
107
|
+
type: "paragraph",
|
109
108
|
children: [{
|
110
109
|
text: ""
|
111
110
|
}]
|