You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Mobile: Added duplicate option when selecting notes. (#1969)
* Adding duplicate button on screen-header.js when selecting notes; Adding 'duplicateMultipleNotes' function on Note.js; * Using for-loop like the rest of the code does * changing from 'uniqueTitle' to 'ensureUniqueTitle'
This commit is contained in:
committed by
Laurent Cozic
parent
b0a4a10dcc
commit
d3e9ffcaea
@ -481,6 +481,25 @@ class Note extends BaseItem {
|
||||
return note;
|
||||
}
|
||||
|
||||
static async duplicateMultipleNotes(noteIds, options = null){
|
||||
/*
|
||||
if options.uniqueTitle is true, a unique title for the duplicated file will be assigned.
|
||||
*/
|
||||
const ensureUniqueTitle = options && options.ensureUniqueTitle;
|
||||
|
||||
for(const noteId of noteIds){
|
||||
const noteOptions = {};
|
||||
|
||||
//If ensureUniqueTitle is truthy, set the original note's name as root for the unique title.
|
||||
if(ensureUniqueTitle){
|
||||
const originalNote = await Note.load(noteId);
|
||||
noteOptions.uniqueTitle = originalNote.title;
|
||||
}
|
||||
|
||||
await Note.duplicate(noteId, noteOptions);
|
||||
}
|
||||
}
|
||||
|
||||
static async duplicate(noteId, options = null) {
|
||||
const changes = options && options.changes;
|
||||
const uniqueTitle = options && options.uniqueTitle;
|
||||
|
Reference in New Issue
Block a user