mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 06:29:29 +01:00
feat: allow moving note without a notebook
This commit is contained in:
@@ -357,16 +357,18 @@ class Database {
|
|||||||
async moveNote(noteId, from, to) {
|
async moveNote(noteId, from, to) {
|
||||||
if (
|
if (
|
||||||
!noteId ||
|
!noteId ||
|
||||||
!from ||
|
(from && (!from.notebook || !from.topic)) ||
|
||||||
!to ||
|
!to ||
|
||||||
!from.notebook ||
|
|
||||||
!to.notebook ||
|
!to.notebook ||
|
||||||
!from.topic ||
|
|
||||||
!to.topic ||
|
!to.topic ||
|
||||||
(from.notebook === to.notebook && from.topic === to.topic) //moving to same notebook and topic shouldn't be possible
|
(from.notebook === to.notebook && from.topic === to.topic) //moving to same notebook and topic shouldn't be possible
|
||||||
)
|
)
|
||||||
return false;
|
return false;
|
||||||
if (await this.deleteNoteFromTopic(from.notebook, from.topic, noteId)) {
|
if (!from) {
|
||||||
|
return await this.addNoteToTopic(to.notebook, to.topic, noteId);
|
||||||
|
} else if (
|
||||||
|
await this.deleteNoteFromTopic(from.notebook, from.topic, noteId)
|
||||||
|
) {
|
||||||
return await this.addNoteToTopic(to.notebook, to.topic, noteId);
|
return await this.addNoteToTopic(to.notebook, to.topic, noteId);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user