@flozy/editor 5.7.7 → 5.7.9

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.
Files changed (41) hide show
  1. package/dist/Editor/CommonEditor.js +6 -4
  2. package/dist/Editor/Editor.css +23 -15
  3. package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
  4. package/dist/Editor/Elements/Button/EditorButton.js +2 -1
  5. package/dist/Editor/Elements/DataView/DataView.js +4 -3
  6. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
  7. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
  8. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
  9. package/dist/Editor/Elements/Divider/Divider.js +3 -3
  10. package/dist/Editor/Elements/Search/SearchList.js +8 -1
  11. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  12. package/dist/Editor/Elements/Title/title.js +13 -1
  13. package/dist/Editor/Elements/Variables/Style.js +20 -2
  14. package/dist/Editor/Elements/Variables/VariableButton.js +7 -3
  15. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +24 -25
  16. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
  17. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
  18. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
  19. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
  20. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
  21. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +5 -0
  22. package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
  23. package/dist/Editor/common/FontLoader/FontList.js +3 -11
  24. package/dist/Editor/common/FontLoader/FontLoader.js +33 -7
  25. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
  26. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +8 -2
  27. package/dist/Editor/common/Section/styles.js +15 -0
  28. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  29. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  30. package/dist/Editor/common/Uploader.js +8 -0
  31. package/dist/Editor/commonStyle.js +13 -12
  32. package/dist/Editor/helper/deserialize/index.js +18 -5
  33. package/dist/Editor/helper/index.js +2 -2
  34. package/dist/Editor/helper/markdown.js +45 -0
  35. package/dist/Editor/plugins/withHTML.js +8 -1
  36. package/dist/Editor/plugins/withLayout.js +1 -1
  37. package/dist/Editor/utils/SlateUtilityFunctions.js +33 -3
  38. package/dist/Editor/utils/button.js +4 -4
  39. package/dist/Editor/utils/draftToSlate.js +3 -2
  40. package/dist/Editor/utils/helper.js +60 -19
  41. package/package.json +2 -1
@@ -14,6 +14,7 @@ import MiniColorPicker from "./MiniColorPicker";
14
14
  import SelectAlignment from "./SelectAlignment";
15
15
  import SelectFontSize from "./SelectFontSize";
16
16
  import InfinityAITool from "./InfinityAITool";
17
+ import { viewSlateSelection } from "../../../utils/helper";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
20
  const DEFAULT_COLOR = {
@@ -60,13 +61,15 @@ const MiniTextFormat = props => {
60
61
  className: "verticalLine"
61
62
  }), /*#__PURE__*/_jsx(SelectList, {
62
63
  classes: classes,
63
- editor: editor
64
+ editor: editor,
65
+ closeMainPopup: closeMainPopup
64
66
  }), /*#__PURE__*/_jsx("div", {
65
67
  className: "verticalLine mr-1"
66
68
  }), /*#__PURE__*/_jsx(SelectAlignment, {
67
69
  fontAlign: fontAlign,
68
70
  classes: classes,
69
- editor: editor
71
+ editor: editor,
72
+ closeMainPopup: closeMainPopup
70
73
  }), /*#__PURE__*/_jsx("div", {
71
74
  className: "verticalLine mr-1"
72
75
  }), /*#__PURE__*/_jsx(SelectFontSize, {
@@ -98,7 +101,10 @@ const MiniTextFormat = props => {
98
101
  editor: editor,
99
102
  customProps: customProps
100
103
  }, link.id), /*#__PURE__*/_jsx(IconButton, {
101
- onClick: e => setAnchorEl(document.getElementById("mini-text-editor-wrapper")),
104
+ onClick: e => {
105
+ viewSlateSelection();
106
+ setAnchorEl(document.getElementById("mini-text-editor-wrapper"));
107
+ },
102
108
  className: `textSettingsIcon ${open ? "btnActive" : ""}`,
103
109
  children: /*#__PURE__*/_jsx(TextToolIcon, {})
104
110
  }), /*#__PURE__*/_jsx(Popper, {
@@ -416,6 +416,11 @@ const usePopupStyle = theme => ({
416
416
  "& .MuiOutlinedInput-notchedOutline": {
417
417
  border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`
418
418
  },
419
+ '& .MuiInputBase-root': {
420
+ '& input': {
421
+ border: "none !important"
422
+ }
423
+ },
419
424
  "& svg": {
420
425
  width: "20px",
421
426
  height: "24px"
@@ -9,6 +9,7 @@ import { useEditorContext } from "../../hooks/useMouseMove";
9
9
  import usePopupStyles from "../PopupTool/PopupToolStyle";
10
10
  import useEditorScroll from "../../hooks/useEditorScroll";
11
11
  import { isCarouselSelected } from "../../helper";
12
+ import { hideSlateSelection } from "../../utils/helper";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const PopupTool = props => {
14
15
  const {
@@ -83,6 +84,7 @@ const PopupTool = props => {
83
84
  setAnchorEl(null);
84
85
  } else {
85
86
  updateAnchorEl();
87
+ hideSlateSelection(); // removes slate selection background, when there is no selection
86
88
  }
87
89
  }, [selection]);
88
90
  useEffect(() => {
@@ -1,11 +1,3 @@
1
- export const defaultFonts = [
2
- // "EB Garamond",
3
- "Anton", "DM Serif Text", "Libre Baskerville", "Montserrat", "Open Sans", "Public Sans", "Raleway", "Space Mono", "Great Vibes", "Zeyada", "Allura", "Pinyon Script", "Dancing Script", "Gaegu", "Kite One", "Merriweather"];
4
- export const otherFonts = ["PoppinsRegular", "PoppinsBold", "Monaco", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door", "Helvetica", "Georgia", "Times New Roman", "Courier New", "Impact"];
5
- export const googleFontList = ["Roboto", "Noto Sans JP", "Poppins", "Lato", "Inter", "Roboto Condensed", "Roboto Mono", "Oswald", "Noto Sans", "Nunito", "Nunito Sans", "Ubuntu", "Rubik", "Playfair Display", "Noto Sans KR", "Roboto Slab", "PT Sans", "Kanit", "Work Sans", "Lora", "DM Sans", "Mulish", "Quicksand", "Fira Sans", "Noto Sans TC", "Inconsolata", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Karla", "Titillium Web", "Heebo", "Noto Serif", "Nanum Gothic", "Noto Color Emoji", "Agdasima", "Bebas Neue", "Libre Franklin", "Mukta", "Outfit", "Josefin Sans", "Source Code Pro", "Jost", "Space Grotesk", "Hind Siliguri", "Arimo", "Cabin", "Barlow Condensed", "Dosis", "Fira Sans Condensed", "Bitter", "Archivo", "Figtree", "Noto Serif JP", "PT Sans Narrow", "Abel", "Noto Sans SC",
6
- // "Source Sans 3",
7
- "Hind",
8
- // "Exo 2",
9
- "Teko", "Oxygen", "Cairo", "Crimson Text", "Plus Jakarta Sans", "Overpass", "Pacifico", "Prompt", "Red Hat Display", "Varela Round", "Cormorant Garamond", "Assistant", "Comfortaa", "Lexend", "Signika Negative",
10
- // "M PLUS Rounded 1c",
11
- "Fjalla One", "Caveat", "IBM Plex Mono", "Arvo", "Lobster", "Schibsted Grotesk", "Chakra Petch", "Maven Pro", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", 'Titillium Web', ...defaultFonts];
1
+ const otherFonts = ["PoppinsRegular", "PoppinsBold", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door"];
2
+ const mostUsedGoogleFonts = ["Roboto", "Poppins", "Lato", "Inter", "Nunito", "Ubuntu", "Oswald", "Rubik", "Roboto Slab", "PT Sans", "Work Sans", "Lora", "Mulish", "DM Sans", "Fira Sans", "Quicksand", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Libre Franklin", "Bebas Neue", "Cabin", "Titillium Web", "Heebo", "Noto Serif", "Jost", "Source Code Pro", "Josefin Sans", "Dosis", "Fira Sans Condensed", "Archivo", "Noto Serif JP", "Crimson Text", "Cairo", "Pacifico", "Red Hat Display", "Assistant", "Comfortaa", "Lexend", "Fjalla One", "Caveat", "Arvo", "Lobster", "Schibsted Grotesk", "EB Garamond", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", "Plus Jakarta Sans"];
3
+ export const googleFontList = [...mostUsedGoogleFonts, ...otherFonts];
@@ -1,7 +1,11 @@
1
- import { useEffect } from "react";
1
+ import { useEffect, useState } from "react";
2
2
  import WebFont from "webfontloader";
3
3
  import { useEditorContext } from "../../hooks/useMouseMove";
4
- import { defaultFonts, googleFontList, otherFonts } from "./FontList";
4
+ import { googleFontList } from "./FontList";
5
+ import CircularProgress from '@mui/material/CircularProgress';
6
+ import Box from "@mui/material/Box";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
9
  const FontLoader = props => {
6
10
  const {
7
11
  otherProps,
@@ -10,14 +14,20 @@ const FontLoader = props => {
10
14
  const {
11
15
  setFontFamilies
12
16
  } = useEditorContext();
17
+ const [loading, setLoading] = useState(false);
13
18
  const loadFontsInBatches = (families, batchSize = 5, maxRetries = 3) => {
14
19
  let currentIndex = 0;
15
20
  let retryCount = 0;
21
+ let hideLoaderOn = 30;
16
22
  function loadNextBatch() {
17
23
  if (currentIndex >= families?.length) {
18
24
  // console.log("All fonts have been loaded");
25
+ setLoading(false);
19
26
  return;
20
27
  }
28
+ if (currentIndex >= hideLoaderOn) {
29
+ setLoading(false);
30
+ }
21
31
  const batch = families?.slice(currentIndex, currentIndex + batchSize);
22
32
  const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
23
33
  WebFont.load({
@@ -54,21 +64,21 @@ const FontLoader = props => {
54
64
  loadNextBatch();
55
65
  };
56
66
  useEffect(() => {
57
- let families = [...otherFonts, ...defaultFonts];
67
+ let families = [...googleFontList];
58
68
  if (!readOnly) {
59
69
  otherProps?.services("listGoogleFont", []).then(data => {
60
- families = [...families, ...(data?.data || [])];
61
- const filteredfamilies = families?.filter(font => !font?.includes("Material"));
70
+ families = [...(data?.data || [])];
62
71
  setFontFamilies({
63
72
  id: 1,
64
73
  format: "fontFamily",
65
74
  type: "fontfamilydropdown",
66
- options: filteredfamilies || []
75
+ options: families || []
67
76
  });
68
77
  loadFontsInBatches(families);
69
78
  }).catch(err => {
70
79
  // console.log(err);
71
80
  });
81
+ // setLoading(true);
72
82
  } else {
73
83
  function correctFontArray(fontString) {
74
84
  let fontsArray = fontString.split(",");
@@ -90,9 +100,25 @@ const FontLoader = props => {
90
100
  families = families?.map(font => font?.replace(/\"/g, ""));
91
101
  families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
92
102
  families = families.filter(font => googleFontList.includes(font));
103
+ // setLoading(true);
93
104
  loadFontsInBatches(families);
94
105
  }
95
106
  }, []);
96
- return null;
107
+ return /*#__PURE__*/_jsx(_Fragment, {
108
+ children: loading ? /*#__PURE__*/_jsx(Box, {
109
+ sx: {
110
+ position: 'absolute',
111
+ top: 0,
112
+ left: 0,
113
+ right: 0,
114
+ bottom: 0,
115
+ zIndex: 99999,
116
+ display: 'flex',
117
+ justifyContent: 'center',
118
+ alignItems: 'center'
119
+ },
120
+ children: /*#__PURE__*/_jsx(CircularProgress, {})
121
+ }) : null
122
+ });
97
123
  };
98
124
  export default FontLoader;
@@ -62,6 +62,7 @@ const FormSettings = props => {
62
62
  MuiAccordion: {
63
63
  styleOverrides: {
64
64
  root: {
65
+ background: theme?.palette?.editor?.miniToolBarBackground,
65
66
  "& .MuiAccordionSummary-root": {
66
67
  flexDirection: "row-reverse",
67
68
  "& .MuiSvgIcon-root": {
@@ -9,17 +9,23 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const SwitchViewport = props => {
10
10
  const {
11
11
  breakpoint,
12
- onChange
12
+ onChange,
13
+ show
13
14
  } = props;
14
15
  const classes = useSwitchViewport();
15
16
  const {
17
+ setSelectedElement,
16
18
  setActiveBreakPoint
17
19
  } = useEditorContext();
18
20
  useEffect(() => {
19
- console.log(breakpoint);
21
+ // to reset selection on viewport changes - FS-6589
22
+ setSelectedElement({});
20
23
  }, [breakpoint]);
21
24
  return /*#__PURE__*/_jsxs(Box, {
22
25
  sx: classes.root,
26
+ style: {
27
+ display: show ? "block" : "none"
28
+ },
23
29
  children: [/*#__PURE__*/_jsx(Tooltip, {
24
30
  title: "Desktop View",
25
31
  children: /*#__PURE__*/_jsx(IconButton, {
@@ -11,6 +11,9 @@ const SectionStyle = (themeReact, theme) => ({
11
11
  "& .sectionIcon": {
12
12
  opacity: 1
13
13
  },
14
+ '& .dividerIcon': {
15
+ opacity: 1
16
+ },
14
17
  "& .sectionPopper": {
15
18
  opacity: 1
16
19
  }
@@ -52,6 +55,18 @@ const SectionStyle = (themeReact, theme) => ({
52
55
  opacity: 1
53
56
  }
54
57
  },
58
+ "& .dividerIcon": {
59
+ opacity: 0,
60
+ padding: "0px",
61
+ background: "transparent",
62
+ border: "none",
63
+ width: "20px",
64
+ height: "20px",
65
+ "& button": {
66
+ boxShadow: "none",
67
+ background: "transparent"
68
+ }
69
+ },
55
70
  "& .ed-section-inner": {
56
71
  [themeReact.breakpoints.between("xs", "md")]: {
57
72
  maxWidth: `320px !important`,
@@ -73,6 +73,11 @@ const BackgroundImage = props => {
73
73
  children: "REMOVE"
74
74
  }) : /*#__PURE__*/_jsx(Grid, {
75
75
  className: "uploadImageText",
76
+ sx: {
77
+ padding: 0,
78
+ background: `${theme?.palette?.editor?.inputFieldBgColor}`,
79
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
80
+ },
76
81
  children: /*#__PURE__*/_jsxs(Button, {
77
82
  component: "label",
78
83
  variant: "text",
@@ -1,6 +1,7 @@
1
1
  import { Box, Card, Checkbox, FormControlLabel, Grid, Tooltip, Typography } from "@mui/material";
2
2
  import React from "react";
3
3
  import Icon from "../../Icon";
4
+ import { useEditorContext } from "../../../hooks/useMouseMove";
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  import { Fragment as _Fragment } from "react/jsx-runtime";
6
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -15,7 +16,10 @@ const RenderCard = ({
15
16
  return /*#__PURE__*/_jsx(Card, {
16
17
  sx: {
17
18
  position: 'relative',
18
- padding: "10px"
19
+ padding: "10px",
20
+ '& .MuiCheckbox-root svg': {
21
+ fill: 'unset !important'
22
+ }
19
23
  },
20
24
  children: /*#__PURE__*/_jsx(FormControlLabel, {
21
25
  control: /*#__PURE__*/_jsx(Checkbox, {
@@ -81,6 +85,9 @@ const CardsMapping = props => {
81
85
  selectedCard,
82
86
  infoIcon
83
87
  } = data;
88
+ const {
89
+ theme
90
+ } = useEditorContext();
84
91
  const activeCard = value === selectedCard;
85
92
  const handleChange = e => {
86
93
  if (selectedCard === data?.value) {
@@ -99,7 +106,8 @@ const CardsMapping = props => {
99
106
  sx: {
100
107
  marginBottom: "12px",
101
108
  "& .MuiPaper-root": {
102
- border: activeCard ? "1px solid #2563EB" : "1px solid #C8D8FA",
109
+ background: theme?.palette?.editor?.miniToolBarBackground,
110
+ border: activeCard ? "1px solid #2563EB" : `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
103
111
  borderRadius: "8px",
104
112
  boxShadow: activeCard ? "0px 4px 16px 0px #2563EB40" : "unset"
105
113
  }
@@ -4,6 +4,7 @@ import { convertBase64 } from "../utils/helper";
4
4
  import { uploadFile } from "../service/fileupload";
5
5
  import Icon from "./Icon";
6
6
  import UploadStyles from "../common/ImageSelector/UploadStyles";
7
+ import { useEditorContext } from "../hooks/useMouseMove";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { Fragment as _Fragment } from "react/jsx-runtime";
9
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -18,6 +19,9 @@ const Uploader = props => {
18
19
  const [base64, setBase64] = useState(value?.url);
19
20
  const [fileName, setFileName] = useState("");
20
21
  const [uploading, setUploading] = useState(false);
22
+ const {
23
+ theme
24
+ } = useEditorContext();
21
25
  const handleChange = async e => {
22
26
  const uFile = e.target.files[0];
23
27
  const strImage = await convertBase64(uFile);
@@ -99,6 +103,10 @@ const Uploader = props => {
99
103
  className: "uploadImageSection",
100
104
  children: base64 ? renderThumb() : /*#__PURE__*/_jsx(Grid, {
101
105
  className: "uploadImageText",
106
+ sx: {
107
+ background: `${theme?.palette?.editor?.inputFieldBgColor}`,
108
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
109
+ },
102
110
  children: /*#__PURE__*/_jsxs(Button, {
103
111
  component: "label",
104
112
  variant: "text",
@@ -49,16 +49,20 @@ const useCommonStyle = theme => ({
49
49
  fontWeight: "500",
50
50
  fontFamily: "Inter, sans-serif"
51
51
  },
52
- "& p": {
53
- marginBottom: "7px",
54
- marginTop: "4px"
55
- },
56
52
  "& .MuiPaper-root": {
57
- border: 'unset !important',
53
+ border: `unset !important`,
58
54
  borderRadius: '0px',
59
55
  height: 'fit-content',
60
56
  padding: '2px'
61
57
  },
58
+ "& p": {
59
+ marginBottom: "7px",
60
+ marginTop: "4px"
61
+ },
62
+ "& p": {
63
+ marginBottom: "7px",
64
+ marginTop: "4px"
65
+ },
62
66
  "& .muiIconsListParent": {
63
67
  "& svg": {
64
68
  color: `${theme?.palette?.editor?.svgTextAlignStrokeColor} !important`
@@ -71,9 +75,6 @@ const useCommonStyle = theme => ({
71
75
  },
72
76
  "&::-webkit-scrollbar-thumb": {
73
77
  background: `${theme?.palette?.editor?.brainPopupScroll} !important`
74
- },
75
- "&::-webkit-scrollbar-track": {
76
- visibility: "hidden"
77
78
  }
78
79
  },
79
80
  "& .MuiGrid-root>.MuiGrid-item": {
@@ -470,10 +471,6 @@ const useCommonStyle = theme => ({
470
471
  }
471
472
  }
472
473
  },
473
- pageSettingPopUpRoot: {
474
- padding: "16px 8px 16px 10px!important",
475
- height: "100%"
476
- },
477
474
  buttonMoreOption: {
478
475
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
479
476
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
@@ -486,6 +483,10 @@ const useCommonStyle = theme => ({
486
483
  }
487
484
  }
488
485
  },
486
+ pageSettingPopUpRoot: {
487
+ padding: "16px 8px 16px 10px!important",
488
+ height: "100%"
489
+ },
489
490
  buttonMoreOption2: {
490
491
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
491
492
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
@@ -90,9 +90,18 @@ const ELEMENT_TAGS = {
90
90
  type: "image",
91
91
  url: el.getAttribute("src")
92
92
  }),
93
- LI: () => ({
94
- type: "list-item"
95
- }),
93
+ LI: el => {
94
+ const checkListItem = el.querySelector(".check-list-item");
95
+ if (checkListItem) {
96
+ return {
97
+ type: "check-list-item",
98
+ checked: checkListItem?.dataset?.checked === "true"
99
+ };
100
+ }
101
+ return {
102
+ type: "list-item"
103
+ };
104
+ },
96
105
  UL: () => ({
97
106
  type: "unorderedList"
98
107
  }),
@@ -109,7 +118,7 @@ const ELEMENT_TAGS = {
109
118
  "GOOGLE-SHEETS-HTML-ORIGIN": paragraphType,
110
119
  TABLE: (el, children = []) => {
111
120
  try {
112
- const bodyChild = children || [];
121
+ const bodyChild = (children || [])?.filter(f => f !== null);
113
122
  const firstRowChildren = bodyChild[0]?.children || [];
114
123
  return {
115
124
  type: "table",
@@ -129,7 +138,11 @@ const ELEMENT_TAGS = {
129
138
  }),
130
139
  TD: handleTableCell,
131
140
  COLGROUP: paragraphType,
132
- COL: paragraphType
141
+ COL: paragraphType,
142
+ HR: () => ({
143
+ type: "divider",
144
+ borderColor: "#CCC"
145
+ })
133
146
  };
134
147
 
135
148
  // COMPAT: `B` is omitted here because Google Docs uses `<b>` in weird ways.
@@ -337,14 +337,14 @@ export const isCarouselSelected = editor => {
337
337
  return false;
338
338
  }
339
339
  const [nodeEntry] = Editor.nodes(editor, {
340
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'carousel'
340
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "carousel"
341
341
  });
342
342
  if (!nodeEntry) {
343
343
  return false;
344
344
  }
345
345
  const [node] = nodeEntry;
346
346
  const carouselDom = ReactEditor.toDOMNode(editor, node);
347
- const isEdit = carouselDom.classList.contains('carousel_slider_edit');
347
+ const isEdit = carouselDom.classList.contains("carousel_slider_edit");
348
348
  return !isEdit;
349
349
  } catch (err) {
350
350
  console.log(err);
@@ -0,0 +1,45 @@
1
+ import MarkdownIt from "markdown-it";
2
+ const md = new MarkdownIt();
3
+ function markdownItCheckbox(md) {
4
+ md.core.ruler.push("checkbox_lists", function (state) {
5
+ const tokens = state.tokens;
6
+ for (let i = 0; i < tokens.length; i++) {
7
+ const token = tokens[i];
8
+ if (token.type === "inline" && token.content) {
9
+ const taskListRegex = /^\s*(-\s*)?\[\s*([xX\s]?)\s*\]\s+(.*)/;
10
+ const match = taskListRegex.exec(token.content);
11
+ if (match) {
12
+ token.attrJoin("class", "check-list-item");
13
+ const isChecked = match[2].toLowerCase() === "x"; // Check if checked
14
+ const content = match[3].trim(); // Extract text after checkbox
15
+
16
+ // Create new tokens for the task list item
17
+ const listItemOpenToken = new state.Token("html_inline", "", 0);
18
+ listItemOpenToken.content = `<li class="check-list-item" data-checked="${isChecked}">`;
19
+ const checkboxToken = new state.Token("html_inline", "", 0);
20
+ checkboxToken.content = `<span class='check-list-item' data-checked="${isChecked}" />`;
21
+ const textToken = new state.Token("text", "", 0);
22
+ textToken.content = content;
23
+ const listItemCloseToken = new state.Token("html_inline", "", 0);
24
+ listItemCloseToken.content = `</li>`;
25
+
26
+ // Replace the original token with the new tokens
27
+ tokens.splice(i, 1, checkboxToken, textToken);
28
+ }
29
+ }
30
+ }
31
+ });
32
+ }
33
+
34
+ // init plugin
35
+ md.use(markdownItCheckbox);
36
+ function convertMDToHTML(data) {
37
+ try {
38
+ const html = md.render(data);
39
+ return html;
40
+ } catch (err) {
41
+ console.log(err);
42
+ return data;
43
+ }
44
+ }
45
+ export default convertMDToHTML;
@@ -1,6 +1,7 @@
1
1
  import { Transforms, Editor, Element, Node, Path } from "slate";
2
2
  import deserialize from "../helper/deserialize";
3
3
  import { decodeAndParseBase64 } from "../utils/helper";
4
+ import convertMDToHTML from "../helper/markdown";
4
5
  const avoidDefaultInsert = ["table", "grid"];
5
6
  const NON_TEXT_TAGS = ["ol", "ul", "img", "table", "video", "a", "button", "GOOGLE-SHEETS-HTML-ORIGIN"];
6
7
  const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree"];
@@ -274,9 +275,15 @@ const withHtml = editor => {
274
275
  Transforms.insertFragment(editor, formattedFragment);
275
276
  return;
276
277
  } else {
277
- insertData(data);
278
+ const html = convertMDToHTML(data.getData("text/plain"));
279
+ let parsed = new DOMParser().parseFromString(html, "text/html");
280
+ parsed = parseCopiedHTML(html);
281
+ const fragment = deserialize(parsed.body);
282
+ Transforms.insertFragment(editor, fragment);
283
+ // insertData(data);
278
284
  }
279
285
  };
286
+
280
287
  return editor;
281
288
  };
282
289
  export default withHtml;
@@ -39,7 +39,7 @@ const withLayout = editor => {
39
39
  const title = {
40
40
  type: "title",
41
41
  children: [{
42
- text: "Untitled"
42
+ text: ""
43
43
  }]
44
44
  };
45
45
  Transforms.insertNodes(editor, title, {
@@ -173,10 +173,9 @@ export const getMarked = (leaf, children, theme) => {
173
173
  if (leaf.highlight) {
174
174
  children = /*#__PURE__*/_jsx("span", {
175
175
  style: {
176
- color: "inherit"
176
+ color: "inherit",
177
+ background: "var(--slate-highlight-bg)"
177
178
  },
178
- className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
179
- ,
180
179
  children: children
181
180
  });
182
181
  }
@@ -302,6 +301,30 @@ export const getBlock = props => {
302
301
  placeholder: "Heading 3",
303
302
  children: children
304
303
  });
304
+ case "headingFour":
305
+ return /*#__PURE__*/_jsx("h4", {
306
+ ...attributes,
307
+ ...element.attr,
308
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
309
+ placeholder: "Heading 4",
310
+ children: children
311
+ });
312
+ case "headingFive":
313
+ return /*#__PURE__*/_jsx("h5", {
314
+ ...attributes,
315
+ ...element.attr,
316
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
317
+ placeholder: "Heading 5",
318
+ children: children
319
+ });
320
+ case "headingSix":
321
+ return /*#__PURE__*/_jsx("h6", {
322
+ ...attributes,
323
+ ...element.attr,
324
+ className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
325
+ placeholder: "Heading 6",
326
+ children: children
327
+ });
305
328
  case "blockquote":
306
329
  return /*#__PURE__*/_jsx("blockquote", {
307
330
  ...attributes,
@@ -589,6 +612,13 @@ export const getBlock = props => {
589
612
  return /*#__PURE__*/_jsx(ColumnView, {
590
613
  ...props
591
614
  });
615
+ case "code":
616
+ return /*#__PURE__*/_jsx("code", {
617
+ ...attributes,
618
+ ...element.attr,
619
+ className: "markcode",
620
+ children: children
621
+ });
592
622
  default:
593
623
  return /*#__PURE__*/_jsx(SimpleText, {
594
624
  ...props,
@@ -20,10 +20,10 @@ export const insertButton = editor => {
20
20
  bottomRight: 30
21
21
  },
22
22
  bannerSpacing: {
23
- left: 16,
24
- top: 8,
25
- right: 16,
26
- bottom: 8
23
+ left: 24,
24
+ top: 10,
25
+ right: 24,
26
+ bottom: 10
27
27
  },
28
28
  ...(windowVar.lastButtonProps || {})
29
29
  };
@@ -82,7 +82,8 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
82
82
  };
83
83
  export const draftToSlate = props => {
84
84
  const {
85
- data
85
+ data,
86
+ needLayout
86
87
  } = props;
87
88
  if (data?.blocks && data?.blocks?.length > 0) {
88
89
  const converted = data?.blocks?.reduce((a, b) => {
@@ -104,7 +105,7 @@ export const draftToSlate = props => {
104
105
  return data;
105
106
  } else {
106
107
  return [{
107
- type: "paragraph",
108
+ type: needLayout ? "title" : "paragraph",
108
109
  children: [{
109
110
  text: ""
110
111
  }]