You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Desktop: Toggle todo checkbox using SPACE key
This commit is contained in:
@@ -51,6 +51,16 @@ class BaseModel {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static modelsByIds(items, ids) {
|
||||
const output = [];
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (ids.indexOf(items[i].id) >= 0) {
|
||||
output.push(items[i]);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
// Prefer the use of this function to compare IDs as it handles the case where
|
||||
// one ID is null and the other is "", in which case they are actually considered to be the same.
|
||||
static idsEqual(id1, id2) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user