IUploaderOptions
types.IUploaderOptions
Type parameters
| Name |
|---|
T |
url
url: string | (request: string | IDictionary<string> | FormData) => string
Defined in
insertImageAsBase64URI
insertImageAsBase64URI: boolean
Defined in
imagesExtensions
imagesExtensions: string[]
List of extensions for images
Default
['jpg', 'png', 'jpeg', 'gif']
Example
Jodit.make('#editor', {
uploader: {
insertImageAsBase64URI: true,
imagesExtensions: ['jpg', 'png', 'jpeg', 'gif', 'svg', 'webp']
}
});
Defined in
headers
Optional headers: null | IDictionary<string> | (this: IAjax<any>) => CanPromise<null | IDictionary<string>>
Defined in
data
data: null | object
Defined in
format
format: string
Defined in
method
method: string
Defined in
filesVariableName
filesVariableName: (i: number) => string
Type declaration
(i): string
Parameters
| Name | Type |
|---|---|
i |
number |
Returns
string
Defined in
pathVariableName
pathVariableName: string
Defined in
withCredentials
withCredentials: boolean
Defined in
prepareData
prepareData: (this: T, formData: FormData) => any
Type declaration
(this, formData): any
Parameters
| Name | Type |
|---|---|
this |
T |
formData |
FormData |
Returns
any
Defined in
buildData
Optional buildData: (this: T, formData: any) => BuildDataResult
Type declaration
(this, formData): BuildDataResult
Parameters
| Name | Type |
|---|---|
this |
T |
formData |
any |
Returns
Defined in
queryBuild
Optional queryBuild: (obj: string | FormData | IDictionary<string | object>, prefix?: string) => string | FormData
Type declaration
(obj, prefix?): string | FormData
Parameters
| Name | Type |
|---|---|
obj |
string | FormData | IDictionary<string | object> |
prefix? |
string |
Returns
string | FormData
Defined in
isSuccess
isSuccess: (this: T, resp: IUploaderAnswer) => boolean
Type declaration
(this, resp): boolean
Parameters
| Name | Type |
|---|---|
this |
T |
resp |
IUploaderAnswer |
Returns
boolean
Defined in
getMessage
getMessage: (this: T, resp: IUploaderAnswer) => string
Type declaration
(this, resp): string
Parameters
| Name | Type |
|---|---|
this |
T |
resp |
IUploaderAnswer |
Returns
string
Defined in
process
process: (this: T, resp: IUploaderAnswer) => IUploaderData
Type declaration
(this, resp): IUploaderData
Parameters
| Name | Type |
|---|---|
this |
T |
resp |
IUploaderAnswer |
Returns
Defined in
error
error: (this: T, e: Error) => void
Type declaration
(this, e): void
Parameters
| Name | Type |
|---|---|
this |
T |
e |
Error |
Returns
void
Defined in
defaultHandlerSuccess
defaultHandlerSuccess: HandlerSuccess
Defined in
defaultHandlerError
defaultHandlerError: HandlerError
Defined in
contentType
contentType: (this: T, requestData: any) => string | false
Type declaration
(this, requestData): string | false
Parameters
| Name | Type |
|---|---|
this |
T |
requestData |
any |
Returns
string | false
Defined in
customUploadFunction
Optional customUploadFunction: (requestData: any, showProgress: (progress: number) => void) => Promise<IUploaderAnswer>
This method can be used to replace the function of uploading files
Jodit.make('#editor', {
uploader: {
customUploadFunction: (requestData, showProgress) => fetch(requestData).then((res)=>{
showProgress(100)
return res.json()
})
}
});
Type declaration
(requestData, showProgress): Promise<IUploaderAnswer>
This method can be used to replace the function of uploading files
Jodit.make('#editor', {
uploader: {
customUploadFunction: (requestData, showProgress) => fetch(requestData).then((res)=>{
showProgress(100)
return res.json()
})
}
});
Parameters
| Name | Type |
|---|---|
requestData |
any |
showProgress |
(progress: number) => void |
Returns
Defined in
processFileName
processFileName(this, key, file, name): [string, File, string]
The method can be used to change the name of the uploaded file
This is the name the file will have when it is sent to the server
Jodit.make('#editor', {
uploader: {
url: 'some-connector.php',
processFileName: (key, file, name) => {
return [key, file, 'some-prefix_' + name];
}
}
});
Parameters
| Name | Type |
|---|---|
this |
T |
key |
string |
file |
File |
name |
string |
Returns
[string, File, string]
Defined in
getDisplayName
getDisplayName(this, baseurl, filename): string
The method can be used to change the displayed name of the uploaded file
Jodit.make('#editor', {
uploader: {
url: 'https://sitename.net/jodit/connector/index.php?action=fileUpload',
getDisplayName: (_, name) => 'File:' + name
}
});
Parameters
| Name | Type |
|---|---|
this |
T |
baseurl |
string |
filename |
string |
Returns
string
Defined in
jodit/src/types/uploader.d.ts:100