@flozy/editor 4.0.2 → 4.0.4
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 +14 -9
- package/dist/Editor/CommonEditor.js +185 -170
- package/dist/Editor/DialogWrapper.js +4 -3
- package/dist/Editor/Editor.css +5 -19
- package/dist/Editor/Elements/AI/PopoverAIInput.js +52 -41
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +4 -15
- package/dist/Editor/Elements/AppHeader/AppHeader.js +39 -26
- package/dist/Editor/Elements/Button/EditorButton.js +33 -38
- package/dist/Editor/Elements/Carousel/CarouselButton.js +0 -1
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -59
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
- package/dist/Editor/Elements/Embed/Image.js +15 -14
- package/dist/Editor/Elements/Embed/Video.js +12 -8
- package/dist/Editor/Elements/Emoji/EmojiButton.js +11 -7
- package/dist/Editor/Elements/Form/Form.js +43 -27
- package/dist/Editor/Elements/Form/FormField.js +21 -10
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
- package/dist/Editor/Elements/Form/Workflow/index.js +5 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +437 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +206 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +23 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +236 -0
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +44 -0
- package/dist/Editor/Elements/FreeGrid/Options/More.js +24 -0
- package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +47 -0
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +19 -0
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +75 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +214 -0
- package/dist/Editor/Elements/Grid/Grid.js +11 -9
- package/dist/Editor/Elements/Grid/GridItem.js +31 -23
- package/dist/Editor/Elements/Link/Link.js +1 -6
- package/dist/Editor/Elements/Link/LinkButton.js +2 -4
- package/dist/Editor/Elements/Link/LinkPopup.js +15 -18
- package/dist/Editor/Elements/NewLine/NewLineButton.js +0 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +1 -1
- package/dist/Editor/Elements/SimpleText/index.js +18 -16
- package/dist/Editor/Elements/SimpleText/style.js +43 -0
- package/dist/Editor/ErrorBoundary.js +30 -0
- package/dist/Editor/MiniEditor.js +1 -3
- package/dist/Editor/Styles/EditorStyles.js +28 -0
- package/dist/Editor/Toolbar/Basic/index.js +2 -4
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +11 -5
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +14 -26
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +2 -68
- package/dist/Editor/Toolbar/PopupTool/index.js +8 -0
- package/dist/Editor/Toolbar/Toolbar.js +7 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +16 -48
- package/dist/Editor/common/ColorPickerButton.js +9 -25
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/EditorCmds.js +0 -3
- package/dist/Editor/common/Icon.js +16 -34
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
- package/dist/Editor/common/LinkSettings/index.js +1 -2
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
- package/dist/Editor/common/MentionsPopup/index.js +12 -8
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +142 -0
- package/dist/Editor/common/RnD/ContextMenu/index.js +38 -0
- package/dist/Editor/common/RnD/ContextMenu/styles.js +21 -0
- package/dist/Editor/common/RnD/DragInfo/index.js +31 -0
- package/dist/Editor/common/RnD/DragInfo/styles.js +15 -0
- package/dist/Editor/common/RnD/DragOver/index.js +55 -0
- package/dist/Editor/common/RnD/DragOver/styles.js +23 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +102 -0
- package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +26 -0
- package/dist/Editor/common/RnD/ElementOptions/index.js +95 -0
- package/dist/Editor/common/RnD/ElementOptions/styles.js +41 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +153 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +36 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +60 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +9 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +48 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +30 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +17 -0
- package/dist/Editor/common/RnD/ElementSettings/index.js +17 -0
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +18 -0
- package/dist/Editor/common/RnD/ElementSettings/styles.js +94 -0
- package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +52 -0
- package/dist/Editor/common/RnD/GuideLines/index.js +33 -0
- package/dist/Editor/common/RnD/GuideLines/styles.js +62 -0
- package/dist/Editor/common/RnD/OptionsPopup/index.js +50 -0
- package/dist/Editor/common/RnD/OptionsPopup/style.js +36 -0
- package/dist/Editor/common/RnD/RnDCopy.js +23 -0
- package/dist/Editor/common/RnD/ShadowElement.js +34 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +40 -0
- package/dist/Editor/common/RnD/SwitchViewport/styles.js +24 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +63 -0
- package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +19 -0
- package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +13 -0
- package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +20 -0
- package/dist/Editor/common/RnD/TransformHandles/index.js +67 -0
- package/dist/Editor/common/RnD/Utils/alignmentDetection.js +26 -0
- package/dist/Editor/common/RnD/Utils/calculateDropItem.js +98 -0
- package/dist/Editor/common/RnD/Utils/collisionDetection.js +52 -0
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +181 -0
- package/dist/Editor/common/RnD/Utils/index.js +251 -0
- package/dist/Editor/common/RnD/VirtualElement/index.js +77 -0
- package/dist/Editor/common/RnD/VirtualElement/styles.js +27 -0
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +28 -0
- package/dist/Editor/common/RnD/index.js +567 -0
- package/dist/Editor/common/RnD/styles.js +4 -0
- package/dist/Editor/common/Section/index.js +21 -12
- package/dist/Editor/common/Section/styles.js +7 -4
- package/dist/Editor/common/Shorthands/elements.js +12 -54
- package/dist/Editor/common/StyleBuilder/boxStyle.js +30 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +36 -44
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +23 -33
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -31
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +18 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
- package/dist/Editor/common/StyleBuilder/index.js +5 -3
- package/dist/Editor/common/StyleBuilder/sectionStyle.js +13 -2
- package/dist/Editor/helper/RnD/focusOnNewItem.js +39 -0
- package/dist/Editor/helper/RnD/scrollToNewSection.js +24 -0
- package/dist/Editor/helper/breakpoint.js +5 -0
- package/dist/Editor/helper/index.js +139 -0
- package/dist/Editor/helper/theme.js +48 -186
- package/dist/Editor/hooks/useBreakpoints.js +34 -0
- package/dist/Editor/hooks/useMouseMove.js +37 -12
- package/dist/Editor/hooks/withCommon.js +2 -1
- package/dist/Editor/hooks/withErrorHandling.js +14 -0
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +1 -1
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +197 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +60 -164
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/events.js +5 -0
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/form.js +7 -2
- package/dist/Editor/utils/formfield.js +1 -1
- package/dist/Editor/utils/freegrid.js +91 -0
- package/dist/Editor/utils/helper.js +44 -30
- package/dist/Editor/utils/insertAppHeader.js +47 -40
- package/package.json +5 -2
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
- package/dist/Editor/common/CustomColorPicker/index.js +0 -106
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog/index.js +0 -94
- package/dist/Editor/common/CustomDialog/style.js +0 -67
- package/dist/Editor/common/CustomSelect.js +0 -33
- package/dist/Editor/hooks/useEditorTheme.js +0 -139
- package/dist/Editor/theme/index.js +0 -144
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
- package/dist/Editor/themeSettings/buttons/index.js +0 -290
- package/dist/Editor/themeSettings/buttons/style.js +0 -21
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
- package/dist/Editor/themeSettings/fonts/index.js +0 -213
- package/dist/Editor/themeSettings/fonts/style.js +0 -44
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -320
- package/dist/Editor/themeSettings/style.js +0 -152
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -356
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
- package/dist/Editor/themeSettingsAI/style.js +0 -247
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Editor, Transforms, Element as SlateElement
|
|
1
|
+
import { Editor, Transforms, Element as SlateElement } from "slate";
|
|
2
2
|
import { Box } from "@mui/material";
|
|
3
3
|
import { fontFamilyMap, sizeMap } from "./font";
|
|
4
4
|
import Link from "../Elements/Link/Link";
|
|
@@ -34,30 +34,24 @@ import SimpleText from "../Elements/SimpleText";
|
|
|
34
34
|
import CheckList from "../Elements/List/CheckList";
|
|
35
35
|
import { isEmptyTextNode } from "../helper";
|
|
36
36
|
import Attachments from "../Elements/Attachments/Attachments";
|
|
37
|
-
import { getBreakPointsValue
|
|
37
|
+
import { getBreakPointsValue } 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 } from "./helper";
|
|
41
42
|
import Code from "../Elements/EmbedScript/Code";
|
|
42
|
-
import
|
|
43
|
+
import FreeGrid from "../Elements/FreeGrid/FreeGrid";
|
|
44
|
+
import FreeGridItem from "../Elements/FreeGrid/FreeGridItem";
|
|
45
|
+
import FreeGridBox from "../Elements/FreeGrid/FreeGridBox";
|
|
46
|
+
import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
|
|
43
47
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
44
|
-
const alignment = ["alignLeft", "alignRight", "alignCenter"];
|
|
48
|
+
const alignment = ["alignLeft", "alignRight", "alignCenter", "alignJustify"];
|
|
45
49
|
const list_types = ["orderedList", "unorderedList"];
|
|
46
50
|
const LIST_FORMAT_TYPE = {
|
|
47
51
|
orderedList: "list-item",
|
|
48
52
|
unorderedList: "list-item"
|
|
49
53
|
};
|
|
50
|
-
|
|
51
|
-
// const NEWLINESAFTER = [
|
|
52
|
-
// "headingOne",
|
|
53
|
-
// "headingTwo",
|
|
54
|
-
// "headingThree",
|
|
55
|
-
// "headingFour",
|
|
56
|
-
// "headingFive",
|
|
57
|
-
// "headingSix",
|
|
58
|
-
// ];
|
|
59
|
-
|
|
60
|
-
const THEME_BLOCK_FIELDS = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "paragraphOne", "paragraphTwo", "paragraphThree"];
|
|
54
|
+
const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
|
|
61
55
|
export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
62
56
|
const isActive = isBlockActive(editor, format);
|
|
63
57
|
const isList = list_types.includes(format);
|
|
@@ -90,9 +84,8 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
|
90
84
|
if (!selection) {
|
|
91
85
|
Transforms.insertText(editor, "");
|
|
92
86
|
}
|
|
93
|
-
const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
|
|
94
87
|
Transforms.setNodes(editor, {
|
|
95
|
-
type: isActive ?
|
|
88
|
+
type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
|
|
96
89
|
...attr
|
|
97
90
|
});
|
|
98
91
|
if (isList && !isActive) {
|
|
@@ -101,12 +94,10 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
|
101
94
|
children: []
|
|
102
95
|
});
|
|
103
96
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// }
|
|
97
|
+
if (NEWLINESAFTER.indexOf(format) > -1) {
|
|
98
|
+
insertNewLine(editor);
|
|
99
|
+
}
|
|
108
100
|
};
|
|
109
|
-
|
|
110
101
|
export const addMarkData = (editor, data) => {
|
|
111
102
|
try {
|
|
112
103
|
Editor.addMark(editor, data.format, data.value);
|
|
@@ -115,14 +106,9 @@ export const addMarkData = (editor, data) => {
|
|
|
115
106
|
}
|
|
116
107
|
};
|
|
117
108
|
export const toggleMark = (editor, format) => {
|
|
118
|
-
const isActive =
|
|
109
|
+
const isActive = isMarkActive(editor, format);
|
|
119
110
|
if (isActive) {
|
|
120
|
-
|
|
121
|
-
if (isThemeSupportedMark) {
|
|
122
|
-
Editor.addMark(editor, format, false);
|
|
123
|
-
} else {
|
|
124
|
-
Editor.removeMark(editor, format);
|
|
125
|
-
}
|
|
111
|
+
Editor.removeMark(editor, format);
|
|
126
112
|
} else {
|
|
127
113
|
Editor.addMark(editor, format, true);
|
|
128
114
|
}
|
|
@@ -136,53 +122,6 @@ export const isMarkActive = (editor, format) => {
|
|
|
136
122
|
return null;
|
|
137
123
|
}
|
|
138
124
|
};
|
|
139
|
-
export const isMarkBtnActive = (editor, format) => {
|
|
140
|
-
switch (format) {
|
|
141
|
-
case "bold":
|
|
142
|
-
{
|
|
143
|
-
const style = getSelectedElementStyle("font-weight", editor);
|
|
144
|
-
return style === "700";
|
|
145
|
-
}
|
|
146
|
-
case "italic":
|
|
147
|
-
{
|
|
148
|
-
const style = getSelectedElementStyle("font-style", editor);
|
|
149
|
-
return style === format;
|
|
150
|
-
}
|
|
151
|
-
// case "underline": {
|
|
152
|
-
// const style = getSelectedElementStyle("text-decoration");
|
|
153
|
-
|
|
154
|
-
// return style?.includes(format);
|
|
155
|
-
// }
|
|
156
|
-
// case "strikethrough": {
|
|
157
|
-
// const style = getSelectedElementStyle("text-decoration");
|
|
158
|
-
|
|
159
|
-
// return style?.includes("line-through");
|
|
160
|
-
// }
|
|
161
|
-
default:
|
|
162
|
-
return isMarkActive(editor, format);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
export const getSelectedElementStyle = (styleProperty, editor) => {
|
|
166
|
-
try {
|
|
167
|
-
if (!editor.selection) {
|
|
168
|
-
return "";
|
|
169
|
-
}
|
|
170
|
-
if (Range.isCollapsed(editor.selection)) {
|
|
171
|
-
return "";
|
|
172
|
-
}
|
|
173
|
-
const domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
|
174
|
-
const selectedDomNode = domRange.commonAncestorContainer;
|
|
175
|
-
|
|
176
|
-
// If it's a text node, get its parent element
|
|
177
|
-
const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
|
|
178
|
-
if (selectedElement) {
|
|
179
|
-
const computedStyle = window.getComputedStyle(selectedElement);
|
|
180
|
-
return computedStyle.getPropertyValue(styleProperty) || "";
|
|
181
|
-
}
|
|
182
|
-
} catch (err) {
|
|
183
|
-
console.log(err);
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
125
|
export const isBlockActive = (editor, format) => {
|
|
187
126
|
const [match] = Editor.nodes(editor, {
|
|
188
127
|
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
|
|
@@ -225,32 +164,7 @@ export const activeMark = (editor, format) => {
|
|
|
225
164
|
return null;
|
|
226
165
|
}
|
|
227
166
|
};
|
|
228
|
-
|
|
229
|
-
// to avoid the styles, that automatically assign from themes
|
|
230
|
-
const getThemeMarkedLeaf = (leaf, children) => {
|
|
231
|
-
const {
|
|
232
|
-
italic,
|
|
233
|
-
bold
|
|
234
|
-
} = leaf || {};
|
|
235
|
-
const style = {};
|
|
236
|
-
if (italic === false) {
|
|
237
|
-
style.fontStyle = "normal";
|
|
238
|
-
}
|
|
239
|
-
if (bold === false) {
|
|
240
|
-
style.fontWeight = "normal";
|
|
241
|
-
}
|
|
242
|
-
if (Object.keys(style).length) {
|
|
243
|
-
children = /*#__PURE__*/_jsx(Box, {
|
|
244
|
-
component: "span",
|
|
245
|
-
sx: {
|
|
246
|
-
"& span": style
|
|
247
|
-
},
|
|
248
|
-
children: children
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
return children;
|
|
252
|
-
};
|
|
253
|
-
export const getMarked = (leaf, children) => {
|
|
167
|
+
export const getMarked = (leaf, children, theme) => {
|
|
254
168
|
const className = leaf?.doublequote ? "doublequote" : "";
|
|
255
169
|
if (leaf.bold) {
|
|
256
170
|
children = /*#__PURE__*/_jsx("strong", {
|
|
@@ -267,7 +181,6 @@ export const getMarked = (leaf, children) => {
|
|
|
267
181
|
children: children
|
|
268
182
|
});
|
|
269
183
|
}
|
|
270
|
-
children = getThemeMarkedLeaf(leaf, children);
|
|
271
184
|
if (leaf.strikethrough) {
|
|
272
185
|
children = /*#__PURE__*/_jsx("span", {
|
|
273
186
|
style: {
|
|
@@ -301,23 +214,22 @@ export const getMarked = (leaf, children) => {
|
|
|
301
214
|
} : {
|
|
302
215
|
color: leaf.color
|
|
303
216
|
};
|
|
304
|
-
const fontSize = {
|
|
305
|
-
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
|
306
|
-
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
|
307
|
-
};
|
|
308
|
-
const fontSizesImportant = {};
|
|
309
|
-
Object.entries(fontSize).forEach(([key, value]) => {
|
|
310
|
-
fontSizesImportant[key] = `${value} !important`;
|
|
311
|
-
});
|
|
312
217
|
children = /*#__PURE__*/_jsx("span", {
|
|
218
|
+
style: {
|
|
219
|
+
background: leaf.bgColor
|
|
220
|
+
},
|
|
313
221
|
children: /*#__PURE__*/_jsx(Box, {
|
|
314
222
|
className: className,
|
|
315
223
|
component: "span",
|
|
316
224
|
sx: {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
},
|
|
225
|
+
...wrapThemeBreakpoints({
|
|
226
|
+
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
|
227
|
+
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
|
228
|
+
}, "fontSize", theme),
|
|
229
|
+
// fontSize: {
|
|
230
|
+
// lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
|
231
|
+
// ...getBreakPointsValue(leaf.fontSize, null, "overrideText"),
|
|
232
|
+
// },
|
|
321
233
|
...textStyles,
|
|
322
234
|
fontFamily: family,
|
|
323
235
|
fontWeight: leaf.fontWeight
|
|
@@ -346,71 +258,31 @@ export const getBlock = props => {
|
|
|
346
258
|
} = props;
|
|
347
259
|
const attributes = props.attributes ?? {};
|
|
348
260
|
const isEmpty = isEmptyTextNode(element);
|
|
349
|
-
const commonHeadingProps = () => ({
|
|
350
|
-
...attributes,
|
|
351
|
-
...element.attr,
|
|
352
|
-
className: `content-editable ${isEmpty ? "empty" : ""} theme-element`
|
|
353
|
-
});
|
|
354
|
-
const commonParaProps = paraType => ({
|
|
355
|
-
...attributes,
|
|
356
|
-
...element.attr,
|
|
357
|
-
className: `content-editable ${isEmpty ? "empty" : ""} theme-element ${paraType}`
|
|
358
|
-
});
|
|
359
261
|
switch (element.type) {
|
|
360
262
|
case "headingOne":
|
|
361
263
|
return /*#__PURE__*/_jsx("h1", {
|
|
362
|
-
...
|
|
264
|
+
...attributes,
|
|
265
|
+
...element.attr,
|
|
266
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
|
363
267
|
placeholder: "Heading 1",
|
|
364
268
|
children: children
|
|
365
269
|
});
|
|
366
270
|
case "headingTwo":
|
|
367
271
|
return /*#__PURE__*/_jsx("h2", {
|
|
368
|
-
...
|
|
272
|
+
...attributes,
|
|
273
|
+
...element.attr,
|
|
274
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
|
369
275
|
placeholder: "Heading 2",
|
|
370
276
|
children: children
|
|
371
277
|
});
|
|
372
278
|
case "headingThree":
|
|
373
279
|
return /*#__PURE__*/_jsx("h3", {
|
|
374
|
-
...
|
|
280
|
+
...attributes,
|
|
281
|
+
...element.attr,
|
|
282
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
|
375
283
|
placeholder: "Heading 3",
|
|
376
284
|
children: children
|
|
377
285
|
});
|
|
378
|
-
case "headingFour":
|
|
379
|
-
return /*#__PURE__*/_jsx("h4", {
|
|
380
|
-
...commonHeadingProps(),
|
|
381
|
-
placeholder: "Heading 4",
|
|
382
|
-
children: children
|
|
383
|
-
});
|
|
384
|
-
case "headingFive":
|
|
385
|
-
return /*#__PURE__*/_jsx("h5", {
|
|
386
|
-
...commonHeadingProps(),
|
|
387
|
-
placeholder: "Heading 5",
|
|
388
|
-
children: children
|
|
389
|
-
});
|
|
390
|
-
case "headingSix":
|
|
391
|
-
return /*#__PURE__*/_jsx("h6", {
|
|
392
|
-
...commonHeadingProps(),
|
|
393
|
-
placeholder: "Heading 6",
|
|
394
|
-
children: children
|
|
395
|
-
});
|
|
396
|
-
case "paragraphOne":
|
|
397
|
-
return /*#__PURE__*/_jsx("p", {
|
|
398
|
-
...commonParaProps("para1"),
|
|
399
|
-
placeholder: "Paragraph 1",
|
|
400
|
-
children: children
|
|
401
|
-
});
|
|
402
|
-
case "paragraphTwo":
|
|
403
|
-
return /*#__PURE__*/_jsx("p", {
|
|
404
|
-
...commonParaProps("para2"),
|
|
405
|
-
placeholder: "Paragraph 2",
|
|
406
|
-
children: children
|
|
407
|
-
});
|
|
408
|
-
case "paragraphThree":
|
|
409
|
-
return /*#__PURE__*/_jsx("p", {
|
|
410
|
-
...commonParaProps("para3"),
|
|
411
|
-
placeholder: "Paragraph 3",
|
|
412
|
-
children: children
|
|
413
|
-
});
|
|
414
286
|
case "blockquote":
|
|
415
287
|
return /*#__PURE__*/_jsx("blockquote", {
|
|
416
288
|
...attributes,
|
|
@@ -457,6 +329,18 @@ export const getBlock = props => {
|
|
|
457
329
|
...element.attr,
|
|
458
330
|
children: children
|
|
459
331
|
});
|
|
332
|
+
case "alignJustify":
|
|
333
|
+
return /*#__PURE__*/_jsx("div", {
|
|
334
|
+
style: {
|
|
335
|
+
display: "flex",
|
|
336
|
+
alignItems: "center",
|
|
337
|
+
flexDirection: "column",
|
|
338
|
+
textAlign: "justify"
|
|
339
|
+
},
|
|
340
|
+
...attributes,
|
|
341
|
+
...element.attr,
|
|
342
|
+
children: children
|
|
343
|
+
});
|
|
460
344
|
case "list-item":
|
|
461
345
|
const firstChildren = element.children[0] || {};
|
|
462
346
|
return /*#__PURE__*/_jsx("li", {
|
|
@@ -543,6 +427,18 @@ export const getBlock = props => {
|
|
|
543
427
|
return /*#__PURE__*/_jsx(Grid, {
|
|
544
428
|
...props
|
|
545
429
|
});
|
|
430
|
+
case "freegrid":
|
|
431
|
+
return /*#__PURE__*/_jsx(FreeGrid, {
|
|
432
|
+
...props
|
|
433
|
+
});
|
|
434
|
+
case "freegridItem":
|
|
435
|
+
return /*#__PURE__*/_jsx(FreeGridItem, {
|
|
436
|
+
...props
|
|
437
|
+
});
|
|
438
|
+
case "freegridBox":
|
|
439
|
+
return /*#__PURE__*/_jsx(FreeGridBox, {
|
|
440
|
+
...props
|
|
441
|
+
});
|
|
546
442
|
case "grid-item":
|
|
547
443
|
return /*#__PURE__*/_jsx(GridItem, {
|
|
548
444
|
...props,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Transforms } from "slate";
|
|
2
2
|
import insertNewLine from "./insertNewLine";
|
|
3
|
+
import { windowVar } from "./helper";
|
|
3
4
|
export const insertButton = editor => {
|
|
4
5
|
const button = {
|
|
5
6
|
type: "button",
|
|
@@ -9,7 +10,22 @@ export const insertButton = editor => {
|
|
|
9
10
|
buttonLink: {
|
|
10
11
|
linkType: "webAddress"
|
|
11
12
|
},
|
|
12
|
-
iconPosition: "start"
|
|
13
|
+
iconPosition: "start",
|
|
14
|
+
bgColor: "#2563EB",
|
|
15
|
+
textColor: "#FFF",
|
|
16
|
+
borderRadius: {
|
|
17
|
+
topLeft: 30,
|
|
18
|
+
topRight: 30,
|
|
19
|
+
bottomLeft: 30,
|
|
20
|
+
bottomRight: 30
|
|
21
|
+
},
|
|
22
|
+
bannerSpacing: {
|
|
23
|
+
left: 16,
|
|
24
|
+
top: 8,
|
|
25
|
+
right: 16,
|
|
26
|
+
bottom: 8
|
|
27
|
+
},
|
|
28
|
+
...(windowVar.lastButtonProps || {})
|
|
13
29
|
};
|
|
14
30
|
Transforms.insertNodes(editor, button);
|
|
15
31
|
Transforms.move(editor);
|
|
@@ -3,6 +3,7 @@ import { toggleBlock } from "./SlateUtilityFunctions";
|
|
|
3
3
|
import insertNewLine from "./insertNewLine";
|
|
4
4
|
import { insertAccordion } from "./accordion";
|
|
5
5
|
import { isListItem } from "./helper";
|
|
6
|
+
import RnDCtrlCmds from "./RnD/RnDCtrlCmds";
|
|
6
7
|
import EDITORCMDS from "../common/EditorCmds";
|
|
7
8
|
const HOTKEYS = {
|
|
8
9
|
b: "bold",
|
|
@@ -75,6 +76,10 @@ export const commands = props => {
|
|
|
75
76
|
} else {
|
|
76
77
|
Editor.addMark(editor, HOTKEYS[event.key], true);
|
|
77
78
|
}
|
|
79
|
+
} else if (RnDCtrlCmds[event.key]) {
|
|
80
|
+
RnDCtrlCmds[event.key](event, {
|
|
81
|
+
editor
|
|
82
|
+
});
|
|
78
83
|
} else if (EDITORCMDS[event.key]) {
|
|
79
84
|
EDITORCMDS[event.key](event, {
|
|
80
85
|
editor,
|
|
@@ -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: "Roboto, sans-serif",
|
|
14
|
-
qwitcher: '
|
|
15
|
-
garamond: '
|
|
16
|
-
anton: "Anton, sans-serif",
|
|
17
|
-
dmserif: '
|
|
18
|
-
inter: "Inter, sans-serif",
|
|
19
|
-
libre: '
|
|
20
|
-
montserrat: "Montserrat, sans-serif",
|
|
21
|
-
opensans: '
|
|
22
|
-
publicsans: '
|
|
23
|
-
raleway: "Raleway, sans-serif",
|
|
24
|
-
spacemono: '
|
|
25
|
-
bulgarian: '
|
|
26
|
-
impact: "Impact, serif",
|
|
27
|
-
redacted: '
|
|
28
|
-
greatVibes: '
|
|
29
|
-
zeyada: "Zeyada, cursive",
|
|
30
|
-
allura: "Allura, cursive",
|
|
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: "Engagement, cursive",
|
|
38
|
-
gaegu: "Gaegu, cursive",
|
|
39
|
-
ingridDarling: '
|
|
40
|
-
kitaOne: "
|
|
41
|
-
laBelleAurore: '
|
|
42
|
-
lobster: "Lobster, cursive",
|
|
43
|
-
meaCulpa: '
|
|
44
|
-
meddon: "Meddon, cursive",
|
|
45
|
-
merriWeather: "Merriweather, serif",
|
|
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: "'Kite One', sans - serif",
|
|
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,8 +62,5 @@ 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"
|
|
66
|
-
"headingFour": "16px",
|
|
67
|
-
"headingFive": "13px",
|
|
68
|
-
"headingSix": "11px"
|
|
65
|
+
"headingThree": "19px"
|
|
69
66
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Transforms } from "slate";
|
|
2
2
|
import { formField } from "./formfield";
|
|
3
3
|
import insertNewLine from "./insertNewLine";
|
|
4
|
-
export const
|
|
5
|
-
|
|
4
|
+
export const FORM_NODE = () => {
|
|
5
|
+
return {
|
|
6
6
|
type: "form",
|
|
7
7
|
grid: "container",
|
|
8
8
|
formName: `form_${new Date().getTime()}`,
|
|
@@ -23,6 +23,11 @@ export const insertForm = (editor, item) => {
|
|
|
23
23
|
...formField()
|
|
24
24
|
}],
|
|
25
25
|
metadatamapping: "mappingToContactBoard"
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export const insertForm = (editor, item) => {
|
|
29
|
+
const grid = !item ? {
|
|
30
|
+
...FORM_NODE()
|
|
26
31
|
} : item;
|
|
27
32
|
Transforms.insertNodes(editor, grid);
|
|
28
33
|
insertNewLine(editor);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Transforms } from "slate";
|
|
2
|
+
import insertNewLine from "./insertNewLine";
|
|
3
|
+
import scrollToNewSection from "../helper/RnD/scrollToNewSection";
|
|
4
|
+
const Default_text_Node = {
|
|
5
|
+
type: "paragraph",
|
|
6
|
+
children: [{
|
|
7
|
+
text: "Effortless Business Growth"
|
|
8
|
+
}]
|
|
9
|
+
};
|
|
10
|
+
export const insertFreeGridItem = (childType, childTypeNode, extProps = {}, type = "freegridItem") => {
|
|
11
|
+
return {
|
|
12
|
+
type: type || "freegridItem",
|
|
13
|
+
childType: childType || "text",
|
|
14
|
+
children: [childTypeNode || Default_text_Node],
|
|
15
|
+
gridArea: "1 / 1 / 2 / 2",
|
|
16
|
+
height: 300,
|
|
17
|
+
width: 250,
|
|
18
|
+
left: 401,
|
|
19
|
+
top: 0,
|
|
20
|
+
marginTop: 47,
|
|
21
|
+
left_xs: 24,
|
|
22
|
+
top_xs: 24,
|
|
23
|
+
marginTop_xs: 12,
|
|
24
|
+
width_xs: 250,
|
|
25
|
+
height_xs: 300,
|
|
26
|
+
gridArea_xs: "1 / 1 / 2 / 2",
|
|
27
|
+
sectionBgColor: "rgb(240, 108, 131)",
|
|
28
|
+
...(extProps || {})
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export const insertFreeGrid = (editor, path, extProps) => {
|
|
32
|
+
const freegridData = [{
|
|
33
|
+
type: "freegrid",
|
|
34
|
+
height: 508,
|
|
35
|
+
gridTemplateRows: "var(--rows)",
|
|
36
|
+
gridTemplateColumns: "var(--cols)",
|
|
37
|
+
children: [{
|
|
38
|
+
type: "freegridItem",
|
|
39
|
+
childType: "text",
|
|
40
|
+
children: [{
|
|
41
|
+
type: "alignCenter",
|
|
42
|
+
children: [{
|
|
43
|
+
type: "paragraph",
|
|
44
|
+
children: [{
|
|
45
|
+
text: "Heading One",
|
|
46
|
+
fontSize: {
|
|
47
|
+
xs: "38px",
|
|
48
|
+
sm: "54px",
|
|
49
|
+
md: "54px",
|
|
50
|
+
lg: "54px"
|
|
51
|
+
},
|
|
52
|
+
fontFamily: "PoppinsBold"
|
|
53
|
+
}]
|
|
54
|
+
}]
|
|
55
|
+
}],
|
|
56
|
+
gridArea: "2 / 1 / 3 / 2",
|
|
57
|
+
height: 88,
|
|
58
|
+
width: 746,
|
|
59
|
+
left: 129,
|
|
60
|
+
marginTop: 23,
|
|
61
|
+
top_xs: 105.1875,
|
|
62
|
+
left_xs: 22,
|
|
63
|
+
marginTop_xs: 38,
|
|
64
|
+
width_xs: 272,
|
|
65
|
+
height_xs: 163.0078125,
|
|
66
|
+
gridArea_xs: "2 / 1 / 3 / 2",
|
|
67
|
+
updated_at: 1728554109479,
|
|
68
|
+
lg_updatedOn: 1726290562773,
|
|
69
|
+
xs_updatedOn: 1728554109478
|
|
70
|
+
}],
|
|
71
|
+
height_xs: 593.0625,
|
|
72
|
+
updated_at: 1728554109479,
|
|
73
|
+
width: 0,
|
|
74
|
+
sectionBgColor: "rgb(222, 99, 138)",
|
|
75
|
+
xs_updatedOn: 1727921628092,
|
|
76
|
+
sectionName: "Home"
|
|
77
|
+
}];
|
|
78
|
+
const newPath = path ? path : editor?.selection?.anchor?.path;
|
|
79
|
+
let upNode = [...freegridData];
|
|
80
|
+
if (path) {
|
|
81
|
+
upNode = [{
|
|
82
|
+
type: "paragraph",
|
|
83
|
+
children: upNode
|
|
84
|
+
}];
|
|
85
|
+
}
|
|
86
|
+
Transforms.insertNodes(editor, upNode, {
|
|
87
|
+
at: newPath
|
|
88
|
+
});
|
|
89
|
+
scrollToNewSection(editor, newPath, extProps);
|
|
90
|
+
insertNewLine(editor);
|
|
91
|
+
};
|