@flozy/editor 5.5.7 → 5.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/ChatEditor.js +34 -25
- package/dist/Editor/CommonEditor.js +13 -26
- package/dist/Editor/Editor.css +19 -102
- package/dist/Editor/Elements/AI/AIInput.js +1 -0
- package/dist/Editor/Elements/AI/CustomSelect.js +10 -17
- package/dist/Editor/Elements/AI/PopoverAIInput.js +53 -59
- package/dist/Editor/Elements/AI/Styles.js +6 -24
- package/dist/Editor/Elements/Accordion/Accordion.js +1 -8
- package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
- package/dist/Editor/Elements/Button/EditorButton.js +1 -6
- package/dist/Editor/Elements/Carousel/CarouselItem.js +3 -11
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +5 -7
- package/dist/Editor/Elements/Color Picker/Styles.js +3 -8
- package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
- package/dist/Editor/Elements/Divider/Divider.js +20 -36
- package/dist/Editor/Elements/Embed/Image.js +16 -51
- package/dist/Editor/Elements/Embed/Video.js +3 -26
- package/dist/Editor/Elements/Form/Form.js +2 -38
- package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormDate.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormEmail.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormText.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -6
- package/dist/Editor/Elements/Form/FormPopup.js +9 -12
- package/dist/Editor/Elements/Form/Workflow/Styles.js +0 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +2 -4
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -20
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -1
- package/dist/Editor/Elements/Grid/GridButton.js +2 -2
- package/dist/Editor/Elements/Grid/GridItem.js +36 -47
- package/dist/Editor/Elements/Grid/Styles.js +0 -50
- package/dist/Editor/Elements/Link/LinkButton.js +1 -1
- package/dist/Editor/Elements/Search/SearchButton.js +0 -1
- package/dist/Editor/Elements/Signature/Signature.css +1 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
- package/dist/Editor/Elements/Signature/SignaturePopup.js +52 -17
- package/dist/Editor/Elements/SimpleText/style.js +0 -15
- package/dist/Editor/Elements/Table/Styles.js +78 -88
- package/dist/Editor/Elements/Table/Table.js +140 -263
- package/dist/Editor/Elements/Table/TableCell.js +111 -365
- package/dist/Editor/Elements/Table/TablePopup.js +3 -9
- package/dist/Editor/Elements/Table/TableRow.js +2 -10
- package/dist/Editor/Elements/TopBanner/TopBanner.js +1 -2
- package/dist/Editor/MiniEditor.js +2 -21
- package/dist/Editor/Styles/EditorStyles.js +4 -13
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +0 -10
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +12 -7
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -26
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +0 -3
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -5
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +8 -8
- package/dist/Editor/Toolbar/Mini/Styles.js +1 -9
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +3 -7
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -6
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +15 -19
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +58 -547
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +16 -28
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -3
- package/dist/Editor/Toolbar/Toolbar.js +0 -6
- package/dist/Editor/Toolbar/toolbarGroups.js +0 -4
- package/dist/Editor/assets/svg/BrainIcon.js +2 -2
- package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
- package/dist/Editor/common/ColorPickerButton.js +45 -85
- package/dist/Editor/common/DnD/Draggable.js +1 -2
- package/dist/Editor/common/FontLoader/FontLoader.js +2 -2
- package/dist/Editor/common/Icon.js +21 -54
- package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -2
- package/dist/Editor/common/ImageSelector/Styles.js +6 -47
- package/dist/Editor/common/ImageSelector/UploadStyles.js +6 -18
- package/dist/Editor/common/LinkSettings/NavComponents.js +1 -2
- package/dist/Editor/common/LinkSettings/index.js +1 -2
- package/dist/Editor/common/MentionsPopup/Styles.js +8 -142
- package/dist/Editor/common/MentionsPopup/index.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +12 -107
- package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
- package/dist/Editor/common/RnD/ShadowElement.js +1 -1
- package/dist/Editor/common/RnD/VirtualElement/index.js +1 -5
- package/dist/Editor/common/RnD/index.js +3 -4
- package/dist/Editor/common/Section/index.js +3 -3
- package/dist/Editor/common/Section/styles.js +1 -5
- package/dist/Editor/common/Shorthands/elements.js +1 -13
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +7 -35
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +2 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +1 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +0 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +6 -22
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +2 -21
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -20
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +2 -12
- package/dist/Editor/common/StyleBuilder/formStyle.js +149 -268
- package/dist/Editor/common/StyleBuilder/index.js +20 -101
- package/dist/Editor/common/StyleBuilder/tableStyle.js +25 -69
- package/dist/Editor/common/SwipeableDrawer/style.js +4 -15
- package/dist/Editor/common/ToolbarIcon.js +1 -1
- package/dist/Editor/common/Uploader.js +37 -39
- package/dist/Editor/common/iconListV2.js +74 -598
- package/dist/Editor/common/iconslist.js +19 -25
- package/dist/Editor/commonStyle.js +15 -421
- package/dist/Editor/helper/deserialize/index.js +2 -31
- package/dist/Editor/helper/index.js +2 -15
- package/dist/Editor/helper/theme.js +1 -15
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/plugins/withCustomDeleteBackward.js +3 -34
- package/dist/Editor/plugins/withEmbeds.js +26 -30
- package/dist/Editor/plugins/withHTML.js +12 -100
- package/dist/Editor/plugins/withLayout.js +0 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +11 -31
- package/dist/Editor/utils/brains.js +1 -1
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +1 -26
- package/dist/Editor/utils/customHooks/useResize.js +4 -7
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -6
- package/dist/Editor/utils/embed.js +1 -2
- package/dist/Editor/utils/events.js +1 -0
- package/dist/Editor/utils/font.js +4 -11
- package/dist/Editor/utils/formfield.js +4 -8
- package/dist/Editor/utils/helper.js +2 -100
- package/dist/Editor/utils/insertNewLine.js +1 -19
- package/dist/Editor/utils/serializeToText.js +0 -2
- package/dist/Editor/utils/table.js +24 -228
- package/package.json +2 -2
- package/dist/Editor/Elements/DataView/DataView.js +0 -124
- package/dist/Editor/Elements/DataView/DataViewButton.js +0 -23
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +0 -83
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +0 -33
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +0 -180
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +0 -62
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +0 -68
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +0 -35
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +0 -39
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +0 -30
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +0 -30
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +0 -35
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +0 -36
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +0 -17
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +0 -29
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +0 -38
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +0 -86
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +0 -71
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +0 -138
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -213
- package/dist/Editor/Elements/DataView/Layouts/Formula.js +0 -29
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +0 -113
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +0 -44
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +0 -146
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +0 -79
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +0 -57
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +0 -101
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +0 -174
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +0 -241
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +0 -45
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +0 -32
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -110
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +0 -217
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +0 -131
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +0 -253
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +0 -85
- package/dist/Editor/Elements/DataView/Layouts/colStyles.js +0 -10
- package/dist/Editor/Elements/DataView/Layouts/index.js +0 -25
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +0 -277
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +0 -15
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +0 -88
- package/dist/Editor/Elements/DataView/styles.js +0 -169
- package/dist/Editor/Elements/Table/AddRowCol.js +0 -77
- package/dist/Editor/Elements/Table/DragButton.js +0 -142
- package/dist/Editor/Elements/Table/DragStyles.js +0 -70
- package/dist/Editor/Elements/Table/Draggable.js +0 -25
- package/dist/Editor/Elements/Table/Droppable.js +0 -53
- package/dist/Editor/Elements/Table/TableTool.js +0 -101
- package/dist/Editor/Elements/Table/tableHelper.js +0 -71
- package/dist/Editor/assets/svg/ArrowDownIcon.js +0 -25
- package/dist/Editor/assets/svg/ArrowUpIcon.js +0 -25
- package/dist/Editor/assets/svg/CalenderIconTick.js +0 -64
- package/dist/Editor/assets/svg/ChervDown.js +0 -18
- package/dist/Editor/assets/svg/ChervUp.js +0 -18
- package/dist/Editor/assets/svg/DataTableIcon.js +0 -50
- package/dist/Editor/assets/svg/DuplicateIcon.js +0 -23
- package/dist/Editor/assets/svg/EyeIcon.js +0 -23
- package/dist/Editor/assets/svg/EyeSlash.js +0 -43
- package/dist/Editor/assets/svg/HashtagIcon.js +0 -33
- package/dist/Editor/assets/svg/PlusIcon.js +0 -23
- package/dist/Editor/assets/svg/SelectRoundedIcon.js +0 -24
- package/dist/Editor/assets/svg/SortByIcon.js +0 -33
- package/dist/Editor/assets/svg/TableIcons.js +0 -220
- package/dist/Editor/assets/svg/TickOutlined.js +0 -23
- package/dist/Editor/assets/svg/TrashCanIcon.js +0 -38
- package/dist/Editor/common/Select/index.js +0 -20
- package/dist/Editor/common/Select/styles.js +0 -17
- package/dist/Editor/helper/enforceDateFormat.js +0 -41
- package/dist/Editor/hooks/useTable.js +0 -210
- package/dist/Editor/utils/dataView.js +0 -43
@@ -1,26 +1,4 @@
|
|
1
1
|
import { jsx } from "slate-hyperscript";
|
2
|
-
const inlineStyles = [{
|
3
|
-
key: "bold",
|
4
|
-
getStyle: styles => styles.fontWeight === "bold" || parseInt(styles.fontWeight, 10) >= 700
|
5
|
-
}, {
|
6
|
-
key: "italic",
|
7
|
-
getStyle: styles => styles.fontStyle === "italic"
|
8
|
-
}, {
|
9
|
-
key: "underline",
|
10
|
-
getStyle: styles => styles.textDecoration.includes("underline")
|
11
|
-
}];
|
12
|
-
function getInlineTextStyles(element) {
|
13
|
-
if (!element || !element.style) return {};
|
14
|
-
const styles = element.style;
|
15
|
-
const elementStyles = inlineStyles.reduce((total, currVal) => {
|
16
|
-
const style = currVal.getStyle(styles);
|
17
|
-
if (style) {
|
18
|
-
total[currVal.key] = style;
|
19
|
-
}
|
20
|
-
return total;
|
21
|
-
}, {});
|
22
|
-
return elementStyles;
|
23
|
-
}
|
24
2
|
const handleTableCell = (el, children) => {
|
25
3
|
const wrapChild = children?.map(c => {
|
26
4
|
if (typeof c === "string") {
|
@@ -36,10 +14,7 @@ const handleTableCell = (el, children) => {
|
|
36
14
|
});
|
37
15
|
return {
|
38
16
|
type: "table-cell",
|
39
|
-
overwriteChild: wrapChild
|
40
|
-
size: {
|
41
|
-
width: 120
|
42
|
-
}
|
17
|
+
overwriteChild: wrapChild
|
43
18
|
};
|
44
19
|
};
|
45
20
|
const INLINE_TAGS = ["A", "ABBR", "B", "BDO", "CITE", "CODE", "DATA", "DEL", "DFN", "IMG", "INS", "KBD", "LABEL", "MARK", "Q", "SAMP", "SMALL", "SPAN", "SUB", "SUP", "TIME", "VAR"];
|
@@ -160,13 +135,9 @@ const TEXT_TAGS = {
|
|
160
135
|
|
161
136
|
const deserialize = el => {
|
162
137
|
if (el.nodeType === 3) {
|
163
|
-
// if there is any line-breaks
|
164
138
|
const match = /\r|\n/.exec(el.textContent);
|
165
139
|
const text = el.textContent.replace(/\r|\n/g, "").trim();
|
166
|
-
return match && !text ? null :
|
167
|
-
text,
|
168
|
-
...getInlineTextStyles(el.parentNode)
|
169
|
-
};
|
140
|
+
return match && !text ? null : el.textContent;
|
170
141
|
} else if (el.nodeType !== 1) {
|
171
142
|
return null;
|
172
143
|
} else if (el.nodeName === "BR") {
|
@@ -308,13 +308,7 @@ export const getTextColor = (color = "") => {
|
|
308
308
|
color: "transparent !important",
|
309
309
|
caretColor: "black",
|
310
310
|
"& span": {
|
311
|
-
color: "transparent !important"
|
312
|
-
"& ::selection": {
|
313
|
-
color: "#000 !important"
|
314
|
-
}
|
315
|
-
},
|
316
|
-
"& ::selection": {
|
317
|
-
color: "#000 !important"
|
311
|
+
color: "transparent !important"
|
318
312
|
}
|
319
313
|
} : {
|
320
314
|
color
|
@@ -358,7 +352,7 @@ export const clearBrainText = editor => {
|
|
358
352
|
} = editor;
|
359
353
|
if (selection) {
|
360
354
|
const [currentNode, currentPath] = Editor.node(editor, selection);
|
361
|
-
const cleanedText = Node.string(currentNode).replace(/\/
|
355
|
+
const cleanedText = Node.string(currentNode).replace(/\/b(?:rain|rai|ra|r)?/g, "").trim();
|
362
356
|
Transforms.insertText(editor, cleanedText, {
|
363
357
|
at: currentPath
|
364
358
|
});
|
@@ -366,11 +360,4 @@ export const clearBrainText = editor => {
|
|
366
360
|
} catch (err) {
|
367
361
|
console.log(err);
|
368
362
|
}
|
369
|
-
};
|
370
|
-
export const clearSelectionOnly = editor => {
|
371
|
-
try {
|
372
|
-
Transforms.deselect(editor);
|
373
|
-
} catch (err) {
|
374
|
-
console.log(err);
|
375
|
-
}
|
376
363
|
};
|
@@ -54,20 +54,6 @@ const overrides = {
|
|
54
54
|
return `${val?.topLeft}px ${val?.topRight}px ${val?.bottomLeft}px ${val?.bottomRight}px`;
|
55
55
|
}
|
56
56
|
};
|
57
|
-
export const checkXS = (val = {}) => {
|
58
|
-
try {
|
59
|
-
if (typeof val === "object") {
|
60
|
-
if (val?.xs === undefined && val?.lg !== undefined) {
|
61
|
-
val.xs = val.lg;
|
62
|
-
}
|
63
|
-
return val;
|
64
|
-
}
|
65
|
-
return val;
|
66
|
-
} catch (err) {
|
67
|
-
console.log(err);
|
68
|
-
return val;
|
69
|
-
}
|
70
|
-
};
|
71
57
|
export const getBreakPointsValue = (value, breakpoint, ot = null, ov = false) => {
|
72
58
|
try {
|
73
59
|
if (breakpoint) {
|
@@ -81,7 +67,7 @@ export const getBreakPointsValue = (value, breakpoint, ot = null, ov = false) =>
|
|
81
67
|
return value ? value[breakpoint] || value["lg"] : value;
|
82
68
|
}
|
83
69
|
} else if (typeof value === "object") {
|
84
|
-
return !breakpoint && value["lg"] ? !ov ? value :
|
70
|
+
return !breakpoint && value["lg"] ? !ov ? value : overrideValues(value, ot) : value[breakpoint] || copyAllLg(value, ot);
|
85
71
|
} else {
|
86
72
|
// consider without breakpoints
|
87
73
|
return copyAllLg(value, ot);
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Editor, Node, Path, Point,
|
2
|
-
import {
|
1
|
+
import { Editor, Node, Path, Point, Transforms } from "slate";
|
2
|
+
import { getNextNode } from "../utils/helper";
|
3
3
|
const BACKWARD_BLOCKS = ["list-item", "signature"];
|
4
4
|
const isNodeTextEmpty = node => {
|
5
5
|
const nodeText = Node.string(node);
|
@@ -30,41 +30,10 @@ const withCustomDeleteBackward = editor => {
|
|
30
30
|
return;
|
31
31
|
}
|
32
32
|
}
|
33
|
-
if (selection && Range.isCollapsed(selection)) {
|
34
|
-
const [currentNode, path] = Editor.node(editor, selection);
|
35
|
-
if (currentNode && typeof currentNode.text === 'string') {
|
36
|
-
const text = currentNode.text;
|
37
|
-
if (containsSurrogatePair(text)) {
|
38
|
-
// Check if the cursor is at the end of a surrogate pair
|
39
|
-
const {
|
40
|
-
offset
|
41
|
-
} = selection.anchor;
|
42
|
-
const beforeCursor = text.slice(0, offset);
|
43
|
-
const afterCursor = text.slice(offset);
|
44
|
-
if (containsSurrogatePair(beforeCursor) || containsSurrogatePair(afterCursor)) {
|
45
|
-
// Delete the entire surrogate pair
|
46
|
-
Transforms.delete(editor, {
|
47
|
-
at: {
|
48
|
-
anchor: {
|
49
|
-
path,
|
50
|
-
offset: offset - 2
|
51
|
-
},
|
52
|
-
// Move back 2 for surrogate pair
|
53
|
-
focus: {
|
54
|
-
path,
|
55
|
-
offset
|
56
|
-
}
|
57
|
-
}
|
58
|
-
});
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
33
|
|
65
34
|
// Check if current node is a list item and is the last one, signature node
|
66
35
|
const [node] = Editor.nodes(editor, {
|
67
|
-
match: n => BACKWARD_BLOCKS
|
36
|
+
match: n => BACKWARD_BLOCKS?.includes(n.type) // Adjust based on your list item type
|
68
37
|
});
|
69
38
|
|
70
39
|
if (node) {
|
@@ -40,36 +40,32 @@ const withEmbeds = editor => {
|
|
40
40
|
}
|
41
41
|
};
|
42
42
|
editor.insertBreak = (...args) => {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
insertBreak(...args);
|
70
|
-
}
|
71
|
-
} catch (err) {
|
72
|
-
console.log(err);
|
43
|
+
const parentPath = Path.parent(editor.selection.focus.path);
|
44
|
+
const parentNode = Node.get(editor, parentPath);
|
45
|
+
if (editor.isVoid(parentNode)) {
|
46
|
+
const nextPath = Path.next(parentPath);
|
47
|
+
Transforms.insertNodes(editor, {
|
48
|
+
type: "paragraph",
|
49
|
+
children: [{
|
50
|
+
text: ""
|
51
|
+
}]
|
52
|
+
}, {
|
53
|
+
at: nextPath,
|
54
|
+
select: true // Focus on this node once inserted
|
55
|
+
});
|
56
|
+
} else if (AvoidCopying.indexOf(parentNode?.type) >= 0) {
|
57
|
+
const nextPath = Path.next(parentPath);
|
58
|
+
Transforms.insertNodes(editor, {
|
59
|
+
type: "paragraph",
|
60
|
+
children: [{
|
61
|
+
text: ""
|
62
|
+
}]
|
63
|
+
}, {
|
64
|
+
at: nextPath,
|
65
|
+
select: true // Focus on this node once inserted
|
66
|
+
});
|
67
|
+
} else {
|
68
|
+
insertBreak(...args);
|
73
69
|
}
|
74
70
|
};
|
75
71
|
return editor;
|
@@ -2,45 +2,6 @@ import { Transforms, Editor, Element, Node, Path } from "slate";
|
|
2
2
|
import deserialize from "../helper/deserialize";
|
3
3
|
import { decodeAndParseBase64 } from "../utils/helper";
|
4
4
|
const avoidDefaultInsert = ["table", "grid"];
|
5
|
-
const NON_TEXT_TAGS = ["ol", "ul", "img", "table", "video", "a", "button", "GOOGLE-SHEETS-HTML-ORIGIN"];
|
6
|
-
const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree"];
|
7
|
-
const parseCopiedHTML = html => {
|
8
|
-
const parsed = new DOMParser().parseFromString(html, "text/html");
|
9
|
-
|
10
|
-
// if ol, ul are inside li, remove and push ol,ul after that li to maintain format between our slate list and external source list's json
|
11
|
-
parsed.querySelectorAll("li > ul, li > ol").forEach(list => {
|
12
|
-
// Find the parent li
|
13
|
-
const parentLi = list.parentElement;
|
14
|
-
|
15
|
-
// Move the list after the parent li
|
16
|
-
parentLi.after(list);
|
17
|
-
});
|
18
|
-
|
19
|
-
// to handle google docs list
|
20
|
-
parsed.querySelectorAll("li p, li div").forEach(element => {
|
21
|
-
const parent = element.parentNode;
|
22
|
-
// Move all child nodes of <p> or <div> to its parent <li>
|
23
|
-
while (element.firstChild) {
|
24
|
-
parent.insertBefore(element.firstChild, element);
|
25
|
-
}
|
26
|
-
// Remove the <p> or <div> element
|
27
|
-
parent.removeChild(element);
|
28
|
-
});
|
29
|
-
|
30
|
-
// claude.ai, copy list inbetween, some li tags are not wrapped with ul or ol
|
31
|
-
parsed.querySelectorAll("li").forEach(li => {
|
32
|
-
// Check if the parent of <li> is not a <ul> or <ol>
|
33
|
-
if (!li.parentElement || li.parentElement.tagName !== "UL" && li.parentElement.tagName !== "OL") {
|
34
|
-
// Create a <ul> element
|
35
|
-
const ul = document.createElement("ul");
|
36
|
-
// Append the <li> to the <ul>
|
37
|
-
ul.appendChild(li.cloneNode(true)); // Clone the <li>
|
38
|
-
// Replace the original <li> in the DOM with the <ul>
|
39
|
-
li.replaceWith(ul);
|
40
|
-
}
|
41
|
-
});
|
42
|
-
return parsed;
|
43
|
-
};
|
44
5
|
const loopChildren = (children = [], defaultInsert) => {
|
45
6
|
if (!children?.length) {
|
46
7
|
return defaultInsert;
|
@@ -65,7 +26,7 @@ const getCurrentElement = editor => {
|
|
65
26
|
return null;
|
66
27
|
}
|
67
28
|
};
|
68
|
-
|
29
|
+
const getCurrentElementText = editor => {
|
69
30
|
try {
|
70
31
|
if (editor.selection) {
|
71
32
|
return Editor.string(editor, editor?.selection?.anchor?.path);
|
@@ -100,23 +61,12 @@ const insertAtNextNode = (editor, formattedFragment) => {
|
|
100
61
|
console.log(err);
|
101
62
|
}
|
102
63
|
};
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
// insertAtNextNode(editor, fragment);
|
110
|
-
// } else {
|
111
|
-
// defaultInsert();
|
112
|
-
// }
|
113
|
-
// };
|
114
|
-
|
115
|
-
const getTableCellChild = (fragment = []) => {
|
116
|
-
const table = fragment.find(node => node.type === "table");
|
117
|
-
const row = table?.children?.find(node => node.type === "table-row");
|
118
|
-
const cell = row?.children?.find(node => node.type === "table-cell");
|
119
|
-
return cell?.children || [];
|
64
|
+
const handleInsert = (editor, defaultInsert, fragment = []) => {
|
65
|
+
if (getCurrentElementText(editor) && fragment.some(f => f.type === "table")) {
|
66
|
+
insertAtNextNode(editor, fragment);
|
67
|
+
} else {
|
68
|
+
defaultInsert();
|
69
|
+
}
|
120
70
|
};
|
121
71
|
const formatFragment = {
|
122
72
|
"list-item": fragment => {
|
@@ -165,21 +115,8 @@ const withHtml = editor => {
|
|
165
115
|
const html = data?.getData("text/html");
|
166
116
|
const currentEl = getCurrentElement(editor);
|
167
117
|
const eltype = currentEl?.type;
|
168
|
-
const firstNode = editor?.children?.[0];
|
169
|
-
const titlePath = firstNode?.type === "topbanner" ? 1 : 0;
|
170
|
-
const isTitlePath = editor.needLayout && editor?.selection?.anchor?.path[0] === titlePath;
|
171
118
|
if (slateHTML && !formatFragment[eltype]) {
|
172
|
-
const [tableCellNode] = Editor.nodes(editor, {
|
173
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
|
174
|
-
});
|
175
119
|
const decoded = decodeAndParseBase64(slateHTML);
|
176
|
-
if (tableCellNode) {
|
177
|
-
const tableCellChild = getTableCellChild(decoded);
|
178
|
-
if (tableCellChild?.length) {
|
179
|
-
Transforms.insertFragment(editor, tableCellChild);
|
180
|
-
return;
|
181
|
-
}
|
182
|
-
}
|
183
120
|
const tableNode = getFocusedNode(editor, "table");
|
184
121
|
const onlyTextNode = getFocusedNode(editor, "freegrid");
|
185
122
|
|
@@ -217,38 +154,22 @@ const withHtml = editor => {
|
|
217
154
|
Transforms.insertText(editor, text);
|
218
155
|
}
|
219
156
|
} else {
|
220
|
-
|
221
|
-
if (isTitlePath && !isTextNode) {
|
222
|
-
insertAtNextNode(editor, decoded);
|
223
|
-
return;
|
224
|
-
}
|
225
|
-
const currentText = getCurrentElementText(editor);
|
226
|
-
if (currentText?.trim() && !isTextNode) {
|
227
|
-
insertAtNextNode(editor, decoded);
|
228
|
-
return;
|
229
|
-
}
|
230
|
-
insertData(data);
|
157
|
+
handleInsert(editor, () => insertData(data), decoded);
|
231
158
|
}
|
232
159
|
} else if (html) {
|
233
|
-
const parsed =
|
234
|
-
const rootElement = parsed.body;
|
235
|
-
const isNonText = rootElement ? rootElement?.querySelector(NON_TEXT_TAGS.toString()) : false;
|
160
|
+
const parsed = new DOMParser().parseFromString(html, "text/html");
|
236
161
|
const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
|
237
162
|
if (isGoogleSheet) {
|
238
163
|
if (editor.isChatEditor) {
|
239
164
|
return;
|
240
165
|
}
|
241
|
-
const table =
|
166
|
+
const table = parsed.body.querySelector("table");
|
242
167
|
const colGrp = table.querySelector("colgroup");
|
243
168
|
if (colGrp) {
|
244
169
|
colGrp.remove();
|
245
170
|
}
|
246
171
|
const fragment = deserialize(table);
|
247
|
-
|
248
|
-
insertAtNextNode(editor, [fragment]);
|
249
|
-
} else {
|
250
|
-
Transforms.insertFragment(editor, [fragment]);
|
251
|
-
}
|
172
|
+
Transforms.insertFragment(editor, [fragment]);
|
252
173
|
return;
|
253
174
|
}
|
254
175
|
const fragment = deserialize(parsed.body);
|
@@ -262,16 +183,7 @@ const withHtml = editor => {
|
|
262
183
|
if (editor.isChatEditor && is_img_table) {
|
263
184
|
return;
|
264
185
|
}
|
265
|
-
|
266
|
-
insertAtNextNode(editor, formattedFragment);
|
267
|
-
return;
|
268
|
-
}
|
269
|
-
const currentText = getCurrentElementText(editor);
|
270
|
-
if (currentText?.trim() && isNonText) {
|
271
|
-
insertAtNextNode(editor, formattedFragment);
|
272
|
-
return;
|
273
|
-
}
|
274
|
-
Transforms.insertFragment(editor, formattedFragment);
|
186
|
+
handleInsert(editor, () => Transforms.insertFragment(editor, formattedFragment), formattedFragment);
|
275
187
|
return;
|
276
188
|
} else {
|
277
189
|
insertData(data);
|
@@ -43,9 +43,6 @@ import Code from "../Elements/EmbedScript/Code";
|
|
43
43
|
import FreeGrid from "../Elements/FreeGrid/FreeGrid";
|
44
44
|
import FreeGridItem from "../Elements/FreeGrid/FreeGridItem";
|
45
45
|
import FreeGridBox from "../Elements/FreeGrid/FreeGridBox";
|
46
|
-
import DataView from "../Elements/DataView/DataView";
|
47
|
-
import ViewData from "../Elements/DataView/Layouts/ViewData";
|
48
|
-
import ColumnView from "../Elements/DataView/Layouts/ColumnView";
|
49
46
|
import SearchAttachment from "../Elements/Search/SearchAttachment";
|
50
47
|
// import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
|
51
48
|
import { jsx as _jsx } from "react/jsx-runtime";
|
@@ -155,7 +152,7 @@ export const activeMark = (editor, format) => {
|
|
155
152
|
const defaultMarkData = {
|
156
153
|
color: "#000000",
|
157
154
|
bgColor: "#FFFFFF",
|
158
|
-
fontSize: "
|
155
|
+
fontSize: "normal",
|
159
156
|
fontFamily: "PoppinsRegular",
|
160
157
|
fontWeight: "normal"
|
161
158
|
};
|
@@ -170,16 +167,6 @@ export const activeMark = (editor, format) => {
|
|
170
167
|
};
|
171
168
|
export const getMarked = (leaf, children, theme) => {
|
172
169
|
const className = leaf?.doublequote ? "doublequote" : "";
|
173
|
-
if (leaf.highlight) {
|
174
|
-
children = /*#__PURE__*/_jsx("span", {
|
175
|
-
style: {
|
176
|
-
color: "inherit"
|
177
|
-
},
|
178
|
-
className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
|
179
|
-
,
|
180
|
-
children: children
|
181
|
-
});
|
182
|
-
}
|
183
170
|
if (leaf.bold) {
|
184
171
|
children = /*#__PURE__*/_jsx("strong", {
|
185
172
|
children: children
|
@@ -250,13 +237,21 @@ export const getMarked = (leaf, children, theme) => {
|
|
250
237
|
// },
|
251
238
|
...textStyles,
|
252
239
|
fontFamily: family,
|
253
|
-
fontWeight: leaf.fontWeight
|
254
|
-
WebkitTextFillColor: "unset !important"
|
240
|
+
fontWeight: leaf.fontWeight
|
255
241
|
},
|
256
242
|
children: children
|
257
243
|
})
|
258
244
|
});
|
259
245
|
}
|
246
|
+
if (leaf.highlight) {
|
247
|
+
children = /*#__PURE__*/_jsx("span", {
|
248
|
+
style: {
|
249
|
+
background: "#EAEBFE",
|
250
|
+
color: "inherit"
|
251
|
+
},
|
252
|
+
children: children
|
253
|
+
});
|
254
|
+
}
|
260
255
|
if (leaf.decoration === "link") {
|
261
256
|
children = /*#__PURE__*/_jsx("a", {
|
262
257
|
style: {
|
@@ -374,14 +369,12 @@ export const getBlock = props => {
|
|
374
369
|
});
|
375
370
|
case "orderedList":
|
376
371
|
return /*#__PURE__*/_jsx("ol", {
|
377
|
-
className: "listItemMargin",
|
378
372
|
type: "1",
|
379
373
|
...attributes,
|
380
374
|
children: children
|
381
375
|
});
|
382
376
|
case "unorderedList":
|
383
377
|
return /*#__PURE__*/_jsx("ul", {
|
384
|
-
className: "listItemMargin",
|
385
378
|
...attributes,
|
386
379
|
children: children
|
387
380
|
});
|
@@ -569,19 +562,6 @@ export const getBlock = props => {
|
|
569
562
|
contentEditable: false,
|
570
563
|
children: children
|
571
564
|
});
|
572
|
-
// Data View
|
573
|
-
case "dataView":
|
574
|
-
return /*#__PURE__*/_jsx(DataView, {
|
575
|
-
...props
|
576
|
-
});
|
577
|
-
case "viewData":
|
578
|
-
return /*#__PURE__*/_jsx(ViewData, {
|
579
|
-
...props
|
580
|
-
});
|
581
|
-
case "columnView":
|
582
|
-
return /*#__PURE__*/_jsx(ColumnView, {
|
583
|
-
...props
|
584
|
-
});
|
585
565
|
default:
|
586
566
|
return /*#__PURE__*/_jsx(SimpleText, {
|
587
567
|
...props,
|
@@ -18,7 +18,7 @@ export const insertBrain = (editor, data, position) => {
|
|
18
18
|
};
|
19
19
|
const [currentNode, currentPath] = Editor.node(editor, selection);
|
20
20
|
console.log('W1', Node.string(currentNode));
|
21
|
-
const cleanedText = Node.string(currentNode).replace(/\/
|
21
|
+
const cleanedText = Node.string(currentNode).replace(/\/b(?:rain|rai|ra|r)?/g, "").trim();
|
22
22
|
if (cleanedText) {
|
23
23
|
Transforms.delete(editor, {
|
24
24
|
at: Editor.range(editor, currentPath)
|
@@ -3,7 +3,6 @@ import { Box } from "@mui/material";
|
|
3
3
|
import { fontFamilyMap, sizeMap } from "../font";
|
4
4
|
import Mentions from "../../Elements/Mentions/Mentions";
|
5
5
|
import CheckList from "../../Elements/List/CheckList";
|
6
|
-
import SimpleText from "../../Elements/SimpleText";
|
7
6
|
import { isEmptyTextNode } from "../../helper";
|
8
7
|
import { getBreakPointsValue } from "../../helper/theme";
|
9
8
|
import insertNewLine from "../insertNewLine";
|
@@ -16,20 +15,6 @@ const LIST_FORMAT_TYPE = {
|
|
16
15
|
unorderedList: "list-item"
|
17
16
|
};
|
18
17
|
const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
|
19
|
-
export const serializeMentions = node => {
|
20
|
-
try {
|
21
|
-
if (node?.type === 'mention') {
|
22
|
-
return [node.character];
|
23
|
-
}
|
24
|
-
let children = Array.isArray(node) ? node : node?.children;
|
25
|
-
children = children && Array.isArray(children) ? children : [];
|
26
|
-
let mentions = children.map(child => serializeMentions(child)).flat();
|
27
|
-
return mentions.filter(Boolean);
|
28
|
-
} catch (err) {
|
29
|
-
console.log(err);
|
30
|
-
return [];
|
31
|
-
}
|
32
|
-
};
|
33
18
|
export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
34
19
|
const isActive = isBlockActive(editor, format);
|
35
20
|
const isList = list_types.includes(format);
|
@@ -260,13 +245,6 @@ export const getBlock = props => {
|
|
260
245
|
,
|
261
246
|
children: children
|
262
247
|
});
|
263
|
-
case "title":
|
264
|
-
return /*#__PURE__*/_jsx("h3", {
|
265
|
-
...attributes,
|
266
|
-
...element.attr,
|
267
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
268
|
-
children: children
|
269
|
-
});
|
270
248
|
case "headingThree":
|
271
249
|
return /*#__PURE__*/_jsx("h3", {
|
272
250
|
...attributes,
|
@@ -364,9 +342,6 @@ export const getBlock = props => {
|
|
364
342
|
...props
|
365
343
|
});
|
366
344
|
default:
|
367
|
-
return
|
368
|
-
...props,
|
369
|
-
isEmpty: isEmpty
|
370
|
-
});
|
345
|
+
return null;
|
371
346
|
}
|
372
347
|
};
|
@@ -4,10 +4,7 @@ const useResize = ({
|
|
4
4
|
parentDOM,
|
5
5
|
size: allSize,
|
6
6
|
isGrid,
|
7
|
-
onChange
|
8
|
-
MH,
|
9
|
-
MW,
|
10
|
-
MP
|
7
|
+
onChange
|
11
8
|
}) => {
|
12
9
|
const device = getDevice(window.innerWidth);
|
13
10
|
const defaultSize = getBreakPointsValue(allSize);
|
@@ -55,9 +52,9 @@ const useResize = ({
|
|
55
52
|
const cWP = calcWidth / width * 100;
|
56
53
|
const calcHeight = (parseInt(currentSize.height) || height) + e.movementY;
|
57
54
|
const calc = {
|
58
|
-
width: Math.max(calcWidth,
|
59
|
-
height: Math.max(calcHeight,
|
60
|
-
widthInPercent: cWP > 100 ? 100 : Math.max(cWP,
|
55
|
+
width: Math.max(calcWidth, 140),
|
56
|
+
height: Math.max(calcHeight, 50),
|
57
|
+
widthInPercent: cWP > 100 ? 100 : Math.max(cWP, 15)
|
61
58
|
};
|
62
59
|
latest = calc;
|
63
60
|
return calc;
|
@@ -2,8 +2,7 @@ import { useState } from "react";
|
|
2
2
|
const useTableResize = ({
|
3
3
|
parentDOM,
|
4
4
|
size: defaultSize,
|
5
|
-
onDone
|
6
|
-
minMaxProps = {}
|
5
|
+
onDone
|
7
6
|
}) => {
|
8
7
|
const {
|
9
8
|
width
|
@@ -39,13 +38,10 @@ const useTableResize = ({
|
|
39
38
|
setIsDone(1);
|
40
39
|
};
|
41
40
|
const onMouseMove = e => {
|
42
|
-
const {
|
43
|
-
minWidth
|
44
|
-
} = minMaxProps || {};
|
45
41
|
setSize(currentSize => {
|
46
42
|
const calcWidth = currentSize?.width + e.movementX;
|
47
43
|
return {
|
48
|
-
width:
|
44
|
+
width: calcWidth,
|
49
45
|
height: currentSize.height + e.movementY,
|
50
46
|
widthInPercent: calcWidth / width * 100
|
51
47
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Transforms } from "slate";
|
2
|
-
import insertNewLine
|
2
|
+
import insertNewLine from "./insertNewLine";
|
3
3
|
export const insertDefaultEmbed = (editor, type, defaultURL = "", extProps = {}) => {
|
4
4
|
try {
|
5
5
|
const url = defaultURL ? defaultURL : type === "image" ? "" : "";
|
@@ -56,7 +56,6 @@ export const insertEmbed = (editor, embedData, format) => {
|
|
56
56
|
at: editor.selection.anchor.path
|
57
57
|
});
|
58
58
|
insertNewLine(editor);
|
59
|
-
insertNewLineAfterCurrentPath(editor);
|
60
59
|
} catch (err) {
|
61
60
|
console.log(err);
|
62
61
|
}
|
@@ -5,6 +5,7 @@ import { insertAccordion } from "./accordion";
|
|
5
5
|
import { isListItem } from "./helper";
|
6
6
|
import RnDCtrlCmds from "./RnD/RnDCtrlCmds";
|
7
7
|
import EDITORCMDS from "../common/EditorCmds";
|
8
|
+
import { ReactEditor } from "slate-react";
|
8
9
|
const HOTKEYS = {
|
9
10
|
b: "bold",
|
10
11
|
i: "italic",
|
@@ -60,14 +60,7 @@ export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
|
|
60
60
|
};
|
61
61
|
});
|
62
62
|
export const headingMap = {
|
63
|
-
headingOne: "32px",
|
64
|
-
headingTwo: "24px",
|
65
|
-
headingThree: "19px"
|
66
|
-
};
|
67
|
-
export const fontWeightOptions = [{
|
68
|
-
text: "Bold",
|
69
|
-
value: "500"
|
70
|
-
}, {
|
71
|
-
text: "Bolder",
|
72
|
-
value: "600"
|
73
|
-
}];
|
63
|
+
"headingOne": "32px",
|
64
|
+
"headingTwo": "24px",
|
65
|
+
"headingThree": "19px"
|
66
|
+
};
|