Commit df97c065 authored by ransome1's avatar ransome1
Browse files

- Fixed https://github.com/ransome1/sleek/issues/428

- Added shortcut for deleting todos
- Updated external libraries
parent 2bc53cca
{
"name": "sleek",
"productName": "sleek",
"version": "1.2.9-rc.1",
"version": "1.2.9-rc.2",
"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",
......@@ -132,7 +132,7 @@
"sass": "sass -w src/scss/style.scss:src/css/style.css",
"start": "yarn sass & electron .",
"test": "yarn playwright test --config=test/playwright.config.js",
"test1": "yarn playwright test -g 'Filter drawer 2' --config=test/playwright.config.js"
"test1": "yarn playwright test -g 'Creating todos' --config=test/playwright.config.js"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.1.1",
......@@ -140,20 +140,20 @@
"bulma": "^0.9.2",
"chokidar": "^3.5.1",
"electron-notarize": "^1.1.1",
"electron-updater": "^4.6.5",
"electron-updater": "^5.3.0",
"electron-windows-badge": "^1.1.0",
"i18next": "^21.6.6",
"i18next-fs-backend": "^1.1.1",
"i18next": "^22.0.4",
"i18next-fs-backend": "^2.0.0",
"jstodotxt": "^0.10.0",
"marked": "^4.0.12",
"peggy": "^1.2.0",
"peggy": "^2.0.1",
"playwright": "^1.27.1",
"sass": "^1.34.1",
"sugar": "^2.0.6",
"vanillajs-datepicker": "^1.1.4"
},
"devDependencies": {
"electron": "^17.2.0",
"electron": "17.2.0",
"electron-builder": "23.0.2",
"electron-reloader": "^1.2.2",
"eslint": "^8.6.0"
......
This diff is collapsed.
This diff is collapsed.
......@@ -852,7 +852,7 @@
<div class="card-content">
<table id="modalChangeFileTable" class="files"></table>
<div class="modalFileDrop">
<div class="btnFilesAddTodoFile" tabindex="0"><i class="fa-solid fa-file-arrow-down"></i><br><span class="modalChangeFileAdd">Drag and drop todo.txt file here or</span></div>
<div class="btnFilesAddTodoFile" tabindex="0"><i class="fa-solid fa-file-arrow-down"></i><br><span class="modalChangeFileAdd"></span></div>
<div class="break"></div>
<button class="btnFilesOpenTodoFile" tabindex="0"><i class="fas fa-folder-open"></i>&nbsp;<span class="spanFilesOpenTodoFile"></span></button>
<button class="btnFilesCreateTodoFile" tabindex="0"><i class="fas fa-plus-circle"></i>&nbsp;<span class="spanFilesCreateTodoFile"></span></button>
......
......@@ -13,15 +13,10 @@ const btnFilesCancel = document.getElementById("btnFilesCancel");
const btnNoResultContainerResetFilters = document.getElementById("btnNoResultContainerResetFilters");
const fileTabBar = document.getElementById("fileTabBar");
const fileTabBarList = document.querySelector("#fileTabBar ul");
//const modalChangeFile = document.getElementById("modalChangeFile");
// const modalChangeFileCreate = document.getElementById("modalChangeFileCreate");
// const modalChangeFileOpen = document.getElementById("modalChangeFileOpen");
const modalChangeFileTable = document.getElementById("modalChangeFileTable");
const modalFileDrop = document.querySelectorAll(".modalFileDrop");
btnFilesCancel.innerHTML = translations.cancel;
// modalChangeFileCreate.innerHTML = translations.createFile;
// modalChangeFileOpen.innerHTML = translations.openFile;
btnNoResultContainerResetFilters.onclick = function() {
resetFilters(true);
......@@ -29,30 +24,17 @@ btnNoResultContainerResetFilters.onclick = function() {
if(userData.matomoEvents) _paq.push(["trackEvent", "No Result Container", "Click on reset button"])
}
// btnFilesCreateTodoFile.onclick = function() {
// window.api.send("openOrCreateFile", ["create"]);
// // trigger matomo event
// if(userData.matomoEvents) _paq.push(["trackEvent", "Change-Modal", "Click on Create file"]);
// }
// btnFilesOpenTodoFile.onclick = function() {
// window.api.send("openOrCreateFile", ["open"]);
// // trigger matomo event
// if(userData.matomoEvents) _paq.push(["trackEvent", "Change-Modal", "Click on Open file"]);
// }
modalFileDrop.forEach(function(modal) {
const spanFilesOpenTodoFile = modal.querySelector(".spanFilesOpenTodoFile");
const spanFilesCreateTodoFile = modal.querySelector(".spanFilesCreateTodoFile");
const btnFilesOpenTodoFile = modal.querySelector(".btnFilesOpenTodoFile");
const btnFilesCreateTodoFile = modal.querySelector(".btnFilesCreateTodoFile");
let modalChangeFileAdd = modal.querySelector(".modalChangeFileAdd");
spanFilesOpenTodoFile.innerHTML = translations.openFile;
spanFilesCreateTodoFile.innerHTML = translations.createFile;
modalChangeFileAdd.innerHTML = translations.dragDropFile;
btnFilesCreateTodoFile.onclick = function() {
window.api.send("openOrCreateFile", ["create"]);
......@@ -66,8 +48,6 @@ modalFileDrop.forEach(function(modal) {
if(userData.matomoEvents) _paq.push(["trackEvent", "Change-Modal", "Click on Open file"]);
}
//let counter = 0;
modal.addEventListener("drop", (event) => {
event.preventDefault();
event.stopPropagation();
......@@ -79,17 +59,11 @@ modalFileDrop.forEach(function(modal) {
modal.addEventListener("dragover", (event) => {
event.preventDefault();
event.stopPropagation();
// if(counter === 0) {
// counter++;
// modal.classList.add("is-highlighted");
// }
modal.classList.add("is-highlighted");
});
modal.addEventListener("dragleave", (event) => {
event.preventDefault();
event.stopPropagation();
//counter--;
//if(counter === 0) modal.classList.remove("is-highlighted");
modal.classList.remove("is-highlighted");
});
})
......@@ -153,7 +127,7 @@ function removeFileFromList(index, removeFile) {
handleError(error);
});
generateFileList(false).then(response => {
generateFileList(true).then(response => {
console.info(response);
}).catch(error => {
handleError(error);
......
This diff is collapsed.
......@@ -90,11 +90,7 @@ modalForm.onsubmit = async function(event) {
let todo = await generateTodoTxtObject(inputValue);
// we add the current date to the start date attribute of the todo.txt object
//if(userData.appendStartDate) todo.date = new Date();
if(userData.appendStartDate) {
const creationDate = convertDate(new Date()) + " ";
inputValue = creationDate.concat(inputValue);
}
if(userData.appendStartDate) todo.date = new Date();
// check if todo already exists
let index;
......@@ -130,8 +126,6 @@ modalForm.onsubmit = async function(event) {
//item.previous = todo;
// send file to main process to save it
//window.api.send("writeToFile", [items.objects.join("\n").toString() + "\n"]);
//window.api.send("writeToFile", [todo.toString(), index]);
window.api.send("writeToFile", [inputValue, index]);
// close and clean up the modal
......@@ -207,8 +201,7 @@ function addInputEvents(element) {
let autoCompleteValue ="";
// TODO: describe
//if((inputValue.charAt(caretPosition-2) === " " || inputValue.charAt(caretPosition-2) === "\n") && (inputValue.charAt(caretPosition-1) === "@" || inputValue.charAt(caretPosition-1) === "+" || inputValue.charAt(caretPosition-1) === "#")) {
if((inputValue.charAt(caretPosition-2) === " " || inputValue.charAt(caretPosition-2) === "\n") && (inputValue.charAt(caretPosition-1) === "@" || inputValue.charAt(caretPosition-1) === "+")) {
if((inputValue.charAt(caretPosition-2) === " " || inputValue.charAt(caretPosition-2) === "\n") && (inputValue.charAt(caretPosition-1) === "@" || inputValue.charAt(caretPosition-1) === "+")) {
autoCompleteValue = inputValue.substr(caretPosition, inputValue.lastIndexOf(" ")).split(" ").shift();
autoCompletePrefix = inputValue.charAt(caretPosition-1);
} else if(inputValue.charAt(caretPosition) === " ") {
......@@ -635,4 +628,4 @@ if(userData.useTextarea) {
});
}
export { show, resizeInput, setPriority, resetForm};
export { show, resizeInput, setPriority, resetForm, item};
......@@ -2,7 +2,7 @@
import { appData, userData, setUserData, translations } from "../render.js";
import { generateGroupedObjects, items, generateTodoTxtObject } from "./todos.mjs";
import { isToday, isPast, isTomorrow } from "./date.mjs";
import { generateFileTabs } from "./files.mjs";
import { generateFileTabs, generateFileList } from "./files.mjs";
import { showGenericMessage } from "./messages.mjs";
import { showDrawer } from "./drawer.mjs";
import { showOnboarding } from "./onboarding.mjs";
......@@ -243,7 +243,13 @@ export function setupInterface() {
window.api.send("update-badge", getBadgeCount());
// close file chooser if it's open
if(modalChangeFile.classList.contains("is-active")) modalChangeFile.classList.remove("is-active");
//if(modalChangeFile.classList.contains("is-active")) modalChangeFile.classList.remove("is-active");
generateFileList(false).then(function(response) {
console.info(response);
}).catch(function(error) {
handleError(error);
});
// if files are available, (re)generate tabs
if(userData.files && userData.files.length > 0) {
......
......@@ -206,9 +206,15 @@ export async function registerShortcuts() {
if(!isInputFocused() && !isContextOpen()) {
// if(event.key === "Delete" || event.key === "Backspace") {
// deleteTodo(currentRow);
// }
// find and delete todo
if(event.key === "Delete" || event.key === "Backspace") {
const todoTableRow = todoTable.querySelectorAll(".todo")[currentRow];
const index = await items.objects.map(function(object) {return object.raw; }).indexOf(todoTableRow.getAttribute("data-item"));
deleteTodo(index);
focusRow(currentRow);
return false;
}
// move focus down in table list
......
......@@ -32,8 +32,6 @@ addTodoContainerHeadline.innerHTML = translations.addTodoContainerHeadline;
addTodoContainerSubtitle.innerHTML = translations.addTodoContainerSubtitle;
noResultContainerHeadline.innerHTML = translations.noResults;
noResultContainerSubtitle.innerHTML = translations.noResultContainerSubtitle;
// onboardingContainerBtnCreate.innerHTML = translations.createFile;
// onboardingContainerBtnOpen.innerHTML = translations.openFile;
onboardingContainerSubtitle.innerHTML = translations.onboardingContainerSubtitle;
welcomeToSleek.innerHTML = translations.welcomeToSleek;
......@@ -47,95 +45,6 @@ btnAddTodoContainer.onclick = function () {
if(userData.matomoEvents) _paq.push(["trackEvent", "Menu", "Click on add todo"]);
}
// btnOnboardingCreateTodoFile.onclick = function() {
// window.api.send("openOrCreateFile", ["create"]);
// // trigger matomo event
// if(userData.matomoEvents) _paq.push(["trackEvent", "Onboarding", "Click on Create file"]);
// }
// btnOnboardingOpenTodoFile.onclick = function() {
// // if files are already available show file modal
// if(typeof userData.files === "object" && userData.files.length > 0) {
// generateFileList().then(response => {
// console.info(response);
// }).catch(error => {
// handleError(error);
// });
// // if NO files are available, file chooser will be opened
// } else {
// window.api.send("openOrCreateFile", ["open"]);
// }
// // trigger matomo event
// if(userData.matomoEvents) _paq.push(["trackEvent", "Onboarding", "Click on Open file"]);
// }
// document.getElementById("modalFileDrop").addEventListener("drop", (event) => {
// event.preventDefault();
// event.stopPropagation();
// console.log("Drop")
// for(const f of event.dataTransfer.files) {
// //window.api.send("openOrCreateFile", ["add", f.path]);
// }
// });
// document.getElementById("modalFileDrop").addEventListener("dragover", (event) => {
// event.preventDefault();
// event.stopPropagation();
// console.log("Over")
// //document.getElementById("modalFileDrop").classList.add("is-active");
// });
// document.addEventListener("dragenter", (event) => {
// event.preventDefault();
// event.stopPropagation();
// console.log("Enter")
// //if(document.getElementById("modalFileDrop").classList.contains("is-active")) document.getElementById("modalFileDrop").classList.add("is-active");
// document.getElementById("modalFileDrop").classList.add("is-active");
// });
// document.addEventListener("dragleave", (event) => {
// // event.preventDefault();
// // event.stopPropagation();
// //if(document.getElementById("modalFileDrop").classList.contains("is-active")) document.getElementById("modalFileDrop").classList.add("is-active");
// document.getElementById("modalFileDrop").classList.remove("is-active");
// });
// document.addEventListener("drop", (event) => {
// event.preventDefault();
// event.stopPropagation();
// console.log("dfdfdf")
// // for (const f of event.dataTransfer.files) {
// // window.api.send("openOrCreateFile", ["add", f.path]);
// // }
// });
// document.addEventListener('dragover', (event) => {
// console.log(document.getElementById("modalFileDrop").classList.contains("is-active"))
// if(document.getElementById("modalFileDrop").classList.contains("is-active")) document.getElementById("modalFileDrop").classList.add("is-active");
// });
// document.addEventListener("dragenter", (event) => {
// console.log('File has entered the Drop Space');
// //document.getElementById("modalFileDrop").classList.add("is-active");
// });
// document.addEventListener('dragleave', (event) => {
// console.log('File has left the Drop Space');
// document.getElementById("modalFileDrop").classList.remove("is-active");
// });
export function showOnboarding() {
try {
......
......@@ -321,10 +321,10 @@ function generateTableRow(todo) {
// if new item was saved, row is being marked
// previous object is emptied
if(item.previous && todo.toString() === item.previous.toString()) {
todoTableBodyRow.setAttribute("id", "previousItem");
item.previous = null;
}
// if(item.previous && todo.toString() === item.previous.toString()) {
// todoTableBodyRow.setAttribute("id", "previousItem");
// item.previous = null;
// }
// start with the individual config of the items
if(todo.complete) todoTableBodyRow.setAttribute("class", "todo completed")
......
......@@ -36,6 +36,7 @@
"duePast": "Po datu splnění",
"dueToday": "Do dneška",
"dueTomorrow": "Do zítřka",
"dragDropFile": "Přetáhněte sem soubor todo.txt nebo",
"edit": "Upravit",
"editTodo": "Upravit úkol",
"errorEventLogging": "Zapisování chyb a událostí",
......
......@@ -36,6 +36,7 @@
"duePast": "Überfällig",
"dueToday": "Heute fällig",
"dueTomorrow": "Morgen fällig",
"dragDropFile": "Ziehe eine todo.txt-Datei per Drag-and-Drop hierher oder",
"edit": "Bearbeiten",
"editTodo": "Aufgabe bearbeiten",
"errorEventLogging": "Fehler- und Event-Logging",
......
......@@ -36,6 +36,7 @@
"duePast": "Overdue",
"dueToday": "Due today",
"dueTomorrow": "Due tomorrow",
"dragDropFile": "Drag and drop todo.txt file here or",
"edit": "Edit",
"editTodo": "Edit todo",
"errorEventLogging": "Error and event logging",
......
......@@ -36,6 +36,7 @@
"duePast": "Atrasadas",
"dueToday": "Para hoy",
"dueTomorrow": "Para mañana",
"dragDropFile": "Arrastre y suelte el archivo todo.txt aquí o",
"edit": "Modificar",
"editTodo": "Modificar tarea",
"errorEventLogging": "Registro de errores y eventos",
......
......@@ -36,6 +36,7 @@
"duePast": "En retard",
"dueToday": "Dû aujourd'hui",
"dueTomorrow": "Dû demain",
"dragDropFile": "Faites glisser et déposez le fichier todo.txt ici ou",
"edit": "Modifier",
"editTodo": "Modifier la tâche",
"errorEventLogging": "Enregistrement des erreurs et des événements",
......
......@@ -36,6 +36,7 @@
"duePast": "Lejárt",
"dueToday": "Ma esedékes",
"dueTomorrow": "Holnap esedékes",
"dragDropFile": "Húzza ide a todo.txt fájlt vagy",
"edit": "Szerkesztés",
"editTodo": "Tennivaló szerkesztése",
"errorEventLogging": "Hiba- és eseménynaplózás",
......
......@@ -36,6 +36,7 @@
"duePast": "In ritardo",
"dueToday": "Da fare oggi",
"dueTomorrow": "Per domani",
"dragDropFile": "Trascina e rilascia il file todo.txt qui o",
"edit": "Modifica",
"editTodo": "Modifica todo",
"errorEventLogging": "Registrazione errori ed eventi",
......
......@@ -36,6 +36,7 @@
"duePast": "期限切れ",
"dueToday": "本日期限",
"dueTomorrow": "明日期限",
"dragDropFile": "todo.txt ファイルをここにドラッグ アンド ドロップするか、",
"edit": "編集",
"editTodo": "タスクを編集",
"errorEventLogging": "エラー・イベントログ",
......
......@@ -36,6 +36,7 @@
"duePast": "Zaległe",
"dueToday": "Dedlajn dziś",
"dueTomorrow": "Dedlajn jutro",
"dragDropFile": "Przeciągnij i upuść plik todo.txt tutaj lub",
"edit": "Edytuj",
"editTodo": "Edytuj zadanie",
"errorEventLogging": "Rejestrowanie błędów i zdarzeń",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment