Skip to content

Commit 85e00cb

Browse files
committed
Remove doc top offset workaround for checkCursorTag and checkCursorMenu which cause cursors floating around
1 parent 43ad625 commit 85e00cb

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

public/js/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,8 +2279,6 @@ function checkCursorTag(coord, ele) {
22792279
// get coord position
22802280
var left = coord.left;
22812281
var top = coord.top;
2282-
// get doc top offset (to workaround with viewport)
2283-
var docTopOffset = ui.area.codemirrorSizerInner.position().top;
22842282
// set offset
22852283
var offsetLeft = -3;
22862284
var offsetTop = defaultTextHeight;
@@ -2292,7 +2290,7 @@ function checkCursorTag(coord, ele) {
22922290
}
22932291
// flip y when element bottom bound larger than doc height
22942292
// and element top position is larger than element height
2295-
if (top + docTopOffset + height + offsetTop + tagBottomMargin > Math.max(editor.doc.height, editorHeight) && top + docTopOffset > height + tagBottomMargin) {
2293+
if (top + height + offsetTop + tagBottomMargin > Math.max(editor.doc.height, editorHeight) && top > height + tagBottomMargin) {
22962294
offsetTop = -(height);
22972295
}
22982296
}
@@ -2877,8 +2875,6 @@ function checkCursorMenuInner() {
28772875
}, 'windows');
28782876
var left = coord.left;
28792877
var top = coord.top;
2880-
// get doc top offset (to workaround with viewport)
2881-
var docTopOffset = ui.area.codemirrorSizerInner.position().top;
28822878
// set offset
28832879
var offsetLeft = 0;
28842880
var offsetTop = defaultTextHeight;
@@ -2889,7 +2885,7 @@ function checkCursorMenuInner() {
28892885
offsetLeft = -(left + width - docWidth + menuRightMargin);
28902886
// flip y when element bottom bound larger than doc height
28912887
// and element top position is larger than element height
2892-
if (top + docTopOffset + height + offsetTop + menuBottomMargin > Math.max(editor.doc.height, editorHeight) && top + docTopOffset > height + menuBottomMargin) {
2888+
if (top + height + offsetTop + menuBottomMargin > Math.max(editor.doc.height, editorHeight) && top > height + menuBottomMargin) {
28932889
offsetTop = -(height + menuBottomMargin);
28942890
// reverse sort menu because upSideDown
28952891
dropdown.html(reverseSortCursorMenu(dropdown));

0 commit comments

Comments
 (0)