Module for working with remote images or just files. Allows you to upload / delete / rename files on the server.
A prerequisite for the module to work is the server side. Jodit offers its own implementation in php jodit-connectors. The module will not work without the server side.
You can write the backend yourself, it must support API
Module settings allow you to override behavior for your server-side implementation.
For example, by default, the server side returns a list of files in this format:
In this case, you can add the setting [[IFileBrowser.ajax.process]] or define the same setting for a specific handle,
for example, to get a list [[IFileBrowser.items]]
but in that case all the responses of the all endpoints will be processed by this function. Better to handle the response for a specific handle:
Jodit.make('#editor',{ filebrowser:{ ajax:{ url:'https://sitename.com/connector/index.php' }, // a request for a list of files will be handled in a special way items:{ process:resp=>{ return{ success:true, time:'2021-12-23 16:30:01', data:{ sources: [ { baseurl: 'https://xdsoft.net/jodit/finder/files/', path:'/folder/somepath/', files:resp, name:'default' } ], code:220 } }; } } } });
filebrowser.view='tiles' Filelist view - tiles or list
filebrowser.ajax The default settings for AJAX connections to the server.
Most of the settings like here jQuery.ajax but is not jQuery.ajax
filebrowser.ajax.prepareData Method of preparation
of data to be sent to the server
filebrowser.ajax.process The method of processing the
data obtained after administration of the server. Must return this PlainObject format
constresponse={ files:resp.files|| [],// {array} The names of files or folders, // files canbe ['image.jpg', 'image.jpg2', 'image3.jpg' ...] and [{file: 'image.jpg', thumb: '_thumbs/image.jpg'}, {file: 'image2.jpg', thumb: '_thumbs/image2.jpg'} ...] path:resp.path,// {string} Real relative path baseurl:resp.baseurl,// {string} Base url for filebrowser error:resp.error,// {int} msg:resp.msg// {string} };
filebrowser.ajax.url='' Address entry point on the server for AJAX connection
filebrowser.ajax.data={} Default data to send to the server
filebrowser.ajax.headers={} An object of additional header key/value pairs toWYSIWYG
send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest
is always added, but its default XMLHttpRequest value can be changed here.
@property {object} filebrowser.resize Settings for AJAX connections to the server to resize
image. By default, the uses [[Config.filebrowser.ajax]] with argument
action=create
filebrowser.crop Settings for AJAX connections to the server to crop image.
By default, the uses [[Config.filebrowser.ajax]] with argument
action=create
filebrowser.c Settings for AJAX connections to the server to create
the category . By default, the uses [[Config.filebrowser.ajax]]
with argument action=create
filebrowser.move Settings for AJAX connections to the server for the moving
image or category . By default uses [[Config.filebrowser.ajax]]
with argument action=move
filebrowser.remove Settings for AJAX connections to the server toWYSIWYG
delete the image or category . By default uses [[Config.filebrowser.ajax]]
with argument action=remove
@property {object} filebrowser.folder Settings for AJAX connections to the server toWYSIWYG
download the list of categories .
By default uses [[Config.filebrowser.ajax]]
with argument action=folder
filebrowser.items Settings for AJAX connections to the server to download
the image list in the specified category . By default uses
[[Config.filebrowser.ajax]] with argument action=items
filebrowser.uploader=null Settings Module [[Uploader]]
for fast uploading images in category via Drag&Drop file in the file browser. The default settings of
the module [[Uploader]]
Jodit filebrowser
Module for working with remote images or just files. Allows you to upload / delete / rename files on the server.
You can write the backend yourself, it must support API Module settings allow you to override behavior for your server-side implementation.
For example, by default, the server side returns a list of files in this format:
But what if your server returns such data for example?
In this case, you can add the setting [[IFileBrowser.ajax.process]] or define the same setting for a specific handle, for example, to get a list [[IFileBrowser.items]]
but in that case all the responses of the all endpoints will be processed by this function. Better to handle the response for a specific handle:
Settings
[ 'filebrowser.upload', 'filebrowser.remove', 'filebrowser.update', 'filebrowser.select', 'filebrowser.edit', '|', 'filebrowser.tiles', 'filebrowser.list', '|', 'filebrowser.filter', '|', 'filebrowser.sort', ]
Example:
tiles
orlist
XMLHttpRequest
transport. The headerX-Requested-With: XMLHttpRequest
is always added, but its defaultXMLHttpRequest
value can be changed here. @property {object}filebrowser.resize
Settings for AJAX connections to the server to resize image. By default, the uses [[Config.filebrowser.ajax]] with argument action=createaction=create
action=move
action=remove
@property {object} filebrowser.folder Settings for AJAX connections to the server toWYSIWYG download the list of categories . By default uses [[Config.filebrowser.ajax]] with argumentaction=folder
Example:
Example:
Example: