1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-14 23:26:58 +02:00

Electron: Resolves #612: Allow duplicating a note

This commit is contained in:
Laurent Cozic
2018-06-27 21:45:31 +01:00
parent 7d7e1e1637
commit 310afb0ad6
8 changed files with 33 additions and 18 deletions

View File

@@ -33,19 +33,6 @@ class Folder extends BaseItem {
}
}
static async findUniqueFolderTitle(title) {
let counter = 1;
let titleToTry = title;
while (true) {
const folder = await this.loadByField('title', titleToTry);
if (!folder) return titleToTry;
titleToTry = title + ' (' + counter + ')';
counter++;
if (counter >= 100) titleToTry = title + ' (' + ((new Date()).getTime()) + ')';
if (counter >= 1000) throw new Error('Cannot find unique title');
}
}
static noteIds(parentId) {
return this.db().selectAll('SELECT id FROM notes WHERE is_conflict = 0 AND parent_id = ?', [parentId]).then((rows) => {
let output = [];