“Esc”键盘快捷键在编辑模式下无法正常工作

How to reproduce:

  1. Go to one of your post and click Edit to open the composer. Don’t type anything.
  2. Press the Esc key => as expected, the composer disappears completely (it isn’t minimized, because the post hasn’t been modified).
  3. Refresh the browser page => the composer comes back.

In step 2, if you click the Cancel button instead of pressing the Esc key, the behavior is correct, i.e. the composer doesn’t come back after browser refresh.

5 个赞

@jack2

I just did it, Yes it does exactly what you say. Not sure if it’s a bug or its suppose to do this actually.

3 个赞

我已经无法复现这个问题了,请问您还能在 try.discourse.org 上复现吗?

是的,我刚刚在 try.discourse.org 上复现了这个问题。

等等!这是随机的!有时它不会出现。

您能找到一致的复现步骤吗?我有一个修复思路,但最好能有稳定的复现方法。拜托了。

1 个赞

这是一个可稳定复现的问题:

  1. 进入您的某篇帖子,点击“编辑”以打开编辑器。不要输入任何内容。
  2. 等待几秒钟,直到编辑器右下角出现一个对勾图标
  3. 按下 Esc 键 => 预期情况下,编辑器会完全消失(由于帖子未被修改,因此不会最小化)。
  4. 刷新浏览器页面 => 编辑器重新出现。
2 个赞

太好了!好的,所以我的修复方案应该能行,非常感谢 :heart:

3 个赞

这比预期的要棘手得多,我想这应该能解决问题:

我已经请求了多次代码审查,合并可能需要一些时间。再次感谢您提供详细的复现步骤:+1

5 个赞

快速更新:我刚关闭了 PR。修复方案是有效的,但我们打算在更高层级进行修复。

这可能需要一些时间 :slight_smile:

4 个赞

我做了这个修复:

这个文件超级棘手 @eviltrout……我们真希望能尽快支持 async,因为一大堆方法有时返回 Promise,有时返回对象,这让逻辑变得非常难以理解。

目前,我引入了一些 Promise 和绕过机制,确保在点击编辑按钮后不会立即保存草稿。这也让 @supermathie 抓狂,因为它使得从 N 条回复中复制文本到原帖变得非常复杂和烦人。

7 个赞

这解释了我之前遇到的许多挫败感,:clap:

4 个赞

此主题在最后一次回复后 4 天自动关闭。不再允许新回复。