Skip to content

Commit

Permalink
Fixed broken keyboard shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
ransome1 committed Nov 30, 2022
1 parent aad500c commit 1348d78
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 39 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sleek",
"productName": "sleek",
"version": "1.3.0",
"version": "1.3.1-rc.1",
"description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"category": "ProjectManagement",
Expand Down Expand Up @@ -154,6 +154,7 @@
"electron-builder": "23.0.2",
"electron-notarize": "^1.2.2",
"electron-reloader": "^1.2.2",
"cross-env": "^7.0.3",
"eslint": "^8.6.0"
}
}
45 changes: 7 additions & 38 deletions src/js/keyboard.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ export function focusRow(row) {
return false;
}

// const isDrawerOpen = () => { return userData.filterDrawer || userData.viewDrawer; }
// const isOnboardingOpen = () => { return document.getElementById("onboardingContainer").classList.contains("is-active"); }
// const isContextOpen = () => { return todoContext.classList.contains("is-active"); }

export async function registerShortcuts() {
try {

Expand Down Expand Up @@ -135,20 +131,9 @@ export async function registerShortcuts() {

if(isModalOpen()) {

// // set priority directly
// if(event.altKey && event.key.length === 1 && event.key.match(/[A-Z]/i)) {

// setPriority(event.key.substr(0,1)).then(response => {
// console.log(response);
// }).catch(error => {
// handleError(error);
// });
// return false;
// }

// due date plus 1

if((event.ctrlKey || event.metaKey) && event.altKey && event.key === "ArrowUp") {
if(event.altKey && event.key === "ArrowUp") {
setDueDate(1).then(response => {
console.log(response);
}).catch(error => {
Expand All @@ -159,7 +144,7 @@ export async function registerShortcuts() {

// due date minus 1

if((event.ctrlKey || event.metaKey) && event.altKey && event.key === "ArrowDown") {
if(event.altKey && event.key === "ArrowDown") {
setDueDate(-1).then(response => {
console.log(response);
}).catch(error => {
Expand All @@ -170,7 +155,7 @@ export async function registerShortcuts() {

// reset due date

if((event.ctrlKey || event.metaKey) && event.altKey && (event.key === "ArrowRight" || event.key === "ArrowLeft")) {
if(event.altKey && (event.key === "ArrowRight" || event.key === "ArrowLeft")) {
setDueDate(0).then(response => {
console.log(response);
}).catch(error => {
Expand Down Expand Up @@ -235,7 +220,6 @@ export async function registerShortcuts() {
// setup x key
// ******************************************************

// TODO: not working any more
if (isRowFocused() && event.key === "x") {
const todoTableRow = todoTable.querySelectorAll(".todo")[currentRow].getAttribute("data-item");
setTodoComplete(todoTableRow).then(function(response) {
Expand Down Expand Up @@ -468,7 +452,7 @@ export async function registerShortcuts() {

// priority up

if(event.altKey && event.metaKey && event.key === "ArrowUp") {
if(event.ctrlKey && event.shiftKey && event.key === "ArrowUp") {
setPriority(-1).then(function(result) {
console.log(result);
}).catch(function(error) {
Expand All @@ -479,7 +463,7 @@ export async function registerShortcuts() {

// priority down

if(event.altKey && event.metaKey && event.key === "ArrowDown") {
if(event.ctrlKey && event.shiftKey && event.key === "ArrowDown") {
setPriority(1).then(function(result) {
console.log(result);
}).catch(function(error) {
Expand All @@ -490,7 +474,7 @@ export async function registerShortcuts() {

// set priority directly

if(event.altKey && event.metaKey && event.key.length === 1) {
if(event.ctrlKey && event.shiftKey && event.key.length === 1) {

if(!event.code.includes("Key")) return false

Expand All @@ -506,7 +490,7 @@ export async function registerShortcuts() {

// remove priority

if(event.altKey && event.metaKey && (event.key === "ArrowRight" || event.key === "ArrowLeft")) {
if(event.ctrlKey && event.shiftKey && (event.key === "ArrowRight" || event.key === "ArrowLeft")) {

setPriority(false).then(response => {
console.log(response);
Expand All @@ -525,21 +509,6 @@ export async function registerShortcuts() {
location.reload(true);
return false;
}

// // toggle completed todos

// if(event.key==="h" && !isInputFocused()) {
// // abort when onboarding is shown
// if(isOnboardingOpen()) return false;

// const showCompleted = document.getElementById("showCompleted");
// triggerToggle(showCompleted, true).then(function(response) {
// console.info(response);
// }).catch(function(error) {
// handleError(error);
// });
// return false;
// }

// toggle deferred todos

Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,13 @@ crc@^3.8.0:
dependencies:
buffer "^5.1.0"

cross-env@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
dependencies:
cross-spawn "^7.0.1"

cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
Expand Down

0 comments on commit 1348d78

Please sign in to comment.