@flozy/editor 5.5.9 → 5.6.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 +25 -34
- package/dist/Editor/CommonEditor.js +33 -16
- package/dist/Editor/Editor.css +105 -20
- package/dist/Editor/Elements/AI/AIInput.js +0 -1
- package/dist/Editor/Elements/AI/CustomSelect.js +17 -10
- package/dist/Editor/Elements/AI/PopoverAIInput.js +59 -53
- package/dist/Editor/Elements/AI/Styles.js +24 -6
- package/dist/Editor/Elements/Accordion/Accordion.js +8 -1
- package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
- package/dist/Editor/Elements/Button/EditorButton.js +9 -2
- package/dist/Editor/Elements/Carousel/CarouselItem.js +11 -3
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +7 -5
- package/dist/Editor/Elements/Color Picker/Styles.js +8 -3
- package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
- package/dist/Editor/Elements/DataView/DataView.js +124 -0
- package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +83 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +180 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +62 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +68 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +35 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +86 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +71 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +138 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +213 -0
- package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +44 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +146 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +79 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +57 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +174 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +241 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +45 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +32 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +217 -0
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +131 -0
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +253 -0
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +85 -0
- package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
- package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +277 -0
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +88 -0
- package/dist/Editor/Elements/DataView/styles.js +169 -0
- package/dist/Editor/Elements/Divider/Divider.js +36 -20
- package/dist/Editor/Elements/Embed/Image.js +51 -16
- package/dist/Editor/Elements/Embed/Video.js +26 -3
- package/dist/Editor/Elements/Form/Form.js +39 -2
- package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormDate.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormEmail.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormText.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +6 -1
- package/dist/Editor/Elements/Form/FormPopup.js +12 -9
- package/dist/Editor/Elements/Form/Workflow/Styles.js +2 -0
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -2
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +2 -1
- package/dist/Editor/Elements/Grid/GridButton.js +2 -2
- package/dist/Editor/Elements/Grid/GridItem.js +47 -36
- package/dist/Editor/Elements/Grid/Styles.js +50 -0
- package/dist/Editor/Elements/Link/LinkButton.js +1 -1
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
- package/dist/Editor/Elements/Search/SearchButton.js +1 -0
- 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 +17 -52
- package/dist/Editor/Elements/SimpleText/index.js +11 -3
- package/dist/Editor/Elements/SimpleText/style.js +20 -1
- package/dist/Editor/Elements/Table/AddRowCol.js +77 -0
- package/dist/Editor/Elements/Table/DragButton.js +142 -0
- package/dist/Editor/Elements/Table/DragStyles.js +70 -0
- package/dist/Editor/Elements/Table/Draggable.js +25 -0
- package/dist/Editor/Elements/Table/Droppable.js +53 -0
- package/dist/Editor/Elements/Table/Styles.js +88 -78
- package/dist/Editor/Elements/Table/Table.js +263 -140
- package/dist/Editor/Elements/Table/TableCell.js +365 -111
- package/dist/Editor/Elements/Table/TablePopup.js +9 -3
- package/dist/Editor/Elements/Table/TableRow.js +10 -2
- package/dist/Editor/Elements/Table/TableTool.js +101 -0
- package/dist/Editor/Elements/Table/tableHelper.js +71 -0
- package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
- package/dist/Editor/MiniEditor.js +21 -2
- package/dist/Editor/Styles/EditorStyles.js +13 -4
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +10 -0
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +7 -12
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +26 -4
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +3 -0
- 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 +9 -1
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +13 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +7 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +6 -4
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +19 -15
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +557 -58
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +73 -16
- package/dist/Editor/Toolbar/PopupTool/index.js +3 -5
- package/dist/Editor/Toolbar/Toolbar.js +6 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
- package/dist/Editor/assets/svg/ArrowDownIcon.js +25 -0
- package/dist/Editor/assets/svg/ArrowUpIcon.js +25 -0
- package/dist/Editor/assets/svg/BrainIcon.js +2 -2
- package/dist/Editor/assets/svg/CalenderIconTick.js +64 -0
- package/dist/Editor/assets/svg/ChervDown.js +18 -0
- package/dist/Editor/assets/svg/ChervUp.js +18 -0
- package/dist/Editor/assets/svg/DataTableIcon.js +50 -0
- package/dist/Editor/assets/svg/DuplicateIcon.js +23 -0
- package/dist/Editor/assets/svg/EyeIcon.js +23 -0
- package/dist/Editor/assets/svg/EyeSlash.js +43 -0
- package/dist/Editor/assets/svg/HashtagIcon.js +33 -0
- package/dist/Editor/assets/svg/PlusIcon.js +23 -0
- package/dist/Editor/assets/svg/SelectRoundedIcon.js +24 -0
- package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
- package/dist/Editor/assets/svg/SortByIcon.js +33 -0
- package/dist/Editor/assets/svg/TableIcons.js +220 -0
- package/dist/Editor/assets/svg/TickOutlined.js +23 -0
- package/dist/Editor/assets/svg/TrashCanIcon.js +38 -0
- package/dist/Editor/common/ColorPickerButton.js +85 -45
- package/dist/Editor/common/DnD/Draggable.js +2 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +6 -6
- package/dist/Editor/common/Icon.js +54 -21
- package/dist/Editor/common/ImageSelector/Options/Upload.js +2 -1
- package/dist/Editor/common/ImageSelector/Styles.js +47 -6
- package/dist/Editor/common/ImageSelector/UploadStyles.js +18 -6
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -1
- package/dist/Editor/common/LinkSettings/index.js +2 -1
- package/dist/Editor/common/MentionsPopup/Styles.js +143 -8
- package/dist/Editor/common/MentionsPopup/index.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +108 -12
- 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 +14 -2
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +26 -7
- package/dist/Editor/common/RnD/VirtualElement/index.js +5 -1
- package/dist/Editor/common/RnD/index.js +4 -3
- package/dist/Editor/common/Section/index.js +3 -3
- package/dist/Editor/common/Section/styles.js +5 -1
- package/dist/Editor/common/Select/index.js +20 -0
- package/dist/Editor/common/Select/styles.js +17 -0
- package/dist/Editor/common/Shorthands/elements.js +13 -1
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +9 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +35 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +22 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +21 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +20 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +12 -2
- package/dist/Editor/common/StyleBuilder/formStyle.js +268 -149
- package/dist/Editor/common/StyleBuilder/index.js +101 -20
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
- package/dist/Editor/common/StyleBuilder/tableStyle.js +69 -25
- package/dist/Editor/common/SwipeableDrawer/style.js +15 -4
- package/dist/Editor/common/ToolbarIcon.js +1 -1
- package/dist/Editor/common/Uploader.js +46 -36
- package/dist/Editor/common/iconListV2.js +598 -74
- package/dist/Editor/common/iconslist.js +25 -19
- package/dist/Editor/commonStyle.js +421 -15
- package/dist/Editor/helper/deserialize/index.js +31 -2
- package/dist/Editor/helper/enforceDateFormat.js +41 -0
- package/dist/Editor/helper/index.js +17 -4
- package/dist/Editor/helper/theme.js +39 -2
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/hooks/useTable.js +210 -0
- package/dist/Editor/plugins/withCustomDeleteBackward.js +34 -3
- package/dist/Editor/plugins/withEmbeds.js +30 -26
- package/dist/Editor/plugins/withHTML.js +100 -12
- package/dist/Editor/plugins/withLayout.js +1 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +39 -12
- package/dist/Editor/utils/brains.js +1 -1
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +75 -6
- package/dist/Editor/utils/customHooks/useResize.js +7 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +6 -2
- package/dist/Editor/utils/dataView.js +43 -0
- package/dist/Editor/utils/embed.js +2 -1
- package/dist/Editor/utils/events.js +0 -1
- package/dist/Editor/utils/font.js +11 -4
- package/dist/Editor/utils/formfield.js +8 -4
- package/dist/Editor/utils/helper.js +103 -2
- package/dist/Editor/utils/insertNewLine.js +19 -1
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/dist/Editor/utils/serializeToText.js +2 -0
- package/dist/Editor/utils/table.js +228 -24
- package/package.json +2 -2
@@ -2,6 +2,45 @@ 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
|
+
};
|
5
44
|
const loopChildren = (children = [], defaultInsert) => {
|
6
45
|
if (!children?.length) {
|
7
46
|
return defaultInsert;
|
@@ -26,7 +65,7 @@ const getCurrentElement = editor => {
|
|
26
65
|
return null;
|
27
66
|
}
|
28
67
|
};
|
29
|
-
const getCurrentElementText = editor => {
|
68
|
+
export const getCurrentElementText = editor => {
|
30
69
|
try {
|
31
70
|
if (editor.selection) {
|
32
71
|
return Editor.string(editor, editor?.selection?.anchor?.path);
|
@@ -61,12 +100,23 @@ const insertAtNextNode = (editor, formattedFragment) => {
|
|
61
100
|
console.log(err);
|
62
101
|
}
|
63
102
|
};
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
103
|
+
|
104
|
+
// const handleInsert = (editor, defaultInsert, fragment = []) => {
|
105
|
+
// if (
|
106
|
+
// getCurrentElementText(editor) &&
|
107
|
+
// fragment.some((f) => f.type === "table")
|
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 || [];
|
70
120
|
};
|
71
121
|
const formatFragment = {
|
72
122
|
"list-item": fragment => {
|
@@ -115,8 +165,21 @@ const withHtml = editor => {
|
|
115
165
|
const html = data?.getData("text/html");
|
116
166
|
const currentEl = getCurrentElement(editor);
|
117
167
|
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;
|
118
171
|
if (slateHTML && !formatFragment[eltype]) {
|
172
|
+
const [tableCellNode] = Editor.nodes(editor, {
|
173
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
|
174
|
+
});
|
119
175
|
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
|
+
}
|
120
183
|
const tableNode = getFocusedNode(editor, "table");
|
121
184
|
const onlyTextNode = getFocusedNode(editor, "freegrid");
|
122
185
|
|
@@ -154,22 +217,38 @@ const withHtml = editor => {
|
|
154
217
|
Transforms.insertText(editor, text);
|
155
218
|
}
|
156
219
|
} else {
|
157
|
-
|
220
|
+
const isTextNode = ALLOWED_TEXT_NODES.includes(decoded?.[0]?.type);
|
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);
|
158
231
|
}
|
159
232
|
} else if (html) {
|
160
|
-
const parsed =
|
233
|
+
const parsed = parseCopiedHTML(html);
|
234
|
+
const rootElement = parsed.body;
|
235
|
+
const isNonText = rootElement ? rootElement?.querySelector(NON_TEXT_TAGS.toString()) : false;
|
161
236
|
const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
|
162
237
|
if (isGoogleSheet) {
|
163
238
|
if (editor.isChatEditor) {
|
164
239
|
return;
|
165
240
|
}
|
166
|
-
const table =
|
241
|
+
const table = rootElement.querySelector("table");
|
167
242
|
const colGrp = table.querySelector("colgroup");
|
168
243
|
if (colGrp) {
|
169
244
|
colGrp.remove();
|
170
245
|
}
|
171
246
|
const fragment = deserialize(table);
|
172
|
-
|
247
|
+
if (isTitlePath) {
|
248
|
+
insertAtNextNode(editor, [fragment]);
|
249
|
+
} else {
|
250
|
+
Transforms.insertFragment(editor, [fragment]);
|
251
|
+
}
|
173
252
|
return;
|
174
253
|
}
|
175
254
|
const fragment = deserialize(parsed.body);
|
@@ -183,7 +262,16 @@ const withHtml = editor => {
|
|
183
262
|
if (editor.isChatEditor && is_img_table) {
|
184
263
|
return;
|
185
264
|
}
|
186
|
-
|
265
|
+
if (isTitlePath && isNonText) {
|
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);
|
187
275
|
return;
|
188
276
|
} else {
|
189
277
|
insertData(data);
|
@@ -43,6 +43,9 @@ 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";
|
46
49
|
import SearchAttachment from "../Elements/Search/SearchAttachment";
|
47
50
|
// import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
|
48
51
|
import { jsx as _jsx } from "react/jsx-runtime";
|
@@ -152,7 +155,7 @@ export const activeMark = (editor, format) => {
|
|
152
155
|
const defaultMarkData = {
|
153
156
|
color: "#000000",
|
154
157
|
bgColor: "#FFFFFF",
|
155
|
-
fontSize: "
|
158
|
+
fontSize: "14px",
|
156
159
|
fontFamily: "PoppinsRegular",
|
157
160
|
fontWeight: "normal"
|
158
161
|
};
|
@@ -167,6 +170,16 @@ export const activeMark = (editor, format) => {
|
|
167
170
|
};
|
168
171
|
export const getMarked = (leaf, children, theme) => {
|
169
172
|
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
|
+
}
|
170
183
|
if (leaf.bold) {
|
171
184
|
children = /*#__PURE__*/_jsx("strong", {
|
172
185
|
children: children
|
@@ -237,21 +250,13 @@ export const getMarked = (leaf, children, theme) => {
|
|
237
250
|
// },
|
238
251
|
...textStyles,
|
239
252
|
fontFamily: family,
|
240
|
-
fontWeight: leaf.fontWeight
|
253
|
+
fontWeight: leaf.fontWeight,
|
254
|
+
WebkitTextFillColor: "unset !important"
|
241
255
|
},
|
242
256
|
children: children
|
243
257
|
})
|
244
258
|
});
|
245
259
|
}
|
246
|
-
if (leaf.highlight) {
|
247
|
-
children = /*#__PURE__*/_jsx("span", {
|
248
|
-
style: {
|
249
|
-
background: "#EAEBFE",
|
250
|
-
color: "inherit"
|
251
|
-
},
|
252
|
-
children: children
|
253
|
-
});
|
254
|
-
}
|
255
260
|
if (leaf.decoration === "link") {
|
256
261
|
children = /*#__PURE__*/_jsx("a", {
|
257
262
|
style: {
|
@@ -309,7 +314,8 @@ export const getBlock = props => {
|
|
309
314
|
borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
|
310
315
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
311
316
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
312
|
-
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
317
|
+
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
|
318
|
+
lineHeight: 1.43
|
313
319
|
},
|
314
320
|
children: children
|
315
321
|
});
|
@@ -369,12 +375,20 @@ export const getBlock = props => {
|
|
369
375
|
});
|
370
376
|
case "orderedList":
|
371
377
|
return /*#__PURE__*/_jsx("ol", {
|
378
|
+
style: {
|
379
|
+
lineHeight: 1.43
|
380
|
+
},
|
381
|
+
className: "listItemMargin",
|
372
382
|
type: "1",
|
373
383
|
...attributes,
|
374
384
|
children: children
|
375
385
|
});
|
376
386
|
case "unorderedList":
|
377
387
|
return /*#__PURE__*/_jsx("ul", {
|
388
|
+
style: {
|
389
|
+
lineHeight: 1.43
|
390
|
+
},
|
391
|
+
className: "listItemMargin",
|
378
392
|
...attributes,
|
379
393
|
children: children
|
380
394
|
});
|
@@ -562,6 +576,19 @@ export const getBlock = props => {
|
|
562
576
|
contentEditable: false,
|
563
577
|
children: children
|
564
578
|
});
|
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
|
+
});
|
565
592
|
default:
|
566
593
|
return /*#__PURE__*/_jsx(SimpleText, {
|
567
594
|
...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(/\/b(?:rain|rai|ra|r)?/g, "").trim();
|
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,6 +3,7 @@ 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";
|
6
7
|
import { isEmptyTextNode } from "../../helper";
|
7
8
|
import { getBreakPointsValue } from "../../helper/theme";
|
8
9
|
import insertNewLine from "../insertNewLine";
|
@@ -15,6 +16,20 @@ const LIST_FORMAT_TYPE = {
|
|
15
16
|
unorderedList: "list-item"
|
16
17
|
};
|
17
18
|
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
|
+
};
|
18
33
|
export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
19
34
|
const isActive = isBlockActive(editor, format);
|
20
35
|
const isList = list_types.includes(format);
|
@@ -222,38 +237,88 @@ export const getBlock = props => {
|
|
222
237
|
return /*#__PURE__*/_jsx("p", {
|
223
238
|
...attributes,
|
224
239
|
...element.attr,
|
225
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`
|
240
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`
|
226
241
|
// placeholder="paragraph"
|
227
242
|
,
|
228
243
|
children: children
|
229
244
|
});
|
230
245
|
case "headingOne":
|
231
|
-
return /*#__PURE__*/_jsx("
|
246
|
+
return /*#__PURE__*/_jsx("h3", {
|
232
247
|
...attributes,
|
233
248
|
...element.attr,
|
249
|
+
style: {
|
250
|
+
margin: "10px 0px"
|
251
|
+
},
|
234
252
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
235
253
|
// placeholder="Heading 1"
|
236
254
|
,
|
237
255
|
children: children
|
238
256
|
});
|
239
257
|
case "headingTwo":
|
240
|
-
return /*#__PURE__*/_jsx("
|
258
|
+
return /*#__PURE__*/_jsx("h3", {
|
241
259
|
...attributes,
|
242
260
|
...element.attr,
|
261
|
+
style: {
|
262
|
+
margin: "10px 0px"
|
263
|
+
},
|
243
264
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
244
265
|
// placeholder="Heading 2"
|
245
266
|
,
|
246
267
|
children: children
|
247
268
|
});
|
269
|
+
case "title":
|
270
|
+
return /*#__PURE__*/_jsx("h3", {
|
271
|
+
...attributes,
|
272
|
+
...element.attr,
|
273
|
+
style: {
|
274
|
+
margin: "10px 0px"
|
275
|
+
},
|
276
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
277
|
+
children: children
|
278
|
+
});
|
248
279
|
case "headingThree":
|
249
280
|
return /*#__PURE__*/_jsx("h3", {
|
250
281
|
...attributes,
|
251
282
|
...element.attr,
|
283
|
+
style: {
|
284
|
+
margin: "10px 0px"
|
285
|
+
},
|
252
286
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
253
287
|
// placeholder="Heading 3"
|
254
288
|
,
|
255
289
|
children: children
|
256
290
|
});
|
291
|
+
case "headingFour":
|
292
|
+
return /*#__PURE__*/_jsx("h4", {
|
293
|
+
...attributes,
|
294
|
+
...element.attr,
|
295
|
+
style: {
|
296
|
+
margin: "10px 0px"
|
297
|
+
},
|
298
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
299
|
+
children: children
|
300
|
+
});
|
301
|
+
case "headingFive":
|
302
|
+
return /*#__PURE__*/_jsx("h5", {
|
303
|
+
...attributes,
|
304
|
+
...element.attr,
|
305
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
306
|
+
children: children
|
307
|
+
});
|
308
|
+
case "headingSix":
|
309
|
+
return /*#__PURE__*/_jsx("h6", {
|
310
|
+
...attributes,
|
311
|
+
...element.attr,
|
312
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
313
|
+
children: children
|
314
|
+
});
|
315
|
+
case "headingSeven":
|
316
|
+
return /*#__PURE__*/_jsx("h7", {
|
317
|
+
...attributes,
|
318
|
+
...element.attr,
|
319
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
320
|
+
children: children
|
321
|
+
});
|
257
322
|
case "blockquote":
|
258
323
|
return /*#__PURE__*/_jsx("blockquote", {
|
259
324
|
...attributes,
|
@@ -305,7 +370,7 @@ export const getBlock = props => {
|
|
305
370
|
return /*#__PURE__*/_jsx("li", {
|
306
371
|
...attributes,
|
307
372
|
...element.attr,
|
308
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
373
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
309
374
|
placeholder: "List",
|
310
375
|
style: {
|
311
376
|
color: firstChildren?.color
|
@@ -322,7 +387,7 @@ export const getBlock = props => {
|
|
322
387
|
return /*#__PURE__*/_jsx("p", {
|
323
388
|
...attributes,
|
324
389
|
...element.attr,
|
325
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`
|
390
|
+
className: `content-editable ${isEmpty ? "empty" : ""} m-0`
|
326
391
|
// placeholder="paragraph"
|
327
392
|
,
|
328
393
|
children: children
|
@@ -342,6 +407,10 @@ export const getBlock = props => {
|
|
342
407
|
...props
|
343
408
|
});
|
344
409
|
default:
|
345
|
-
return
|
410
|
+
return /*#__PURE__*/_jsx(SimpleText, {
|
411
|
+
...props,
|
412
|
+
isEmpty: isEmpty,
|
413
|
+
isChatEditor: true
|
414
|
+
});
|
346
415
|
}
|
347
416
|
};
|
@@ -4,7 +4,10 @@ const useResize = ({
|
|
4
4
|
parentDOM,
|
5
5
|
size: allSize,
|
6
6
|
isGrid,
|
7
|
-
onChange
|
7
|
+
onChange,
|
8
|
+
MH,
|
9
|
+
MW,
|
10
|
+
MP
|
8
11
|
}) => {
|
9
12
|
const device = getDevice(window.innerWidth);
|
10
13
|
const defaultSize = getBreakPointsValue(allSize);
|
@@ -52,9 +55,9 @@ const useResize = ({
|
|
52
55
|
const cWP = calcWidth / width * 100;
|
53
56
|
const calcHeight = (parseInt(currentSize.height) || height) + e.movementY;
|
54
57
|
const calc = {
|
55
|
-
width: Math.max(calcWidth, 140),
|
56
|
-
height: Math.max(calcHeight, 50),
|
57
|
-
widthInPercent: cWP > 100 ? 100 : Math.max(cWP, 15)
|
58
|
+
width: Math.max(calcWidth, MW || 140),
|
59
|
+
height: Math.max(calcHeight, MH || 50),
|
60
|
+
widthInPercent: cWP > 100 ? 100 : Math.max(cWP, MP || 15)
|
58
61
|
};
|
59
62
|
latest = calc;
|
60
63
|
return calc;
|
@@ -2,7 +2,8 @@ import { useState } from "react";
|
|
2
2
|
const useTableResize = ({
|
3
3
|
parentDOM,
|
4
4
|
size: defaultSize,
|
5
|
-
onDone
|
5
|
+
onDone,
|
6
|
+
minMaxProps = {}
|
6
7
|
}) => {
|
7
8
|
const {
|
8
9
|
width
|
@@ -38,10 +39,13 @@ const useTableResize = ({
|
|
38
39
|
setIsDone(1);
|
39
40
|
};
|
40
41
|
const onMouseMove = e => {
|
42
|
+
const {
|
43
|
+
minWidth
|
44
|
+
} = minMaxProps || {};
|
41
45
|
setSize(currentSize => {
|
42
46
|
const calcWidth = currentSize?.width + e.movementX;
|
43
47
|
return {
|
44
|
-
width: calcWidth,
|
48
|
+
width: minWidth && calcWidth < minWidth ? minWidth : calcWidth,
|
45
49
|
height: currentSize.height + e.movementY,
|
46
50
|
widthInPercent: calcWidth / width * 100
|
47
51
|
};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { Transforms } from "slate";
|
2
|
+
import insertNewLine from "./insertNewLine";
|
3
|
+
const getDefaultDatView = () => ({
|
4
|
+
type: "dataView",
|
5
|
+
title: "",
|
6
|
+
layouts: [{
|
7
|
+
key: "view1",
|
8
|
+
type: "table",
|
9
|
+
label: "Table 1 View",
|
10
|
+
value: "table1",
|
11
|
+
filter: [],
|
12
|
+
sort: []
|
13
|
+
}],
|
14
|
+
properties: [{
|
15
|
+
key: "column1",
|
16
|
+
label: "Task",
|
17
|
+
type: "text",
|
18
|
+
visible: true,
|
19
|
+
default: true
|
20
|
+
}],
|
21
|
+
rows: [{
|
22
|
+
id: new Date().getTime(),
|
23
|
+
column1: ""
|
24
|
+
}],
|
25
|
+
children: [{
|
26
|
+
type: "viewData",
|
27
|
+
children: [{
|
28
|
+
text: ""
|
29
|
+
}]
|
30
|
+
}]
|
31
|
+
});
|
32
|
+
export const insertDataView = editor => {
|
33
|
+
try {
|
34
|
+
Transforms.insertNodes(editor, {
|
35
|
+
...getDefaultDatView()
|
36
|
+
}, {
|
37
|
+
at: editor?.selection.focus.path
|
38
|
+
});
|
39
|
+
insertNewLine(editor);
|
40
|
+
} catch (err) {
|
41
|
+
console.log(err);
|
42
|
+
}
|
43
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Transforms } from "slate";
|
2
|
-
import insertNewLine from "./insertNewLine";
|
2
|
+
import insertNewLine, { insertNewLineAfterCurrentPath } from "./insertNewLine";
|
3
3
|
export const insertDefaultEmbed = (editor, type, defaultURL = "", extProps = {}) => {
|
4
4
|
try {
|
5
5
|
const url = defaultURL ? defaultURL : type === "image" ? "" : "";
|
@@ -56,6 +56,7 @@ export const insertEmbed = (editor, embedData, format) => {
|
|
56
56
|
at: editor.selection.anchor.path
|
57
57
|
});
|
58
58
|
insertNewLine(editor);
|
59
|
+
insertNewLineAfterCurrentPath(editor);
|
59
60
|
} catch (err) {
|
60
61
|
console.log(err);
|
61
62
|
}
|
@@ -5,7 +5,6 @@ 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";
|
9
8
|
const HOTKEYS = {
|
10
9
|
b: "bold",
|
11
10
|
i: "italic",
|
@@ -60,7 +60,14 @@ export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
|
|
60
60
|
};
|
61
61
|
});
|
62
62
|
export const headingMap = {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
};
|
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
|
+
}];
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Transforms } from "slate";
|
2
|
-
export const formField =
|
2
|
+
export const formField = data => {
|
3
3
|
return {
|
4
4
|
type: "form-field",
|
5
5
|
grid: 6,
|
@@ -12,14 +12,18 @@ export const formField = () => {
|
|
12
12
|
text: ""
|
13
13
|
}],
|
14
14
|
field_type: "text",
|
15
|
-
bgColor: "rgba(255, 255, 255, 1)",
|
16
|
-
borderColor: "#ccc",
|
15
|
+
bgColor: data?.bgColor ? data?.bgColor : "rgba(255, 255, 255, 1)",
|
16
|
+
borderColor: data?.borderColor ? data?.borderColor : "#ccc",
|
17
17
|
bannerSpacing: {
|
18
18
|
left: 16,
|
19
19
|
right: 16,
|
20
20
|
top: 16,
|
21
21
|
bottom: 16
|
22
|
-
}
|
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"
|
23
27
|
};
|
24
28
|
};
|
25
29
|
export const insertGridItem = editor => {
|