@flozy/editor 3.6.8 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -146,21 +146,19 @@ function AppHeader(props) {
146
146
  src: appLogo
147
147
  }) : appTitle
148
148
  }), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(List, {
149
- children: menus.map((item, i) => {
150
- const buttonProps = handleLinkType(item.url, item.linkType, true, item.target === "_blank");
151
- return /*#__PURE__*/_jsx(ListItem, {
152
- disablePadding: true,
153
- children: /*#__PURE__*/_jsx(ListItemButton, {
154
- ...buttonProps,
155
- sx: {
156
- textAlign: "center"
157
- },
158
- children: /*#__PURE__*/_jsx(ListItemText, {
159
- primary: item.text
160
- })
149
+ children: menus.map((item, i) => /*#__PURE__*/_jsx(ListItem, {
150
+ disablePadding: true,
151
+ children: /*#__PURE__*/_jsx(ListItemButton, {
152
+ component: "a",
153
+ href: item.url,
154
+ sx: {
155
+ textAlign: "center"
156
+ },
157
+ children: /*#__PURE__*/_jsx(ListItemText, {
158
+ primary: item.text
161
159
  })
162
- }, `${item.text}_${i}`);
163
- })
160
+ })
161
+ }, `${item.text}_${i}`))
164
162
  })]
165
163
  });
166
164
  const container = window !== undefined ? () => window().document.body : undefined;
@@ -2,8 +2,7 @@ import React, { useState } from "react";
2
2
  import { Transforms } from "slate";
3
3
  import { ReactEditor, useSlateStatic } from "slate-react";
4
4
  import { IconButton, Tooltip, Box } from "@mui/material";
5
- // import * as fIcons from "@mui/icons-material";
6
- import MUIIcon from "../../common/StyleBuilder/fieldTypes/loadIcon";
5
+ import * as fIcons from "@mui/icons-material";
7
6
  import SettingsIcon from "@mui/icons-material/Settings";
8
7
  import OpenInNewIcon from "@mui/icons-material/OpenInNew";
9
8
  import LinkIcon from "@mui/icons-material/Link";
@@ -64,7 +63,7 @@ const EditorButton = props => {
64
63
  };
65
64
  const isTrigger = linkType === "actionTrigger";
66
65
  const refURl = isTrigger ? buttonLink?.url : url;
67
- const BtnIcon = buttonIcon ? buttonIcon : null;
66
+ const BtnIcon = buttonIcon ? fIcons[buttonIcon] : null;
68
67
  windowVar.lastButtonProps = element;
69
68
  const handleTrigger = async () => {
70
69
  if (metadata?.buttonLink?.handler) {
@@ -81,7 +80,6 @@ const EditorButton = props => {
81
80
  }
82
81
  };
83
82
  const buttonProps = handleLinkType(refURl, linkType, readOnly, openInNewTab, handleTrigger);
84
- console.log(openInNewTab);
85
83
  const onMenuClick = val => () => {
86
84
  switch (val) {
87
85
  case "edit":
@@ -133,7 +131,6 @@ const EditorButton = props => {
133
131
  color: "rgba(0, 0, 0, 0.54)"
134
132
  },
135
133
  ...btnProps,
136
- target: openInNewTab ? "_blank" : "_self",
137
134
  children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
138
135
  })
139
136
  })]
@@ -215,14 +212,12 @@ const EditorButton = props => {
215
212
  }
216
213
  },
217
214
  ...buttonProps,
218
- children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(MUIIcon, {
219
- iconName: buttonIcon,
215
+ children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(BtnIcon, {
220
216
  style: {
221
217
  paddingLeft: "4px",
222
218
  paddingRight: "4px"
223
219
  }
224
- }), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(MUIIcon, {
225
- iconName: buttonIcon,
220
+ }), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(BtnIcon, {
226
221
  style: {
227
222
  paddingLeft: "4px",
228
223
  paddingRight: "4px"
@@ -1,10 +1,10 @@
1
1
  import React, { useState } from "react";
2
2
  import { Transforms } from "slate";
3
3
  import { useSlateStatic, ReactEditor } from "slate-react";
4
+ import * as fIcons from "@mui/icons-material";
4
5
  import { Box } from "@mui/material";
5
6
  import ChipTextPopup from "./ChipTextPopup";
6
7
  import { getTRBLBreakPoints, getBreakPointsValue } from "../../helper/theme";
7
- import MUIIcon from "../../common/StyleBuilder/fieldTypes/loadIcon";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
10
  const ChipText = props => {
@@ -26,6 +26,7 @@ const ChipText = props => {
26
26
  buttonIcon,
27
27
  textSize
28
28
  } = element;
29
+ const BtnIcon = buttonIcon ? fIcons[buttonIcon] : fIcons["Check"];
29
30
  const [openSetttings, setOpenSettings] = useState(false);
30
31
  const editor = useSlateStatic();
31
32
  const path = ReactEditor.findPath(editor, element);
@@ -81,8 +82,7 @@ const ChipText = props => {
81
82
  background: bgColor || "#CCC",
82
83
  color: textColor
83
84
  },
84
- children: [/*#__PURE__*/_jsx(MUIIcon, {
85
- iconName: buttonIcon || "Check",
85
+ children: [/*#__PURE__*/_jsx(BtnIcon, {
86
86
  style: {
87
87
  fontSize: textSize || "16px",
88
88
  lineHeight: textSize || "16px",
@@ -2,10 +2,10 @@ import React, { useState, forwardRef, useImperativeHandle } from "react";
2
2
  import { useSlateStatic, ReactEditor } from "slate-react";
3
3
  import { Paper, Popover } from "@mui/material";
4
4
  import data from "@emoji-mart/data";
5
+ import Picker from "@emoji-mart/react";
5
6
  import { insertEmoji } from "../../utils/emoji";
6
7
  import ToolbarIcon from "../../common/ToolbarIcon";
7
8
  import Icon from "../../common/Icon";
8
- import EmojiPicker from "./EmojiPicker";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -61,7 +61,7 @@ const EmojiButton = /*#__PURE__*/forwardRef((props, ref) => {
61
61
  },
62
62
  onClose: handleClose,
63
63
  children: /*#__PURE__*/_jsx(Paper, {
64
- children: /*#__PURE__*/_jsx(EmojiPicker, {
64
+ children: /*#__PURE__*/_jsx(Picker, {
65
65
  data: data,
66
66
  onEmojiSelect: onEmojiSelect
67
67
  })
@@ -1,16 +0,0 @@
1
- import data from "@emoji-mart/data";
2
- import Picker from "@emoji-mart/react";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { Fragment as _Fragment } from "react/jsx-runtime";
5
- const EmojiPicker = props => {
6
- const {
7
- onEmojiSelect
8
- } = props;
9
- return /*#__PURE__*/_jsx(_Fragment, {
10
- children: /*#__PURE__*/_jsx(Picker, {
11
- data: data,
12
- onEmojiSelect: onEmojiSelect
13
- })
14
- });
15
- };
16
- export default EmojiPicker;
@@ -277,7 +277,7 @@ const Grid = props => {
277
277
  } = getBreakPointsValue(borderRadius, size?.device) || {};
278
278
  return /*#__PURE__*/_jsxs(GridContainer, {
279
279
  container: true,
280
- className: `grid-container ${grid} has-hover element-root dpath`,
280
+ className: `grid-container ${grid} has-hover element-root`,
281
281
  ...attributes,
282
282
  ...sectionId,
283
283
  sx: {
@@ -105,7 +105,7 @@ const GridItem = props => {
105
105
  return /*#__PURE__*/_jsxs(Item, {
106
106
  item: true,
107
107
  component: "div",
108
- className: `grid-item element-root gi-top-wrpr dpath`,
108
+ className: `grid-item element-root gi-top-wrpr`,
109
109
  ...attributes,
110
110
  sx: {
111
111
  width: {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
+ import * as fIcons from "@mui/icons-material";
2
3
  import { Box } from "@mui/material";
3
- import Check from "@mui/icons-material/Check";
4
4
  import { getBreakPointsValue } from "../../helper/theme";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -23,6 +23,7 @@ const InlineIcon = props => {
23
23
  right,
24
24
  bottom
25
25
  } = bannerSpacing || {};
26
+ const BtnIcon = fIcons["Check"];
26
27
  return /*#__PURE__*/_jsxs(Box, {
27
28
  ...attributes,
28
29
  className: "editor-icon-text",
@@ -41,7 +42,7 @@ const InlineIcon = props => {
41
42
  background: bgColor || "#CCC",
42
43
  color: textColor
43
44
  },
44
- children: [/*#__PURE__*/_jsx(Check, {}), /*#__PURE__*/_jsx("div", {
45
+ children: [/*#__PURE__*/_jsx(BtnIcon, {}), /*#__PURE__*/_jsx("div", {
45
46
  contentEditable: true,
46
47
  children: children
47
48
  })]
@@ -11,9 +11,7 @@ const CheckList = ({
11
11
  attributes,
12
12
  children,
13
13
  element,
14
- isEmpty,
15
- className,
16
- style
14
+ isEmpty
17
15
  }) => {
18
16
  const editor = useSlateStatic();
19
17
  const readOnly = useReadOnly();
@@ -32,14 +30,12 @@ const CheckList = ({
32
30
  const nestedCheckList = element?.children?.length && element.children[0].type === "check-list-item";
33
31
  return /*#__PURE__*/_jsx(_Fragment, {
34
32
  children: /*#__PURE__*/_jsxs("div", {
35
- className: className || "",
36
33
  ...attributes,
37
34
  style: {
38
35
  textAlign: element.alignment || "left",
39
36
  display: "flex",
40
37
  justifyContent: "center",
41
- alignItems: "center",
42
- ...(style || {})
38
+ alignItems: "center"
43
39
  },
44
40
  children: [/*#__PURE__*/_jsxs("div", {
45
41
  contentEditable: false,
@@ -188,7 +188,6 @@ const editorStyles = ({
188
188
  }
189
189
  },
190
190
  "& .checkbox-edit": {
191
- alignSelf: "flex-start",
192
191
  "& .MuiFormControlLabel-root": {
193
192
  marginRight: "0px"
194
193
  },
@@ -213,7 +212,7 @@ const editorStyles = ({
213
212
  "& svg": {
214
213
  width: "17px",
215
214
  height: "18px",
216
- marginTop: "-1px"
215
+ marginTop: '-1px'
217
216
  }
218
217
  }
219
218
  },
@@ -274,7 +273,7 @@ const editorStyles = ({
274
273
  },
275
274
  cardsTypo: {
276
275
  color: theme?.palette?.editor?.textColor,
277
- fontSize: "14px !important"
276
+ fontSize: '14px !important'
278
277
  }
279
278
  });
280
279
  export default editorStyles;
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { Popper, Fade, Paper } from "@mui/material";
2
+ import { Popper, Fade, Paper, ClickAwayListener } from "@mui/material";
3
3
  import { Editor, Range } from "slate";
4
4
  import { useSlate, useFocused } from "slate-react";
5
5
  import useDrag from "../../hooks/useDrag";
@@ -9,7 +9,6 @@ import MiniTextFormat from "./MiniTextFormat";
9
9
  import { useEditorContext } from "../../hooks/useMouseMove";
10
10
  import usePopupStyles from "../PopupTool/PopupToolStyle";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
- import { Fragment as _Fragment } from "react/jsx-runtime";
13
12
  const PopupTool = props => {
14
13
  const {
15
14
  theme,
@@ -32,11 +31,6 @@ const PopupTool = props => {
32
31
  const id = open ? "popup-edit-tool" : "";
33
32
  const table = new TableUtil(editor);
34
33
  const [size] = useWindowResize();
35
- useEffect(() => {
36
- if (!inFocus) {
37
- setAnchorEl(null);
38
- }
39
- }, [inFocus]);
40
34
  useEffect(() => {
41
35
  if (event === "end" && anchorEl && !open) {
42
36
  // for table cell selection
@@ -84,7 +78,14 @@ const PopupTool = props => {
84
78
  setOpen(false);
85
79
  setPopupType("");
86
80
  };
87
- return open && !openAI ? /*#__PURE__*/_jsx(_Fragment, {
81
+ return open && !openAI ? /*#__PURE__*/_jsx(ClickAwayListener, {
82
+ onClickAway: e => {
83
+ // close the mini toolbar, if user clicks outside the editor (in Flozy app.)
84
+ if (e.target !== document.body) {
85
+ // e.target returns body, if the user clicks material ui select popup inside the tool bar, on that time, we don't need to close
86
+ handleClose();
87
+ }
88
+ },
88
89
  children: size.device === "xs" ? /*#__PURE__*/_jsx("div", {
89
90
  className: "mobileMiniTextWrapper",
90
91
  children: /*#__PURE__*/_jsx(MiniTextFormat, {
@@ -1,24 +1,8 @@
1
1
  import { Autocomplete, Checkbox, FormControlLabel, MenuItem, Select, TextField, Typography, createFilterOptions } from "@mui/material";
2
2
  import { useEffect, useMemo, useState } from "react";
3
- import { useSlate } from "slate-react";
4
3
  import { jsx as _jsx } from "react/jsx-runtime";
5
4
  import { Fragment as _Fragment } from "react/jsx-runtime";
6
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
- const sectionTypes = ["grid"];
8
- const loopChildren = (children = [], sections) => {
9
- if (!children?.length) {
10
- return sections;
11
- }
12
- for (let child of children) {
13
- if (sectionTypes.includes(child?.type)) {
14
- if (child.id) {
15
- sections.push(child.id);
16
- }
17
- }
18
- sections = loopChildren(child.children, sections);
19
- }
20
- return sections;
21
- };
22
6
  const OpenInNewTab = props => {
23
7
  const {
24
8
  nav,
@@ -58,35 +42,21 @@ export const SelectPage = props => {
58
42
  services
59
43
  } = props;
60
44
  const [pages, setPages] = useState([]);
61
- const editor = useSlate();
62
45
  const getPages = async () => {
63
46
  const result = await services("getPages", {});
64
- if (result?.data?.length) {
65
- const refactor = result?.data?.map(r => {
66
- const {
67
- title,
68
- url_name,
69
- ...rest
70
- } = r;
71
- return {
72
- label: url_name,
73
- value: url_name,
74
- ...rest
75
- };
76
- });
77
- setPages(refactor);
78
- } else {
79
- const currentPage = {
80
- label: "Current Page",
81
- value: "_currentPage",
82
- is_current_page: 1,
83
- sections: loopChildren(editor.children, [])
47
+ const refactor = result?.data?.map(r => {
48
+ const {
49
+ title,
50
+ url_name,
51
+ ...rest
52
+ } = r;
53
+ return {
54
+ label: url_name,
55
+ value: url_name,
56
+ ...rest
84
57
  };
85
- setPages([currentPage]);
86
- if (!value) {
87
- onChange(currentPage.value);
88
- }
89
- }
58
+ });
59
+ setPages(refactor);
90
60
  };
91
61
  useEffect(() => {
92
62
  getPages();
@@ -106,14 +76,12 @@ export const SelectPage = props => {
106
76
  }
107
77
  return [];
108
78
  }, [value, pages]);
109
- const isCurrentPage = page?.value === "_currentPage";
110
79
  return /*#__PURE__*/_jsxs("div", {
111
80
  children: [/*#__PURE__*/_jsx(FreeSoloCreateOption, {
112
81
  label: page?.label,
113
- setValue: val => onChange(val?.value || ""),
82
+ setValue: val => onChange(val?.value),
114
83
  placeholder: "Select Page",
115
- options: pages,
116
- disabled: isCurrentPage
84
+ options: pages
117
85
  }), /*#__PURE__*/_jsx(FreeSoloCreateOption, {
118
86
  label: section?.label,
119
87
  setValue: val => {
@@ -128,7 +96,7 @@ export const SelectPage = props => {
128
96
  label: p,
129
97
  value: p
130
98
  }))
131
- }), isCurrentPage ? null : /*#__PURE__*/_jsx(OpenInNewTab, {
99
+ }), /*#__PURE__*/_jsx(OpenInNewTab, {
132
100
  ...props
133
101
  })]
134
102
  });
@@ -181,8 +149,7 @@ export function FreeSoloCreateOption({
181
149
  label,
182
150
  setValue,
183
151
  options = [],
184
- placeholder = "",
185
- disabled = false
152
+ placeholder = ""
186
153
  }) {
187
154
  return /*#__PURE__*/_jsx(Autocomplete, {
188
155
  freeSolo: true,
@@ -197,7 +164,7 @@ export function FreeSoloCreateOption({
197
164
  children: option.label
198
165
  }),
199
166
  onChange: (event, newValue) => {
200
- if (typeof newValue === "string") {
167
+ if (typeof newValue === 'string') {
201
168
  setValue({
202
169
  value: newValue
203
170
  });
@@ -222,7 +189,7 @@ export function FreeSoloCreateOption({
222
189
  } = params;
223
190
  // Suggest the creation of a new value
224
191
  const isExisting = options.some(option => inputValue === option.label);
225
- if (inputValue !== "" && !isExisting) {
192
+ if (inputValue !== '' && !isExisting) {
226
193
  filtered.push({
227
194
  inputValue,
228
195
  label: `Add "${inputValue}"`
@@ -235,7 +202,7 @@ export function FreeSoloCreateOption({
235
202
  handleHomeEndKeys: true,
236
203
  getOptionLabel: option => {
237
204
  // Value selected with enter, right from the input
238
- if (typeof option === "string") {
205
+ if (typeof option === 'string') {
239
206
  return option;
240
207
  }
241
208
  // Add "xxx" option created dynamically
@@ -247,7 +214,6 @@ export function FreeSoloCreateOption({
247
214
  },
248
215
  sx: {
249
216
  marginTop: "10px"
250
- },
251
- disabled: disabled
217
+ }
252
218
  });
253
219
  }
@@ -13,8 +13,7 @@ const MentionsListCard = props => {
13
13
  } = props;
14
14
  const {
15
15
  name,
16
- email,
17
- avatar_filename = null
16
+ email
18
17
  } = data;
19
18
  return /*#__PURE__*/_jsxs(Card, {
20
19
  sx: {
@@ -38,9 +37,7 @@ const MentionsListCard = props => {
38
37
  alignItems: "center"
39
38
  },
40
39
  alt: name,
41
- children: /*#__PURE__*/_jsx(Avatar, {
42
- src: avatar_filename
43
- })
40
+ children: /*#__PURE__*/_jsx(Avatar, {})
44
41
  }), /*#__PURE__*/_jsx(Box, {
45
42
  sx: {
46
43
  display: "flex",
@@ -10,7 +10,7 @@ const usePopupStyles = theme => ({
10
10
  papper: {
11
11
  boxShadow: "none",
12
12
  width: "300px",
13
- height: "auto",
13
+ height: "300px",
14
14
  overflow: "auto",
15
15
  padding: "8px",
16
16
  margin: "0px",
@@ -1,10 +1,29 @@
1
1
  import React, { useState } from "react";
2
2
  import { Grid, IconButton, TextField, Tooltip } from "@mui/material";
3
- import MUIIcon from "./loadIcon";
4
- import MUIFilledIcons from "./mui_filled_icons";
3
+ import * as fIcons from "@mui/icons-material";
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
6
  import { Fragment as _Fragment } from "react/jsx-runtime";
7
+ const MUIIcons = Object.keys(fIcons).reduce((a, b) => {
8
+ if (b.indexOf("Outlined") > -1) {
9
+ a.outlined.push(b);
10
+ } else if (b.indexOf("Rounded") > -1) {
11
+ a.rounded.push(b);
12
+ } else if (b.indexOf("Sharp") > -1) {
13
+ a.sharp.push(b);
14
+ } else if (b.indexOf("TwoTone") > -1) {
15
+ a.tt.push(b);
16
+ } else {
17
+ a.filled.push(b);
18
+ }
19
+ return a;
20
+ }, {
21
+ filled: [],
22
+ outlined: [],
23
+ rounded: [],
24
+ tt: [],
25
+ sharp: []
26
+ });
8
27
  const Icons = props => {
9
28
  const {
10
29
  value,
@@ -15,7 +34,7 @@ const Icons = props => {
15
34
  key
16
35
  } = data;
17
36
  const [val, setVal] = useState("");
18
- const [list, setList] = useState(MUIFilledIcons.slice(0, 90));
37
+ const [list, setList] = useState(MUIIcons.filled.slice(0, 90));
19
38
  const onSelectIcon = ico => () => {
20
39
  onChange({
21
40
  [key]: ico
@@ -25,11 +44,11 @@ const Icons = props => {
25
44
  const keyVal = e.target.value?.toLowerCase();
26
45
  setVal(keyVal);
27
46
  if (keyVal) {
28
- setList(MUIFilledIcons.filter(f => {
47
+ setList(MUIIcons.filled.filter(f => {
29
48
  return f.toLowerCase().indexOf(keyVal) > -1;
30
49
  }).slice(0, 90));
31
50
  } else {
32
- setList(MUIFilledIcons.slice(0, 90));
51
+ setList(MUIIcons.filled.slice(0, 90));
33
52
  }
34
53
  };
35
54
  const onRemoveIcon = () => {
@@ -37,7 +56,7 @@ const Icons = props => {
37
56
  [key]: null
38
57
  });
39
58
  };
40
- const SelectedIcon = value ? value : null;
59
+ const SelectedIcon = value ? fIcons[value] : null;
41
60
  return /*#__PURE__*/_jsxs(_Fragment, {
42
61
  children: [/*#__PURE__*/_jsx(Grid, {
43
62
  item: true,
@@ -73,9 +92,7 @@ const Icons = props => {
73
92
  arrow: true,
74
93
  children: /*#__PURE__*/_jsx(IconButton, {
75
94
  onClick: onRemoveIcon,
76
- children: /*#__PURE__*/_jsx(MUIIcon, {
77
- iconName: value
78
- })
95
+ children: /*#__PURE__*/_jsx(SelectedIcon, {})
79
96
  })
80
97
  }) : ""
81
98
  })]
@@ -90,14 +107,13 @@ const Icons = props => {
90
107
  paddingTop: "5px"
91
108
  },
92
109
  children: list.map(m => {
110
+ const Ico = fIcons[m];
93
111
  return /*#__PURE__*/_jsx(Tooltip, {
94
112
  title: m,
95
113
  arrow: true,
96
114
  children: /*#__PURE__*/_jsx(IconButton, {
97
115
  onClick: onSelectIcon(m),
98
- children: /*#__PURE__*/_jsx(MUIIcon, {
99
- iconName: m
100
- })
116
+ children: /*#__PURE__*/_jsx(Ico, {})
101
117
  })
102
118
  }, `mui_ico_${m}`);
103
119
  })
@@ -139,19 +139,4 @@ export const isEmptyTextNode = element => {
139
139
  console.log(err);
140
140
  return false;
141
141
  }
142
- };
143
- export const debounce = function (func, wait, immediate) {
144
- let timeout;
145
- return function () {
146
- const context = this,
147
- args = arguments,
148
- later = function () {
149
- timeout = null;
150
- if (!immediate) func.apply(context, args);
151
- },
152
- callNow = immediate && !timeout;
153
- clearTimeout(timeout);
154
- timeout = setTimeout(later, wait);
155
- if (callNow) func.apply(context, args);
156
- };
157
142
  };
@@ -1,6 +1,5 @@
1
1
  import { useEffect, useState, createContext, useContext, useMemo } from "react";
2
2
  import { getSelectedText } from "../utils/helper";
3
- import { debounce } from "../helper";
4
3
  import { jsx as _jsx } from "react/jsx-runtime";
5
4
  const EditorContext = /*#__PURE__*/createContext();
6
5
  export const useEditorSelection = editor => {
@@ -74,21 +73,15 @@ const useMouseMove = () => {
74
73
  };
75
74
  }, []);
76
75
  const onMouseMove = e => {
77
- const dpath = e?.target?.closest(".dpath");
78
- console.log(dpath);
79
- if (dpath) {
80
- console.log(`Stopped position: (${e.clientX}, ${e.clientY})`, dpath);
81
- setEvent({
82
- target: dpath
83
- });
84
- }
76
+ setEvent({
77
+ target: e.target
78
+ });
85
79
  };
86
- const debounceMouseMove = debounce(onMouseMove, 100);
87
80
  const addListener = () => {
88
- document.addEventListener("mousemove", debounceMouseMove);
81
+ document.addEventListener("mousemove", onMouseMove);
89
82
  };
90
83
  const removeListener = () => {
91
- document.removeEventListener("mousemove", debounceMouseMove);
84
+ document.removeEventListener("mousemove", onMouseMove);
92
85
  };
93
86
  return [event];
94
87
  };