@flozy/editor 5.4.4 → 5.4.6

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 (47) hide show
  1. package/dist/Editor/Elements/AI/CustomSelect.js +1 -2
  2. package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -3
  3. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +15 -4
  4. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +2 -1
  5. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +2 -1
  6. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +17 -5
  7. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +38 -11
  8. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +55 -15
  9. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +7 -7
  10. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +5 -2
  11. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +4 -2
  12. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +5 -2
  13. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +21 -21
  14. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +7 -4
  15. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +49 -21
  16. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +4 -2
  17. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +4 -2
  18. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +51 -16
  19. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +22 -3
  20. package/dist/Editor/Elements/DataView/Layouts/TableView.js +19 -5
  21. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +5 -0
  22. package/dist/Editor/Elements/DataView/styles.js +10 -3
  23. package/dist/Editor/Elements/Table/Styles.js +7 -0
  24. package/dist/Editor/Elements/Table/Table.js +10 -5
  25. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +5 -2
  26. package/dist/Editor/Toolbar/Mini/Styles.js +5 -0
  27. package/dist/Editor/assets/svg/ArrowDownIcon.js +25 -0
  28. package/dist/Editor/assets/svg/ArrowUpIcon.js +25 -0
  29. package/dist/Editor/assets/svg/CalenderIconTick.js +64 -0
  30. package/dist/Editor/assets/svg/DataTableIcon.js +50 -0
  31. package/dist/Editor/assets/svg/DuplicateIcon.js +23 -0
  32. package/dist/Editor/assets/svg/EyeIcon.js +23 -0
  33. package/dist/Editor/assets/svg/EyeSlash.js +43 -0
  34. package/dist/Editor/assets/svg/HashtagIcon.js +33 -0
  35. package/dist/Editor/assets/svg/PlusIcon.js +23 -0
  36. package/dist/Editor/assets/svg/SelectRoundedIcon.js +24 -0
  37. package/dist/Editor/assets/svg/SortByIcon.js +33 -0
  38. package/dist/Editor/assets/svg/TickOutlined.js +23 -0
  39. package/dist/Editor/assets/svg/TrashCanIcon.js +38 -0
  40. package/dist/Editor/common/Icon.js +30 -4
  41. package/dist/Editor/common/RnD/index.js +2 -2
  42. package/dist/Editor/common/Shorthands/elements.js +1 -1
  43. package/dist/Editor/common/iconListV2.js +47 -79
  44. package/dist/Editor/helper/deserialize/index.js +28 -1
  45. package/dist/Editor/hooks/useBreakpoints.js +1 -1
  46. package/dist/Editor/plugins/withHTML.js +14 -4
  47. package/package.json +1 -1
@@ -1,4 +1,26 @@
1
1
  import { jsx } from "slate-hyperscript";
2
+ const inlineStyles = [{
3
+ key: "bold",
4
+ getStyle: styles => styles.fontWeight === "bold" || parseInt(styles.fontWeight, 10) >= 700
5
+ }, {
6
+ key: "italic",
7
+ getStyle: styles => styles.fontStyle === "italic"
8
+ }, {
9
+ key: "underline",
10
+ getStyle: styles => styles.textDecoration.includes("underline")
11
+ }];
12
+ function getInlineTextStyles(element) {
13
+ if (!element || !element.style) return {};
14
+ const styles = element.style;
15
+ const elementStyles = inlineStyles.reduce((total, currVal) => {
16
+ const style = currVal.getStyle(styles);
17
+ if (style) {
18
+ total[currVal.key] = style;
19
+ }
20
+ return total;
21
+ }, {});
22
+ return elementStyles;
23
+ }
2
24
  const handleTableCell = (el, children) => {
3
25
  const wrapChild = children?.map(c => {
4
26
  if (typeof c === "string") {
@@ -21,6 +43,8 @@ const handleTableCell = (el, children) => {
21
43
  };
22
44
  };
23
45
  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"];
46
+
47
+ // to avoid nested paragraph to resolve performace issue
24
48
  const paragraphType = el => {
25
49
  const {
26
50
  childNodes = []
@@ -138,7 +162,10 @@ const deserialize = el => {
138
162
  if (el.nodeType === 3) {
139
163
  const match = /\r|\n/.exec(el.textContent);
140
164
  const text = el.textContent.replace(/\r|\n/g, "").trim();
141
- return match && !text ? null : el.textContent;
165
+ return match && !text ? null : {
166
+ text: el.textContent,
167
+ ...getInlineTextStyles(el.parentNode)
168
+ };
142
169
  } else if (el.nodeType !== 1) {
143
170
  return null;
144
171
  } else if (el.nodeName === "BR") {
@@ -1,6 +1,6 @@
1
1
  import { useMediaQuery } from "@mui/material";
2
2
  export const STIMULATOR_MOCK = {
3
- xs: "@media (min-width: 1200px) and (max-width: 1980px)"
3
+ xs: "@media (min-width: 1200px) and (max-width: 10000px)"
4
4
  };
5
5
  export const isStimulator = () => {
6
6
  try {
@@ -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.6",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"