@flozy/editor 10.6.4 → 10.6.5
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 +14 -129
- package/dist/Editor/DialogWrapper.js +25 -31
- package/dist/Editor/Editor.css +11 -57
- 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 +9 -45
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +23 -1
- package/dist/Editor/Elements/AppHeader/AppHeader.js +5 -10
- package/dist/Editor/Elements/Button/EditorButton.js +10 -26
- package/dist/Editor/Elements/Carousel/CarouselItem.js +1 -2
- 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/{SelectV1.js → MultiSelect.js} +69 -125
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +10 -10
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +9 -28
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +5 -12
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +14 -40
- package/dist/Editor/Elements/Divider/Divider.js +1 -1
- package/dist/Editor/Elements/Embed/Embed.css +0 -4
- package/dist/Editor/Elements/Embed/Video.js +1 -1
- package/dist/Editor/Elements/Form/Form.js +3 -3
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -0
- package/dist/Editor/Elements/Form/FormField.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +31 -35
- 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/Options/sectionItemOptions.js +1 -1
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -14
- package/dist/Editor/Elements/Grid/Grid.js +2 -14
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/Signature/Signature.css +1 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +5 -18
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +3 -16
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/AddRowCol.js +2 -8
- package/dist/Editor/Elements/Table/DragButton.js +1 -0
- package/dist/Editor/Elements/Table/Draggable.js +2 -6
- package/dist/Editor/Elements/Table/Styles.js +0 -7
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Table/TableCell.js +5 -24
- package/dist/Editor/Elements/Title/title.js +11 -8
- package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
- package/dist/Editor/MiniEditor.js +1 -2
- package/dist/Editor/Styles/EditorStyles.js +4 -4
- 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 +13 -10
- 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 +13 -6
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -7
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +13 -73
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +10 -58
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -12
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
- package/dist/Editor/common/ColorPickerButton.js +16 -41
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
- package/dist/Editor/common/Icon.js +0 -28
- package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
- package/dist/Editor/common/ImageSelector/Styles.js +9 -3
- package/dist/Editor/common/LinkSettings/NavComponents.js +63 -47
- package/dist/Editor/common/LinkSettings/index.js +28 -17
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
- package/dist/Editor/common/LinkSettings/style.js +244 -164
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +5 -4
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +3 -4
- 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 +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +1 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
- package/dist/Editor/common/RnD/OptionsPopup/style.js +1 -0
- 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 +19 -28
- package/dist/Editor/common/RnD/Utils/index.js +25 -58
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +58 -42
- package/dist/Editor/common/RnD/VirtualElement/helper.js +132 -323
- package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -16
- package/dist/Editor/common/RnD/index.js +38 -72
- package/dist/Editor/common/Select/index.js +7 -44
- package/dist/Editor/common/Select/styles.js +2 -30
- package/dist/Editor/common/Shorthands/elements.js +0 -54
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +9 -12
- 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 +0 -5
- 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/SwipeableDrawer/style.js +12 -14
- package/dist/Editor/common/Uploader.js +0 -16
- package/dist/Editor/common/iconListV2.js +0 -76
- package/dist/Editor/common/iconslist.js +0 -21
- package/dist/Editor/commonStyle.js +61 -116
- package/dist/Editor/helper/deserialize/index.js +4 -6
- package/dist/Editor/helper/index.js +2 -6
- package/dist/Editor/helper/theme.js +2 -203
- package/dist/Editor/hooks/useMouseMove.js +3 -9
- package/dist/Editor/hooks/useTable.js +4 -5
- package/dist/Editor/plugins/withCustomDeleteBackward.js +1 -6
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +5 -14
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +50 -173
- package/dist/Editor/utils/accordion.js +37 -158
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/customHooks/useTableResize.js +9 -49
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/events.js +6 -18
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/formfield.js +0 -1
- package/dist/Editor/utils/helper.js +30 -149
- package/dist/Editor/utils/insertAppHeader.js +5 -9
- package/dist/Editor/utils/signature.js +9 -2
- package/package.json +4 -4
- 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/Checkbox/index.js +0 -46
- package/dist/Editor/common/Checkbox/styles.js +0 -45
- 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/RadioGroup/index.js +0 -48
- package/dist/Editor/common/RadioGroup/styles.js +0 -29
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
- package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +0 -115
- 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
- package/dist/Editor/utils/updateFormName.js +0 -22
@@ -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,25 +47,16 @@ 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
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
52
53
|
const alignment = ["alignLeft", "alignRight", "alignCenter", "alignJustify"];
|
53
54
|
const list_types = ["orderedList", "unorderedList"];
|
54
55
|
const LIST_FORMAT_TYPE = {
|
55
56
|
orderedList: "list-item",
|
56
57
|
unorderedList: "list-item"
|
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"];
|
59
|
+
const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix"];
|
69
60
|
export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
70
61
|
const isActive = isBlockActive(editor, format);
|
71
62
|
const isList = list_types.includes(format);
|
@@ -98,9 +89,8 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
98
89
|
if (!selection) {
|
99
90
|
Transforms.insertText(editor, "");
|
100
91
|
}
|
101
|
-
const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
|
102
92
|
Transforms.setNodes(editor, {
|
103
|
-
type: isActive ?
|
93
|
+
type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
|
104
94
|
...attr
|
105
95
|
});
|
106
96
|
if (isList && !isActive) {
|
@@ -109,12 +99,10 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
109
99
|
children: []
|
110
100
|
});
|
111
101
|
}
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
// }
|
102
|
+
if (NEWLINESAFTER.indexOf(format) > -1) {
|
103
|
+
insertNewLine(editor);
|
104
|
+
}
|
116
105
|
};
|
117
|
-
|
118
106
|
export const addMarkData = (editor, data) => {
|
119
107
|
try {
|
120
108
|
Editor.addMark(editor, data.format, data.value);
|
@@ -123,14 +111,9 @@ export const addMarkData = (editor, data) => {
|
|
123
111
|
}
|
124
112
|
};
|
125
113
|
export const toggleMark = (editor, format) => {
|
126
|
-
const isActive =
|
114
|
+
const isActive = isMarkActive(editor, format);
|
127
115
|
if (isActive) {
|
128
|
-
|
129
|
-
if (isThemeSupportedMark) {
|
130
|
-
Editor.addMark(editor, format, false);
|
131
|
-
} else {
|
132
|
-
Editor.removeMark(editor, format);
|
133
|
-
}
|
116
|
+
Editor.removeMark(editor, format);
|
134
117
|
} else {
|
135
118
|
Editor.addMark(editor, format, true);
|
136
119
|
}
|
@@ -144,58 +127,6 @@ export const isMarkActive = (editor, format) => {
|
|
144
127
|
return null;
|
145
128
|
}
|
146
129
|
};
|
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
130
|
export const isBlockActive = (editor, format) => {
|
200
131
|
const [match] = Editor.nodes(editor, {
|
201
132
|
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
|
@@ -221,7 +152,7 @@ export const upateBlockActive = (editor, format, attr = {}) => {
|
|
221
152
|
});
|
222
153
|
}
|
223
154
|
};
|
224
|
-
export const activeMark = (editor, format
|
155
|
+
export const activeMark = (editor, format) => {
|
225
156
|
const defaultMarkData = {
|
226
157
|
color: "#000000",
|
227
158
|
bgColor: "#FFFFFF",
|
@@ -231,7 +162,7 @@ export const activeMark = (editor, format, noDefaultValue) => {
|
|
231
162
|
};
|
232
163
|
try {
|
233
164
|
const marks = Editor.marks(editor);
|
234
|
-
let defaultValue =
|
165
|
+
let defaultValue = defaultMarkData[format];
|
235
166
|
const {
|
236
167
|
selection
|
237
168
|
} = editor || {};
|
@@ -248,31 +179,6 @@ export const activeMark = (editor, format, noDefaultValue) => {
|
|
248
179
|
return null;
|
249
180
|
}
|
250
181
|
};
|
251
|
-
|
252
|
-
// to avoid the styles, that automatically assign from themes
|
253
|
-
const getThemeMarkedLeaf = (leaf, children) => {
|
254
|
-
const {
|
255
|
-
italic,
|
256
|
-
bold
|
257
|
-
} = leaf || {};
|
258
|
-
const style = {};
|
259
|
-
if (italic === false) {
|
260
|
-
style.fontStyle = "normal";
|
261
|
-
}
|
262
|
-
if (bold === false) {
|
263
|
-
style.fontWeight = "normal";
|
264
|
-
}
|
265
|
-
if (Object.keys(style).length) {
|
266
|
-
children = /*#__PURE__*/_jsx(Box, {
|
267
|
-
component: "span",
|
268
|
-
sx: {
|
269
|
-
"& span": style
|
270
|
-
},
|
271
|
-
children: children
|
272
|
-
});
|
273
|
-
}
|
274
|
-
return children;
|
275
|
-
};
|
276
182
|
export const getMarked = (leaf, children, theme) => {
|
277
183
|
const className = leaf?.doublequote ? "doublequote" : "";
|
278
184
|
const lineH = leaf?.lineHeight;
|
@@ -302,7 +208,6 @@ export const getMarked = (leaf, children, theme) => {
|
|
302
208
|
children: children
|
303
209
|
});
|
304
210
|
}
|
305
|
-
children = getThemeMarkedLeaf(leaf, children);
|
306
211
|
if (leaf.strikethrough) {
|
307
212
|
children = /*#__PURE__*/_jsx("span", {
|
308
213
|
style: {
|
@@ -330,15 +235,6 @@ export const getMarked = (leaf, children, theme) => {
|
|
330
235
|
if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || lineHeight || className) {
|
331
236
|
const family = leaf?.fontFamily;
|
332
237
|
const textStyles = getTextColor(leaf?.color);
|
333
|
-
const fontSize = {
|
334
|
-
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
335
|
-
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
336
|
-
};
|
337
|
-
const fontSizesImportant = {};
|
338
|
-
Object.entries(fontSize).forEach(([key, value]) => {
|
339
|
-
fontSizesImportant[key] = `${value} !important`;
|
340
|
-
});
|
341
|
-
const fontSizeWithBreakpoints = wrapThemeBreakpoints(fontSizesImportant, "fontSize", theme);
|
342
238
|
children = /*#__PURE__*/_jsx("span", {
|
343
239
|
style: {
|
344
240
|
background: leaf.bgColor
|
@@ -347,13 +243,12 @@ export const getMarked = (leaf, children, theme) => {
|
|
347
243
|
className: `${className} leaf-item`,
|
348
244
|
component: "span",
|
349
245
|
sx: {
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
},
|
356
|
-
...fontSizeWithBreakpoints,
|
246
|
+
...groupByBreakpoint({
|
247
|
+
fontSize: {
|
248
|
+
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
249
|
+
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
250
|
+
}
|
251
|
+
}, theme),
|
357
252
|
// ...wrapThemeBreakpoints(
|
358
253
|
// {
|
359
254
|
// lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
@@ -405,85 +300,69 @@ export const getBlock = props => {
|
|
405
300
|
const {
|
406
301
|
translation
|
407
302
|
} = customProps;
|
408
|
-
const commonHeadingProps = () => ({
|
409
|
-
...attributes,
|
410
|
-
...element.attr,
|
411
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} theme-element`
|
412
|
-
});
|
413
|
-
const commonParaProps = paraType => ({
|
414
|
-
...attributes,
|
415
|
-
...element.attr,
|
416
|
-
className: `edt-paragraphs content-editable ${isEmpty ? "empty" : ""} theme-element ${paraType}`
|
417
|
-
});
|
418
303
|
const breakpoint = getDevice(window.innerWidth);
|
419
304
|
const lineH = element?.children[0]?.lineHeight;
|
420
305
|
const selectedLineHeight = getBreakpointLineSpacing(lineH, breakpoint);
|
421
306
|
switch (element.type) {
|
422
307
|
case "headingOne":
|
423
|
-
return /*#__PURE__*/
|
308
|
+
return /*#__PURE__*/_jsxs("h1", {
|
424
309
|
...attributes,
|
425
310
|
...element.attr,
|
426
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}
|
311
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
427
312
|
placeholder: translation("Heading 1"),
|
428
|
-
children: children
|
313
|
+
children: [children, /*#__PURE__*/_jsx("span", {
|
314
|
+
contentEditable: false
|
315
|
+
})]
|
429
316
|
});
|
430
317
|
case "headingTwo":
|
431
|
-
return /*#__PURE__*/
|
318
|
+
return /*#__PURE__*/_jsxs("h2", {
|
432
319
|
...attributes,
|
433
320
|
...element.attr,
|
434
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}
|
321
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
435
322
|
placeholder: translation("Heading 2"),
|
436
|
-
children: children
|
323
|
+
children: [children, /*#__PURE__*/_jsx("span", {
|
324
|
+
contentEditable: false
|
325
|
+
})]
|
437
326
|
});
|
438
327
|
case "headingThree":
|
439
|
-
return /*#__PURE__*/
|
328
|
+
return /*#__PURE__*/_jsxs("h3", {
|
440
329
|
...attributes,
|
441
330
|
...element.attr,
|
442
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}
|
331
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
443
332
|
placeholder: translation("Heading 3"),
|
444
|
-
children: children
|
333
|
+
children: [children, /*#__PURE__*/_jsx("span", {
|
334
|
+
contentEditable: false
|
335
|
+
})]
|
445
336
|
});
|
446
337
|
case "headingFour":
|
447
|
-
return /*#__PURE__*/
|
338
|
+
return /*#__PURE__*/_jsxs("h4", {
|
448
339
|
...attributes,
|
449
340
|
...element.attr,
|
450
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}
|
341
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
451
342
|
placeholder: translation("Heading 4"),
|
452
|
-
children: children
|
343
|
+
children: [children, /*#__PURE__*/_jsx("span", {
|
344
|
+
contentEditable: false
|
345
|
+
})]
|
453
346
|
});
|
454
347
|
case "headingFive":
|
455
|
-
return /*#__PURE__*/
|
348
|
+
return /*#__PURE__*/_jsxs("h5", {
|
456
349
|
...attributes,
|
457
350
|
...element.attr,
|
458
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}
|
351
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
459
352
|
placeholder: translation("Heading 5"),
|
460
|
-
children: children
|
353
|
+
children: [children, /*#__PURE__*/_jsx("span", {
|
354
|
+
contentEditable: false
|
355
|
+
})]
|
461
356
|
});
|
462
357
|
case "headingSix":
|
463
|
-
return /*#__PURE__*/
|
358
|
+
return /*#__PURE__*/_jsxs("h6", {
|
464
359
|
...attributes,
|
465
360
|
...element.attr,
|
466
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}
|
361
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
467
362
|
placeholder: translation("Heading 6"),
|
468
|
-
children: children
|
469
|
-
|
470
|
-
|
471
|
-
return /*#__PURE__*/_jsx("p", {
|
472
|
-
...commonParaProps("para1"),
|
473
|
-
placeholder: "Paragraph 1",
|
474
|
-
children: children
|
475
|
-
});
|
476
|
-
case "paragraphTwo":
|
477
|
-
return /*#__PURE__*/_jsx("p", {
|
478
|
-
...commonParaProps("para2"),
|
479
|
-
placeholder: "Paragraph 2",
|
480
|
-
children: children
|
481
|
-
});
|
482
|
-
case "paragraphThree":
|
483
|
-
return /*#__PURE__*/_jsx("p", {
|
484
|
-
...commonParaProps("para3"),
|
485
|
-
placeholder: "Paragraph 3",
|
486
|
-
children: children
|
363
|
+
children: [children, /*#__PURE__*/_jsx("span", {
|
364
|
+
contentEditable: false
|
365
|
+
})]
|
487
366
|
});
|
488
367
|
case "blockquote":
|
489
368
|
return /*#__PURE__*/_jsx("blockquote", {
|
@@ -793,10 +672,8 @@ export const getQueryStrings = urlString => {
|
|
793
672
|
const newUrl = new URL(urlString);
|
794
673
|
var youCode = newUrl.searchParams.get("v");
|
795
674
|
if (!youCode) {
|
796
|
-
|
797
|
-
youCode = parts[parts.length - 1]; // video ID
|
675
|
+
youCode = newUrl.pathname.replace("/", "");
|
798
676
|
}
|
799
|
-
|
800
677
|
return `https://www.youtube.com/embed/${youCode}`;
|
801
678
|
} else {
|
802
679
|
return urlString;
|
@@ -1,169 +1,48 @@
|
|
1
|
-
import {
|
1
|
+
import { Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const
|
8
|
-
|
9
|
-
path: upPath,
|
10
|
-
offset: 0
|
11
|
-
});
|
12
|
-
};
|
13
|
-
const getAccordionNode = summaryNode => {
|
14
|
-
return {
|
15
|
-
type: "accordion",
|
16
|
-
children: [{
|
17
|
-
type: "accordion-summary",
|
18
|
-
children: summaryNode
|
19
|
-
}, {
|
20
|
-
type: "accordion-details",
|
3
|
+
import { getSelectedText } from "./helper";
|
4
|
+
export const insertAccordion = (editor, path) => {
|
5
|
+
try {
|
6
|
+
const selectedText = getSelectedText(editor);
|
7
|
+
const accordion = {
|
8
|
+
type: "accordion",
|
21
9
|
children: [{
|
22
|
-
type: "
|
10
|
+
type: "accordion-summary",
|
23
11
|
children: [{
|
24
|
-
|
12
|
+
type: "paragraph",
|
13
|
+
children: [{
|
14
|
+
text: selectedText || ""
|
15
|
+
}]
|
25
16
|
}]
|
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",
|
17
|
+
}, {
|
18
|
+
type: "accordion-details",
|
39
19
|
children: [{
|
40
|
-
|
20
|
+
type: "paragraph",
|
21
|
+
children: [{
|
22
|
+
text: ""
|
23
|
+
}]
|
41
24
|
}]
|
42
|
-
}
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
children: node.children
|
62
|
-
};
|
63
|
-
}
|
64
|
-
let accordion = getAccordionNode([currNode]);
|
65
|
-
if (isListItem) {
|
66
|
-
accordion = {
|
67
|
-
type: "list-item",
|
68
|
-
children: [accordion]
|
69
|
-
};
|
70
|
-
}
|
71
|
-
Transforms.removeNodes(editor, {
|
72
|
-
at: path
|
73
|
-
});
|
74
|
-
Transforms.insertNodes(editor, accordion, {
|
75
|
-
at: path
|
76
|
-
});
|
77
|
-
}
|
78
|
-
const lastNode = selectedNodes[selectedNodes.length - 1];
|
79
|
-
const lastNodePath = lastNode[1];
|
80
|
-
accordionPath = lastNodePath;
|
81
|
-
}
|
82
|
-
const focusPath = [...accordionPath, 0, 0, 0];
|
83
|
-
if (isMobileWindow()) {
|
84
|
-
// timeout to resolve focus issue in mobile
|
85
|
-
setTimeout(() => focusAccordion(editor, focusPath), 0);
|
86
|
-
} else {
|
87
|
-
focusAccordion(editor, focusPath);
|
88
|
-
}
|
25
|
+
}]
|
26
|
+
};
|
27
|
+
const props = path ? {
|
28
|
+
at: path,
|
29
|
+
select: true
|
30
|
+
} : {
|
31
|
+
select: true
|
32
|
+
};
|
33
|
+
Transforms.insertNodes(editor, accordion, props);
|
34
|
+
const curPath = [...editor?.selection?.anchor?.path];
|
35
|
+
const upPath = [...curPath];
|
36
|
+
// get title index
|
37
|
+
const summaryIndex = upPath.length - 3;
|
38
|
+
upPath[summaryIndex] = upPath[summaryIndex] === 0 ? 0 : upPath[summaryIndex] - 1;
|
39
|
+
// select accordion title by default
|
40
|
+
Transforms.select(editor, {
|
41
|
+
path: upPath,
|
42
|
+
offset: 0
|
43
|
+
});
|
89
44
|
insertNewLine(editor);
|
90
45
|
} catch (err) {
|
91
46
|
console.log(err);
|
92
47
|
}
|
93
|
-
};
|
94
|
-
export const onDeleteBackwardAccordion = editor => {
|
95
|
-
try {
|
96
|
-
let preventDefault = false;
|
97
|
-
const {
|
98
|
-
selection
|
99
|
-
} = editor;
|
100
|
-
const {
|
101
|
-
path: currentPath,
|
102
|
-
offset
|
103
|
-
} = selection.anchor || {};
|
104
|
-
const isCursorAtStart = offset === 0;
|
105
|
-
if (isCursorAtStart) {
|
106
|
-
// If the cursor is at the start of the accordion-summary and backspace is pressed,
|
107
|
-
// unwrap the accordion by removing both the summary and details,
|
108
|
-
// and insert their contents as regular nodes without the accordion wrapper.
|
109
|
-
const [accordionSummary] = getNodeWithType(editor, "accordion-summary");
|
110
|
-
const [accordionTitle, accordionTitlePath] = accordionSummary || [];
|
111
|
-
if (accordionTitle) {
|
112
|
-
const accordionPath = Path.parent(accordionTitlePath);
|
113
|
-
removeAccordion(editor, accordionPath);
|
114
|
-
preventDefault = true;
|
115
|
-
return;
|
116
|
-
}
|
117
|
-
const parentPath = Path.parent(currentPath);
|
118
|
-
const parentNode = getNode(editor, parentPath);
|
119
|
-
const isTextNode = ALLOWED_TEXT_NODES.includes(parentNode?.type);
|
120
|
-
if (isTextNode) {
|
121
|
-
const prevEntry = Editor.previous(editor, {
|
122
|
-
at: parentPath,
|
123
|
-
match: n => n.type === "accordion"
|
124
|
-
});
|
125
|
-
if (prevEntry) {
|
126
|
-
const [accordionNode, accordionPath] = prevEntry;
|
127
|
-
const dom = ReactEditor.toDOMNode(editor, accordionNode);
|
128
|
-
const aContent = dom.querySelector(".accordion-content");
|
129
|
-
const isContentVisible = aContent.style.display !== "none";
|
130
|
-
if (!isContentVisible) {
|
131
|
-
// If the accordion content is not visible and backspace is pressed,
|
132
|
-
// the content from the current node should be merged with the accordion title,
|
133
|
-
// and the cursor should move to the title.
|
134
|
-
// Otherwise, Slate will by default merge the current node into the hidden details section,
|
135
|
-
// which makes the content invisible.
|
136
|
-
|
137
|
-
let targetPath = [...accordionPath, 0, 0];
|
138
|
-
const targetNodeEntry = getNode(editor, targetPath);
|
139
|
-
if (targetNodeEntry) {
|
140
|
-
const nodeText = getNodeText(parentNode);
|
141
|
-
const endPath = Editor.end(editor, targetPath);
|
142
|
-
|
143
|
-
// Move current paragraph text into the end of the target block
|
144
|
-
Transforms.select(editor, Editor.start(editor, parentPath));
|
145
|
-
Transforms.delete(editor, {
|
146
|
-
at: parentPath
|
147
|
-
});
|
148
|
-
Transforms.insertText(editor, nodeText, {
|
149
|
-
at: endPath
|
150
|
-
});
|
151
|
-
|
152
|
-
// move the focus and cursor to the inserted node
|
153
|
-
Transforms.select(editor, {
|
154
|
-
anchor: endPath,
|
155
|
-
focus: endPath
|
156
|
-
});
|
157
|
-
ReactEditor.focus(editor);
|
158
|
-
preventDefault = true;
|
159
|
-
return;
|
160
|
-
}
|
161
|
-
}
|
162
|
-
}
|
163
|
-
}
|
164
|
-
}
|
165
|
-
return preventDefault;
|
166
|
-
} catch (err) {
|
167
|
-
console.log(err);
|
168
|
-
}
|
169
48
|
};
|
@@ -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;
|