47 lines
1.3 KiB
HTML
47 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<!-- <link href="js/codemirror.min.css" rel="stylesheet"> -->
|
|
<link href="./js/bootstrap.min.css" rel="stylesheet" />
|
|
<link rel="stylesheet" href="./js/codemirror.min.css" />
|
|
<script src="./js/codemirror.min.js"></script>
|
|
<script src="./js/jquery.min.js"></script>
|
|
<script src="./js/jquery.format.js"></script>
|
|
<script src="./js/xml.js"></script>
|
|
</head>
|
|
<style>
|
|
.CodeMirror {
|
|
height: 450px;
|
|
}
|
|
::-webkit-scrollbar {
|
|
width: 10px;
|
|
height: 10px;
|
|
}
|
|
/* 滚动条方块 */
|
|
::-webkit-scrollbar-thumb {
|
|
border-radius: 5px !important;
|
|
background: #f5f6f7 !important;
|
|
}
|
|
/* 滚动条轨道 */
|
|
::-webkit-scrollbar-track {
|
|
background: transparent !important;
|
|
}
|
|
</style>
|
|
<body>
|
|
<!-- 在文本域内设置要展示和编辑的代码 -->
|
|
<textarea class="form-control" id="code" name="code" rows="10"></textarea>
|
|
|
|
<script>
|
|
var codeEditor = CodeMirror.fromTextArea(document.getElementById('code'), {
|
|
lineNumbers: true,
|
|
matchBrackets: true,
|
|
mode: 'application/xml',
|
|
indentUnit: 4,
|
|
indentWithTabs: true,
|
|
});
|
|
let textVal = localStorage.getItem('textVal');
|
|
codeEditor.setValue(decodeURIComponent(textVal));
|
|
</script>
|
|
</body>
|
|
</html>
|