mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 20:03:20 +08:00
Command palette: auto close if other palette opens (#5192)
This commit is contained in:
parent
a637caf864
commit
53a314d946
|
@ -2130,6 +2130,11 @@ function CommandPalette(commandEnumerator, opts) {
|
|||
this.renderAndBindElements();
|
||||
this.hookEvents();
|
||||
Hotkeys.addHotkeyToHelpSheet(opts.toggleKey, opts.hotkeyDescription);
|
||||
|
||||
if (!CommandPalette.instances) {
|
||||
CommandPalette.instances = [];
|
||||
}
|
||||
CommandPalette.instances.push(this);
|
||||
}
|
||||
|
||||
CommandPalette.prototype.hookEvents = function(){
|
||||
|
@ -2269,6 +2274,14 @@ CommandPalette.prototype.adjustScrollPosition = function(itemElement){
|
|||
CommandPalette.prototype.toggleDisplay = function(forceState) {
|
||||
var isDisplayed = (this.elements.palette.style.display !== "none");
|
||||
var tobeDisplayed = (forceState !== undefined) ? forceState : !isDisplayed;
|
||||
|
||||
if (tobeDisplayed) {
|
||||
// auto close other command palettes
|
||||
CommandPalette.instances.forEach(function(instance){
|
||||
instance.elements.palette.style.display = "none";
|
||||
});
|
||||
}
|
||||
|
||||
this.elements.palette.style.display = tobeDisplayed ? "" : "none";
|
||||
if (tobeDisplayed) {
|
||||
this.elements.input.value = "";
|
||||
|
@ -2276,6 +2289,7 @@ CommandPalette.prototype.toggleDisplay = function(forceState) {
|
|||
this.applyFilter();
|
||||
this.selectFirst();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CommandPalette.prototype.getCommandByElement = function(element) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user