mirror of
https://github.com/flarum/framework.git
synced 2024-11-30 13:36:10 +08:00
Fix mobile controls gesture on discussion deletion/restoration (#2324)
Because the Slidable class was always added on creation, it was lost every time the class list changed (in this case when the discussion was hidden/unhidden which added/removed DiscussionListItem--hidden class). So by determining the Slidable class's presence in elementAttrs() method, it guarantees it always properly set.
This commit is contained in:
parent
948ac359dc
commit
922cb8bb11
|
@ -50,6 +50,7 @@ export default class DiscussionListItem extends Component {
|
||||||
'DiscussionListItem',
|
'DiscussionListItem',
|
||||||
this.active() ? 'active' : '',
|
this.active() ? 'active' : '',
|
||||||
this.attrs.discussion.isHidden() ? 'DiscussionListItem--hidden' : '',
|
this.attrs.discussion.isHidden() ? 'DiscussionListItem--hidden' : '',
|
||||||
|
'ontouchstart' in window ? 'Slidable' : '',
|
||||||
]),
|
]),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,7 @@ export default class DiscussionListItem extends Component {
|
||||||
// This allows the user to drag the row to either side of the screen to
|
// This allows the user to drag the row to either side of the screen to
|
||||||
// reveal controls.
|
// reveal controls.
|
||||||
if ('ontouchstart' in window) {
|
if ('ontouchstart' in window) {
|
||||||
const slidableInstance = slidable(this.$().addClass('Slidable'));
|
const slidableInstance = slidable(this.$());
|
||||||
|
|
||||||
this.$('.DiscussionListItem-controls').on('hidden.bs.dropdown', () => slidableInstance.reset());
|
this.$('.DiscussionListItem-controls').on('hidden.bs.dropdown', () => slidableInstance.reset());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user