# 编号列表中的新行导致跳转到编辑器底部

**URL:** <https://meta.discourse.org/t/new-line-in-a-numbered-list-causes-a-jump-to-the-bottom-of-the-composer/316612>\
**Category:** Bug\
**Tags:** fixed\
**Created:** [2024年七月16日 17:18 UTC](https://meta.discourse.org/t/new-line-in-a-numbered-list-causes-a-jump-to-the-bottom-of-the-composer/316612 "2024-07-16T17:18:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)\
**Post date:** [2024年七月16日 17:18 UTC](https://meta.discourse.org/t/new-line-in-a-numbered-list-causes-a-jump-to-the-bottom-of-the-composer/316612/1 "2024-07-16T17:18:20Z")

</div>

在长文本的编号列表中添加新行时，编辑器会滚动到最底部。

---

<div class="post-metadata">

**Author:** ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)\
**Post date:** [2024年八月26日 00:47 UTC](https://meta.discourse.org/t/new-line-in-a-numbered-list-causes-a-jump-to-the-bottom-of-the-composer/316612/2 "2024-08-26T00:47:09Z")

</div>

我现在无法重现此问题

---

<div class="post-metadata">

**Author:** ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)\
**Post date:** [2024年八月26日 06:23 UTC](https://meta.discourse.org/t/new-line-in-a-numbered-list-causes-a-jump-to-the-bottom-of-the-composer/316612/3 "2024-08-26T06:23:29Z")

</div>

我刚刚在 [My Wiki of useful Meta (and other) links](https://meta.discourse.org/t/my-wiki-of-useful-meta-and-other-links/290591?silent=true) 的编号列表中重现了此问题

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [2024年八月26日 12:31 UTC](https://meta.discourse.org/t/new-line-in-a-numbered-list-causes-a-jump-to-the-bottom-of-the-composer/316612/4 "2024-08-26T12:31:15Z")

</div>

是的，我确认可以重现此问题。

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [2024年八月26日 16:33 UTC](https://meta.discourse.org/t/new-line-in-a-numbered-list-causes-a-jump-to-the-bottom-of-the-composer/316612/5 "2024-08-26T16:33:08Z")

</div>

将在以下位置修复：

> <https://github.com/discourse/discourse/pull/28554>
>
> Prior to this fix using:
> 
> \- \`replaceText(...)\`
> \- \`selectText(..., ..., { scro…ll: true})\`
> 
> Wouldn't have the expected behaviour as the scroll from selectText will attempt to save the scroll position and restore it AFTER the replacement happened. This commit allows scroll to be a Boolean or a Number, when a number, it will be used to restore the scrollTop position.
> 
> I tried to write tests for this specific behavior but couldn't reproduce the issue in tests.

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [2024年八月29日 16:34 UTC](https://meta.discourse.org/t/new-line-in-a-numbered-list-causes-a-jump-to-the-bottom-of-the-composer/316612/6 "2024-08-29T16:34:06Z")

</div>

此主题在上次回复后 3 天自动关闭。不允许新的回复。
