File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change 10
10
type =" text"
11
11
name =" notesPath"
12
12
:placeholder =" t('notes', 'Root directory')"
13
- @change = " onChangeSettingsReload "
14
- >< input type = " submit " class = " icon-confirm " value = " " >
13
+ @click = " onChangeNotePath "
14
+ >
15
15
</form >
16
16
</div >
17
17
<div class =" settings-block" >
@@ -51,6 +51,7 @@ import {
51
51
} from ' @nextcloud/vue'
52
52
53
53
import { setSettings } from ' ../NotesService.js'
54
+ import { FilePicker , FilePickerType } from ' @nextcloud/dialogs'
54
55
import store from ' ../store.js'
55
56
56
57
export default {
@@ -89,6 +90,25 @@ export default {
89
90
},
90
91
91
92
methods: {
93
+ onChangeNotePath (input ) {
94
+ // Code Example from: https://github.com/nextcloud/text/blob/main/src/components/Menu/ActionInsertLink.vue#L130-L155
95
+ const filePicker = new FilePicker (
96
+ t (' text' , ' Select folder to link to' ),
97
+ false , // multiselect
98
+ [], // mime filter
99
+ true , // modal
100
+ FilePickerType .Choose , // type
101
+ true , // directories
102
+ ' /' // path
103
+ )
104
+ filePicker .pick ().then ((file ) => {
105
+ const client = OC .Files .getClient ()
106
+ client .getFileInfo (file).then ((_status , fileInfo ) => {
107
+ this .settings .notesPath = fileInfo .path === ' /' ? ` /${ fileInfo .name } ` : ` ${ fileInfo .path } /${ fileInfo .name } `
108
+ this .onChangeSettingsReload ()
109
+ })
110
+ })
111
+ },
92
112
onChangeSettings () {
93
113
this .saving = true
94
114
return setSettings (this .settings )
You can’t perform that action at this time.
0 commit comments