|
| 1 | += Media Optimizer (Documents) |
| 2 | +:navtitle: Documents feature of the Media Optimizer plugin |
| 3 | +:description: The Documents feature of the Media Optimizer plugin allows you to upload and link document files in your content. |
| 4 | +:description_short: upload and link document files in your content. |
| 5 | +:plugincode: uploadcare |
| 6 | +:pluginname: Media Optimizer's Documents feature |
| 7 | +:keywords: plugin, {plugincode}, documents, files, upload, pdf, word, excel, powerpoint, link |
| 8 | +:plugincategory: premium |
| 9 | + |
| 10 | +include::partial$misc/admon-premium-plugin.adoc[] |
| 11 | + |
| 12 | +== Overview |
| 13 | + |
| 14 | +The Documents feature of the {pluginname} plugin enables users to upload and link document files (PDF, Word, Excel, PowerPoint, and more) directly within the editor through the xref:link.adoc[Link] plugin's dialog. The plugin automatically configures the necessary options to enable file uploads in the link dialog when both the {pluginname} plugin and the Link plugin are enabled. |
| 15 | + |
| 16 | +== Key benefits |
| 17 | + |
| 18 | +* Upload and link document files directly within the editor |
| 19 | +* Support for a wide range of file types including documents, iWork files, audio files, and archives |
| 20 | +* Automatic configuration of file upload handlers when both plugins are enabled |
| 21 | +* Secure file uploads through Uploadcare's infrastructure |
| 22 | +* Customizable list of supported file types |
| 23 | +* Drag-and-drop file upload support |
| 24 | +* URL-based file linking |
| 25 | + |
| 26 | +== Interactive example |
| 27 | + |
| 28 | +liveDemo::uploadcare-documents[] |
| 29 | + |
| 30 | +== Basic setup |
| 31 | + |
| 32 | +To enable document file uploads, include both `uploadcare` and `link` in the `plugins` option in the editor configuration. The {pluginname} plugin will automatically configure the necessary options to enable file uploads in the link dialog. |
| 33 | + |
| 34 | +.Example |
| 35 | +[source,js] |
| 36 | +---- |
| 37 | +tinymce.init({ |
| 38 | + selector: 'textarea', |
| 39 | + plugins: 'uploadcare link', |
| 40 | + toolbar: 'link', |
| 41 | + uploadcare_public_key: '<your-public-key>', |
| 42 | + documents_file_types: [ |
| 43 | + { mimeType: 'application/msword', extensions: [ 'doc' ] }, |
| 44 | + { mimeType: 'application/vnd.ms-excel', extensions: [ 'xls' ] }, |
| 45 | + { mimeType: 'application/vnd.ms-powerpoint', extensions: [ 'ppt', 'pps' ] }, |
| 46 | + { mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', extensions: [ 'docx' ] }, |
| 47 | + { mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', extensions: [ 'xlsx' ] }, |
| 48 | + { mimeType: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', extensions: [ 'pptx' ] }, |
| 49 | + { mimeType: 'application/pdf', extensions: [ 'pdf' ] }, |
| 50 | + { mimeType: 'application/rtf', extensions: [ 'rtf' ] }, |
| 51 | + { mimeType: 'text/plain', extensions: [ 'txt' ] }, |
| 52 | + { mimeType: 'application/vnd.apple.keynote', extensions: [ 'key' ] }, |
| 53 | + { mimeType: 'application/vnd.apple.pages', extensions: [ 'pages' ] }, |
| 54 | + { mimeType: 'application/vnd.apple.numbers', extensions: [ 'numbers' ] }, |
| 55 | + { mimeType: 'audio/wav', extensions: [ 'wav', 'wave' ] }, |
| 56 | + { mimeType: 'audio/mpeg', extensions: [ 'mp3' ] }, |
| 57 | + { mimeType: 'audio/ogg', extensions: [ 'ogg' ] }, |
| 58 | + { mimeType: 'application/zip', extensions: [ 'zip' ] }, |
| 59 | + { mimeType: 'application/gzip', extensions: [ 'gz', 'gzip' ] }, |
| 60 | + { mimeType: 'application/x-tar', extensions: [ 'tar' ] }, |
| 61 | + { mimeType: 'application/x-gtar', extensions: [ 'tar.gz', 'tgz' ] }, |
| 62 | + { mimeType: 'application/x-compressed-tar', extensions: [ 'tar.gz', 'tgz' ] }, |
| 63 | + { mimeType: 'application/x-7z-compressed', extensions: [ '7z' ] }, |
| 64 | + { mimeType: 'application/vnd.rar', extensions: [ 'rar' ] } |
| 65 | + ] |
| 66 | +}); |
| 67 | +---- |
| 68 | + |
| 69 | +[NOTE] |
| 70 | +==== |
| 71 | +The {pluginname} plugin automatically configures the xref:link.adoc#files_upload_handler[`+files_upload_handler+`] and `+documents_file_types+` options when both the Link plugin and the {pluginname} plugin are enabled. This enables file uploads in the Link dialog without requiring manual configuration. However, you can customize the list of supported file types by explicitly setting the xref:uploadcare.adoc#documents-file-types[`+documents_file_types+`] option as shown in the example above. |
| 72 | +==== |
| 73 | + |
| 74 | +== Document Operations |
| 75 | + |
| 76 | +Below is an overview of the features provided by the {pluginname} plugin for document file uploads: |
| 77 | + |
| 78 | +[cols="1,1,4",options="header"] |
| 79 | +|=== |
| 80 | +| Toolbar button | Icon | Description |
| 81 | + |
| 82 | +| `+link+` |
| 83 | +| image:icons/link.svg[link.svg] |
| 84 | +| Opens the Insert/edit link dialog so the user can upload with file picker or dropping file to be uploaded. Uploaded files are processed through Uploadcare's infrastructure and automatically linked in the content. |
| 85 | +|=== |
| 86 | + |
| 87 | +The {pluginname} plugin supports a comprehensive list of file types: |
| 88 | + |
| 89 | +* **Documents:** PDF, Word (doc, docx), Excel (xls, xlsx), PowerPoint (ppt, pps, pptx), RTF, plain text (txt) |
| 90 | +* **iWork files:** Keynote (key), Pages (pages), Numbers (numbers) |
| 91 | +* **Audio files:** WAV (wav, wave), MP3 (mp3), OGG (ogg) |
| 92 | +* **Archive files:** ZIP (zip), GZIP (gz, gzip), TAR (tar), TAR.GZ (tar.gz, tgz), 7Z (7z), RAR (rar) |
| 93 | + |
| 94 | +When both the {pluginname} plugin and the Link plugin are enabled, the Link dialog displays an "Upload" tab that enables file uploads. Users can upload files via drag-and-drop, file selection, or by providing a URL. Uploaded files are processed through Uploadcare's infrastructure and automatically linked in the content. |
| 95 | + |
| 96 | +== Options |
| 97 | + |
| 98 | +The following configuration options affect the behavior of the Documents feature: |
| 99 | + |
| 100 | +:includedSection: uploadcarePlugin |
| 101 | +include::partial$configuration/documents_file_types.adoc[leveloffset=+1] |
| 102 | +:!includedSection: |
| 103 | + |
| 104 | +:pluginfeature: uc-documents |
| 105 | +include::partial$misc/plugin-toolbar-button-id-boilerplate.adoc[] |
| 106 | + |
| 107 | +include::partial$misc/plugin-menu-item-id-boilerplate.adoc[] |
| 108 | + |
0 commit comments