Difference between revisions of "Widget:CodeEditor"
From Coder Merlin
Line 5: | Line 5: | ||
;theme: string: name of theme (which must be loaded via css) | ;theme: string: name of theme (which must be loaded via css) | ||
;readOnly: boolean: true if editing should be disabled | ;readOnly: boolean: true if editing should be disabled | ||
;mode: string: language for highlighting | ;mode: string: language for highlighting (which must be loaded via js) | ||
;initialCode: string: initial code to place in editor | ;initialCode: string: initial code to place in editor | ||
</noinclude> | </noinclude> | ||
Line 18: | Line 18: | ||
CodeMirror.fromTextArea(document.getElementById('codeEditor<!--{$uniqueID|validate:int}-->'), | CodeMirror.fromTextArea(document.getElementById('codeEditor<!--{$uniqueID|validate:int}-->'), | ||
{ | { | ||
keyMap: "emacs", | |||
lineNumbers: "<!--{$lineNumbers|validate:boolean}-->", | lineNumbers: "<!--{$lineNumbers|validate:boolean}-->", | ||
theme: "<!--{$theme}-->", | theme: "<!--{$theme}-->", |
Revision as of 20:28, 8 June 2021
Parameters:
- uniqueID
- integer: id for editor, must be unique per page
- lineNumbers
- boolean: true to display line numbers
- theme
- string: name of theme (which must be loaded via css)
- readOnly
- boolean: true if editing should be disabled
- mode
- string: language for highlighting (which must be loaded via js)
- initialCode
- string: initial code to place in editor