Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
feat: export Memos as Markdown FIles (#2716)
Noah Alderton43e42079a4d6
diff --git a/web/src/components/ShareMemoDialog.tsx b/web/src/components/ShareMemoDialog.tsxindex a5fc4f7ca..ccff1733f 100644--- a/web/src/components/ShareMemoDialog.tsx+++ b/web/src/components/ShareMemoDialog.tsx@@ -49,11 +49,7 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {pixelRatio: window.devicePixelRatio * 2,}).then((url) => {- const a = document.createElement("a");- a.href = url;- a.download = `memos-${getDateTimeString(Date.now())}.png`;- a.click();-+ downloadFileFromUrl(url, `memos-${getDateTimeString(Date.now())}.png`);downloadingImageState.setFinish();}).catch((err) => {@@ -61,6 +57,18 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {});};+ const handleDownloadTextFileBtnClick = () => {+ const blob = new Blob([memo.content], { type: "text/plain;charset=utf-8" });+ downloadFileFromUrl(URL.createObjectURL(blob), `memos-${getDateTimeString(Date.now())}.md`);+ };++ const downloadFileFromUrl = (url: string, filename: string) => {+ const a = document.createElement("a");+ a.href = url;+ a.download = filename;+ a.click();+ };+const handleCopyLinkBtnClick = () => {copy(`${window.location.origin}/m/${memo.id}`);toast.success(t("message.succeed-copy-link"));@@ -88,6 +96,10 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {)}{t("common.image")}</Button>+ <Button color="neutral" variant="outlined" onClick={handleDownloadTextFileBtnClick}>+ <Icon.File className="w-4 h-auto mr-1" />+ {t("common.file")}+ </Button><Button color="neutral" variant="outlined" onClick={handleCopyLinkBtnClick}><Icon.Link className="w-4 h-auto mr-1" />{t("common.link")}diff --git a/web/src/locales/en.json b/web/src/locales/en.jsonindex fa9f0a761..f9577ef59 100644--- a/web/src/locales/en.json+++ b/web/src/locales/en.json@@ -47,6 +47,7 @@"fold": "Fold","expand": "Expand","image": "Image",+ "file": "File","link": "Link","vacuum": "Vacuum","select": "Select",diff --git a/web/src/locales/es.json b/web/src/locales/es.jsonindex 1550a17fb..82c6e0271 100644--- a/web/src/locales/es.json+++ b/web/src/locales/es.json@@ -1,6 +1,7 @@{"common": {"about": "Acerca de",+ "home": "Inicio","email": "Email","password": "Contraseña","username": "Usuario",@@ -37,6 +38,7 @@"fold": "Plegar","expand": "Expandir","image": "Imagen",+ "file": "Archivo","link": "Enlace","vacuum": "Vaciar","select": "Seleccionar",diff --git a/web/src/locales/fr.json b/web/src/locales/fr.jsonindex 71edc5a2a..a510a963b 100644--- a/web/src/locales/fr.json+++ b/web/src/locales/fr.json@@ -40,6 +40,7 @@"email": "Email","expand": "Agrandir","explore": "Explorer",+ "file": "Fichier","filter": "Filtre","filter-period": "{{from}} à {{to}}","fold": "Rétracter",diff --git a/web/src/locales/it.json b/web/src/locales/it.jsonindex 694b59bd5..4d851cc9d 100644--- a/web/src/locales/it.json+++ b/web/src/locales/it.json@@ -37,6 +37,7 @@"email": "Email","expand": "Espandi","explore": "Esplora",+ "file": "File","filter": "Filtro","filter-period": "{{from}} a {{to}}","fold": "Riduci",