FIX: Couldn't like via keyboard
This commit is contained in:
parent
befae52c09
commit
363cf5c5da
|
@ -28,7 +28,7 @@ const bindings = {
|
||||||
'home': {handler: 'goToFirstPost', anonymous: true},
|
'home': {handler: 'goToFirstPost', anonymous: true},
|
||||||
'j': {handler: 'selectDown', anonymous: true},
|
'j': {handler: 'selectDown', anonymous: true},
|
||||||
'k': {handler: 'selectUp', anonymous: true},
|
'k': {handler: 'selectUp', anonymous: true},
|
||||||
'l': {click: '.topic-post.selected button[data-action="like"]'},
|
'l': {click: '.topic-post.selected button.toggle-like'},
|
||||||
'm m': {click: 'div.notification-options li[data-id="0"] a'}, // mark topic as muted
|
'm m': {click: 'div.notification-options li[data-id="0"] a'}, // mark topic as muted
|
||||||
'm r': {click: 'div.notification-options li[data-id="1"] a'}, // mark topic as regular
|
'm r': {click: 'div.notification-options li[data-id="1"] a'}, // mark topic as regular
|
||||||
'm t': {click: 'div.notification-options li[data-id="2"] a'}, // mark topic as tracking
|
'm t': {click: 'div.notification-options li[data-id="2"] a'}, // mark topic as tracking
|
||||||
|
@ -312,12 +312,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($article.is('.topic-post')) {
|
if ($article.is('.topic-post')) {
|
||||||
let tabLoc = $article.find('a.tabLoc');
|
$('a.tabLoc', $article).focus();
|
||||||
if (tabLoc.length === 0) {
|
|
||||||
tabLoc = $('<a href class="tabLoc"></a>');
|
|
||||||
$article.prepend(tabLoc);
|
|
||||||
}
|
|
||||||
tabLoc.focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._scrollList($article, direction);
|
this._scrollList($article, direction);
|
||||||
|
|
|
@ -26,14 +26,21 @@ function registerButton(name, builder) {
|
||||||
|
|
||||||
registerButton('like', attrs => {
|
registerButton('like', attrs => {
|
||||||
if (!attrs.showLike) { return; }
|
if (!attrs.showLike) { return; }
|
||||||
const className = attrs.liked ? 'has-like fade-out' : 'like';
|
const className = attrs.liked ? 'toggle-like has-like fade-out' : 'toggle-like like';
|
||||||
|
|
||||||
|
const button = {
|
||||||
|
action: 'like',
|
||||||
|
icon: 'heart',
|
||||||
|
className
|
||||||
|
};
|
||||||
|
|
||||||
if (attrs.canToggleLike) {
|
if (attrs.canToggleLike) {
|
||||||
const descKey = attrs.liked ? 'post.controls.undo_like' : 'post.controls.like';
|
button.title = attrs.liked ? 'post.controls.undo_like' : 'post.controls.like';
|
||||||
return { action: 'like', title: descKey, icon: 'heart', className };
|
|
||||||
} else if (attrs.liked) {
|
} else if (attrs.liked) {
|
||||||
return { action: 'like', title: 'post.controls.has_liked', icon: 'heart', className, disabled: true };
|
button.title = 'post.controls.has_liked';
|
||||||
|
button.disabled = true;
|
||||||
}
|
}
|
||||||
|
return button;
|
||||||
});
|
});
|
||||||
|
|
||||||
registerButton('like-count', attrs => {
|
registerButton('like-count', attrs => {
|
||||||
|
|
|
@ -315,7 +315,7 @@ createWidget('post-article', {
|
||||||
},
|
},
|
||||||
|
|
||||||
html(attrs, state) {
|
html(attrs, state) {
|
||||||
const rows = [];
|
const rows = [h('a.tabLoc')];
|
||||||
if (state.repliesAbove.length) {
|
if (state.repliesAbove.length) {
|
||||||
const replies = state.repliesAbove.map(p => this.attach('embedded-post', p, { state: { above: true } }));
|
const replies = state.repliesAbove.map(p => this.attach('embedded-post', p, { state: { above: true } }));
|
||||||
rows.push(h('div.row', h('section.embedded-posts.top.topic-body.offset2', replies)));
|
rows.push(h('div.row', h('section.embedded-posts.top.topic-body.offset2', replies)));
|
||||||
|
|
Loading…
Reference in New Issue