added syntax highlighting
This commit is contained in:
parent
ca18c11eb3
commit
a259387096
|
@ -32,7 +32,7 @@ help_tips(){
|
||||||
echo ""
|
echo ""
|
||||||
echo 'TIPS'
|
echo 'TIPS'
|
||||||
echo '----'
|
echo '----'
|
||||||
echo 'text editors ' "type '<vi|mg|nano> <textfile>'"
|
echo 'text editors ' "type '<codemirror|vi|mg|nano> <textfile>'"
|
||||||
echo 'programming languages ' "type 'ls ~/bin/helloworld*'"
|
echo 'programming languages ' "type 'ls ~/bin/helloworld*'"
|
||||||
echo 'run 64bit linux app ' "type 'blink <x86_64 binary>'"
|
echo 'run 64bit linux app ' "type 'blink <x86_64 binary>'"
|
||||||
echo 'paste text ' "ctrl/cmd+shift+v'"
|
echo 'paste text ' "ctrl/cmd+shift+v'"
|
||||||
|
|
|
@ -66,7 +66,13 @@ AFRAME.registerComponent('codemirror', {
|
||||||
this.el.setAttribute("window", `title: codemirror; uid: ${this.el.dom.id}; attach: #overlay; dom: #${this.el.dom.id}; width: ${this.data.width}px; height: ${this.data.height}px`)
|
this.el.setAttribute("window", `title: codemirror; uid: ${this.el.dom.id}; attach: #overlay; dom: #${this.el.dom.id}; width: ${this.data.width}px; height: ${this.data.height}px`)
|
||||||
this.editor = CodeMirror( this.el.dom, {
|
this.editor = CodeMirror( this.el.dom, {
|
||||||
value,
|
value,
|
||||||
mode: "htmlmixed",
|
mode: this.data.file.match(/\.js$/) ? "text/javascript" :
|
||||||
|
this.data.file.match(/\.css$/) ? "text/css" :
|
||||||
|
this.data.file.match(/\.html$/) ? "htmlmixed" :
|
||||||
|
this.data.file.match(/\.md$/) ? "markdown" :
|
||||||
|
this.data.file.match(/\.py$/) ? "python" :
|
||||||
|
this.data.file.match(/\.lua$/) ? "lua" :
|
||||||
|
"text/javascript",
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
styleActiveLine: true,
|
styleActiveLine: true,
|
||||||
matchBrackets: true,
|
matchBrackets: true,
|
||||||
|
@ -198,6 +204,9 @@ AFRAME.utils.require({
|
||||||
cmxml: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/xml/xml.js",
|
cmxml: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/xml/xml.js",
|
||||||
cmjavascript: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/javascript/javascript.js",
|
cmjavascript: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/javascript/javascript.js",
|
||||||
cmcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/css/css.js",
|
cmcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/css/css.js",
|
||||||
|
cmlua: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/lua/lua.js",
|
||||||
|
cmpython: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/python/python.js",
|
||||||
|
cmmarkdown: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/markdown/markdown.js",
|
||||||
highlight: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/htmlmixed/htmlmixed.js",
|
highlight: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/htmlmixed/htmlmixed.js",
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue