tinymce-bundle icon indicating copy to clipboard operation
tinymce-bundle copied to clipboard

upload tab from local filesystem not showing

Open broomdancer opened this issue 1 year ago • 4 comments

First of all: wonderful bundle! Impeccable!

I faced an issue not seeing this little upload button, when clicking the image dialog. The setting images_upload_url in tinymce.yaml is existing and set.

Can you help out?

broomdancer avatar Aug 19 '23 18:08 broomdancer

Hey @broomdancer!

Could you share the contents of your tinymce.yaml config file, and perhaps the relevant parts of your FormType code?

I’ll try and reproduce the issue on my end to see what’s wrong.

EmilePerron avatar Aug 19 '23 21:08 EmilePerron

Thank you for the quick response!

contens of tinymce.yaml

tinymce:
  images_upload_url: "http://127.0.0.1:8000/admin/tinymce/upload"
  images_upload_route: "" # Pame of the route for `images_upload_url` (leave `images_upload_url` blank if using this)
  images_upload_route_params: [] # Parameters of the route for `images_upload_url` (leave `images_upload_url` blank if using this)
  images_upload_handler: ""
  images_upload_base_path: ""
  images_upload_credentials: "true"
  images_reuse_filename: ""

From the error message I get the allowed settings: Available options are "content_css", "images_reuse_filename", "images_upload_base_path", "images_upload_credentials", "images_upload_handler", "images_upload_route", "images_upload_route_params", "images_upload_url", "plugins", "skin", "toolbar"

Important part of the the formType:

$builder->add('content', TinymceType::class, [
    'label' => 'general.content',
    'attr' => [
        'plugins' => 'advlist autolink lists link image charmap preview anchor searchreplace visualblocks code fullscreen insertdatetime media table emoticons template image',
        'toolbar' => 'searchreplace | fullscreen | undo redo | styleselect | fontsizeselect | bold italic underline forecolor backcolor | link media image anchor code | codesample | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat',
        'image_uploadtab' => true

broomdancer avatar Aug 20 '23 10:08 broomdancer

Hey @broomdancer!

Just I just tested it out on my end and found the issue.

It seems the global defaults defined in tinymce.yaml are not used when attr is defined in the form type.

This seems like an oversight - my bad! I'll see if I can submit a PR to fix that issue soon (unless someone over at @eckinox has time to do it).

In the meantime, you can either:

  • Define your TinyMCE configs entirely in your config file, and not use attr in your TinymceType definition.
  • Specify all of your configs in your TinymceType definition.

Hope that helps!

EmilePerron avatar Aug 20 '23 22:08 EmilePerron

Hey @broomdancer

I just created a new fork of this repo with some bugfixes and improvements, so I'd suggest moving over to this new forked bundle: https://github.com/EmilePerron/tinymce-bundle

This issue should be fixed in this new fork.

Cheers!

EmilePerron avatar May 14 '24 02:05 EmilePerron