Notebooks: Fix callout dialog being cut off at the bottom of the document (#14579)

* add above position for callout dialog

* use if else
This commit is contained in:
Lucy Zhang
2021-03-05 15:23:44 -08:00
committed by GitHub
parent 733c3628a1
commit f125b9b2c7
7 changed files with 31 additions and 13 deletions

View File

@@ -278,11 +278,12 @@ export class MarkdownToolbarComponent extends AngularDisposable {
const triggerHeight = triggerElement.offsetHeight;
const triggerWidth = triggerElement.offsetWidth;
const dialogProperties = { xPos: triggerPosX, yPos: triggerPosY, width: triggerWidth, height: triggerHeight };
const dialogPosition = window.innerHeight - triggerPosY < 250 ? 'above' : 'below';
let calloutOptions;
if (type === MarkdownButtonType.LINK_PREVIEW) {
const defaultLabel = this.getCurrentSelectionText();
this._linkCallout = this._instantiationService.createInstance(LinkCalloutDialog, this.insertLinkHeading, dialogProperties, defaultLabel);
this._linkCallout = this._instantiationService.createInstance(LinkCalloutDialog, this.insertLinkHeading, dialogProperties, dialogPosition, defaultLabel);
this._linkCallout.render();
calloutOptions = await this._linkCallout.open();
}