Register Filepond Plugin

There is a similar post here : ❓┊helpInstalling filepond plugin for file upload

Is there a way to register a plugin for FileUpload without overriding the whole thing?

I've tried all the solutions mentioned in the above thread - except for the suggestion to override the entire file-upload.js file.

Here are some of the things I tried.

FilamentAsset::register([
    Js::make('filepond-config', __DIR__.'/../../resources/js/filepond-config.js'),
    Js::make('filepond-config', Vite::asset('resources/js/filepond-config.js')),
]);

FilamentView::registerRenderHook( PanelsRenderHook::SCRIPTS_AFTER,
    fn (): string => Blade::render("@vite('resources/js/filepond-config.js')")
);


// This is just the latest example. The code is from the FilePond documentation
// https://pqina.nl/filepond/docs/api/plugins/file-rename/
import FilePondPluginFileRename from 'filepond-plugin-file-rename';

window.FilePond.registerPlugin(FilePondPluginFileRename);

document.addEventListener("DOMContentLoaded", function(event) {
    window.FilePond.setOptions({
        fileRenameFunction: (file) =>
            new Promise((resolve) => {
                resolve(window.prompt('Enter new filename', file.name));
            }),
    });
});

None of the above work for different reasons (obviously, I may be doing something wrong).

One of the problems is that the filepond stuff is loaded only when needed so it's not always available.

So, is there a way to install FilePond plugins ?

Thank you.
Was this page helpful?