@flozy/editor 3.7.3 → 3.7.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/CommonEditor.js +111 -169
- package/dist/Editor/Elements/Accordion/Accordion.js +7 -74
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +2 -3
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +60 -4
- package/dist/Editor/Elements/AppHeader/AppHeader.js +4 -26
- package/dist/Editor/Elements/Button/EditorButton.js +14 -25
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +17 -60
- 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/Frames/ImageFrame.js +0 -1
- package/dist/Editor/Elements/Embed/Image.js +20 -28
- package/dist/Editor/Elements/Embed/Video.js +11 -15
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
- package/dist/Editor/Elements/Grid/Grid.js +0 -2
- package/dist/Editor/Elements/Grid/GridItem.js +1 -3
- 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 +3 -11
- package/dist/Editor/Elements/Table/TableCell.js +1 -1
- package/dist/Editor/MiniEditor.js +1 -3
- 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/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 +13 -20
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +7 -52
- package/dist/Editor/Toolbar/PopupTool/index.js +2 -4
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
- package/dist/Editor/common/ColorPickerButton.js +9 -25
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/Icon.js +2 -30
- package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
- package/dist/Editor/common/Shorthands/elements.js +0 -54
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +7 -7
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +3 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
- 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/textOptions.js +4 -14
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/helper/theme.js +4 -190
- package/dist/Editor/hooks/useMouseMove.js +2 -4
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +5 -47
- package/dist/Editor/plugins/withLayout.js +10 -15
- package/dist/Editor/plugins/withTable.js +2 -2
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +25 -157
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/events.js +4 -11
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/helper.js +12 -71
- package/package.json +1 -1
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +0 -28
- 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/common/EditorCmds.js +0 -35
- 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,12 +34,12 @@ 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 { ReactEditor } from "slate-react";
|
|
43
43
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
44
44
|
const alignment = ["alignLeft", "alignRight", "alignCenter"];
|
|
45
45
|
const list_types = ["orderedList", "unorderedList"];
|
|
@@ -47,17 +47,7 @@ const LIST_FORMAT_TYPE = {
|
|
|
47
47
|
orderedList: "list-item",
|
|
48
48
|
unorderedList: "list-item"
|
|
49
49
|
};
|
|
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"];
|
|
50
|
+
const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
|
|
61
51
|
export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
62
52
|
const isActive = isBlockActive(editor, format);
|
|
63
53
|
const isList = list_types.includes(format);
|
|
@@ -90,9 +80,8 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
|
90
80
|
if (!selection) {
|
|
91
81
|
Transforms.insertText(editor, "");
|
|
92
82
|
}
|
|
93
|
-
const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
|
|
94
83
|
Transforms.setNodes(editor, {
|
|
95
|
-
type: isActive ?
|
|
84
|
+
type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
|
|
96
85
|
...attr
|
|
97
86
|
});
|
|
98
87
|
if (isList && !isActive) {
|
|
@@ -101,12 +90,10 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
|
101
90
|
children: []
|
|
102
91
|
});
|
|
103
92
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// }
|
|
93
|
+
if (NEWLINESAFTER.indexOf(format) > -1) {
|
|
94
|
+
insertNewLine(editor);
|
|
95
|
+
}
|
|
108
96
|
};
|
|
109
|
-
|
|
110
97
|
export const addMarkData = (editor, data) => {
|
|
111
98
|
try {
|
|
112
99
|
Editor.addMark(editor, data.format, data.value);
|
|
@@ -115,14 +102,9 @@ export const addMarkData = (editor, data) => {
|
|
|
115
102
|
}
|
|
116
103
|
};
|
|
117
104
|
export const toggleMark = (editor, format) => {
|
|
118
|
-
const isActive =
|
|
105
|
+
const isActive = isMarkActive(editor, format);
|
|
119
106
|
if (isActive) {
|
|
120
|
-
|
|
121
|
-
if (isThemeSupportedMark) {
|
|
122
|
-
Editor.addMark(editor, format, false);
|
|
123
|
-
} else {
|
|
124
|
-
Editor.removeMark(editor, format);
|
|
125
|
-
}
|
|
107
|
+
Editor.removeMark(editor, format);
|
|
126
108
|
} else {
|
|
127
109
|
Editor.addMark(editor, format, true);
|
|
128
110
|
}
|
|
@@ -136,49 +118,6 @@ export const isMarkActive = (editor, format) => {
|
|
|
136
118
|
return null;
|
|
137
119
|
}
|
|
138
120
|
};
|
|
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
|
-
if (!editor.selection) {
|
|
167
|
-
return "";
|
|
168
|
-
}
|
|
169
|
-
if (Range.isCollapsed(editor.selection)) {
|
|
170
|
-
return "";
|
|
171
|
-
}
|
|
172
|
-
const domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
|
173
|
-
const selectedDomNode = domRange.commonAncestorContainer;
|
|
174
|
-
|
|
175
|
-
// If it's a text node, get its parent element
|
|
176
|
-
const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
|
|
177
|
-
if (selectedElement) {
|
|
178
|
-
const computedStyle = window.getComputedStyle(selectedElement);
|
|
179
|
-
return computedStyle.getPropertyValue(styleProperty) || "";
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
121
|
export const isBlockActive = (editor, format) => {
|
|
183
122
|
const [match] = Editor.nodes(editor, {
|
|
184
123
|
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
|
|
@@ -221,31 +160,6 @@ export const activeMark = (editor, format) => {
|
|
|
221
160
|
return null;
|
|
222
161
|
}
|
|
223
162
|
};
|
|
224
|
-
|
|
225
|
-
// to avoid the styles, that automatically assign from themes
|
|
226
|
-
const getThemeMarkedLeaf = (leaf, children) => {
|
|
227
|
-
const {
|
|
228
|
-
italic,
|
|
229
|
-
bold
|
|
230
|
-
} = leaf || {};
|
|
231
|
-
const style = {};
|
|
232
|
-
if (italic === false) {
|
|
233
|
-
style.fontStyle = "normal";
|
|
234
|
-
}
|
|
235
|
-
if (bold === false) {
|
|
236
|
-
style.fontWeight = "normal";
|
|
237
|
-
}
|
|
238
|
-
if (Object.keys(style).length) {
|
|
239
|
-
children = /*#__PURE__*/_jsx(Box, {
|
|
240
|
-
component: "span",
|
|
241
|
-
sx: {
|
|
242
|
-
"& span": style
|
|
243
|
-
},
|
|
244
|
-
children: children
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
return children;
|
|
248
|
-
};
|
|
249
163
|
export const getMarked = (leaf, children) => {
|
|
250
164
|
const className = leaf?.doublequote ? "doublequote" : "";
|
|
251
165
|
if (leaf.bold) {
|
|
@@ -263,7 +177,6 @@ export const getMarked = (leaf, children) => {
|
|
|
263
177
|
children: children
|
|
264
178
|
});
|
|
265
179
|
}
|
|
266
|
-
children = getThemeMarkedLeaf(leaf, children);
|
|
267
180
|
if (leaf.strikethrough) {
|
|
268
181
|
children = /*#__PURE__*/_jsx("span", {
|
|
269
182
|
style: {
|
|
@@ -297,22 +210,17 @@ export const getMarked = (leaf, children) => {
|
|
|
297
210
|
} : {
|
|
298
211
|
color: leaf.color
|
|
299
212
|
};
|
|
300
|
-
const fontSize = {
|
|
301
|
-
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
|
302
|
-
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
|
303
|
-
};
|
|
304
|
-
const fontSizesImportant = {};
|
|
305
|
-
Object.entries(fontSize).forEach(([key, value]) => {
|
|
306
|
-
fontSizesImportant[key] = `${value} !important`;
|
|
307
|
-
});
|
|
308
213
|
children = /*#__PURE__*/_jsx("span", {
|
|
214
|
+
style: {
|
|
215
|
+
background: leaf.bgColor
|
|
216
|
+
},
|
|
309
217
|
children: /*#__PURE__*/_jsx(Box, {
|
|
310
218
|
className: className,
|
|
311
219
|
component: "span",
|
|
312
220
|
sx: {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
221
|
+
fontSize: {
|
|
222
|
+
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
|
223
|
+
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
|
316
224
|
},
|
|
317
225
|
...textStyles,
|
|
318
226
|
fontFamily: family,
|
|
@@ -342,71 +250,31 @@ export const getBlock = props => {
|
|
|
342
250
|
} = props;
|
|
343
251
|
const attributes = props.attributes ?? {};
|
|
344
252
|
const isEmpty = isEmptyTextNode(element);
|
|
345
|
-
const commonHeadingProps = () => ({
|
|
346
|
-
...attributes,
|
|
347
|
-
...element.attr,
|
|
348
|
-
className: `content-editable ${isEmpty ? "empty" : ""} theme-element`
|
|
349
|
-
});
|
|
350
|
-
const commonParaProps = paraType => ({
|
|
351
|
-
...attributes,
|
|
352
|
-
...element.attr,
|
|
353
|
-
className: `content-editable ${isEmpty ? "empty" : ""} theme-element ${paraType}`
|
|
354
|
-
});
|
|
355
253
|
switch (element.type) {
|
|
356
254
|
case "headingOne":
|
|
357
255
|
return /*#__PURE__*/_jsx("h1", {
|
|
358
|
-
...
|
|
256
|
+
...attributes,
|
|
257
|
+
...element.attr,
|
|
258
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
|
359
259
|
placeholder: "Heading 1",
|
|
360
260
|
children: children
|
|
361
261
|
});
|
|
362
262
|
case "headingTwo":
|
|
363
263
|
return /*#__PURE__*/_jsx("h2", {
|
|
364
|
-
...
|
|
264
|
+
...attributes,
|
|
265
|
+
...element.attr,
|
|
266
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
|
365
267
|
placeholder: "Heading 2",
|
|
366
268
|
children: children
|
|
367
269
|
});
|
|
368
270
|
case "headingThree":
|
|
369
271
|
return /*#__PURE__*/_jsx("h3", {
|
|
370
|
-
...
|
|
272
|
+
...attributes,
|
|
273
|
+
...element.attr,
|
|
274
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
|
371
275
|
placeholder: "Heading 3",
|
|
372
276
|
children: children
|
|
373
277
|
});
|
|
374
|
-
case "headingFour":
|
|
375
|
-
return /*#__PURE__*/_jsx("h4", {
|
|
376
|
-
...commonHeadingProps(),
|
|
377
|
-
placeholder: "Heading 4",
|
|
378
|
-
children: children
|
|
379
|
-
});
|
|
380
|
-
case "headingFive":
|
|
381
|
-
return /*#__PURE__*/_jsx("h5", {
|
|
382
|
-
...commonHeadingProps(),
|
|
383
|
-
placeholder: "Heading 5",
|
|
384
|
-
children: children
|
|
385
|
-
});
|
|
386
|
-
case "headingSix":
|
|
387
|
-
return /*#__PURE__*/_jsx("h6", {
|
|
388
|
-
...commonHeadingProps(),
|
|
389
|
-
placeholder: "Heading 6",
|
|
390
|
-
children: children
|
|
391
|
-
});
|
|
392
|
-
case "paragraphOne":
|
|
393
|
-
return /*#__PURE__*/_jsx("p", {
|
|
394
|
-
...commonParaProps("para1"),
|
|
395
|
-
placeholder: "Paragraph 1",
|
|
396
|
-
children: children
|
|
397
|
-
});
|
|
398
|
-
case "paragraphTwo":
|
|
399
|
-
return /*#__PURE__*/_jsx("p", {
|
|
400
|
-
...commonParaProps("para2"),
|
|
401
|
-
placeholder: "Paragraph 2",
|
|
402
|
-
children: children
|
|
403
|
-
});
|
|
404
|
-
case "paragraphThree":
|
|
405
|
-
return /*#__PURE__*/_jsx("p", {
|
|
406
|
-
...commonParaProps("para3"),
|
|
407
|
-
placeholder: "Paragraph 3",
|
|
408
|
-
children: children
|
|
409
|
-
});
|
|
410
278
|
case "blockquote":
|
|
411
279
|
return /*#__PURE__*/_jsx("blockquote", {
|
|
412
280
|
...attributes,
|
|
@@ -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,7 +3,6 @@ import { toggleBlock } from "./SlateUtilityFunctions";
|
|
|
3
3
|
import insertNewLine from "./insertNewLine";
|
|
4
4
|
import { insertAccordion } from "./accordion";
|
|
5
5
|
import { isListItem } from "./helper";
|
|
6
|
-
import EDITORCMDS from "../common/EditorCmds";
|
|
7
6
|
const HOTKEYS = {
|
|
8
7
|
b: "bold",
|
|
9
8
|
i: "italic",
|
|
@@ -64,8 +63,7 @@ export const commands = props => {
|
|
|
64
63
|
try {
|
|
65
64
|
const {
|
|
66
65
|
event,
|
|
67
|
-
editor
|
|
68
|
-
needLayout
|
|
66
|
+
editor
|
|
69
67
|
} = props;
|
|
70
68
|
if (HOTKEYS[event.key]) {
|
|
71
69
|
event.preventDefault();
|
|
@@ -75,11 +73,6 @@ export const commands = props => {
|
|
|
75
73
|
} else {
|
|
76
74
|
Editor.addMark(editor, HOTKEYS[event.key], true);
|
|
77
75
|
}
|
|
78
|
-
} else if (EDITORCMDS[event.key]) {
|
|
79
|
-
EDITORCMDS[event.key](event, {
|
|
80
|
-
editor,
|
|
81
|
-
needLayout
|
|
82
|
-
});
|
|
83
76
|
}
|
|
84
77
|
} catch (err) {
|
|
85
78
|
console.log(err);
|
|
@@ -103,7 +96,7 @@ export const indentation = props => {
|
|
|
103
96
|
Transforms.wrapNodes(editor, {
|
|
104
97
|
type: listItem.type,
|
|
105
98
|
children: [{
|
|
106
|
-
text:
|
|
99
|
+
text: ''
|
|
107
100
|
}]
|
|
108
101
|
});
|
|
109
102
|
} else {
|
|
@@ -160,7 +153,7 @@ const checkListEnterEvent = (editor, type) => {
|
|
|
160
153
|
Transforms.insertNodes(editor, {
|
|
161
154
|
type: "check-list-item",
|
|
162
155
|
children: [{
|
|
163
|
-
text:
|
|
156
|
+
text: ''
|
|
164
157
|
}]
|
|
165
158
|
}, {
|
|
166
159
|
at: newPath
|
|
@@ -169,7 +162,7 @@ const checkListEnterEvent = (editor, type) => {
|
|
|
169
162
|
// focus on the end of the line
|
|
170
163
|
Transforms.move(editor, {
|
|
171
164
|
distance: 1,
|
|
172
|
-
unit:
|
|
165
|
+
unit: 'line'
|
|
173
166
|
});
|
|
174
167
|
} else {
|
|
175
168
|
toggleBlock(editor, type);
|
|
@@ -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
|
};
|
|
@@ -216,17 +216,6 @@ const getScrollElement = () => {
|
|
|
216
216
|
const scrollFrom = isSlateWrapperScroll ? slateWrapper : window;
|
|
217
217
|
return scrollFrom;
|
|
218
218
|
};
|
|
219
|
-
const handleLinkBtnClick = (e, props) => {
|
|
220
|
-
if (e) {
|
|
221
|
-
e.preventDefault();
|
|
222
|
-
e.stopPropagation();
|
|
223
|
-
}
|
|
224
|
-
if (props.target) {
|
|
225
|
-
window.open(props.href);
|
|
226
|
-
} else {
|
|
227
|
-
window.location.href = props.href;
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
219
|
export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}) => {
|
|
231
220
|
const props = {};
|
|
232
221
|
if (!readOnly) {
|
|
@@ -317,22 +306,23 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
|
317
306
|
|
|
318
307
|
// for iphone fix
|
|
319
308
|
if (props.component === "a" && props.href) {
|
|
320
|
-
|
|
321
|
-
if (isMobile) {
|
|
309
|
+
if (getDevice(window.innerWidth) === "xs") {
|
|
322
310
|
props.component = "button"; // iphone is opening two tabs, on open in new tab because of a tag.
|
|
323
311
|
}
|
|
324
312
|
|
|
325
|
-
let touchEndClicked = false;
|
|
326
313
|
props.onTouchEnd = e => {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
314
|
+
if (e) {
|
|
315
|
+
// onTouchEnd will get triggered on web, only for image element, for that case event is getting undefined.
|
|
316
|
+
e.preventDefault();
|
|
317
|
+
e.stopPropagation();
|
|
318
|
+
}
|
|
319
|
+
if (props.target) {
|
|
320
|
+
window.open(props.href);
|
|
321
|
+
} else {
|
|
322
|
+
window.location.href = props.href;
|
|
335
323
|
}
|
|
324
|
+
};
|
|
325
|
+
props.onClick = () => {
|
|
336
326
|
return false;
|
|
337
327
|
};
|
|
338
328
|
}
|
|
@@ -377,53 +367,4 @@ export const decodeString = str => {
|
|
|
377
367
|
} catch (err) {
|
|
378
368
|
console.log(err);
|
|
379
369
|
}
|
|
380
|
-
};
|
|
381
|
-
export const getContrastColor = color => {
|
|
382
|
-
let r, g, b;
|
|
383
|
-
|
|
384
|
-
// Check if the color is in hex format
|
|
385
|
-
if (color.startsWith("#")) {
|
|
386
|
-
r = parseInt(color.substring(1, 3), 16);
|
|
387
|
-
g = parseInt(color.substring(3, 5), 16);
|
|
388
|
-
b = parseInt(color.substring(5, 7), 16);
|
|
389
|
-
}
|
|
390
|
-
// Check if the color is in RGB/RGBA format
|
|
391
|
-
else if (color.startsWith("rgb")) {
|
|
392
|
-
const rgbValues = color.replace(/^rgba?\(|\s+|\)$/g, "") // Remove the rgb/rgba and spaces
|
|
393
|
-
.split(","); // Split the values into an array
|
|
394
|
-
|
|
395
|
-
r = parseInt(rgbValues[0]);
|
|
396
|
-
g = parseInt(rgbValues[1]);
|
|
397
|
-
b = parseInt(rgbValues[2]);
|
|
398
|
-
} else {
|
|
399
|
-
// If the format is not recognized, default to black text
|
|
400
|
-
return "#000000";
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// Calculate relative luminance
|
|
404
|
-
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
405
|
-
|
|
406
|
-
// Return black for light colors, white for dark colors
|
|
407
|
-
return luminance > 0.5 ? "#000000" : "#FFFFFF";
|
|
408
|
-
};
|
|
409
|
-
export const onDeleteKey = (event, {
|
|
410
|
-
editor
|
|
411
|
-
}) => {
|
|
412
|
-
try {
|
|
413
|
-
const {
|
|
414
|
-
selection
|
|
415
|
-
} = editor;
|
|
416
|
-
if (selection) {
|
|
417
|
-
// If text is selected, delete the selection
|
|
418
|
-
Transforms.delete(editor);
|
|
419
|
-
} else {
|
|
420
|
-
// If no text is selected, handle deleting the next character/element
|
|
421
|
-
Transforms.delete(editor, {
|
|
422
|
-
unit: "character",
|
|
423
|
-
reverse: false
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
} catch (err) {
|
|
427
|
-
console.log(err);
|
|
428
|
-
}
|
|
429
370
|
};
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const LinkPopupStyles = theme => ({
|
|
2
|
-
addLinkField: {
|
|
3
|
-
"& .MuiOutlinedInput-input": {
|
|
4
|
-
fontSize: "12px",
|
|
5
|
-
fontWeight: 500,
|
|
6
|
-
color: `${theme?.palette?.editor?.textColor} !important`
|
|
7
|
-
},
|
|
8
|
-
"& .MuiFormHelperText-root": {
|
|
9
|
-
color: `${theme?.palette?.editor?.textColor} !important`
|
|
10
|
-
},
|
|
11
|
-
"& .MuiOutlinedInput-root": {
|
|
12
|
-
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.16)",
|
|
13
|
-
color: `${theme?.palette?.editor?.textColor} !important`,
|
|
14
|
-
borderRadius: "7px",
|
|
15
|
-
"& fieldset": {
|
|
16
|
-
borderColor: "#D8DDE1"
|
|
17
|
-
},
|
|
18
|
-
"&:hover fieldset": {
|
|
19
|
-
borderColor: "#64748B"
|
|
20
|
-
},
|
|
21
|
-
"&.Mui-focused fieldset": {
|
|
22
|
-
borderColor: "#2563EB"
|
|
23
|
-
},
|
|
24
|
-
"& .MuiFormLabel-root": {}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
export default LinkPopupStyles;
|