mirror of
https://github.com/discourse/discourse.git
synced 2025-06-08 14:26:21 +08:00
UX: Keyboard shortcuts will automatically select hovered post
This commit is contained in:
@ -297,10 +297,14 @@ export default {
|
|||||||
sendToSelectedPost(action) {
|
sendToSelectedPost(action) {
|
||||||
const container = this.container;
|
const container = this.container;
|
||||||
// TODO: We should keep track of the post without a CSS class
|
// TODO: We should keep track of the post without a CSS class
|
||||||
const selectedPostId = parseInt(
|
let selectedPostId = parseInt(
|
||||||
$(".topic-post.selected article.boxed").data("post-id"),
|
$(".topic-post.selected article.boxed").data("post-id"),
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
|
if (!selectedPostId) {
|
||||||
|
// If no post was selected, automatically select the hovered post.
|
||||||
|
selectedPostId = parseInt($("article.boxed:hover").data("post-id"), 10);
|
||||||
|
}
|
||||||
if (selectedPostId) {
|
if (selectedPostId) {
|
||||||
const topicController = container.lookup("controller:topic");
|
const topicController = container.lookup("controller:topic");
|
||||||
const post = topicController
|
const post = topicController
|
||||||
|
Reference in New Issue
Block a user