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
8cfcd201
Unverified
Commit
8cfcd201
authored
Nov 24, 2022
by
boojack
Committed by
GitHub
Nov 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support display video (#558)
parent
abcd3cfa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
14 deletions
+23
-14
MemoResources.tsx
web/src/components/MemoResources.tsx
+18
-9
memo-resources.less
web/src/less/memo-resources.less
+5
-5
No files found.
web/src/components/MemoResources.tsx
View file @
8cfcd201
...
@@ -21,25 +21,34 @@ const MemoResources: React.FC<Props> = (props: Props) => {
...
@@ -21,25 +21,34 @@ const MemoResources: React.FC<Props> = (props: Props) => {
...
getDefaultProps
(),
...
getDefaultProps
(),
...
props
,
...
props
,
};
};
const
imageList
=
resourceList
.
filter
((
resource
)
=>
resource
.
type
.
includes
(
"image
"
));
const
availableResourceList
=
resourceList
.
filter
((
resource
)
=>
resource
.
type
.
startsWith
(
"image"
)
||
resource
.
type
.
startsWith
(
"video
"
));
const
otherResourceList
=
resourceList
.
filter
((
resource
)
=>
!
resource
.
type
.
includes
(
"image"
));
const
otherResourceList
=
resourceList
.
filter
((
resource
)
=>
!
availableResourceList
.
includes
(
resource
));
const
handlPreviewBtnClick
=
(
resource
:
Resource
)
=>
{
const
handlPreviewBtnClick
=
(
resource
:
Resource
)
=>
{
const
resourceUrl
=
`
${
window
.
location
.
origin
}
/o/r/
${
resource
.
id
}
/
${
resource
.
filename
}
`
;
const
resourceUrl
=
`
${
window
.
location
.
origin
}
/o/r/
${
resource
.
id
}
/
${
resource
.
filename
}
`
;
window
.
open
(
resourceUrl
);
window
.
open
(
resourceUrl
);
};
};
const
imgUrls
=
imageList
.
map
((
resource
)
=>
{
const
imgUrls
=
availableResourceList
return
`/o/r/
${
resource
.
id
}
/
${
resource
.
filename
}
`
;
.
filter
((
resource
)
=>
resource
.
type
.
startsWith
(
"image"
))
});
.
map
((
resource
)
=>
{
return
`/o/r/
${
resource
.
id
}
/
${
resource
.
filename
}
`
;
});
return
(
return
(
<
div
className=
{
`resource-wrapper ${className || ""}`
}
>
<
div
className=
{
`resource-wrapper ${className || ""}`
}
>
{
imag
eList
.
length
>
0
&&
(
{
availableResourc
eList
.
length
>
0
&&
(
<
div
className=
{
`images-wrapper ${style}`
}
>
<
div
className=
{
`images-wrapper ${style}`
}
>
{
imageList
.
map
((
resource
,
index
)
=>
(
{
availableResourceList
.
map
((
resource
)
=>
{
<
Image
className=
"memo-img"
key=
{
resource
.
id
}
imgUrls=
{
imgUrls
}
index=
{
index
}
/>
const
url
=
`/o/r/${resource.id}/${resource.filename}`
;
))
}
if
(
resource
.
type
.
startsWith
(
"image"
))
{
return
(
<
Image
className=
"memo-resource"
key=
{
resource
.
id
}
imgUrls=
{
imgUrls
}
index=
{
imgUrls
.
findIndex
((
item
)
=>
item
===
url
)
}
/>
);
}
else
{
return
<
video
className=
"memo-resource"
controls
key=
{
resource
.
id
}
src=
{
url
}
/>;
}
})
}
</
div
>
</
div
>
)
}
)
}
<
div
className=
"other-resource-wrapper"
>
<
div
className=
"other-resource-wrapper"
>
...
...
web/src/less/memo-resources.less
View file @
8cfcd201
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
> .images-wrapper {
> .images-wrapper {
@apply w-full flex mt-2 pb-1;
@apply w-full flex mt-2 pb-1;
> .memo-
img
{
> .memo-
resource
{
@apply w-auto h-auto shrink-0 grow-0 cursor-pointer;
@apply w-auto h-auto shrink-0 grow-0 cursor-pointer
rounded
;
> img {
> img {
@apply rounded hover:shadow;
@apply rounded hover:shadow;
...
@@ -15,8 +15,8 @@
...
@@ -15,8 +15,8 @@
&.row {
&.row {
@apply flex-row justify-start items-start overflow-x-auto overflow-y-hidden;
@apply flex-row justify-start items-start overflow-x-auto overflow-y-hidden;
> .memo-
img
{
> .memo-
resource
{
@apply max-w-xs h-auto mr-2 last:mr-0;
@apply max-w-xs h-auto m
ax-h-40 m
r-2 last:mr-0;
> img {
> img {
@apply w-auto max-h-40;
@apply w-auto max-h-40;
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
&.col {
&.col {
@apply flex-col justify-start items-start;
@apply flex-col justify-start items-start;
> .memo-
img
{
> .memo-
resource
{
@apply w-full h-auto mb-2 last:mb-0;
@apply w-full h-auto mb-2 last:mb-0;
> img {
> img {
...
...
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