@codemirror/autocomplete 0.19.8 → 0.19.9
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.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +8 -6
- package/dist/index.js +8 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -484,9 +484,9 @@ class CompletionTooltip {
|
|
|
484
484
|
if (!sel || !this.info)
|
|
485
485
|
return null;
|
|
486
486
|
let rect = this.dom.getBoundingClientRect(), infoRect = this.info.getBoundingClientRect();
|
|
487
|
-
|
|
488
|
-
if (top < 0 || top > this.list.clientHeight - 10)
|
|
487
|
+
if (rect.top > innerHeight - 10 || rect.bottom < 10)
|
|
489
488
|
return null;
|
|
489
|
+
let top = Math.max(0, Math.min(sel.getBoundingClientRect().top, innerHeight - infoRect.height)) - rect.top;
|
|
490
490
|
let left = this.view.textDirection == view.Direction.RTL;
|
|
491
491
|
let spaceLeft = rect.left, spaceRight = innerWidth - rect.right;
|
|
492
492
|
if (left && spaceLeft < Math.min(infoRect.width, spaceRight))
|
|
@@ -496,10 +496,12 @@ class CompletionTooltip {
|
|
|
496
496
|
return { top, left };
|
|
497
497
|
}
|
|
498
498
|
positionInfo(pos) {
|
|
499
|
-
if (this.info
|
|
500
|
-
this.info.style.top = pos.top + "px";
|
|
501
|
-
|
|
502
|
-
|
|
499
|
+
if (this.info) {
|
|
500
|
+
this.info.style.top = (pos ? pos.top : -1e6) + "px";
|
|
501
|
+
if (pos) {
|
|
502
|
+
this.info.classList.toggle("cm-completionInfo-left", pos.left);
|
|
503
|
+
this.info.classList.toggle("cm-completionInfo-right", !pos.left);
|
|
504
|
+
}
|
|
503
505
|
}
|
|
504
506
|
}
|
|
505
507
|
createListBox(options, id, range) {
|
package/dist/index.js
CHANGED
|
@@ -480,9 +480,9 @@ class CompletionTooltip {
|
|
|
480
480
|
if (!sel || !this.info)
|
|
481
481
|
return null;
|
|
482
482
|
let rect = this.dom.getBoundingClientRect(), infoRect = this.info.getBoundingClientRect();
|
|
483
|
-
|
|
484
|
-
if (top < 0 || top > this.list.clientHeight - 10)
|
|
483
|
+
if (rect.top > innerHeight - 10 || rect.bottom < 10)
|
|
485
484
|
return null;
|
|
485
|
+
let top = Math.max(0, Math.min(sel.getBoundingClientRect().top, innerHeight - infoRect.height)) - rect.top;
|
|
486
486
|
let left = this.view.textDirection == Direction.RTL;
|
|
487
487
|
let spaceLeft = rect.left, spaceRight = innerWidth - rect.right;
|
|
488
488
|
if (left && spaceLeft < Math.min(infoRect.width, spaceRight))
|
|
@@ -492,10 +492,12 @@ class CompletionTooltip {
|
|
|
492
492
|
return { top, left };
|
|
493
493
|
}
|
|
494
494
|
positionInfo(pos) {
|
|
495
|
-
if (this.info
|
|
496
|
-
this.info.style.top = pos.top + "px";
|
|
497
|
-
|
|
498
|
-
|
|
495
|
+
if (this.info) {
|
|
496
|
+
this.info.style.top = (pos ? pos.top : -1e6) + "px";
|
|
497
|
+
if (pos) {
|
|
498
|
+
this.info.classList.toggle("cm-completionInfo-left", pos.left);
|
|
499
|
+
this.info.classList.toggle("cm-completionInfo-right", !pos.left);
|
|
500
|
+
}
|
|
499
501
|
}
|
|
500
502
|
}
|
|
501
503
|
createListBox(options, id, range) {
|