Difference between revisions of "Widget:CodeExplorer"
From Coder Merlin
Line 80: | Line 80: | ||
var standardError = consoleToHTML(executionCodeResponse.standardError); | var standardError = consoleToHTML(executionCodeResponse.standardError); | ||
var standardOutput = consoleToHTML(executionCodeResponse.standardOutput); | var standardOutput = consoleToHTML(executionCodeResponse.standardOutput); | ||
var timedOut = executionCodeResponse.timedOut; | |||
// If timed out, append line to standardError | |||
if (timedOut) { | |||
standardError += "error: timed out<br/>"; | |||
}; | |||
var standardErrorLines = standardError.split("<br/>"); | var standardErrorLines = standardError.split("<br/>"); | ||
Line 86: | Line 92: | ||
if (errorLine.match(/warning:/)) { | if (errorLine.match(/warning:/)) { | ||
errorClass = "merlin-code-explorer-combined-output-warning"; | errorClass = "merlin-code-explorer-combined-output-warning"; | ||
} | }; | ||
if (errorLine.match(/error:/)) { | if (errorLine.match(/error:/)) { | ||
errorClass = "merlin-code-explorer-combined-output-error"; | errorClass = "merlin-code-explorer-combined-output-error"; | ||
} | }; | ||
$("#codeEditorCombinedOutput<!--{$uniqueID|validate:int}-->").append("<span class='" + errorClass + "'>" + errorLine + "</span><br/>"); | $("#codeEditorCombinedOutput<!--{$uniqueID|validate:int}-->").append("<span class='" + errorClass + "'>" + errorLine + "</span><br/>"); | ||
}; | }; |
Revision as of 09:15, 14 June 2021
Parameters:
- 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 |uniqueID=10 |width=null |height=null |lineNumbers=true |theme=vibrant-ink |readOnly=false |mode=swift |initialCode=func sayHello() { print("Hello, World!") } }}