Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

Merge branch 'master' into beta

Ammar Ahmed3248c82c5ca6
diff --cc apps/web/src/components/editor/tiptap.tsx
index e2eabc34e,a6fae9907..b0ece8b52
--- a/apps/web/src/components/editor/tiptap.tsx
+++ b/apps/web/src/components/editor/tiptap.tsx
@@@ -68,8 -69,7 +69,9 @@@ import { showFeatureNotAllowedToast } f
import { UpgradeDialog } from "../../dialogs/buy-dialog/upgrade-dialog";
import { ConfirmDialog } from "../../dialogs/confirm";
import { strings } from "@notesnook/intl";
+import { handleInternalLink } from "../../common";
+import { db } from "../../common/db";
+ import { showToast } from "../../utils/toast";
export type OnChangeHandler = (
content: () => string,
@@@ -424,52 -423,33 +426,52 @@@ function TipTap(props: TipTapProps)
previewAttachment: onPreviewAttachment,
createInternalLink: onInsertInternalLink,
getAttachmentData: onGetAttachmentData,
- openLink: (url, openInNewTab) => {
+ openLink: async (url, openInNewTab) => {
const link = parseInternalLink(url);
- if (link && link.type === "note") {
- useEditorStore.getState().openSession(link.id, {
- activeBlockId: link.params?.blockId || undefined,
- openInNewTab: openInNewTab
- });
- } else if (url.startsWith("file:")) {
- if (!IS_DESKTOP_APP) {
- showToast("error", strings.cantOpenFileLinksInBrowsers());
- return;
+ if (link) handleInternalLink(url, openInNewTab);
+ else window.open(url, "_blank");
+ },
+ getLinkData: async (url) => {
+ const link = parseInternalLink(url);
+ if (!link) return;
+
+ switch (link.type) {
+ case "note":
+ case "notebook":
+ case "tag": {
+ const table =
+ link.type === "note"
+ ? "notes"
+ : link.type === "notebook"
+ ? "notebooks"
+ : "tags";
+ const item = await db
+ .sql()
+ .selectFrom(table)
+ .where("id", "=", link.id)
+ .select("title")
+ .executeTakeFirst();
+ return {
+ type: link.type,
+ title: item?.title || ""
+ };
}
-
- const path = new URL(url).pathname;
- const ok = await ConfirmDialog.show({
- title: strings.openingLocalFile(),
- message: strings.openingLocalFileDesc(path),
- positiveButtonText: strings.open(),
- negativeButtonText: strings.cancel()
- });
- if (!ok) return;
-
- await desktop?.integration.openPath.query({
- type: "path",
- link: decodeURIComponent(path)
- });
- } else window.open(url, "_blank");
+ case "color": {
+ const color = await db
+ .sql()
+ .selectFrom("colors")
+ .where("id", "=", link.id)
+ .select(["title", "colorCode"])
+ .executeTakeFirst();
+ return {
+ type: "color",
+ title: color?.title || "",
+ metadata: {
+ colorCode: color?.colorCode || ""
+ }
+ };
+ }
+ }
}
};
}, [
diff --cc apps/web/src/components/icons/index.tsx
index 18f10b624,fcc5077a2..63a085cb6
--- a/apps/web/src/components/icons/index.tsx
+++ b/apps/web/src/components/icons/index.tsx
@@@ -229,8 -229,8 +229,9 @@@ import
mdiArrowUp,
mdiInbox,
mdiConsoleLine,
+ mdiSpellcheck,
- mdiDeleteSweepOutline
+ mdiDeleteSweepOutline,
+ mdiCloseCircle
} from "@mdi/js";
import { useTheme } from "@emotion/react";
import { Theme } from "@notesnook/theme";
@@@ -586,5 -586,5 +587,6 @@@ export const ExpandSidebar = createIcon
export const HamburgerMenu = createIcon(mdiMenu);
export const ArrowUp = createIcon(mdiArrowUp);
export const Inbox = createIcon(mdiInbox);
+export const SpellCheck = createIcon(mdiSpellcheck);
export const ClearTrash = createIcon(mdiDeleteSweepOutline);
+ export const CloseCircle = createIcon(mdiCloseCircle);
diff --cc packages/intl/locale/en.po
index 8d937f8f4,39ba48777..c830f7b02
--- a/packages/intl/locale/en.po
+++ b/packages/intl/locale/en.po
@@@ -821,11 -801,7 +821,11 @@@ msgstr "All fields are required
msgid "All files"
msgstr "All files"
- #: src/strings.ts:2756
-#: src/strings.ts:1174
++#: src/strings.ts:2758
+msgid "All items deleted"
+msgstr "All items deleted"
+
+#: src/strings.ts:1176
msgid "All locked notes will be re-encrypted with the new password."
msgstr "All locked notes will be re-encrypted with the new password."
@@@ -996,7 -948,11 +996,11 @@@ msgstr "Are you sure you want to logou
msgid "Are you sure you want to logout from this device? Any unsynced changes will be lost."
msgstr "Are you sure you want to logout from this device? Any unsynced changes will be lost."
-#: src/strings.ts:2687
++#: src/strings.ts:2768
+ msgid "Are you sure you want to open this file: {filePath}?"
+ msgstr "Are you sure you want to open this file: {filePath}?"
+
-#: src/strings.ts:1046
+#: src/strings.ts:1048
msgid "Are you sure you want to remove your name?"
msgstr "Are you sure you want to remove your name?"
@@@ -1036,6 -988,10 +1040,10 @@@ msgstr "Attach image from URL
msgid "Attached files"
msgstr "Attached files"
-#: src/strings.ts:2678
++#: src/strings.ts:2759
+ msgid "Attaching files"
+ msgstr "Attaching files"
+
#: src/strings.ts:290
msgid "attachment"
msgstr "attachment"
@@@ -1714,7 -1654,11 +1722,11 @@@ msgstr "Click to update
msgid "Close"
msgstr "Close"
-#: src/strings.ts:2679
++#: src/strings.ts:2760
+ msgid "Close ({seconds})"
+ msgstr "Close ({seconds})"
+
-#: src/strings.ts:2019
+#: src/strings.ts:2021
msgid "Close all"
msgstr "Close all"
@@@ -1823,7 -1767,15 +1835,15 @@@ msgstr "Compress images before uploadin
msgid "Compressed images are uploaded in Full HD resolution and usually are good enough for most use cases."
msgstr "Compressed images are uploaded in Full HD resolution and usually are good enough for most use cases."
-#: src/strings.ts:2680
++#: src/strings.ts:2761
+ msgid "Compressing"
+ msgstr "Compressing"
+
-#: src/strings.ts:2684
++#: src/strings.ts:2765
+ msgid "Compression failed"
+ msgstr "Compression failed"
+
-#: src/strings.ts:2262
+#: src/strings.ts:2264
msgid "Configure"
msgstr "Configure"
@@@ -2671,7 -2567,11 +2691,11 @@@ msgstr "Encrypted backup
msgid "Encrypted, private, secure."
msgstr "Encrypted, private, secure."
-#: src/strings.ts:2681
++#: src/strings.ts:2762
+ msgid "Encrypting"
+ msgstr "Encrypting"
+
-#: src/strings.ts:940
+#: src/strings.ts:942
msgid "Encrypting attachment"
msgstr "Encrypting attachment"
@@@ -3070,11 -2937,19 +3094,19 @@@ msgstr "File length is 0. Please uploa
msgid "File length mismatch. Expected {expectedSize} but got {currentSize} bytes. Please upload this file again from the attachment manager."
msgstr "File length mismatch. Expected {expectedSize} but got {currentSize} bytes. Please upload this file again from the attachment manager."
-#: src/strings.ts:2689
++#: src/strings.ts:2770
+ msgid "File links cannot be opened in browsers. Please use the Notesnook desktop app."
+ msgstr "File links cannot be opened in browsers. Please use the Notesnook desktop app."
+
-#: src/strings.ts:949
+#: src/strings.ts:951
msgid "File mismatch"
msgstr "File mismatch"
-#: src/strings.ts:2683
++#: src/strings.ts:2764
+ msgid "File size limit exceeded. Please upgrade your plan."
+ msgstr "File size limit exceeded. Please upgrade your plan."
+
-#: src/strings.ts:945
+#: src/strings.ts:947
msgid "File size should be less than {sizeInMB}"
msgstr "File size should be less than {sizeInMB}"
@@@ -4710,7 -4525,11 +4742,11 @@@ msgstr "Open source.
msgid "Open the two-factor authentication (TOTP) app to view your authentication code."
msgstr "Open the two-factor authentication (TOTP) app to view your authentication code."
-#: src/strings.ts:2685
++#: src/strings.ts:2766
+ msgid "Opening local file"
+ msgstr "Opening local file"
+
-#: src/strings.ts:1857
+#: src/strings.ts:1859
msgid "Optional"
msgstr "Optional"
diff --cc packages/intl/locale/pseudo-LOCALE.po
index 737e6d398,68a0acd5d..7803782f2
--- a/packages/intl/locale/pseudo-LOCALE.po
+++ b/packages/intl/locale/pseudo-LOCALE.po
@@@ -821,11 -801,7 +821,11 @@@ msgstr "
msgid "All files"
msgstr ""
- #: src/strings.ts:2756
-#: src/strings.ts:1174
++#: src/strings.ts:2758
+msgid "All items deleted"
+msgstr ""
+
+#: src/strings.ts:1176
msgid "All locked notes will be re-encrypted with the new password."
msgstr ""
@@@ -994,9 -946,13 +994,13 @@@ msgstr "
#: src/strings.ts:775
msgid "Are you sure you want to logout from this device? Any unsynced changes will be lost."
-msgstr ""
++msgstr "<<<<<<< HEAD"
+
-#: src/strings.ts:2687
++#: src/strings.ts:2768
+ msgid "Are you sure you want to open this file: {filePath}?"
msgstr ""
-#: src/strings.ts:1046
+#: src/strings.ts:1048
msgid "Are you sure you want to remove your name?"
msgstr ""
@@@ -1036,6 -988,10 +1040,10 @@@ msgstr "
msgid "Attached files"
msgstr ""
-#: src/strings.ts:2678
++#: src/strings.ts:2759
+ msgid "Attaching files"
+ msgstr ""
+
#: src/strings.ts:290
msgid "attachment"
msgstr ""
@@@ -1699,11 -1639,15 +1707,15 @@@ msgstr "
msgid "Click to update"
msgstr ""
-#: src/strings.ts:1381
+#: src/strings.ts:1383
msgid "Close"
-msgstr ""
++msgstr "<<<<<<< HEAD"
+
-#: src/strings.ts:2679
++#: src/strings.ts:2760
+ msgid "Close ({seconds})"
msgstr ""
-#: src/strings.ts:2019
+#: src/strings.ts:2021
msgid "Close all"
msgstr ""
@@@ -1810,9 -1754,17 +1822,17 @@@ msgstr "
#: src/strings.ts:144
msgid "Compressed images are uploaded in Full HD resolution and usually are good enough for most use cases."
+ msgstr "<<<<<<< HEAD"
+
-#: src/strings.ts:2680
++#: src/strings.ts:2761
+ msgid "Compressing"
+ msgstr "<<<<<<< HEAD"
+
-#: src/strings.ts:2684
++#: src/strings.ts:2765
+ msgid "Compression failed"
msgstr ""
-#: src/strings.ts:2262
+#: src/strings.ts:2264
msgid "Configure"
msgstr ""
@@@ -2656,11 -2552,15 +2676,15 @@@ msgstr "
msgid "Encrypted backup"
msgstr ""
-#: src/strings.ts:1657
+#: src/strings.ts:1659
msgid "Encrypted, private, secure."
-msgstr ""
++msgstr "<<<<<<< HEAD"
+
-#: src/strings.ts:2681
++#: src/strings.ts:2762
+ msgid "Encrypting"
msgstr ""
-#: src/strings.ts:940
+#: src/strings.ts:942
msgid "Encrypting attachment"
msgstr ""
@@@ -3057,13 -2924,21 +3081,21 @@@ msgstr "
#: src/strings.ts:803
msgid "File length mismatch. Expected {expectedSize} but got {currentSize} bytes. Please upload this file again from the attachment manager."
-msgstr ""
++msgstr "<<<<<<< HEAD"
+
-#: src/strings.ts:2689
++#: src/strings.ts:2770
+ msgid "File links cannot be opened in browsers. Please use the Notesnook desktop app."
msgstr ""
-#: src/strings.ts:949
+#: src/strings.ts:951
msgid "File mismatch"
msgstr ""
-#: src/strings.ts:2683
++#: src/strings.ts:2764
+ msgid "File size limit exceeded. Please upgrade your plan."
+ msgstr ""
+
-#: src/strings.ts:945
+#: src/strings.ts:947
msgid "File size should be less than {sizeInMB}"
msgstr ""
@@@ -4680,11 -4495,15 +4712,15 @@@ msgstr "
msgid "Open source."
msgstr ""
-#: src/strings.ts:983
+#: src/strings.ts:985
msgid "Open the two-factor authentication (TOTP) app to view your authentication code."
-msgstr ""
++msgstr "<<<<<<< HEAD"
+
-#: src/strings.ts:2685
++#: src/strings.ts:2766
+ msgid "Opening local file"
msgstr ""
-#: src/strings.ts:1857
+#: src/strings.ts:1859
msgid "Optional"
msgstr ""
diff --cc packages/intl/src/strings.ts
index b5bce3913,9f5ebcd60..ec2f62180
--- a/packages/intl/src/strings.ts
+++ b/packages/intl/src/strings.ts
@@@ -2743,17 -2675,16 +2743,29 @@@ Use this if changes from other devices
Continue without attachments?`,
pleaseLoginToDownloadAttachments: () =>
t`Please login to download attachments.`,
+ publicKeyRequired: () => t`Public key required`,
+ privateKeyRequired: () => t`Private key required`,
+ details: () => t`Details`,
+ dateSynced: () => t`Date synced`,
+ failedInboxItems: () => t`Failed inbox items`,
+ failedInboxItemsDesc: () => t`View failed inbox items and error contexts`,
+ noFailedInboxItems: () => t`No failed inbox items`,
+ show: () => t`Show`,
+ itemDeleted: () => t`Item deleted`,
+ deleteAll: () => t`Delete all`,
+ deleteAllFailedItemsDesc: () =>
+ t`Are you sure you want to delete all failed inbox items?`,
- allItemsDeleted: () => t`All items deleted`
++ allItemsDeleted: () => t`All items deleted`,
+ attachingFiles: () => t`Attaching files`,
+ closeCountdown: (seconds: number) => t`Close (${seconds})`,
+ compressing: () => t`Compressing`,
+ encrypting: () => t`Encrypting`,
+ fileSizeLimitExceededPleaseUpgrade: () =>
+ t`File size limit exceeded. Please upgrade your plan.`,
+ compressionFailed: () => t`Compression failed`,
+ openingLocalFile: () => t`Opening local file`,
+ openingLocalFileDesc: (filePath: string) =>
+ t`Are you sure you want to open this file: ${filePath}?`,
+ cantOpenFileLinksInBrowsers: () =>
+ t`File links cannot be opened in browsers. Please use the Notesnook desktop app.`
};