Tiny Drive plugin setup options
tinydrive_token_provider
This option could take one of the following two forms:
-
A URL to a page or endpoint that accepts a HTTP JSON POST request, and produces a JSON structure with a valid JWT.
-
A function that provides the same token through a callback, allowing a HTTP request in any desired format. The token provider function should have a success and a failure callback, where:
-
The success callback accepts an object with a
tokenproperty containing the JWT -
The failure callback accepts a string to present as an error message if the token could not be produced.
-
For information on how to create these tokens, refer to the JWT authentication guide.
Type: String or Function
Required: yes
tinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'tinydrive',
tinydrive_token_provider: '/jwt' // this can be a page or endpoint like this
});
tinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'tinydrive',
tinydrive_token_provider: (success, failure) => {
success({ token: 'jwt-token' });
// failure('Could not create a jwt token')
}
});
tinydrive_upload_path
This option sets the default upload path for files:
-
Pasted into the editor,
-
Uploaded to the editor through the Image dialog, or
-
Dragged and dropped into the editor.
It will produce a date-based structure within this path, such as: /uploads/{year}{month}{day}. This is to avoid having thousands of files in the same directory.
Type: String
Default value: '/uploads'
tinydrive_upload_pathtinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'tinydrive',
tinydrive_upload_path: '/some/other/path'
});
tinydrive_max_image_dimension
This option constrains the width and height of uploaded images. When specified, any images with a greater width or height than the specified amount would be proportionally resized down to the specified maximum dimension.
Type: Number
Default value: undefined
tinydrive_max_image_dimensiontinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'tinydrive',
tinydrive_max_image_dimension: 1024
});