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
35a88174
Unverified
Commit
35a88174
authored
Oct 18, 2022
by
boojack
Committed by
GitHub
Oct 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: memo list auto scroll to top (#313)
fix: editor initial content
parent
c7378e78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
Editor.tsx
web/src/components/Editor/Editor.tsx
+1
-0
MemoList.tsx
web/src/components/MemoList.tsx
+6
-6
No files found.
web/src/components/Editor/Editor.tsx
View file @
35a88174
...
...
@@ -29,6 +29,7 @@ const Editor = forwardRef((props: Props, ref: React.ForwardedRef<EditorRefAction
useEffect
(()
=>
{
if
(
editorRef
.
current
&&
initialContent
)
{
editorRef
.
current
.
value
=
initialContent
;
handleContentChangeCallback
(
initialContent
);
}
},
[]);
...
...
web/src/components/MemoList.tsx
View file @
35a88174
import
{
useEffect
,
useRef
}
from
"react"
;
import
{
useEffect
}
from
"react"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
memoService
,
shortcutService
}
from
"../services"
;
import
{
useAppSelector
}
from
"../store"
;
...
...
@@ -13,7 +13,6 @@ const MemoList = () => {
const
{
t
}
=
useTranslation
();
const
query
=
useAppSelector
((
state
)
=>
state
.
location
.
query
);
const
{
memos
,
isFetching
}
=
useAppSelector
((
state
)
=>
state
.
memo
);
const
wrapperElement
=
useRef
<
HTMLDivElement
>
(
null
);
const
{
tag
:
tagQuery
,
duration
,
type
:
memoType
,
text
:
textQuery
,
shortcutId
}
=
query
??
{};
const
shortcut
=
shortcutId
?
shortcutService
.
getShortcutById
(
shortcutId
)
:
null
;
...
...
@@ -86,13 +85,14 @@ const MemoList = () => {
}
, []);
useEffect(() =
>
{
wrapperElement
.
current
?.
scrollTo
({
top
:
0
,
});
const
pageWrapper
=
document
.
body
.
querySelector
(
".page-wrapper"
);
if
(
pageWrapper
)
{
pageWrapper
.
scrollTo
(
0
,
0
);
}
}
, [query]);
return (
<
div
className=
"memo-list-container"
ref=
{
wrapperElement
}
>
<
div
className=
"memo-list-container"
>
{
sortedMemos
.
map
((
memo
)
=>
(
<
Memo
key=
{
`${memo.id}-${memo.createdTs}-${memo.updatedTs}`
}
memo=
{
memo
}
/>
))
}
...
...
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