@flozy/editor 5.4.4 → 5.4.5

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.
@@ -11,11 +11,10 @@ function CustomSelect({
11
11
  show,
12
12
  btnProps = {}
13
13
  }) {
14
- const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
15
14
  if (show) {
16
15
  return /*#__PURE__*/_jsx(Box, {
17
16
  component: "div",
18
- sx: !isMobile && classes.customSelectContainer,
17
+ sx: classes.customSelectContainer,
19
18
  className: "customSelectContainer",
20
19
  children: options?.map((groupOption, index) => {
21
20
  const {
@@ -85,6 +85,13 @@ const TableStyles = theme => {
85
85
  "&:hover": {
86
86
  background: "#2563EB"
87
87
  }
88
+ },
89
+ mobileToolDrawer: {
90
+ "& .customSelectContainer": {
91
+ border: "none !important",
92
+ padding: "0px !important",
93
+ boxShadow: "none !important"
94
+ }
88
95
  }
89
96
  };
90
97
  };
@@ -47,7 +47,8 @@ const MoreTableSettings = props => {
47
47
  exandTools,
48
48
  handleAction,
49
49
  editorTheme,
50
- setExpandTools
50
+ setExpandTools,
51
+ classes
51
52
  } = props;
52
53
  const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
53
54
  return isMobile ? /*#__PURE__*/_jsx(SwipeableDrawerComponent, {
@@ -56,9 +57,12 @@ const MoreTableSettings = props => {
56
57
  setExpandTools(false);
57
58
  },
58
59
  swipeableDrawer: false,
59
- children: /*#__PURE__*/_jsx(ToolTableComponent, {
60
- handleAction: handleAction,
61
- editorTheme: editorTheme
60
+ children: /*#__PURE__*/_jsx(Box, {
61
+ sx: classes.mobileToolDrawer,
62
+ children: /*#__PURE__*/_jsx(ToolTableComponent, {
63
+ handleAction: handleAction,
64
+ editorTheme: editorTheme
65
+ })
62
66
  })
63
67
  }) : /*#__PURE__*/_jsx(Popper, {
64
68
  open: Boolean(exandTools),
@@ -321,7 +325,8 @@ const Table = props => {
321
325
  exandTools: exandTools,
322
326
  handleAction: handleAction,
323
327
  editorTheme: editorTheme,
324
- setExpandTools: setExpandTools
328
+ setExpandTools: setExpandTools,
329
+ classes: classes
325
330
  }), openSetttings ? /*#__PURE__*/_jsx(TablePopup, {
326
331
  element: tableProps?.styleProps || {},
327
332
  onSave: onSave,
@@ -21,6 +21,8 @@ const handleTableCell = (el, children) => {
21
21
  };
22
22
  };
23
23
  const INLINE_TAGS = ["A", "ABBR", "B", "BDO", "CITE", "CODE", "DATA", "DEL", "DFN", "IMG", "INS", "KBD", "LABEL", "MARK", "Q", "SAMP", "SMALL", "SPAN", "SUB", "SUP", "TIME", "VAR"];
24
+
25
+ // to avoid nested paragraph to resolve performace issue
24
26
  const paragraphType = el => {
25
27
  const {
26
28
  childNodes = []
@@ -28,7 +28,7 @@ const getCurrentElement = editor => {
28
28
  return null;
29
29
  }
30
30
  };
31
- const getCurrentElementText = editor => {
31
+ export const getCurrentElementText = editor => {
32
32
  try {
33
33
  if (editor.selection) {
34
34
  return Editor.string(editor, editor?.selection?.anchor?.path);
@@ -186,7 +186,7 @@ const withHtml = editor => {
186
186
  return;
187
187
  }
188
188
  const currentText = getCurrentElementText(editor);
189
- if (currentText && !isTextNode) {
189
+ if (currentText?.trim() && !isTextNode) {
190
190
  insertAtNextNode(editor, decoded);
191
191
  return;
192
192
  }
@@ -194,7 +194,17 @@ const withHtml = editor => {
194
194
  }
195
195
  } else if (html) {
196
196
  const parsed = new DOMParser().parseFromString(html, "text/html");
197
- const rootElement = parsed.body || parsed.documentElement;
197
+
198
+ // if ol, ul are inside li, remove and push ol,ul after that li to maintain format between our slate list and external source list's json
199
+ parsed.querySelectorAll("li > ul, li > ol").forEach(list => {
200
+ // Find the parent li
201
+ const parentLi = list.parentElement;
202
+
203
+ // Move the list after the parent li
204
+ parentLi.after(list);
205
+ });
206
+ const rootElement = parsed.body;
207
+ console.log("rootElement", rootElement);
198
208
  const isNonText = rootElement ? rootElement?.querySelector(NON_TEXT_TAGS.toString()) : false;
199
209
  const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
200
210
  if (isGoogleSheet) {
@@ -230,7 +240,7 @@ const withHtml = editor => {
230
240
  return;
231
241
  }
232
242
  const currentText = getCurrentElementText(editor);
233
- if (currentText && isNonText) {
243
+ if (currentText?.trim() && isNonText) {
234
244
  insertAtNextNode(editor, formattedFragment);
235
245
  return;
236
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.4.4",
3
+ "version": "5.4.5",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"