@flozy/editor 5.4.1 → 5.4.2
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 +29 -15
- package/dist/Editor/Editor.css +100 -18
- package/dist/Editor/Elements/AI/AIInput.js +0 -1
- package/dist/Editor/Elements/AI/CustomSelect.js +19 -11
- package/dist/Editor/Elements/AI/PopoverAIInput.js +58 -52
- 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 +7 -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 +67 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -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 +74 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -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 +37 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +60 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +112 -0
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +80 -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 +281 -0
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +74 -0
- package/dist/Editor/Elements/DataView/styles.js +154 -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/FreeGrid/FreeGrid.js +1 -1
- 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 +8 -1
- 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 +82 -79
- package/dist/Editor/Elements/Table/Table.js +258 -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 +15 -1
- 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 +3 -6
- package/dist/Editor/Toolbar/Mini/Styles.js +4 -1
- 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 +555 -57
- 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/BrainIcon.js +2 -2
- package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
- package/dist/Editor/assets/svg/TableIcons.js +220 -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 +4 -4
- package/dist/Editor/common/Icon.js +23 -20
- 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 +9 -6
- package/dist/Editor/common/RnD/VirtualElement/index.js +5 -1
- package/dist/Editor/common/RnD/index.js +3 -2
- 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 +616 -60
- package/dist/Editor/common/iconslist.js +23 -17
- package/dist/Editor/commonStyle.js +417 -11
- package/dist/Editor/helper/deserialize/index.js +25 -13
- package/dist/Editor/helper/enforceDateFormat.js +41 -0
- package/dist/Editor/helper/index.js +17 -4
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/hooks/useTable.js +210 -0
- package/dist/Editor/plugins/withCustomDeleteBackward.js +36 -4
- package/dist/Editor/plugins/withEmbeds.js +30 -26
- package/dist/Editor/plugins/withHTML.js +61 -10
- 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 +26 -1
- 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
@@ -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);
|
@@ -245,6 +260,13 @@ export const getBlock = props => {
|
|
245
260
|
,
|
246
261
|
children: children
|
247
262
|
});
|
263
|
+
case "title":
|
264
|
+
return /*#__PURE__*/_jsx("h3", {
|
265
|
+
...attributes,
|
266
|
+
...element.attr,
|
267
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
268
|
+
children: children
|
269
|
+
});
|
248
270
|
case "headingThree":
|
249
271
|
return /*#__PURE__*/_jsx("h3", {
|
250
272
|
...attributes,
|
@@ -342,6 +364,9 @@ export const getBlock = props => {
|
|
342
364
|
...props
|
343
365
|
});
|
344
366
|
default:
|
345
|
-
return
|
367
|
+
return /*#__PURE__*/_jsx(SimpleText, {
|
368
|
+
...props,
|
369
|
+
isEmpty: isEmpty
|
370
|
+
});
|
346
371
|
}
|
347
372
|
};
|
@@ -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 => {
|
@@ -4,6 +4,7 @@ import insertNewLine from "./insertNewLine";
|
|
4
4
|
import { getDevice } from "../helper/theme";
|
5
5
|
export const windowVar = {};
|
6
6
|
let ST_TIMEOUT = null;
|
7
|
+
const BLOCKS = ["grid", "dataView"];
|
7
8
|
export const formatDate = (date, format = "MM/DD/YYYY") => {
|
8
9
|
if (!date) return "";
|
9
10
|
var d = new Date(date),
|
@@ -163,7 +164,7 @@ export const handleInsertLastElement = (event, editor) => {
|
|
163
164
|
if (isFreeGrid) {
|
164
165
|
return;
|
165
166
|
}
|
166
|
-
const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c => c.type
|
167
|
+
const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c => BLOCKS.includes(c.type));
|
167
168
|
if (!ReactEditor.isFocused(editor)) {
|
168
169
|
if (isLastElementEmpty) {
|
169
170
|
if (hasPath) {
|
@@ -212,7 +213,7 @@ export const isListItem = editor => {
|
|
212
213
|
});
|
213
214
|
return node;
|
214
215
|
};
|
215
|
-
const getNode = (editor, path) => {
|
216
|
+
export const getNode = (editor, path) => {
|
216
217
|
try {
|
217
218
|
return Node.get(editor, path);
|
218
219
|
} catch (err) {
|
@@ -264,6 +265,17 @@ export const decodeAndParseBase64 = encodedString => {
|
|
264
265
|
const jsonData = JSON.parse(decodedURLString);
|
265
266
|
return jsonData;
|
266
267
|
};
|
268
|
+
export const encodeToBase64 = data => {
|
269
|
+
// Convert the data to a JSON string
|
270
|
+
const jsonString = JSON.stringify(data);
|
271
|
+
|
272
|
+
// URL-encode the JSON string
|
273
|
+
const encodedURLString = encodeURIComponent(jsonString);
|
274
|
+
|
275
|
+
// Base64-encode the URL-encoded string
|
276
|
+
const base64EncodedString = btoa(encodedURLString);
|
277
|
+
return base64EncodedString;
|
278
|
+
};
|
267
279
|
export const hasVerticalScrollbar = (element = {}) => {
|
268
280
|
return element.scrollHeight > element.clientHeight;
|
269
281
|
};
|
@@ -611,4 +623,93 @@ export const isPageSettings = (event, editor) => {
|
|
611
623
|
isPageSettingsNode = true;
|
612
624
|
return isPageSettingsNode;
|
613
625
|
}
|
626
|
+
};
|
627
|
+
export function capitalizeFirstLetter(str) {
|
628
|
+
if (!str) return str;
|
629
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
630
|
+
}
|
631
|
+
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
632
|
+
try {
|
633
|
+
const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
|
634
|
+
if (node) {
|
635
|
+
// Insert the line break
|
636
|
+
Transforms.insertNodes(editor, {
|
637
|
+
type: "paragraph",
|
638
|
+
children: [{
|
639
|
+
text: ""
|
640
|
+
}]
|
641
|
+
}, {
|
642
|
+
at: nodePath
|
643
|
+
});
|
644
|
+
}
|
645
|
+
} catch (err) {
|
646
|
+
console.log(err);
|
647
|
+
}
|
648
|
+
};
|
649
|
+
export function isHavingSelection(editor) {
|
650
|
+
try {
|
651
|
+
return editor?.selection && !Range.isCollapsed(editor.selection);
|
652
|
+
} catch (err) {
|
653
|
+
console.log(err);
|
654
|
+
}
|
655
|
+
}
|
656
|
+
const omitNodes = ["site-settings", "page-settings"];
|
657
|
+
export function getInitialValue(value = [], readOnly) {
|
658
|
+
if (readOnly === "readonly" && value?.length) {
|
659
|
+
// remove last empty nodes on readonly mode, to remove empty spaces
|
660
|
+
|
661
|
+
let lastNonEmptyElementIndex;
|
662
|
+
for (let i = value?.length; i > 0; i--) {
|
663
|
+
const elementIndex = i - 1;
|
664
|
+
const node = value[elementIndex];
|
665
|
+
if (lastNonEmptyElementIndex) {
|
666
|
+
break;
|
667
|
+
}
|
668
|
+
if (node?.type === "paragraph") {
|
669
|
+
// Ensure all children of the paragraph node are text nodes
|
670
|
+
const hasOnlyTextChildren = node.children.every(child => Text.isText(child));
|
671
|
+
const text = node.children[node.children.length - 1]?.text;
|
672
|
+
lastNonEmptyElementIndex = hasOnlyTextChildren ? text ? elementIndex : null : elementIndex;
|
673
|
+
} else if (omitNodes.includes(node?.type)) {
|
674
|
+
continue;
|
675
|
+
} else {
|
676
|
+
lastNonEmptyElementIndex = elementIndex;
|
677
|
+
}
|
678
|
+
}
|
679
|
+
const newValue = [...value].slice(0, lastNonEmptyElementIndex + 1);
|
680
|
+
return newValue;
|
681
|
+
}
|
682
|
+
return value;
|
683
|
+
}
|
684
|
+
export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
|
685
|
+
return `${defaultCls} ${selected ? selectedClsName : ""}`;
|
686
|
+
}
|
687
|
+
export function handleNegativeInteger(val) {
|
688
|
+
return val < 0 ? 0 : val;
|
689
|
+
}
|
690
|
+
export const containsSurrogatePair = text => {
|
691
|
+
// Match surrogate pairs (high and low surrogate)
|
692
|
+
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
693
|
+
return surrogatePairRegex.test(text);
|
694
|
+
};
|
695
|
+
export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
696
|
+
try {
|
697
|
+
const options = {
|
698
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === nodeType,
|
699
|
+
...(otherOptions || {})
|
700
|
+
};
|
701
|
+
const [node, nodePath] = Editor.nodes(editor, options);
|
702
|
+
return node ? [node, nodePath] : [];
|
703
|
+
} catch (err) {
|
704
|
+
console.log(err);
|
705
|
+
return [];
|
706
|
+
}
|
707
|
+
};
|
708
|
+
export const getSlateDom = (editor, range) => {
|
709
|
+
try {
|
710
|
+
const slateDom = ReactEditor.toDOMRange(editor, range);
|
711
|
+
return slateDom;
|
712
|
+
} catch (err) {
|
713
|
+
console.log(err);
|
714
|
+
}
|
614
715
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Transforms } from "slate";
|
1
|
+
import { Editor, Element, Path, Transforms } from "slate";
|
2
2
|
const insertNewLine = editor => {
|
3
3
|
Transforms.insertNodes(editor, {
|
4
4
|
type: "paragraph",
|
@@ -9,4 +9,22 @@ const insertNewLine = editor => {
|
|
9
9
|
at: [editor.children.length]
|
10
10
|
});
|
11
11
|
};
|
12
|
+
export const insertNewLineAfterCurrentPath = editor => {
|
13
|
+
const currentPath = editor?.selection?.anchor?.path;
|
14
|
+
const [tableNode] = Editor.nodes(editor, {
|
15
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
16
|
+
});
|
17
|
+
if (currentPath && tableNode) {
|
18
|
+
const currentParentPath = Path.parent(currentPath);
|
19
|
+
const nextPath = Path.next(currentParentPath);
|
20
|
+
Transforms.insertNodes(editor, {
|
21
|
+
type: "paragraph",
|
22
|
+
children: [{
|
23
|
+
text: ""
|
24
|
+
}]
|
25
|
+
}, {
|
26
|
+
at: nextPath
|
27
|
+
});
|
28
|
+
}
|
29
|
+
};
|
12
30
|
export default insertNewLine;
|
@@ -9,7 +9,13 @@ export const findPageSettings = editor => {
|
|
9
9
|
path: null,
|
10
10
|
element: {
|
11
11
|
pageProps: {
|
12
|
-
pageWidth: "fixed"
|
12
|
+
pageWidth: "fixed",
|
13
|
+
"lineHeight": {
|
14
|
+
"xs": 1.43,
|
15
|
+
"sm": 1.43,
|
16
|
+
"md": 1.43,
|
17
|
+
"lg": 1.43
|
18
|
+
}
|
13
19
|
}
|
14
20
|
}
|
15
21
|
};
|
@@ -34,7 +40,13 @@ export const getPageSettings = editor => {
|
|
34
40
|
path: null,
|
35
41
|
element: {
|
36
42
|
pageProps: {
|
37
|
-
pageWidth: "fixed"
|
43
|
+
pageWidth: "fixed",
|
44
|
+
"lineHeight": {
|
45
|
+
"xs": 1.43,
|
46
|
+
"sm": 1.43,
|
47
|
+
"md": 1.43,
|
48
|
+
"lg": 1.43
|
49
|
+
}
|
38
50
|
}
|
39
51
|
}
|
40
52
|
};
|
@@ -2,6 +2,8 @@ export const serializeToText = node => {
|
|
2
2
|
try {
|
3
3
|
if (!node?.type && node?.text) {
|
4
4
|
return node?.text;
|
5
|
+
} else if (node?.type === 'mention') {
|
6
|
+
return '@' + node?.character?.name || '';
|
5
7
|
}
|
6
8
|
let n = Array.isArray(node) ? node : node?.children;
|
7
9
|
n = n && Array.isArray(n) ? n : n ? [n] : [];
|