themains226819
themains226819

I have a plugin which I have added TinyMCE to. I would like to add a button that adds the Media Manager like the Wysiwyg Editors plugin does for the Backend. I had a look at that plugins settings and note the ocmediamanager plugin but it seems to require the backend Javascript libraries. Is there a way to reference the required libraries to make this work for the frontend. I have seen other posts on adding Media Manager to the front end with no definitive answer.

tee
tee
  1. Follow Laravel Filemanager installation guide here https://unisharp.github.io/laravel-filemanager/installation. (recommend version 1.9.2 or below because after this version still have a problem with auth middlewares and I don't know how to fix it)

  2. Open /config/lfm.php and add your own assets path for your icon example

    'assets_directory' => '/themes/[your_theme_name]/assets',
  3. remove 'auth' config in middlewares option.

    middlewares' => ['web'],
  4. Open vendor/unisharp/laravel-filemanager/src/views/index.blade.php. We have to replace all css and before and javascript before declarations.

    <style>{!! \File::get(base_path('vendor/laravel-filemanager/css/cropper.min.css')) !!}</style>
    <style>{!! \File::get(base_path('vendor/laravel-filemanager/css/mfb.css')) !!}</style>
    <style>{!! \File::get(base_path('vendor/laravel-filemanager/css/dropzone.min.css')) !!}</style>
    
    <script>{!! \File::get(base_path('vendor/laravel-filemanager/js/cropper.min.js')) !!}</script>
    <script>{!! \File::get(base_path('vendor/laravel-filemanager/js/jquery.form.min.js')) !!}</script>
    <script>{!! \File::get(base_path('vendor/laravel-filemanager/js/dropzone.min.js')) !!}</script>
  5. Open /vendor/unisharp/laravel-filemanager/src/Traits/LfmHelpers.php find $thumb_url and replace the folder.png path instead.

    $thumb_url = asset(config('lfm.assets_directory').'/images/icons/png/folder.png');

All done and serve!!

LukeTowers
LukeTowers

Yes, it's quite doable. See my Easy Files plugin (https://octobercms.com/plugin/luketowers-easyfiles) for an example of how I did it.

1-3 of 3