1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Desktop: Toggle todo checkbox using SPACE key

This commit is contained in:
Laurent Cozic
2019-01-26 15:33:45 +00:00
parent fef176eb96
commit f62bbfe286
3 changed files with 58 additions and 16 deletions

View File

@@ -474,6 +474,19 @@ class Note extends BaseItem {
return this.changeNoteType(note, !!note.is_todo ? 'note' : 'todo');
}
static toggleTodoCompleted(note) {
if (!('todo_completed' in note)) throw new Error('Missing "todo_completed" property');
note = Object.assign({}, note);
if (note.todo_completed) {
note.todo_completed = 0;
} else {
note.todo_completed = Date.now();
}
return note;
}
static async duplicate(noteId, options = null) {
const changes = options && options.changes;
const uniqueTitle = options && options.uniqueTitle;