t3editor CSS fail to load if typo3 is not installed in the document root
For our setup, we have many instances of typo3 which are installed in a subdirectory under the same domain. In the past versions that I know of (from 4.1 to 7.6) it worked well. We recently started working with 9.5LTS and 10.4LTS which both present the same issue.
If typo3 9.5 or 10.4 is installed in a subdirectory,
(ie: http://www.my-domain.com/my-typo3/) t3editor fail to work properly.
How to reproduce
1) Here is the directory structure for a traditionnal installation (without composer):
/var/www/html/my-site/typo3_src -> ../typo3_src-10.4.1
/var/www/html/my-site/typo3 -> typo3_src/typo3
/var/www/html/my-site/index.php -> typo3_src/index.php
2) Installation goes through without any issue, I conclude installation with a blank database: "Take me straight to backend"
3) Then create a first page with "Site root" property enabled
4) With Template module, "create template for a new site"
5) Finally, edit "Constants" or "Setup" to notice the textarea going gray.
Using the development tool of my browser, I can notice a merged CSS is loaded, but no styles are applied to the textearea (CoreMirror classes).
I recommend modifying the way CodeMirror styles are included. In the file: typo3/sysext/t3editor/Classes/Form/Element/T3editorElement.php
Here is the diff of my suggested patch:
With this patch, the t3editor is now working as expected.