We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c37dcb8 commit d497922Copy full SHA for d497922
1 file changed
addon/editor.js
@@ -296,7 +296,13 @@ export class Editor extends React.Component {
296
let caretEle = model.editorMirror.getElementsByClassName("editor_caret")[0];
297
if (caretEle) {
298
const rect = caretEle.getBoundingClientRect();
299
- model.setSuggestionPosition(rect.top + rect.height, rect.left);
+ const textareaRect = model.editor.getBoundingClientRect();
300
+ let suggestionLeft = rect.left;
301
+ // If caret's right edge is too close to the left of textarea, position suggestion to the left of caret
302
+ if (rect.left + 200 > textareaRect.right) {
303
+ suggestionLeft = textareaRect.right - 200;
304
+ }
305
+ model.setSuggestionPosition(rect.top + rect.height, suggestionLeft);
306
} else {
307
model.displaySuggestion = false;
308
}
0 commit comments