A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: implement multiple notes moving
thecodrr3327ffc139eb
diff --git a/apps/web/src/common/selectionoptions.js b/apps/web/src/common/selectionoptions.jsindex f565de75c..d56d7b1df 100644--- a/apps/web/src/common/selectionoptions.js+++ b/apps/web/src/common/selectionoptions.js@@ -3,6 +3,7 @@ import { store as appStore } from "../stores/app-store";import { store as notesStore } from "../stores/note-store";import { store as nbStore } from "../stores/notebook-store";import { db } from "./index";+import { showMoveNoteDialog } from "../components/dialogs/movenotedialog";function createOption(icon, onClick) {return {@@ -53,7 +54,13 @@ const UnfavoriteOption = createOption(Icon.Star, function(state) {notesStore.getState().refresh();});-const AddToNotebookOption = createOption(Icon.Plus, function() {});+const AddToNotebookOption = createOption(Icon.Plus, async function(state) {+ const items = state.selectedItems.map(item => item.id);+ if (await showMoveNoteDialog(items)) {+ //TODO show proper snack+ console.log("Notes moved successfully!");+ }+});const NotesOptions = createOptions([AddToNotebookOption, FavoriteOption]);const NotebooksOptions = createOptions();diff --git a/apps/web/src/components/dialogs/move-note-dialog.js b/apps/web/src/components/dialogs/move-note-dialog.jsindex 13739bd0f..adb948a0a 100644--- a/apps/web/src/components/dialogs/move-note-dialog.js+++ b/apps/web/src/components/dialogs/move-note-dialog.js@@ -167,16 +167,11 @@ export default class MoveDialog extends React.Component {try {await db.notes.move({ id: this.selectedNotebook.id, topic: this.selectedTopic },- props.noteId- );- console.log(- this.selectedNotebook.id,- this.selectedTopic,- props.noteId+ ...props.noteIds);props.onMove();} catch (e) {- console.log(e);+ console.error(e);} finally {props.onClose();}@@ -189,11 +184,10 @@ export default class MoveDialog extends React.Component {}}-export const showMoveNoteDialog = (noteId, notebook) => {+export const showMoveNoteDialog = noteIds => {return showDialog(perform => (<MoveDialog- noteId={noteId}- notebook={notebook}+ noteIds={noteIds}onClose={() => perform(false)}onMove={() => perform(true)}/>diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.jsindex 60e9a9d7e..11fbf5f2b 100644--- a/apps/web/src/components/note/index.js+++ b/apps/web/src/components/note/index.js@@ -14,7 +14,7 @@ const menuItems = (note, index, groupIndex) => [{title: note.notebook ? "Move" : "Add to",onClick: async () => {- if (await showMoveNoteDialog(note.id)) {+ if (await showMoveNoteDialog([note.id])) {showSnack("Note moved successfully!");}}