style: prettify code

This commit is contained in:
yanglbme 2020-11-21 01:34:46 +00:00 committed by GitHub Action
parent aee49b2d32
commit a54f55bbac
2 changed files with 16 additions and 17 deletions

View File

@ -11,11 +11,10 @@ import CodeMirror from "codemirror/lib/codemirror";
var Pos = CodeMirror.Pos; var Pos = CodeMirror.Pos;
CodeMirror.defineOption("autoCloseBrackets", false, function ( CodeMirror.defineOption(
cm, "autoCloseBrackets",
val, false,
old function (cm, val, old) {
) {
if (old && old != CodeMirror.Init) { if (old && old != CodeMirror.Init) {
cm.removeKeyMap(keyMap); cm.removeKeyMap(keyMap);
cm.state.closeBrackets = null; cm.state.closeBrackets = null;
@ -25,7 +24,8 @@ import CodeMirror from "codemirror/lib/codemirror";
cm.state.closeBrackets = val; cm.state.closeBrackets = val;
cm.addKeyMap(keyMap); cm.addKeyMap(keyMap);
} }
}); }
);
function getOption(conf, name) { function getOption(conf, name) {
if (name == "pairs" && typeof conf == "string") return conf; if (name == "pairs" && typeof conf == "string") return conf;

View File

@ -200,7 +200,6 @@ export function formatDoc(content) {
return doc; return doc;
} }
export function fixCodeWhiteSpace(value = "pre") { export function fixCodeWhiteSpace(value = "pre") {
const preDomList = document.getElementsByClassName("code__pre"); const preDomList = document.getElementsByClassName("code__pre");
if (preDomList.length > 0) { if (preDomList.length > 0) {