mirror of
https://github.com/yhl452493373/frpc-panel.git
synced 2026-04-04 14:27:01 +08:00
add codemirror test page
This commit is contained in:
344
assets/static/lib/codemirror/lib/codemirror.css
vendored
Normal file
344
assets/static/lib/codemirror/lib/codemirror.css
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
/* BASICS */
|
||||
|
||||
.CodeMirror {
|
||||
/* Set height, width, borders, and global font properties here */
|
||||
font-family: monospace;
|
||||
height: 300px;
|
||||
color: black;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
/* PADDING */
|
||||
|
||||
.CodeMirror-lines {
|
||||
padding: 4px 0; /* Vertical padding around content */
|
||||
}
|
||||
.CodeMirror pre.CodeMirror-line,
|
||||
.CodeMirror pre.CodeMirror-line-like {
|
||||
padding: 0 4px; /* Horizontal padding of content */
|
||||
}
|
||||
|
||||
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
background-color: white; /* The little square between H and V scrollbars */
|
||||
}
|
||||
|
||||
/* GUTTER */
|
||||
|
||||
.CodeMirror-gutters {
|
||||
border-right: 1px solid #ddd;
|
||||
background-color: #f7f7f7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.CodeMirror-linenumbers {}
|
||||
.CodeMirror-linenumber {
|
||||
padding: 0 3px 0 5px;
|
||||
min-width: 20px;
|
||||
text-align: right;
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.CodeMirror-guttermarker { color: black; }
|
||||
.CodeMirror-guttermarker-subtle { color: #999; }
|
||||
|
||||
/* CURSOR */
|
||||
|
||||
.CodeMirror-cursor {
|
||||
border-left: 1px solid black;
|
||||
border-right: none;
|
||||
width: 0;
|
||||
}
|
||||
/* Shown when moving in bi-directional text */
|
||||
.CodeMirror div.CodeMirror-secondarycursor {
|
||||
border-left: 1px solid silver;
|
||||
}
|
||||
.cm-fat-cursor .CodeMirror-cursor {
|
||||
width: auto;
|
||||
border: 0 !important;
|
||||
background: #7e7;
|
||||
}
|
||||
.cm-fat-cursor div.CodeMirror-cursors {
|
||||
z-index: 1;
|
||||
}
|
||||
.cm-fat-cursor .CodeMirror-line::selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span::selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; }
|
||||
.cm-fat-cursor .CodeMirror-line::-moz-selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span::-moz-selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; }
|
||||
.cm-fat-cursor { caret-color: transparent; }
|
||||
@-moz-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
@-webkit-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
@keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
|
||||
/* Can style cursor different in overwrite (non-insert) mode */
|
||||
.CodeMirror-overwrite .CodeMirror-cursor {}
|
||||
|
||||
.cm-tab { display: inline-block; text-decoration: inherit; }
|
||||
|
||||
.CodeMirror-rulers {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: -50px; bottom: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.CodeMirror-ruler {
|
||||
border-left: 1px solid #ccc;
|
||||
top: 0; bottom: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* DEFAULT THEME */
|
||||
|
||||
.cm-s-default .cm-header {color: blue;}
|
||||
.cm-s-default .cm-quote {color: #090;}
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
|
||||
.cm-s-default .cm-keyword {color: #708;}
|
||||
.cm-s-default .cm-atom {color: #219;}
|
||||
.cm-s-default .cm-number {color: #164;}
|
||||
.cm-s-default .cm-def {color: #00f;}
|
||||
.cm-s-default .cm-variable,
|
||||
.cm-s-default .cm-punctuation,
|
||||
.cm-s-default .cm-property,
|
||||
.cm-s-default .cm-operator {}
|
||||
.cm-s-default .cm-variable-2 {color: #05a;}
|
||||
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
|
||||
.cm-s-default .cm-comment {color: #a50;}
|
||||
.cm-s-default .cm-string {color: #a11;}
|
||||
.cm-s-default .cm-string-2 {color: #f50;}
|
||||
.cm-s-default .cm-meta {color: #555;}
|
||||
.cm-s-default .cm-qualifier {color: #555;}
|
||||
.cm-s-default .cm-builtin {color: #30a;}
|
||||
.cm-s-default .cm-bracket {color: #997;}
|
||||
.cm-s-default .cm-tag {color: #170;}
|
||||
.cm-s-default .cm-attribute {color: #00c;}
|
||||
.cm-s-default .cm-hr {color: #999;}
|
||||
.cm-s-default .cm-link {color: #00c;}
|
||||
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
|
||||
.CodeMirror-composing { border-bottom: 2px solid; }
|
||||
|
||||
/* Default styles for common addons */
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
|
||||
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
||||
.CodeMirror-activeline-background {background: #e8f2ff;}
|
||||
|
||||
/* STOP */
|
||||
|
||||
/* The rest of this file contains styles related to the mechanics of
|
||||
the editor. You probably shouldn't touch them. */
|
||||
|
||||
.CodeMirror {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.CodeMirror-scroll {
|
||||
overflow: scroll !important; /* Things will break if this is overridden */
|
||||
/* 50px is the magic margin used to hide the element's real scrollbars */
|
||||
/* See overflow: hidden in .CodeMirror */
|
||||
margin-bottom: -50px; margin-right: -50px;
|
||||
padding-bottom: 50px;
|
||||
height: 100%;
|
||||
outline: none; /* Prevent dragging from highlighting the element */
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
.CodeMirror-sizer {
|
||||
position: relative;
|
||||
border-right: 50px solid transparent;
|
||||
}
|
||||
|
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||
before actual scrolling happens, thus preventing shaking and
|
||||
flickering artifacts. */
|
||||
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
display: none;
|
||||
outline: none;
|
||||
}
|
||||
.CodeMirror-vscrollbar {
|
||||
right: 0; top: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.CodeMirror-hscrollbar {
|
||||
bottom: 0; left: 0;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.CodeMirror-scrollbar-filler {
|
||||
right: 0; bottom: 0;
|
||||
}
|
||||
.CodeMirror-gutter-filler {
|
||||
left: 0; bottom: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-gutters {
|
||||
position: absolute; left: 0; top: 0;
|
||||
min-height: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
.CodeMirror-gutter {
|
||||
white-space: normal;
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-bottom: -50px;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper {
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
}
|
||||
.CodeMirror-gutter-background {
|
||||
position: absolute;
|
||||
top: 0; bottom: 0;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-elt {
|
||||
position: absolute;
|
||||
cursor: default;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
|
||||
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
|
||||
|
||||
.CodeMirror-lines {
|
||||
cursor: text;
|
||||
min-height: 1px; /* prevents collapsing before first draw */
|
||||
}
|
||||
.CodeMirror pre.CodeMirror-line,
|
||||
.CodeMirror pre.CodeMirror-line-like {
|
||||
/* Reset some styles that the rest of the page might have set */
|
||||
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||
border-width: 0;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
white-space: pre;
|
||||
word-wrap: normal;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-font-variant-ligatures: contextual;
|
||||
font-variant-ligatures: contextual;
|
||||
}
|
||||
.CodeMirror-wrap pre.CodeMirror-line,
|
||||
.CodeMirror-wrap pre.CodeMirror-line-like {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.CodeMirror-linebackground {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: 0; bottom: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-linewidget {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
||||
}
|
||||
|
||||
.CodeMirror-widget {}
|
||||
|
||||
.CodeMirror-rtl pre { direction: rtl; }
|
||||
|
||||
.CodeMirror-code {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Force content-box sizing for the elements where we expect it */
|
||||
.CodeMirror-scroll,
|
||||
.CodeMirror-sizer,
|
||||
.CodeMirror-gutter,
|
||||
.CodeMirror-gutters,
|
||||
.CodeMirror-linenumber {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.CodeMirror-measure {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror-cursor {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.CodeMirror-measure pre { position: static; }
|
||||
|
||||
div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
}
|
||||
div.CodeMirror-dragcursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-focused div.CodeMirror-cursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-selected { background: #d9d9d9; }
|
||||
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
||||
.CodeMirror-crosshair { cursor: crosshair; }
|
||||
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
|
||||
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
|
||||
|
||||
.cm-searching {
|
||||
background-color: #ffa;
|
||||
background-color: rgba(255, 255, 0, .4);
|
||||
}
|
||||
|
||||
/* Used to force a border model for a node */
|
||||
.cm-force-border { padding-right: .1px; }
|
||||
|
||||
@media print {
|
||||
/* Hide the cursor when printing */
|
||||
.CodeMirror div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
/* See issue #2901 */
|
||||
.cm-tab-wrap-hack:after { content: ''; }
|
||||
|
||||
/* Help users use markselection to safely style text background */
|
||||
span.CodeMirror-selectedtext { background: none; }
|
||||
9874
assets/static/lib/codemirror/lib/codemirror.js
vendored
Normal file
9874
assets/static/lib/codemirror/lib/codemirror.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
53
assets/static/lib/codemirror/mode/properties/index.html
vendored
Normal file
53
assets/static/lib/codemirror/mode/properties/index.html
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: Properties files mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="properties.js"></script>
|
||||
<style>.CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}</style>
|
||||
<div id=nav>
|
||||
<a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror5">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">Properties files</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>Properties files mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
# This is a properties file
|
||||
a.key = A value
|
||||
another.key = http://example.com
|
||||
! Exclamation mark as comment
|
||||
but.not=Within ! A value # indeed
|
||||
# Spaces at the beginning of a line
|
||||
spaces.before.key=value
|
||||
backslash=Used for multi\
|
||||
line entries,\
|
||||
that's convenient.
|
||||
# Unicode sequences
|
||||
unicode.key=This is \u0020 Unicode
|
||||
no.multiline=here
|
||||
# Colons
|
||||
colons : can be used too
|
||||
# Spaces
|
||||
spaces\ in\ keys=Not very common...
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-properties</code>,
|
||||
<code>text/x-ini</code>.</p>
|
||||
|
||||
</article>
|
||||
78
assets/static/lib/codemirror/mode/properties/properties.js
vendored
Normal file
78
assets/static/lib/codemirror/mode/properties/properties.js
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("properties", function() {
|
||||
return {
|
||||
token: function(stream, state) {
|
||||
var sol = stream.sol() || state.afterSection;
|
||||
var eol = stream.eol();
|
||||
|
||||
state.afterSection = false;
|
||||
|
||||
if (sol) {
|
||||
if (state.nextMultiline) {
|
||||
state.inMultiline = true;
|
||||
state.nextMultiline = false;
|
||||
} else {
|
||||
state.position = "def";
|
||||
}
|
||||
}
|
||||
|
||||
if (eol && ! state.nextMultiline) {
|
||||
state.inMultiline = false;
|
||||
state.position = "def";
|
||||
}
|
||||
|
||||
if (sol) {
|
||||
while(stream.eatSpace()) {}
|
||||
}
|
||||
|
||||
var ch = stream.next();
|
||||
|
||||
if (sol && (ch === "#" || ch === "!" || ch === ";")) {
|
||||
state.position = "comment";
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
} else if (sol && ch === "[") {
|
||||
state.afterSection = true;
|
||||
stream.skipTo("]"); stream.eat("]");
|
||||
return "header";
|
||||
} else if (ch === "=" || ch === ":") {
|
||||
state.position = "quote";
|
||||
return null;
|
||||
} else if (ch === "\\" && state.position === "quote") {
|
||||
if (stream.eol()) { // end of line?
|
||||
// Multiline value
|
||||
state.nextMultiline = true;
|
||||
}
|
||||
}
|
||||
|
||||
return state.position;
|
||||
},
|
||||
|
||||
startState: function() {
|
||||
return {
|
||||
position : "def", // Current position, "def", "quote" or "comment"
|
||||
nextMultiline : false, // Is the next line multiline value
|
||||
inMultiline : false, // Is the current line a multiline value
|
||||
afterSection : false // Did we just open a section
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-properties", "properties");
|
||||
CodeMirror.defineMIME("text/x-ini", "properties");
|
||||
|
||||
});
|
||||
73
assets/static/lib/codemirror/mode/toml/index.html
vendored
Normal file
73
assets/static/lib/codemirror/mode/toml/index.html
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: TOML Mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="toml.js"></script>
|
||||
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
<div id=nav>
|
||||
<a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror5">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">TOML Mode</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>TOML Mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
# This is a TOML document. Boom.
|
||||
|
||||
title = "TOML Example"
|
||||
|
||||
[owner]
|
||||
name = "Tom Preston-Werner"
|
||||
organization = "GitHub"
|
||||
bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
|
||||
dob = 1979-05-27T07:32:00Z # First class dates? Why not?
|
||||
|
||||
[database]
|
||||
server = "192.168.1.1"
|
||||
ports = [ 8001, 8001, 8002 ]
|
||||
connection_max = 5000
|
||||
enabled = true
|
||||
|
||||
[servers]
|
||||
|
||||
# You can indent as you please. Tabs or spaces. TOML don't care.
|
||||
[servers.alpha]
|
||||
ip = "10.0.0.1"
|
||||
dc = "eqdc10"
|
||||
|
||||
[servers.beta]
|
||||
ip = "10.0.0.2"
|
||||
dc = "eqdc10"
|
||||
|
||||
[clients]
|
||||
data = [ ["gamma", "delta"], [1, 2] ]
|
||||
|
||||
# Line breaks are OK when inside arrays
|
||||
hosts = [
|
||||
"alpha",
|
||||
"omega"
|
||||
]
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
mode: {name: "toml"},
|
||||
lineNumbers: true
|
||||
});
|
||||
</script>
|
||||
<h3>The TOML Mode</h3>
|
||||
<p> Created by Forbes Lindesay.</p>
|
||||
<p><strong>MIME type defined:</strong> <code>text/x-toml</code>.</p>
|
||||
</article>
|
||||
88
assets/static/lib/codemirror/mode/toml/toml.js
vendored
Normal file
88
assets/static/lib/codemirror/mode/toml/toml.js
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("toml", function () {
|
||||
return {
|
||||
startState: function () {
|
||||
return {
|
||||
inString: false,
|
||||
stringType: "",
|
||||
lhs: true,
|
||||
inArray: 0
|
||||
};
|
||||
},
|
||||
token: function (stream, state) {
|
||||
//check for state changes
|
||||
if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) {
|
||||
state.stringType = stream.peek();
|
||||
stream.next(); // Skip quote
|
||||
state.inString = true; // Update state
|
||||
}
|
||||
if (stream.sol() && state.inArray === 0) {
|
||||
state.lhs = true;
|
||||
}
|
||||
//return state
|
||||
if (state.inString) {
|
||||
while (state.inString && !stream.eol()) {
|
||||
if (stream.peek() === state.stringType) {
|
||||
stream.next(); // Skip quote
|
||||
state.inString = false; // Clear flag
|
||||
} else if (stream.peek() === '\\') {
|
||||
stream.next();
|
||||
stream.next();
|
||||
} else {
|
||||
stream.match(/^.[^\\\"\']*/);
|
||||
}
|
||||
}
|
||||
return state.lhs ? "property string" : "string"; // Token style
|
||||
} else if (state.inArray && stream.peek() === ']') {
|
||||
stream.next();
|
||||
state.inArray--;
|
||||
return 'bracket';
|
||||
} else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) {
|
||||
stream.next();//skip closing ]
|
||||
// array of objects has an extra open & close []
|
||||
if (stream.peek() === ']') stream.next();
|
||||
return "atom";
|
||||
} else if (stream.peek() === "#") {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
} else if (stream.eatSpace()) {
|
||||
return null;
|
||||
} else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) {
|
||||
return "property";
|
||||
} else if (state.lhs && stream.peek() === "=") {
|
||||
stream.next();
|
||||
state.lhs = false;
|
||||
return null;
|
||||
} else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) {
|
||||
return 'atom'; //date
|
||||
} else if (!state.lhs && (stream.match('true') || stream.match('false'))) {
|
||||
return 'atom';
|
||||
} else if (!state.lhs && stream.peek() === '[') {
|
||||
state.inArray++;
|
||||
stream.next();
|
||||
return 'bracket';
|
||||
} else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) {
|
||||
return 'number';
|
||||
} else if (!stream.eatSpace()) {
|
||||
stream.next();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME('text/x-toml', 'toml');
|
||||
|
||||
});
|
||||
80
assets/static/lib/codemirror/mode/yaml/index.html
vendored
Normal file
80
assets/static/lib/codemirror/mode/yaml/index.html
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: YAML mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="yaml.js"></script>
|
||||
<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
|
||||
<div id=nav>
|
||||
<a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror5">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">YAML</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>YAML mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
--- # Favorite movies
|
||||
- Casablanca
|
||||
- North by Northwest
|
||||
- The Man Who Wasn't There
|
||||
--- # Shopping list
|
||||
[milk, pumpkin pie, eggs, juice]
|
||||
--- # Indented Blocks, common in YAML data files, use indentation and new lines to separate the key: value pairs
|
||||
name: John Smith
|
||||
age: 33
|
||||
--- # Inline Blocks, common in YAML data streams, use commas to separate the key: value pairs between braces
|
||||
{name: John Smith, age: 33}
|
||||
---
|
||||
receipt: Oz-Ware Purchase Invoice
|
||||
date: 2007-08-06
|
||||
customer:
|
||||
given: Dorothy
|
||||
family: Gale
|
||||
|
||||
items:
|
||||
- part_no: A4786
|
||||
descrip: Water Bucket (Filled)
|
||||
price: 1.47
|
||||
quantity: 4
|
||||
|
||||
- part_no: E1628
|
||||
descrip: High Heeled "Ruby" Slippers
|
||||
size: 8
|
||||
price: 100.27
|
||||
quantity: 1
|
||||
|
||||
bill-to: &id001
|
||||
street: |
|
||||
123 Tornado Alley
|
||||
Suite 16
|
||||
city: East Centerville
|
||||
state: KS
|
||||
|
||||
ship-to: *id001
|
||||
|
||||
specialDelivery: >
|
||||
Follow the Yellow Brick
|
||||
Road to the Emerald City.
|
||||
Pay no attention to the
|
||||
man behind the curtain.
|
||||
...
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-yaml</code>.</p>
|
||||
|
||||
</article>
|
||||
120
assets/static/lib/codemirror/mode/yaml/yaml.js
vendored
Normal file
120
assets/static/lib/codemirror/mode/yaml/yaml.js
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("yaml", function() {
|
||||
|
||||
var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
|
||||
var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
|
||||
|
||||
return {
|
||||
token: function(stream, state) {
|
||||
var ch = stream.peek();
|
||||
var esc = state.escaped;
|
||||
state.escaped = false;
|
||||
/* comments */
|
||||
if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
|
||||
if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))
|
||||
return "string";
|
||||
|
||||
if (state.literal && stream.indentation() > state.keyCol) {
|
||||
stream.skipToEnd(); return "string";
|
||||
} else if (state.literal) { state.literal = false; }
|
||||
if (stream.sol()) {
|
||||
state.keyCol = 0;
|
||||
state.pair = false;
|
||||
state.pairStart = false;
|
||||
/* document start */
|
||||
if(stream.match('---')) { return "def"; }
|
||||
/* document end */
|
||||
if (stream.match('...')) { return "def"; }
|
||||
/* array list item */
|
||||
if (stream.match(/\s*-\s+/)) { return 'meta'; }
|
||||
}
|
||||
/* inline pairs/lists */
|
||||
if (stream.match(/^(\{|\}|\[|\])/)) {
|
||||
if (ch == '{')
|
||||
state.inlinePairs++;
|
||||
else if (ch == '}')
|
||||
state.inlinePairs--;
|
||||
else if (ch == '[')
|
||||
state.inlineList++;
|
||||
else
|
||||
state.inlineList--;
|
||||
return 'meta';
|
||||
}
|
||||
|
||||
/* list separator */
|
||||
if (state.inlineList > 0 && !esc && ch == ',') {
|
||||
stream.next();
|
||||
return 'meta';
|
||||
}
|
||||
/* pairs separator */
|
||||
if (state.inlinePairs > 0 && !esc && ch == ',') {
|
||||
state.keyCol = 0;
|
||||
state.pair = false;
|
||||
state.pairStart = false;
|
||||
stream.next();
|
||||
return 'meta';
|
||||
}
|
||||
|
||||
/* start of value of a pair */
|
||||
if (state.pairStart) {
|
||||
/* block literals */
|
||||
if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
|
||||
/* references */
|
||||
if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
|
||||
/* numbers */
|
||||
if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
|
||||
if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
|
||||
/* keywords */
|
||||
if (stream.match(keywordRegex)) { return 'keyword'; }
|
||||
}
|
||||
|
||||
/* pairs (associative arrays) -> key */
|
||||
if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^\s,\[\]{}#&*!|>'"%@`])[^#:]*(?=:($|\s))/)) {
|
||||
state.pair = true;
|
||||
state.keyCol = stream.indentation();
|
||||
return "atom";
|
||||
}
|
||||
if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
|
||||
|
||||
/* nothing found, continue */
|
||||
state.pairStart = false;
|
||||
state.escaped = (ch == '\\');
|
||||
stream.next();
|
||||
return null;
|
||||
},
|
||||
startState: function() {
|
||||
return {
|
||||
pair: false,
|
||||
pairStart: false,
|
||||
keyCol: 0,
|
||||
inlinePairs: 0,
|
||||
inlineList: 0,
|
||||
literal: false,
|
||||
escaped: false
|
||||
};
|
||||
},
|
||||
lineComment: "#",
|
||||
fold: "indent"
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-yaml", "yaml");
|
||||
CodeMirror.defineMIME("text/yaml", "yaml");
|
||||
|
||||
});
|
||||
71
assets/static/lib/codemirror/theme/base16.css
vendored
Normal file
71
assets/static/lib/codemirror/theme/base16.css
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
|
||||
Name: Base16 Default Light
|
||||
Author: Chris Kempson (http://chriskempson.com)
|
||||
|
||||
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
||||
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
||||
|
||||
*/
|
||||
|
||||
.cm-s-base16.CodeMirror { background: #f5f5f5; color: #202020; }
|
||||
.cm-s-base16 div.CodeMirror-selected { background: #e0e0e0; }
|
||||
.cm-s-base16 .CodeMirror-line::selection, .cm-s-base16 .CodeMirror-line > span::selection, .cm-s-base16 .CodeMirror-line > span > span::selection { background: #e0e0e0; }
|
||||
.cm-s-base16 .CodeMirror-line::-moz-selection, .cm-s-base16 .CodeMirror-line > span::-moz-selection, .cm-s-base16 .CodeMirror-line > span > span::-moz-selection { background: #e0e0e0; }
|
||||
.cm-s-base16 .CodeMirror-gutters { background: #f5f5f5; border-right: 0px; }
|
||||
.cm-s-base16 .CodeMirror-guttermarker { color: #ac4142; }
|
||||
.cm-s-base16 .CodeMirror-guttermarker-subtle { color: #b0b0b0; }
|
||||
.cm-s-base16 .CodeMirror-linenumber { color: #b0b0b0; }
|
||||
.cm-s-base16 .CodeMirror-cursor { border-left: 1px solid #505050; }
|
||||
|
||||
.cm-s-base16 span.cm-comment { color: #8f5536; }
|
||||
.cm-s-base16 span.cm-atom { color: #aa759f; }
|
||||
.cm-s-base16 span.cm-number { color: #aa759f; }
|
||||
|
||||
.cm-s-base16 span.cm-property, .cm-s-base16 span.cm-attribute { color: #90a959; }
|
||||
.cm-s-base16 span.cm-keyword { color: #ac4142; }
|
||||
.cm-s-base16 span.cm-string { color: #f4bf75; }
|
||||
|
||||
.cm-s-base16 span.cm-variable { color: #90a959; }
|
||||
.cm-s-base16 span.cm-variable-2 { color: #6a9fb5; }
|
||||
.cm-s-base16 span.cm-def { color: #d28445; }
|
||||
.cm-s-base16 span.cm-bracket { color: #202020; }
|
||||
.cm-s-base16 span.cm-tag { color: #ac4142; }
|
||||
.cm-s-base16 span.cm-link { color: #aa759f; }
|
||||
.cm-s-base16 span.cm-error { background: #ac4142; color: #505050; }
|
||||
|
||||
.cm-s-base16 .CodeMirror-activeline-background { background: #DDDCDC; }
|
||||
.cm-s-base16 .CodeMirror-matchingbracket { color: #f5f5f5 !important; background-color: #6A9FB5 !important}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.cm-s-base16.CodeMirror { background: #151515; color: #e0e0e0; }
|
||||
.cm-s-base16 div.CodeMirror-selected { background: #303030; }
|
||||
.cm-s-base16 .CodeMirror-line::selection, .cm-s-base16 .CodeMirror-line > span::selection, .cm-s-base16 .CodeMirror-line > span > span::selection { background: rgba(48, 48, 48, .99); }
|
||||
.cm-s-base16 .CodeMirror-line::-moz-selection, .cm-s-base16 .CodeMirror-line > span::-moz-selection, .cm-s-base16 .CodeMirror-line > span > span::-moz-selection { background: rgba(48, 48, 48, .99); }
|
||||
.cm-s-base16 .CodeMirror-gutters { background: #151515; border-right: 0px; }
|
||||
.cm-s-base16 .CodeMirror-guttermarker { color: #ac4142; }
|
||||
.cm-s-base16 .CodeMirror-guttermarker-subtle { color: #505050; }
|
||||
.cm-s-base16 .CodeMirror-linenumber { color: #505050; }
|
||||
.cm-s-base16 .CodeMirror-cursor { border-left: 1px solid #b0b0b0; }
|
||||
.cm-s-base16.cm-fat-cursor .CodeMirror-cursor { background-color: #8e8d8875 !important; }
|
||||
.cm-s-base16 .cm-animate-fat-cursor { background-color: #8e8d8875 !important; }
|
||||
|
||||
.cm-s-base16 span.cm-comment { color: #8f5536; }
|
||||
.cm-s-base16 span.cm-atom { color: #aa759f; }
|
||||
.cm-s-base16 span.cm-number { color: #aa759f; }
|
||||
|
||||
.cm-s-base16 span.cm-property, .cm-s-base16 span.cm-attribute { color: #90a959; }
|
||||
.cm-s-base16 span.cm-keyword { color: #ac4142; }
|
||||
.cm-s-base16 span.cm-string { color: #f4bf75; }
|
||||
|
||||
.cm-s-base16 span.cm-variable { color: #90a959; }
|
||||
.cm-s-base16 span.cm-variable-2 { color: #6a9fb5; }
|
||||
.cm-s-base16 span.cm-def { color: #d28445; }
|
||||
.cm-s-base16 span.cm-bracket { color: #e0e0e0; }
|
||||
.cm-s-base16 span.cm-tag { color: #ac4142; }
|
||||
.cm-s-base16 span.cm-link { color: #aa759f; }
|
||||
.cm-s-base16 span.cm-error { background: #ac4142; color: #b0b0b0; }
|
||||
|
||||
.cm-s-base16 .CodeMirror-activeline-background { background: #202020; }
|
||||
.cm-s-base16 .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
|
||||
}
|
||||
Reference in New Issue
Block a user