How it works
- Load the public CDN loader:
https://cdn.filestorage.io/loader.min.js. - Load the plugin for your editor after both the loader and the editor script.
- Pass the same options you would give
mount()—apiKeypluss3orhttp(register the page host under Dashboard → Websites).
TinyMCE
Register filestorage as a plugin and toolbar button, and pass options under the filestorage key.
<script src="https://cdn.filestorage.io/loader.min.js"></script>
<script src="https://cdn.filestorage.io/plugins/tinymce/plugin.js"></script>
<script>
tinymce.init({
selector: '#editor',
plugins: 'filestorage',
toolbar: 'filestorage',
filestorage: {
apiKey: 'fs_live_…',
s3: { proxyBaseUrl: 'https://your-proxy.example' },
},
})
</script>CKEditor 5
Pass FileStorageCKEditor.plugin() in extraPlugins so the button exists before the toolbar renders, then add 'filestorage' to the toolbar items.
<script src="https://cdn.filestorage.io/loader.min.js"></script>
<script src="https://cdn.filestorage.io/plugins/ckeditor5/filestorage.js"></script>
<script>
ClassicEditor.create(document.querySelector('#editor'), {
extraPlugins: [
FileStorageCKEditor.plugin({
apiKey: 'fs_live_…',
s3: { proxyBaseUrl: 'https://your-proxy.example' },
}),
],
toolbar: { items: ['bold', 'italic', '|', 'filestorage'] },
})
</script>Froala
Register the command before creating the editor, then add 'filestorage' to toolbarButtons.
<script src="https://cdn.filestorage.io/loader.min.js"></script>
<script src="https://cdn.filestorage.io/plugins/froala/filestorage.js"></script>
<script>
FileStorageFroala.register(FroalaEditor, {
apiKey: 'fs_live_…',
s3: { proxyBaseUrl: 'https://your-proxy.example' },
})
new FroalaEditor('#editor', {
toolbarButtons: ['filestorage', '|', 'bold', 'italic'],
})
</script>Any other editor: openFilePicker()
Using Quill, Tiptap, Lexical, or a plain <textarea>? Open the picker yourself and handle the selection. Users pick a file by opening its preview and clicking Insert selected file; Escape or the Close button cancels. It returns { close } so you can dismiss it programmatically.
const picker = FileStorageSDK.openFilePicker({
apiKey: 'fs_live_…',
s3: { proxyBaseUrl: 'https://your-proxy.example' },
onSelect(file) {
// file: { path, name, url?, mimeType? }
const isImage = file.mimeType?.startsWith('image/')
editor.insert(
isImage
? `<img src="${file.url}" alt="${file.name}">`
: `<a href="${file.url}">${file.name}</a>`,
)
},
onCancel() {
console.log('Picker closed')
},
})