tab switching keybind for keybinds cheatsheet

This commit is contained in:
end-4
2024-06-10 22:06:04 +07:00
parent 2c1dfcc711
commit b6e34a4ab1
2 changed files with 14 additions and 3 deletions
+12 -1
View File
@@ -88,12 +88,13 @@ const SheetContent = (id) => {
} }
export default (id) => { export default (id) => {
const sheets = SheetContent(id);
const widgetContent = Widget.Box({ const widgetContent = Widget.Box({
vertical: true, vertical: true,
className: "cheatsheet-bg spacing-v-5", className: "cheatsheet-bg spacing-v-5",
children: [ children: [
CheatsheetHeader(), CheatsheetHeader(),
SheetContent(id), sheets,
] ]
}); });
return PopupWindow({ return PopupWindow({
@@ -121,6 +122,16 @@ export default (id) => {
sheetContents[id].nextTab(); sheetContents[id].nextTab();
else if (checkKeybind(event, userOptions.keybinds.cheatsheet.prevTab)) else if (checkKeybind(event, userOptions.keybinds.cheatsheet.prevTab))
sheetContents[id].prevTab(); sheetContents[id].prevTab();
if (sheets.attribute.names[sheets.attribute.shown.value] == 'Keybinds') { // If Keybinds tab is focused
if (checkKeybind(event, userOptions.keybinds.cheatsheet.keybinds.nextTab)) {
const toSwitchTab = sheets.attribute.children[sheets.attribute.shown.value];
toSwitchTab.nextTab();
}
else if (checkKeybind(event, userOptions.keybinds.cheatsheet.keybinds.prevTab)) {
const toSwitchTab = sheets.attribute.children[sheets.attribute.shown.value];
toSwitchTab.prevTab();
}
}
}) })
}) })
}); });
+2 -2
View File
@@ -108,11 +108,11 @@ export default () => Box({
// Switch API type // Switch API type
else if (checkKeybind(event, userOptions.keybinds.sidebar.apis.nextTab)) { else if (checkKeybind(event, userOptions.keybinds.sidebar.apis.nextTab)) {
const toSwitchTab = widgetContent.attribute.children[widgetContent.attribute.shown.value]; const toSwitchTab = widgetContent.attribute.children[widgetContent.attribute.shown.value];
toSwitchTab.attribute.nextTab(); toSwitchTab.nextTab();
} }
else if (checkKeybind(event, userOptions.keybinds.sidebar.apis.prevTab)) { else if (checkKeybind(event, userOptions.keybinds.sidebar.apis.prevTab)) {
const toSwitchTab = widgetContent.attribute.children[widgetContent.attribute.shown.value]; const toSwitchTab = widgetContent.attribute.children[widgetContent.attribute.shown.value];
toSwitchTab.attribute.prevTab(); toSwitchTab.prevTab();
} }
} }