Merge pull request #4844 from node-red/4843-quick-add-placement

Adjust type search dialog position to prevent x-overflow
This commit is contained in:
Nick O'Leary 2024-08-12 19:38:40 +01:00 committed by GitHub
commit f88e536ee0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -279,6 +279,11 @@ RED.typeSearch = (function() {
if ($("#red-ui-main-container").height() - opts.y - 195 < 0) {
opts.y = opts.y - 275;
}
const dialogWidth = dialog.width() || 300 // default is 300 (defined in class .red-ui-search)
const workspaceWidth = $('#red-ui-workspace').width()
if (workspaceWidth > dialogWidth && workspaceWidth - opts.x - dialogWidth < 0) {
opts.x = opts.x - (dialogWidth - RED.view.node_width)
}
dialog.css({left:opts.x+"px",top:opts.y+"px"}).show();
searchResultsDiv.slideDown(300);
setTimeout(function() {