How do you specify the starting path when launching the FileBrowser component from Jodit?

27 Views Asked by At

When launching a FileBrowser component with Jodit that has multiple sources on the back end how do you specify your "starting source" and/or "starting path"

function LaunchFinder() {
   const fb = new Jodit.modules.FileBrowser({
     ajax: {
       url: 'http://localhost/access/',
     },
     uploader: {
       url: 'http://localhost/access/?action=fileUpload'
     }
   });
   fb.open((images) => {
      console.log('Selected:', images);
   }, false); // true - show only images
}

In this case, there are 3 sources defined for the back end:

'sources' : {
           'Area One' : {
                'root' : '/tmp/ROOT/abc/',
                'baseurl' : 'http://localhost:8000/ROOT/abc/',
                'maxFileSize' : '100kb',
                'createThumb' : False,
                'extensions' : ['jpg','txt']
            },
           'Area Two' : {
                'root' : '/tmp/ROOT/xxx/',
                'baseurl' : 'http://localhost:8000/ROOT/xxx/',
                'maxFileSize' : '100kb',
                'createThumb' : False,
                'extensions' : ['jpg','txt']
            },
            'More Files' : {
                'title': "Cool Files Here",
                'root' : '/tmp/ROOT2/',
                'baseurl' : 'http://localhost:8000/ROOT2/',
                'maxFileSize' : '100kb',
                'createThumb' : False,
            }
        }

The FileBrowser module does not seem to take any parameters as documented here: https://xdsoft.net/jodit/docs/modules/file_browser.html

ideally, something in the config would set the staring path, like

function LaunchFinder() {
   const fb = new Jodit.modules.FileBrowser({
     
     source: "Area One",
     path: "/"

     ajax: {
       url: 'http://localhost/access/',
     },
     uploader: {
       url: 'http://localhost/access/?action=fileUpload'
     }
   });
   fb.open((images) => {
      console.log('Selected:', images);
   }, false); // true - show only images
}
0

There are 0 best solutions below