By default CodeMirror only highlights HTML, CSS and JAVASCRIPT (as far as I know) and I have started using this Sourcerer plugin which allows to insert PHP into modules and articles. It works perfectly but CodeMirror doesn't highlight any PHP syntax which makes it pretty hard to write code. I have used CodeMirror as a standalone module and I'm aware it come with different modes that can be set using JS on the textarea. I see this source code on my Edit Module page, its probably the piece of code to be edited but I don't know from where its generated.
jQuery(function() {
var id = "jform_content",
options = {
"autofocus": true,
"lineWrapping": true,
"styleActiveLine": true,
"lineNumbers": true,
"gutters": ["CodeMirror-linenumbers", "CodeMirror-foldgutter", "CodeMirror-markergutter"],
"foldGutter": true,
"markerGutter": true,
"mode": "htmlmixed",
"autoCloseTags": true,
"matchTags": true,
"scrollbarStyle": "native",
"vimMode": false
};
Joomla.editors.instances[id] = CodeMirror.fromTextArea(document.getElementById(id), options);
});
"matchBrackets": "true",
"mode": "application/x-httpd-php",
<script src="mode/php/php.js"></script>
<script src="addon/edit/matchbrackets.js"></script>
Setting Value
PHP Built On Windows NT DESKTOP-JUUOFOO 6.2 build 9200 (Windows 8 Business Edition) i586
Database Version 5.6.24
Database Collation latin1_swedish_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 5.6.8
Web Server Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.6.2 Stable [ Noether ] 4-August-2016 23:41 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36
So which file creates the CodeMirror instance, where is it located in Joomla Directories?
Labels |
Added:
?
|
By default CodeMirror only highlights HTML, CSS and JAVASCRIPT (as far as I know)
Actually it does highlight php when you edit php files as can be seen in this screenshot from the template manager. I am assuming that you are not seeing it when you type in the module using sourcerer because CodeMirror has no way of knowing that you are writing php
As it is not a core functionality of Joomla to write php code in your articles and modules this will need to be supported by your own code or the sourcerer plugin and not by the core of Joomla
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-10-20 12:07:37 |
Closed_By | ⇒ | brianteeman |
I figured it out. Provided JSON string manually with desired values in this file:
\plugins\editors\codemirror\layouts\editors\codemirror\elements.php
and added the required JS files in
\administrator\templates\isis\index.php
Thanks for the directories.
Labels |
Added:
?
|
Codemirror cane be found in /media/editors
And the joomla interface to it in /plugins/editors
On 20 October 2016 at 09:54, saibbyweb notifications@github.com wrote:
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
https://brian.teeman.net/ http://brian.teeman.net/