feat:样板编辑器升级
This commit is contained in:
parent
a04069b0ee
commit
00addfcbf3
2
_server/CodeMirror/beautify.min.js
vendored
2
_server/CodeMirror/beautify.min.js
vendored
File diff suppressed because one or more lines are too long
2
_server/CodeMirror/jshint.min.js
vendored
2
_server/CodeMirror/jshint.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
_server/css/FiraCode.ttf
Normal file
BIN
_server/css/FiraCode.ttf
Normal file
Binary file not shown.
@ -699,3 +699,12 @@ div.checkboxSet {
|
||||
.etableInputDiv textarea:hover {
|
||||
margin: -5px;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: code;
|
||||
src: url(./FiraCode.ttf);
|
||||
}
|
||||
|
||||
.main .CodeMirror {
|
||||
font-family: code, 微软雅黑, 黑体, 新宋体, Verdana;
|
||||
}
|
||||
|
||||
@ -710,3 +710,11 @@ div.checkboxSet {
|
||||
margin: -5px;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Fira;
|
||||
src: url(./FiraCode.ttf);
|
||||
}
|
||||
|
||||
.main .CodeMirror {
|
||||
font-family: Fira, Menlo, Consolas, 'Courier New', Courier, monospace;
|
||||
}
|
||||
|
||||
@ -236,7 +236,15 @@ editor_multi = function () {
|
||||
document.getElementById('left7').style = 'z-index:-1;opacity: 0;';
|
||||
}
|
||||
editor_multi.setLint = function () {
|
||||
codeEditor.setOption("lint", editor_multi.lintAutocomplete);
|
||||
if (editor_multi.lintAutocomplete) {
|
||||
codeEditor.setOption("lint", {
|
||||
options: {
|
||||
esversion: 2021
|
||||
}
|
||||
});
|
||||
} else {
|
||||
codeEditor.setOption("lint", false);
|
||||
}
|
||||
codeEditor.setOption("autocomplete", editor_multi.lintAutocomplete);
|
||||
document.getElementById("lintCheckbox").checked = editor_multi.lintAutocomplete;
|
||||
}
|
||||
@ -253,7 +261,7 @@ editor_multi = function () {
|
||||
var _format = function () {
|
||||
if (!editor_multi.lintAutocomplete) return;
|
||||
var offset = (codeEditor.getScrollInfo() || {}).top || 0;
|
||||
_setValue(js_beautify(codeEditor.getValue(), {
|
||||
_setValue(beautifier.js(codeEditor.getValue(), {
|
||||
brace_style: "collapse-preserve-inline",
|
||||
indent_with_tabs: true,
|
||||
jslint_happy: true
|
||||
@ -486,6 +494,22 @@ editor_multi = function () {
|
||||
editor_multi.importFile(dict[mod])
|
||||
}
|
||||
|
||||
// 字体大小
|
||||
{
|
||||
const CONFIG_KEY = "editor_multi.fontSize";
|
||||
let fontsize = editor.config.get(CONFIG_KEY, 14);
|
||||
const input = document.getElementById("editor_multi_fontsize");
|
||||
const check = document.getElementById("editor_multi_fontweight")
|
||||
input.value = fontsize;
|
||||
editor_multi.setFontSize = function () {
|
||||
const value = Number(input.value);
|
||||
editor.config.set(CONFIG_KEY, value);
|
||||
const ele = codeEditor.getWrapperElement()
|
||||
ele.style.fontSize = `${value}px`;
|
||||
ele.style.fontWeight = `${check.checked ? 'bold' : 'normal'}`
|
||||
}
|
||||
}
|
||||
|
||||
return editor_multi;
|
||||
}
|
||||
//editor_multi=editor_multi();
|
||||
@ -242,6 +242,7 @@
|
||||
<button onclick="confirmColor()">确定</button>
|
||||
</div>
|
||||
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
|
||||
<div>
|
||||
<button onclick="editor_multi.confirm()">确认</button>
|
||||
<button onclick="editor_multi.cancel()">取消</button>
|
||||
<button onclick="editor_multi.confirm(true)">应用</button>
|
||||
@ -251,6 +252,11 @@
|
||||
style="vertical-align: middle;margin-left:6px"/>
|
||||
<span style="vertical-align: middle; margin-left: -3px">语法检查</span>
|
||||
<select id="codemirrorCommands" onchange="editor_multi.doCommand(this)" style="vertical-align: middle; margin-left: 6px;"></select>
|
||||
<span>字体大小</span>
|
||||
<input style="width: 40px" type="number" onchange="editor_multi.setFontSize()" id="editor_multi_fontsize" />
|
||||
<span>字体加粗</span>
|
||||
<input style="width: 40px" type="checkbox" onchange="editor_multi.setFontSize()" id="editor_multi_fontweight" />
|
||||
</div>
|
||||
<textarea id="multiLineCode" name="multiLineCode"></textarea>
|
||||
</div>
|
||||
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><!-- functions -->
|
||||
|
||||
@ -238,6 +238,7 @@
|
||||
<button onclick="confirmColor()">确定</button>
|
||||
</div>
|
||||
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
|
||||
<div>
|
||||
<button onclick="editor_multi.confirm()">确认</button>
|
||||
<button onclick="editor_multi.cancel()">取消</button>
|
||||
<button onclick="editor_multi.confirm(true)">应用</button>
|
||||
@ -247,6 +248,11 @@
|
||||
style="vertical-align: middle;margin-left:6px"/>
|
||||
<span style="vertical-align: middle; margin-left: -3px">语法检查</span>
|
||||
<select id="codemirrorCommands" onchange="editor_multi.doCommand(this)" style="vertical-align: middle; margin-left: 6px;"></select>
|
||||
<span>字体大小</span>
|
||||
<input style="width: 40px" type="number" onchange="editor_multi.setFontSize()" id="editor_multi_fontsize" />
|
||||
<span>字体加粗</span>
|
||||
<input style="width: 40px" type="checkbox" onchange="editor_multi.setFontSize()" id="editor_multi_fontweight" />
|
||||
</div>
|
||||
<textarea id="multiLineCode" name="multiLineCode"></textarea>
|
||||
</div>
|
||||
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><!-- functions -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user