Jump to content

Recommended Posts

Posted

By default, the syntax highlighting in code blocks is set to HTML. This may be OK for the majority of forums, but if a forum is a special interest group for a different code language, users must set the value every time they use a code block. Is there a way to change the default to something other than HTML, even if it's "No Syntax Highlighting"?

Posted (edited)

So I found the template file for the code block modal in Core>global>editor>code:

<div class="ipsPad ipsForm ipsForm_vertical" data-controller='core.global.editor.code' data-editorid='{$editorId}' data-randomstring='{$randomString}'>
	<form method='get' action='#'>
		<div class="ipsPad ipsAreaBackground_light">
			<div class="ipsFieldRow ipsFieldRow_fullWidth ipsFieldRow_primary ipsLoading" data-role="codeContainer">
				<textarea id='elCodeInput{$randomString}'>{$val}</textarea>
			</div>
			<div class='ipsFieldRow'>
				<button type='submit' class="ipsButton ipsButton_primary cEditorURLButton cEditorURLButtonInsert" data-action="linkButton">{lang="editor_media_insert"}</button>
				<div class="ipsPos_right">
					<select id='elCodeMode{$randomString}' data-role="codeModeSelect" data-codeLanguage="{$language}">
						<option value="null">{lang="editor_code_null"}</option>
						<option value="htmlmixed" {{if $language == 'html' OR $language == 'htmlmixed'}}selected{{endif}}>{lang="editor_code_htmlmixed"}</option>
						<option value="css" {{if $language == 'css'}}selected{{endif}}>{lang="editor_code_css"}</option>
						<option value="javascript" {{if $language == 'javascript'}}selected{{endif}}>{lang="editor_code_javascript"}</option>
						<option value="php" {{if $language == 'php'}}selected{{endif}}>{lang="editor_code_php"}</option>
						<option value="sql" {{if $language == 'sql'}}selected{{endif}}>{lang="editor_code_sql"}</option>
						<option value="xml" {{if $language == 'xml'}}selected{{endif}}>{lang="editor_code_xml"}</option>
					</select>
				</div>
			</div>
		</div>
	</form>
</div>

Would the solution be as simple as changing the null option to be "selected"?

UPDATE:

Editing this template makes no difference to the drop-down and the options must be coming from elsewhere? This would make sense because the options on the actual drop-down don't match those shown in the template:

code-select.png.142a4eac24ec87b9ed76b2157e9c2f61.png

Edited by cfish
  • 1 year later...
Posted
On 6/10/2022 at 9:14 PM, Refsmmat said:

Hi,

have you ever figured how to extend the list of supported languages?

 

I'm afraid not. After a lot of research with no progress, I gave up. I would still dearly love to make it happen, but I have no idea how to do it. If you have better luck than I did, please do let me know.

 

On 6/11/2022 at 1:10 AM, teraßyte said:

That list is updated with a javascript controller. I don't have access to the code right now to check the exact name/path though.

Any help on this would be most welcome.

  • Recently Browsing   0 members

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