mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Added clear selection when right clicking non selected item
refs https://github.com/TryGhost/Team/issues/2677
This commit is contained in:
parent
20d2722f04
commit
062a716fbc
@ -86,6 +86,7 @@ export default class ItemComponent extends Component {
|
||||
} else {
|
||||
this.selectionList.clearSelection();
|
||||
this.selectionList.toggleItem(this.id);
|
||||
this.selectionList.clearOnNextUnfreeze();
|
||||
this.dropdown.toggleDropdown('context-menu', this, {left: x, top: y, selectionList: this.selectionList});
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,11 @@ export default class SelectionList {
|
||||
|
||||
#frozen = false;
|
||||
|
||||
/**
|
||||
* When doing right click on an item, we temporarily select it, but want to clear it as soon as we close the context menu.
|
||||
*/
|
||||
#clearOnNextUnfreeze = false;
|
||||
|
||||
constructor(infinityModel) {
|
||||
this.infinityModel = infinityModel ?? {content: []};
|
||||
}
|
||||
@ -22,6 +27,14 @@ export default class SelectionList {
|
||||
|
||||
unfreeze() {
|
||||
this.#frozen = false;
|
||||
if (this.#clearOnNextUnfreeze) {
|
||||
this.clearSelection();
|
||||
this.#clearOnNextUnfreeze = false;
|
||||
}
|
||||
}
|
||||
|
||||
clearOnNextUnfreeze() {
|
||||
this.#clearOnNextUnfreeze = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user