Bug 31558

Summary: Upgrade of TinyMCE broke image drag and drop
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: TemplatesAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: arthur.suzuki, lucas, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.07, 21.11.14
Bug Depends on: 26949    
Bug Blocks:    
Attachments: Bug 31558: Fix image drag and drop in TinyMCE
Bug 31558: Fix image drag and drop in TinyMCE
Bug 31558: Fix image drag and drop in TinyMCE

Description Fridolin Somers 2022-09-13 20:27:17 UTC
Bug 26949 upgraded JS lib TinyMCE to 5.9.2

This version has a known issue on images drag and drop :

https://stackoverflow.com/questions/64782955/tinymce-inline-drag-and-drop-image-upload-not-working
Comment 1 Fridolin Somers 2022-09-13 20:29:21 UTC
I set as major because several librarians are asking for this fix. They may use this feature in OPAC news very often.
Comment 2 Fridolin Somers 2022-09-13 20:33:03 UTC
Created attachment 140607 [details] [review]
Bug 31558: Fix image drag and drop in TinyMCE

Bug 26949 upgraded JS lib TinyMCE to 5.9.2

This version has a known issue on images drag and drop :
https://stackoverflow.com/questions/64782955/tinymce-inline-drag-and-drop-image-upload-not-working

Test plan :
1) Go to Tools > HTML customizations
2) Create a new entry (not using text editor)
3) Drag and drop an image
=> Without patch you see an error message from TinyMCE 'Dropped file type is not supported'
=> With patch : It works !
Comment 3 Fridolin Somers 2022-09-13 20:37:14 UTC
There are other places with TinyMCE (wysiwyg prefs, branches description ...) but looks like they do not need images drag and drop.
Comment 4 David Nind 2022-09-13 20:44:28 UTC
Created attachment 140609 [details] [review]
Bug 31558: Fix image drag and drop in TinyMCE

Bug 26949 upgraded JS lib TinyMCE to 5.9.2

This version has a known issue on images drag and drop :
https://stackoverflow.com/questions/64782955/tinymce-inline-drag-and-drop-image-upload-not-working

Test plan :
1) Go to Tools > HTML customizations
2) Create a new entry (not using text editor)
3) Drag and drop an image
=> Without patch you see an error message from TinyMCE 'Dropped file type is not supported'
=> With patch : It works !

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Lucas Gass 2022-09-15 20:51:42 UTC
This adds a bunch of base64 encoded stuff into the additional_contents table in the DB, not my favorite but likely not harmful.

I tried renaming a JS file to JPG and it comes out looking like this:

<img src="data:image/jpeg;base64," alt="" />


The fix is trivial so I am passing QA.
Comment 6 Lucas Gass 2022-09-15 20:53:51 UTC
Created attachment 140686 [details] [review]
Bug 31558: Fix image drag and drop in TinyMCE

Bug 26949 upgraded JS lib TinyMCE to 5.9.2

This version has a known issue on images drag and drop :
https://stackoverflow.com/questions/64782955/tinymce-inline-drag-and-drop-image-upload-not-working

Test plan :
1) Go to Tools > HTML customizations
2) Create a new entry (not using text editor)
3) Drag and drop an image
=> Without patch you see an error message from TinyMCE 'Dropped file type is not supported'
=> With patch : It works !

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 7 Tomás Cohen Arazi 2022-09-16 14:07:37 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 8 Lucas Gass 2022-10-31 21:58:43 UTC
Backported to 22.05.x for upcoming 22.05.07 release
Comment 9 Arthur Suzuki 2022-11-14 16:04:30 UTC
applied to 21.11 for 21.11.14
Comment 10 Victor Grousset/tuxayo 2022-11-24 20:52:52 UTC
Missing dependencies for 21.05.x, it shouldn't be affected, no backport.

Nothing to document it seems, marking resolved.