38
38
<ion-content
39
39
ref =" browserContent"
40
40
class =" ion-padding"
41
+ :scroll-events =" true"
42
+ @ionScroll =" logScroll($event)"
41
43
v-if =" (files.cwd || files.collection_id) && connectionState"
42
44
>
43
45
<ion-list >
127
129
</ion-item >
128
130
</ion-list >
129
131
</ion-content >
132
+ <ion-fab
133
+ v-if =" scrollToTopEnabled"
134
+ vertical =" bottom"
135
+ horizontal =" end"
136
+ slot =" fixed"
137
+ @click =" onScrollToTopClicked"
138
+ >
139
+ <ion-fab-button >
140
+ <ion-icon :icon =" arrowUp" ></ion-icon >
141
+ </ion-fab-button >
142
+ </ion-fab >
143
+
130
144
<ion-footer v-if =" showOpenFolder" >
131
145
<ion-button
132
146
:disabled =" !files.cwd"
@@ -164,11 +178,13 @@ import {
164
178
alertController ,
165
179
IonInfiniteScroll ,
166
180
IonInfiniteScrollContent ,
181
+ IonFab ,
182
+ IonFabButton ,
167
183
} from " @ionic/vue" ;
168
184
import {
185
+ arrowUp ,
169
186
folder ,
170
187
document ,
171
- add ,
172
188
fileTray ,
173
189
bookmarksOutline ,
174
190
musicalNotes ,
@@ -198,6 +214,9 @@ export default {
198
214
const INFINITE_SCROLL_STEP = 100 ;
199
215
const infiniteScrollEnabled = ref (false );
200
216
217
+ // Scroll to top
218
+ const scrollToTopEnabled = ref (false );
219
+
201
220
const filesBak = ref ([]);
202
221
const collections = ref ([]);
203
222
const search = ref (" " );
@@ -206,7 +225,6 @@ export default {
206
225
207
226
const showOpenFolder = ref (props .action === FileBrowserActions .OPENFOLDER );
208
227
const drives = ref ([]);
209
-
210
228
const filemanLastPath = store .state .settings .filemanLastPath ;
211
229
const sortBy = ref (FileBrowserSortBy .NAME );
212
230
@@ -516,7 +534,7 @@ export default {
516
534
const onSortByClicked = async () => {
517
535
const alert = await alertController .create ({
518
536
header: " Sort by" ,
519
- cssClass: " alert " ,
537
+ cssClass: " alertbox " ,
520
538
inputs: [
521
539
{
522
540
type: " radio" ,
@@ -563,8 +581,18 @@ export default {
563
581
}
564
582
};
565
583
584
+ const logScroll = async (event ) => {
585
+ if (event .detail .scrollTop > 0 ) scrollToTopEnabled .value = true ;
586
+ else scrollToTopEnabled .value = false ;
587
+ };
588
+
589
+ const onScrollToTopClicked = () => {
590
+ browserContent .value .$el .scrollToPoint (0 , 0 , 500 );
591
+ };
592
+
566
593
loadFileBrowser ();
567
594
return {
595
+ logScroll,
568
596
onCancelClicked,
569
597
onPrevDirectoryClicked,
570
598
onOpenDirectoryClicked,
@@ -574,6 +602,9 @@ export default {
574
602
decideIcon,
575
603
onCollectionsClicked,
576
604
getDirectoryContents,
605
+ onSortByClicked,
606
+ onInfiniteScroll,
607
+ onScrollToTopClicked,
577
608
browsableFiles,
578
609
connectionState: computed (
579
610
() => store .getters [" simpleapi/connectionState" ]
@@ -584,7 +615,6 @@ export default {
584
615
files,
585
616
folder,
586
617
document ,
587
- add,
588
618
fileTray,
589
619
bookmarksOutline,
590
620
search,
@@ -595,11 +625,11 @@ export default {
595
625
drives,
596
626
serverConfig,
597
627
funnelOutline,
598
- onSortByClicked,
599
- onInfiniteScroll,
600
628
infiniteScrollEnabled,
601
629
browserContent,
602
630
arrowBackSharp,
631
+ arrowUp,
632
+ scrollToTopEnabled,
603
633
};
604
634
},
605
635
components: {
@@ -619,6 +649,8 @@ export default {
619
649
IonListHeader,
620
650
IonInfiniteScroll,
621
651
IonInfiniteScrollContent,
652
+ IonFab,
653
+ IonFabButton,
622
654
},
623
655
};
624
656
</script >
@@ -630,7 +662,7 @@ ion-footer {
630
662
}
631
663
632
664
ion-footer ion-button {
633
- width : 120px ;
665
+ min- width : 120px ;
634
666
}
635
667
636
668
.fileformatSubtitle {
0 commit comments