@flozy/editor 4.0.4 → 4.0.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.
@@ -97,13 +97,17 @@ const getNextLine = editor => {
97
97
  return null;
98
98
  }
99
99
  };
100
- const updateAnchorEl = (setAnchorEl, editor) => {
100
+ const updateAnchorEl = (setAnchorEl, editor, openAI) => {
101
101
  try {
102
102
  if (!editor.selection) {
103
103
  return;
104
104
  }
105
105
  const selection = window.getSelection();
106
- if (selection.rangeCount && selection.anchorOffset !== selection.focusOffset) {
106
+ if (openAI === "fromToolBar" && selection.anchorOffset !== selection.focusOffset) {
107
+ // to fix some issue in Drag n Drop
108
+ return;
109
+ }
110
+ if (selection.rangeCount) {
107
111
  let caret;
108
112
  if (getSelectedText(editor)) {
109
113
  // selected text as caret
@@ -175,7 +179,7 @@ function PopoverAIInput({
175
179
  };
176
180
  const editorElement = document.querySelector(".ed-section-inner");
177
181
  useEffect(() => {
178
- updateAnchorEl(setAnchorEl, editor);
182
+ updateAnchorEl(setAnchorEl, editor, openAI);
179
183
  }, [openAI, editor.selection]);
180
184
  useEffect(() => {
181
185
  if (openAI) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"