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: add duplicate note option
thecodrr9f397bcc272f
diff --git a/apps/web/src/components/icons/index.js b/apps/web/src/components/icons/index.jsindex 64db9cb6b..35752f3c8 100644--- a/apps/web/src/components/icons/index.js+++ b/apps/web/src/components/icons/index.js@@ -143,6 +143,7 @@ import {mdiFormTextbox,mdiCheckAll,mdiCloudOffOutline,+ mdiContentDuplicate,} from "@mdi/js";import { useTheme } from "emotion-theming";import { AnimatedFlex } from "../animated";@@ -290,6 +291,7 @@ export const Publish = createIcon(mdiCloudUploadOutline);export const Colors = createIcon(mdiPaletteOutline);export const Published = createIcon(mdiCloudCheckOutline);export const Copy = createIcon(mdiContentCopy);+export const Duplicate = createIcon(mdiContentDuplicate);export const Select = createIcon(mdiCheckboxMultipleMarkedCircleOutline);export const NotebookEdit = createIcon(mdiBookEditOutline);export const DeleteForver = createIcon(mdiDeleteForeverOutline);diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.jsindex abe1b591c..129cf5754 100644--- a/apps/web/src/components/note/index.js+++ b/apps/web/src/components/note/index.js@@ -313,6 +313,26 @@ const menuItems = [multiSelect: true,isPro: true,},+ {+ key: "duplicate",+ title: "Duplicate",+ disabled: ({ note }) => note.locked,+ disableReason: "Locked notes cannot be duplicated",+ icon: Icon.Duplicate,+ onClick: async ({ note }) => {+ const id = await store.get().duplicate(note);+ if (+ await confirm({+ title: "Open duplicated note?",+ message: "Do you want to open the duplicated note?",+ noText: "No",+ yesText: "Yes",+ })+ ) {+ hashNavigate(`/notes/${id}/edit`, { replace: true });+ }+ },+ },{key: "lock",title: ({ note }) => (note.locked ? "Unlock" : "Lock"),diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.jsindex e8cf896c0..2ec9d4db4 100644--- a/apps/web/src/stores/note-store.js+++ b/apps/web/src/stores/note-store.js@@ -123,6 +123,12 @@ class NoteStore extends BaseStore {this.refresh();};+ duplicate = async (note) => {+ const id = await db.notes.note(note).duplicate();+ this.refresh();+ return id;+ };+setColor = async (id, color) => {try {let note = db.notes.note(id);