Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
43e42079
Unverified
Commit
43e42079
authored
Jan 08, 2024
by
Noah Alderton
Committed by
GitHub
Jan 08, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: export Memos as Markdown FIles (#2716)
parent
cafa7c5a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
5 deletions
+22
-5
ShareMemoDialog.tsx
web/src/components/ShareMemoDialog.tsx
+17
-5
en.json
web/src/locales/en.json
+1
-0
es.json
web/src/locales/es.json
+2
-0
fr.json
web/src/locales/fr.json
+1
-0
it.json
web/src/locales/it.json
+1
-0
No files found.
web/src/components/ShareMemoDialog.tsx
View file @
43e42079
...
@@ -49,11 +49,7 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
...
@@ -49,11 +49,7 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
pixelRatio
:
window
.
devicePixelRatio
*
2
,
pixelRatio
:
window
.
devicePixelRatio
*
2
,
})
})
.
then
((
url
)
=>
{
.
then
((
url
)
=>
{
const
a
=
document
.
createElement
(
"a"
);
downloadFileFromUrl
(
url
,
`memos-
${
getDateTimeString
(
Date
.
now
())}
.png`
);
a
.
href
=
url
;
a
.
download
=
`memos-
${
getDateTimeString
(
Date
.
now
())}
.png`
;
a
.
click
();
downloadingImageState
.
setFinish
();
downloadingImageState
.
setFinish
();
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
...
@@ -61,6 +57,18 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
...
@@ -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
=
()
=>
{
const
handleCopyLinkBtnClick
=
()
=>
{
copy
(
`
${
window
.
location
.
origin
}
/m/
${
memo
.
id
}
`
);
copy
(
`
${
window
.
location
.
origin
}
/m/
${
memo
.
id
}
`
);
toast
.
success
(
t
(
"message.succeed-copy-link"
));
toast
.
success
(
t
(
"message.succeed-copy-link"
));
...
@@ -88,6 +96,10 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
...
@@ -88,6 +96,10 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
)
}
)
}
{
t
(
"common.image"
)
}
{
t
(
"common.image"
)
}
</
Button
>
</
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
}
>
<
Button
color=
"neutral"
variant=
"outlined"
onClick=
{
handleCopyLinkBtnClick
}
>
<
Icon
.
Link
className=
"w-4 h-auto mr-1"
/>
<
Icon
.
Link
className=
"w-4 h-auto mr-1"
/>
{
t
(
"common.link"
)
}
{
t
(
"common.link"
)
}
...
...
web/src/locales/en.json
View file @
43e42079
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
"fold"
:
"Fold"
,
"fold"
:
"Fold"
,
"expand"
:
"Expand"
,
"expand"
:
"Expand"
,
"image"
:
"Image"
,
"image"
:
"Image"
,
"file"
:
"File"
,
"link"
:
"Link"
,
"link"
:
"Link"
,
"vacuum"
:
"Vacuum"
,
"vacuum"
:
"Vacuum"
,
"select"
:
"Select"
,
"select"
:
"Select"
,
...
...
web/src/locales/es.json
View file @
43e42079
{
{
"common"
:
{
"common"
:
{
"about"
:
"Acerca de"
,
"about"
:
"Acerca de"
,
"home"
:
"Inicio"
,
"email"
:
"Email"
,
"email"
:
"Email"
,
"password"
:
"Contraseña"
,
"password"
:
"Contraseña"
,
"username"
:
"Usuario"
,
"username"
:
"Usuario"
,
...
@@ -37,6 +38,7 @@
...
@@ -37,6 +38,7 @@
"fold"
:
"Plegar"
,
"fold"
:
"Plegar"
,
"expand"
:
"Expandir"
,
"expand"
:
"Expandir"
,
"image"
:
"Imagen"
,
"image"
:
"Imagen"
,
"file"
:
"Archivo"
,
"link"
:
"Enlace"
,
"link"
:
"Enlace"
,
"vacuum"
:
"Vaciar"
,
"vacuum"
:
"Vaciar"
,
"select"
:
"Seleccionar"
,
"select"
:
"Seleccionar"
,
...
...
web/src/locales/fr.json
View file @
43e42079
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
"email"
:
"Email"
,
"email"
:
"Email"
,
"expand"
:
"Agrandir"
,
"expand"
:
"Agrandir"
,
"explore"
:
"Explorer"
,
"explore"
:
"Explorer"
,
"file"
:
"Fichier"
,
"filter"
:
"Filtre"
,
"filter"
:
"Filtre"
,
"filter-period"
:
"{{from}} à {{to}}"
,
"filter-period"
:
"{{from}} à {{to}}"
,
"fold"
:
"Rétracter"
,
"fold"
:
"Rétracter"
,
...
...
web/src/locales/it.json
View file @
43e42079
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
"email"
:
"Email"
,
"email"
:
"Email"
,
"expand"
:
"Espandi"
,
"expand"
:
"Espandi"
,
"explore"
:
"Esplora"
,
"explore"
:
"Esplora"
,
"file"
:
"File"
,
"filter"
:
"Filtro"
,
"filter"
:
"Filtro"
,
"filter-period"
:
"{{from}} a {{to}}"
,
"filter-period"
:
"{{from}} a {{to}}"
,
"fold"
:
"Riduci"
,
"fold"
:
"Riduci"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment