@flozy/editor 5.4.0 → 5.4.1
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 +15 -29
- package/dist/Editor/Editor.css +18 -100
- package/dist/Editor/Elements/AI/AIInput.js +1 -0
- package/dist/Editor/Elements/AI/CustomSelect.js +11 -19
- package/dist/Editor/Elements/AI/PopoverAIInput.js +52 -58
- 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 +2 -9
- 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 -7
- 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 -39
- 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/FreeGrid/FreeGrid.js +1 -1
- 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 -2
- 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/List/CheckList.js +1 -2
- package/dist/Editor/Elements/Search/SearchAttachment.js +0 -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/index.js +1 -8
- package/dist/Editor/Elements/SimpleText/style.js +1 -20
- package/dist/Editor/Elements/Table/Styles.js +79 -82
- package/dist/Editor/Elements/Table/Table.js +140 -258
- 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 +1 -15
- 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 +6 -3
- package/dist/Editor/Toolbar/Mini/Styles.js +1 -4
- 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 +57 -555
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +16 -73
- 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 +4 -4
- package/dist/Editor/common/Icon.js +20 -23
- 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 -143
- package/dist/Editor/common/MentionsPopup/index.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +12 -108
- package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
- package/dist/Editor/common/RnD/ShadowElement.js +1 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -14
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +6 -9
- package/dist/Editor/common/RnD/VirtualElement/index.js +1 -5
- package/dist/Editor/common/RnD/index.js +2 -3
- 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 -9
- 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/card.js +2 -10
- 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/index.js +1 -3
- 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/pageSettingsStyle.js +0 -4
- 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 +36 -46
- package/dist/Editor/common/iconListV2.js +60 -616
- package/dist/Editor/common/iconslist.js +17 -23
- package/dist/Editor/commonStyle.js +11 -417
- package/dist/Editor/helper/deserialize/index.js +1 -4
- package/dist/Editor/helper/index.js +4 -17
- package/dist/Editor/helper/theme.js +1 -24
- package/dist/Editor/hooks/useMouseMove.js +2 -5
- package/dist/Editor/plugins/withCustomDeleteBackward.js +4 -36
- package/dist/Editor/plugins/withEmbeds.js +26 -30
- package/dist/Editor/plugins/withHTML.js +10 -61
- package/dist/Editor/plugins/withLayout.js +0 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +12 -39
- package/dist/Editor/utils/brains.js +1 -1
- package/dist/Editor/utils/button.js +4 -4
- 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 -103
- package/dist/Editor/utils/insertNewLine.js +1 -19
- package/dist/Editor/utils/pageSettings.js +2 -14
- 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 -67
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +0 -33
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +0 -162
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +0 -40
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +0 -67
- 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 -74
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +0 -64
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +0 -106
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -174
- 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 -37
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +0 -111
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +0 -60
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +0 -36
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +0 -101
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +0 -160
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +0 -190
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +0 -42
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +0 -30
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -110
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +0 -179
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +0 -112
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +0 -227
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +0 -80
- 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 -281
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +0 -15
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +0 -74
- package/dist/Editor/Elements/DataView/styles.js +0 -154
- 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/TableIcons.js +0 -220
- package/dist/Editor/common/Select/index.js +0 -20
- package/dist/Editor/common/Select/styles.js +0 -17
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
- package/dist/Editor/helper/enforceDateFormat.js +0 -41
- package/dist/Editor/hooks/useTable.js +0 -210
- package/dist/Editor/utils/dataView.js +0 -43
@@ -147,27 +147,4 @@ export const groupByBreakpoint = (styleProps, theme) => {
|
|
147
147
|
}
|
148
148
|
};
|
149
149
|
};
|
150
|
-
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
151
|
-
export const getBreakpointLineSpacing = (value, breakpoint) => {
|
152
|
-
try {
|
153
|
-
const values = getBreakPointsValue(value, breakpoint);
|
154
|
-
const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
|
155
|
-
if (values[b] || values["lg"]) {
|
156
|
-
const value = values[b] || values["lg"];
|
157
|
-
return {
|
158
|
-
...a,
|
159
|
-
[b]: value
|
160
|
-
};
|
161
|
-
} else {
|
162
|
-
return a;
|
163
|
-
}
|
164
|
-
}, {});
|
165
|
-
if (breakpoint) {
|
166
|
-
return value[breakpoint] || value["lg"] || value;
|
167
|
-
} else {
|
168
|
-
return cssVal["lg"];
|
169
|
-
}
|
170
|
-
} catch (err) {
|
171
|
-
// console.log(err);
|
172
|
-
}
|
173
|
-
};
|
150
|
+
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
@@ -35,7 +35,6 @@ export const EditorProvider = ({
|
|
35
35
|
path: null
|
36
36
|
});
|
37
37
|
const [fontFamilies, setFontFamilies] = useState({});
|
38
|
-
const [activeBreakPoint, setActiveBreakPoint] = useState("");
|
39
38
|
useEffect(() => {
|
40
39
|
window.updateSelectedItem = d => {
|
41
40
|
setSelectedElement(d);
|
@@ -98,10 +97,8 @@ export const EditorProvider = ({
|
|
98
97
|
setOpenAI,
|
99
98
|
updateDragging,
|
100
99
|
fontFamilies,
|
101
|
-
setFontFamilies
|
102
|
-
|
103
|
-
setActiveBreakPoint
|
104
|
-
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
|
100
|
+
setFontFamilies
|
101
|
+
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop]);
|
105
102
|
return /*#__PURE__*/_jsx(EditorContext.Provider, {
|
106
103
|
value: otherValues,
|
107
104
|
children: children
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { Editor, Node, Path, Point,
|
2
|
-
import {
|
3
|
-
const BACKWARD_BLOCKS = ["list-item", "signature"];
|
1
|
+
import { Editor, Node, Path, Point, Transforms } from "slate";
|
2
|
+
import { getNextNode } from "../utils/helper";
|
4
3
|
const isNodeTextEmpty = node => {
|
5
4
|
const nodeText = Node.string(node);
|
6
5
|
return nodeText.trim() === "";
|
@@ -29,41 +28,10 @@ const withCustomDeleteBackward = editor => {
|
|
29
28
|
return;
|
30
29
|
}
|
31
30
|
}
|
32
|
-
if (selection && Range.isCollapsed(selection)) {
|
33
|
-
const [currentNode, path] = Editor.node(editor, selection);
|
34
|
-
if (currentNode && typeof currentNode.text === 'string') {
|
35
|
-
const text = currentNode.text;
|
36
|
-
if (containsSurrogatePair(text)) {
|
37
|
-
// Check if the cursor is at the end of a surrogate pair
|
38
|
-
const {
|
39
|
-
offset
|
40
|
-
} = selection.anchor;
|
41
|
-
const beforeCursor = text.slice(0, offset);
|
42
|
-
const afterCursor = text.slice(offset);
|
43
|
-
if (containsSurrogatePair(beforeCursor) || containsSurrogatePair(afterCursor)) {
|
44
|
-
// Delete the entire surrogate pair
|
45
|
-
Transforms.delete(editor, {
|
46
|
-
at: {
|
47
|
-
anchor: {
|
48
|
-
path,
|
49
|
-
offset: offset - 2
|
50
|
-
},
|
51
|
-
// Move back 2 for surrogate pair
|
52
|
-
focus: {
|
53
|
-
path,
|
54
|
-
offset
|
55
|
-
}
|
56
|
-
}
|
57
|
-
});
|
58
|
-
return;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
31
|
|
64
|
-
// Check if current node is a list item and is the last one
|
32
|
+
// Check if current node is a list item and is the last one
|
65
33
|
const [node] = Editor.nodes(editor, {
|
66
|
-
match: n =>
|
34
|
+
match: n => n.type === "list-item" // Adjust based on your list item type
|
67
35
|
});
|
68
36
|
|
69
37
|
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,8 +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
5
|
const loopChildren = (children = [], defaultInsert) => {
|
8
6
|
if (!children?.length) {
|
9
7
|
return defaultInsert;
|
@@ -63,23 +61,12 @@ const insertAtNextNode = (editor, formattedFragment) => {
|
|
63
61
|
console.log(err);
|
64
62
|
}
|
65
63
|
};
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
// insertAtNextNode(editor, fragment);
|
73
|
-
// } else {
|
74
|
-
// defaultInsert();
|
75
|
-
// }
|
76
|
-
// };
|
77
|
-
|
78
|
-
const getTableCellChild = (fragment = []) => {
|
79
|
-
const table = fragment.find(node => node.type === "table");
|
80
|
-
const row = table?.children?.find(node => node.type === "table-row");
|
81
|
-
const cell = row?.children?.find(node => node.type === "table-cell");
|
82
|
-
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
|
+
}
|
83
70
|
};
|
84
71
|
const formatFragment = {
|
85
72
|
"list-item": fragment => {
|
@@ -128,21 +115,8 @@ const withHtml = editor => {
|
|
128
115
|
const html = data?.getData("text/html");
|
129
116
|
const currentEl = getCurrentElement(editor);
|
130
117
|
const eltype = currentEl?.type;
|
131
|
-
const firstNode = editor?.children?.[0];
|
132
|
-
const titlePath = firstNode?.type === "topbanner" ? 1 : 0;
|
133
|
-
const isTitlePath = editor.needLayout && editor?.selection?.anchor?.path[0] === titlePath;
|
134
118
|
if (slateHTML && !formatFragment[eltype]) {
|
135
|
-
const [tableCellNode] = Editor.nodes(editor, {
|
136
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
|
137
|
-
});
|
138
119
|
const decoded = decodeAndParseBase64(slateHTML);
|
139
|
-
if (tableCellNode) {
|
140
|
-
const tableCellChild = getTableCellChild(decoded);
|
141
|
-
if (tableCellChild?.length) {
|
142
|
-
Transforms.insertFragment(editor, tableCellChild);
|
143
|
-
return;
|
144
|
-
}
|
145
|
-
}
|
146
120
|
const tableNode = getFocusedNode(editor, "table");
|
147
121
|
const onlyTextNode = getFocusedNode(editor, "freegrid");
|
148
122
|
|
@@ -180,38 +154,22 @@ const withHtml = editor => {
|
|
180
154
|
Transforms.insertText(editor, text);
|
181
155
|
}
|
182
156
|
} else {
|
183
|
-
|
184
|
-
if (isTitlePath && !isTextNode) {
|
185
|
-
insertAtNextNode(editor, decoded);
|
186
|
-
return;
|
187
|
-
}
|
188
|
-
const currentText = getCurrentElementText(editor);
|
189
|
-
if (currentText && !isTextNode) {
|
190
|
-
insertAtNextNode(editor, decoded);
|
191
|
-
return;
|
192
|
-
}
|
193
|
-
insertData(data);
|
157
|
+
handleInsert(editor, () => insertData(data), decoded);
|
194
158
|
}
|
195
159
|
} else if (html) {
|
196
160
|
const parsed = new DOMParser().parseFromString(html, "text/html");
|
197
|
-
const rootElement = parsed.body || parsed.documentElement;
|
198
|
-
const isNonText = rootElement ? rootElement?.querySelector(NON_TEXT_TAGS.toString()) : false;
|
199
161
|
const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
|
200
162
|
if (isGoogleSheet) {
|
201
163
|
if (editor.isChatEditor) {
|
202
164
|
return;
|
203
165
|
}
|
204
|
-
const table =
|
166
|
+
const table = parsed.body.querySelector("table");
|
205
167
|
const colGrp = table.querySelector("colgroup");
|
206
168
|
if (colGrp) {
|
207
169
|
colGrp.remove();
|
208
170
|
}
|
209
171
|
const fragment = deserialize(table);
|
210
|
-
|
211
|
-
insertAtNextNode(editor, [fragment]);
|
212
|
-
} else {
|
213
|
-
Transforms.insertFragment(editor, [fragment]);
|
214
|
-
}
|
172
|
+
Transforms.insertFragment(editor, [fragment]);
|
215
173
|
return;
|
216
174
|
}
|
217
175
|
const fragment = deserialize(parsed.body);
|
@@ -225,16 +183,7 @@ const withHtml = editor => {
|
|
225
183
|
if (editor.isChatEditor && is_img_table) {
|
226
184
|
return;
|
227
185
|
}
|
228
|
-
|
229
|
-
insertAtNextNode(editor, formattedFragment);
|
230
|
-
return;
|
231
|
-
}
|
232
|
-
const currentText = getCurrentElementText(editor);
|
233
|
-
if (currentText && isNonText) {
|
234
|
-
insertAtNextNode(editor, formattedFragment);
|
235
|
-
return;
|
236
|
-
}
|
237
|
-
Transforms.insertFragment(editor, formattedFragment);
|
186
|
+
handleInsert(editor, () => Transforms.insertFragment(editor, formattedFragment), formattedFragment);
|
238
187
|
return;
|
239
188
|
} else {
|
240
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: {
|
@@ -314,8 +309,7 @@ export const getBlock = props => {
|
|
314
309
|
borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
|
315
310
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
316
311
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
317
|
-
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
318
|
-
lineHeight: 1.43
|
312
|
+
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
319
313
|
},
|
320
314
|
children: children
|
321
315
|
});
|
@@ -375,20 +369,12 @@ export const getBlock = props => {
|
|
375
369
|
});
|
376
370
|
case "orderedList":
|
377
371
|
return /*#__PURE__*/_jsx("ol", {
|
378
|
-
style: {
|
379
|
-
lineHeight: 1.43
|
380
|
-
},
|
381
|
-
className: "listItemMargin",
|
382
372
|
type: "1",
|
383
373
|
...attributes,
|
384
374
|
children: children
|
385
375
|
});
|
386
376
|
case "unorderedList":
|
387
377
|
return /*#__PURE__*/_jsx("ul", {
|
388
|
-
style: {
|
389
|
-
lineHeight: 1.43
|
390
|
-
},
|
391
|
-
className: "listItemMargin",
|
392
378
|
...attributes,
|
393
379
|
children: children
|
394
380
|
});
|
@@ -576,19 +562,6 @@ export const getBlock = props => {
|
|
576
562
|
contentEditable: false,
|
577
563
|
children: children
|
578
564
|
});
|
579
|
-
// Data View
|
580
|
-
case "dataView":
|
581
|
-
return /*#__PURE__*/_jsx(DataView, {
|
582
|
-
...props
|
583
|
-
});
|
584
|
-
case "viewData":
|
585
|
-
return /*#__PURE__*/_jsx(ViewData, {
|
586
|
-
...props
|
587
|
-
});
|
588
|
-
case "columnView":
|
589
|
-
return /*#__PURE__*/_jsx(ColumnView, {
|
590
|
-
...props
|
591
|
-
});
|
592
565
|
default:
|
593
566
|
return /*#__PURE__*/_jsx(SimpleText, {
|
594
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
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Transforms } from "slate";
|
2
|
-
export const formField =
|
2
|
+
export const formField = () => {
|
3
3
|
return {
|
4
4
|
type: "form-field",
|
5
5
|
grid: 6,
|
@@ -12,18 +12,14 @@ export const formField = data => {
|
|
12
12
|
text: ""
|
13
13
|
}],
|
14
14
|
field_type: "text",
|
15
|
-
bgColor:
|
16
|
-
borderColor:
|
15
|
+
bgColor: "rgba(255, 255, 255, 1)",
|
16
|
+
borderColor: "#ccc",
|
17
17
|
bannerSpacing: {
|
18
18
|
left: 16,
|
19
19
|
right: 16,
|
20
20
|
top: 16,
|
21
21
|
bottom: 16
|
22
|
-
}
|
23
|
-
fontFamily: data?.fontFamily ? data?.fontFamily : "",
|
24
|
-
textSize: data?.textSize ? data?.textSize : "",
|
25
|
-
textColor: data?.textColor ? data?.textColor : "",
|
26
|
-
fontWeight: data?.fontWeight ? data?.fontWeight : "500"
|
22
|
+
}
|
27
23
|
};
|
28
24
|
};
|
29
25
|
export const insertGridItem = editor => {
|