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
f80f0f24
Unverified
Commit
f80f0f24
authored
Jun 21, 2022
by
Steven
Committed by
GitHub
Jun 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: use markdown image syntax (#83)
parent
9f813620
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
16 deletions
+16
-16
DailyMemo.tsx
web/src/components/DailyMemo.tsx
+1
-1
DeletedMemo.tsx
web/src/components/DeletedMemo.tsx
+1
-1
Memo.tsx
web/src/components/Memo.tsx
+1
-1
MemoCardDialog.tsx
web/src/components/MemoCardDialog.tsx
+1
-1
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+3
-3
ShareMemoImageDialog.tsx
web/src/components/ShareMemoImageDialog.tsx
+4
-4
consts.ts
web/src/helpers/consts.ts
+1
-1
daily-memo-diary-dialog.less
web/src/less/daily-memo-diary-dialog.less
+1
-1
memo-content.less
web/src/less/memo-content.less
+1
-1
memo.less
web/src/less/memo.less
+2
-2
No files found.
web/src/components/DailyMemo.tsx
View file @
f80f0f24
...
...
@@ -20,7 +20,7 @@ const DailyMemo: React.FC<Props> = (props: Props) => {
createdAtStr
:
utils
.
getDateTimeString
(
propsMemo
.
createdTs
),
timeStr
:
utils
.
getTimeString
(
propsMemo
.
createdTs
),
};
const
imageUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[]);
const
imageUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[])
.
map
((
s
)
=>
s
.
replace
(
IMAGE_URL_REG
,
"$1"
))
;
return
(
<
div
className=
"daily-memo-wrapper"
>
...
...
web/src/components/DeletedMemo.tsx
View file @
f80f0f24
...
...
@@ -21,7 +21,7 @@ const DeletedMemo: React.FC<Props> = (props: Props) => {
deletedAtStr
:
utils
.
getDateTimeString
(
propsMemo
.
updatedTs
??
Date
.
now
()),
};
const
[
showConfirmDeleteBtn
,
toggleConfirmDeleteBtn
]
=
useToggle
(
false
);
const
imageUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[]);
const
imageUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[])
.
map
((
s
)
=>
s
.
replace
(
IMAGE_URL_REG
,
"$1"
))
;
const
handleDeleteMemoClick
=
async
()
=>
{
if
(
showConfirmDeleteBtn
)
{
...
...
web/src/components/Memo.tsx
View file @
f80f0f24
...
...
@@ -23,7 +23,7 @@ const Memo: React.FC<Props> = (props: Props) => {
createdAtStr
:
utils
.
getDateTimeString
(
propsMemo
.
createdTs
),
};
const
[
showConfirmDeleteBtn
,
toggleConfirmDeleteBtn
]
=
useToggle
(
false
);
const
imageUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[]);
const
imageUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[])
.
map
((
s
)
=>
s
.
replace
(
IMAGE_URL_REG
,
"$1"
))
;
const
handleShowMemoStoryDialog
=
()
=>
{
showMemoCardDialog
(
memo
);
...
...
web/src/components/MemoCardDialog.tsx
View file @
f80f0f24
...
...
@@ -26,7 +26,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
});
const
[
linkMemos
,
setLinkMemos
]
=
useState
<
LinkedMemo
[]
>
([]);
const
[
linkedMemos
,
setLinkedMemos
]
=
useState
<
LinkedMemo
[]
>
([]);
const
imageUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[]);
const
imageUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[])
.
map
((
s
)
=>
s
.
replace
(
IMAGE_URL_REG
,
"$1"
))
;
useEffect
(()
=>
{
const
fetchLinkedMemos
=
async
()
=>
{
...
...
web/src/components/MemoEditor.tsx
View file @
f80f0f24
...
...
@@ -80,7 +80,7 @@ const MemoEditor: React.FC<Props> = () => {
const
file
=
event
.
clipboardData
.
files
[
0
];
const
url
=
await
handleUploadFile
(
file
);
if
(
url
)
{
editorRef
.
current
?.
insertText
(
url
+
" "
);
editorRef
.
current
?.
insertText
(
``
);
}
}
};
...
...
@@ -91,7 +91,7 @@ const MemoEditor: React.FC<Props> = () => {
const
file
=
event
.
dataTransfer
.
files
[
0
];
const
url
=
await
handleUploadFile
(
file
);
if
(
url
)
{
editorRef
.
current
?.
insertText
(
url
);
editorRef
.
current
?.
insertText
(
``
);
}
}
};
...
...
@@ -246,7 +246,7 @@ const MemoEditor: React.FC<Props> = () => {
const
file
=
inputEl
.
files
[
0
];
const
url
=
await
handleUploadFile
(
file
);
if
(
url
)
{
editorRef
.
current
?.
insertText
(
url
);
editorRef
.
current
?.
insertText
(
``
);
}
};
inputEl
.
click
();
...
...
web/src/components/ShareMemoImageDialog.tsx
View file @
f80f0f24
...
...
@@ -20,10 +20,10 @@ const ShareMemoImageDialog: React.FC<Props> = (props: Props) => {
...
propsMemo
,
createdAtStr
:
utils
.
getDateTimeString
(
propsMemo
.
createdTs
),
};
const
memoImgUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[]
);
const
imageUrls
=
Array
.
from
(
memo
.
content
.
match
(
IMAGE_URL_REG
)
??
[]).
map
((
s
)
=>
s
.
replace
(
IMAGE_URL_REG
,
"$1"
)
);
const
[
shortcutImgUrl
,
setShortcutImgUrl
]
=
useState
(
""
);
const
[
imgAmount
,
setImgAmount
]
=
useState
(
memoImg
Urls
.
length
);
const
[
imgAmount
,
setImgAmount
]
=
useState
(
image
Urls
.
length
);
const
memoElRef
=
useRef
<
HTMLDivElement
>
(
null
);
useEffect
(()
=>
{
...
...
@@ -81,9 +81,9 @@ const ShareMemoImageDialog: React.FC<Props> = (props: Props) => {
</
Only
>
<
span
className=
"time-text"
>
{
memo
.
createdAtStr
}
</
span
>
<
div
className=
"memo-content-text"
dangerouslySetInnerHTML=
{
{
__html
:
formatMemoContent
(
memo
.
content
)
}
}
></
div
>
<
Only
when=
{
memoImg
Urls
.
length
>
0
}
>
<
Only
when=
{
image
Urls
.
length
>
0
}
>
<
div
className=
"images-container"
>
{
memoImg
Urls
.
map
((
imgUrl
,
idx
)
=>
(
{
image
Urls
.
map
((
imgUrl
,
idx
)
=>
(
<
img
crossOrigin=
"anonymous"
decoding=
"async"
...
...
web/src/helpers/consts.ts
View file @
f80f0f24
...
...
@@ -17,7 +17,7 @@ export const TAG_REG = /#(.+?) /g;
export
const
LINK_REG
=
/
(
https
?
:
\/\/[^\s
<
\\
*>'
]
+
)
/g
;
// image regex
export
const
IMAGE_URL_REG
=
/
([^\s
<
\\
*>'
]
+
\.(
jpeg|jpg|gif|png|svg|webp
)
)
/g
;
export
const
IMAGE_URL_REG
=
/
!
\[
.*
?\]\((
.+
?)\
)
/g
;
// linked memo regex
export
const
MEMO_LINK_REG
=
/
\[
@
(
.+
?)\]\((
.+
?)\)
/g
;
web/src/less/daily-memo-diary-dialog.less
View file @
f80f0f24
...
...
@@ -20,7 +20,7 @@
}
&.share-btn {
@apply
w-5 h-auto
;
@apply
~"p-0.5"
;
}
}
}
...
...
web/src/less/memo-content.less
View file @
f80f0f24
...
...
@@ -5,7 +5,7 @@
@apply w-full whitespace-pre-wrap break-words;
> p {
@apply inline-block w-full h-auto mb-1 text-base leading-7 whitespace-pre-wrap break-words;
@apply inline-block w-full h-auto mb-1
last:mb-0
text-base leading-7 whitespace-pre-wrap break-words;
}
.tag-span {
...
...
web/src/less/memo.less
View file @
f80f0f24
...
...
@@ -2,7 +2,7 @@
@import "./memo-content.less";
.memo-wrapper {
@apply flex flex-col justify-start items-start w-full max-w-full p-
3 px-4
mt-2 bg-white rounded-lg border border-white hover:border-gray-200;
@apply flex flex-col justify-start items-start w-full max-w-full p-
4 pt-3
mt-2 bg-white rounded-lg border border-white hover:border-gray-200;
&.deleted-memo {
@apply border-gray-200;
...
...
@@ -13,7 +13,7 @@
}
> .memo-top-wrapper {
@apply flex flex-row justify-between items-center w-full h-6 mb-
2
;
@apply flex flex-row justify-between items-center w-full h-6 mb-
1
;
> .time-text {
@apply text-xs text-gray-400 cursor-pointer;
...
...
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