@flozy/editor 10.5.1 → 10.5.3
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/CommonEditor.js +6 -4
- package/dist/Editor/Elements/Button/EditorButton.js +0 -2
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +4 -2
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +454 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +23 -8
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +3 -2
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +11 -0
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +8 -4
- package/dist/Editor/Elements/Embed/Image.js +3 -2
- package/dist/Editor/Elements/EmbedScript/Code.js +14 -2
- package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +57 -28
- package/dist/Editor/Elements/EmbedScript/styles.js +89 -0
- package/dist/Editor/Elements/Form/Form.js +181 -168
- package/dist/Editor/Elements/Form/FormElements/FormText.js +23 -6
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +3 -2
- package/dist/Editor/Elements/Form/FormField.js +10 -4
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +6 -4
- package/dist/Editor/Elements/FreeGrid/Options/More.js +1 -1
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -1
- package/dist/Editor/Elements/FreeGrid/styles.js +61 -7
- package/dist/Editor/Elements/List/CheckList.js +3 -2
- package/dist/Editor/Elements/Search/SearchAttachment.js +40 -9
- package/dist/Editor/Elements/Search/SearchButton.js +9 -8
- package/dist/Editor/Elements/Search/SearchList.js +9 -7
- package/dist/Editor/Elements/SimpleText/index.js +6 -1
- package/dist/Editor/Elements/Table/TableCell.js +7 -3
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +43 -18
- package/dist/Editor/assets/svg/ClearAllRounded.js +31 -0
- package/dist/Editor/assets/svg/ResetIconNew.js +23 -0
- package/dist/Editor/assets/svg/SettingsIcon.js +1 -0
- package/dist/Editor/common/Icon.js +3 -1
- package/dist/Editor/common/LinkSettings/NavComponents.js +34 -8
- package/dist/Editor/common/LinkSettings/index.js +85 -69
- package/dist/Editor/common/LinkSettings/style.js +245 -30
- package/dist/Editor/common/MentionsPopup/index.js +4 -1
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +13 -14
- package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +1 -0
- package/dist/Editor/common/RnD/ElementOptions/index.js +2 -2
- package/dist/Editor/common/RnD/ElementOptions/styles.js +28 -1
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +4 -4
- package/dist/Editor/common/RnD/ElementSettings/styles.js +147 -12
- package/dist/Editor/common/RnD/OptionsPopup/index.js +8 -5
- package/dist/Editor/common/RnD/OptionsPopup/style.js +121 -19
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +0 -6
- package/dist/Editor/common/Select/index.js +2 -0
- package/dist/Editor/common/Shorthands/elements.js +11 -11
- package/dist/Editor/common/SnackBar/index.js +43 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +7 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +13 -6
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +5 -7
- package/dist/Editor/common/iconListV2.js +101 -6
- package/dist/Editor/common/iconslist.js +3 -0
- package/dist/Editor/commonStyle.js +70 -1
- package/dist/Editor/hooks/useMouseMove.js +2 -5
- package/dist/Editor/utils/SlateUtilityFunctions.js +12 -10
- package/dist/Editor/utils/form.js +4 -4
- package/dist/Editor/utils/formfield.js +8 -2
- package/dist/Editor/utils/helper.js +76 -0
- package/package.json +1 -1
@@ -25,13 +25,11 @@ const pageSettingsStyle = [{
|
|
25
25
|
label: "Padding",
|
26
26
|
key: "bannerSpacing",
|
27
27
|
type: "bannerSpacing"
|
28
|
-
}
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
// },
|
34
|
-
]
|
28
|
+
}, {
|
29
|
+
label: "Line Spacing",
|
30
|
+
key: "lineHeight",
|
31
|
+
type: "lineSpacing"
|
32
|
+
}]
|
35
33
|
}, {
|
36
34
|
tab: "Max Width",
|
37
35
|
value: "maxWidth",
|
@@ -1236,27 +1236,37 @@ export function ToggleFullScreenIcon() {
|
|
1236
1236
|
}
|
1237
1237
|
export function CodeElementIcon() {
|
1238
1238
|
return /*#__PURE__*/_jsxs("svg", {
|
1239
|
-
width: "
|
1240
|
-
height: "
|
1241
|
-
viewBox: "0 0
|
1239
|
+
width: "24",
|
1240
|
+
height: "24",
|
1241
|
+
viewBox: "0 0 24 24",
|
1242
1242
|
fill: "none",
|
1243
1243
|
xmlns: "http://www.w3.org/2000/svg",
|
1244
1244
|
className: "commonSvgStyle",
|
1245
1245
|
children: [/*#__PURE__*/_jsx("path", {
|
1246
|
-
d: "
|
1246
|
+
d: "M8 10L6 12L8 14",
|
1247
1247
|
stroke: "#64748B",
|
1248
|
+
strokeWidth: "1.5",
|
1248
1249
|
strokeMiterlimit: "10",
|
1249
1250
|
strokeLinecap: "round",
|
1250
1251
|
strokeLinejoin: "round"
|
1251
1252
|
}), /*#__PURE__*/_jsx("path", {
|
1252
|
-
d: "
|
1253
|
+
d: "M16 10L18 12L16 14",
|
1253
1254
|
stroke: "#64748B",
|
1255
|
+
strokeWidth: "1.5",
|
1256
|
+
strokeMiterlimit: "10",
|
1257
|
+
strokeLinecap: "round",
|
1258
|
+
strokeLinejoin: "round"
|
1259
|
+
}), /*#__PURE__*/_jsx("path", {
|
1260
|
+
d: "M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",
|
1261
|
+
stroke: "#64748B",
|
1262
|
+
strokeWidth: "1.5",
|
1254
1263
|
strokeMiterlimit: "10",
|
1255
1264
|
strokeLinecap: "round",
|
1256
1265
|
strokeLinejoin: "round"
|
1257
1266
|
}), /*#__PURE__*/_jsx("path", {
|
1258
|
-
d: "
|
1267
|
+
d: "M13 9.66992L11 14.33",
|
1259
1268
|
stroke: "#64748B",
|
1269
|
+
strokeWidth: "1.5",
|
1260
1270
|
strokeMiterlimit: "10",
|
1261
1271
|
strokeLinecap: "round",
|
1262
1272
|
strokeLinejoin: "round"
|
@@ -1431,4 +1441,89 @@ export function SectionDragIcon() {
|
|
1431
1441
|
fill: "#94A3B8"
|
1432
1442
|
})]
|
1433
1443
|
});
|
1444
|
+
}
|
1445
|
+
export function PenIcon() {
|
1446
|
+
return /*#__PURE__*/_jsxs("svg", {
|
1447
|
+
width: "17",
|
1448
|
+
height: "17",
|
1449
|
+
viewBox: "0 0 17 17",
|
1450
|
+
fill: "none",
|
1451
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1452
|
+
className: "commonSvgStyle",
|
1453
|
+
children: [/*#__PURE__*/_jsx("path", {
|
1454
|
+
d: "M9.74898 3.14435L3.93357 9.29977C3.71398 9.53352 3.50148 9.99393 3.45898 10.3127L3.1969 12.6077C3.10482 13.4364 3.69982 14.0031 4.52148 13.8614L6.80232 13.4719C7.12107 13.4152 7.56732 13.1814 7.7869 12.9406L13.6023 6.78518C14.6081 5.72268 15.0615 4.51143 13.4961 3.03102C11.9377 1.56477 10.7548 2.08185 9.74898 3.14435Z",
|
1455
|
+
stroke: "#64748B",
|
1456
|
+
strokeWidth: "1.2",
|
1457
|
+
strokeMiterlimit: "10",
|
1458
|
+
strokeLinecap: "round",
|
1459
|
+
strokeLinejoin: "round"
|
1460
|
+
}), /*#__PURE__*/_jsx("path", {
|
1461
|
+
d: "M8.77734 4.17188C9.08193 6.12688 10.6686 7.62146 12.6378 7.81979",
|
1462
|
+
stroke: "#64748B",
|
1463
|
+
strokeWidth: "1.2",
|
1464
|
+
strokeMiterlimit: "10",
|
1465
|
+
strokeLinecap: "round",
|
1466
|
+
strokeLinejoin: "round"
|
1467
|
+
})]
|
1468
|
+
});
|
1469
|
+
}
|
1470
|
+
export function SaveTemplIcon() {
|
1471
|
+
return /*#__PURE__*/_jsxs("svg", {
|
1472
|
+
width: "18",
|
1473
|
+
height: "18",
|
1474
|
+
viewBox: "0 0 18 18",
|
1475
|
+
fill: "none",
|
1476
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1477
|
+
className: "commonSvgStyle",
|
1478
|
+
children: [/*#__PURE__*/_jsx("path", {
|
1479
|
+
d: "M9 1.5V6.75L10.5 5.25",
|
1480
|
+
stroke: "#64748B",
|
1481
|
+
strokeWidth: "1.2",
|
1482
|
+
strokeLinecap: "round",
|
1483
|
+
strokeLinejoin: "round"
|
1484
|
+
}), /*#__PURE__*/_jsx("path", {
|
1485
|
+
d: "M9 6.75L7.5 5.25",
|
1486
|
+
stroke: "#64748B",
|
1487
|
+
strokeWidth: "1.2",
|
1488
|
+
strokeLinecap: "round",
|
1489
|
+
strokeLinejoin: "round"
|
1490
|
+
}), /*#__PURE__*/_jsx("path", {
|
1491
|
+
d: "M1.48438 9.75H4.79187C5.07687 9.75 5.33188 9.9075 5.45938 10.1625L6.33687 11.9175C6.59187 12.4275 7.10938 12.75 7.67938 12.75H10.3269C10.8969 12.75 11.4144 12.4275 11.6694 11.9175L12.5469 10.1625C12.6744 9.9075 12.9369 9.75 13.2144 9.75H16.4844",
|
1492
|
+
stroke: "#64748B",
|
1493
|
+
strokeWidth: "1.2",
|
1494
|
+
strokeLinecap: "round",
|
1495
|
+
strokeLinejoin: "round"
|
1496
|
+
}), /*#__PURE__*/_jsx("path", {
|
1497
|
+
d: "M5.25 3.09766C2.595 3.48766 1.5 5.04766 1.5 8.25016V11.2502C1.5 15.0002 3 16.5002 6.75 16.5002H11.25C15 16.5002 16.5 15.0002 16.5 11.2502V8.25016C16.5 5.04766 15.405 3.48766 12.75 3.09766",
|
1498
|
+
stroke: "#64748B",
|
1499
|
+
strokeWidth: "1.2",
|
1500
|
+
strokeLinecap: "round",
|
1501
|
+
strokeLinejoin: "round"
|
1502
|
+
})]
|
1503
|
+
});
|
1504
|
+
}
|
1505
|
+
export function UploadIconCloud() {
|
1506
|
+
return /*#__PURE__*/_jsxs("svg", {
|
1507
|
+
width: "16",
|
1508
|
+
height: "16",
|
1509
|
+
viewBox: "0 0 16 16",
|
1510
|
+
fill: "none",
|
1511
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1512
|
+
className: "commonSvgStyle uploadIcon",
|
1513
|
+
children: [/*#__PURE__*/_jsx("path", {
|
1514
|
+
d: "M6.00065 14.6673H4.66732C2.00065 14.6673 1.33398 14.0007 1.33398 11.334V4.66732C1.33398 2.00065 2.00065 1.33398 4.66732 1.33398H5.66732C6.66732 1.33398 6.88733 1.62733 7.26733 2.13399L8.26733 3.46733C8.52067 3.80066 8.66732 4.00065 9.33398 4.00065H11.334C14.0007 4.00065 14.6673 4.66732 14.6673 7.33398V8.66732",
|
1515
|
+
stroke: "#64748B",
|
1516
|
+
strokeWidth: "1.2",
|
1517
|
+
strokeMiterlimit: "10",
|
1518
|
+
strokeLinecap: "round",
|
1519
|
+
strokeLinejoin: "round"
|
1520
|
+
}), /*#__PURE__*/_jsx("path", {
|
1521
|
+
d: "M9.17305 12.2136C7.60638 12.3269 7.60638 14.5936 9.17305 14.7069H12.8797C13.3264 14.7069 13.7664 14.5402 14.093 14.2402C15.193 13.2802 14.6064 11.3602 13.1597 11.1802C12.6397 8.05358 8.11973 9.24024 9.18639 12.2202",
|
1522
|
+
stroke: "#64748B",
|
1523
|
+
strokeWidth: "1.2",
|
1524
|
+
strokeMiterlimit: "10",
|
1525
|
+
strokeLinecap: "round",
|
1526
|
+
strokeLinejoin: "round"
|
1527
|
+
})]
|
1528
|
+
});
|
1434
1529
|
}
|
@@ -1273,6 +1273,7 @@ export const GridSettingsIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
1273
1273
|
height: "22",
|
1274
1274
|
viewBox: "0 0 22 22",
|
1275
1275
|
fill: "none",
|
1276
|
+
className: "commonSvgStyle",
|
1276
1277
|
children: [/*#__PURE__*/_jsx("path", {
|
1277
1278
|
d: "M11 13.75C12.5188 13.75 13.75 12.5188 13.75 11C13.75 9.48122 12.5188 8.25 11 8.25C9.48122 8.25 8.25 9.48122 8.25 11C8.25 12.5188 9.48122 13.75 11 13.75Z",
|
1278
1279
|
stroke: "#64748B",
|
@@ -1341,6 +1342,7 @@ export const GridAddSectionIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
1341
1342
|
height: "20",
|
1342
1343
|
viewBox: "0 0 20 20",
|
1343
1344
|
fill: "none",
|
1345
|
+
className: "addIconCircle",
|
1344
1346
|
children: [/*#__PURE__*/_jsx("path", {
|
1345
1347
|
d: "M10 19C14.9706 19 19 14.9706 19 10C19 5.02944 14.9706 1 10 1C5.02944 1 1 5.02944 1 10C1 14.9706 5.02944 19 10 19Z",
|
1346
1348
|
stroke: "#64748B",
|
@@ -1786,6 +1788,7 @@ export const Text = props => /*#__PURE__*/_jsxs("svg", {
|
|
1786
1788
|
viewBox: "0 0 15 14",
|
1787
1789
|
fill: "none",
|
1788
1790
|
xmlns: "http://www.w3.org/2000/svg",
|
1791
|
+
className: "commonSvgStyle",
|
1789
1792
|
children: [/*#__PURE__*/_jsx("path", {
|
1790
1793
|
d: "M2.5 4.1825V3.12083C2.5 2.45 3.0425 1.91333 3.7075 1.91333H12.1775C12.8483 1.91333 13.385 2.45583 13.385 3.12083V4.1825",
|
1791
1794
|
stroke: props?.stroke || "#000",
|
@@ -132,7 +132,7 @@ const useCommonStyle = theme => ({
|
|
132
132
|
background: theme?.palette?.editor?.inputFieldBgColor,
|
133
133
|
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
|
134
134
|
borderRadius: "10px",
|
135
|
-
width: "
|
135
|
+
width: "52px !important",
|
136
136
|
marginLeft: "10px",
|
137
137
|
height: '36px !important'
|
138
138
|
},
|
@@ -596,6 +596,75 @@ const useCommonStyle = theme => ({
|
|
596
596
|
stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
|
597
597
|
}
|
598
598
|
}
|
599
|
+
},
|
600
|
+
formStyles: {
|
601
|
+
"& input": {
|
602
|
+
background: theme?.palette?.editor?.inputFieldBgColor,
|
603
|
+
borderColor: theme?.palette?.editor?.inputFieldBorder,
|
604
|
+
height: "44px",
|
605
|
+
fontSize: "14px",
|
606
|
+
color: theme?.palette?.editor?.textColor
|
607
|
+
},
|
608
|
+
"& .form-btn-wrpr": {
|
609
|
+
"& button": {
|
610
|
+
fontWeight: 500,
|
611
|
+
height: "44px"
|
612
|
+
}
|
613
|
+
}
|
614
|
+
},
|
615
|
+
formMenuStyle: {
|
616
|
+
"& .MuiPaper-root": {
|
617
|
+
background: "transparent",
|
618
|
+
boxShadow: "none"
|
619
|
+
},
|
620
|
+
"& .MuiList-root": {
|
621
|
+
padding: "2px 0px 0px 16px"
|
622
|
+
},
|
623
|
+
"& .MuiButtonBase-root": {
|
624
|
+
padding: "2px"
|
625
|
+
},
|
626
|
+
"& li": {
|
627
|
+
marginLeft: "5px",
|
628
|
+
"&:hover": {
|
629
|
+
background: "transparent"
|
630
|
+
},
|
631
|
+
"& button": {
|
632
|
+
height: "28px",
|
633
|
+
width: "28px",
|
634
|
+
borderRadius: "50%",
|
635
|
+
background: theme?.palette?.editor?.signatureFontBtnBg,
|
636
|
+
border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
|
637
|
+
boxShadow: "0px 0px 4px 0px #00000024",
|
638
|
+
"&:hover": {
|
639
|
+
background: theme?.palette?.editor?.signatureFontBtnBg
|
640
|
+
},
|
641
|
+
"& svg": {
|
642
|
+
height: "20px",
|
643
|
+
width: "20px"
|
644
|
+
},
|
645
|
+
"& .uploadIcon": {
|
646
|
+
height: "17px",
|
647
|
+
width: "17px"
|
648
|
+
},
|
649
|
+
"& .commonSvgStyle path": {
|
650
|
+
stroke: theme?.palette?.editor?.closeButtonSvgStroke
|
651
|
+
}
|
652
|
+
}
|
653
|
+
}
|
654
|
+
},
|
655
|
+
fieldBtnSettings: {
|
656
|
+
"& .MuiButtonBase-root": {
|
657
|
+
height: "28px",
|
658
|
+
width: "28px",
|
659
|
+
padding: "4px",
|
660
|
+
"& svg": {
|
661
|
+
width: "20px",
|
662
|
+
height: "20px",
|
663
|
+
"& path": {
|
664
|
+
stroke: theme?.palette?.editor?.closeButtonSvgStroke
|
665
|
+
}
|
666
|
+
}
|
667
|
+
}
|
599
668
|
}
|
600
669
|
});
|
601
670
|
export default useCommonStyle;
|
@@ -36,7 +36,6 @@ export const EditorProvider = ({
|
|
36
36
|
path: null
|
37
37
|
});
|
38
38
|
const [fontFamilies, setFontFamilies] = useState(defaultFontFamilies);
|
39
|
-
const [activeBreakPoint, setActiveBreakPoint] = useState("");
|
40
39
|
useEffect(() => {
|
41
40
|
window.updateSelectedItem = d => {
|
42
41
|
setSelectedElement(d);
|
@@ -99,10 +98,8 @@ export const EditorProvider = ({
|
|
99
98
|
setOpenAI,
|
100
99
|
updateDragging,
|
101
100
|
fontFamilies,
|
102
|
-
setFontFamilies
|
103
|
-
|
104
|
-
setActiveBreakPoint
|
105
|
-
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
|
101
|
+
setFontFamilies
|
102
|
+
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop]);
|
106
103
|
return /*#__PURE__*/_jsx(EditorContext.Provider, {
|
107
104
|
value: otherValues,
|
108
105
|
children: children
|
@@ -34,7 +34,7 @@ import SimpleText from "../Elements/SimpleText";
|
|
34
34
|
import CheckList from "../Elements/List/CheckList";
|
35
35
|
import { getTextColor, isEmptyTextNode } from "../helper";
|
36
36
|
import Attachments from "../Elements/Attachments/Attachments";
|
37
|
-
import { getBreakPointsValue, groupByBreakpoint } from "../helper/theme";
|
37
|
+
import { getBreakpointLineSpacing, getBreakPointsValue, getDevice, groupByBreakpoint } from "../helper/theme";
|
38
38
|
import Variables from "../Elements/Variables/Variable";
|
39
39
|
import insertNewLine from "./insertNewLine";
|
40
40
|
import Divider from "../Elements/Divider/Divider";
|
@@ -181,6 +181,9 @@ export const activeMark = (editor, format) => {
|
|
181
181
|
};
|
182
182
|
export const getMarked = (leaf, children, theme) => {
|
183
183
|
const className = leaf?.doublequote ? "doublequote" : "";
|
184
|
+
const lineH = leaf?.lineHeight;
|
185
|
+
const breakpoint = getDevice(window.innerWidth);
|
186
|
+
const lineHeight = getBreakpointLineSpacing(lineH, breakpoint);
|
184
187
|
if (leaf.highlight) {
|
185
188
|
children = /*#__PURE__*/_jsx("span", {
|
186
189
|
style: {
|
@@ -229,7 +232,7 @@ export const getMarked = (leaf, children, theme) => {
|
|
229
232
|
});
|
230
233
|
}
|
231
234
|
// cover under single span
|
232
|
-
if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
|
235
|
+
if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || lineHeight || className) {
|
233
236
|
const family = leaf?.fontFamily;
|
234
237
|
const textStyles = getTextColor(leaf?.color);
|
235
238
|
children = /*#__PURE__*/_jsx("span", {
|
@@ -297,6 +300,9 @@ export const getBlock = props => {
|
|
297
300
|
const {
|
298
301
|
translation
|
299
302
|
} = customProps;
|
303
|
+
const breakpoint = getDevice(window.innerWidth);
|
304
|
+
const lineH = element?.children[0]?.lineHeight;
|
305
|
+
const selectedLineHeight = getBreakpointLineSpacing(lineH, breakpoint);
|
300
306
|
switch (element.type) {
|
301
307
|
case "headingOne":
|
302
308
|
return /*#__PURE__*/_jsxs("h1", {
|
@@ -371,7 +377,7 @@ export const getBlock = props => {
|
|
371
377
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
372
378
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
373
379
|
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
|
374
|
-
lineHeight:
|
380
|
+
lineHeight: `${selectedLineHeight} !important`
|
375
381
|
},
|
376
382
|
children: children
|
377
383
|
});
|
@@ -425,15 +431,13 @@ export const getBlock = props => {
|
|
425
431
|
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
426
432
|
placeholder: translation("List"),
|
427
433
|
style: {
|
428
|
-
color: firstChildren?.color
|
434
|
+
color: firstChildren?.color,
|
435
|
+
lineHeight: `${selectedLineHeight}`
|
429
436
|
},
|
430
437
|
children: children
|
431
438
|
});
|
432
439
|
case "orderedList":
|
433
440
|
return /*#__PURE__*/_jsx("ol", {
|
434
|
-
style: {
|
435
|
-
lineHeight: 1.43
|
436
|
-
},
|
437
441
|
className: "listItemMargin",
|
438
442
|
type: "1",
|
439
443
|
...attributes,
|
@@ -441,9 +445,6 @@ export const getBlock = props => {
|
|
441
445
|
});
|
442
446
|
case "unorderedList":
|
443
447
|
return /*#__PURE__*/_jsx("ul", {
|
444
|
-
style: {
|
445
|
-
lineHeight: 1.43
|
446
|
-
},
|
447
448
|
className: "listItemMargin",
|
448
449
|
...attributes,
|
449
450
|
children: children
|
@@ -451,6 +452,7 @@ export const getBlock = props => {
|
|
451
452
|
case "check-list-item":
|
452
453
|
return /*#__PURE__*/_jsx(CheckList, {
|
453
454
|
...props,
|
455
|
+
selectedLineHeight: selectedLineHeight,
|
454
456
|
isEmpty: isEmpty
|
455
457
|
});
|
456
458
|
case "link":
|
@@ -22,8 +22,14 @@ export const formField = data => {
|
|
22
22
|
},
|
23
23
|
fontFamily: data?.fontFamily ? data?.fontFamily : "",
|
24
24
|
textSize: data?.textSize ? data?.textSize : "",
|
25
|
-
textColor: data?.textColor
|
26
|
-
fontWeight: data?.fontWeight ? data?.fontWeight : "500"
|
25
|
+
textColor: data?.textColor && `${data?.textColor} !important`,
|
26
|
+
fontWeight: data?.fontWeight ? data?.fontWeight : "500",
|
27
|
+
borderRadius: {
|
28
|
+
topLeft: 8,
|
29
|
+
topRight: 8,
|
30
|
+
bottomLeft: 8,
|
31
|
+
bottomRight: 8
|
32
|
+
}
|
27
33
|
};
|
28
34
|
};
|
29
35
|
export const insertGridItem = editor => {
|
@@ -863,4 +863,80 @@ export const getCurrentNodeText = editor => {
|
|
863
863
|
} catch (error) {
|
864
864
|
console.log("Error:", error);
|
865
865
|
}
|
866
|
+
};
|
867
|
+
const handleCopiedList = (el, domRange) => {
|
868
|
+
// Ensure you're working with an Element, not a Text node
|
869
|
+
const startEl = domRange.startContainer.nodeType === Node.ELEMENT_NODE ? domRange.startContainer : domRange.startContainer.parentElement;
|
870
|
+
const liEl = startEl?.closest("li");
|
871
|
+
let listType = "";
|
872
|
+
if (liEl) {
|
873
|
+
const listEl = liEl.closest("ul, ol");
|
874
|
+
if (listEl) {
|
875
|
+
listType = listEl.tagName === "OL" ? "OL" : "UL";
|
876
|
+
}
|
877
|
+
}
|
878
|
+
const parent = el.parentElement;
|
879
|
+
if (listType === "OL") {
|
880
|
+
const index = Array.from(parent.children).indexOf(el) + 1;
|
881
|
+
el.insertAdjacentText("afterbegin", `${index}. `);
|
882
|
+
} else {
|
883
|
+
el.insertAdjacentText("afterbegin", "- ");
|
884
|
+
}
|
885
|
+
};
|
886
|
+
const getCopiedTextFormat = domRange => {
|
887
|
+
const contents = domRange.cloneContents();
|
888
|
+
const div = document.createElement("div");
|
889
|
+
div.appendChild(contents);
|
890
|
+
|
891
|
+
// Replace <br> with newlines
|
892
|
+
div.querySelectorAll("br").forEach(br => br.replaceWith("\n"));
|
893
|
+
const BLOCK_TAGS = ["DIV", "P", "LI", "H1", "H2", "H3", "H4", "H5", "H6"];
|
894
|
+
div.querySelectorAll(BLOCK_TAGS.join(",")).forEach(el => {
|
895
|
+
if (el.tagName === "LI") {
|
896
|
+
handleCopiedList(el, domRange);
|
897
|
+
}
|
898
|
+
el.insertAdjacentText("beforeend", "\n");
|
899
|
+
});
|
900
|
+
let text = div.textContent || "";
|
901
|
+
text = text
|
902
|
+
// Remove spaces or tabs that appear just before a newline
|
903
|
+
// e.g., "text \n" → "text\n"
|
904
|
+
.replace(/[ \t]+\n/g, "\n")
|
905
|
+
|
906
|
+
// Collapse multiple consecutive newlines into a single newline
|
907
|
+
// e.g., "\n\n\n" → "\n"
|
908
|
+
.replace(/\n{2,}/g, "\n")
|
909
|
+
|
910
|
+
// Remove leading and trailing whitespace from the final text
|
911
|
+
.trim();
|
912
|
+
return text;
|
913
|
+
};
|
914
|
+
const getCopiedHTMLFormat = domRange => {
|
915
|
+
const htmlContents = domRange.cloneContents();
|
916
|
+
const container = document.createElement("div");
|
917
|
+
container.appendChild(htmlContents);
|
918
|
+
const html = container.innerHTML;
|
919
|
+
return html;
|
920
|
+
};
|
921
|
+
const getCopiedSlateFormat = editor => {
|
922
|
+
// Get Slate fragment
|
923
|
+
const fragment = JSON.stringify(Editor.fragment(editor, editor.selection));
|
924
|
+
const encodedFragment = window.btoa(encodeURIComponent(fragment));
|
925
|
+
return encodedFragment;
|
926
|
+
};
|
927
|
+
export const handleCopy = (event, editor) => {
|
928
|
+
const {
|
929
|
+
selection
|
930
|
+
} = editor;
|
931
|
+
if (!selection || Range.isCollapsed(selection)) return;
|
932
|
+
event.preventDefault();
|
933
|
+
const domRange = ReactEditor.toDOMRange(editor, selection);
|
934
|
+
const text = getCopiedTextFormat(domRange);
|
935
|
+
const html = getCopiedHTMLFormat(domRange);
|
936
|
+
const encodedFragment = getCopiedSlateFormat(editor);
|
937
|
+
|
938
|
+
// Set all formats manually
|
939
|
+
event.clipboardData?.setData("text/html", html);
|
940
|
+
event.clipboardData?.setData("text/plain", text);
|
941
|
+
event.clipboardData?.setData("application/x-slate-fragment", encodedFragment);
|
866
942
|
};
|