diff options
| author | Tusooa Zhu <tusooa@kazv.moe> | 2021-08-11 00:12:16 -0400 |
|---|---|---|
| committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-03-07 19:19:30 -0500 |
| commit | f1db5e8f4bfc8d43eb74d0e3f784c0aa8b06bf3f (patch) | |
| tree | 52309a20406057267dbc8412c4304a8875f339fd /src/components/conversation/conversation.js | |
| parent | d78c8e8ea4c1b5a9801552b519573037564a8f66 (diff) | |
Highlight ancestor of the current status when diving back to top
Diffstat (limited to 'src/components/conversation/conversation.js')
| -rw-r--r-- | src/components/conversation/conversation.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 817b9bda..e9bbca18 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -441,7 +441,7 @@ const conversation = { this.tryScrollTo(id) }, diveToTopLevel () { - this.tryScrollTo(this.topLevel[0].id) + this.tryScrollTo(this.topLevelAncestorOrSelfId(this.diveRoot) || this.topLevel[0].id) }, // only used when we are not on a page undive () { @@ -490,6 +490,15 @@ const conversation = { } // console.log('ancestors = ', ancestors, 'conversation = ', this.conversation.map(k => k.id), 'statusContentProperties=', this.statusContentProperties) return ancestors + }, + topLevelAncestorOrSelfId (id) { + let cur = id + let parent = this.parentOf(id) + while (parent) { + cur = this.parentOf(cur) + parent = this.parentOf(parent) + } + return cur } } } |
