File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
framework/core/js/src/forum/components Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export interface IDiscussionListItemAttrs extends ComponentAttrs {
2929 params : DiscussionListParams ;
3030 jumpTo ?: number ;
3131 author ?: User ;
32+ slidable ?: boolean ;
3233}
3334
3435/**
@@ -62,7 +63,7 @@ export default class DiscussionListItem<CustomAttrs extends IDiscussionListItemA
6263 className : classList ( 'DiscussionListItem' , this . attrs . className , {
6364 active : this . active ( ) ,
6465 'DiscussionListItem--hidden' : this . attrs . discussion . isHidden ( ) ,
65- Slidable : 'ontouchstart' in window ,
66+ Slidable : this . isSlidableEnabled ( ) ,
6667 } ) ,
6768 } ;
6869 }
@@ -212,13 +213,21 @@ export default class DiscussionListItem<CustomAttrs extends IDiscussionListItemA
212213 return jumpTo ;
213214 }
214215
216+ protected isSlidableEnabled ( ) : boolean {
217+ if ( this . attrs . slidable === false ) {
218+ return false ;
219+ }
220+
221+ return 'ontouchstart' in window ;
222+ }
223+
215224 oncreate ( vnode : Mithril . VnodeDOM < CustomAttrs , this> ) {
216225 super . oncreate ( vnode ) ;
217226
218227 // If we're on a touch device, set up the discussion row to be slidable.
219228 // This allows the user to drag the row to either side of the screen to
220229 // reveal controls.
221- if ( 'ontouchstart' in window ) {
230+ if ( this . isSlidableEnabled ( ) ) {
222231 const slidableInstance = slidable ( this . element ) ;
223232
224233 this . $ ( '.DiscussionListItem-controls' ) . on ( 'hidden.bs.dropdown' , ( ) => slidableInstance . reset ( ) ) ;
You can’t perform that action at this time.
0 commit comments