Bug 25697 - Tinymce doesn't load in IE 11 (due to Koha adding version number suffix to Javascript)
Summary: Tinymce doesn't load in IE 11 (due to Koha adding version number suffix to Ja...
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Browser compatibility (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: David Cook
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-09 05:53 UTC by David Cook
Modified: 2021-06-14 21:29 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 25697: Declare base url and suffix in tinymce init (3.36 KB, patch)
2020-06-09 06:12 UTC, David Cook
Details | Diff | Splinter Review
Bug 25697: Declare base url and suffix in tinymce init (3.34 KB, patch)
2020-06-23 01:57 UTC, David Cook
Details | Diff | Splinter Review
Bug 25697: Declare base url and suffix in tinymce init (3.40 KB, patch)
2020-06-23 14:06 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 25697: Declare base url and suffix in tinymce init (3.46 KB, patch)
2020-06-28 21:32 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2020-06-09 05:53:55 UTC
Tinymce tries to set its base url by iterating through "script" elements looking for scripts like tinymce.min.js, and uses the baseurl of the script src attribute for its own baseurl.

However, we provide something like tinymce.min_19.1106000.js, which will never match.

This is OK in browsers like Chrome which support document.currentScript as a fallback.

But IE 11 doesn't support document.currentScript.

The simple solution is just to provide "suffix" and "base_url" when running tinyMCE.init. It's no big drama, and it means tinymce will work better cross-browser.
Comment 1 David Cook 2020-06-09 06:12:53 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2020-06-18 19:44:02 UTC Comment hidden (obsolete)
Comment 3 David Cook 2020-06-22 00:15:29 UTC Comment hidden (obsolete)
Comment 4 David Cook 2020-06-23 01:57:53 UTC
Created attachment 106174 [details] [review]
Bug 25697: Declare base url and suffix in tinymce init

This patch declares the base url and suffix in tinymce init, so
that tinymce will initialize properly cross-browser. Without this change,
tinymce will fail to initialize on IE 11.

Test plan:
0. Apply patch
1. Open IE 11
2. Enable "UseWYSIWYGinSystemPreferences" system preference
3. Go to /cgi-bin/koha/admin/preferences.pl?tab=opac and note that
tinymce initializes correctly
4. Go to /cgi-bin/koha/tools/koha-news.pl and create/edit a news item,
and note that tinymce initializes correctly
5. Go to /cgi-bin/koha/admin/branches.pl and add/edit a library, and
note that tinymce initializes correctly for "OPAC info"
Comment 5 ByWater Sandboxes 2020-06-23 14:06:48 UTC
Created attachment 106208 [details] [review]
Bug 25697: Declare base url and suffix in tinymce init

This patch declares the base url and suffix in tinymce init, so
that tinymce will initialize properly cross-browser. Without this change,
tinymce will fail to initialize on IE 11.

Test plan:
0. Apply patch
1. Open IE 11
2. Enable "UseWYSIWYGinSystemPreferences" system preference
3. Go to /cgi-bin/koha/admin/preferences.pl?tab=opac and note that
tinymce initializes correctly
4. Go to /cgi-bin/koha/tools/koha-news.pl and create/edit a news item,
and note that tinymce initializes correctly
5. Go to /cgi-bin/koha/admin/branches.pl and add/edit a library, and
note that tinymce initializes correctly for "OPAC info"

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 6 Julian Maurice 2020-06-26 08:43:18 UTC
I cannot test with IE, but I confirm that it is still working with Firefox.

However, it doesn't make much sense to append koha version to tinymce URLs (tinymce is not updated very often). Wouldn't it be better to have tinymce version in URL ? Like /intranet-tmpl/lib/tinymce/5.0.16/jquery.tinymce.min.js ?

If I understood correctly that should also fix the issue.
Comment 7 Julian Maurice 2020-06-26 09:09:47 UTC
(In reply to Julian Maurice from comment #6)
> I cannot test with IE, but I confirm that it is still working with Firefox.
> 
> However, it doesn't make much sense to append koha version to tinymce URLs
> (tinymce is not updated very often). Wouldn't it be better to have tinymce
> version in URL ? Like
> /intranet-tmpl/lib/tinymce/5.0.16/jquery.tinymce.min.js ?
> 
> If I understood correctly that should also fix the issue.

I wrote an alternative patch here : https://gitlab.com/jajm/Koha/-/tree/bug/25697-alt (commit https://gitlab.com/jajm/Koha/-/commit/d2ac23957522dac45a5971b9eb4435954c609d2b)
Comment 8 Katrin Fischer 2020-06-28 21:32:52 UTC
Created attachment 106362 [details] [review]
Bug 25697: Declare base url and suffix in tinymce init

This patch declares the base url and suffix in tinymce init, so
that tinymce will initialize properly cross-browser. Without this change,
tinymce will fail to initialize on IE 11.

Test plan:
0. Apply patch
1. Open IE 11
2. Enable "UseWYSIWYGinSystemPreferences" system preference
3. Go to /cgi-bin/koha/admin/preferences.pl?tab=opac and note that
tinymce initializes correctly
4. Go to /cgi-bin/koha/tools/koha-news.pl and create/edit a news item,
and note that tinymce initializes correctly
5. Go to /cgi-bin/koha/admin/branches.pl and add/edit a library, and
note that tinymce initializes correctly for "OPAC info"

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2020-06-28 21:36:37 UTC
Sorry Julian, I saw your comments too late. 

You change is the bigger one and I am not sure why we had settled on appending the version in the file name - but maybe it would make sense to use the same method everywhere?

Adding Owen and hoping that David will be able to tell us if your patch works with IE (I couldn't test that either)
Comment 10 Katrin Fischer 2020-06-28 21:37:04 UTC
Owen, could you maybe have a look at David's patch and Julian's alternative?
Comment 11 David Cook 2020-06-28 23:23:51 UTC
(In reply to Katrin Fischer from comment #9)
> Adding Owen and hoping that David will be able to tell us if your patch
> works with IE (I couldn't test that either)

I haven't tried the patch yet, but it sounds reasonable to me.
Comment 12 David Cook 2020-07-09 07:02:49 UTC
Actually, in a different patch, I think I said I'm now advocating that all IE 11 users use Edge instead, so I wouldn't mind us closing this as a WONTFIX.
Comment 13 Katrin Fischer 2020-07-18 17:27:14 UTC
We have been discussing IE support at the last general meeting and we will add a note that IE is not supported for the staff interface to the manual and to use Edge based browsers instead:

https://meetings.koha-community.org/2020/general_irc_meeting_15_july_2020.2020-07-15-20.03.log.html