UX: Keyboard shortcuts will automatically select hovered post

This commit is contained in:
Bianca Nenciu 2018-08-22 07:47:17 +02:00 committed by Sam
parent cdea969c6a
commit 758fae7f9f
1 changed files with 5 additions and 1 deletions

View File

@ -297,10 +297,14 @@ export default {
sendToSelectedPost(action) {
const container = this.container;
// 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"),
10
);
if (!selectedPostId) {
// If no post was selected, automatically select the hovered post.
selectedPostId = parseInt($("article.boxed:hover").data("post-id"), 10);
}
if (selectedPostId) {
const topicController = container.lookup("controller:topic");
const post = topicController