mirror of
https://github.com/45Drives/cockpit-navigator.git
synced 2025-07-30 00:55:30 +02:00
add delete key handler
This commit is contained in:
parent
a6c7392d99
commit
d2deb01783
@ -358,19 +358,8 @@ export default {
|
|||||||
*/
|
*/
|
||||||
const keyHandler = (event) => {
|
const keyHandler = (event) => {
|
||||||
const unCutEntries = () => gatherEntries([], false).map(entry => entry.cut = false);
|
const unCutEntries = () => gatherEntries([], false).map(entry => entry.cut = false);
|
||||||
if (event.key === 'Escape') {
|
const keypress = event.key.toLowerCase();
|
||||||
if (getSelected().length === 0) {
|
|
||||||
if (clipboard.content.length) {
|
|
||||||
unCutEntries();
|
|
||||||
clipboard.content = [];
|
|
||||||
notifications.value.constructNotification('Clipboard', 'Cleared clipboard.', 'info', 2000);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
deselectAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (event.ctrlKey) {
|
if (event.ctrlKey) {
|
||||||
const keypress = event.key.toLowerCase();
|
|
||||||
switch (keypress) {
|
switch (keypress) {
|
||||||
case 'a':
|
case 'a':
|
||||||
selectAll();
|
selectAll();
|
||||||
@ -424,10 +413,27 @@ export default {
|
|||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
return;
|
switch (keypress) {
|
||||||
|
case 'delete':
|
||||||
|
emit('browserAction', 'delete', getSelected());
|
||||||
|
break;
|
||||||
|
case 'escape':
|
||||||
|
if (getSelected().length === 0) {
|
||||||
|
if (clipboard.content.length) {
|
||||||
|
unCutEntries();
|
||||||
|
clipboard.content = [];
|
||||||
|
notifications.value.constructNotification('Clipboard', 'Cleared clipboard.', 'info', 2000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deselectAll();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollHandler = (event) => {
|
const scrollHandler = (event) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user