Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
989e6c9e
Commit
989e6c9e
authored
2 months ago
by
Jan-Hendrik Willms
Browse files
Options
Downloads
Patches
Plain Diff
attach event handler only if posts are present and fix layout bug, fixes #5063
Closes #5063 Merge request
studip/studip!3786
parent
102efecd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
resources/vue/components/blubber/Thread.vue
+37
-19
37 additions, 19 deletions
resources/vue/components/blubber/Thread.vue
with
37 additions
and
19 deletions
resources/vue/components/blubber/Thread.vue
+
37
−
19
View file @
989e6c9e
...
...
@@ -213,33 +213,46 @@ export default {
},
mounted
()
{
this
.
handleDebouncedScroll
=
_
.
debounce
(
this
.
handleScroll
,
100
);
this
.
$refs
.
scrollable
.
addEventListener
(
'
scroll
'
,
this
.
handleDebouncedScroll
);
// when everything is initialized
this
.
$nextTick
(()
=>
{
if
(
this
.
comments
.
length
>
0
)
{
this
.
scrollDown
();
}
const
memory
=
getBlubberMemory
(
this
.
thread
);
if
(
memory
)
{
this
.
composerText
=
memory
;
}
});
},
beforeUnmount
()
{
this
.
$refs
.
scrollable
.
removeEventListener
(
'
scroll
'
,
this
.
handleDebouncedScroll
);
},
beforeUpdate
()
{
const
{
scrollHeight
,
scrollTop
}
=
this
.
$refs
.
scrollable
;
this
.
scrollPosition
=
{
scrollHeight
,
scrollTop
};
if
(
!
this
.
emptyBlubber
)
{
const
{
scrollHeight
,
scrollTop
}
=
this
.
$refs
.
scrollable
;
this
.
scrollPosition
=
{
scrollHeight
,
scrollTop
};
}
},
updated
()
{
// maintain scroll position when loading older comments
const
newScrollTop
=
this
.
$refs
.
scrollable
.
scrollHeight
-
this
.
scrollPosition
.
scrollHeight
+
this
.
scrollPosition
.
scrollTop
;
this
.
$refs
.
scrollable
.
scrollTo
(
0
,
newScrollTop
);
if
(
!
this
.
emptyBlubber
)
{
// maintain scroll position when loading older comments
const
newScrollTop
=
this
.
$refs
.
scrollable
.
scrollHeight
-
this
.
scrollPosition
.
scrollHeight
+
this
.
scrollPosition
.
scrollTop
;
this
.
$refs
.
scrollable
.
scrollTo
(
0
,
newScrollTop
);
}
},
watch
:
{
emptyBlubber
:
{
handler
(
isEmpty
)
{
if
(
!
isEmpty
)
{
this
.
$refs
.
scrollable
.
addEventListener
(
'
scroll
'
,
this
.
handleDebouncedScroll
);
// when everything is initialized
this
.
$nextTick
(()
=>
{
if
(
this
.
comments
.
length
>
0
)
{
this
.
scrollDown
();
}
const
memory
=
getBlubberMemory
(
this
.
thread
);
if
(
memory
)
{
this
.
composerText
=
memory
;
}
});
}
},
immediate
:
true
,
}
}
};
function
clearBlubberMemory
(
thread
)
{
...
...
@@ -258,3 +271,8 @@ function setBlubberMemory(thread, memory) {
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.empty_blubber_background
{
flex
:
1
;
}
</
style
>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment