Difference between revisions of "Widget:CodeExplorer"
From Coder Merlin
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
Parameters: | Parameters: | ||
;userName: The current user's username | |||
;uniqueID: integer: id for editor, must be unique per page | ;uniqueID: integer: id for editor, must be unique per page | ||
;width: integer|string: percentage (as string, e.g. "100%" or integer size in pixels), null for no change (full width) | ;width: integer|string: percentage (as string, e.g. "100%" or integer size in pixels), null for no change (full width) | ||
Line 13: | Line 14: | ||
<pre> | <pre> | ||
{{#widget:CodeExplorer | {{#widget:CodeExplorer | ||
|userName=john-williams | |||
|uniqueID=10 | |uniqueID=10 | ||
|width=null | |width=null | ||
Line 68: | Line 70: | ||
var response = $.post(url, { | var response = $.post(url, { | ||
"username": "{ | "username": "<!--{$userName}-->", | ||
"experienceID": "W1001", | "experienceID": "W1001", | ||
"exerciseID": 10, | "exerciseID": 10, |
Revision as of 10:10, 14 June 2021
Parameters:
- userName
- The current user's username
- uniqueID
- integer: id for editor, must be unique per page
- width
- integer|string: percentage (as string, e.g. "100%" or integer size in pixels), null for no change (full width)
- height
- integer|string: percentage (as string, e.g. "100%" or integer size in pixels), null for no change (~10 lines)
- 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
Example:
{{#widget:CodeExplorer |userName=john-williams |uniqueID=10 |width=null |height=null |lineNumbers=true |theme=vibrant-ink |readOnly=false |mode=swift |initialCode=func sayHello() { print("Hello, World!") } }}