mirror of
https://github.com/doocs/md.git
synced 2024-11-25 03:18:36 +08:00
style: prettify code
This commit is contained in:
parent
aee49b2d32
commit
a54f55bbac
@ -11,21 +11,21 @@ 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;
|
}
|
||||||
|
if (val) {
|
||||||
|
ensureBound(getOption(val, "pairs"));
|
||||||
|
cm.state.closeBrackets = val;
|
||||||
|
cm.addKeyMap(keyMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (val) {
|
);
|
||||||
ensureBound(getOption(val, "pairs"));
|
|
||||||
cm.state.closeBrackets = val;
|
|
||||||
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;
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user