@flozy/editor 5.5.6 → 5.5.8
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 +16 -33
- package/dist/Editor/Editor.css +20 -105
- package/dist/Editor/Elements/AI/AIInput.js +1 -0
- package/dist/Editor/Elements/AI/CustomSelect.js +10 -17
- package/dist/Editor/Elements/AI/PopoverAIInput.js +53 -59
- package/dist/Editor/Elements/AI/Styles.js +6 -24
- package/dist/Editor/Elements/Accordion/Accordion.js +1 -8
- package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
- package/dist/Editor/Elements/Button/EditorButton.js +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 -8
- package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
- package/dist/Editor/Elements/Divider/Divider.js +20 -36
- package/dist/Editor/Elements/Embed/Image.js +16 -51
- package/dist/Editor/Elements/Embed/Video.js +3 -26
- package/dist/Editor/Elements/Form/Form.js +2 -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/Form/Workflow/Styles.js +0 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +2 -4
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -20
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -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 +3 -11
- package/dist/Editor/Elements/SimpleText/style.js +1 -20
- package/dist/Editor/Elements/Table/Styles.js +78 -88
- package/dist/Editor/Elements/Table/Table.js +140 -263
- package/dist/Editor/Elements/Table/TableCell.js +111 -365
- package/dist/Editor/Elements/Table/TablePopup.js +3 -9
- package/dist/Editor/Elements/Table/TableRow.js +2 -10
- package/dist/Editor/Elements/TopBanner/TopBanner.js +1 -2
- package/dist/Editor/MiniEditor.js +2 -21
- package/dist/Editor/Styles/EditorStyles.js +4 -13
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +0 -10
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +12 -7
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -26
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +0 -3
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -5
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +8 -8
- package/dist/Editor/Toolbar/Mini/Styles.js +1 -9
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +3 -7
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -6
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +15 -19
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +58 -557
- 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 +6 -12
- package/dist/Editor/common/Icon.js +21 -54
- package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -2
- package/dist/Editor/common/ImageSelector/Styles.js +6 -47
- package/dist/Editor/common/ImageSelector/UploadStyles.js +6 -18
- package/dist/Editor/common/LinkSettings/NavComponents.js +1 -2
- package/dist/Editor/common/LinkSettings/index.js +1 -2
- package/dist/Editor/common/MentionsPopup/Styles.js +8 -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 +3 -4
- package/dist/Editor/common/Section/index.js +3 -3
- package/dist/Editor/common/Section/styles.js +1 -5
- package/dist/Editor/common/Shorthands/elements.js +1 -13
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -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 +74 -598
- package/dist/Editor/common/iconslist.js +19 -25
- package/dist/Editor/commonStyle.js +15 -421
- package/dist/Editor/helper/deserialize/index.js +2 -31
- package/dist/Editor/helper/index.js +4 -17
- package/dist/Editor/helper/theme.js +2 -39
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/hooks/useMouseMove.js +2 -5
- package/dist/Editor/plugins/withCustomDeleteBackward.js +104 -100
- package/dist/Editor/plugins/withEmbeds.js +26 -30
- package/dist/Editor/plugins/withHTML.js +12 -100
- package/dist/Editor/plugins/withLayout.js +0 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +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 +6 -75
- 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 -83
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +0 -33
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +0 -180
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +0 -62
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +0 -68
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +0 -35
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +0 -39
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +0 -30
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +0 -30
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +0 -35
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +0 -36
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +0 -17
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +0 -29
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +0 -38
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +0 -86
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +0 -71
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +0 -138
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -213
- package/dist/Editor/Elements/DataView/Layouts/Formula.js +0 -29
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +0 -113
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +0 -44
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +0 -146
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +0 -79
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +0 -57
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +0 -101
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +0 -174
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +0 -241
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +0 -45
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +0 -32
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -110
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +0 -217
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +0 -131
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +0 -253
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +0 -85
- package/dist/Editor/Elements/DataView/Layouts/colStyles.js +0 -10
- package/dist/Editor/Elements/DataView/Layouts/index.js +0 -25
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +0 -277
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +0 -15
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +0 -88
- package/dist/Editor/Elements/DataView/styles.js +0 -169
- package/dist/Editor/Elements/Table/AddRowCol.js +0 -77
- package/dist/Editor/Elements/Table/DragButton.js +0 -142
- package/dist/Editor/Elements/Table/DragStyles.js +0 -70
- package/dist/Editor/Elements/Table/Draggable.js +0 -25
- package/dist/Editor/Elements/Table/Droppable.js +0 -53
- package/dist/Editor/Elements/Table/TableTool.js +0 -101
- package/dist/Editor/Elements/Table/tableHelper.js +0 -71
- package/dist/Editor/assets/svg/ArrowDownIcon.js +0 -25
- package/dist/Editor/assets/svg/ArrowUpIcon.js +0 -25
- package/dist/Editor/assets/svg/CalenderIconTick.js +0 -64
- package/dist/Editor/assets/svg/ChervDown.js +0 -18
- package/dist/Editor/assets/svg/ChervUp.js +0 -18
- package/dist/Editor/assets/svg/DataTableIcon.js +0 -50
- package/dist/Editor/assets/svg/DuplicateIcon.js +0 -23
- package/dist/Editor/assets/svg/EyeIcon.js +0 -23
- package/dist/Editor/assets/svg/EyeSlash.js +0 -43
- package/dist/Editor/assets/svg/HashtagIcon.js +0 -33
- package/dist/Editor/assets/svg/PlusIcon.js +0 -23
- package/dist/Editor/assets/svg/SelectRoundedIcon.js +0 -24
- package/dist/Editor/assets/svg/SortByIcon.js +0 -33
- package/dist/Editor/assets/svg/TableIcons.js +0 -220
- package/dist/Editor/assets/svg/TickOutlined.js +0 -23
- package/dist/Editor/assets/svg/TrashCanIcon.js +0 -38
- package/dist/Editor/common/Select/index.js +0 -20
- package/dist/Editor/common/Select/styles.js +0 -17
- package/dist/Editor/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
@@ -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);
|
@@ -237,88 +222,38 @@ export const getBlock = props => {
|
|
237
222
|
return /*#__PURE__*/_jsx("p", {
|
238
223
|
...attributes,
|
239
224
|
...element.attr,
|
240
|
-
className: `content-editable ${isEmpty ? "empty" : ""}
|
225
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`
|
241
226
|
// placeholder="paragraph"
|
242
227
|
,
|
243
228
|
children: children
|
244
229
|
});
|
245
230
|
case "headingOne":
|
246
|
-
return /*#__PURE__*/_jsx("
|
231
|
+
return /*#__PURE__*/_jsx("h1", {
|
247
232
|
...attributes,
|
248
233
|
...element.attr,
|
249
|
-
style: {
|
250
|
-
margin: "10px 0px"
|
251
|
-
},
|
252
234
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
253
235
|
// placeholder="Heading 1"
|
254
236
|
,
|
255
237
|
children: children
|
256
238
|
});
|
257
239
|
case "headingTwo":
|
258
|
-
return /*#__PURE__*/_jsx("
|
240
|
+
return /*#__PURE__*/_jsx("h2", {
|
259
241
|
...attributes,
|
260
242
|
...element.attr,
|
261
|
-
style: {
|
262
|
-
margin: "10px 0px"
|
263
|
-
},
|
264
243
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
265
244
|
// placeholder="Heading 2"
|
266
245
|
,
|
267
246
|
children: children
|
268
247
|
});
|
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
|
-
});
|
279
248
|
case "headingThree":
|
280
249
|
return /*#__PURE__*/_jsx("h3", {
|
281
250
|
...attributes,
|
282
251
|
...element.attr,
|
283
|
-
style: {
|
284
|
-
margin: "10px 0px"
|
285
|
-
},
|
286
252
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
287
253
|
// placeholder="Heading 3"
|
288
254
|
,
|
289
255
|
children: children
|
290
256
|
});
|
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
|
-
});
|
322
257
|
case "blockquote":
|
323
258
|
return /*#__PURE__*/_jsx("blockquote", {
|
324
259
|
...attributes,
|
@@ -370,7 +305,7 @@ export const getBlock = props => {
|
|
370
305
|
return /*#__PURE__*/_jsx("li", {
|
371
306
|
...attributes,
|
372
307
|
...element.attr,
|
373
|
-
className: `content-editable ${isEmpty ? "empty" : ""}
|
308
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
374
309
|
placeholder: "List",
|
375
310
|
style: {
|
376
311
|
color: firstChildren?.color
|
@@ -387,7 +322,7 @@ export const getBlock = props => {
|
|
387
322
|
return /*#__PURE__*/_jsx("p", {
|
388
323
|
...attributes,
|
389
324
|
...element.attr,
|
390
|
-
className: `content-editable ${isEmpty ? "empty" : ""}
|
325
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`
|
391
326
|
// placeholder="paragraph"
|
392
327
|
,
|
393
328
|
children: children
|
@@ -407,10 +342,6 @@ export const getBlock = props => {
|
|
407
342
|
...props
|
408
343
|
});
|
409
344
|
default:
|
410
|
-
return
|
411
|
-
...props,
|
412
|
-
isEmpty: isEmpty,
|
413
|
-
isChatEditor: true
|
414
|
-
});
|
345
|
+
return null;
|
415
346
|
}
|
416
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 => {
|
@@ -4,7 +4,6 @@ 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"];
|
8
7
|
export const formatDate = (date, format = "MM/DD/YYYY") => {
|
9
8
|
if (!date) return "";
|
10
9
|
var d = new Date(date),
|
@@ -164,7 +163,7 @@ export const handleInsertLastElement = (event, editor) => {
|
|
164
163
|
if (isFreeGrid) {
|
165
164
|
return;
|
166
165
|
}
|
167
|
-
const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c =>
|
166
|
+
const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c => c.type === "grid");
|
168
167
|
if (!ReactEditor.isFocused(editor)) {
|
169
168
|
if (isLastElementEmpty) {
|
170
169
|
if (hasPath) {
|
@@ -213,7 +212,7 @@ export const isListItem = editor => {
|
|
213
212
|
});
|
214
213
|
return node;
|
215
214
|
};
|
216
|
-
|
215
|
+
const getNode = (editor, path) => {
|
217
216
|
try {
|
218
217
|
return Node.get(editor, path);
|
219
218
|
} catch (err) {
|
@@ -265,17 +264,6 @@ export const decodeAndParseBase64 = encodedString => {
|
|
265
264
|
const jsonData = JSON.parse(decodedURLString);
|
266
265
|
return jsonData;
|
267
266
|
};
|
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
|
-
};
|
279
267
|
export const hasVerticalScrollbar = (element = {}) => {
|
280
268
|
return element.scrollHeight > element.clientHeight;
|
281
269
|
};
|
@@ -623,93 +611,4 @@ export const isPageSettings = (event, editor) => {
|
|
623
611
|
isPageSettingsNode = true;
|
624
612
|
return isPageSettingsNode;
|
625
613
|
}
|
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
|
-
}
|
715
614
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { Transforms } from "slate";
|
2
2
|
const insertNewLine = editor => {
|
3
3
|
Transforms.insertNodes(editor, {
|
4
4
|
type: "paragraph",
|
@@ -9,22 +9,4 @@ 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
|
-
};
|
30
12
|
export default insertNewLine;
|
@@ -9,13 +9,7 @@ export const findPageSettings = editor => {
|
|
9
9
|
path: null,
|
10
10
|
element: {
|
11
11
|
pageProps: {
|
12
|
-
pageWidth: "fixed"
|
13
|
-
"lineHeight": {
|
14
|
-
"xs": 1.43,
|
15
|
-
"sm": 1.43,
|
16
|
-
"md": 1.43,
|
17
|
-
"lg": 1.43
|
18
|
-
}
|
12
|
+
pageWidth: "fixed"
|
19
13
|
}
|
20
14
|
}
|
21
15
|
};
|
@@ -40,13 +34,7 @@ export const getPageSettings = editor => {
|
|
40
34
|
path: null,
|
41
35
|
element: {
|
42
36
|
pageProps: {
|
43
|
-
pageWidth: "fixed"
|
44
|
-
"lineHeight": {
|
45
|
-
"xs": 1.43,
|
46
|
-
"sm": 1.43,
|
47
|
-
"md": 1.43,
|
48
|
-
"lg": 1.43
|
49
|
-
}
|
37
|
+
pageWidth: "fixed"
|
50
38
|
}
|
51
39
|
}
|
52
40
|
};
|
@@ -2,8 +2,6 @@ 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 || '';
|
7
5
|
}
|
8
6
|
let n = Array.isArray(node) ? node : node?.children;
|
9
7
|
n = n && Array.isArray(n) ? n : n ? [n] : [];
|