2023-10-07 00:48:38 +00:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
|
<html>
|
|
|
|
|
|
<head>
|
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
|
<title>CodeMirror Demo</title>
|
|
|
|
|
|
<link href="codemirror5/lib/codemirror.css" rel="stylesheet" type="text/css" >
|
|
|
|
|
|
<link href="codemirror5/addon/scroll/simplescrollbars.css" rel="stylesheet" type="text/css" >
|
|
|
|
|
|
<link href="codemirror5/addon/display/fullscreen.css" rel="stylesheet" type="text/css" >
|
|
|
|
|
|
<link href="codemirror5/addon/fold/foldgutter.css" rel="stylesheet" type="text/css" >
|
|
|
|
|
|
<link href="codemirror5/addon/hint/show-hint.css" rel="stylesheet" type="text/css" >
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/doc/docs.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/3024-day.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/3024-night.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/abbott.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/abcdef.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/ambiance.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/ayu-dark.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/ayu-mirage.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/base16-dark.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/bespin.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/base16-light.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/blackboard.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/cobalt.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/colorforth.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/dracula.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/duotone-dark.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/duotone-light.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/eclipse.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/elegant.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/erlang-dark.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/gruvbox-dark.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/hopscotch.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/icecoder.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/isotope.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/juejin.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/lesser-dark.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/liquibyte.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/lucario.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/material.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/material-darker.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/material-palenight.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/material-ocean.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/mbo.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/mdn-like.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/midnight.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/monokai.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/moxer.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/neat.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/neo.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/night.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/nord.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/oceanic-next.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/panda-syntax.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/paraiso-dark.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/paraiso-light.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/pastel-on-dark.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/railscasts.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/rubyblue.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/seti.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/shadowfox.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/solarized.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/the-matrix.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/tomorrow-night-bright.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/tomorrow-night-eighties.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/ttcn.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/twilight.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/vibrant-ink.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/xq-dark.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/xq-light.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/yeti.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/idea.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/darcula.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/yonce.css">
|
|
|
|
|
|
<link rel="stylesheet" href="codemirror5/theme/zenburn.css">
|
|
|
|
|
|
|
|
|
|
|
|
<script src="codemirror5/lib/codemirror.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script src="codemirror5/addon/selection/active-line.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/fold/xml-fold.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/edit/closebrackets.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/edit/closetag.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/edit/matchtags.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/edit/matchbrackets.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script src="codemirror5/mode/xml/xml.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/mode/css/css.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/mode/htmlmixed/htmlmixed.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/mode/javascript/javascript.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/mode/clike/clike.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script src="codemirror5/addon/hint/show-hint.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script src="codemirror5/addon/scroll/simplescrollbars.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/display/fullscreen.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/display/placeholder.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/comment/continuecomment.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/comment/comment.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<!--代码折叠-->
|
|
|
|
|
|
<script src="codemirror5/addon/fold/foldcode.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/fold/foldgutter.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="codemirror5/addon/fold/brace-fold.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
|
.CodeMirror {
|
2023-10-09 02:20:20 +00:00
|
|
|
|
height: 100%;
|
2023-10-07 00:48:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
*{
|
|
|
|
|
|
font-family: consolas,"courier new",monospace;
|
|
|
|
|
|
font-size:16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<textarea id="code" name="code" placeholder="在这里编写代码">
|
|
|
|
|
|
import com.demo.util.MyType;
|
|
|
|
|
|
import com.demo.util.MyInterface;
|
|
|
|
|
|
|
|
|
|
|
|
public enum Enum {
|
|
|
|
|
|
VAL1, VAL2, VAL3
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class Class<T, V> implements MyInterface {
|
|
|
|
|
|
public static final MyType<T, V> member;
|
|
|
|
|
|
|
|
|
|
|
|
private class InnerClass {
|
|
|
|
|
|
public int zero() {
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public MyType method() {
|
|
|
|
|
|
return member;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void method2(MyType<T, V> value) {
|
|
|
|
|
|
method();
|
|
|
|
|
|
value.method3();
|
|
|
|
|
|
member = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</textarea>
|
|
|
|
|
|
|
2023-10-09 02:20:20 +00:00
|
|
|
|
<!--<select onchange="selectTheme()" id=select style="display: none">-->
|
|
|
|
|
|
<!-- <option selected="">default</option>-->
|
|
|
|
|
|
<!-- <option>3024-day</option>-->
|
|
|
|
|
|
<!-- <option>3024-night</option>-->
|
|
|
|
|
|
<!-- <option>abbott</option>-->
|
|
|
|
|
|
<!-- <option>abcdef</option>-->
|
|
|
|
|
|
<!-- <option>ambiance</option>-->
|
|
|
|
|
|
<!-- <option>ayu-dark</option>-->
|
|
|
|
|
|
<!-- <option>ayu-mirage</option>-->
|
|
|
|
|
|
<!-- <option>base16-dark</option>-->
|
|
|
|
|
|
<!-- <option>base16-light</option>-->
|
|
|
|
|
|
<!-- <option>bespin</option>-->
|
|
|
|
|
|
<!-- <option>blackboard</option>-->
|
|
|
|
|
|
<!-- <option>cobalt</option>-->
|
|
|
|
|
|
<!-- <option>colorforth</option>-->
|
|
|
|
|
|
<!-- <option>darcula</option>-->
|
|
|
|
|
|
<!-- <option>dracula</option>-->
|
|
|
|
|
|
<!-- <option>duotone-dark</option>-->
|
|
|
|
|
|
<!-- <option>duotone-light</option>-->
|
|
|
|
|
|
<!-- <option>eclipse</option>-->
|
|
|
|
|
|
<!-- <option>elegant</option>-->
|
|
|
|
|
|
<!-- <option>erlang-dark</option>-->
|
|
|
|
|
|
<!-- <option>gruvbox-dark</option>-->
|
|
|
|
|
|
<!-- <option>hopscotch</option>-->
|
|
|
|
|
|
<!-- <option>icecoder</option>-->
|
|
|
|
|
|
<!-- <option>idea</option>-->
|
|
|
|
|
|
<!-- <option>isotope</option>-->
|
|
|
|
|
|
<!-- <option>juejin</option>-->
|
|
|
|
|
|
<!-- <option>lesser-dark</option>-->
|
|
|
|
|
|
<!-- <option>liquibyte</option>-->
|
|
|
|
|
|
<!-- <option>lucario</option>-->
|
|
|
|
|
|
<!-- <option>material</option>-->
|
|
|
|
|
|
<!-- <option>material-darker</option>-->
|
|
|
|
|
|
<!-- <option>material-palenight</option>-->
|
|
|
|
|
|
<!-- <option>material-ocean</option>-->
|
|
|
|
|
|
<!-- <option>mbo</option>-->
|
|
|
|
|
|
<!-- <option>mdn-like</option>-->
|
|
|
|
|
|
<!-- <option>midnight</option>-->
|
|
|
|
|
|
<!-- <option>monokai</option>-->
|
|
|
|
|
|
<!-- <option>moxer</option>-->
|
|
|
|
|
|
<!-- <option>neat</option>-->
|
|
|
|
|
|
<!-- <option>neo</option>-->
|
|
|
|
|
|
<!-- <option>night</option>-->
|
|
|
|
|
|
<!-- <option>nord</option>-->
|
|
|
|
|
|
<!-- <option>oceanic-next</option>-->
|
|
|
|
|
|
<!-- <option>panda-syntax</option>-->
|
|
|
|
|
|
<!-- <option>paraiso-dark</option>-->
|
|
|
|
|
|
<!-- <option>paraiso-light</option>-->
|
|
|
|
|
|
<!-- <option>pastel-on-dark</option>-->
|
|
|
|
|
|
<!-- <option>railscasts</option>-->
|
|
|
|
|
|
<!-- <option>rubyblue</option>-->
|
|
|
|
|
|
<!-- <option>seti</option>-->
|
|
|
|
|
|
<!-- <option>shadowfox</option>-->
|
|
|
|
|
|
<!-- <option>solarized dark</option>-->
|
|
|
|
|
|
<!-- <option>solarized light</option>-->
|
|
|
|
|
|
<!-- <option>the-matrix</option>-->
|
|
|
|
|
|
<!-- <option>tomorrow-night-bright</option>-->
|
|
|
|
|
|
<!-- <option>tomorrow-night-eighties</option>-->
|
|
|
|
|
|
<!-- <option>ttcn</option>-->
|
|
|
|
|
|
<!-- <option>twilight</option>-->
|
|
|
|
|
|
<!-- <option>vibrant-ink</option>-->
|
|
|
|
|
|
<!-- <option>xq-dark</option>-->
|
|
|
|
|
|
<!-- <option>xq-light</option>-->
|
|
|
|
|
|
<!-- <option>yeti</option>-->
|
|
|
|
|
|
<!-- <option>yonce</option>-->
|
|
|
|
|
|
<!-- <option>zenburn</option>-->
|
|
|
|
|
|
<!--</select>-->
|
2023-10-07 00:48:38 +00:00
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
|
|
|
|
//value: "function myScript(){return 100;}\n",
|
|
|
|
|
|
//value : "http://www.cnblogs.com/oldphper", // 文本域默认显示的文本
|
|
|
|
|
|
lineNumbers: true, // 是否显示行号
|
|
|
|
|
|
mode: 'text/x-java', // 模式
|
|
|
|
|
|
smartIndent : true, // 是否智能缩进
|
|
|
|
|
|
styleActiveLine: true, // 激活当前行样式
|
|
|
|
|
|
indentUnit : 2, // 缩进单位,默认2
|
|
|
|
|
|
tabSize : 4, // Tab缩进,默认4
|
|
|
|
|
|
readOnly : false, // 是否只读,默认false
|
|
|
|
|
|
matchBrackets: true, // 匹配符号
|
|
|
|
|
|
matchTags: {bothTags: true}, // 匹配标签 按住Ctrl+J 可以定位标签位置
|
|
|
|
|
|
autoCloseTags: true, // 自动关闭标签 addon/edit/
|
|
|
|
|
|
autoCloseBrackets: true, // 自动输入括弧 addon/edit/
|
|
|
|
|
|
scrollbarStyle: "simple", // 简易滚动条 addon/scroll
|
|
|
|
|
|
continueComments: "Enter", // 注释代码 快捷键 Ctrl-Q
|
|
|
|
|
|
// lineWrapping: true,
|
|
|
|
|
|
foldGutter: true, // 允许在行号位置折叠
|
|
|
|
|
|
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
|
|
|
|
|
|
hintOptions: {
|
|
|
|
|
|
completeSingle: false
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 代码全屏按键,addon/dispaly/ 可以使用组合键
|
|
|
|
|
|
extraKeys: {
|
|
|
|
|
|
"Ctrl-J": "toMatchingTag",
|
|
|
|
|
|
"Ctrl-Q": "toggleComment",
|
|
|
|
|
|
"F11": function(cm) {
|
|
|
|
|
|
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
|
|
|
|
|
|
},
|
|
|
|
|
|
"Esc": function(cm) {
|
|
|
|
|
|
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
|
|
|
|
|
|
},
|
|
|
|
|
|
"Ctrl-Space": "autocomplete"
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/** 切换主题 S **/
|
|
|
|
|
|
var s_theme = document.getElementById("select");
|
|
|
|
|
|
function selectTheme() {
|
|
|
|
|
|
var theme = s_theme.options[s_theme.selectedIndex].textContent;
|
|
|
|
|
|
editor.setOption("theme", theme);
|
|
|
|
|
|
location.hash = "#" + theme;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
editor.on("inputRead", () => {
|
|
|
|
|
|
this.editor.showHint();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var choice = (location.hash && location.hash.slice(1)) ||
|
|
|
|
|
|
(document.location.search && decodeURIComponent(document.location.search.slice(1)));
|
|
|
|
|
|
if (choice) {
|
|
|
|
|
|
s_theme.value = choice;
|
|
|
|
|
|
editor.setOption("theme", choice);
|
|
|
|
|
|
}
|
|
|
|
|
|
CodeMirror.on(window, "hashchange", function() {
|
|
|
|
|
|
var theme = location.hash.slice(1);
|
|
|
|
|
|
if (theme) { s_theme.value = theme; selectTheme(); }
|
|
|
|
|
|
});
|
|
|
|
|
|
/** 切换主题 E **/
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
</html>
|