Run the following code:
$editor = 'codemirror';
$instance = new \Joomla\CMS\Editor\Editor($editor);
$params = array('syntax' => 'php');
echo $instance->display('test1', htmlspecialchars('<?php echo "test";'), '100%', 300, 75, 20, false, null, null, null, $params);
$params = array('syntax' => 'html');
echo $instance->display('test2', htmlspecialchars('<h1>test</h1>'), '100%', 300, 75, 20, false, null, null, null, $params);
Two editors (one configured for PHP syntax highlighting, the other one for HTML) and no errors in the browser console.
Editors work correctly, however there's a 404 request in the console:
GET http://localhost/j40/media/vendor/codemirror/mode/text/html/text/html.js
Latest nightly 4.0.0-beta8-dev
This is happening due to the second CodeMirror instance. I've traced this to this line:
https://github.com/joomla/joomla-cms/blob/4.0-dev/build/media_source/plg_editors_codemirror/js/joomla-editor-codemirror.w-c.es6.js#L60
It's requesting mode.mime
which is text/html
and thus it looks for /mode/text/html/text/html.js
. For example, for PHP it's /mode/php/php.js
However, the correct variable in my opinion would be mode.mode
, which is htmlmixed
and thus it will look for /mode/htmlmixed/htmlmixed.js
, which exists.
Don't know why it's mode.mime
in there instead of mode.mode
and why there's a separate handling for the php mode.
Perhaps somebody can share some light into why this is.
Labels |
Added:
?
|
Was reported by me last year #29767 and @dgrammatiko fixed it in #32315 ... or not :)
hello no news about this ?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-11-23 19:50:19 |
Closed_By | ⇒ | richard67 | |
Labels |
Added:
No Code Attached Yet
Removed: ? |
it something from #32315