You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Electron: Resolves #751: Allow switching between todo and note when multiple notes are selected
This commit is contained in:
@ -424,17 +424,25 @@ class Note extends BaseItem {
|
||||
return Note.save(modifiedNote, { autoTimestamp: false });
|
||||
}
|
||||
|
||||
static toggleIsTodo(note) {
|
||||
static changeNoteType(note, type) {
|
||||
if (!('is_todo' in note)) throw new Error('Missing "is_todo" property');
|
||||
|
||||
let output = Object.assign({}, note);
|
||||
output.is_todo = output.is_todo ? 0 : 1;
|
||||
const newIsTodo = type === 'todo' ? 1 : 0;
|
||||
|
||||
if (Number(note.is_todo) === newIsTodo) return note;
|
||||
|
||||
const output = Object.assign({}, note);
|
||||
output.is_todo = newIsTodo;
|
||||
output.todo_due = 0;
|
||||
output.todo_completed = 0;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
static toggleIsTodo(note) {
|
||||
return this.changeNoteType(note, !!note.is_todo ? 'note' : 'todo');
|
||||
}
|
||||
|
||||
static async duplicate(noteId, options = null) {
|
||||
const changes = options && options.changes;
|
||||
const uniqueTitle = options && options.uniqueTitle;
|
||||
|
Reference in New Issue
Block a user