Jump to content

How do I change the default code language?


darkdreamingdan

Recommended Posts

Posted

The code editor always seems to default to HTML.  This is annoying for programming boards who don't use any HTML.

I've found that the theme is responsible for this, and the html template at core/global/editor/code presents the main editor.  If you hit variables, you'll see this:

Screenshot 2016-09-13 20.09.48.png

However, changing the string from 'html' to anything else doesn't seem to work. It always defaults to HTML no matter what.

 

Would appreciate some guidance on how to change the default language.

Posted

As the codemirror reference to 'html' is actually 'htmlmixed' then I don't think that template does control it - I'm away from my main machine until the morning, so won't be able to confirm until I've tested it out but I don't think the change you are making will have any effect.

Posted

For anyone interested in solving this problem, the following fix worked for me.  It's hacky but does the job.

Enter ACP->Customisation->Themes.

For your theme, edit the HTML and CSS.  Open the core/global/editor/code file. 

On line 10, you should see the following line:

					<select id='elCodeMode{$randomString}' data-role="codeModeSelect" data-codeLanguage="{$language}">

Change it to the following instead:

					<select id='elCodeMode{$randomString}' data-role="codeModeSelect" data-codeLanguage="{{if $val == ''}}YOURLANG{{else}}$language{{endif}}">

Replace "YOURLANG" with the language you want to be default.  For example 'php' or 'xml'.  It should be lowercase.

Good luck.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...