@flozy/editor 4.0.4 → 4.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -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 (
|
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) {
|