In J! 3.8.3 the code in the template file editor is hilighted in colour when editing PHP files but in J! 3.8.4 the colour has disappeared. It doesn't make any difference to the actual code. When editing CSS files in J! 3.8.4 the code hilighting is still present.
PHP file editing should retain the same code hilighting as for J! 3.8.3
Colour code hilighting is absent on J! 3.8.4 when editing some files but the hilighting is retained when editing other files.
?GeShi
First reported https://forum.joomla.org/viewtopic.php?f=9&t=958741&p=3511589#p3511549
OK, I'll have a look
Got it. It seems like a bug in the meta.js file that codemirror uses to determine mode.
See, what happens is, we know the "mode" we want by name so we use CodeMirror's findModeByName
function to get a mode object based on that. CM keeps a long list of mode objects that look like this:
{
name: "HTML",
mime: "text/html",
mode: "htmlmixed",
ext: ["html", "htm"],
alias: ["xhtml"]
}
Or this:
{
name: "JavaScript",
mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"],
mode: "javascript",
ext: ["js"],
alias: ["ecmascript", "js", "node"]
}
Spot the difference? OK, so sometimes, there's 'mime' (string) and sometimes 'mimes' (array of strings). In case of 'mimes', CM will just set mime = mimes[0]
so we should always have a string 'mime' value. This is useful because then what we do is set the editor's 'mode' option to the value of 'mime' which should be a string. There's a problem with php though. It looks like this:
{
name: "PHP",
mime: ["application/x-httpd-php", "text/x-php"],
mode: "php",
ext: ["php", "php3", "php4", "php5", "php7", "phtml"]
}
Obviously a typo, 'mime' should be 'mimes' so that CM can set mimes[0] as mime and we can use that value. Instead we're setting an array where we should be setting a string.
So I'll put a workaround for this in our code and I'll also submit a fix to the codemirror project.
Thanks for finding it!
Ah, seems this is also fixed in the latest version of CodeMirror which was released a few days ago.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-02-02 03:36:24 |
Closed_By | ⇒ | Quy |
Closed_By | Quy | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/19520
nothing to do with geshi lol
the editor in use on that page is codemirrror