mirror of
https://github.com/flarum/core.git
synced 2025-07-20 16:21:18 +02: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:
@@ -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());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user