You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Electron: Resolves #612: Allow duplicating a note
This commit is contained in:
@ -420,6 +420,7 @@ class Note extends BaseItem {
|
||||
|
||||
static async duplicate(noteId, options = null) {
|
||||
const changes = options && options.changes;
|
||||
const uniqueTitle = options && options.uniqueTitle;
|
||||
|
||||
const originalNote = await Note.load(noteId);
|
||||
if (!originalNote) throw new Error('Unknown note: ' + noteId);
|
||||
@ -432,6 +433,11 @@ class Note extends BaseItem {
|
||||
newNote[n] = changes[n];
|
||||
}
|
||||
|
||||
if (uniqueTitle) {
|
||||
const title = await Note.findUniqueItemTitle(uniqueTitle);
|
||||
newNote.title = title;
|
||||
}
|
||||
|
||||
return this.save(newNote);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user