@flozy/editor 7.0.4 → 7.0.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.
@@ -41,6 +41,7 @@ const PopupTool = props => {
41
41
  selection
42
42
  } = editor;
43
43
  const isHavingSelection = selection && !Range.isCollapsed(selection);
44
+ console.log("Editor isHavingSelection", isHavingSelection, selection);
44
45
  if (isHavingSelection) {
45
46
  const domRange = ReactEditor.toDOMRange(editor, editor.selection);
46
47
  const editorContainer = document.querySelector("#slate-wrapper-scroll-container")?.getBoundingClientRect();
@@ -50,6 +51,7 @@ const PopupTool = props => {
50
51
  rect.y = -500; // hide the popper
51
52
  }
52
53
 
54
+ console.log("Editor setAnchorEl", rect, domRange, editorContainer);
53
55
  setAnchorEl({
54
56
  clientWidth: rect.width,
55
57
  clientHeight: rect.height,
@@ -83,13 +85,15 @@ const PopupTool = props => {
83
85
  }
84
86
  }, [event, anchorEl]);
85
87
  useEffect(() => {
88
+ console.log("Editor useEffect", selection);
86
89
  if (!selection || Range.isCollapsed(selection) || Editor.string(editor, selection) === "") {
87
90
  setAnchorEl(null);
88
91
  } else {
92
+ console.log("Editor updateAnchorEl", selection);
89
93
  updateAnchorEl();
90
94
  hideSlateSelection(); // removes slate selection background, when there is no selection
91
95
  }
92
- }, [selection]);
96
+ }, [editor?.selection]);
93
97
  useEffect(() => {
94
98
  const {
95
99
  path,
@@ -97,16 +101,19 @@ const PopupTool = props => {
97
101
  } = selectedElement || {};
98
102
  const isFreeGridElement = path && path.split("|").length > 2;
99
103
  if (enable === 1 && isFreeGridElement) {
104
+ console.log("Editor useEffect isFreeGridElement", selectedElement);
100
105
  setAnchorEl(null);
101
106
  }
102
107
  }, [selection, selectedElement?.path, selectedElement?.enable]);
103
108
  const handleClose = () => {
109
+ console.log("Editor closing");
104
110
  // setAnchorEl(null);
105
111
  setOpen(false);
106
112
  setPopupType("");
107
113
  };
108
114
  return open && !openAI ? /*#__PURE__*/_jsx(ClickAwayListener, {
109
115
  onClickAway: e => {
116
+ console.log("ClickAwayListener", e.target, document.body, e.target !== document.body);
110
117
  // close the mini toolbar, if user clicks outside the editor (in Flozy app.)
111
118
  if (e.target !== document.body) {
112
119
  // 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "7.0.4",
3
+ "version": "7.0.6",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"