Version Description
- now adjusts to the 'Enable full-height editor and distraction-free functionality' setting
- syntax highlighting on Theme and Plugin Editor pages
- fixed bug: native wp editor buttons work on content - no longer overwrites with emulating buttons
-
Settings:
- added an extendable settings panel
- saves settings to WordPress user profile
- added more text customization settings
- basically rewrote the whole codebase
Download this release
Release Info
Developer | arniebradfo |
Plugin | HTML Editor Syntax Highlighter |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.7.2 to 2.0.0
- css.json +50 -0
- dist/hesh.css +1848 -0
- dist/hesh.js +13697 -0
- dist/hesh.min.css +1 -0
- dist/hesh.min.js +9 -0
css.json
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
"3024-day",
|
3 |
+
"3024-night",
|
4 |
+
"abcdef",
|
5 |
+
"ambiance-mobile",
|
6 |
+
"ambiance",
|
7 |
+
"base16-dark",
|
8 |
+
"base16-light",
|
9 |
+
"bespin",
|
10 |
+
"blackboard",
|
11 |
+
"cobalt",
|
12 |
+
"colorforth",
|
13 |
+
"dracula",
|
14 |
+
"duotone-dark",
|
15 |
+
"duotone-light",
|
16 |
+
"eclipse",
|
17 |
+
"elegant",
|
18 |
+
"erlang-dark",
|
19 |
+
"hopscotch",
|
20 |
+
"icecoder",
|
21 |
+
"isotope",
|
22 |
+
"lesser-dark",
|
23 |
+
"liquibyte",
|
24 |
+
"material",
|
25 |
+
"mbo",
|
26 |
+
"mdn-like",
|
27 |
+
"midnight",
|
28 |
+
"monokai",
|
29 |
+
"neat",
|
30 |
+
"neo",
|
31 |
+
"night",
|
32 |
+
"panda-syntax",
|
33 |
+
"paraiso-dark",
|
34 |
+
"paraiso-light",
|
35 |
+
"pastel-on-dark",
|
36 |
+
"railscasts",
|
37 |
+
"rubyblue",
|
38 |
+
"seti",
|
39 |
+
"solarized",
|
40 |
+
"the-matrix",
|
41 |
+
"tomorrow-night-bright",
|
42 |
+
"tomorrow-night-eighties",
|
43 |
+
"ttcn",
|
44 |
+
"twilight",
|
45 |
+
"vibrant-ink",
|
46 |
+
"xq-dark",
|
47 |
+
"xq-light",
|
48 |
+
"yeti",
|
49 |
+
"zenburn"
|
50 |
+
]
|
dist/hesh.css
ADDED
@@ -0,0 +1,1848 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**!
|
2 |
+
* Plugin Name: HTML Editor Syntax Highlighter
|
3 |
+
* Author: James Bradford
|
4 |
+
* Author URI: http://arniebradfo.com/
|
5 |
+
* Author: Peter Mukhortov
|
6 |
+
* Author URI: http://mukhortov.com/
|
7 |
+
* Version: 2.0.0
|
8 |
+
*//* BASICS */.CodeMirror {
|
9 |
+
/* Set height, width, borders, and global font properties here */
|
10 |
+
font-family: monospace;
|
11 |
+
height: 300px;
|
12 |
+
color: black;
|
13 |
+
}/* PADDING */.CodeMirror-lines {
|
14 |
+
padding: 4px 0;
|
15 |
+
/* Vertical padding around content */;
|
16 |
+
}
|
17 |
+
|
18 |
+
.CodeMirror pre {
|
19 |
+
padding: 0 4px;
|
20 |
+
/* Horizontal padding of content */;
|
21 |
+
}
|
22 |
+
|
23 |
+
.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler {
|
24 |
+
background-color: white;
|
25 |
+
/* The little square between H and V scrollbars */;
|
26 |
+
}/* GUTTER */.CodeMirror-gutters {
|
27 |
+
border-right: 1px solid #ddd;
|
28 |
+
background-color: #f7f7f7;
|
29 |
+
white-space: nowrap;
|
30 |
+
}
|
31 |
+
|
32 |
+
.CodeMirror-linenumber {
|
33 |
+
padding: 0 3px 0 5px;
|
34 |
+
min-width: 20px;
|
35 |
+
text-align: right;
|
36 |
+
color: #999;
|
37 |
+
white-space: nowrap;
|
38 |
+
}
|
39 |
+
|
40 |
+
.CodeMirror-guttermarker {
|
41 |
+
color: black;
|
42 |
+
}
|
43 |
+
|
44 |
+
.CodeMirror-guttermarker-subtle {
|
45 |
+
color: #999;
|
46 |
+
}/* CURSOR */.CodeMirror-cursor {
|
47 |
+
border-left: 1px solid black;
|
48 |
+
border-right: none;
|
49 |
+
width: 0;
|
50 |
+
}/* Shown when moving in bi-directional text */.CodeMirror div.CodeMirror-secondarycursor {
|
51 |
+
border-left: 1px solid silver;
|
52 |
+
}
|
53 |
+
|
54 |
+
.cm-fat-cursor .CodeMirror-cursor {
|
55 |
+
width: auto;
|
56 |
+
border: 0 !important;
|
57 |
+
background: #7e7;
|
58 |
+
}
|
59 |
+
|
60 |
+
.cm-fat-cursor div.CodeMirror-cursors {
|
61 |
+
z-index: 1;
|
62 |
+
}
|
63 |
+
|
64 |
+
.cm-animate-fat-cursor {
|
65 |
+
width: auto;
|
66 |
+
border: 0;
|
67 |
+
animation: blink 1.06s steps(1) infinite;
|
68 |
+
background-color: #7e7;
|
69 |
+
}/* Can style cursor different in overwrite (non-insert) mode */.cm-tab {
|
70 |
+
display: inline-block;
|
71 |
+
text-decoration: inherit;
|
72 |
+
}
|
73 |
+
|
74 |
+
.CodeMirror-rulers {
|
75 |
+
position: absolute;
|
76 |
+
left: 0;
|
77 |
+
right: 0;
|
78 |
+
top: -50px;
|
79 |
+
bottom: -20px;
|
80 |
+
overflow: hidden;
|
81 |
+
}
|
82 |
+
|
83 |
+
.CodeMirror-ruler {
|
84 |
+
border-left: 1px solid #ccc;
|
85 |
+
top: 0;
|
86 |
+
bottom: 0;
|
87 |
+
position: absolute;
|
88 |
+
}/* DEFAULT THEME */.cm-s-default .cm-header {
|
89 |
+
color: blue;
|
90 |
+
}
|
91 |
+
|
92 |
+
.cm-s-default .cm-quote {
|
93 |
+
color: #090;
|
94 |
+
}
|
95 |
+
|
96 |
+
.cm-negative {
|
97 |
+
color: #d44;
|
98 |
+
}
|
99 |
+
|
100 |
+
.cm-positive {
|
101 |
+
color: #292;
|
102 |
+
}
|
103 |
+
|
104 |
+
.cm-header,.cm-strong {
|
105 |
+
font-weight: bold;
|
106 |
+
}
|
107 |
+
|
108 |
+
.cm-em {
|
109 |
+
font-style: italic;
|
110 |
+
}
|
111 |
+
|
112 |
+
.cm-link {
|
113 |
+
text-decoration: underline;
|
114 |
+
}
|
115 |
+
|
116 |
+
.cm-strikethrough {
|
117 |
+
text-decoration: line-through;
|
118 |
+
}
|
119 |
+
|
120 |
+
.cm-s-default .cm-keyword {
|
121 |
+
color: #708;
|
122 |
+
}
|
123 |
+
|
124 |
+
.cm-s-default .cm-atom {
|
125 |
+
color: #219;
|
126 |
+
}
|
127 |
+
|
128 |
+
.cm-s-default .cm-number {
|
129 |
+
color: #164;
|
130 |
+
}
|
131 |
+
|
132 |
+
.cm-s-default .cm-def {
|
133 |
+
color: #00f;
|
134 |
+
}
|
135 |
+
|
136 |
+
.cm-s-default .cm-variable-2 {
|
137 |
+
color: #05a;
|
138 |
+
}
|
139 |
+
|
140 |
+
.cm-s-default .cm-variable-3 {
|
141 |
+
color: #085;
|
142 |
+
}
|
143 |
+
|
144 |
+
.cm-s-default .cm-comment {
|
145 |
+
color: #a50;
|
146 |
+
}
|
147 |
+
|
148 |
+
.cm-s-default .cm-string {
|
149 |
+
color: #a11;
|
150 |
+
}
|
151 |
+
|
152 |
+
.cm-s-default .cm-string-2 {
|
153 |
+
color: #f50;
|
154 |
+
}
|
155 |
+
|
156 |
+
.cm-s-default .cm-meta {
|
157 |
+
color: #555;
|
158 |
+
}
|
159 |
+
|
160 |
+
.cm-s-default .cm-qualifier {
|
161 |
+
color: #555;
|
162 |
+
}
|
163 |
+
|
164 |
+
.cm-s-default .cm-builtin {
|
165 |
+
color: #30a;
|
166 |
+
}
|
167 |
+
|
168 |
+
.cm-s-default .cm-bracket {
|
169 |
+
color: #997;
|
170 |
+
}
|
171 |
+
|
172 |
+
.cm-s-default .cm-tag {
|
173 |
+
color: #170;
|
174 |
+
}
|
175 |
+
|
176 |
+
.cm-s-default .cm-attribute {
|
177 |
+
color: #00c;
|
178 |
+
}
|
179 |
+
|
180 |
+
.cm-s-default .cm-hr {
|
181 |
+
color: #999;
|
182 |
+
}
|
183 |
+
|
184 |
+
.cm-s-default .cm-link {
|
185 |
+
color: #00c;
|
186 |
+
}
|
187 |
+
|
188 |
+
.cm-s-default .cm-error {
|
189 |
+
color: #f00;
|
190 |
+
}
|
191 |
+
|
192 |
+
.cm-invalidchar {
|
193 |
+
color: #f00;
|
194 |
+
}
|
195 |
+
|
196 |
+
.CodeMirror-composing {
|
197 |
+
border-bottom: 2px solid;
|
198 |
+
}/* Default styles for common addons */div.CodeMirror span.CodeMirror-matchingbracket {
|
199 |
+
color: #0f0;
|
200 |
+
}
|
201 |
+
|
202 |
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
203 |
+
color: #f22;
|
204 |
+
}
|
205 |
+
|
206 |
+
.CodeMirror-matchingtag {
|
207 |
+
background: rgba(255, 150, 0, 0.3);
|
208 |
+
}
|
209 |
+
|
210 |
+
.CodeMirror-activeline-background {
|
211 |
+
background: #e8f2ff;
|
212 |
+
}/* STOP *//* The rest of this file contains styles related to the mechanics of
|
213 |
+
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 */ /* 30px is the magic margin used to hide the element's real scrollbars */ /* See overflow: hidden in .CodeMirror */margin-bottom: -30px;margin-right: -30px;padding-bottom: 30px;height: 100%;outline: none; /* Prevent dragging from highlighting the element */position: relative;
|
214 |
+
}
|
215 |
+
|
216 |
+
.CodeMirror-sizer {
|
217 |
+
position: relative;
|
218 |
+
border-right: 30px solid transparent;
|
219 |
+
}/* The fake, visible scrollbars. Used to force redraw during scrolling
|
220 |
+
before actual scrolling happens, thus preventing shaking and
|
221 |
+
flickering artifacts. */.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler {
|
222 |
+
position: absolute;
|
223 |
+
z-index: 6;
|
224 |
+
display: none;
|
225 |
+
}
|
226 |
+
|
227 |
+
.CodeMirror-vscrollbar {
|
228 |
+
right: 0;
|
229 |
+
top: 0;
|
230 |
+
overflow-x: hidden;
|
231 |
+
overflow-y: scroll;
|
232 |
+
}
|
233 |
+
|
234 |
+
.CodeMirror-hscrollbar {
|
235 |
+
bottom: 0;
|
236 |
+
left: 0;
|
237 |
+
overflow-y: hidden;
|
238 |
+
overflow-x: scroll;
|
239 |
+
}
|
240 |
+
|
241 |
+
.CodeMirror-scrollbar-filler {
|
242 |
+
right: 0;
|
243 |
+
bottom: 0;
|
244 |
+
}
|
245 |
+
|
246 |
+
.CodeMirror-gutter-filler {
|
247 |
+
left: 0;
|
248 |
+
bottom: 0;
|
249 |
+
}
|
250 |
+
|
251 |
+
.CodeMirror-gutters {
|
252 |
+
position: absolute;
|
253 |
+
left: 0;
|
254 |
+
top: 0;
|
255 |
+
min-height: 100%;
|
256 |
+
z-index: 3;
|
257 |
+
}
|
258 |
+
|
259 |
+
.CodeMirror-gutter {
|
260 |
+
white-space: normal;
|
261 |
+
height: 100%;
|
262 |
+
display: inline-block;
|
263 |
+
vertical-align: top;
|
264 |
+
margin-bottom: -30px;
|
265 |
+
}
|
266 |
+
|
267 |
+
.CodeMirror-gutter-wrapper {
|
268 |
+
position: absolute;
|
269 |
+
z-index: 4;
|
270 |
+
background: none !important;
|
271 |
+
border: none !important;
|
272 |
+
}
|
273 |
+
|
274 |
+
.CodeMirror-gutter-background {
|
275 |
+
position: absolute;
|
276 |
+
top: 0;
|
277 |
+
bottom: 0;
|
278 |
+
z-index: 4;
|
279 |
+
}
|
280 |
+
|
281 |
+
.CodeMirror-gutter-elt {
|
282 |
+
position: absolute;
|
283 |
+
cursor: default;
|
284 |
+
z-index: 4;
|
285 |
+
}
|
286 |
+
|
287 |
+
.CodeMirror-gutter-wrapper ::-moz-selection {
|
288 |
+
background-color: transparent;
|
289 |
+
}
|
290 |
+
|
291 |
+
.CodeMirror-gutter-wrapper ::selection {
|
292 |
+
background-color: transparent;
|
293 |
+
}
|
294 |
+
|
295 |
+
.CodeMirror-gutter-wrapper ::-moz-selection {
|
296 |
+
background-color: transparent;
|
297 |
+
}
|
298 |
+
|
299 |
+
.CodeMirror-lines {
|
300 |
+
cursor: text;
|
301 |
+
min-height: 1px;
|
302 |
+
/* prevents collapsing before first draw */;
|
303 |
+
}
|
304 |
+
|
305 |
+
.CodeMirror pre {
|
306 |
+
/* Reset some styles that the rest of the page might have set */
|
307 |
+
border-radius: 0;
|
308 |
+
border-width: 0;
|
309 |
+
background: transparent;
|
310 |
+
font-family: inherit;
|
311 |
+
font-size: inherit;
|
312 |
+
margin: 0;
|
313 |
+
white-space: pre;
|
314 |
+
word-wrap: normal;
|
315 |
+
line-height: inherit;
|
316 |
+
color: inherit;
|
317 |
+
z-index: 2;
|
318 |
+
position: relative;
|
319 |
+
overflow: visible;
|
320 |
+
-webkit-tap-highlight-color: transparent;
|
321 |
+
font-variant-ligatures: contextual;
|
322 |
+
}
|
323 |
+
|
324 |
+
.CodeMirror-wrap pre {
|
325 |
+
word-wrap: break-word;
|
326 |
+
white-space: pre-wrap;
|
327 |
+
word-break: normal;
|
328 |
+
}
|
329 |
+
|
330 |
+
.CodeMirror-linebackground {
|
331 |
+
position: absolute;
|
332 |
+
left: 0;
|
333 |
+
right: 0;
|
334 |
+
top: 0;
|
335 |
+
bottom: 0;
|
336 |
+
z-index: 0;
|
337 |
+
}
|
338 |
+
|
339 |
+
.CodeMirror-linewidget {
|
340 |
+
position: relative;
|
341 |
+
z-index: 2;
|
342 |
+
overflow: auto;
|
343 |
+
}
|
344 |
+
|
345 |
+
.CodeMirror-rtl pre {
|
346 |
+
direction: rtl;
|
347 |
+
}
|
348 |
+
|
349 |
+
.CodeMirror-code {
|
350 |
+
outline: none;
|
351 |
+
}/* Force content-box sizing for the elements where we expect it */.CodeMirror-scroll,.CodeMirror-sizer,.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber {
|
352 |
+
box-sizing: content-box;
|
353 |
+
}
|
354 |
+
|
355 |
+
.CodeMirror-measure {
|
356 |
+
position: absolute;
|
357 |
+
width: 100%;
|
358 |
+
height: 0;
|
359 |
+
overflow: hidden;
|
360 |
+
visibility: hidden;
|
361 |
+
}
|
362 |
+
|
363 |
+
.CodeMirror-cursor {
|
364 |
+
position: absolute;
|
365 |
+
pointer-events: none;
|
366 |
+
}
|
367 |
+
|
368 |
+
.CodeMirror-measure pre {
|
369 |
+
position: static;
|
370 |
+
}
|
371 |
+
|
372 |
+
div.CodeMirror-cursors {
|
373 |
+
visibility: hidden;
|
374 |
+
position: relative;
|
375 |
+
z-index: 3;
|
376 |
+
}
|
377 |
+
|
378 |
+
div.CodeMirror-dragcursors {
|
379 |
+
visibility: visible;
|
380 |
+
}
|
381 |
+
|
382 |
+
.CodeMirror-focused div.CodeMirror-cursors {
|
383 |
+
visibility: visible;
|
384 |
+
}
|
385 |
+
|
386 |
+
.CodeMirror-selected {
|
387 |
+
background: #d9d9d9;
|
388 |
+
}
|
389 |
+
|
390 |
+
.CodeMirror-focused .CodeMirror-selected {
|
391 |
+
background: #d7d4f0;
|
392 |
+
}
|
393 |
+
|
394 |
+
.CodeMirror-crosshair {
|
395 |
+
cursor: crosshair;
|
396 |
+
}
|
397 |
+
|
398 |
+
.CodeMirror-line::-moz-selection,.CodeMirror-line > span::-moz-selection,.CodeMirror-line > span > span::-moz-selection {
|
399 |
+
background: #d7d4f0;
|
400 |
+
}
|
401 |
+
|
402 |
+
.CodeMirror-line::selection,.CodeMirror-line > span::selection,.CodeMirror-line > span > span::selection {
|
403 |
+
background: #d7d4f0;
|
404 |
+
}
|
405 |
+
|
406 |
+
.CodeMirror-line::-moz-selection,.CodeMirror-line > span::-moz-selection,.CodeMirror-line > span > span::-moz-selection {
|
407 |
+
background: #d7d4f0;
|
408 |
+
}
|
409 |
+
|
410 |
+
.cm-searching {
|
411 |
+
background: #ffa;
|
412 |
+
background: rgba(255, 255, 0, 0.4);
|
413 |
+
}/* Used to force a border model for a node */.cm-force-border {
|
414 |
+
padding-right: .1px;
|
415 |
+
}/* See issue #2901 */.cm-tab-wrap-hack:after {
|
416 |
+
content: '';
|
417 |
+
}/* Help users use markselection to safely style text background */span.CodeMirror-selectedtext {
|
418 |
+
background: none;
|
419 |
+
}/*
|
420 |
+
|
421 |
+
Name: 3024 day
|
422 |
+
Author: Jan T. Sott (http://github.com/idleberg)
|
423 |
+
|
424 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
425 |
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
426 |
+
|
427 |
+
*/.cm-s-3024-day.CodeMirror {
|
428 |
+
background: #f7f7f7;
|
429 |
+
color: #3a3432;
|
430 |
+
}
|
431 |
+
|
432 |
+
.cm-s-3024-day div.CodeMirror-selected {
|
433 |
+
background: #d6d5d4;
|
434 |
+
}
|
435 |
+
|
436 |
+
.cm-s-3024-day .CodeMirror-line::-moz-selection,.cm-s-3024-day .CodeMirror-line > span::-moz-selection,.cm-s-3024-day .CodeMirror-line > span > span::-moz-selection {
|
437 |
+
background: #d6d5d4;
|
438 |
+
}
|
439 |
+
|
440 |
+
.cm-s-3024-day .CodeMirror-line::selection,.cm-s-3024-day .CodeMirror-line > span::selection,.cm-s-3024-day .CodeMirror-line > span > span::selection {
|
441 |
+
background: #d6d5d4;
|
442 |
+
}
|
443 |
+
|
444 |
+
.cm-s-3024-day .CodeMirror-line::-moz-selection,.cm-s-3024-day .CodeMirror-line > span::-moz-selection,.cm-s-3024-day .CodeMirror-line > span > span::-moz-selection {
|
445 |
+
background: #d9d9d9;
|
446 |
+
}
|
447 |
+
|
448 |
+
.cm-s-3024-day .CodeMirror-line::-moz-selection,.cm-s-3024-day .CodeMirror-line > span::-moz-selection,.cm-s-3024-day .CodeMirror-line > span > span::selection {
|
449 |
+
background: #d9d9d9;
|
450 |
+
}
|
451 |
+
|
452 |
+
.cm-s-3024-day .CodeMirror-gutters {
|
453 |
+
background: #f7f7f7;
|
454 |
+
border-right: 0px;
|
455 |
+
}
|
456 |
+
|
457 |
+
.cm-s-3024-day .CodeMirror-guttermarker {
|
458 |
+
color: #db2d20;
|
459 |
+
}
|
460 |
+
|
461 |
+
.cm-s-3024-day .CodeMirror-guttermarker-subtle {
|
462 |
+
color: #807d7c;
|
463 |
+
}
|
464 |
+
|
465 |
+
.cm-s-3024-day .CodeMirror-linenumber {
|
466 |
+
color: #807d7c;
|
467 |
+
}
|
468 |
+
|
469 |
+
.cm-s-3024-day .CodeMirror-cursor {
|
470 |
+
border-left: 1px solid #5c5855;
|
471 |
+
}
|
472 |
+
|
473 |
+
.cm-s-3024-day span.cm-comment {
|
474 |
+
color: #cdab53;
|
475 |
+
}
|
476 |
+
|
477 |
+
.cm-s-3024-day span.cm-atom {
|
478 |
+
color: #a16a94;
|
479 |
+
}
|
480 |
+
|
481 |
+
.cm-s-3024-day span.cm-number {
|
482 |
+
color: #a16a94;
|
483 |
+
}
|
484 |
+
|
485 |
+
.cm-s-3024-day span.cm-property,.cm-s-3024-day span.cm-attribute {
|
486 |
+
color: #01a252;
|
487 |
+
}
|
488 |
+
|
489 |
+
.cm-s-3024-day span.cm-keyword {
|
490 |
+
color: #db2d20;
|
491 |
+
}
|
492 |
+
|
493 |
+
.cm-s-3024-day span.cm-string {
|
494 |
+
color: #fded02;
|
495 |
+
}
|
496 |
+
|
497 |
+
.cm-s-3024-day span.cm-variable {
|
498 |
+
color: #01a252;
|
499 |
+
}
|
500 |
+
|
501 |
+
.cm-s-3024-day span.cm-variable-2 {
|
502 |
+
color: #01a0e4;
|
503 |
+
}
|
504 |
+
|
505 |
+
.cm-s-3024-day span.cm-def {
|
506 |
+
color: #e8bbd0;
|
507 |
+
}
|
508 |
+
|
509 |
+
.cm-s-3024-day span.cm-bracket {
|
510 |
+
color: #3a3432;
|
511 |
+
}
|
512 |
+
|
513 |
+
.cm-s-3024-day span.cm-tag {
|
514 |
+
color: #db2d20;
|
515 |
+
}
|
516 |
+
|
517 |
+
.cm-s-3024-day span.cm-link {
|
518 |
+
color: #a16a94;
|
519 |
+
}
|
520 |
+
|
521 |
+
.cm-s-3024-day span.cm-error {
|
522 |
+
background: #db2d20;
|
523 |
+
color: #5c5855;
|
524 |
+
}
|
525 |
+
|
526 |
+
.cm-s-3024-day .CodeMirror-activeline-background {
|
527 |
+
background: #e8f2ff;
|
528 |
+
}
|
529 |
+
|
530 |
+
.cm-s-3024-day .CodeMirror-matchingbracket {
|
531 |
+
text-decoration: underline;
|
532 |
+
color: #a16a94 !important;
|
533 |
+
}/*
|
534 |
+
|
535 |
+
Name: 3024 night
|
536 |
+
Author: Jan T. Sott (http://github.com/idleberg)
|
537 |
+
|
538 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
539 |
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
540 |
+
|
541 |
+
*/.cm-s-3024-night.CodeMirror {
|
542 |
+
background: #090300;
|
543 |
+
color: #d6d5d4;
|
544 |
+
}
|
545 |
+
|
546 |
+
.cm-s-3024-night div.CodeMirror-selected {
|
547 |
+
background: #3a3432;
|
548 |
+
}
|
549 |
+
|
550 |
+
.cm-s-3024-night .CodeMirror-line::-moz-selection,.cm-s-3024-night .CodeMirror-line > span::-moz-selection,.cm-s-3024-night .CodeMirror-line > span > span::-moz-selection {
|
551 |
+
background: rgba(58, 52, 50, 0.99);
|
552 |
+
}
|
553 |
+
|
554 |
+
.cm-s-3024-night .CodeMirror-line::selection,.cm-s-3024-night .CodeMirror-line > span::selection,.cm-s-3024-night .CodeMirror-line > span > span::selection {
|
555 |
+
background: rgba(58, 52, 50, 0.99);
|
556 |
+
}
|
557 |
+
|
558 |
+
.cm-s-3024-night .CodeMirror-line::-moz-selection,.cm-s-3024-night .CodeMirror-line > span::-moz-selection,.cm-s-3024-night .CodeMirror-line > span > span::-moz-selection {
|
559 |
+
background: rgba(58, 52, 50, 0.99);
|
560 |
+
}
|
561 |
+
|
562 |
+
.cm-s-3024-night .CodeMirror-gutters {
|
563 |
+
background: #090300;
|
564 |
+
border-right: 0px;
|
565 |
+
}
|
566 |
+
|
567 |
+
.cm-s-3024-night .CodeMirror-guttermarker {
|
568 |
+
color: #db2d20;
|
569 |
+
}
|
570 |
+
|
571 |
+
.cm-s-3024-night .CodeMirror-guttermarker-subtle {
|
572 |
+
color: #5c5855;
|
573 |
+
}
|
574 |
+
|
575 |
+
.cm-s-3024-night .CodeMirror-linenumber {
|
576 |
+
color: #5c5855;
|
577 |
+
}
|
578 |
+
|
579 |
+
.cm-s-3024-night .CodeMirror-cursor {
|
580 |
+
border-left: 1px solid #807d7c;
|
581 |
+
}
|
582 |
+
|
583 |
+
.cm-s-3024-night span.cm-comment {
|
584 |
+
color: #cdab53;
|
585 |
+
}
|
586 |
+
|
587 |
+
.cm-s-3024-night span.cm-atom {
|
588 |
+
color: #a16a94;
|
589 |
+
}
|
590 |
+
|
591 |
+
.cm-s-3024-night span.cm-number {
|
592 |
+
color: #a16a94;
|
593 |
+
}
|
594 |
+
|
595 |
+
.cm-s-3024-night span.cm-property,.cm-s-3024-night span.cm-attribute {
|
596 |
+
color: #01a252;
|
597 |
+
}
|
598 |
+
|
599 |
+
.cm-s-3024-night span.cm-keyword {
|
600 |
+
color: #db2d20;
|
601 |
+
}
|
602 |
+
|
603 |
+
.cm-s-3024-night span.cm-string {
|
604 |
+
color: #fded02;
|
605 |
+
}
|
606 |
+
|
607 |
+
.cm-s-3024-night span.cm-variable {
|
608 |
+
color: #01a252;
|
609 |
+
}
|
610 |
+
|
611 |
+
.cm-s-3024-night span.cm-variable-2 {
|
612 |
+
color: #01a0e4;
|
613 |
+
}
|
614 |
+
|
615 |
+
.cm-s-3024-night span.cm-def {
|
616 |
+
color: #e8bbd0;
|
617 |
+
}
|
618 |
+
|
619 |
+
.cm-s-3024-night span.cm-bracket {
|
620 |
+
color: #d6d5d4;
|
621 |
+
}
|
622 |
+
|
623 |
+
.cm-s-3024-night span.cm-tag {
|
624 |
+
color: #db2d20;
|
625 |
+
}
|
626 |
+
|
627 |
+
.cm-s-3024-night span.cm-link {
|
628 |
+
color: #a16a94;
|
629 |
+
}
|
630 |
+
|
631 |
+
.cm-s-3024-night span.cm-error {
|
632 |
+
background: #db2d20;
|
633 |
+
color: #807d7c;
|
634 |
+
}
|
635 |
+
|
636 |
+
.cm-s-3024-night .CodeMirror-activeline-background {
|
637 |
+
background: #2F2F2F;
|
638 |
+
}
|
639 |
+
|
640 |
+
.cm-s-3024-night .CodeMirror-matchingbracket {
|
641 |
+
text-decoration: underline;
|
642 |
+
color: white !important;
|
643 |
+
}
|
644 |
+
|
645 |
+
.cm-s-abcdef.CodeMirror {
|
646 |
+
background: #0f0f0f;
|
647 |
+
color: #defdef;
|
648 |
+
}
|
649 |
+
|
650 |
+
.cm-s-abcdef div.CodeMirror-selected {
|
651 |
+
background: #515151;
|
652 |
+
}
|
653 |
+
|
654 |
+
.cm-s-abcdef .CodeMirror-line::-moz-selection,.cm-s-abcdef .CodeMirror-line > span::-moz-selection,.cm-s-abcdef .CodeMirror-line > span > span::-moz-selection {
|
655 |
+
background: rgba(56, 56, 56, 0.99);
|
656 |
+
}
|
657 |
+
|
658 |
+
.cm-s-abcdef .CodeMirror-line::selection,.cm-s-abcdef .CodeMirror-line > span::selection,.cm-s-abcdef .CodeMirror-line > span > span::selection {
|
659 |
+
background: rgba(56, 56, 56, 0.99);
|
660 |
+
}
|
661 |
+
|
662 |
+
.cm-s-abcdef .CodeMirror-line::-moz-selection,.cm-s-abcdef .CodeMirror-line > span::-moz-selection,.cm-s-abcdef .CodeMirror-line > span > span::-moz-selection {
|
663 |
+
background: rgba(56, 56, 56, 0.99);
|
664 |
+
}
|
665 |
+
|
666 |
+
.cm-s-abcdef .CodeMirror-gutters {
|
667 |
+
background: #555;
|
668 |
+
border-right: 2px solid #314151;
|
669 |
+
}
|
670 |
+
|
671 |
+
.cm-s-abcdef .CodeMirror-guttermarker {
|
672 |
+
color: #222;
|
673 |
+
}
|
674 |
+
|
675 |
+
.cm-s-abcdef .CodeMirror-guttermarker-subtle {
|
676 |
+
color: azure;
|
677 |
+
}
|
678 |
+
|
679 |
+
.cm-s-abcdef .CodeMirror-linenumber {
|
680 |
+
color: #FFFFFF;
|
681 |
+
}
|
682 |
+
|
683 |
+
.cm-s-abcdef .CodeMirror-cursor {
|
684 |
+
border-left: 1px solid #00FF00;
|
685 |
+
}
|
686 |
+
|
687 |
+
.cm-s-abcdef span.cm-keyword {
|
688 |
+
color: darkgoldenrod;
|
689 |
+
font-weight: bold;
|
690 |
+
}
|
691 |
+
|
692 |
+
.cm-s-abcdef span.cm-atom {
|
693 |
+
color: #77F;
|
694 |
+
}
|
695 |
+
|
696 |
+
.cm-s-abcdef span.cm-number {
|
697 |
+
color: violet;
|
698 |
+
}
|
699 |
+
|
700 |
+
.cm-s-abcdef span.cm-def {
|
701 |
+
color: #fffabc;
|
702 |
+
}
|
703 |
+
|
704 |
+
.cm-s-abcdef span.cm-variable {
|
705 |
+
color: #abcdef;
|
706 |
+
}
|
707 |
+
|
708 |
+
.cm-s-abcdef span.cm-variable-2 {
|
709 |
+
color: #cacbcc;
|
710 |
+
}
|
711 |
+
|
712 |
+
.cm-s-abcdef span.cm-variable-3 {
|
713 |
+
color: #def;
|
714 |
+
}
|
715 |
+
|
716 |
+
.cm-s-abcdef span.cm-property {
|
717 |
+
color: #fedcba;
|
718 |
+
}
|
719 |
+
|
720 |
+
.cm-s-abcdef span.cm-operator {
|
721 |
+
color: #ff0;
|
722 |
+
}
|
723 |
+
|
724 |
+
.cm-s-abcdef span.cm-comment {
|
725 |
+
color: #7a7b7c;
|
726 |
+
font-style: italic;
|
727 |
+
}
|
728 |
+
|
729 |
+
.cm-s-abcdef span.cm-string {
|
730 |
+
color: #2b4;
|
731 |
+
}
|
732 |
+
|
733 |
+
.cm-s-abcdef span.cm-meta {
|
734 |
+
color: #C9F;
|
735 |
+
}
|
736 |
+
|
737 |
+
.cm-s-abcdef span.cm-qualifier {
|
738 |
+
color: #FFF700;
|
739 |
+
}
|
740 |
+
|
741 |
+
.cm-s-abcdef span.cm-builtin {
|
742 |
+
color: #30aabc;
|
743 |
+
}
|
744 |
+
|
745 |
+
.cm-s-abcdef span.cm-bracket {
|
746 |
+
color: #8a8a8a;
|
747 |
+
}
|
748 |
+
|
749 |
+
.cm-s-abcdef span.cm-tag {
|
750 |
+
color: #FFDD44;
|
751 |
+
}
|
752 |
+
|
753 |
+
.cm-s-abcdef span.cm-attribute {
|
754 |
+
color: #DDFF00;
|
755 |
+
}
|
756 |
+
|
757 |
+
.cm-s-abcdef span.cm-error {
|
758 |
+
color: #FF0000;
|
759 |
+
}
|
760 |
+
|
761 |
+
.cm-s-abcdef span.cm-header {
|
762 |
+
color: aquamarine;
|
763 |
+
font-weight: bold;
|
764 |
+
}
|
765 |
+
|
766 |
+
.cm-s-abcdef span.cm-link {
|
767 |
+
color: blueviolet;
|
768 |
+
}
|
769 |
+
|
770 |
+
.cm-s-abcdef .CodeMirror-activeline-background {
|
771 |
+
background: #314151;
|
772 |
+
}
|
773 |
+
|
774 |
+
.cm-s-ambiance.CodeMirror {
|
775 |
+
box-shadow: none;
|
776 |
+
}/* ambiance theme for codemirror *//* Color scheme */.cm-s-ambiance .cm-header {
|
777 |
+
color: blue;
|
778 |
+
}
|
779 |
+
|
780 |
+
.cm-s-ambiance .cm-quote {
|
781 |
+
color: #24C2C7;
|
782 |
+
}
|
783 |
+
|
784 |
+
.cm-s-ambiance .cm-keyword {
|
785 |
+
color: #cda869;
|
786 |
+
}
|
787 |
+
|
788 |
+
.cm-s-ambiance .cm-atom {
|
789 |
+
color: #CF7EA9;
|
790 |
+
}
|
791 |
+
|
792 |
+
.cm-s-ambiance .cm-number {
|
793 |
+
color: #78CF8A;
|
794 |
+
}
|
795 |
+
|
796 |
+
.cm-s-ambiance .cm-def {
|
797 |
+
color: #aac6e3;
|
798 |
+
}
|
799 |
+
|
800 |
+
.cm-s-ambiance .cm-variable {
|
801 |
+
color: #ffb795;
|
802 |
+
}
|
803 |
+
|
804 |
+
.cm-s-ambiance .cm-variable-2 {
|
805 |
+
color: #eed1b3;
|
806 |
+
}
|
807 |
+
|
808 |
+
.cm-s-ambiance .cm-variable-3 {
|
809 |
+
color: #faded3;
|
810 |
+
}
|
811 |
+
|
812 |
+
.cm-s-ambiance .cm-property {
|
813 |
+
color: #eed1b3;
|
814 |
+
}
|
815 |
+
|
816 |
+
.cm-s-ambiance .cm-operator {
|
817 |
+
color: #fa8d6a;
|
818 |
+
}
|
819 |
+
|
820 |
+
.cm-s-ambiance .cm-comment {
|
821 |
+
color: #555;
|
822 |
+
font-style: italic;
|
823 |
+
}
|
824 |
+
|
825 |
+
.cm-s-ambiance .cm-string {
|
826 |
+
color: #8f9d6a;
|
827 |
+
}
|
828 |
+
|
829 |
+
.cm-s-ambiance .cm-string-2 {
|
830 |
+
color: #9d937c;
|
831 |
+
}
|
832 |
+
|
833 |
+
.cm-s-ambiance .cm-meta {
|
834 |
+
color: #D2A8A1;
|
835 |
+
}
|
836 |
+
|
837 |
+
.cm-s-ambiance .cm-qualifier {
|
838 |
+
color: yellow;
|
839 |
+
}
|
840 |
+
|
841 |
+
.cm-s-ambiance .cm-builtin {
|
842 |
+
color: #9999cc;
|
843 |
+
}
|
844 |
+
|
845 |
+
.cm-s-ambiance .cm-bracket {
|
846 |
+
color: #24C2C7;
|
847 |
+
}
|
848 |
+
|
849 |
+
.cm-s-ambiance .cm-tag {
|
850 |
+
color: #fee4ff;
|
851 |
+
}
|
852 |
+
|
853 |
+
.cm-s-ambiance .cm-attribute {
|
854 |
+
color: #9B859D;
|
855 |
+
}
|
856 |
+
|
857 |
+
.cm-s-ambiance .cm-hr {
|
858 |
+
color: pink;
|
859 |
+
}
|
860 |
+
|
861 |
+
.cm-s-ambiance .cm-link {
|
862 |
+
color: #F4C20B;
|
863 |
+
}
|
864 |
+
|
865 |
+
.cm-s-ambiance .cm-special {
|
866 |
+
color: #FF9D00;
|
867 |
+
}
|
868 |
+
|
869 |
+
.cm-s-ambiance .cm-error {
|
870 |
+
color: #AF2018;
|
871 |
+
}
|
872 |
+
|
873 |
+
.cm-s-ambiance .CodeMirror-matchingbracket {
|
874 |
+
color: #0f0;
|
875 |
+
}
|
876 |
+
|
877 |
+
.cm-s-ambiance .CodeMirror-nonmatchingbracket {
|
878 |
+
color: #f22;
|
879 |
+
}
|
880 |
+
|
881 |
+
.cm-s-ambiance div.CodeMirror-selected {
|
882 |
+
background: rgba(255, 255, 255, 0.15);
|
883 |
+
}
|
884 |
+
|
885 |
+
.cm-s-ambiance.CodeMirror-focused div.CodeMirror-selected {
|
886 |
+
background: rgba(255, 255, 255, 0.1);
|
887 |
+
}
|
888 |
+
|
889 |
+
.cm-s-ambiance .CodeMirror-line::-moz-selection,.cm-s-ambiance .CodeMirror-line > span::-moz-selection,.cm-s-ambiance .CodeMirror-line > span > span::-moz-selection {
|
890 |
+
background: rgba(255, 255, 255, 0.1);
|
891 |
+
}
|
892 |
+
|
893 |
+
.cm-s-ambiance .CodeMirror-line::selection,.cm-s-ambiance .CodeMirror-line > span::selection,.cm-s-ambiance .CodeMirror-line > span > span::selection {
|
894 |
+
background: rgba(255, 255, 255, 0.1);
|
895 |
+
}
|
896 |
+
|
897 |
+
.cm-s-ambiance .CodeMirror-line::-moz-selection,.cm-s-ambiance .CodeMirror-line > span::-moz-selection,.cm-s-ambiance .CodeMirror-line > span > span::-moz-selection {
|
898 |
+
background: rgba(255, 255, 255, 0.1);
|
899 |
+
}/* Editor styling */.cm-s-ambiance.CodeMirror {
|
900 |
+
line-height: 1.40em;
|
901 |
+
color: #E6E1DC;
|
902 |
+
background-color: #202020;
|
903 |
+
box-shadow: inset 0 0 10px black;
|
904 |
+
}
|
905 |
+
|
906 |
+
.cm-s-ambiance .CodeMirror-gutters {
|
907 |
+
background: #3D3D3D;
|
908 |
+
border-right: 1px solid #4D4D4D;
|
909 |
+
box-shadow: 0 10px 20px black;
|
910 |
+
}
|
911 |
+
|
912 |
+
.cm-s-ambiance .CodeMirror-linenumber {
|
913 |
+
text-shadow: 0px 1px 1px #4d4d4d;
|
914 |
+
color: #111;
|
915 |
+
padding: 0 5px;
|
916 |
+
}
|
917 |
+
|
918 |
+
.cm-s-ambiance .CodeMirror-guttermarker {
|
919 |
+
color: #aaa;
|
920 |
+
}
|
921 |
+
|
922 |
+
.cm-s-ambiance .CodeMirror-guttermarker-subtle {
|
923 |
+
color: #111;
|
924 |
+
}
|
925 |
+
|
926 |
+
.cm-s-ambiance .CodeMirror-cursor {
|
927 |
+
border-left: 1px solid #7991E8;
|
928 |
+
}
|
929 |
+
|
930 |
+
.cm-s-ambiance .CodeMirror-activeline-background {
|
931 |
+
background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.031);
|
932 |
+
}
|
933 |
+
|
934 |
+
.cm-s-ambiance.CodeMirror,.cm-s-ambiance .CodeMirror-gutters {
|
935 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ2cBDbmtHA043VFhHwXxClWmeYAdLhV00B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1VucBRot6QMlbivaBhoBgjqGiCJNhsqVp/S2SsG6DIONCR0dXhvWbJ+MRRZJkkuEjgDXJjFQW6SSL7GXK8Z2CZg7cVsbWGoKmEpzQ5elpiy8Ryg7dMkLLUEauzeO86CuwlSOlgYLojZWeJ9xM3S1PWfEfKl5ISLQ0MEKR8YOB2QfCxJBjrKPCN4f9MkaSsqoVXJBmP7EpFZ9UQfOoOFwSzBN4MQ8LsGrymlipcJQhmy0GaQjPqCHaXRwuCZwRbqK2Fg9wlClZqYicrIgMdZfxTQ0c7TBIbrChxmuzoKG8XRaSrIhhiyNFJkrC7oIAWMEOQa5aBekPCRknCo4IKPrYkvCDI8aYmY7WFtprgekcJZ3oLIqssCSMtFbQTJKwXYy3BY5oCh2iKPCpJOE+zRdpYgi6O2KmOAgvVCYaU4ySRek1sgyFhJ403QFHiVEmJHwtybO1gs8Hr5+BETQX3War0qZngYGgtVZtoqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC");
|
936 |
+
}/*
|
937 |
+
|
938 |
+
Name: Base16 Default Dark
|
939 |
+
Author: Chris Kempson (http://chriskempson.com)
|
940 |
+
|
941 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
942 |
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
943 |
+
|
944 |
+
*/.cm-s-base16-dark.CodeMirror {
|
945 |
+
background: #151515;
|
946 |
+
color: #e0e0e0;
|
947 |
+
}
|
948 |
+
|
949 |
+
.cm-s-base16-dark div.CodeMirror-selected {
|
950 |
+
background: #303030;
|
951 |
+
}
|
952 |
+
|
953 |
+
.cm-s-base16-dark .CodeMirror-line::-moz-selection,.cm-s-base16-dark .CodeMirror-line > span::-moz-selection,.cm-s-base16-dark .CodeMirror-line > span > span::-moz-selection {
|
954 |
+
background: rgba(48, 48, 48, 0.99);
|
955 |
+
}
|
956 |
+
|
957 |
+
.cm-s-base16-dark .CodeMirror-line::selection,.cm-s-base16-dark .CodeMirror-line > span::selection,.cm-s-base16-dark .CodeMirror-line > span > span::selection {
|
958 |
+
background: rgba(48, 48, 48, 0.99);
|
959 |
+
}
|
960 |
+
|
961 |
+
.cm-s-base16-dark .CodeMirror-line::-moz-selection,.cm-s-base16-dark .CodeMirror-line > span::-moz-selection,.cm-s-base16-dark .CodeMirror-line > span > span::-moz-selection {
|
962 |
+
background: rgba(48, 48, 48, 0.99);
|
963 |
+
}
|
964 |
+
|
965 |
+
.cm-s-base16-dark .CodeMirror-gutters {
|
966 |
+
background: #151515;
|
967 |
+
border-right: 0px;
|
968 |
+
}
|
969 |
+
|
970 |
+
.cm-s-base16-dark .CodeMirror-guttermarker {
|
971 |
+
color: #ac4142;
|
972 |
+
}
|
973 |
+
|
974 |
+
.cm-s-base16-dark .CodeMirror-guttermarker-subtle {
|
975 |
+
color: #505050;
|
976 |
+
}
|
977 |
+
|
978 |
+
.cm-s-base16-dark .CodeMirror-linenumber {
|
979 |
+
color: #505050;
|
980 |
+
}
|
981 |
+
|
982 |
+
.cm-s-base16-dark .CodeMirror-cursor {
|
983 |
+
border-left: 1px solid #b0b0b0;
|
984 |
+
}
|
985 |
+
|
986 |
+
.cm-s-base16-dark span.cm-comment {
|
987 |
+
color: #8f5536;
|
988 |
+
}
|
989 |
+
|
990 |
+
.cm-s-base16-dark span.cm-atom {
|
991 |
+
color: #aa759f;
|
992 |
+
}
|
993 |
+
|
994 |
+
.cm-s-base16-dark span.cm-number {
|
995 |
+
color: #aa759f;
|
996 |
+
}
|
997 |
+
|
998 |
+
.cm-s-base16-dark span.cm-property,.cm-s-base16-dark span.cm-attribute {
|
999 |
+
color: #90a959;
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
.cm-s-base16-dark span.cm-keyword {
|
1003 |
+
color: #ac4142;
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
.cm-s-base16-dark span.cm-string {
|
1007 |
+
color: #f4bf75;
|
1008 |
+
}
|
1009 |
+
|
1010 |
+
.cm-s-base16-dark span.cm-variable {
|
1011 |
+
color: #90a959;
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
.cm-s-base16-dark span.cm-variable-2 {
|
1015 |
+
color: #6a9fb5;
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
.cm-s-base16-dark span.cm-def {
|
1019 |
+
color: #d28445;
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
.cm-s-base16-dark span.cm-bracket {
|
1023 |
+
color: #e0e0e0;
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
.cm-s-base16-dark span.cm-tag {
|
1027 |
+
color: #ac4142;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
.cm-s-base16-dark span.cm-link {
|
1031 |
+
color: #aa759f;
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
.cm-s-base16-dark span.cm-error {
|
1035 |
+
background: #ac4142;
|
1036 |
+
color: #b0b0b0;
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
.cm-s-base16-dark .CodeMirror-activeline-background {
|
1040 |
+
background: #202020;
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
.cm-s-base16-dark .CodeMirror-matchingbracket {
|
1044 |
+
text-decoration: underline;
|
1045 |
+
color: white !important;
|
1046 |
+
}/*
|
1047 |
+
|
1048 |
+
Name: Base16 Default Light
|
1049 |
+
Author: Chris Kempson (http://chriskempson.com)
|
1050 |
+
|
1051 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
1052 |
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
1053 |
+
|
1054 |
+
*/.cm-s-base16-light.CodeMirror {
|
1055 |
+
background: #f5f5f5;
|
1056 |
+
color: #202020;
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
.cm-s-base16-light div.CodeMirror-selected {
|
1060 |
+
background: #e0e0e0;
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
.cm-s-base16-light .CodeMirror-line::-moz-selection,.cm-s-base16-light .CodeMirror-line > span::-moz-selection,.cm-s-base16-light .CodeMirror-line > span > span::-moz-selection {
|
1064 |
+
background: #e0e0e0;
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
.cm-s-base16-light .CodeMirror-line::selection,.cm-s-base16-light .CodeMirror-line > span::selection,.cm-s-base16-light .CodeMirror-line > span > span::selection {
|
1068 |
+
background: #e0e0e0;
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
.cm-s-base16-light .CodeMirror-line::-moz-selection,.cm-s-base16-light .CodeMirror-line > span::-moz-selection,.cm-s-base16-light .CodeMirror-line > span > span::-moz-selection {
|
1072 |
+
background: #e0e0e0;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
.cm-s-base16-light .CodeMirror-gutters {
|
1076 |
+
background: #f5f5f5;
|
1077 |
+
border-right: 0px;
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
.cm-s-base16-light .CodeMirror-guttermarker {
|
1081 |
+
color: #ac4142;
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
.cm-s-base16-light .CodeMirror-guttermarker-subtle {
|
1085 |
+
color: #b0b0b0;
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
.cm-s-base16-light .CodeMirror-linenumber {
|
1089 |
+
color: #b0b0b0;
|
1090 |
+
}
|
1091 |
+
|
1092 |
+
.cm-s-base16-light .CodeMirror-cursor {
|
1093 |
+
border-left: 1px solid #505050;
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
.cm-s-base16-light span.cm-comment {
|
1097 |
+
color: #8f5536;
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
.cm-s-base16-light span.cm-atom {
|
1101 |
+
color: #aa759f;
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
.cm-s-base16-light span.cm-number {
|
1105 |
+
color: #aa759f;
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
.cm-s-base16-light span.cm-property,.cm-s-base16-light span.cm-attribute {
|
1109 |
+
color: #90a959;
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
.cm-s-base16-light span.cm-keyword {
|
1113 |
+
color: #ac4142;
|
1114 |
+
}
|
1115 |
+
|
1116 |
+
.cm-s-base16-light span.cm-string {
|
1117 |
+
color: #f4bf75;
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
.cm-s-base16-light span.cm-variable {
|
1121 |
+
color: #90a959;
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
.cm-s-base16-light span.cm-variable-2 {
|
1125 |
+
color: #6a9fb5;
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
.cm-s-base16-light span.cm-def {
|
1129 |
+
color: #d28445;
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
.cm-s-base16-light span.cm-bracket {
|
1133 |
+
color: #202020;
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
.cm-s-base16-light span.cm-tag {
|
1137 |
+
color: #ac4142;
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
.cm-s-base16-light span.cm-link {
|
1141 |
+
color: #aa759f;
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
.cm-s-base16-light span.cm-error {
|
1145 |
+
background: #ac4142;
|
1146 |
+
color: #505050;
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
.cm-s-base16-light .CodeMirror-activeline-background {
|
1150 |
+
background: #DDDCDC;
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
.cm-s-base16-light .CodeMirror-matchingbracket {
|
1154 |
+
text-decoration: underline;
|
1155 |
+
color: white !important;
|
1156 |
+
}/*
|
1157 |
+
|
1158 |
+
Name: Bespin
|
1159 |
+
Author: Mozilla / Jan T. Sott
|
1160 |
+
|
1161 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
1162 |
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
1163 |
+
|
1164 |
+
*/.cm-s-bespin.CodeMirror {
|
1165 |
+
background: #28211c;
|
1166 |
+
color: #9d9b97;
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
.cm-s-bespin div.CodeMirror-selected {
|
1170 |
+
background: #36312e !important;
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
.cm-s-bespin .CodeMirror-gutters {
|
1174 |
+
background: #28211c;
|
1175 |
+
border-right: 0px;
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
.cm-s-bespin .CodeMirror-linenumber {
|
1179 |
+
color: #666666;
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
.cm-s-bespin .CodeMirror-cursor {
|
1183 |
+
border-left: 1px solid #797977 !important;
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
.cm-s-bespin span.cm-comment {
|
1187 |
+
color: #937121;
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
.cm-s-bespin span.cm-atom {
|
1191 |
+
color: #9b859d;
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
.cm-s-bespin span.cm-number {
|
1195 |
+
color: #9b859d;
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
.cm-s-bespin span.cm-property,.cm-s-bespin span.cm-attribute {
|
1199 |
+
color: #54be0d;
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
.cm-s-bespin span.cm-keyword {
|
1203 |
+
color: #cf6a4c;
|
1204 |
+
}
|
1205 |
+
|
1206 |
+
.cm-s-bespin span.cm-string {
|
1207 |
+
color: #f9ee98;
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
.cm-s-bespin span.cm-variable {
|
1211 |
+
color: #54be0d;
|
1212 |
+
}
|
1213 |
+
|
1214 |
+
.cm-s-bespin span.cm-variable-2 {
|
1215 |
+
color: #5ea6ea;
|
1216 |
+
}
|
1217 |
+
|
1218 |
+
.cm-s-bespin span.cm-def {
|
1219 |
+
color: #cf7d34;
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
.cm-s-bespin span.cm-error {
|
1223 |
+
background: #cf6a4c;
|
1224 |
+
color: #797977;
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
.cm-s-bespin span.cm-bracket {
|
1228 |
+
color: #9d9b97;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
.cm-s-bespin span.cm-tag {
|
1232 |
+
color: #cf6a4c;
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
.cm-s-bespin span.cm-link {
|
1236 |
+
color: #9b859d;
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
.cm-s-bespin .CodeMirror-matchingbracket {
|
1240 |
+
text-decoration: underline;
|
1241 |
+
color: white !important;
|
1242 |
+
}
|
1243 |
+
|
1244 |
+
.cm-s-bespin .CodeMirror-activeline-background {
|
1245 |
+
background: #404040;
|
1246 |
+
}/* Port of TextMate's Blackboard theme */.cm-s-blackboard.CodeMirror {background: #0C1021;color: #F8F8F8;}.cm-s-blackboard div.CodeMirror-selected {background: #253B76;}.cm-s-blackboard .CodeMirror-line::-moz-selection,.cm-s-blackboard .CodeMirror-line > span::-moz-selection,.cm-s-blackboard .CodeMirror-line > span > span::-moz-selection {background: rgba(37, 59, 118, 0.99);}.cm-s-blackboard .CodeMirror-line::selection,.cm-s-blackboard .CodeMirror-line > span::selection,.cm-s-blackboard .CodeMirror-line > span > span::selection {background: rgba(37, 59, 118, 0.99);}.cm-s-blackboard .CodeMirror-line::-moz-selection,.cm-s-blackboard .CodeMirror-line > span::-moz-selection,.cm-s-blackboard .CodeMirror-line > span > span::-moz-selection {background: rgba(37, 59, 118, 0.99);}.cm-s-blackboard .CodeMirror-gutters {background: #0C1021;border-right: 0;}.cm-s-blackboard .CodeMirror-guttermarker {color: #FBDE2D;}.cm-s-blackboard .CodeMirror-guttermarker-subtle {color: #888;}.cm-s-blackboard .CodeMirror-linenumber {color: #888;}.cm-s-blackboard .CodeMirror-cursor {border-left: 1px solid #A7A7A7;}.cm-s-blackboard .cm-keyword {color: #FBDE2D;}.cm-s-blackboard .cm-atom {color: #D8FA3C;}.cm-s-blackboard .cm-number {color: #D8FA3C;}.cm-s-blackboard .cm-def {color: #8DA6CE;}.cm-s-blackboard .cm-variable {color: #FF6400;}.cm-s-blackboard .cm-operator {color: #FBDE2D;}.cm-s-blackboard .cm-comment {color: #AEAEAE;}.cm-s-blackboard .cm-string {color: #61CE3C;}.cm-s-blackboard .cm-string-2 {color: #61CE3C;}.cm-s-blackboard .cm-meta {color: #D8FA3C;}.cm-s-blackboard .cm-builtin {color: #8DA6CE;}.cm-s-blackboard .cm-tag {color: #8DA6CE;}.cm-s-blackboard .cm-attribute {color: #8DA6CE;}.cm-s-blackboard .cm-header {color: #FF6400;}.cm-s-blackboard .cm-hr {color: #AEAEAE;}.cm-s-blackboard .cm-link {color: #8DA6CE;}.cm-s-blackboard .cm-error {background: #9D1E15;color: #F8F8F8;}.cm-s-blackboard .CodeMirror-activeline-background {background: #3C3636;}.cm-s-blackboard .CodeMirror-matchingbracket {outline: 1px solid grey;color: white !important;}.cm-s-cobalt.CodeMirror {background: #002240;color: white;}.cm-s-cobalt div.CodeMirror-selected {background: #b36539;}.cm-s-cobalt .CodeMirror-line::-moz-selection,.cm-s-cobalt .CodeMirror-line > span::-moz-selection,.cm-s-cobalt .CodeMirror-line > span > span::-moz-selection {background: rgba(179, 101, 57, 0.99);}.cm-s-cobalt .CodeMirror-line::selection,.cm-s-cobalt .CodeMirror-line > span::selection,.cm-s-cobalt .CodeMirror-line > span > span::selection {background: rgba(179, 101, 57, 0.99);}.cm-s-cobalt .CodeMirror-line::-moz-selection,.cm-s-cobalt .CodeMirror-line > span::-moz-selection,.cm-s-cobalt .CodeMirror-line > span > span::-moz-selection {background: rgba(179, 101, 57, 0.99);}.cm-s-cobalt .CodeMirror-gutters {background: #002240;border-right: 1px solid #aaa;}.cm-s-cobalt .CodeMirror-guttermarker {color: #ffee80;}.cm-s-cobalt .CodeMirror-guttermarker-subtle {color: #d0d0d0;}.cm-s-cobalt .CodeMirror-linenumber {color: #d0d0d0;}.cm-s-cobalt .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-cobalt span.cm-comment {color: #08f;}.cm-s-cobalt span.cm-atom {color: #845dc4;}.cm-s-cobalt span.cm-number,.cm-s-cobalt span.cm-attribute {color: #ff80e1;}.cm-s-cobalt span.cm-keyword {color: #ffee80;}.cm-s-cobalt span.cm-string {color: #3ad900;}.cm-s-cobalt span.cm-meta {color: #ff9d00;}.cm-s-cobalt span.cm-variable-2,.cm-s-cobalt span.cm-tag {color: #9effff;}.cm-s-cobalt span.cm-variable-3,.cm-s-cobalt span.cm-def {color: white;}.cm-s-cobalt span.cm-bracket {color: #d8d8d8;}.cm-s-cobalt span.cm-builtin,.cm-s-cobalt span.cm-special {color: #ff9e59;}.cm-s-cobalt span.cm-link {color: #845dc4;}.cm-s-cobalt span.cm-error {color: #9d1e15;}.cm-s-cobalt .CodeMirror-activeline-background {background: #002D57;}.cm-s-cobalt .CodeMirror-matchingbracket {outline: 1px solid grey;color: white !important;}.cm-s-colorforth.CodeMirror {background: #000000;color: #f8f8f8;}.cm-s-colorforth .CodeMirror-gutters {background: #0a001f;border-right: 1px solid #aaa;}.cm-s-colorforth .CodeMirror-guttermarker {color: #FFBD40;}.cm-s-colorforth .CodeMirror-guttermarker-subtle {color: #78846f;}.cm-s-colorforth .CodeMirror-linenumber {color: #bababa;}.cm-s-colorforth .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-colorforth span.cm-comment {color: #ededed;}.cm-s-colorforth span.cm-def {color: #ff1c1c;font-weight: bold;}.cm-s-colorforth span.cm-keyword {color: #ffd900;}.cm-s-colorforth span.cm-builtin {color: #00d95a;}.cm-s-colorforth span.cm-variable {color: #73ff00;}.cm-s-colorforth span.cm-string {color: #007bff;}.cm-s-colorforth span.cm-number {color: #00c4ff;}.cm-s-colorforth span.cm-atom {color: #606060;}.cm-s-colorforth span.cm-variable-2 {color: #EEE;}.cm-s-colorforth span.cm-variable-3 {color: #DDD;}.cm-s-colorforth span.cm-meta {color: yellow;}.cm-s-colorforth span.cm-qualifier {color: #FFF700;}.cm-s-colorforth span.cm-bracket {color: #cc7;}.cm-s-colorforth span.cm-tag {color: #FFBD40;}.cm-s-colorforth span.cm-attribute {color: #FFF700;}.cm-s-colorforth span.cm-error {color: #f00;}.cm-s-colorforth div.CodeMirror-selected {background: #333d53;}.cm-s-colorforth span.cm-compilation {background: rgba(255, 255, 255, 0.12);}.cm-s-colorforth .CodeMirror-activeline-background {background: #253540;}/*
|
1247 |
+
|
1248 |
+
Name: dracula
|
1249 |
+
Author: Michael Kaminsky (http://github.com/mkaminsky11)
|
1250 |
+
|
1251 |
+
Original dracula color scheme by Zeno Rocha (https://github.com/zenorocha/dracula-theme)
|
1252 |
+
|
1253 |
+
*/.cm-s-dracula.CodeMirror,.cm-s-dracula .CodeMirror-gutters {background-color: #282a36 !important;color: #f8f8f2 !important;border: none;}.cm-s-dracula .CodeMirror-gutters {color: #282a36;}.cm-s-dracula .CodeMirror-cursor {border-left: solid thin #f8f8f0;}.cm-s-dracula .CodeMirror-linenumber {color: #6D8A88;}.cm-s-dracula .CodeMirror-selected {background: rgba(255, 255, 255, 0.1);}.cm-s-dracula .CodeMirror-line::-moz-selection,.cm-s-dracula .CodeMirror-line > span::-moz-selection,.cm-s-dracula .CodeMirror-line > span > span::-moz-selection {background: rgba(255, 255, 255, 0.1);}.cm-s-dracula .CodeMirror-line::selection,.cm-s-dracula .CodeMirror-line > span::selection,.cm-s-dracula .CodeMirror-line > span > span::selection {background: rgba(255, 255, 255, 0.1);}.cm-s-dracula .CodeMirror-line::-moz-selection,.cm-s-dracula .CodeMirror-line > span::-moz-selection,.cm-s-dracula .CodeMirror-line > span > span::-moz-selection {background: rgba(255, 255, 255, 0.1);}.cm-s-dracula span.cm-comment {color: #6272a4;}.cm-s-dracula span.cm-string,.cm-s-dracula span.cm-string-2 {color: #f1fa8c;}.cm-s-dracula span.cm-number {color: #bd93f9;}.cm-s-dracula span.cm-variable {color: #50fa7b;}.cm-s-dracula span.cm-variable-2 {color: white;}.cm-s-dracula span.cm-def {color: #50fa7b;}.cm-s-dracula span.cm-operator {color: #ff79c6;}.cm-s-dracula span.cm-keyword {color: #ff79c6;}.cm-s-dracula span.cm-atom {color: #bd93f9;}.cm-s-dracula span.cm-meta {color: #f8f8f2;}.cm-s-dracula span.cm-tag {color: #ff79c6;}.cm-s-dracula span.cm-attribute {color: #50fa7b;}.cm-s-dracula span.cm-qualifier {color: #50fa7b;}.cm-s-dracula span.cm-property {color: #66d9ef;}.cm-s-dracula span.cm-builtin {color: #50fa7b;}.cm-s-dracula span.cm-variable-3 {color: #ffb86c;}.cm-s-dracula .CodeMirror-activeline-background {background: rgba(255, 255, 255, 0.1);}.cm-s-dracula .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}/*
|
1254 |
+
Name: DuoTone-Dark
|
1255 |
+
Author: by Bram de Haan, adapted from DuoTone themes by Simurai (http://simurai.com/projects/2016/01/01/duotone-themes)
|
1256 |
+
|
1257 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg), adapted by Bram de Haan (https://github.com/atelierbram/)
|
1258 |
+
*/.cm-s-duotone-dark.CodeMirror {background: #2a2734;color: #6c6783;}.cm-s-duotone-dark div.CodeMirror-selected {background: #545167!important;}.cm-s-duotone-dark .CodeMirror-gutters {background: #2a2734;border-right: 0px;}.cm-s-duotone-dark .CodeMirror-linenumber {color: #545167;}/* begin cursor */.cm-s-duotone-dark .CodeMirror-cursor {border-left: 1px solid #ffad5c; /* border-left: 1px solid #ffad5c80; */border-right: .5em solid #ffad5c; /* border-right: .5em solid #ffad5c80; */opacity: .5;}.cm-s-duotone-dark .CodeMirror-activeline-background {background: #363342; /* background: #36334280; */opacity: .5;}.cm-s-duotone-dark .cm-fat-cursor .CodeMirror-cursor {background: #ffad5c; /* background: #ffad5c80; */opacity: .5;}/* end cursor */.cm-s-duotone-dark span.cm-atom,.cm-s-duotone-dark span.cm-number,.cm-s-duotone-dark span.cm-keyword,.cm-s-duotone-dark span.cm-variable,.cm-s-duotone-dark span.cm-attribute,.cm-s-duotone-dark span.cm-quote,.cm-s-duotone-dark span.cm-hr,.cm-s-duotone-dark span.cm-link {color: #ffcc99;}.cm-s-duotone-dark span.cm-property {color: #9a86fd;}.cm-s-duotone-dark span.cm-punctuation,.cm-s-duotone-dark span.cm-unit,.cm-s-duotone-dark span.cm-negative {color: #e09142;}.cm-s-duotone-dark span.cm-string {color: #ffb870;}.cm-s-duotone-dark span.cm-operator {color: #ffad5c;}.cm-s-duotone-dark span.cm-positive {color: #6a51e6;}.cm-s-duotone-dark span.cm-variable-2,.cm-s-duotone-dark span.cm-variable-3,.cm-s-duotone-dark span.cm-string-2,.cm-s-duotone-dark span.cm-url {color: #7a63ee;}.cm-s-duotone-dark span.cm-def,.cm-s-duotone-dark span.cm-tag,.cm-s-duotone-dark span.cm-builtin,.cm-s-duotone-dark span.cm-qualifier,.cm-s-duotone-dark span.cm-header,.cm-s-duotone-dark span.cm-em {color: #eeebff;}.cm-s-duotone-dark span.cm-bracket,.cm-s-duotone-dark span.cm-comment {color: #6c6783;}/* using #f00 red for errors, don't think any of the colorscheme variables will stand out enough, ... maybe by giving it a background-color ... */.cm-s-duotone-dark span.cm-error,.cm-s-duotone-dark span.cm-invalidchar {
|
1259 |
+
color: #f00;
|
1260 |
+
}
|
1261 |
+
|
1262 |
+
.cm-s-duotone-dark span.cm-header {
|
1263 |
+
font-weight: normal;
|
1264 |
+
}
|
1265 |
+
|
1266 |
+
.cm-s-duotone-dark .CodeMirror-matchingbracket {
|
1267 |
+
text-decoration: underline;
|
1268 |
+
color: #eeebff !important;
|
1269 |
+
}/*
|
1270 |
+
Name: DuoTone-Light
|
1271 |
+
Author: by Bram de Haan, adapted from DuoTone themes by Simurai (http://simurai.com/projects/2016/01/01/duotone-themes)
|
1272 |
+
|
1273 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg), adapted by Bram de Haan (https://github.com/atelierbram/)
|
1274 |
+
*/.cm-s-duotone-light.CodeMirror {
|
1275 |
+
background: #faf8f5;
|
1276 |
+
color: #b29762;
|
1277 |
+
}
|
1278 |
+
|
1279 |
+
.cm-s-duotone-light div.CodeMirror-selected {
|
1280 |
+
background: #e3dcce !important;
|
1281 |
+
}
|
1282 |
+
|
1283 |
+
.cm-s-duotone-light .CodeMirror-gutters {
|
1284 |
+
background: #faf8f5;
|
1285 |
+
border-right: 0px;
|
1286 |
+
}
|
1287 |
+
|
1288 |
+
.cm-s-duotone-light .CodeMirror-linenumber {
|
1289 |
+
color: #cdc4b1;
|
1290 |
+
}/* begin cursor */.cm-s-duotone-light .CodeMirror-cursor {
|
1291 |
+
border-left: 1px solid #93abdc;
|
1292 |
+
/* border-left: 1px solid #93abdc80; */
|
1293 |
+
border-right: .5em solid #93abdc;
|
1294 |
+
/* border-right: .5em solid #93abdc80; */
|
1295 |
+
opacity: .5;
|
1296 |
+
}
|
1297 |
+
|
1298 |
+
.cm-s-duotone-light .CodeMirror-activeline-background {
|
1299 |
+
background: #e3dcce;
|
1300 |
+
/* background: #e3dcce80; */
|
1301 |
+
opacity: .5;
|
1302 |
+
}
|
1303 |
+
|
1304 |
+
.cm-s-duotone-light .cm-fat-cursor .CodeMirror-cursor {
|
1305 |
+
background: #93abdc;
|
1306 |
+
/* #93abdc80; */
|
1307 |
+
opacity: .5;
|
1308 |
+
}/* end cursor */.cm-s-duotone-light span.cm-atom,.cm-s-duotone-light span.cm-number,.cm-s-duotone-light span.cm-keyword,.cm-s-duotone-light span.cm-variable,.cm-s-duotone-light span.cm-attribute,.cm-s-duotone-light span.cm-quote,.cm-s-duotone-light-light span.cm-hr,.cm-s-duotone-light-light span.cm-link {
|
1309 |
+
color: #063289;
|
1310 |
+
}
|
1311 |
+
|
1312 |
+
.cm-s-duotone-light span.cm-property {
|
1313 |
+
color: #b29762;
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
.cm-s-duotone-light span.cm-punctuation,.cm-s-duotone-light span.cm-unit,.cm-s-duotone-light span.cm-negative {
|
1317 |
+
color: #063289;
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
.cm-s-duotone-light span.cm-string,.cm-s-duotone-light span.cm-operator {
|
1321 |
+
color: #1659df;
|
1322 |
+
}
|
1323 |
+
|
1324 |
+
.cm-s-duotone-light span.cm-positive {
|
1325 |
+
color: #896724;
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
.cm-s-duotone-light span.cm-variable-2,.cm-s-duotone-light span.cm-variable-3,.cm-s-duotone-light span.cm-string-2,.cm-s-duotone-light span.cm-url {
|
1329 |
+
color: #896724;
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
.cm-s-duotone-light span.cm-def,.cm-s-duotone-light span.cm-tag,.cm-s-duotone-light span.cm-builtin,.cm-s-duotone-light span.cm-qualifier,.cm-s-duotone-light span.cm-header,.cm-s-duotone-light span.cm-em {
|
1333 |
+
color: #2d2006;
|
1334 |
+
}
|
1335 |
+
|
1336 |
+
.cm-s-duotone-light span.cm-bracket,.cm-s-duotone-light span.cm-comment {
|
1337 |
+
color: #b6ad9a;
|
1338 |
+
}/* using #f00 red for errors, don't think any of the colorscheme variables will stand out enough, ... maybe by giving it a background-color ... *//* .cm-s-duotone-light span.cm-error { background: #896724; color: #728fcb; } */.cm-s-duotone-light span.cm-error,.cm-s-duotone-light span.cm-invalidchar {color: #f00;}.cm-s-duotone-light span.cm-header {font-weight: normal;}.cm-s-duotone-light .CodeMirror-matchingbracket {text-decoration: underline;color: #faf8f5 !important;}.cm-s-eclipse span.cm-meta {color: #FF1717;}.cm-s-eclipse span.cm-keyword {line-height: 1em;font-weight: bold;color: #7F0055;}.cm-s-eclipse span.cm-atom {color: #219;}.cm-s-eclipse span.cm-number {color: #164;}.cm-s-eclipse span.cm-def {color: #00f;}.cm-s-eclipse span.cm-variable {color: black;}.cm-s-eclipse span.cm-variable-2 {color: #0000C0;}.cm-s-eclipse span.cm-variable-3 {color: #0000C0;}.cm-s-eclipse span.cm-property {color: black;}.cm-s-eclipse span.cm-operator {color: black;}.cm-s-eclipse span.cm-comment {color: #3F7F5F;}.cm-s-eclipse span.cm-string {color: #2A00FF;}.cm-s-eclipse span.cm-string-2 {color: #f50;}.cm-s-eclipse span.cm-qualifier {color: #555;}.cm-s-eclipse span.cm-builtin {color: #30a;}.cm-s-eclipse span.cm-bracket {color: #cc7;}.cm-s-eclipse span.cm-tag {color: #170;}.cm-s-eclipse span.cm-attribute {color: #00c;}.cm-s-eclipse span.cm-link {color: #219;}.cm-s-eclipse span.cm-error {color: #f00;}.cm-s-eclipse .CodeMirror-activeline-background {background: #e8f2ff;}.cm-s-eclipse .CodeMirror-matchingbracket {outline: 1px solid grey;color: black !important;}.cm-s-elegant span.cm-number,.cm-s-elegant span.cm-string,.cm-s-elegant span.cm-atom {color: #762;}.cm-s-elegant span.cm-comment {color: #262;font-style: italic;line-height: 1em;}.cm-s-elegant span.cm-meta {color: #555;font-style: italic;line-height: 1em;}.cm-s-elegant span.cm-variable {color: black;}.cm-s-elegant span.cm-variable-2 {color: #b11;}.cm-s-elegant span.cm-qualifier {color: #555;}.cm-s-elegant span.cm-keyword {color: #730;}.cm-s-elegant span.cm-builtin {color: #30a;}.cm-s-elegant span.cm-link {color: #762;}.cm-s-elegant span.cm-error {background-color: #fdd;}.cm-s-elegant .CodeMirror-activeline-background {background: #e8f2ff;}.cm-s-elegant .CodeMirror-matchingbracket {outline: 1px solid grey;color: black !important;}.cm-s-erlang-dark.CodeMirror {background: #002240;color: white;}.cm-s-erlang-dark div.CodeMirror-selected {background: #b36539;}.cm-s-erlang-dark .CodeMirror-line::-moz-selection,.cm-s-erlang-dark .CodeMirror-line > span::-moz-selection,.cm-s-erlang-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(179, 101, 57, 0.99);}.cm-s-erlang-dark .CodeMirror-line::selection,.cm-s-erlang-dark .CodeMirror-line > span::selection,.cm-s-erlang-dark .CodeMirror-line > span > span::selection {background: rgba(179, 101, 57, 0.99);}.cm-s-erlang-dark .CodeMirror-line::-moz-selection,.cm-s-erlang-dark .CodeMirror-line > span::-moz-selection,.cm-s-erlang-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(179, 101, 57, 0.99);}.cm-s-erlang-dark .CodeMirror-gutters {background: #002240;border-right: 1px solid #aaa;}.cm-s-erlang-dark .CodeMirror-guttermarker {color: white;}.cm-s-erlang-dark .CodeMirror-guttermarker-subtle {color: #d0d0d0;}.cm-s-erlang-dark .CodeMirror-linenumber {color: #d0d0d0;}.cm-s-erlang-dark .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-erlang-dark span.cm-quote {color: #ccc;}.cm-s-erlang-dark span.cm-atom {color: #f133f1;}.cm-s-erlang-dark span.cm-attribute {color: #ff80e1;}.cm-s-erlang-dark span.cm-bracket {color: #ff9d00;}.cm-s-erlang-dark span.cm-builtin {color: #eaa;}.cm-s-erlang-dark span.cm-comment {color: #77f;}.cm-s-erlang-dark span.cm-def {color: #e7a;}.cm-s-erlang-dark span.cm-keyword {color: #ffee80;}.cm-s-erlang-dark span.cm-meta {color: #50fefe;}.cm-s-erlang-dark span.cm-number {color: #ffd0d0;}.cm-s-erlang-dark span.cm-operator {color: #d55;}.cm-s-erlang-dark span.cm-property {color: #ccc;}.cm-s-erlang-dark span.cm-qualifier {color: #ccc;}.cm-s-erlang-dark span.cm-special {color: #ffbbbb;}.cm-s-erlang-dark span.cm-string {color: #3ad900;}.cm-s-erlang-dark span.cm-string-2 {color: #ccc;}.cm-s-erlang-dark span.cm-tag {color: #9effff;}.cm-s-erlang-dark span.cm-variable {color: #50fe50;}.cm-s-erlang-dark span.cm-variable-2 {color: #e0e;}.cm-s-erlang-dark span.cm-variable-3 {color: #ccc;}.cm-s-erlang-dark span.cm-error {color: #9d1e15;}.cm-s-erlang-dark .CodeMirror-activeline-background {background: #013461;}.cm-s-erlang-dark .CodeMirror-matchingbracket {outline: 1px solid grey;color: white !important;}/*
|
1339 |
+
|
1340 |
+
Name: Hopscotch
|
1341 |
+
Author: Jan T. Sott
|
1342 |
+
|
1343 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
1344 |
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
1345 |
+
|
1346 |
+
*/.cm-s-hopscotch.CodeMirror {background: #322931;color: #d5d3d5;}.cm-s-hopscotch div.CodeMirror-selected {background: #433b42 !important;}.cm-s-hopscotch .CodeMirror-gutters {background: #322931;border-right: 0px;}.cm-s-hopscotch .CodeMirror-linenumber {color: #797379;}.cm-s-hopscotch .CodeMirror-cursor {border-left: 1px solid #989498 !important;}.cm-s-hopscotch span.cm-comment {color: #b33508;}.cm-s-hopscotch span.cm-atom {color: #c85e7c;}.cm-s-hopscotch span.cm-number {color: #c85e7c;}.cm-s-hopscotch span.cm-property,.cm-s-hopscotch span.cm-attribute {color: #8fc13e;}.cm-s-hopscotch span.cm-keyword {color: #dd464c;}.cm-s-hopscotch span.cm-string {color: #fdcc59;}.cm-s-hopscotch span.cm-variable {color: #8fc13e;}.cm-s-hopscotch span.cm-variable-2 {color: #1290bf;}.cm-s-hopscotch span.cm-def {color: #fd8b19;}.cm-s-hopscotch span.cm-error {background: #dd464c;color: #989498;}.cm-s-hopscotch span.cm-bracket {color: #d5d3d5;}.cm-s-hopscotch span.cm-tag {color: #dd464c;}.cm-s-hopscotch span.cm-link {color: #c85e7c;}.cm-s-hopscotch .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}.cm-s-hopscotch .CodeMirror-activeline-background {background: #302020;}/*
|
1347 |
+
ICEcoder default theme by Matt Pass, used in code editor available at https://icecoder.net
|
1348 |
+
*/.cm-s-icecoder {color: #666;background: #1d1d1b;}.cm-s-icecoder span.cm-keyword {color: #eee;font-weight: bold;}/* off-white 1 */.cm-s-icecoder span.cm-atom {color: #e1c76e;}/* yellow */.cm-s-icecoder span.cm-number {color: #6cb5d9;}/* blue */.cm-s-icecoder span.cm-def {color: #b9ca4a;}/* green */.cm-s-icecoder span.cm-variable {color: #6cb5d9;}/* blue */.cm-s-icecoder span.cm-variable-2 {color: #cc1e5c;}/* pink */.cm-s-icecoder span.cm-variable-3 {color: #f9602c;}/* orange */.cm-s-icecoder span.cm-property {color: #eee;}/* off-white 1 */.cm-s-icecoder span.cm-operator {color: #9179bb;}/* purple */.cm-s-icecoder span.cm-comment {color: #97a3aa;}/* grey-blue */.cm-s-icecoder span.cm-string {color: #b9ca4a;}/* green */.cm-s-icecoder span.cm-string-2 {color: #6cb5d9;}/* blue */.cm-s-icecoder span.cm-meta {color: #555;}/* grey */.cm-s-icecoder span.cm-qualifier {color: #555;}/* grey */.cm-s-icecoder span.cm-builtin {color: #214e7b;}/* bright blue */.cm-s-icecoder span.cm-bracket {color: #cc7;}/* grey-yellow */.cm-s-icecoder span.cm-tag {color: #e8e8e8;}/* off-white 2 */.cm-s-icecoder span.cm-attribute {color: #099;}/* teal */.cm-s-icecoder span.cm-header {color: #6a0d6a;}/* purple-pink */.cm-s-icecoder span.cm-quote {color: #186718;}/* dark green */.cm-s-icecoder span.cm-hr {color: #888;}/* mid-grey */.cm-s-icecoder span.cm-link {color: #e1c76e;}/* yellow */.cm-s-icecoder span.cm-error {color: #d00;}/* red */.cm-s-icecoder .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-icecoder div.CodeMirror-selected {color: #fff;background: #037;}.cm-s-icecoder .CodeMirror-gutters {background: #1d1d1b;min-width: 41px;border-right: 0;}.cm-s-icecoder .CodeMirror-linenumber {color: #555;cursor: default;}.cm-s-icecoder .CodeMirror-matchingbracket {color: #fff !important;background: #555 !important;}.cm-s-icecoder .CodeMirror-activeline-background {background: #000;}/*
|
1349 |
+
|
1350 |
+
Name: Isotope
|
1351 |
+
Author: David Desandro / Jan T. Sott
|
1352 |
+
|
1353 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
1354 |
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
1355 |
+
|
1356 |
+
*/.cm-s-isotope.CodeMirror {background: #000000;color: #e0e0e0;}.cm-s-isotope div.CodeMirror-selected {background: #404040 !important;}.cm-s-isotope .CodeMirror-gutters {background: #000000;border-right: 0px;}.cm-s-isotope .CodeMirror-linenumber {color: #808080;}.cm-s-isotope .CodeMirror-cursor {border-left: 1px solid #c0c0c0 !important;}.cm-s-isotope span.cm-comment {color: #3300ff;}.cm-s-isotope span.cm-atom {color: #cc00ff;}.cm-s-isotope span.cm-number {color: #cc00ff;}.cm-s-isotope span.cm-property,.cm-s-isotope span.cm-attribute {color: #33ff00;}.cm-s-isotope span.cm-keyword {color: #ff0000;}.cm-s-isotope span.cm-string {color: #ff0099;}.cm-s-isotope span.cm-variable {color: #33ff00;}.cm-s-isotope span.cm-variable-2 {color: #0066ff;}.cm-s-isotope span.cm-def {color: #ff9900;}.cm-s-isotope span.cm-error {background: #ff0000;color: #c0c0c0;}.cm-s-isotope span.cm-bracket {color: #e0e0e0;}.cm-s-isotope span.cm-tag {color: #ff0000;}.cm-s-isotope span.cm-link {color: #cc00ff;}.cm-s-isotope .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}.cm-s-isotope .CodeMirror-activeline-background {background: #202020;}/*
|
1357 |
+
http://lesscss.org/ dark theme
|
1358 |
+
Ported to CodeMirror by Peter Kroon
|
1359 |
+
*/.cm-s-lesser-dark {line-height: 1.3em;}.cm-s-lesser-dark.CodeMirror {background: #262626;color: #EBEFE7;text-shadow: 0 -1px 1px #262626;}.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B;}/* 33322B*/.cm-s-lesser-dark .CodeMirror-line::-moz-selection,.cm-s-lesser-dark .CodeMirror-line > span::-moz-selection,.cm-s-lesser-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(69, 68, 59, 0.99);}.cm-s-lesser-dark .CodeMirror-line::selection,.cm-s-lesser-dark .CodeMirror-line > span::selection,.cm-s-lesser-dark .CodeMirror-line > span > span::selection {background: rgba(69, 68, 59, 0.99);}.cm-s-lesser-dark .CodeMirror-line::-moz-selection,.cm-s-lesser-dark .CodeMirror-line > span::-moz-selection,.cm-s-lesser-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(69, 68, 59, 0.99);}.cm-s-lesser-dark .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-lesser-dark pre {padding: 0 8px;}/*editable code holder*/.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket {color: #7EFC7E;}/*65FC65*/.cm-s-lesser-dark .CodeMirror-gutters {background: #262626;border-right: 1px solid #aaa;}.cm-s-lesser-dark .CodeMirror-guttermarker {color: #599eff;}.cm-s-lesser-dark .CodeMirror-guttermarker-subtle {color: #777;}.cm-s-lesser-dark .CodeMirror-linenumber {color: #777;}.cm-s-lesser-dark span.cm-header {color: #a0a;}.cm-s-lesser-dark span.cm-quote {color: #090;}.cm-s-lesser-dark span.cm-keyword {color: #599eff;}.cm-s-lesser-dark span.cm-atom {color: #C2B470;}.cm-s-lesser-dark span.cm-number {color: #B35E4D;}.cm-s-lesser-dark span.cm-def {color: white;}.cm-s-lesser-dark span.cm-variable {color: #D9BF8C;}.cm-s-lesser-dark span.cm-variable-2 {color: #669199;}.cm-s-lesser-dark span.cm-variable-3 {color: white;}.cm-s-lesser-dark span.cm-property {color: #92A75C;}.cm-s-lesser-dark span.cm-operator {color: #92A75C;}.cm-s-lesser-dark span.cm-comment {color: #666;}.cm-s-lesser-dark span.cm-string {color: #BCD279;}.cm-s-lesser-dark span.cm-string-2 {color: #f50;}.cm-s-lesser-dark span.cm-meta {color: #738C73;}.cm-s-lesser-dark span.cm-qualifier {color: #555;}.cm-s-lesser-dark span.cm-builtin {color: #ff9e59;}.cm-s-lesser-dark span.cm-bracket {color: #EBEFE7;}.cm-s-lesser-dark span.cm-tag {color: #669199;}.cm-s-lesser-dark span.cm-attribute {color: #00c;}.cm-s-lesser-dark span.cm-hr {color: #999;}.cm-s-lesser-dark span.cm-link {color: #00c;}.cm-s-lesser-dark span.cm-error {color: #9d1e15;}.cm-s-lesser-dark .CodeMirror-activeline-background {background: #3C3A3A;}.cm-s-lesser-dark .CodeMirror-matchingbracket {outline: 1px solid grey;color: white !important;}.cm-s-liquibyte.CodeMirror {background-color: #000;color: #fff;line-height: 1.2em;font-size: 1em;}.cm-s-liquibyte .CodeMirror-focused .cm-matchhighlight {text-decoration: underline;-webkit-text-decoration-color: #0f0;text-decoration-color: #0f0;-webkit-text-decoration-style: wavy;text-decoration-style: wavy;}.cm-s-liquibyte .cm-trailingspace {text-decoration: line-through;-webkit-text-decoration-color: #f00;text-decoration-color: #f00;-webkit-text-decoration-style: dotted;text-decoration-style: dotted;}.cm-s-liquibyte .cm-tab {text-decoration: line-through;-webkit-text-decoration-color: #404040;text-decoration-color: #404040;-webkit-text-decoration-style: dotted;text-decoration-style: dotted;}.cm-s-liquibyte .CodeMirror-gutters {background-color: #262626;border-right: 1px solid #505050;padding-right: 0.8em;}.cm-s-liquibyte .CodeMirror-gutter-elt div {font-size: 1.2em;}.cm-s-liquibyte .CodeMirror-linenumber {color: #606060;padding-left: 0;}.cm-s-liquibyte .CodeMirror-cursor {border-left: 1px solid #eee;}.cm-s-liquibyte span.cm-comment {color: #008000;}.cm-s-liquibyte span.cm-def {color: #ffaf40;font-weight: bold;}.cm-s-liquibyte span.cm-keyword {color: #c080ff;font-weight: bold;}.cm-s-liquibyte span.cm-builtin {color: #ffaf40;font-weight: bold;}.cm-s-liquibyte span.cm-variable {color: #5967ff;font-weight: bold;}.cm-s-liquibyte span.cm-string {color: #ff8000;}.cm-s-liquibyte span.cm-number {color: #0f0;font-weight: bold;}.cm-s-liquibyte span.cm-atom {color: #bf3030;font-weight: bold;}.cm-s-liquibyte span.cm-variable-2 {color: #007f7f;font-weight: bold;}.cm-s-liquibyte span.cm-variable-3 {color: #c080ff;font-weight: bold;}.cm-s-liquibyte span.cm-property {color: #999;font-weight: bold;}.cm-s-liquibyte span.cm-operator {color: #fff;}.cm-s-liquibyte span.cm-meta {color: #0f0;}.cm-s-liquibyte span.cm-qualifier {color: #fff700;font-weight: bold;}.cm-s-liquibyte span.cm-bracket {color: #cc7;}.cm-s-liquibyte span.cm-tag {color: #ff0;font-weight: bold;}.cm-s-liquibyte span.cm-attribute {color: #c080ff;font-weight: bold;}.cm-s-liquibyte span.cm-error {color: #f00;}.cm-s-liquibyte div.CodeMirror-selected {background-color: rgba(255, 0, 0, 0.25);}.cm-s-liquibyte span.cm-compilation {background-color: rgba(255, 255, 255, 0.12);}.cm-s-liquibyte .CodeMirror-activeline-background {background-color: rgba(0, 255, 0, 0.15);}/* Default styles for common addons */.cm-s-liquibyte .CodeMirror span.CodeMirror-matchingbracket {color: #0f0;font-weight: bold;}.cm-s-liquibyte .CodeMirror span.CodeMirror-nonmatchingbracket {color: #f00;font-weight: bold;}.CodeMirror-matchingtag {background-color: rgba(150, 255, 0, 0.3);}/* Scrollbars *//* Simple */.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div:hover,div.CodeMirror-simplescroll-vertical div:hover {background-color: rgba(80, 80, 80, 0.7);}.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div,div.CodeMirror-simplescroll-vertical div {background-color: rgba(80, 80, 80, 0.3);border: 1px solid #404040;border-radius: 5px;}.cm-s-liquibyte div.CodeMirror-simplescroll-vertical div {border-top: 1px solid #404040;border-bottom: 1px solid #404040;}.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div {border-left: 1px solid #404040;border-right: 1px solid #404040;}.cm-s-liquibyte div.CodeMirror-simplescroll-vertical {background-color: #262626;}.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal {background-color: #262626;border-top: 1px solid #404040;}/* Overlay */.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div,div.CodeMirror-overlayscroll-vertical div {background-color: #404040;border-radius: 5px;}.cm-s-liquibyte div.CodeMirror-overlayscroll-vertical div {border: 1px solid #404040;}.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div {border: 1px solid #404040;}/*
|
1360 |
+
|
1361 |
+
Name: material
|
1362 |
+
Author: Michael Kaminsky (http://github.com/mkaminsky11)
|
1363 |
+
|
1364 |
+
Original material color scheme by Mattia Astorino (https://github.com/equinusocio/material-theme)
|
1365 |
+
|
1366 |
+
*/.cm-s-material.CodeMirror {background-color: #263238;color: #e9eded;}.cm-s-material .CodeMirror-gutters {background: #263238;color: #537f7e;border: none;}.cm-s-material .CodeMirror-guttermarker,.cm-s-material .CodeMirror-guttermarker-subtle,.cm-s-material .CodeMirror-linenumber {color: #537f7e;}.cm-s-material .CodeMirror-cursor {border-left: 1px solid #f8f8f0;}.cm-s-material div.CodeMirror-selected {background: rgba(255, 255, 255, 0.15);}.cm-s-material.CodeMirror-focused div.CodeMirror-selected {background: rgba(255, 255, 255, 0.1);}.cm-s-material .CodeMirror-line::-moz-selection,.cm-s-material .CodeMirror-line > span::-moz-selection,.cm-s-material .CodeMirror-line > span > span::-moz-selection {background: rgba(255, 255, 255, 0.1);}.cm-s-material .CodeMirror-line::selection,.cm-s-material .CodeMirror-line > span::selection,.cm-s-material .CodeMirror-line > span > span::selection {background: rgba(255, 255, 255, 0.1);}.cm-s-material .CodeMirror-line::-moz-selection,.cm-s-material .CodeMirror-line > span::-moz-selection,.cm-s-material .CodeMirror-line > span > span::-moz-selection {background: rgba(255, 255, 255, 0.1);}.cm-s-material .CodeMirror-activeline-background {background: rgba(0, 0, 0, 0);}.cm-s-material .cm-keyword {color: #c792ea;}.cm-s-material .cm-operator {color: #e9eded;}.cm-s-material .cm-variable-2 {color: #80CBC4;}.cm-s-material .cm-variable-3 {color: #82B1FF;}.cm-s-material .cm-builtin {color: #DECB6B;}.cm-s-material .cm-atom {color: #F77669;}.cm-s-material .cm-number {color: #F77669;}.cm-s-material .cm-def {color: #e9eded;}.cm-s-material .cm-string {color: #C3E88D;}.cm-s-material .cm-string-2 {color: #80CBC4;}.cm-s-material .cm-comment {color: #546E7A;}.cm-s-material .cm-variable {color: #82B1FF;}.cm-s-material .cm-tag {color: #80CBC4;}.cm-s-material .cm-meta {color: #80CBC4;}.cm-s-material .cm-attribute {color: #FFCB6B;}.cm-s-material .cm-property {color: #80CBAE;}.cm-s-material .cm-qualifier {color: #DECB6B;}.cm-s-material .cm-variable-3 {color: #DECB6B;}.cm-s-material .cm-tag {color: #ff5370;}.cm-s-material .cm-error {color: #ffffff;background-color: #EC5F67;}.cm-s-material .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}/****************************************************************//* Based on mbonaci's Brackets mbo theme *//* https://github.com/mbonaci/global/blob/master/Mbo.tmTheme *//* Create your own: http://tmtheme-editor.herokuapp.com *//****************************************************************/.cm-s-mbo.CodeMirror {
|
1367 |
+
background: #2c2c2c;
|
1368 |
+
color: #ffffec;
|
1369 |
+
}
|
1370 |
+
|
1371 |
+
.cm-s-mbo div.CodeMirror-selected {
|
1372 |
+
background: #716C62;
|
1373 |
+
}
|
1374 |
+
|
1375 |
+
.cm-s-mbo .CodeMirror-line::-moz-selection,.cm-s-mbo .CodeMirror-line > span::-moz-selection,.cm-s-mbo .CodeMirror-line > span > span::-moz-selection {
|
1376 |
+
background: rgba(113, 108, 98, 0.99);
|
1377 |
+
}
|
1378 |
+
|
1379 |
+
.cm-s-mbo .CodeMirror-line::selection,.cm-s-mbo .CodeMirror-line > span::selection,.cm-s-mbo .CodeMirror-line > span > span::selection {
|
1380 |
+
background: rgba(113, 108, 98, 0.99);
|
1381 |
+
}
|
1382 |
+
|
1383 |
+
.cm-s-mbo .CodeMirror-line::-moz-selection,.cm-s-mbo .CodeMirror-line > span::-moz-selection,.cm-s-mbo .CodeMirror-line > span > span::-moz-selection {
|
1384 |
+
background: rgba(113, 108, 98, 0.99);
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
.cm-s-mbo .CodeMirror-gutters {
|
1388 |
+
background: #4e4e4e;
|
1389 |
+
border-right: 0px;
|
1390 |
+
}
|
1391 |
+
|
1392 |
+
.cm-s-mbo .CodeMirror-guttermarker {
|
1393 |
+
color: white;
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
.cm-s-mbo .CodeMirror-guttermarker-subtle {
|
1397 |
+
color: grey;
|
1398 |
+
}
|
1399 |
+
|
1400 |
+
.cm-s-mbo .CodeMirror-linenumber {
|
1401 |
+
color: #dadada;
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
.cm-s-mbo .CodeMirror-cursor {
|
1405 |
+
border-left: 1px solid #ffffec;
|
1406 |
+
}
|
1407 |
+
|
1408 |
+
.cm-s-mbo span.cm-comment {
|
1409 |
+
color: #95958a;
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
.cm-s-mbo span.cm-atom {
|
1413 |
+
color: #00a8c6;
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
.cm-s-mbo span.cm-number {
|
1417 |
+
color: #00a8c6;
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
.cm-s-mbo span.cm-property,.cm-s-mbo span.cm-attribute {
|
1421 |
+
color: #9ddfe9;
|
1422 |
+
}
|
1423 |
+
|
1424 |
+
.cm-s-mbo span.cm-keyword {
|
1425 |
+
color: #ffb928;
|
1426 |
+
}
|
1427 |
+
|
1428 |
+
.cm-s-mbo span.cm-string {
|
1429 |
+
color: #ffcf6c;
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
.cm-s-mbo span.cm-string.cm-property {
|
1433 |
+
color: #ffffec;
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
.cm-s-mbo span.cm-variable {
|
1437 |
+
color: #ffffec;
|
1438 |
+
}
|
1439 |
+
|
1440 |
+
.cm-s-mbo span.cm-variable-2 {
|
1441 |
+
color: #00a8c6;
|
1442 |
+
}
|
1443 |
+
|
1444 |
+
.cm-s-mbo span.cm-def {
|
1445 |
+
color: #ffffec;
|
1446 |
+
}
|
1447 |
+
|
1448 |
+
.cm-s-mbo span.cm-bracket {
|
1449 |
+
color: #fffffc;
|
1450 |
+
font-weight: bold;
|
1451 |
+
}
|
1452 |
+
|
1453 |
+
.cm-s-mbo span.cm-tag {
|
1454 |
+
color: #9ddfe9;
|
1455 |
+
}
|
1456 |
+
|
1457 |
+
.cm-s-mbo span.cm-link {
|
1458 |
+
color: #f54b07;
|
1459 |
+
}
|
1460 |
+
|
1461 |
+
.cm-s-mbo span.cm-error {
|
1462 |
+
border-bottom: #636363;
|
1463 |
+
color: #ffffec;
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
.cm-s-mbo span.cm-qualifier {
|
1467 |
+
color: #ffffec;
|
1468 |
+
}
|
1469 |
+
|
1470 |
+
.cm-s-mbo .CodeMirror-activeline-background {
|
1471 |
+
background: #494b41;
|
1472 |
+
}
|
1473 |
+
|
1474 |
+
.cm-s-mbo .CodeMirror-matchingbracket {
|
1475 |
+
color: #ffb928 !important;
|
1476 |
+
}
|
1477 |
+
|
1478 |
+
.cm-s-mbo .CodeMirror-matchingtag {
|
1479 |
+
background: rgba(255, 255, 255, 0.37);
|
1480 |
+
}/*
|
1481 |
+
MDN-LIKE Theme - Mozilla
|
1482 |
+
Ported to CodeMirror by Peter Kroon <plakroon@gmail.com>
|
1483 |
+
Report bugs/issues here: https://github.com/codemirror/CodeMirror/issues
|
1484 |
+
GitHub: @peterkroon
|
1485 |
+
|
1486 |
+
The mdn-like theme is inspired on the displayed code examples at: https://developer.mozilla.org/en-US/docs/Web/CSS/animation
|
1487 |
+
|
1488 |
+
*/.cm-s-mdn-like.CodeMirror {
|
1489 |
+
color: #999;
|
1490 |
+
background-color: #fff;
|
1491 |
+
}
|
1492 |
+
|
1493 |
+
.cm-s-mdn-like div.CodeMirror-selected {
|
1494 |
+
background: #cfc;
|
1495 |
+
}
|
1496 |
+
|
1497 |
+
.cm-s-mdn-like .CodeMirror-line::-moz-selection,.cm-s-mdn-like .CodeMirror-line > span::-moz-selection,.cm-s-mdn-like .CodeMirror-line > span > span::-moz-selection {
|
1498 |
+
background: #cfc;
|
1499 |
+
}
|
1500 |
+
|
1501 |
+
.cm-s-mdn-like .CodeMirror-line::selection,.cm-s-mdn-like .CodeMirror-line > span::selection,.cm-s-mdn-like .CodeMirror-line > span > span::selection {
|
1502 |
+
background: #cfc;
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
.cm-s-mdn-like .CodeMirror-line::-moz-selection,.cm-s-mdn-like .CodeMirror-line > span::-moz-selection,.cm-s-mdn-like .CodeMirror-line > span > span::-moz-selection {
|
1506 |
+
background: #cfc;
|
1507 |
+
}
|
1508 |
+
|
1509 |
+
.cm-s-mdn-like .CodeMirror-gutters {
|
1510 |
+
background: #f8f8f8;
|
1511 |
+
border-left: 6px solid rgba(0, 83, 159, 0.65);
|
1512 |
+
color: #333;
|
1513 |
+
}
|
1514 |
+
|
1515 |
+
.cm-s-mdn-like .CodeMirror-linenumber {
|
1516 |
+
color: #aaa;
|
1517 |
+
padding-left: 8px;
|
1518 |
+
}
|
1519 |
+
|
1520 |
+
.cm-s-mdn-like .CodeMirror-cursor {
|
1521 |
+
border-left: 2px solid #222;
|
1522 |
+
}
|
1523 |
+
|
1524 |
+
.cm-s-mdn-like .cm-keyword {
|
1525 |
+
color: #6262FF;
|
1526 |
+
}
|
1527 |
+
|
1528 |
+
.cm-s-mdn-like .cm-atom {
|
1529 |
+
color: #F90;
|
1530 |
+
}
|
1531 |
+
|
1532 |
+
.cm-s-mdn-like .cm-number {
|
1533 |
+
color: #ca7841;
|
1534 |
+
}
|
1535 |
+
|
1536 |
+
.cm-s-mdn-like .cm-def {
|
1537 |
+
color: #8DA6CE;
|
1538 |
+
}
|
1539 |
+
|
1540 |
+
.cm-s-mdn-like span.cm-variable-2,.cm-s-mdn-like span.cm-tag {
|
1541 |
+
color: #690;
|
1542 |
+
}
|
1543 |
+
|
1544 |
+
.cm-s-mdn-like span.cm-variable-3,.cm-s-mdn-like span.cm-def {
|
1545 |
+
color: #07a;
|
1546 |
+
}
|
1547 |
+
|
1548 |
+
.cm-s-mdn-like .cm-variable {
|
1549 |
+
color: #07a;
|
1550 |
+
}
|
1551 |
+
|
1552 |
+
.cm-s-mdn-like .cm-property {
|
1553 |
+
color: #905;
|
1554 |
+
}
|
1555 |
+
|
1556 |
+
.cm-s-mdn-like .cm-qualifier {
|
1557 |
+
color: #690;
|
1558 |
+
}
|
1559 |
+
|
1560 |
+
.cm-s-mdn-like .cm-operator {
|
1561 |
+
color: #cda869;
|
1562 |
+
}
|
1563 |
+
|
1564 |
+
.cm-s-mdn-like .cm-comment {
|
1565 |
+
color: #777;
|
1566 |
+
font-weight: normal;
|
1567 |
+
}
|
1568 |
+
|
1569 |
+
.cm-s-mdn-like .cm-string {
|
1570 |
+
color: #07a;
|
1571 |
+
font-style: italic;
|
1572 |
+
}
|
1573 |
+
|
1574 |
+
.cm-s-mdn-like .cm-string-2 {
|
1575 |
+
color: #bd6b18;
|
1576 |
+
}/*?*/.cm-s-mdn-like .cm-meta {
|
1577 |
+
color: #000;
|
1578 |
+
}/*?*/.cm-s-mdn-like .cm-builtin {
|
1579 |
+
color: #9B7536;
|
1580 |
+
}/*?*/.cm-s-mdn-like .cm-tag {
|
1581 |
+
color: #997643;
|
1582 |
+
}
|
1583 |
+
|
1584 |
+
.cm-s-mdn-like .cm-attribute {
|
1585 |
+
color: #d6bb6d;
|
1586 |
+
}/*?*/.cm-s-mdn-like .cm-header {
|
1587 |
+
color: #FF6400;
|
1588 |
+
}
|
1589 |
+
|
1590 |
+
.cm-s-mdn-like .cm-hr {
|
1591 |
+
color: #AEAEAE;
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
.cm-s-mdn-like .cm-link {
|
1595 |
+
color: #ad9361;
|
1596 |
+
font-style: italic;
|
1597 |
+
text-decoration: none;
|
1598 |
+
}
|
1599 |
+
|
1600 |
+
.cm-s-mdn-like .cm-error {
|
1601 |
+
border-bottom: 1px solid red;
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
div.cm-s-mdn-like .CodeMirror-activeline-background {
|
1605 |
+
background: #efefff;
|
1606 |
+
}
|
1607 |
+
|
1608 |
+
div.cm-s-mdn-like span.CodeMirror-matchingbracket {
|
1609 |
+
outline: 1px solid grey;
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0NAEyMbYaAlyquFoLKK3SPby9CeVUPThrSJmkCAE0CrKUQadi4DrdSlWhmah0YL9z9vClH59YGbHx1J8VZTyAjQepJjmXwAKTDQI3omc3p1U4gDUf6RfcdYfrUp5ClAi2J3Ba6UOXGo+K+bQrjjssitG2SJzshaLwMtXgRagUNpYYoVkMSBLM+9GGiJZMvduG6DRZ4qc04DMPtQQxOjEtACmhO7K1AbNbQDEggZyJwscFpAGwENhoBeUwh3bWolhe8BTYVKxQEWrSUn/uhcM5KhvUu/+eQu0Lzhi+VrK0PrZZNDQKs9cpYUuFYgMVpD4/NxenJTiMCNqdUEUf1qZWjppLT5qSkkUZbCwkbZMSuVnu80hfSkzRbQeqCZSAh6huR4VtoM2gHAlLf72smuWgE+VV7XpE25Ab2WFDgyhnSuKbs4GuGzCjR+tIoUuMFg3kgcWKLTwRqanJQ2W00hAsenfaApRC42hbCvK1SlE0HtE9BGgneJO+ELamitD1YjjOYnNYVcraGhtKkW0EqVVeDx733I2NH581k1NNxNLG0i0IJ8/NjVaOZ0tYZ2Vtr0Xv7tPV3hkWp9EFkgS/J0vosngTaSoaG06WHi+xObQkaAdlbanP8B2+2l0f90LmUAAAAASUVORK5CYII=);
|
1615 |
+
}/* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden *//*<!--match-->*/.cm-s-midnight span.CodeMirror-matchhighlight {
|
1616 |
+
background: #494949;
|
1617 |
+
}
|
1618 |
+
|
1619 |
+
.cm-s-midnight.CodeMirror-focused span.CodeMirror-matchhighlight {
|
1620 |
+
background: #314D67 !important;
|
1621 |
+
}/*<!--activeline-->*/.cm-s-midnight .CodeMirror-activeline-background {
|
1622 |
+
background: #253540;
|
1623 |
+
}
|
1624 |
+
|
1625 |
+
.cm-s-midnight.CodeMirror {
|
1626 |
+
background: #0F192A;
|
1627 |
+
color: #D1EDFF;
|
1628 |
+
}
|
1629 |
+
|
1630 |
+
.cm-s-midnight.CodeMirror {
|
1631 |
+
border-top: 1px solid black;
|
1632 |
+
border-bottom: 1px solid black;
|
1633 |
+
}
|
1634 |
+
|
1635 |
+
.cm-s-midnight div.CodeMirror-selected {
|
1636 |
+
background: #314D67;
|
1637 |
+
}
|
1638 |
+
|
1639 |
+
.cm-s-midnight .CodeMirror-line::-moz-selection,.cm-s-midnight .CodeMirror-line > span::-moz-selection,.cm-s-midnight .CodeMirror-line > span > span::-moz-selection {
|
1640 |
+
background: rgba(49, 77, 103, 0.99);
|
1641 |
+
}
|
1642 |
+
|
1643 |
+
.cm-s-midnight .CodeMirror-line::selection,.cm-s-midnight .CodeMirror-line > span::selection,.cm-s-midnight .CodeMirror-line > span > span::selection {
|
1644 |
+
background: rgba(49, 77, 103, 0.99);
|
1645 |
+
}
|
1646 |
+
|
1647 |
+
.cm-s-midnight .CodeMirror-line::-moz-selection,.cm-s-midnight .CodeMirror-line > span::-moz-selection,.cm-s-midnight .CodeMirror-line > span > span::-moz-selection {
|
1648 |
+
background: rgba(49, 77, 103, 0.99);
|
1649 |
+
}
|
1650 |
+
|
1651 |
+
.cm-s-midnight .CodeMirror-gutters {
|
1652 |
+
background: #0F192A;
|
1653 |
+
border-right: 1px solid;
|
1654 |
+
}
|
1655 |
+
|
1656 |
+
.cm-s-midnight .CodeMirror-guttermarker {
|
1657 |
+
color: white;
|
1658 |
+
}
|
1659 |
+
|
1660 |
+
.cm-s-midnight .CodeMirror-guttermarker-subtle {
|
1661 |
+
color: #d0d0d0;
|
1662 |
+
}
|
1663 |
+
|
1664 |
+
.cm-s-midnight .CodeMirror-linenumber {
|
1665 |
+
color: #D0D0D0;
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
.cm-s-midnight .CodeMirror-cursor {
|
1669 |
+
border-left: 1px solid #F8F8F0;
|
1670 |
+
}
|
1671 |
+
|
1672 |
+
.cm-s-midnight span.cm-comment {
|
1673 |
+
color: #428BDD;
|
1674 |
+
}
|
1675 |
+
|
1676 |
+
.cm-s-midnight span.cm-atom {
|
1677 |
+
color: #AE81FF;
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
.cm-s-midnight span.cm-number {
|
1681 |
+
color: #D1EDFF;
|
1682 |
+
}
|
1683 |
+
|
1684 |
+
.cm-s-midnight span.cm-property,.cm-s-midnight span.cm-attribute {
|
1685 |
+
color: #A6E22E;
|
1686 |
+
}
|
1687 |
+
|
1688 |
+
.cm-s-midnight span.cm-keyword {
|
1689 |
+
color: #E83737;
|
1690 |
+
}
|
1691 |
+
|
1692 |
+
.cm-s-midnight span.cm-string {
|
1693 |
+
color: #1DC116;
|
1694 |
+
}
|
1695 |
+
|
1696 |
+
.cm-s-midnight span.cm-variable {
|
1697 |
+
color: #FFAA3E;
|
1698 |
+
}
|
1699 |
+
|
1700 |
+
.cm-s-midnight span.cm-variable-2 {
|
1701 |
+
color: #FFAA3E;
|
1702 |
+
}
|
1703 |
+
|
1704 |
+
.cm-s-midnight span.cm-def {
|
1705 |
+
color: #4DD;
|
1706 |
+
}
|
1707 |
+
|
1708 |
+
.cm-s-midnight span.cm-bracket {
|
1709 |
+
color: #D1EDFF;
|
1710 |
+
}
|
1711 |
+
|
1712 |
+
.cm-s-midnight span.cm-tag {
|
1713 |
+
color: #449;
|
1714 |
+
}
|
1715 |
+
|
1716 |
+
.cm-s-midnight span.cm-link {
|
1717 |
+
color: #AE81FF;
|
1718 |
+
}
|
1719 |
+
|
1720 |
+
.cm-s-midnight span.cm-error {
|
1721 |
+
background: #F92672;
|
1722 |
+
color: #F8F8F0;
|
1723 |
+
}
|
1724 |
+
|
1725 |
+
.cm-s-midnight .CodeMirror-matchingbracket {
|
1726 |
+
text-decoration: underline;
|
1727 |
+
color: white !important;
|
1728 |
+
}/* Based on Sublime Text's Monokai theme */.cm-s-monokai.CodeMirror {background: #272822;color: #f8f8f2;}.cm-s-monokai div.CodeMirror-selected {background: #49483E;}.cm-s-monokai .CodeMirror-line::-moz-selection,.cm-s-monokai .CodeMirror-line > span::-moz-selection,.cm-s-monokai .CodeMirror-line > span > span::-moz-selection {background: rgba(73, 72, 62, 0.99);}.cm-s-monokai .CodeMirror-line::selection,.cm-s-monokai .CodeMirror-line > span::selection,.cm-s-monokai .CodeMirror-line > span > span::selection {background: rgba(73, 72, 62, 0.99);}.cm-s-monokai .CodeMirror-line::-moz-selection,.cm-s-monokai .CodeMirror-line > span::-moz-selection,.cm-s-monokai .CodeMirror-line > span > span::-moz-selection {background: rgba(73, 72, 62, 0.99);}.cm-s-monokai .CodeMirror-gutters {background: #272822;border-right: 0px;}.cm-s-monokai .CodeMirror-guttermarker {color: white;}.cm-s-monokai .CodeMirror-guttermarker-subtle {color: #d0d0d0;}.cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;}.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0;}.cm-s-monokai span.cm-comment {color: #75715e;}.cm-s-monokai span.cm-atom {color: #ae81ff;}.cm-s-monokai span.cm-number {color: #ae81ff;}.cm-s-monokai span.cm-property,.cm-s-monokai span.cm-attribute {color: #a6e22e;}.cm-s-monokai span.cm-keyword {color: #f92672;}.cm-s-monokai span.cm-builtin {color: #66d9ef;}.cm-s-monokai span.cm-string {color: #e6db74;}.cm-s-monokai span.cm-variable {color: #f8f8f2;}.cm-s-monokai span.cm-variable-2 {color: #9effff;}.cm-s-monokai span.cm-variable-3 {color: #66d9ef;}.cm-s-monokai span.cm-def {color: #fd971f;}.cm-s-monokai span.cm-bracket {color: #f8f8f2;}.cm-s-monokai span.cm-tag {color: #f92672;}.cm-s-monokai span.cm-header {color: #ae81ff;}.cm-s-monokai span.cm-link {color: #ae81ff;}.cm-s-monokai span.cm-error {background: #f92672;color: #f8f8f0;}.cm-s-monokai .CodeMirror-activeline-background {background: #373831;}.cm-s-monokai .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}.cm-s-neat span.cm-comment {color: #a86;}.cm-s-neat span.cm-keyword {line-height: 1em;font-weight: bold;color: blue;}.cm-s-neat span.cm-string {color: #a22;}.cm-s-neat span.cm-builtin {line-height: 1em;font-weight: bold;color: #077;}.cm-s-neat span.cm-special {line-height: 1em;font-weight: bold;color: #0aa;}.cm-s-neat span.cm-variable {color: black;}.cm-s-neat span.cm-number,.cm-s-neat span.cm-atom {color: #3a3;}.cm-s-neat span.cm-meta {color: #555;}.cm-s-neat span.cm-link {color: #3a3;}.cm-s-neat .CodeMirror-activeline-background {background: #e8f2ff;}.cm-s-neat .CodeMirror-matchingbracket {outline: 1px solid grey;color: black !important;}/* neo theme for codemirror *//* Color scheme */.cm-s-neo.CodeMirror {background-color: #ffffff;color: #2e383c;line-height: 1.4375;}.cm-s-neo .cm-comment {color: #75787b;}.cm-s-neo .cm-keyword,.cm-s-neo .cm-property {color: #1d75b3;}.cm-s-neo .cm-atom,.cm-s-neo .cm-number {color: #75438a;}.cm-s-neo .cm-node,.cm-s-neo .cm-tag {color: #9c3328;}.cm-s-neo .cm-string {color: #b35e14;}.cm-s-neo .cm-variable,.cm-s-neo .cm-qualifier {color: #047d65;}/* Editor styling */.cm-s-neo pre {padding: 0;}.cm-s-neo .CodeMirror-gutters {border: none;border-right: 10px solid transparent;background-color: transparent;}.cm-s-neo .CodeMirror-linenumber {padding: 0;color: #e0e2e5;}.cm-s-neo .CodeMirror-guttermarker {color: #1d75b3;}.cm-s-neo .CodeMirror-guttermarker-subtle {color: #e0e2e5;}.cm-s-neo .CodeMirror-cursor {width: auto;border: 0;background: rgba(155, 157, 162, 0.37);z-index: 1;}/* Loosely based on the Midnight Textmate theme */.cm-s-night.CodeMirror {background: #0a001f;color: #f8f8f8;}.cm-s-night div.CodeMirror-selected {background: #447;}.cm-s-night .CodeMirror-line::-moz-selection,.cm-s-night .CodeMirror-line > span::-moz-selection,.cm-s-night .CodeMirror-line > span > span::-moz-selection {background: rgba(68, 68, 119, 0.99);}.cm-s-night .CodeMirror-line::selection,.cm-s-night .CodeMirror-line > span::selection,.cm-s-night .CodeMirror-line > span > span::selection {background: rgba(68, 68, 119, 0.99);}.cm-s-night .CodeMirror-line::-moz-selection,.cm-s-night .CodeMirror-line > span::-moz-selection,.cm-s-night .CodeMirror-line > span > span::-moz-selection {background: rgba(68, 68, 119, 0.99);}.cm-s-night .CodeMirror-gutters {background: #0a001f;border-right: 1px solid #aaa;}.cm-s-night .CodeMirror-guttermarker {color: white;}.cm-s-night .CodeMirror-guttermarker-subtle {color: #bbb;}.cm-s-night .CodeMirror-linenumber {color: #f8f8f8;}.cm-s-night .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-night span.cm-comment {color: #8900d1;}.cm-s-night span.cm-atom {color: #845dc4;}.cm-s-night span.cm-number,.cm-s-night span.cm-attribute {color: #ffd500;}.cm-s-night span.cm-keyword {color: #599eff;}.cm-s-night span.cm-string {color: #37f14a;}.cm-s-night span.cm-meta {color: #7678e2;}.cm-s-night span.cm-variable-2,.cm-s-night span.cm-tag {color: #99b2ff;}.cm-s-night span.cm-variable-3,.cm-s-night span.cm-def {color: white;}.cm-s-night span.cm-bracket {color: #8da6ce;}.cm-s-night span.cm-builtin,.cm-s-night span.cm-special {color: #ff9e59;}.cm-s-night span.cm-link {color: #845dc4;}.cm-s-night span.cm-error {color: #9d1e15;}.cm-s-night .CodeMirror-activeline-background {background: #1C005A;}.cm-s-night .CodeMirror-matchingbracket {outline: 1px solid grey;color: white !important;}/*
|
1729 |
+
Name: Panda Syntax
|
1730 |
+
Author: Siamak Mokhtari (http://github.com/siamak/)
|
1731 |
+
CodeMirror template by Siamak Mokhtari (https://github.com/siamak/atom-panda-syntax)
|
1732 |
+
*/.cm-s-panda-syntax {background: #292A2B;color: #E6E6E6;line-height: 1.5;font-family: 'Operator Mono', 'Source Sans Pro', Menlo, Monaco, Consolas, Courier New, monospace;}.cm-s-panda-syntax .CodeMirror-cursor {border-color: #ff2c6d;}.cm-s-panda-syntax .CodeMirror-activeline-background {background: rgba(99, 123, 156, 0.1);}.cm-s-panda-syntax .CodeMirror-selected {background: #FFF;}.cm-s-panda-syntax .cm-comment {font-style: italic;color: #676B79;}.cm-s-panda-syntax .cm-operator {color: #f3f3f3;}.cm-s-panda-syntax .cm-string {color: #19F9D8;}.cm-s-panda-syntax .cm-string-2 {color: #FFB86C;}.cm-s-panda-syntax .cm-tag {color: #ff2c6d;}.cm-s-panda-syntax .cm-meta {color: #b084eb;}.cm-s-panda-syntax .cm-number {color: #FFB86C;}.cm-s-panda-syntax .cm-atom {color: #ff2c6d;}.cm-s-panda-syntax .cm-keyword {color: #FF75B5;}.cm-s-panda-syntax .cm-variable {color: #ffb86c;}.cm-s-panda-syntax .cm-variable-2 {color: #ff9ac1;}.cm-s-panda-syntax .cm-variable-3 {color: #ff9ac1;}.cm-s-panda-syntax .cm-def {color: #e6e6e6;}.cm-s-panda-syntax .cm-property {color: #f3f3f3;}.cm-s-panda-syntax .cm-unit {color: #ffb86c;}.cm-s-panda-syntax .cm-attribute {color: #ffb86c;}.cm-s-panda-syntax .CodeMirror-matchingbracket {border-bottom: 1px dotted #19F9D8;padding-bottom: 2px;color: #e6e6e6;}.cm-s-panda-syntax .CodeMirror-gutters {background: #292a2b;border-right-color: rgba(255, 255, 255, 0.1);}.cm-s-panda-syntax .CodeMirror-linenumber {color: #e6e6e6;opacity: 0.6;}/*
|
1733 |
+
|
1734 |
+
Name: Paraíso (Dark)
|
1735 |
+
Author: Jan T. Sott
|
1736 |
+
|
1737 |
+
Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror)
|
1738 |
+
Inspired by the art of Rubens LP (http://www.rubenslp.com.br)
|
1739 |
+
|
1740 |
+
*/.cm-s-paraiso-dark.CodeMirror {background: #2f1e2e;color: #b9b6b0;}.cm-s-paraiso-dark div.CodeMirror-selected {background: #41323f;}.cm-s-paraiso-dark .CodeMirror-line::-moz-selection,.cm-s-paraiso-dark .CodeMirror-line > span::-moz-selection,.cm-s-paraiso-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(65, 50, 63, 0.99);}.cm-s-paraiso-dark .CodeMirror-line::selection,.cm-s-paraiso-dark .CodeMirror-line > span::selection,.cm-s-paraiso-dark .CodeMirror-line > span > span::selection {background: rgba(65, 50, 63, 0.99);}.cm-s-paraiso-dark .CodeMirror-line::-moz-selection,.cm-s-paraiso-dark .CodeMirror-line > span::-moz-selection,.cm-s-paraiso-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(65, 50, 63, 0.99);}.cm-s-paraiso-dark .CodeMirror-gutters {background: #2f1e2e;border-right: 0px;}.cm-s-paraiso-dark .CodeMirror-guttermarker {color: #ef6155;}.cm-s-paraiso-dark .CodeMirror-guttermarker-subtle {color: #776e71;}.cm-s-paraiso-dark .CodeMirror-linenumber {color: #776e71;}.cm-s-paraiso-dark .CodeMirror-cursor {border-left: 1px solid #8d8687;}.cm-s-paraiso-dark span.cm-comment {color: #e96ba8;}.cm-s-paraiso-dark span.cm-atom {color: #815ba4;}.cm-s-paraiso-dark span.cm-number {color: #815ba4;}.cm-s-paraiso-dark span.cm-property,.cm-s-paraiso-dark span.cm-attribute {color: #48b685;}.cm-s-paraiso-dark span.cm-keyword {color: #ef6155;}.cm-s-paraiso-dark span.cm-string {color: #fec418;}.cm-s-paraiso-dark span.cm-variable {color: #48b685;}.cm-s-paraiso-dark span.cm-variable-2 {color: #06b6ef;}.cm-s-paraiso-dark span.cm-def {color: #f99b15;}.cm-s-paraiso-dark span.cm-bracket {color: #b9b6b0;}.cm-s-paraiso-dark span.cm-tag {color: #ef6155;}.cm-s-paraiso-dark span.cm-link {color: #815ba4;}.cm-s-paraiso-dark span.cm-error {background: #ef6155;color: #8d8687;}.cm-s-paraiso-dark .CodeMirror-activeline-background {background: #4D344A;}.cm-s-paraiso-dark .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}/*
|
1741 |
+
|
1742 |
+
Name: Paraíso (Light)
|
1743 |
+
Author: Jan T. Sott
|
1744 |
+
|
1745 |
+
Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror)
|
1746 |
+
Inspired by the art of Rubens LP (http://www.rubenslp.com.br)
|
1747 |
+
|
1748 |
+
*/.cm-s-paraiso-light.CodeMirror {background: #e7e9db;color: #41323f;}.cm-s-paraiso-light div.CodeMirror-selected {background: #b9b6b0;}.cm-s-paraiso-light .CodeMirror-line::-moz-selection,.cm-s-paraiso-light .CodeMirror-line > span::-moz-selection,.cm-s-paraiso-light .CodeMirror-line > span > span::-moz-selection {background: #b9b6b0;}.cm-s-paraiso-light .CodeMirror-line::selection,.cm-s-paraiso-light .CodeMirror-line > span::selection,.cm-s-paraiso-light .CodeMirror-line > span > span::selection {background: #b9b6b0;}.cm-s-paraiso-light .CodeMirror-line::-moz-selection,.cm-s-paraiso-light .CodeMirror-line > span::-moz-selection,.cm-s-paraiso-light .CodeMirror-line > span > span::-moz-selection {background: #b9b6b0;}.cm-s-paraiso-light .CodeMirror-gutters {background: #e7e9db;border-right: 0px;}.cm-s-paraiso-light .CodeMirror-guttermarker {color: black;}.cm-s-paraiso-light .CodeMirror-guttermarker-subtle {color: #8d8687;}.cm-s-paraiso-light .CodeMirror-linenumber {color: #8d8687;}.cm-s-paraiso-light .CodeMirror-cursor {border-left: 1px solid #776e71;}.cm-s-paraiso-light span.cm-comment {color: #e96ba8;}.cm-s-paraiso-light span.cm-atom {color: #815ba4;}.cm-s-paraiso-light span.cm-number {color: #815ba4;}.cm-s-paraiso-light span.cm-property,.cm-s-paraiso-light span.cm-attribute {color: #48b685;}.cm-s-paraiso-light span.cm-keyword {color: #ef6155;}.cm-s-paraiso-light span.cm-string {color: #fec418;}.cm-s-paraiso-light span.cm-variable {color: #48b685;}.cm-s-paraiso-light span.cm-variable-2 {color: #06b6ef;}.cm-s-paraiso-light span.cm-def {color: #f99b15;}.cm-s-paraiso-light span.cm-bracket {color: #41323f;}.cm-s-paraiso-light span.cm-tag {color: #ef6155;}.cm-s-paraiso-light span.cm-link {color: #815ba4;}.cm-s-paraiso-light span.cm-error {background: #ef6155;color: #776e71;}.cm-s-paraiso-light .CodeMirror-activeline-background {background: #CFD1C4;}.cm-s-paraiso-light .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}/**
|
1749 |
+
* Pastel On Dark theme ported from ACE editor
|
1750 |
+
* @license MIT
|
1751 |
+
* @copyright AtomicPages LLC 2014
|
1752 |
+
* @author Dennis Thompson, AtomicPages LLC
|
1753 |
+
* @version 1.1
|
1754 |
+
* @source https://github.com/atomicpages/codemirror-pastel-on-dark-theme
|
1755 |
+
*/.cm-s-pastel-on-dark.CodeMirror {background: #2c2827;color: #8F938F;line-height: 1.5;}.cm-s-pastel-on-dark div.CodeMirror-selected {background: rgba(221, 240, 255, 0.2);}.cm-s-pastel-on-dark .CodeMirror-line::-moz-selection,.cm-s-pastel-on-dark .CodeMirror-line > span::-moz-selection,.cm-s-pastel-on-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(221, 240, 255, 0.2);}.cm-s-pastel-on-dark .CodeMirror-line::selection,.cm-s-pastel-on-dark .CodeMirror-line > span::selection,.cm-s-pastel-on-dark .CodeMirror-line > span > span::selection {background: rgba(221, 240, 255, 0.2);}.cm-s-pastel-on-dark .CodeMirror-line::-moz-selection,.cm-s-pastel-on-dark .CodeMirror-line > span::-moz-selection,.cm-s-pastel-on-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(221, 240, 255, 0.2);}.cm-s-pastel-on-dark .CodeMirror-gutters {background: #34302f;border-right: 0px;padding: 0 3px;}.cm-s-pastel-on-dark .CodeMirror-guttermarker {color: white;}.cm-s-pastel-on-dark .CodeMirror-guttermarker-subtle {color: #8F938F;}.cm-s-pastel-on-dark .CodeMirror-linenumber {color: #8F938F;}.cm-s-pastel-on-dark .CodeMirror-cursor {border-left: 1px solid #A7A7A7;}.cm-s-pastel-on-dark span.cm-comment {color: #A6C6FF;}.cm-s-pastel-on-dark span.cm-atom {color: #DE8E30;}.cm-s-pastel-on-dark span.cm-number {color: #CCCCCC;}.cm-s-pastel-on-dark span.cm-property {color: #8F938F;}.cm-s-pastel-on-dark span.cm-attribute {color: #a6e22e;}.cm-s-pastel-on-dark span.cm-keyword {color: #AEB2F8;}.cm-s-pastel-on-dark span.cm-string {color: #66A968;}.cm-s-pastel-on-dark span.cm-variable {color: #AEB2F8;}.cm-s-pastel-on-dark span.cm-variable-2 {color: #BEBF55;}.cm-s-pastel-on-dark span.cm-variable-3 {color: #DE8E30;}.cm-s-pastel-on-dark span.cm-def {color: #757aD8;}.cm-s-pastel-on-dark span.cm-bracket {color: #f8f8f2;}.cm-s-pastel-on-dark span.cm-tag {color: #C1C144;}.cm-s-pastel-on-dark span.cm-link {color: #ae81ff;}.cm-s-pastel-on-dark span.cm-qualifier,.cm-s-pastel-on-dark span.cm-builtin {color: #C1C144;}.cm-s-pastel-on-dark span.cm-error {background: #757aD8;color: #f8f8f0;}.cm-s-pastel-on-dark .CodeMirror-activeline-background {background: rgba(255, 255, 255, 0.031);}.cm-s-pastel-on-dark .CodeMirror-matchingbracket {border: 1px solid rgba(255, 255, 255, 0.25);color: #8F938F !important;margin: -1px -1px 0 -1px;}/*
|
1756 |
+
|
1757 |
+
Name: Railscasts
|
1758 |
+
Author: Ryan Bates (http://railscasts.com)
|
1759 |
+
|
1760 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
1761 |
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
1762 |
+
|
1763 |
+
*/.cm-s-railscasts.CodeMirror {background: #2b2b2b;color: #f4f1ed;}.cm-s-railscasts div.CodeMirror-selected {background: #272935 !important;}.cm-s-railscasts .CodeMirror-gutters {background: #2b2b2b;border-right: 0px;}.cm-s-railscasts .CodeMirror-linenumber {color: #5a647e;}.cm-s-railscasts .CodeMirror-cursor {border-left: 1px solid #d4cfc9 !important;}.cm-s-railscasts span.cm-comment {color: #bc9458;}.cm-s-railscasts span.cm-atom {color: #b6b3eb;}.cm-s-railscasts span.cm-number {color: #b6b3eb;}.cm-s-railscasts span.cm-property,.cm-s-railscasts span.cm-attribute {color: #a5c261;}.cm-s-railscasts span.cm-keyword {color: #da4939;}.cm-s-railscasts span.cm-string {color: #ffc66d;}.cm-s-railscasts span.cm-variable {color: #a5c261;}.cm-s-railscasts span.cm-variable-2 {color: #6d9cbe;}.cm-s-railscasts span.cm-def {color: #cc7833;}.cm-s-railscasts span.cm-error {background: #da4939;color: #d4cfc9;}.cm-s-railscasts span.cm-bracket {color: #f4f1ed;}.cm-s-railscasts span.cm-tag {color: #da4939;}.cm-s-railscasts span.cm-link {color: #b6b3eb;}.cm-s-railscasts .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}.cm-s-railscasts .CodeMirror-activeline-background {background: #303040;}.cm-s-rubyblue.CodeMirror {background: #112435;color: white;}.cm-s-rubyblue div.CodeMirror-selected {background: #38566F;}.cm-s-rubyblue .CodeMirror-line::-moz-selection,.cm-s-rubyblue .CodeMirror-line > span::-moz-selection,.cm-s-rubyblue .CodeMirror-line > span > span::-moz-selection {background: rgba(56, 86, 111, 0.99);}.cm-s-rubyblue .CodeMirror-line::selection,.cm-s-rubyblue .CodeMirror-line > span::selection,.cm-s-rubyblue .CodeMirror-line > span > span::selection {background: rgba(56, 86, 111, 0.99);}.cm-s-rubyblue .CodeMirror-line::-moz-selection,.cm-s-rubyblue .CodeMirror-line > span::-moz-selection,.cm-s-rubyblue .CodeMirror-line > span > span::-moz-selection {background: rgba(56, 86, 111, 0.99);}.cm-s-rubyblue .CodeMirror-gutters {background: #1F4661;border-right: 7px solid #3E7087;}.cm-s-rubyblue .CodeMirror-guttermarker {color: white;}.cm-s-rubyblue .CodeMirror-guttermarker-subtle {color: #3E7087;}.cm-s-rubyblue .CodeMirror-linenumber {color: white;}.cm-s-rubyblue .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-rubyblue span.cm-comment {color: #999;font-style: italic;line-height: 1em;}.cm-s-rubyblue span.cm-atom {color: #F4C20B;}.cm-s-rubyblue span.cm-number,.cm-s-rubyblue span.cm-attribute {color: #82C6E0;}.cm-s-rubyblue span.cm-keyword {color: #F0F;}.cm-s-rubyblue span.cm-string {color: #F08047;}.cm-s-rubyblue span.cm-meta {color: #F0F;}.cm-s-rubyblue span.cm-variable-2,.cm-s-rubyblue span.cm-tag {color: #7BD827;}.cm-s-rubyblue span.cm-variable-3,.cm-s-rubyblue span.cm-def {color: white;}.cm-s-rubyblue span.cm-bracket {color: #F0F;}.cm-s-rubyblue span.cm-link {color: #F4C20B;}.cm-s-rubyblue span.CodeMirror-matchingbracket {color: #F0F !important;}.cm-s-rubyblue span.cm-builtin,.cm-s-rubyblue span.cm-special {color: #FF9D00;}.cm-s-rubyblue span.cm-error {color: #AF2018;}.cm-s-rubyblue .CodeMirror-activeline-background {background: #173047;}/*
|
1764 |
+
|
1765 |
+
Name: seti
|
1766 |
+
Author: Michael Kaminsky (http://github.com/mkaminsky11)
|
1767 |
+
|
1768 |
+
Original seti color scheme by Jesse Weed (https://github.com/jesseweed/seti-syntax)
|
1769 |
+
|
1770 |
+
*/.cm-s-seti.CodeMirror {background-color: #151718 !important;color: #CFD2D1 !important;border: none;}.cm-s-seti .CodeMirror-gutters {color: #404b53;background-color: #0E1112;border: none;}.cm-s-seti .CodeMirror-cursor {border-left: solid thin #f8f8f0;}.cm-s-seti .CodeMirror-linenumber {color: #6D8A88;}.cm-s-seti.CodeMirror-focused div.CodeMirror-selected {background: rgba(255, 255, 255, 0.1);}.cm-s-seti .CodeMirror-line::-moz-selection,.cm-s-seti .CodeMirror-line > span::-moz-selection,.cm-s-seti .CodeMirror-line > span > span::-moz-selection {background: rgba(255, 255, 255, 0.1);}.cm-s-seti .CodeMirror-line::selection,.cm-s-seti .CodeMirror-line > span::selection,.cm-s-seti .CodeMirror-line > span > span::selection {background: rgba(255, 255, 255, 0.1);}.cm-s-seti .CodeMirror-line::-moz-selection,.cm-s-seti .CodeMirror-line > span::-moz-selection,.cm-s-seti .CodeMirror-line > span > span::-moz-selection {background: rgba(255, 255, 255, 0.1);}.cm-s-seti span.cm-comment {color: #41535b;}.cm-s-seti span.cm-string,.cm-s-seti span.cm-string-2 {color: #55b5db;}.cm-s-seti span.cm-number {color: #cd3f45;}.cm-s-seti span.cm-variable {color: #55b5db;}.cm-s-seti span.cm-variable-2 {color: #a074c4;}.cm-s-seti span.cm-def {color: #55b5db;}.cm-s-seti span.cm-keyword {color: #ff79c6;}.cm-s-seti span.cm-operator {color: #9fca56;}.cm-s-seti span.cm-keyword {color: #e6cd69;}.cm-s-seti span.cm-atom {color: #cd3f45;}.cm-s-seti span.cm-meta {color: #55b5db;}.cm-s-seti span.cm-tag {color: #55b5db;}.cm-s-seti span.cm-attribute {color: #9fca56;}.cm-s-seti span.cm-qualifier {color: #9fca56;}.cm-s-seti span.cm-property {color: #a074c4;}.cm-s-seti span.cm-variable-3 {color: #9fca56;}.cm-s-seti span.cm-builtin {color: #9fca56;}.cm-s-seti .CodeMirror-activeline-background {background: #101213;}.cm-s-seti .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}/*
|
1771 |
+
Solarized theme for code-mirror
|
1772 |
+
http://ethanschoonover.com/solarized
|
1773 |
+
*//*
|
1774 |
+
Solarized color palette
|
1775 |
+
http://ethanschoonover.com/solarized/img/solarized-palette.png
|
1776 |
+
*/.solarized.base03 {color: #002b36;}.solarized.base02 {color: #073642;}.solarized.base01 {color: #586e75;}.solarized.base00 {color: #657b83;}.solarized.base0 {color: #839496;}.solarized.base1 {color: #93a1a1;}.solarized.base2 {color: #eee8d5;}.solarized.base3 {color: #fdf6e3;}.solarized.solar-yellow {color: #b58900;}.solarized.solar-orange {color: #cb4b16;}.solarized.solar-red {color: #dc322f;}.solarized.solar-magenta {color: #d33682;}.solarized.solar-violet {color: #6c71c4;}.solarized.solar-blue {color: #268bd2;}.solarized.solar-cyan {color: #2aa198;}.solarized.solar-green {color: #859900;}/* Color scheme for code-mirror */.cm-s-solarized {line-height: 1.45em;color-profile: sRGB;rendering-intent: auto;}.cm-s-solarized.cm-s-dark {color: #839496;background-color: #002b36;text-shadow: #002b36 0 1px;}.cm-s-solarized.cm-s-light {background-color: #fdf6e3;color: #657b83;text-shadow: #eee8d5 0 1px;}.cm-s-solarized .CodeMirror-widget {text-shadow: none;}.cm-s-solarized .cm-header {color: #586e75;}.cm-s-solarized .cm-quote {color: #93a1a1;}.cm-s-solarized .cm-keyword {color: #cb4b16;}.cm-s-solarized .cm-atom {color: #d33682;}.cm-s-solarized .cm-number {color: #d33682;}.cm-s-solarized .cm-def {color: #2aa198;}.cm-s-solarized .cm-variable {color: #839496;}.cm-s-solarized .cm-variable-2 {color: #b58900;}.cm-s-solarized .cm-variable-3 {color: #6c71c4;}.cm-s-solarized .cm-property {color: #2aa198;}.cm-s-solarized .cm-operator {color: #6c71c4;}.cm-s-solarized .cm-comment {color: #586e75;font-style: italic;}.cm-s-solarized .cm-string {color: #859900;}.cm-s-solarized .cm-string-2 {color: #b58900;}.cm-s-solarized .cm-meta {color: #859900;}.cm-s-solarized .cm-qualifier {color: #b58900;}.cm-s-solarized .cm-builtin {color: #d33682;}.cm-s-solarized .cm-bracket {color: #cb4b16;}.cm-s-solarized .CodeMirror-matchingbracket {color: #859900;}.cm-s-solarized .CodeMirror-nonmatchingbracket {color: #dc322f;}.cm-s-solarized .cm-tag {color: #93a1a1;}.cm-s-solarized .cm-attribute {color: #2aa198;}.cm-s-solarized .cm-hr {color: transparent;border-top: 1px solid #586e75;display: block;}.cm-s-solarized .cm-link {color: #93a1a1;cursor: pointer;}.cm-s-solarized .cm-special {color: #6c71c4;}.cm-s-solarized .cm-em {color: #999;text-decoration: underline;-webkit-text-decoration-style: dotted;text-decoration-style: dotted;}.cm-s-solarized .cm-strong {color: #eee;}.cm-s-solarized .cm-error,.cm-s-solarized .cm-invalidchar {color: #586e75;border-bottom: 1px dotted #dc322f;}.cm-s-solarized.cm-s-dark div.CodeMirror-selected {background: #073642;}.cm-s-solarized.cm-s-dark.CodeMirror ::-moz-selection {background: rgba(7, 54, 66, 0.99);}.cm-s-solarized.cm-s-dark.CodeMirror ::selection {background: rgba(7, 54, 66, 0.99);}.cm-s-solarized.cm-s-dark .CodeMirror-line::-moz-selection,.cm-s-dark .CodeMirror-line > span::-moz-selection,.cm-s-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(7, 54, 66, 0.99);}.cm-s-solarized.cm-s-light div.CodeMirror-selected {background: #eee8d5;}.cm-s-solarized.cm-s-light .CodeMirror-line::-moz-selection,.cm-s-light .CodeMirror-line > span::-moz-selection,.cm-s-light .CodeMirror-line > span > span::-moz-selection {background: #eee8d5;}.cm-s-solarized.cm-s-light .CodeMirror-line::selection,.cm-s-light .CodeMirror-line > span::selection,.cm-s-light .CodeMirror-line > span > span::selection {background: #eee8d5;}.cm-s-solarized.cm-s-light .CodeMirror-line::-moz-selection,.cm-s-ligh .CodeMirror-line > span::-moz-selection,.cm-s-ligh .CodeMirror-line > span > span::-moz-selection {background: #eee8d5;}/* Editor styling *//* Little shadow on the view-port of the buffer view */.cm-s-solarized.CodeMirror {box-shadow: inset 7px 0 12px -6px #000;}/* Remove gutter border */.cm-s-solarized .CodeMirror-gutters {border-right: 0;}/* Gutter colors and line number styling based of color scheme (dark / light) *//* Dark */.cm-s-solarized.cm-s-dark .CodeMirror-gutters {background-color: #073642;}.cm-s-solarized.cm-s-dark .CodeMirror-linenumber {color: #586e75;text-shadow: #021014 0 -1px;}/* Light */.cm-s-solarized.cm-s-light .CodeMirror-gutters {background-color: #eee8d5;}.cm-s-solarized.cm-s-light .CodeMirror-linenumber {color: #839496;}/* Common */.cm-s-solarized .CodeMirror-linenumber {padding: 0 5px;}.cm-s-solarized .CodeMirror-guttermarker-subtle {color: #586e75;}.cm-s-solarized.cm-s-dark .CodeMirror-guttermarker {color: #ddd;}.cm-s-solarized.cm-s-light .CodeMirror-guttermarker {color: #cb4b16;}.cm-s-solarized .CodeMirror-gutter .CodeMirror-gutter-text {color: #586e75;}/* Cursor */.cm-s-solarized .CodeMirror-cursor {border-left: 1px solid #819090;}/* Fat cursor */.cm-s-solarized.cm-s-light.cm-fat-cursor .CodeMirror-cursor {background: #77ee77;}.cm-s-solarized.cm-s-light .cm-animate-fat-cursor {background-color: #77ee77;}.cm-s-solarized.cm-s-dark.cm-fat-cursor .CodeMirror-cursor {background: #586e75;}.cm-s-solarized.cm-s-dark .cm-animate-fat-cursor {background-color: #586e75;}/* Active line */.cm-s-solarized.cm-s-dark .CodeMirror-activeline-background {background: rgba(255, 255, 255, 0.06);}.cm-s-solarized.cm-s-light .CodeMirror-activeline-background {background: rgba(0, 0, 0, 0.06);}.cm-s-the-matrix.CodeMirror {background: #000000;color: #00FF00;}.cm-s-the-matrix div.CodeMirror-selected {background: #2D2D2D;}.cm-s-the-matrix .CodeMirror-line::-moz-selection,.cm-s-the-matrix .CodeMirror-line > span::-moz-selection,.cm-s-the-matrix .CodeMirror-line > span > span::-moz-selection {background: rgba(45, 45, 45, 0.99);}.cm-s-the-matrix .CodeMirror-line::selection,.cm-s-the-matrix .CodeMirror-line > span::selection,.cm-s-the-matrix .CodeMirror-line > span > span::selection {background: rgba(45, 45, 45, 0.99);}.cm-s-the-matrix .CodeMirror-line::-moz-selection,.cm-s-the-matrix .CodeMirror-line > span::-moz-selection,.cm-s-the-matrix .CodeMirror-line > span > span::-moz-selection {background: rgba(45, 45, 45, 0.99);}.cm-s-the-matrix .CodeMirror-gutters {background: #060;border-right: 2px solid #00FF00;}.cm-s-the-matrix .CodeMirror-guttermarker {color: #0f0;}.cm-s-the-matrix .CodeMirror-guttermarker-subtle {color: white;}.cm-s-the-matrix .CodeMirror-linenumber {color: #FFFFFF;}.cm-s-the-matrix .CodeMirror-cursor {border-left: 1px solid #00FF00;}.cm-s-the-matrix span.cm-keyword {color: #008803;font-weight: bold;}.cm-s-the-matrix span.cm-atom {color: #3FF;}.cm-s-the-matrix span.cm-number {color: #FFB94F;}.cm-s-the-matrix span.cm-def {color: #99C;}.cm-s-the-matrix span.cm-variable {color: #F6C;}.cm-s-the-matrix span.cm-variable-2 {color: #C6F;}.cm-s-the-matrix span.cm-variable-3 {color: #96F;}.cm-s-the-matrix span.cm-property {color: #62FFA0;}.cm-s-the-matrix span.cm-operator {color: #999;}.cm-s-the-matrix span.cm-comment {color: #CCCCCC;}.cm-s-the-matrix span.cm-string {color: #39C;}.cm-s-the-matrix span.cm-meta {color: #C9F;}.cm-s-the-matrix span.cm-qualifier {color: #FFF700;}.cm-s-the-matrix span.cm-builtin {color: #30a;}.cm-s-the-matrix span.cm-bracket {color: #cc7;}.cm-s-the-matrix span.cm-tag {color: #FFBD40;}.cm-s-the-matrix span.cm-attribute {color: #FFF700;}.cm-s-the-matrix span.cm-error {color: #FF0000;}.cm-s-the-matrix .CodeMirror-activeline-background {background: #040;}/*
|
1777 |
+
|
1778 |
+
Name: Tomorrow Night - Bright
|
1779 |
+
Author: Chris Kempson
|
1780 |
+
|
1781 |
+
Port done by Gerard Braad <me@gbraad.nl>
|
1782 |
+
|
1783 |
+
*/.cm-s-tomorrow-night-bright.CodeMirror {background: #000000;color: #eaeaea;}.cm-s-tomorrow-night-bright div.CodeMirror-selected {background: #424242;}.cm-s-tomorrow-night-bright .CodeMirror-gutters {background: #000000;border-right: 0px;}.cm-s-tomorrow-night-bright .CodeMirror-guttermarker {color: #e78c45;}.cm-s-tomorrow-night-bright .CodeMirror-guttermarker-subtle {color: #777;}.cm-s-tomorrow-night-bright .CodeMirror-linenumber {color: #424242;}.cm-s-tomorrow-night-bright .CodeMirror-cursor {border-left: 1px solid #6A6A6A;}.cm-s-tomorrow-night-bright span.cm-comment {color: #d27b53;}.cm-s-tomorrow-night-bright span.cm-atom {color: #a16a94;}.cm-s-tomorrow-night-bright span.cm-number {color: #a16a94;}.cm-s-tomorrow-night-bright span.cm-property,.cm-s-tomorrow-night-bright span.cm-attribute {color: #99cc99;}.cm-s-tomorrow-night-bright span.cm-keyword {color: #d54e53;}.cm-s-tomorrow-night-bright span.cm-string {color: #e7c547;}.cm-s-tomorrow-night-bright span.cm-variable {color: #b9ca4a;}.cm-s-tomorrow-night-bright span.cm-variable-2 {color: #7aa6da;}.cm-s-tomorrow-night-bright span.cm-def {color: #e78c45;}.cm-s-tomorrow-night-bright span.cm-bracket {color: #eaeaea;}.cm-s-tomorrow-night-bright span.cm-tag {color: #d54e53;}.cm-s-tomorrow-night-bright span.cm-link {color: #a16a94;}.cm-s-tomorrow-night-bright span.cm-error {background: #d54e53;color: #6A6A6A;}.cm-s-tomorrow-night-bright .CodeMirror-activeline-background {background: #2a2a2a;}.cm-s-tomorrow-night-bright .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}/*
|
1784 |
+
|
1785 |
+
Name: Tomorrow Night - Eighties
|
1786 |
+
Author: Chris Kempson
|
1787 |
+
|
1788 |
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
1789 |
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
1790 |
+
|
1791 |
+
*/.cm-s-tomorrow-night-eighties.CodeMirror {background: #000000;color: #CCCCCC;}.cm-s-tomorrow-night-eighties div.CodeMirror-selected {background: #2D2D2D;}.cm-s-tomorrow-night-eighties .CodeMirror-line::-moz-selection,.cm-s-tomorrow-night-eighties .CodeMirror-line > span::-moz-selection,.cm-s-tomorrow-night-eighties .CodeMirror-line > span > span::-moz-selection {background: rgba(45, 45, 45, 0.99);}.cm-s-tomorrow-night-eighties .CodeMirror-line::selection,.cm-s-tomorrow-night-eighties .CodeMirror-line > span::selection,.cm-s-tomorrow-night-eighties .CodeMirror-line > span > span::selection {background: rgba(45, 45, 45, 0.99);}.cm-s-tomorrow-night-eighties .CodeMirror-line::-moz-selection,.cm-s-tomorrow-night-eighties .CodeMirror-line > span::-moz-selection,.cm-s-tomorrow-night-eighties .CodeMirror-line > span > span::-moz-selection {background: rgba(45, 45, 45, 0.99);}.cm-s-tomorrow-night-eighties .CodeMirror-gutters {background: #000000;border-right: 0px;}.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker {color: #f2777a;}.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker-subtle {color: #777;}.cm-s-tomorrow-night-eighties .CodeMirror-linenumber {color: #515151;}.cm-s-tomorrow-night-eighties .CodeMirror-cursor {border-left: 1px solid #6A6A6A;}.cm-s-tomorrow-night-eighties span.cm-comment {color: #d27b53;}.cm-s-tomorrow-night-eighties span.cm-atom {color: #a16a94;}.cm-s-tomorrow-night-eighties span.cm-number {color: #a16a94;}.cm-s-tomorrow-night-eighties span.cm-property,.cm-s-tomorrow-night-eighties span.cm-attribute {color: #99cc99;}.cm-s-tomorrow-night-eighties span.cm-keyword {color: #f2777a;}.cm-s-tomorrow-night-eighties span.cm-string {color: #ffcc66;}.cm-s-tomorrow-night-eighties span.cm-variable {color: #99cc99;}.cm-s-tomorrow-night-eighties span.cm-variable-2 {color: #6699cc;}.cm-s-tomorrow-night-eighties span.cm-def {color: #f99157;}.cm-s-tomorrow-night-eighties span.cm-bracket {color: #CCCCCC;}.cm-s-tomorrow-night-eighties span.cm-tag {color: #f2777a;}.cm-s-tomorrow-night-eighties span.cm-link {color: #a16a94;}.cm-s-tomorrow-night-eighties span.cm-error {background: #f2777a;color: #6A6A6A;}.cm-s-tomorrow-night-eighties .CodeMirror-activeline-background {background: #343600;}.cm-s-tomorrow-night-eighties .CodeMirror-matchingbracket {text-decoration: underline;color: white !important;}.cm-s-ttcn .cm-quote {color: #090;}.cm-s-ttcn .cm-negative {color: #d44;}.cm-s-ttcn .cm-positive {color: #292;}.cm-s-ttcn .cm-header,.cm-strong {font-weight: bold;}.cm-s-ttcn .cm-em {font-style: italic;}.cm-s-ttcn .cm-link {text-decoration: underline;}.cm-s-ttcn .cm-strikethrough {text-decoration: line-through;}.cm-s-ttcn .cm-header {color: #00f;font-weight: bold;}.cm-s-ttcn .cm-atom {color: #219;}.cm-s-ttcn .cm-attribute {color: #00c;}.cm-s-ttcn .cm-bracket {color: #997;}.cm-s-ttcn .cm-comment {color: #333333;}.cm-s-ttcn .cm-def {color: #00f;}.cm-s-ttcn .cm-em {font-style: italic;}.cm-s-ttcn .cm-error {color: #f00;}.cm-s-ttcn .cm-hr {color: #999;}.cm-s-ttcn .cm-invalidchar {color: #f00;}.cm-s-ttcn .cm-keyword {font-weight: bold;}.cm-s-ttcn .cm-link {color: #00c;text-decoration: underline;}.cm-s-ttcn .cm-meta {color: #555;}.cm-s-ttcn .cm-negative {color: #d44;}.cm-s-ttcn .cm-positive {color: #292;}.cm-s-ttcn .cm-qualifier {color: #555;}.cm-s-ttcn .cm-strikethrough {text-decoration: line-through;}.cm-s-ttcn .cm-string {color: #006400;}.cm-s-ttcn .cm-string-2 {color: #f50;}.cm-s-ttcn .cm-strong {font-weight: bold;}.cm-s-ttcn .cm-tag {color: #170;}.cm-s-ttcn .cm-variable {color: #8B2252;}.cm-s-ttcn .cm-variable-2 {color: #05a;}.cm-s-ttcn .cm-variable-3 {color: #085;}.cm-s-ttcn .cm-invalidchar {color: #f00;}/* ASN */.cm-s-ttcn .cm-accessTypes,.cm-s-ttcn .cm-compareTypes {color: #27408B;}.cm-s-ttcn .cm-cmipVerbs {color: #8B2252;}.cm-s-ttcn .cm-modifier {color: #D2691E;}.cm-s-ttcn .cm-status {color: #8B4545;}.cm-s-ttcn .cm-storage {color: #A020F0;}.cm-s-ttcn .cm-tags {color: #006400;}/* CFG */.cm-s-ttcn .cm-externalCommands {color: #8B4545;font-weight: bold;}.cm-s-ttcn .cm-fileNCtrlMaskOptions,.cm-s-ttcn .cm-sectionTitle {color: #2E8B57;font-weight: bold;}/* TTCN */.cm-s-ttcn .cm-booleanConsts,.cm-s-ttcn .cm-otherConsts,.cm-s-ttcn .cm-verdictConsts {color: #006400;}.cm-s-ttcn .cm-configOps,.cm-s-ttcn .cm-functionOps,.cm-s-ttcn .cm-portOps,.cm-s-ttcn .cm-sutOps,.cm-s-ttcn .cm-timerOps,.cm-s-ttcn .cm-verdictOps {color: #0000FF;}.cm-s-ttcn .cm-preprocessor,.cm-s-ttcn .cm-templateMatch,.cm-s-ttcn .cm-ttcn3Macros {color: #27408B;}.cm-s-ttcn .cm-types {color: #A52A2A;font-weight: bold;}.cm-s-ttcn .cm-visibilityModifiers {font-weight: bold;}.cm-s-twilight.CodeMirror {background: #141414;color: #f7f7f7;}/**/.cm-s-twilight div.CodeMirror-selected {background: #323232;}/**/.cm-s-twilight .CodeMirror-line::-moz-selection,.cm-s-twilight .CodeMirror-line > span::-moz-selection,.cm-s-twilight .CodeMirror-line > span > span::-moz-selection {background: rgba(50, 50, 50, 0.99);}.cm-s-twilight .CodeMirror-line::selection,.cm-s-twilight .CodeMirror-line > span::selection,.cm-s-twilight .CodeMirror-line > span > span::selection {background: rgba(50, 50, 50, 0.99);}.cm-s-twilight .CodeMirror-line::-moz-selection,.cm-s-twilight .CodeMirror-line > span::-moz-selection,.cm-s-twilight .CodeMirror-line > span > span::-moz-selection {background: rgba(50, 50, 50, 0.99);}.cm-s-twilight .CodeMirror-gutters {background: #222;border-right: 1px solid #aaa;}.cm-s-twilight .CodeMirror-guttermarker {color: white;}.cm-s-twilight .CodeMirror-guttermarker-subtle {color: #aaa;}.cm-s-twilight .CodeMirror-linenumber {color: #aaa;}.cm-s-twilight .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-twilight .cm-keyword {color: #f9ee98;}/**/.cm-s-twilight .cm-atom {color: #FC0;}.cm-s-twilight .cm-number {color: #ca7841;}/**/.cm-s-twilight .cm-def {color: #8DA6CE;}.cm-s-twilight span.cm-variable-2,.cm-s-twilight span.cm-tag {color: #607392;}/**/.cm-s-twilight span.cm-variable-3,.cm-s-twilight span.cm-def {color: #607392;}/**/.cm-s-twilight .cm-operator {color: #cda869;}/**/.cm-s-twilight .cm-comment {color: #777;font-style: italic;font-weight: normal;}/**/.cm-s-twilight .cm-string {color: #8f9d6a;font-style: italic;}/**/.cm-s-twilight .cm-string-2 {color: #bd6b18;}/*?*/.cm-s-twilight .cm-meta {background-color: #141414;color: #f7f7f7;}/*?*/.cm-s-twilight .cm-builtin {color: #cda869;}/*?*/.cm-s-twilight .cm-tag {color: #997643;}/**/.cm-s-twilight .cm-attribute {color: #d6bb6d;}/*?*/.cm-s-twilight .cm-header {color: #FF6400;}.cm-s-twilight .cm-hr {color: #AEAEAE;}.cm-s-twilight .cm-link {color: #ad9361;font-style: italic;text-decoration: none;}/**/.cm-s-twilight .cm-error {border-bottom: 1px solid red;}.cm-s-twilight .CodeMirror-activeline-background {background: #27282E;}.cm-s-twilight .CodeMirror-matchingbracket {outline: 1px solid grey;color: white !important;}/* Taken from the popular Visual Studio Vibrant Ink Schema */.cm-s-vibrant-ink.CodeMirror {background: black;color: white;}.cm-s-vibrant-ink div.CodeMirror-selected {background: #35493c;}.cm-s-vibrant-ink .CodeMirror-line::-moz-selection,.cm-s-vibrant-ink .CodeMirror-line > span::-moz-selection,.cm-s-vibrant-ink .CodeMirror-line > span > span::-moz-selection {background: rgba(53, 73, 60, 0.99);}.cm-s-vibrant-ink .CodeMirror-line::selection,.cm-s-vibrant-ink .CodeMirror-line > span::selection,.cm-s-vibrant-ink .CodeMirror-line > span > span::selection {background: rgba(53, 73, 60, 0.99);}.cm-s-vibrant-ink .CodeMirror-line::-moz-selection,.cm-s-vibrant-ink .CodeMirror-line > span::-moz-selection,.cm-s-vibrant-ink .CodeMirror-line > span > span::-moz-selection {background: rgba(53, 73, 60, 0.99);}.cm-s-vibrant-ink .CodeMirror-gutters {background: #002240;border-right: 1px solid #aaa;}.cm-s-vibrant-ink .CodeMirror-guttermarker {color: white;}.cm-s-vibrant-ink .CodeMirror-guttermarker-subtle {color: #d0d0d0;}.cm-s-vibrant-ink .CodeMirror-linenumber {color: #d0d0d0;}.cm-s-vibrant-ink .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-vibrant-ink .cm-keyword {color: #CC7832;}.cm-s-vibrant-ink .cm-atom {color: #FC0;}.cm-s-vibrant-ink .cm-number {color: #FFEE98;}.cm-s-vibrant-ink .cm-def {color: #8DA6CE;}.cm-s-vibrant-ink span.cm-variable-2,.cm-s-vibrant span.cm-tag {color: #FFC66D;}.cm-s-vibrant-ink span.cm-variable-3,.cm-s-vibrant span.cm-def {color: #FFC66D;}.cm-s-vibrant-ink .cm-operator {color: #888;}.cm-s-vibrant-ink .cm-comment {color: gray;font-weight: bold;}.cm-s-vibrant-ink .cm-string {color: #A5C25C;}.cm-s-vibrant-ink .cm-string-2 {color: red;}.cm-s-vibrant-ink .cm-meta {color: #D8FA3C;}.cm-s-vibrant-ink .cm-builtin {color: #8DA6CE;}.cm-s-vibrant-ink .cm-tag {color: #8DA6CE;}.cm-s-vibrant-ink .cm-attribute {color: #8DA6CE;}.cm-s-vibrant-ink .cm-header {color: #FF6400;}.cm-s-vibrant-ink .cm-hr {color: #AEAEAE;}.cm-s-vibrant-ink .cm-link {color: blue;}.cm-s-vibrant-ink .cm-error {border-bottom: 1px solid red;}.cm-s-vibrant-ink .CodeMirror-activeline-background {background: #27282E;}.cm-s-vibrant-ink .CodeMirror-matchingbracket {outline: 1px solid grey;color: white !important;}/*
|
1792 |
+
Copyright (C) 2011 by MarkLogic Corporation
|
1793 |
+
Author: Mike Brevoort <mike@brevoort.com>
|
1794 |
+
|
1795 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
1796 |
+
of this software and associated documentation files (the "Software"), to deal
|
1797 |
+
in the Software without restriction, including without limitation the rights
|
1798 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
1799 |
+
copies of the Software, and to permit persons to whom the Software is
|
1800 |
+
furnished to do so, subject to the following conditions:
|
1801 |
+
|
1802 |
+
The above copyright notice and this permission notice shall be included in
|
1803 |
+
all copies or substantial portions of the Software.
|
1804 |
+
|
1805 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
1806 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
1807 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1808 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
1809 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
1810 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
1811 |
+
THE SOFTWARE.
|
1812 |
+
*/.cm-s-xq-dark.CodeMirror {background: #0a001f;color: #f8f8f8;}.cm-s-xq-dark div.CodeMirror-selected {background: #27007A;}.cm-s-xq-dark .CodeMirror-line::-moz-selection,.cm-s-xq-dark .CodeMirror-line > span::-moz-selection,.cm-s-xq-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(39, 0, 122, 0.99);}.cm-s-xq-dark .CodeMirror-line::selection,.cm-s-xq-dark .CodeMirror-line > span::selection,.cm-s-xq-dark .CodeMirror-line > span > span::selection {background: rgba(39, 0, 122, 0.99);}.cm-s-xq-dark .CodeMirror-line::-moz-selection,.cm-s-xq-dark .CodeMirror-line > span::-moz-selection,.cm-s-xq-dark .CodeMirror-line > span > span::-moz-selection {background: rgba(39, 0, 122, 0.99);}.cm-s-xq-dark .CodeMirror-gutters {background: #0a001f;border-right: 1px solid #aaa;}.cm-s-xq-dark .CodeMirror-guttermarker {color: #FFBD40;}.cm-s-xq-dark .CodeMirror-guttermarker-subtle {color: #f8f8f8;}.cm-s-xq-dark .CodeMirror-linenumber {color: #f8f8f8;}.cm-s-xq-dark .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-xq-dark span.cm-keyword {color: #FFBD40;}.cm-s-xq-dark span.cm-atom {color: #6C8CD5;}.cm-s-xq-dark span.cm-number {color: #164;}.cm-s-xq-dark span.cm-def {color: #FFF;text-decoration: underline;}.cm-s-xq-dark span.cm-variable {color: #FFF;}.cm-s-xq-dark span.cm-variable-2 {color: #EEE;}.cm-s-xq-dark span.cm-variable-3 {color: #DDD;}.cm-s-xq-dark span.cm-comment {color: gray;}.cm-s-xq-dark span.cm-string {color: #9FEE00;}.cm-s-xq-dark span.cm-meta {color: yellow;}.cm-s-xq-dark span.cm-qualifier {color: #FFF700;}.cm-s-xq-dark span.cm-builtin {color: #30a;}.cm-s-xq-dark span.cm-bracket {color: #cc7;}.cm-s-xq-dark span.cm-tag {color: #FFBD40;}.cm-s-xq-dark span.cm-attribute {color: #FFF700;}.cm-s-xq-dark span.cm-error {color: #f00;}.cm-s-xq-dark .CodeMirror-activeline-background {background: #27282E;}.cm-s-xq-dark .CodeMirror-matchingbracket {outline: 1px solid grey;color: white !important;}/*
|
1813 |
+
Copyright (C) 2011 by MarkLogic Corporation
|
1814 |
+
Author: Mike Brevoort <mike@brevoort.com>
|
1815 |
+
|
1816 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
1817 |
+
of this software and associated documentation files (the "Software"), to deal
|
1818 |
+
in the Software without restriction, including without limitation the rights
|
1819 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
1820 |
+
copies of the Software, and to permit persons to whom the Software is
|
1821 |
+
furnished to do so, subject to the following conditions:
|
1822 |
+
|
1823 |
+
The above copyright notice and this permission notice shall be included in
|
1824 |
+
all copies or substantial portions of the Software.
|
1825 |
+
|
1826 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
1827 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
1828 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1829 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
1830 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
1831 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
1832 |
+
THE SOFTWARE.
|
1833 |
+
*/.cm-s-xq-light span.cm-keyword {line-height: 1em;font-weight: bold;color: #5A5CAD;}.cm-s-xq-light span.cm-atom {color: #6C8CD5;}.cm-s-xq-light span.cm-number {color: #164;}.cm-s-xq-light span.cm-def {text-decoration: underline;}.cm-s-xq-light span.cm-variable {color: black;}.cm-s-xq-light span.cm-variable-2 {color: black;}.cm-s-xq-light span.cm-variable-3 {color: black;}.cm-s-xq-light span.cm-comment {color: #0080FF;font-style: italic;}.cm-s-xq-light span.cm-string {color: red;}.cm-s-xq-light span.cm-meta {color: yellow;}.cm-s-xq-light span.cm-qualifier {color: grey;}.cm-s-xq-light span.cm-builtin {color: #7EA656;}.cm-s-xq-light span.cm-bracket {color: #cc7;}.cm-s-xq-light span.cm-tag {color: #3F7F7F;}.cm-s-xq-light span.cm-attribute {color: #7F007F;}.cm-s-xq-light span.cm-error {color: #f00;}.cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff;}.cm-s-xq-light .CodeMirror-matchingbracket {outline: 1px solid grey;color: black !important;background: yellow;}/*
|
1834 |
+
|
1835 |
+
Name: yeti
|
1836 |
+
Author: Michael Kaminsky (http://github.com/mkaminsky11)
|
1837 |
+
|
1838 |
+
Original yeti color scheme by Jesse Weed (https://github.com/jesseweed/yeti-syntax)
|
1839 |
+
|
1840 |
+
*/.cm-s-yeti.CodeMirror {background-color: #ECEAE8 !important;color: #d1c9c0 !important;border: none;}.cm-s-yeti .CodeMirror-gutters {color: #adaba6;background-color: #E5E1DB;border: none;}.cm-s-yeti .CodeMirror-cursor {border-left: solid thin #d1c9c0;}.cm-s-yeti .CodeMirror-linenumber {color: #adaba6;}.cm-s-yeti.CodeMirror-focused div.CodeMirror-selected {background: #DCD8D2;}.cm-s-yeti .CodeMirror-line::-moz-selection,.cm-s-yeti .CodeMirror-line > span::-moz-selection,.cm-s-yeti .CodeMirror-line > span > span::-moz-selection {background: #DCD8D2;}.cm-s-yeti .CodeMirror-line::selection,.cm-s-yeti .CodeMirror-line > span::selection,.cm-s-yeti .CodeMirror-line > span > span::selection {background: #DCD8D2;}.cm-s-yeti .CodeMirror-line::-moz-selection,.cm-s-yeti .CodeMirror-line > span::-moz-selection,.cm-s-yeti .CodeMirror-line > span > span::-moz-selection {background: #DCD8D2;}.cm-s-yeti span.cm-comment {color: #d4c8be;}.cm-s-yeti span.cm-string,.cm-s-yeti span.cm-string-2 {color: #96c0d8;}.cm-s-yeti span.cm-number {color: #a074c4;}.cm-s-yeti span.cm-variable {color: #55b5db;}.cm-s-yeti span.cm-variable-2 {color: #a074c4;}.cm-s-yeti span.cm-def {color: #55b5db;}.cm-s-yeti span.cm-operator {color: #9fb96e;}.cm-s-yeti span.cm-keyword {color: #9fb96e;}.cm-s-yeti span.cm-atom {color: #a074c4;}.cm-s-yeti span.cm-meta {color: #96c0d8;}.cm-s-yeti span.cm-tag {color: #96c0d8;}.cm-s-yeti span.cm-attribute {color: #9fb96e;}.cm-s-yeti span.cm-qualifier {color: #96c0d8;}.cm-s-yeti span.cm-property {color: #a074c4;}.cm-s-yeti span.cm-builtin {color: #a074c4;}.cm-s-yeti span.cm-variable-3 {color: #96c0d8;}.cm-s-yeti .CodeMirror-activeline-background {background: #E7E4E0;}.cm-s-yeti .CodeMirror-matchingbracket {text-decoration: underline;}/**
|
1841 |
+
* "
|
1842 |
+
* Using Zenburn color palette from the Emacs Zenburn Theme
|
1843 |
+
* https://github.com/bbatsov/zenburn-emacs/blob/master/zenburn-theme.el
|
1844 |
+
*
|
1845 |
+
* Also using parts of https://github.com/xavi/coderay-lighttable-theme
|
1846 |
+
* "
|
1847 |
+
* From: https://github.com/wisenomad/zenburn-lighttable-theme/blob/master/zenburn.css
|
1848 |
+
*/.cm-s-zenburn .CodeMirror-gutters {background: #3f3f3f !important;}.cm-s-zenburn .CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded {color: #999;}.cm-s-zenburn .CodeMirror-cursor {border-left: 1px solid white;}.cm-s-zenburn {background-color: #3f3f3f;color: #dcdccc;}.cm-s-zenburn span.cm-builtin {color: #dcdccc;font-weight: bold;}.cm-s-zenburn span.cm-comment {color: #7f9f7f;}.cm-s-zenburn span.cm-keyword {color: #f0dfaf;font-weight: bold;}.cm-s-zenburn span.cm-atom {color: #bfebbf;}.cm-s-zenburn span.cm-def {color: #dcdccc;}.cm-s-zenburn span.cm-variable {color: #dfaf8f;}.cm-s-zenburn span.cm-variable-2 {color: #dcdccc;}.cm-s-zenburn span.cm-string {color: #cc9393;}.cm-s-zenburn span.cm-string-2 {color: #cc9393;}.cm-s-zenburn span.cm-number {color: #dcdccc;}.cm-s-zenburn span.cm-tag {color: #93e0e3;}.cm-s-zenburn span.cm-property {color: #dfaf8f;}.cm-s-zenburn span.cm-attribute {color: #dfaf8f;}.cm-s-zenburn span.cm-qualifier {color: #7cb8bb;}.cm-s-zenburn span.cm-meta {color: #f0dfaf;}.cm-s-zenburn span.cm-header {color: #f0efd0;}.cm-s-zenburn span.cm-operator {color: #f0efd0;}.cm-s-zenburn span.CodeMirror-matchingbracket {box-sizing: border-box;background: transparent;border-bottom: 1px solid;}.cm-s-zenburn span.CodeMirror-nonmatchingbracket {border-bottom: 1px solid;background: none;}.cm-s-zenburn .CodeMirror-activeline {background: #000000;}.cm-s-zenburn .CodeMirror-activeline-background {background: #000000;}.cm-s-zenburn div.CodeMirror-selected {background: #545454;}.cm-s-zenburn .CodeMirror-focused div.CodeMirror-selected {background: #4f4f4f;}.CodeMirror {font: inherit;}.CodeMirror-scroll {font-family: Menlo Regular, Consolas, Monaco, monospace;line-height: 150%;position: relative;}.CodeMirror-settings {color: #444;height: 0;width: 100%;z-index: 9;text-shadow: none;}.CodeMirror-settings__toggle {border-radius: 3px;z-index: 11;box-sizing: border-box;position: absolute;top: 0;right: 0;margin: 6px;display: block;cursor: pointer;}.CodeMirror-settings__toggle:after {content: '\f111';font-family: dashicons;line-height: 1em;display: inline-block;}.CodeMirror-settings__toggle:before {border: 1px solid #ddd;border-radius: 3px;z-index: -1;content: '';background-color: white;transition: 250ms ease;transition-property: transform opacity;position: absolute;top: 0;right: 0;bottom: 0;left: 0;}.CodeMirror-settings__wrapper {pointer-events: none;visibility: hidden;}.CodeMirror-settings__docked,.CodeMirror-settings__body {pointer-events: initial;visibility: visible;}.CodeMirror-settings__wrapper {position: absolute;width: calc(100% - 12px );max-height: calc(100% - 12px );top: 0;margin: 6px;box-sizing: border-box;z-index: 9;display: -ms-flexbox;display: flex;-ms-flex-direction: column;flex-direction: column;}.CodeMirror-settings__docked {-ms-flex: 0 0 auto;flex: 0 0 auto;z-index: 10;background-color: white;box-sizing: border-box;}.CodeMirror-settings__header {border-top-left-radius: 3px;border-top-right-radius: 3px;border: 1px solid #ddd;padding: 4px;border-bottom-left-radius: 3px;border-bottom-right-radius: 3px;}.CodeMirror-settings__body {-ms-flex: 1 1 auto;flex: 1 1 auto;box-sizing: border-box;padding: 1px 12px;overflow-y: auto;background-color: rgba(255, 255, 255, 0.93);border-left: 1px solid #ddd;border-right: 1px solid #ddd;}.CodeMirror-settings__footer {border-bottom-left-radius: 3px;border-bottom-right-radius: 3px;border: 1px solid #ddd;padding: 6px 12px;display: -ms-flexbox;display: flex;-ms-flex-wrap: wrap;flex-wrap: wrap;-ms-flex-align: baseline;align-items: baseline;-ms-flex-line-pack: center;align-content: center;-ms-flex-pack: justify;justify-content: space-between;}td.CodeMirror-settings__heading {padding: 0;}.CodeMirror-settings__foot-content {margin: 0;}.CodeMirror-settings__toggle,.CodeMirror-settings__toggle-advanced,.CodeMirror-settings__header,.CodeMirror-settings__body,.CodeMirror-settings__footer,.CodeMirror-settings__wrapper {transition: 250ms ease;transition-property: opacity, transform;transform-origin: top right;}.CodeMirror-settings.closed .CodeMirror-settings__toggle-advanced:before {content: 'more...';}.CodeMirror-settings.closed .CodeMirror-settings__toggle {opacity: .5;}.CodeMirror-settings.closed .CodeMirror-settings__toggle:hover {opacity: 1;}.CodeMirror-settings.closed .CodeMirror-settings__toggle:before {opacity: 1;}.CodeMirror-settings.closed .CodeMirror-settings__wrapper {opacity: 0;transform: scaleX(0);}.CodeMirror-settings.closed .CodeMirror-settings__body,.CodeMirror-settings.closed .CodeMirror-settings__footer {visibility: hidden;opacity: 0;transform: translate(0, -20px);transition: opacity 250ms ease, transform 250ms ease, visibility 1ms ease 250ms;}.CodeMirror-settings.open .CodeMirror-settings__toggle-advanced:before {content: 'more...';}.CodeMirror-settings.open .CodeMirror-settings__toggle:after {content: '\f158';}.CodeMirror-settings.open .CodeMirror-settings__toggle:before {opacity: 0;}.CodeMirror-settings.open .CodeMirror-settings__wrapper {opacity: 1;transform: scaleX(1);}.CodeMirror-settings.open .CodeMirror-settings__body,.CodeMirror-settings.open .CodeMirror-settings__footer {visibility: hidden;opacity: 0;transform: translate(0, -20px);transition: opacity 250ms ease, transform 250ms ease, visibility 1ms ease 250ms;}.CodeMirror-settings.open-advanced .CodeMirror-settings__toggle-advanced:before {content: 'less';}.CodeMirror-settings.open-advanced .CodeMirror-settings__header {border-bottom-left-radius: 0;border-bottom-right-radius: 0;}.CodeMirror-settings.open-advanced .CodeMirror-settings__body,.CodeMirror-settings.open-advanced .CodeMirror-settings__footer {visibility: visible;opacity: 1;transform: translate(0, 0);transition: visibility 1ms ease, opacity 250ms ease 1ms, transform 250ms ease 1ms;}.CodeMirror-settings__button {position: relative;}.CodeMirror-settings__button:active {transform: none !important;}.CodeMirror-settings__button select,.CodeMirror-settings__button input {display: block;position: absolute;top: 0;right: 0;bottom: 0;left: 0;-webkit-appearance: none;margin: 0;padding: 0;border: none;height: auto;font-size: 0;line-height: 0;height: 100% !important;width: 100% !important;background: none;opacity: 0;}.CodeMirror-settings__button option {font-size: 12px;}.CodeMirror-settings__button--select:after {content: '\f140';font-family: dashicons;vertical-align: top;display: inline-block;margin: 0 -5px -4px;}.CodeMirror-settings__toggle-advanced {cursor: pointer;display: inline-block;line-height: 25px;padding: 0 4px;vertical-align: middle;}.wp-editor-expand .CodeMirror {min-height: 300px;}.CodeMirror-mirrored {display: block !important;position: fixed !important;left: -9999px !important;top: -9999px !important;z-index: -999 !important;opacity: 0 !important;}#template .CodeMirror div {margin-right: initial;}#template .CodeMirror p {width: auto;}.CodeMirror-vscrollbar {display: none !important;}.CodeMirror-scroll {margin-right: -30px !important;}.CodeMirror-settings__toggle {margin-right: 6px !important;}.heshFullscreen {z-index: 99999;position: fixed !important;top: 0;left: 0;right: 0;bottom: 0;height: 100%;background: #fff;padding: 2% 2% 0;}.heshFullscreen .CodeMirror {border: 1px solid #ccc;border-radius: 0 0 4px 4px;height: 85% !important;}.heshFullscreen #ed_toolbar {border: 1px solid #ccc;border-bottom: 0;border-radius: 4px 4px 0 0;}.heshFullscreen #cm_content_fullscreen:before {content: '\f506';}#cm_content_fullscreen {display: inline-block;}.wp-editor-expand #cm_content_fullscreen {display: none;}.hesh-content-resize-handle {position: absolute;right: 0;bottom: 0;width: 12px;height: 12px;z-index: 8;margin: 1px !important;}#ed_toolbar {z-index: 10;}@media screen and (min-width: 782px) {.CodeMirror-settings__toggle {height: 35px;}.CodeMirror-settings__toggle {width: 35px;}.CodeMirror-settings__toggle:after {font-size: 20px;}.CodeMirror-settings__toggle:after {margin: 7px;}.CodeMirror-settings__docked {min-height: 35px;}.CodeMirror-settings__header {padding-right: 35px;}.CodeMirror-settings__button--select:after {font-size: 16px;}.CodeMirror-settings__button--select:after {margin-top: 0;}#template .CodeMirror {margin-right: 20px;}}@media screen and (max-width: 781px) {.CodeMirror-settings__toggle {height: 44px;}.CodeMirror-settings__toggle {width: 44px;}.CodeMirror-settings__toggle:after {font-size: 28px;}.CodeMirror-settings__toggle:after {margin: 8px;}.CodeMirror-settings__docked {min-height: 44px;}.CodeMirror-settings__header {padding-right: 44px;}.CodeMirror-settings__button--select:after {font-size: 20px;}.CodeMirror-settings__button--select:after {margin-top: -2px;}#template .CodeMirror {margin-right: initial;}}@media screen and (max-height: 550px) {.heshFullscreen .CodeMirror {height: 75% !important;}}@media print {/* Hide the cursor when printing */.CodeMirror div.CodeMirror-cursors {visibility: hidden;}}@keyframes blink {50% {background-color: transparent;}}
|
dist/hesh.js
ADDED
@@ -0,0 +1,13697 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3 |
+
|
4 |
+
// This is CodeMirror (http://codemirror.net), a code editor
|
5 |
+
// implemented in JavaScript on top of the browser's DOM.
|
6 |
+
//
|
7 |
+
// You can find some technical background for some of the code below
|
8 |
+
// at http://marijnhaverbeke.nl/blog/#cm-internals .
|
9 |
+
|
10 |
+
(function (global, factory) {
|
11 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
12 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
13 |
+
(global.CodeMirror = factory());
|
14 |
+
}(this, (function () { 'use strict';
|
15 |
+
|
16 |
+
// Kludges for bugs and behavior differences that can't be feature
|
17 |
+
// detected are enabled based on userAgent etc sniffing.
|
18 |
+
var userAgent = navigator.userAgent;
|
19 |
+
var platform = navigator.platform;
|
20 |
+
|
21 |
+
var gecko = /gecko\/\d/i.test(userAgent);
|
22 |
+
var ie_upto10 = /MSIE \d/.test(userAgent);
|
23 |
+
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
|
24 |
+
var edge = /Edge\/(\d+)/.exec(userAgent);
|
25 |
+
var ie = ie_upto10 || ie_11up || edge;
|
26 |
+
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
|
27 |
+
var webkit = !edge && /WebKit\//.test(userAgent);
|
28 |
+
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
|
29 |
+
var chrome = !edge && /Chrome\//.test(userAgent);
|
30 |
+
var presto = /Opera\//.test(userAgent);
|
31 |
+
var safari = /Apple Computer/.test(navigator.vendor);
|
32 |
+
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
|
33 |
+
var phantom = /PhantomJS/.test(userAgent);
|
34 |
+
|
35 |
+
var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
|
36 |
+
var android = /Android/.test(userAgent);
|
37 |
+
// This is woefully incomplete. Suggestions for alternative methods welcome.
|
38 |
+
var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
|
39 |
+
var mac = ios || /Mac/.test(platform);
|
40 |
+
var chromeOS = /\bCrOS\b/.test(userAgent);
|
41 |
+
var windows = /win/i.test(platform);
|
42 |
+
|
43 |
+
var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
|
44 |
+
if (presto_version) { presto_version = Number(presto_version[1]); }
|
45 |
+
if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
|
46 |
+
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
|
47 |
+
var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
|
48 |
+
var captureRightClick = gecko || (ie && ie_version >= 9);
|
49 |
+
|
50 |
+
function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
|
51 |
+
|
52 |
+
var rmClass = function(node, cls) {
|
53 |
+
var current = node.className;
|
54 |
+
var match = classTest(cls).exec(current);
|
55 |
+
if (match) {
|
56 |
+
var after = current.slice(match.index + match[0].length);
|
57 |
+
node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
|
58 |
+
}
|
59 |
+
};
|
60 |
+
|
61 |
+
function removeChildren(e) {
|
62 |
+
for (var count = e.childNodes.length; count > 0; --count)
|
63 |
+
{ e.removeChild(e.firstChild); }
|
64 |
+
return e
|
65 |
+
}
|
66 |
+
|
67 |
+
function removeChildrenAndAdd(parent, e) {
|
68 |
+
return removeChildren(parent).appendChild(e)
|
69 |
+
}
|
70 |
+
|
71 |
+
function elt(tag, content, className, style) {
|
72 |
+
var e = document.createElement(tag);
|
73 |
+
if (className) { e.className = className; }
|
74 |
+
if (style) { e.style.cssText = style; }
|
75 |
+
if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
|
76 |
+
else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
|
77 |
+
return e
|
78 |
+
}
|
79 |
+
// wrapper for elt, which removes the elt from the accessibility tree
|
80 |
+
function eltP(tag, content, className, style) {
|
81 |
+
var e = elt(tag, content, className, style);
|
82 |
+
e.setAttribute("role", "presentation");
|
83 |
+
return e
|
84 |
+
}
|
85 |
+
|
86 |
+
var range;
|
87 |
+
if (document.createRange) { range = function(node, start, end, endNode) {
|
88 |
+
var r = document.createRange();
|
89 |
+
r.setEnd(endNode || node, end);
|
90 |
+
r.setStart(node, start);
|
91 |
+
return r
|
92 |
+
}; }
|
93 |
+
else { range = function(node, start, end) {
|
94 |
+
var r = document.body.createTextRange();
|
95 |
+
try { r.moveToElementText(node.parentNode); }
|
96 |
+
catch(e) { return r }
|
97 |
+
r.collapse(true);
|
98 |
+
r.moveEnd("character", end);
|
99 |
+
r.moveStart("character", start);
|
100 |
+
return r
|
101 |
+
}; }
|
102 |
+
|
103 |
+
function contains(parent, child) {
|
104 |
+
if (child.nodeType == 3) // Android browser always returns false when child is a textnode
|
105 |
+
{ child = child.parentNode; }
|
106 |
+
if (parent.contains)
|
107 |
+
{ return parent.contains(child) }
|
108 |
+
do {
|
109 |
+
if (child.nodeType == 11) { child = child.host; }
|
110 |
+
if (child == parent) { return true }
|
111 |
+
} while (child = child.parentNode)
|
112 |
+
}
|
113 |
+
|
114 |
+
function activeElt() {
|
115 |
+
// IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
|
116 |
+
// IE < 10 will throw when accessed while the page is loading or in an iframe.
|
117 |
+
// IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
|
118 |
+
var activeElement;
|
119 |
+
try {
|
120 |
+
activeElement = document.activeElement;
|
121 |
+
} catch(e) {
|
122 |
+
activeElement = document.body || null;
|
123 |
+
}
|
124 |
+
while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
|
125 |
+
{ activeElement = activeElement.shadowRoot.activeElement; }
|
126 |
+
return activeElement
|
127 |
+
}
|
128 |
+
|
129 |
+
function addClass(node, cls) {
|
130 |
+
var current = node.className;
|
131 |
+
if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
|
132 |
+
}
|
133 |
+
function joinClasses(a, b) {
|
134 |
+
var as = a.split(" ");
|
135 |
+
for (var i = 0; i < as.length; i++)
|
136 |
+
{ if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
|
137 |
+
return b
|
138 |
+
}
|
139 |
+
|
140 |
+
var selectInput = function(node) { node.select(); };
|
141 |
+
if (ios) // Mobile Safari apparently has a bug where select() is broken.
|
142 |
+
{ selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
|
143 |
+
else if (ie) // Suppress mysterious IE10 errors
|
144 |
+
{ selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
|
145 |
+
|
146 |
+
function bind(f) {
|
147 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
148 |
+
return function(){return f.apply(null, args)}
|
149 |
+
}
|
150 |
+
|
151 |
+
function copyObj(obj, target, overwrite) {
|
152 |
+
if (!target) { target = {}; }
|
153 |
+
for (var prop in obj)
|
154 |
+
{ if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
|
155 |
+
{ target[prop] = obj[prop]; } }
|
156 |
+
return target
|
157 |
+
}
|
158 |
+
|
159 |
+
// Counts the column offset in a string, taking tabs into account.
|
160 |
+
// Used mostly to find indentation.
|
161 |
+
function countColumn(string, end, tabSize, startIndex, startValue) {
|
162 |
+
if (end == null) {
|
163 |
+
end = string.search(/[^\s\u00a0]/);
|
164 |
+
if (end == -1) { end = string.length; }
|
165 |
+
}
|
166 |
+
for (var i = startIndex || 0, n = startValue || 0;;) {
|
167 |
+
var nextTab = string.indexOf("\t", i);
|
168 |
+
if (nextTab < 0 || nextTab >= end)
|
169 |
+
{ return n + (end - i) }
|
170 |
+
n += nextTab - i;
|
171 |
+
n += tabSize - (n % tabSize);
|
172 |
+
i = nextTab + 1;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
var Delayed = function() {this.id = null;};
|
177 |
+
Delayed.prototype.set = function (ms, f) {
|
178 |
+
clearTimeout(this.id);
|
179 |
+
this.id = setTimeout(f, ms);
|
180 |
+
};
|
181 |
+
|
182 |
+
function indexOf(array, elt) {
|
183 |
+
for (var i = 0; i < array.length; ++i)
|
184 |
+
{ if (array[i] == elt) { return i } }
|
185 |
+
return -1
|
186 |
+
}
|
187 |
+
|
188 |
+
// Number of pixels added to scroller and sizer to hide scrollbar
|
189 |
+
var scrollerGap = 30;
|
190 |
+
|
191 |
+
// Returned or thrown by various protocols to signal 'I'm not
|
192 |
+
// handling this'.
|
193 |
+
var Pass = {toString: function(){return "CodeMirror.Pass"}};
|
194 |
+
|
195 |
+
// Reused option objects for setSelection & friends
|
196 |
+
var sel_dontScroll = {scroll: false};
|
197 |
+
var sel_mouse = {origin: "*mouse"};
|
198 |
+
var sel_move = {origin: "+move"};
|
199 |
+
|
200 |
+
// The inverse of countColumn -- find the offset that corresponds to
|
201 |
+
// a particular column.
|
202 |
+
function findColumn(string, goal, tabSize) {
|
203 |
+
for (var pos = 0, col = 0;;) {
|
204 |
+
var nextTab = string.indexOf("\t", pos);
|
205 |
+
if (nextTab == -1) { nextTab = string.length; }
|
206 |
+
var skipped = nextTab - pos;
|
207 |
+
if (nextTab == string.length || col + skipped >= goal)
|
208 |
+
{ return pos + Math.min(skipped, goal - col) }
|
209 |
+
col += nextTab - pos;
|
210 |
+
col += tabSize - (col % tabSize);
|
211 |
+
pos = nextTab + 1;
|
212 |
+
if (col >= goal) { return pos }
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
var spaceStrs = [""];
|
217 |
+
function spaceStr(n) {
|
218 |
+
while (spaceStrs.length <= n)
|
219 |
+
{ spaceStrs.push(lst(spaceStrs) + " "); }
|
220 |
+
return spaceStrs[n]
|
221 |
+
}
|
222 |
+
|
223 |
+
function lst(arr) { return arr[arr.length-1] }
|
224 |
+
|
225 |
+
function map(array, f) {
|
226 |
+
var out = [];
|
227 |
+
for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
|
228 |
+
return out
|
229 |
+
}
|
230 |
+
|
231 |
+
function insertSorted(array, value, score) {
|
232 |
+
var pos = 0, priority = score(value);
|
233 |
+
while (pos < array.length && score(array[pos]) <= priority) { pos++; }
|
234 |
+
array.splice(pos, 0, value);
|
235 |
+
}
|
236 |
+
|
237 |
+
function nothing() {}
|
238 |
+
|
239 |
+
function createObj(base, props) {
|
240 |
+
var inst;
|
241 |
+
if (Object.create) {
|
242 |
+
inst = Object.create(base);
|
243 |
+
} else {
|
244 |
+
nothing.prototype = base;
|
245 |
+
inst = new nothing();
|
246 |
+
}
|
247 |
+
if (props) { copyObj(props, inst); }
|
248 |
+
return inst
|
249 |
+
}
|
250 |
+
|
251 |
+
var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
252 |
+
function isWordCharBasic(ch) {
|
253 |
+
return /\w/.test(ch) || ch > "\x80" &&
|
254 |
+
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
|
255 |
+
}
|
256 |
+
function isWordChar(ch, helper) {
|
257 |
+
if (!helper) { return isWordCharBasic(ch) }
|
258 |
+
if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
|
259 |
+
return helper.test(ch)
|
260 |
+
}
|
261 |
+
|
262 |
+
function isEmpty(obj) {
|
263 |
+
for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
|
264 |
+
return true
|
265 |
+
}
|
266 |
+
|
267 |
+
// Extending unicode characters. A series of a non-extending char +
|
268 |
+
// any number of extending chars is treated as a single unit as far
|
269 |
+
// as editing and measuring is concerned. This is not fully correct,
|
270 |
+
// since some scripts/fonts/browsers also treat other configurations
|
271 |
+
// of code points as a group.
|
272 |
+
var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
|
273 |
+
function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
|
274 |
+
|
275 |
+
// Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
|
276 |
+
function skipExtendingChars(str, pos, dir) {
|
277 |
+
while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
|
278 |
+
return pos
|
279 |
+
}
|
280 |
+
|
281 |
+
// Returns the value from the range [`from`; `to`] that satisfies
|
282 |
+
// `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`.
|
283 |
+
function findFirst(pred, from, to) {
|
284 |
+
for (;;) {
|
285 |
+
if (Math.abs(from - to) <= 1) { return pred(from) ? from : to }
|
286 |
+
var mid = Math.floor((from + to) / 2);
|
287 |
+
if (pred(mid)) { to = mid; }
|
288 |
+
else { from = mid; }
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
// The display handles the DOM integration, both for input reading
|
293 |
+
// and content drawing. It holds references to DOM nodes and
|
294 |
+
// display-related state.
|
295 |
+
|
296 |
+
function Display(place, doc, input) {
|
297 |
+
var d = this;
|
298 |
+
this.input = input;
|
299 |
+
|
300 |
+
// Covers bottom-right square when both scrollbars are present.
|
301 |
+
d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
|
302 |
+
d.scrollbarFiller.setAttribute("cm-not-content", "true");
|
303 |
+
// Covers bottom of gutter when coverGutterNextToScrollbar is on
|
304 |
+
// and h scrollbar is present.
|
305 |
+
d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
|
306 |
+
d.gutterFiller.setAttribute("cm-not-content", "true");
|
307 |
+
// Will contain the actual code, positioned to cover the viewport.
|
308 |
+
d.lineDiv = eltP("div", null, "CodeMirror-code");
|
309 |
+
// Elements are added to these to represent selection and cursors.
|
310 |
+
d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
|
311 |
+
d.cursorDiv = elt("div", null, "CodeMirror-cursors");
|
312 |
+
// A visibility: hidden element used to find the size of things.
|
313 |
+
d.measure = elt("div", null, "CodeMirror-measure");
|
314 |
+
// When lines outside of the viewport are measured, they are drawn in this.
|
315 |
+
d.lineMeasure = elt("div", null, "CodeMirror-measure");
|
316 |
+
// Wraps everything that needs to exist inside the vertically-padded coordinate system
|
317 |
+
d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
|
318 |
+
null, "position: relative; outline: none");
|
319 |
+
var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
|
320 |
+
// Moved around its parent to cover visible view.
|
321 |
+
d.mover = elt("div", [lines], null, "position: relative");
|
322 |
+
// Set to the height of the document, allowing scrolling.
|
323 |
+
d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
|
324 |
+
d.sizerWidth = null;
|
325 |
+
// Behavior of elts with overflow: auto and padding is
|
326 |
+
// inconsistent across browsers. This is used to ensure the
|
327 |
+
// scrollable area is big enough.
|
328 |
+
d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
|
329 |
+
// Will contain the gutters, if any.
|
330 |
+
d.gutters = elt("div", null, "CodeMirror-gutters");
|
331 |
+
d.lineGutter = null;
|
332 |
+
// Actual scrollable element.
|
333 |
+
d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
|
334 |
+
d.scroller.setAttribute("tabIndex", "-1");
|
335 |
+
// The element in which the editor lives.
|
336 |
+
d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
|
337 |
+
|
338 |
+
// Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
|
339 |
+
if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
|
340 |
+
if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
|
341 |
+
|
342 |
+
if (place) {
|
343 |
+
if (place.appendChild) { place.appendChild(d.wrapper); }
|
344 |
+
else { place(d.wrapper); }
|
345 |
+
}
|
346 |
+
|
347 |
+
// Current rendered range (may be bigger than the view window).
|
348 |
+
d.viewFrom = d.viewTo = doc.first;
|
349 |
+
d.reportedViewFrom = d.reportedViewTo = doc.first;
|
350 |
+
// Information about the rendered lines.
|
351 |
+
d.view = [];
|
352 |
+
d.renderedView = null;
|
353 |
+
// Holds info about a single rendered line when it was rendered
|
354 |
+
// for measurement, while not in view.
|
355 |
+
d.externalMeasured = null;
|
356 |
+
// Empty space (in pixels) above the view
|
357 |
+
d.viewOffset = 0;
|
358 |
+
d.lastWrapHeight = d.lastWrapWidth = 0;
|
359 |
+
d.updateLineNumbers = null;
|
360 |
+
|
361 |
+
d.nativeBarWidth = d.barHeight = d.barWidth = 0;
|
362 |
+
d.scrollbarsClipped = false;
|
363 |
+
|
364 |
+
// Used to only resize the line number gutter when necessary (when
|
365 |
+
// the amount of lines crosses a boundary that makes its width change)
|
366 |
+
d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
|
367 |
+
// Set to true when a non-horizontal-scrolling line widget is
|
368 |
+
// added. As an optimization, line widget aligning is skipped when
|
369 |
+
// this is false.
|
370 |
+
d.alignWidgets = false;
|
371 |
+
|
372 |
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
|
373 |
+
|
374 |
+
// Tracks the maximum line length so that the horizontal scrollbar
|
375 |
+
// can be kept static when scrolling.
|
376 |
+
d.maxLine = null;
|
377 |
+
d.maxLineLength = 0;
|
378 |
+
d.maxLineChanged = false;
|
379 |
+
|
380 |
+
// Used for measuring wheel scrolling granularity
|
381 |
+
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
|
382 |
+
|
383 |
+
// True when shift is held down.
|
384 |
+
d.shift = false;
|
385 |
+
|
386 |
+
// Used to track whether anything happened since the context menu
|
387 |
+
// was opened.
|
388 |
+
d.selForContextMenu = null;
|
389 |
+
|
390 |
+
d.activeTouch = null;
|
391 |
+
|
392 |
+
input.init(d);
|
393 |
+
}
|
394 |
+
|
395 |
+
// Find the line object corresponding to the given line number.
|
396 |
+
function getLine(doc, n) {
|
397 |
+
n -= doc.first;
|
398 |
+
if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
|
399 |
+
var chunk = doc;
|
400 |
+
while (!chunk.lines) {
|
401 |
+
for (var i = 0;; ++i) {
|
402 |
+
var child = chunk.children[i], sz = child.chunkSize();
|
403 |
+
if (n < sz) { chunk = child; break }
|
404 |
+
n -= sz;
|
405 |
+
}
|
406 |
+
}
|
407 |
+
return chunk.lines[n]
|
408 |
+
}
|
409 |
+
|
410 |
+
// Get the part of a document between two positions, as an array of
|
411 |
+
// strings.
|
412 |
+
function getBetween(doc, start, end) {
|
413 |
+
var out = [], n = start.line;
|
414 |
+
doc.iter(start.line, end.line + 1, function (line) {
|
415 |
+
var text = line.text;
|
416 |
+
if (n == end.line) { text = text.slice(0, end.ch); }
|
417 |
+
if (n == start.line) { text = text.slice(start.ch); }
|
418 |
+
out.push(text);
|
419 |
+
++n;
|
420 |
+
});
|
421 |
+
return out
|
422 |
+
}
|
423 |
+
// Get the lines between from and to, as array of strings.
|
424 |
+
function getLines(doc, from, to) {
|
425 |
+
var out = [];
|
426 |
+
doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
|
427 |
+
return out
|
428 |
+
}
|
429 |
+
|
430 |
+
// Update the height of a line, propagating the height change
|
431 |
+
// upwards to parent nodes.
|
432 |
+
function updateLineHeight(line, height) {
|
433 |
+
var diff = height - line.height;
|
434 |
+
if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
|
435 |
+
}
|
436 |
+
|
437 |
+
// Given a line object, find its line number by walking up through
|
438 |
+
// its parent links.
|
439 |
+
function lineNo(line) {
|
440 |
+
if (line.parent == null) { return null }
|
441 |
+
var cur = line.parent, no = indexOf(cur.lines, line);
|
442 |
+
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
|
443 |
+
for (var i = 0;; ++i) {
|
444 |
+
if (chunk.children[i] == cur) { break }
|
445 |
+
no += chunk.children[i].chunkSize();
|
446 |
+
}
|
447 |
+
}
|
448 |
+
return no + cur.first
|
449 |
+
}
|
450 |
+
|
451 |
+
// Find the line at the given vertical position, using the height
|
452 |
+
// information in the document tree.
|
453 |
+
function lineAtHeight(chunk, h) {
|
454 |
+
var n = chunk.first;
|
455 |
+
outer: do {
|
456 |
+
for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
|
457 |
+
var child = chunk.children[i$1], ch = child.height;
|
458 |
+
if (h < ch) { chunk = child; continue outer }
|
459 |
+
h -= ch;
|
460 |
+
n += child.chunkSize();
|
461 |
+
}
|
462 |
+
return n
|
463 |
+
} while (!chunk.lines)
|
464 |
+
var i = 0;
|
465 |
+
for (; i < chunk.lines.length; ++i) {
|
466 |
+
var line = chunk.lines[i], lh = line.height;
|
467 |
+
if (h < lh) { break }
|
468 |
+
h -= lh;
|
469 |
+
}
|
470 |
+
return n + i
|
471 |
+
}
|
472 |
+
|
473 |
+
function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
|
474 |
+
|
475 |
+
function lineNumberFor(options, i) {
|
476 |
+
return String(options.lineNumberFormatter(i + options.firstLineNumber))
|
477 |
+
}
|
478 |
+
|
479 |
+
// A Pos instance represents a position within the text.
|
480 |
+
function Pos(line, ch, sticky) {
|
481 |
+
if ( sticky === void 0 ) sticky = null;
|
482 |
+
|
483 |
+
if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
|
484 |
+
this.line = line;
|
485 |
+
this.ch = ch;
|
486 |
+
this.sticky = sticky;
|
487 |
+
}
|
488 |
+
|
489 |
+
// Compare two positions, return 0 if they are the same, a negative
|
490 |
+
// number when a is less, and a positive number otherwise.
|
491 |
+
function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
|
492 |
+
|
493 |
+
function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
|
494 |
+
|
495 |
+
function copyPos(x) {return Pos(x.line, x.ch)}
|
496 |
+
function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
|
497 |
+
function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
|
498 |
+
|
499 |
+
// Most of the external API clips given positions to make sure they
|
500 |
+
// actually exist within the document.
|
501 |
+
function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
|
502 |
+
function clipPos(doc, pos) {
|
503 |
+
if (pos.line < doc.first) { return Pos(doc.first, 0) }
|
504 |
+
var last = doc.first + doc.size - 1;
|
505 |
+
if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
|
506 |
+
return clipToLen(pos, getLine(doc, pos.line).text.length)
|
507 |
+
}
|
508 |
+
function clipToLen(pos, linelen) {
|
509 |
+
var ch = pos.ch;
|
510 |
+
if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
|
511 |
+
else if (ch < 0) { return Pos(pos.line, 0) }
|
512 |
+
else { return pos }
|
513 |
+
}
|
514 |
+
function clipPosArray(doc, array) {
|
515 |
+
var out = [];
|
516 |
+
for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
|
517 |
+
return out
|
518 |
+
}
|
519 |
+
|
520 |
+
// Optimize some code when these features are not used.
|
521 |
+
var sawReadOnlySpans = false;
|
522 |
+
var sawCollapsedSpans = false;
|
523 |
+
|
524 |
+
function seeReadOnlySpans() {
|
525 |
+
sawReadOnlySpans = true;
|
526 |
+
}
|
527 |
+
|
528 |
+
function seeCollapsedSpans() {
|
529 |
+
sawCollapsedSpans = true;
|
530 |
+
}
|
531 |
+
|
532 |
+
// TEXTMARKER SPANS
|
533 |
+
|
534 |
+
function MarkedSpan(marker, from, to) {
|
535 |
+
this.marker = marker;
|
536 |
+
this.from = from; this.to = to;
|
537 |
+
}
|
538 |
+
|
539 |
+
// Search an array of spans for a span matching the given marker.
|
540 |
+
function getMarkedSpanFor(spans, marker) {
|
541 |
+
if (spans) { for (var i = 0; i < spans.length; ++i) {
|
542 |
+
var span = spans[i];
|
543 |
+
if (span.marker == marker) { return span }
|
544 |
+
} }
|
545 |
+
}
|
546 |
+
// Remove a span from an array, returning undefined if no spans are
|
547 |
+
// left (we don't store arrays for lines without spans).
|
548 |
+
function removeMarkedSpan(spans, span) {
|
549 |
+
var r;
|
550 |
+
for (var i = 0; i < spans.length; ++i)
|
551 |
+
{ if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
|
552 |
+
return r
|
553 |
+
}
|
554 |
+
// Add a span to a line.
|
555 |
+
function addMarkedSpan(line, span) {
|
556 |
+
line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
|
557 |
+
span.marker.attachLine(line);
|
558 |
+
}
|
559 |
+
|
560 |
+
// Used for the algorithm that adjusts markers for a change in the
|
561 |
+
// document. These functions cut an array of spans at a given
|
562 |
+
// character position, returning an array of remaining chunks (or
|
563 |
+
// undefined if nothing remains).
|
564 |
+
function markedSpansBefore(old, startCh, isInsert) {
|
565 |
+
var nw;
|
566 |
+
if (old) { for (var i = 0; i < old.length; ++i) {
|
567 |
+
var span = old[i], marker = span.marker;
|
568 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
|
569 |
+
if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
|
570 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
|
571 |
+
}
|
572 |
+
} }
|
573 |
+
return nw
|
574 |
+
}
|
575 |
+
function markedSpansAfter(old, endCh, isInsert) {
|
576 |
+
var nw;
|
577 |
+
if (old) { for (var i = 0; i < old.length; ++i) {
|
578 |
+
var span = old[i], marker = span.marker;
|
579 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
|
580 |
+
if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
|
581 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
|
582 |
+
span.to == null ? null : span.to - endCh));
|
583 |
+
}
|
584 |
+
} }
|
585 |
+
return nw
|
586 |
+
}
|
587 |
+
|
588 |
+
// Given a change object, compute the new set of marker spans that
|
589 |
+
// cover the line in which the change took place. Removes spans
|
590 |
+
// entirely within the change, reconnects spans belonging to the
|
591 |
+
// same marker that appear on both sides of the change, and cuts off
|
592 |
+
// spans partially within the change. Returns an array of span
|
593 |
+
// arrays with one element for each line in (after) the change.
|
594 |
+
function stretchSpansOverChange(doc, change) {
|
595 |
+
if (change.full) { return null }
|
596 |
+
var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
|
597 |
+
var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
|
598 |
+
if (!oldFirst && !oldLast) { return null }
|
599 |
+
|
600 |
+
var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
|
601 |
+
// Get the spans that 'stick out' on both sides
|
602 |
+
var first = markedSpansBefore(oldFirst, startCh, isInsert);
|
603 |
+
var last = markedSpansAfter(oldLast, endCh, isInsert);
|
604 |
+
|
605 |
+
// Next, merge those two ends
|
606 |
+
var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
|
607 |
+
if (first) {
|
608 |
+
// Fix up .to properties of first
|
609 |
+
for (var i = 0; i < first.length; ++i) {
|
610 |
+
var span = first[i];
|
611 |
+
if (span.to == null) {
|
612 |
+
var found = getMarkedSpanFor(last, span.marker);
|
613 |
+
if (!found) { span.to = startCh; }
|
614 |
+
else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
|
615 |
+
}
|
616 |
+
}
|
617 |
+
}
|
618 |
+
if (last) {
|
619 |
+
// Fix up .from in last (or move them into first in case of sameLine)
|
620 |
+
for (var i$1 = 0; i$1 < last.length; ++i$1) {
|
621 |
+
var span$1 = last[i$1];
|
622 |
+
if (span$1.to != null) { span$1.to += offset; }
|
623 |
+
if (span$1.from == null) {
|
624 |
+
var found$1 = getMarkedSpanFor(first, span$1.marker);
|
625 |
+
if (!found$1) {
|
626 |
+
span$1.from = offset;
|
627 |
+
if (sameLine) { (first || (first = [])).push(span$1); }
|
628 |
+
}
|
629 |
+
} else {
|
630 |
+
span$1.from += offset;
|
631 |
+
if (sameLine) { (first || (first = [])).push(span$1); }
|
632 |
+
}
|
633 |
+
}
|
634 |
+
}
|
635 |
+
// Make sure we didn't create any zero-length spans
|
636 |
+
if (first) { first = clearEmptySpans(first); }
|
637 |
+
if (last && last != first) { last = clearEmptySpans(last); }
|
638 |
+
|
639 |
+
var newMarkers = [first];
|
640 |
+
if (!sameLine) {
|
641 |
+
// Fill gap with whole-line-spans
|
642 |
+
var gap = change.text.length - 2, gapMarkers;
|
643 |
+
if (gap > 0 && first)
|
644 |
+
{ for (var i$2 = 0; i$2 < first.length; ++i$2)
|
645 |
+
{ if (first[i$2].to == null)
|
646 |
+
{ (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
|
647 |
+
for (var i$3 = 0; i$3 < gap; ++i$3)
|
648 |
+
{ newMarkers.push(gapMarkers); }
|
649 |
+
newMarkers.push(last);
|
650 |
+
}
|
651 |
+
return newMarkers
|
652 |
+
}
|
653 |
+
|
654 |
+
// Remove spans that are empty and don't have a clearWhenEmpty
|
655 |
+
// option of false.
|
656 |
+
function clearEmptySpans(spans) {
|
657 |
+
for (var i = 0; i < spans.length; ++i) {
|
658 |
+
var span = spans[i];
|
659 |
+
if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
|
660 |
+
{ spans.splice(i--, 1); }
|
661 |
+
}
|
662 |
+
if (!spans.length) { return null }
|
663 |
+
return spans
|
664 |
+
}
|
665 |
+
|
666 |
+
// Used to 'clip' out readOnly ranges when making a change.
|
667 |
+
function removeReadOnlyRanges(doc, from, to) {
|
668 |
+
var markers = null;
|
669 |
+
doc.iter(from.line, to.line + 1, function (line) {
|
670 |
+
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
671 |
+
var mark = line.markedSpans[i].marker;
|
672 |
+
if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
|
673 |
+
{ (markers || (markers = [])).push(mark); }
|
674 |
+
} }
|
675 |
+
});
|
676 |
+
if (!markers) { return null }
|
677 |
+
var parts = [{from: from, to: to}];
|
678 |
+
for (var i = 0; i < markers.length; ++i) {
|
679 |
+
var mk = markers[i], m = mk.find(0);
|
680 |
+
for (var j = 0; j < parts.length; ++j) {
|
681 |
+
var p = parts[j];
|
682 |
+
if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
|
683 |
+
var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
|
684 |
+
if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
|
685 |
+
{ newParts.push({from: p.from, to: m.from}); }
|
686 |
+
if (dto > 0 || !mk.inclusiveRight && !dto)
|
687 |
+
{ newParts.push({from: m.to, to: p.to}); }
|
688 |
+
parts.splice.apply(parts, newParts);
|
689 |
+
j += newParts.length - 3;
|
690 |
+
}
|
691 |
+
}
|
692 |
+
return parts
|
693 |
+
}
|
694 |
+
|
695 |
+
// Connect or disconnect spans from a line.
|
696 |
+
function detachMarkedSpans(line) {
|
697 |
+
var spans = line.markedSpans;
|
698 |
+
if (!spans) { return }
|
699 |
+
for (var i = 0; i < spans.length; ++i)
|
700 |
+
{ spans[i].marker.detachLine(line); }
|
701 |
+
line.markedSpans = null;
|
702 |
+
}
|
703 |
+
function attachMarkedSpans(line, spans) {
|
704 |
+
if (!spans) { return }
|
705 |
+
for (var i = 0; i < spans.length; ++i)
|
706 |
+
{ spans[i].marker.attachLine(line); }
|
707 |
+
line.markedSpans = spans;
|
708 |
+
}
|
709 |
+
|
710 |
+
// Helpers used when computing which overlapping collapsed span
|
711 |
+
// counts as the larger one.
|
712 |
+
function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
|
713 |
+
function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
|
714 |
+
|
715 |
+
// Returns a number indicating which of two overlapping collapsed
|
716 |
+
// spans is larger (and thus includes the other). Falls back to
|
717 |
+
// comparing ids when the spans cover exactly the same range.
|
718 |
+
function compareCollapsedMarkers(a, b) {
|
719 |
+
var lenDiff = a.lines.length - b.lines.length;
|
720 |
+
if (lenDiff != 0) { return lenDiff }
|
721 |
+
var aPos = a.find(), bPos = b.find();
|
722 |
+
var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
|
723 |
+
if (fromCmp) { return -fromCmp }
|
724 |
+
var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
|
725 |
+
if (toCmp) { return toCmp }
|
726 |
+
return b.id - a.id
|
727 |
+
}
|
728 |
+
|
729 |
+
// Find out whether a line ends or starts in a collapsed span. If
|
730 |
+
// so, return the marker for that span.
|
731 |
+
function collapsedSpanAtSide(line, start) {
|
732 |
+
var sps = sawCollapsedSpans && line.markedSpans, found;
|
733 |
+
if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
|
734 |
+
sp = sps[i];
|
735 |
+
if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
|
736 |
+
(!found || compareCollapsedMarkers(found, sp.marker) < 0))
|
737 |
+
{ found = sp.marker; }
|
738 |
+
} }
|
739 |
+
return found
|
740 |
+
}
|
741 |
+
function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
|
742 |
+
function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
|
743 |
+
|
744 |
+
// Test whether there exists a collapsed span that partially
|
745 |
+
// overlaps (covers the start or end, but not both) of a new span.
|
746 |
+
// Such overlap is not allowed.
|
747 |
+
function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
|
748 |
+
var line = getLine(doc, lineNo$$1);
|
749 |
+
var sps = sawCollapsedSpans && line.markedSpans;
|
750 |
+
if (sps) { for (var i = 0; i < sps.length; ++i) {
|
751 |
+
var sp = sps[i];
|
752 |
+
if (!sp.marker.collapsed) { continue }
|
753 |
+
var found = sp.marker.find(0);
|
754 |
+
var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
|
755 |
+
var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
|
756 |
+
if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
|
757 |
+
if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
|
758 |
+
fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
|
759 |
+
{ return true }
|
760 |
+
} }
|
761 |
+
}
|
762 |
+
|
763 |
+
// A visual line is a line as drawn on the screen. Folding, for
|
764 |
+
// example, can cause multiple logical lines to appear on the same
|
765 |
+
// visual line. This finds the start of the visual line that the
|
766 |
+
// given line is part of (usually that is the line itself).
|
767 |
+
function visualLine(line) {
|
768 |
+
var merged;
|
769 |
+
while (merged = collapsedSpanAtStart(line))
|
770 |
+
{ line = merged.find(-1, true).line; }
|
771 |
+
return line
|
772 |
+
}
|
773 |
+
|
774 |
+
function visualLineEnd(line) {
|
775 |
+
var merged;
|
776 |
+
while (merged = collapsedSpanAtEnd(line))
|
777 |
+
{ line = merged.find(1, true).line; }
|
778 |
+
return line
|
779 |
+
}
|
780 |
+
|
781 |
+
// Returns an array of logical lines that continue the visual line
|
782 |
+
// started by the argument, or undefined if there are no such lines.
|
783 |
+
function visualLineContinued(line) {
|
784 |
+
var merged, lines;
|
785 |
+
while (merged = collapsedSpanAtEnd(line)) {
|
786 |
+
line = merged.find(1, true).line
|
787 |
+
;(lines || (lines = [])).push(line);
|
788 |
+
}
|
789 |
+
return lines
|
790 |
+
}
|
791 |
+
|
792 |
+
// Get the line number of the start of the visual line that the
|
793 |
+
// given line number is part of.
|
794 |
+
function visualLineNo(doc, lineN) {
|
795 |
+
var line = getLine(doc, lineN), vis = visualLine(line);
|
796 |
+
if (line == vis) { return lineN }
|
797 |
+
return lineNo(vis)
|
798 |
+
}
|
799 |
+
|
800 |
+
// Get the line number of the start of the next visual line after
|
801 |
+
// the given line.
|
802 |
+
function visualLineEndNo(doc, lineN) {
|
803 |
+
if (lineN > doc.lastLine()) { return lineN }
|
804 |
+
var line = getLine(doc, lineN), merged;
|
805 |
+
if (!lineIsHidden(doc, line)) { return lineN }
|
806 |
+
while (merged = collapsedSpanAtEnd(line))
|
807 |
+
{ line = merged.find(1, true).line; }
|
808 |
+
return lineNo(line) + 1
|
809 |
+
}
|
810 |
+
|
811 |
+
// Compute whether a line is hidden. Lines count as hidden when they
|
812 |
+
// are part of a visual line that starts with another line, or when
|
813 |
+
// they are entirely covered by collapsed, non-widget span.
|
814 |
+
function lineIsHidden(doc, line) {
|
815 |
+
var sps = sawCollapsedSpans && line.markedSpans;
|
816 |
+
if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
|
817 |
+
sp = sps[i];
|
818 |
+
if (!sp.marker.collapsed) { continue }
|
819 |
+
if (sp.from == null) { return true }
|
820 |
+
if (sp.marker.widgetNode) { continue }
|
821 |
+
if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
|
822 |
+
{ return true }
|
823 |
+
} }
|
824 |
+
}
|
825 |
+
function lineIsHiddenInner(doc, line, span) {
|
826 |
+
if (span.to == null) {
|
827 |
+
var end = span.marker.find(1, true);
|
828 |
+
return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
|
829 |
+
}
|
830 |
+
if (span.marker.inclusiveRight && span.to == line.text.length)
|
831 |
+
{ return true }
|
832 |
+
for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
|
833 |
+
sp = line.markedSpans[i];
|
834 |
+
if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
|
835 |
+
(sp.to == null || sp.to != span.from) &&
|
836 |
+
(sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
|
837 |
+
lineIsHiddenInner(doc, line, sp)) { return true }
|
838 |
+
}
|
839 |
+
}
|
840 |
+
|
841 |
+
// Find the height above the given line.
|
842 |
+
function heightAtLine(lineObj) {
|
843 |
+
lineObj = visualLine(lineObj);
|
844 |
+
|
845 |
+
var h = 0, chunk = lineObj.parent;
|
846 |
+
for (var i = 0; i < chunk.lines.length; ++i) {
|
847 |
+
var line = chunk.lines[i];
|
848 |
+
if (line == lineObj) { break }
|
849 |
+
else { h += line.height; }
|
850 |
+
}
|
851 |
+
for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
|
852 |
+
for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
|
853 |
+
var cur = p.children[i$1];
|
854 |
+
if (cur == chunk) { break }
|
855 |
+
else { h += cur.height; }
|
856 |
+
}
|
857 |
+
}
|
858 |
+
return h
|
859 |
+
}
|
860 |
+
|
861 |
+
// Compute the character length of a line, taking into account
|
862 |
+
// collapsed ranges (see markText) that might hide parts, and join
|
863 |
+
// other lines onto it.
|
864 |
+
function lineLength(line) {
|
865 |
+
if (line.height == 0) { return 0 }
|
866 |
+
var len = line.text.length, merged, cur = line;
|
867 |
+
while (merged = collapsedSpanAtStart(cur)) {
|
868 |
+
var found = merged.find(0, true);
|
869 |
+
cur = found.from.line;
|
870 |
+
len += found.from.ch - found.to.ch;
|
871 |
+
}
|
872 |
+
cur = line;
|
873 |
+
while (merged = collapsedSpanAtEnd(cur)) {
|
874 |
+
var found$1 = merged.find(0, true);
|
875 |
+
len -= cur.text.length - found$1.from.ch;
|
876 |
+
cur = found$1.to.line;
|
877 |
+
len += cur.text.length - found$1.to.ch;
|
878 |
+
}
|
879 |
+
return len
|
880 |
+
}
|
881 |
+
|
882 |
+
// Find the longest line in the document.
|
883 |
+
function findMaxLine(cm) {
|
884 |
+
var d = cm.display, doc = cm.doc;
|
885 |
+
d.maxLine = getLine(doc, doc.first);
|
886 |
+
d.maxLineLength = lineLength(d.maxLine);
|
887 |
+
d.maxLineChanged = true;
|
888 |
+
doc.iter(function (line) {
|
889 |
+
var len = lineLength(line);
|
890 |
+
if (len > d.maxLineLength) {
|
891 |
+
d.maxLineLength = len;
|
892 |
+
d.maxLine = line;
|
893 |
+
}
|
894 |
+
});
|
895 |
+
}
|
896 |
+
|
897 |
+
// BIDI HELPERS
|
898 |
+
|
899 |
+
function iterateBidiSections(order, from, to, f) {
|
900 |
+
if (!order) { return f(from, to, "ltr") }
|
901 |
+
var found = false;
|
902 |
+
for (var i = 0; i < order.length; ++i) {
|
903 |
+
var part = order[i];
|
904 |
+
if (part.from < to && part.to > from || from == to && part.to == from) {
|
905 |
+
f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
|
906 |
+
found = true;
|
907 |
+
}
|
908 |
+
}
|
909 |
+
if (!found) { f(from, to, "ltr"); }
|
910 |
+
}
|
911 |
+
|
912 |
+
var bidiOther = null;
|
913 |
+
function getBidiPartAt(order, ch, sticky) {
|
914 |
+
var found;
|
915 |
+
bidiOther = null;
|
916 |
+
for (var i = 0; i < order.length; ++i) {
|
917 |
+
var cur = order[i];
|
918 |
+
if (cur.from < ch && cur.to > ch) { return i }
|
919 |
+
if (cur.to == ch) {
|
920 |
+
if (cur.from != cur.to && sticky == "before") { found = i; }
|
921 |
+
else { bidiOther = i; }
|
922 |
+
}
|
923 |
+
if (cur.from == ch) {
|
924 |
+
if (cur.from != cur.to && sticky != "before") { found = i; }
|
925 |
+
else { bidiOther = i; }
|
926 |
+
}
|
927 |
+
}
|
928 |
+
return found != null ? found : bidiOther
|
929 |
+
}
|
930 |
+
|
931 |
+
// Bidirectional ordering algorithm
|
932 |
+
// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
|
933 |
+
// that this (partially) implements.
|
934 |
+
|
935 |
+
// One-char codes used for character types:
|
936 |
+
// L (L): Left-to-Right
|
937 |
+
// R (R): Right-to-Left
|
938 |
+
// r (AL): Right-to-Left Arabic
|
939 |
+
// 1 (EN): European Number
|
940 |
+
// + (ES): European Number Separator
|
941 |
+
// % (ET): European Number Terminator
|
942 |
+
// n (AN): Arabic Number
|
943 |
+
// , (CS): Common Number Separator
|
944 |
+
// m (NSM): Non-Spacing Mark
|
945 |
+
// b (BN): Boundary Neutral
|
946 |
+
// s (B): Paragraph Separator
|
947 |
+
// t (S): Segment Separator
|
948 |
+
// w (WS): Whitespace
|
949 |
+
// N (ON): Other Neutrals
|
950 |
+
|
951 |
+
// Returns null if characters are ordered as they appear
|
952 |
+
// (left-to-right), or an array of sections ({from, to, level}
|
953 |
+
// objects) in the order in which they occur visually.
|
954 |
+
var bidiOrdering = (function() {
|
955 |
+
// Character types for codepoints 0 to 0xff
|
956 |
+
var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
|
957 |
+
// Character types for codepoints 0x600 to 0x6f9
|
958 |
+
var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
|
959 |
+
function charType(code) {
|
960 |
+
if (code <= 0xf7) { return lowTypes.charAt(code) }
|
961 |
+
else if (0x590 <= code && code <= 0x5f4) { return "R" }
|
962 |
+
else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
|
963 |
+
else if (0x6ee <= code && code <= 0x8ac) { return "r" }
|
964 |
+
else if (0x2000 <= code && code <= 0x200b) { return "w" }
|
965 |
+
else if (code == 0x200c) { return "b" }
|
966 |
+
else { return "L" }
|
967 |
+
}
|
968 |
+
|
969 |
+
var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
970 |
+
var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
|
971 |
+
|
972 |
+
function BidiSpan(level, from, to) {
|
973 |
+
this.level = level;
|
974 |
+
this.from = from; this.to = to;
|
975 |
+
}
|
976 |
+
|
977 |
+
return function(str, direction) {
|
978 |
+
var outerType = direction == "ltr" ? "L" : "R";
|
979 |
+
|
980 |
+
if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
|
981 |
+
var len = str.length, types = [];
|
982 |
+
for (var i = 0; i < len; ++i)
|
983 |
+
{ types.push(charType(str.charCodeAt(i))); }
|
984 |
+
|
985 |
+
// W1. Examine each non-spacing mark (NSM) in the level run, and
|
986 |
+
// change the type of the NSM to the type of the previous
|
987 |
+
// character. If the NSM is at the start of the level run, it will
|
988 |
+
// get the type of sor.
|
989 |
+
for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
|
990 |
+
var type = types[i$1];
|
991 |
+
if (type == "m") { types[i$1] = prev; }
|
992 |
+
else { prev = type; }
|
993 |
+
}
|
994 |
+
|
995 |
+
// W2. Search backwards from each instance of a European number
|
996 |
+
// until the first strong type (R, L, AL, or sor) is found. If an
|
997 |
+
// AL is found, change the type of the European number to Arabic
|
998 |
+
// number.
|
999 |
+
// W3. Change all ALs to R.
|
1000 |
+
for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
|
1001 |
+
var type$1 = types[i$2];
|
1002 |
+
if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
|
1003 |
+
else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
// W4. A single European separator between two European numbers
|
1007 |
+
// changes to a European number. A single common separator between
|
1008 |
+
// two numbers of the same type changes to that type.
|
1009 |
+
for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
|
1010 |
+
var type$2 = types[i$3];
|
1011 |
+
if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
|
1012 |
+
else if (type$2 == "," && prev$1 == types[i$3+1] &&
|
1013 |
+
(prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
|
1014 |
+
prev$1 = type$2;
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
// W5. A sequence of European terminators adjacent to European
|
1018 |
+
// numbers changes to all European numbers.
|
1019 |
+
// W6. Otherwise, separators and terminators change to Other
|
1020 |
+
// Neutral.
|
1021 |
+
for (var i$4 = 0; i$4 < len; ++i$4) {
|
1022 |
+
var type$3 = types[i$4];
|
1023 |
+
if (type$3 == ",") { types[i$4] = "N"; }
|
1024 |
+
else if (type$3 == "%") {
|
1025 |
+
var end = (void 0);
|
1026 |
+
for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
|
1027 |
+
var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
|
1028 |
+
for (var j = i$4; j < end; ++j) { types[j] = replace; }
|
1029 |
+
i$4 = end - 1;
|
1030 |
+
}
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
// W7. Search backwards from each instance of a European number
|
1034 |
+
// until the first strong type (R, L, or sor) is found. If an L is
|
1035 |
+
// found, then change the type of the European number to L.
|
1036 |
+
for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
|
1037 |
+
var type$4 = types[i$5];
|
1038 |
+
if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
|
1039 |
+
else if (isStrong.test(type$4)) { cur$1 = type$4; }
|
1040 |
+
}
|
1041 |
+
|
1042 |
+
// N1. A sequence of neutrals takes the direction of the
|
1043 |
+
// surrounding strong text if the text on both sides has the same
|
1044 |
+
// direction. European and Arabic numbers act as if they were R in
|
1045 |
+
// terms of their influence on neutrals. Start-of-level-run (sor)
|
1046 |
+
// and end-of-level-run (eor) are used at level run boundaries.
|
1047 |
+
// N2. Any remaining neutrals take the embedding direction.
|
1048 |
+
for (var i$6 = 0; i$6 < len; ++i$6) {
|
1049 |
+
if (isNeutral.test(types[i$6])) {
|
1050 |
+
var end$1 = (void 0);
|
1051 |
+
for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
|
1052 |
+
var before = (i$6 ? types[i$6-1] : outerType) == "L";
|
1053 |
+
var after = (end$1 < len ? types[end$1] : outerType) == "L";
|
1054 |
+
var replace$1 = before == after ? (before ? "L" : "R") : outerType;
|
1055 |
+
for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
|
1056 |
+
i$6 = end$1 - 1;
|
1057 |
+
}
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
// Here we depart from the documented algorithm, in order to avoid
|
1061 |
+
// building up an actual levels array. Since there are only three
|
1062 |
+
// levels (0, 1, 2) in an implementation that doesn't take
|
1063 |
+
// explicit embedding into account, we can build up the order on
|
1064 |
+
// the fly, without following the level-based algorithm.
|
1065 |
+
var order = [], m;
|
1066 |
+
for (var i$7 = 0; i$7 < len;) {
|
1067 |
+
if (countsAsLeft.test(types[i$7])) {
|
1068 |
+
var start = i$7;
|
1069 |
+
for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
|
1070 |
+
order.push(new BidiSpan(0, start, i$7));
|
1071 |
+
} else {
|
1072 |
+
var pos = i$7, at = order.length;
|
1073 |
+
for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
|
1074 |
+
for (var j$2 = pos; j$2 < i$7;) {
|
1075 |
+
if (countsAsNum.test(types[j$2])) {
|
1076 |
+
if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }
|
1077 |
+
var nstart = j$2;
|
1078 |
+
for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
|
1079 |
+
order.splice(at, 0, new BidiSpan(2, nstart, j$2));
|
1080 |
+
pos = j$2;
|
1081 |
+
} else { ++j$2; }
|
1082 |
+
}
|
1083 |
+
if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
|
1084 |
+
}
|
1085 |
+
}
|
1086 |
+
if (order[0].level == 1 && (m = str.match(/^\s+/))) {
|
1087 |
+
order[0].from = m[0].length;
|
1088 |
+
order.unshift(new BidiSpan(0, 0, m[0].length));
|
1089 |
+
}
|
1090 |
+
if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
|
1091 |
+
lst(order).to -= m[0].length;
|
1092 |
+
order.push(new BidiSpan(0, len - m[0].length, len));
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
return direction == "rtl" ? order.reverse() : order
|
1096 |
+
}
|
1097 |
+
})();
|
1098 |
+
|
1099 |
+
// Get the bidi ordering for the given line (and cache it). Returns
|
1100 |
+
// false for lines that are fully left-to-right, and an array of
|
1101 |
+
// BidiSpan objects otherwise.
|
1102 |
+
function getOrder(line, direction) {
|
1103 |
+
var order = line.order;
|
1104 |
+
if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
|
1105 |
+
return order
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
function moveCharLogically(line, ch, dir) {
|
1109 |
+
var target = skipExtendingChars(line.text, ch + dir, dir);
|
1110 |
+
return target < 0 || target > line.text.length ? null : target
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
function moveLogically(line, start, dir) {
|
1114 |
+
var ch = moveCharLogically(line, start.ch, dir);
|
1115 |
+
return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
function endOfLine(visually, cm, lineObj, lineNo, dir) {
|
1119 |
+
if (visually) {
|
1120 |
+
var order = getOrder(lineObj, cm.doc.direction);
|
1121 |
+
if (order) {
|
1122 |
+
var part = dir < 0 ? lst(order) : order[0];
|
1123 |
+
var moveInStorageOrder = (dir < 0) == (part.level == 1);
|
1124 |
+
var sticky = moveInStorageOrder ? "after" : "before";
|
1125 |
+
var ch;
|
1126 |
+
// With a wrapped rtl chunk (possibly spanning multiple bidi parts),
|
1127 |
+
// it could be that the last bidi part is not on the last visual line,
|
1128 |
+
// since visual lines contain content order-consecutive chunks.
|
1129 |
+
// Thus, in rtl, we are looking for the first (content-order) character
|
1130 |
+
// in the rtl chunk that is on the last line (that is, the same line
|
1131 |
+
// as the last (content-order) character).
|
1132 |
+
if (part.level > 0) {
|
1133 |
+
var prep = prepareMeasureForLine(cm, lineObj);
|
1134 |
+
ch = dir < 0 ? lineObj.text.length - 1 : 0;
|
1135 |
+
var targetTop = measureCharPrepared(cm, prep, ch).top;
|
1136 |
+
ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
|
1137 |
+
if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true); }
|
1138 |
+
} else { ch = dir < 0 ? part.to : part.from; }
|
1139 |
+
return new Pos(lineNo, ch, sticky)
|
1140 |
+
}
|
1141 |
+
}
|
1142 |
+
return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
function moveVisually(cm, line, start, dir) {
|
1146 |
+
var bidi = getOrder(line, cm.doc.direction);
|
1147 |
+
if (!bidi) { return moveLogically(line, start, dir) }
|
1148 |
+
if (start.ch >= line.text.length) {
|
1149 |
+
start.ch = line.text.length;
|
1150 |
+
start.sticky = "before";
|
1151 |
+
} else if (start.ch <= 0) {
|
1152 |
+
start.ch = 0;
|
1153 |
+
start.sticky = "after";
|
1154 |
+
}
|
1155 |
+
var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
|
1156 |
+
if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
|
1157 |
+
// Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
|
1158 |
+
// nothing interesting happens.
|
1159 |
+
return moveLogically(line, start, dir)
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
|
1163 |
+
var prep;
|
1164 |
+
var getWrappedLineExtent = function (ch) {
|
1165 |
+
if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
|
1166 |
+
prep = prep || prepareMeasureForLine(cm, line);
|
1167 |
+
return wrappedLineExtentChar(cm, line, prep, ch)
|
1168 |
+
};
|
1169 |
+
var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
|
1170 |
+
|
1171 |
+
if (cm.doc.direction == "rtl" || part.level == 1) {
|
1172 |
+
var moveInStorageOrder = (part.level == 1) == (dir < 0);
|
1173 |
+
var ch = mv(start, moveInStorageOrder ? 1 : -1);
|
1174 |
+
if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
|
1175 |
+
// Case 2: We move within an rtl part or in an rtl editor on the same visual line
|
1176 |
+
var sticky = moveInStorageOrder ? "before" : "after";
|
1177 |
+
return new Pos(start.line, ch, sticky)
|
1178 |
+
}
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
// Case 3: Could not move within this bidi part in this visual line, so leave
|
1182 |
+
// the current bidi part
|
1183 |
+
|
1184 |
+
var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
|
1185 |
+
var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
|
1186 |
+
? new Pos(start.line, mv(ch, 1), "before")
|
1187 |
+
: new Pos(start.line, ch, "after"); };
|
1188 |
+
|
1189 |
+
for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
|
1190 |
+
var part = bidi[partPos];
|
1191 |
+
var moveInStorageOrder = (dir > 0) == (part.level != 1);
|
1192 |
+
var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
|
1193 |
+
if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
|
1194 |
+
ch = moveInStorageOrder ? part.from : mv(part.to, -1);
|
1195 |
+
if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
|
1196 |
+
}
|
1197 |
+
};
|
1198 |
+
|
1199 |
+
// Case 3a: Look for other bidi parts on the same visual line
|
1200 |
+
var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
|
1201 |
+
if (res) { return res }
|
1202 |
+
|
1203 |
+
// Case 3b: Look for other bidi parts on the next visual line
|
1204 |
+
var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
|
1205 |
+
if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
|
1206 |
+
res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
|
1207 |
+
if (res) { return res }
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
// Case 4: Nowhere to move
|
1211 |
+
return null
|
1212 |
+
}
|
1213 |
+
|
1214 |
+
// EVENT HANDLING
|
1215 |
+
|
1216 |
+
// Lightweight event framework. on/off also work on DOM nodes,
|
1217 |
+
// registering native DOM handlers.
|
1218 |
+
|
1219 |
+
var noHandlers = [];
|
1220 |
+
|
1221 |
+
var on = function(emitter, type, f) {
|
1222 |
+
if (emitter.addEventListener) {
|
1223 |
+
emitter.addEventListener(type, f, false);
|
1224 |
+
} else if (emitter.attachEvent) {
|
1225 |
+
emitter.attachEvent("on" + type, f);
|
1226 |
+
} else {
|
1227 |
+
var map$$1 = emitter._handlers || (emitter._handlers = {});
|
1228 |
+
map$$1[type] = (map$$1[type] || noHandlers).concat(f);
|
1229 |
+
}
|
1230 |
+
};
|
1231 |
+
|
1232 |
+
function getHandlers(emitter, type) {
|
1233 |
+
return emitter._handlers && emitter._handlers[type] || noHandlers
|
1234 |
+
}
|
1235 |
+
|
1236 |
+
function off(emitter, type, f) {
|
1237 |
+
if (emitter.removeEventListener) {
|
1238 |
+
emitter.removeEventListener(type, f, false);
|
1239 |
+
} else if (emitter.detachEvent) {
|
1240 |
+
emitter.detachEvent("on" + type, f);
|
1241 |
+
} else {
|
1242 |
+
var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
|
1243 |
+
if (arr) {
|
1244 |
+
var index = indexOf(arr, f);
|
1245 |
+
if (index > -1)
|
1246 |
+
{ map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
|
1247 |
+
}
|
1248 |
+
}
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
function signal(emitter, type /*, values...*/) {
|
1252 |
+
var handlers = getHandlers(emitter, type);
|
1253 |
+
if (!handlers.length) { return }
|
1254 |
+
var args = Array.prototype.slice.call(arguments, 2);
|
1255 |
+
for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
// The DOM events that CodeMirror handles can be overridden by
|
1259 |
+
// registering a (non-DOM) handler on the editor for the event name,
|
1260 |
+
// and preventDefault-ing the event in that handler.
|
1261 |
+
function signalDOMEvent(cm, e, override) {
|
1262 |
+
if (typeof e == "string")
|
1263 |
+
{ e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
|
1264 |
+
signal(cm, override || e.type, cm, e);
|
1265 |
+
return e_defaultPrevented(e) || e.codemirrorIgnore
|
1266 |
+
}
|
1267 |
+
|
1268 |
+
function signalCursorActivity(cm) {
|
1269 |
+
var arr = cm._handlers && cm._handlers.cursorActivity;
|
1270 |
+
if (!arr) { return }
|
1271 |
+
var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
|
1272 |
+
for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
|
1273 |
+
{ set.push(arr[i]); } }
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
function hasHandler(emitter, type) {
|
1277 |
+
return getHandlers(emitter, type).length > 0
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
// Add on and off methods to a constructor's prototype, to make
|
1281 |
+
// registering events on such objects more convenient.
|
1282 |
+
function eventMixin(ctor) {
|
1283 |
+
ctor.prototype.on = function(type, f) {on(this, type, f);};
|
1284 |
+
ctor.prototype.off = function(type, f) {off(this, type, f);};
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
// Due to the fact that we still support jurassic IE versions, some
|
1288 |
+
// compatibility wrappers are needed.
|
1289 |
+
|
1290 |
+
function e_preventDefault(e) {
|
1291 |
+
if (e.preventDefault) { e.preventDefault(); }
|
1292 |
+
else { e.returnValue = false; }
|
1293 |
+
}
|
1294 |
+
function e_stopPropagation(e) {
|
1295 |
+
if (e.stopPropagation) { e.stopPropagation(); }
|
1296 |
+
else { e.cancelBubble = true; }
|
1297 |
+
}
|
1298 |
+
function e_defaultPrevented(e) {
|
1299 |
+
return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
|
1300 |
+
}
|
1301 |
+
function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
|
1302 |
+
|
1303 |
+
function e_target(e) {return e.target || e.srcElement}
|
1304 |
+
function e_button(e) {
|
1305 |
+
var b = e.which;
|
1306 |
+
if (b == null) {
|
1307 |
+
if (e.button & 1) { b = 1; }
|
1308 |
+
else if (e.button & 2) { b = 3; }
|
1309 |
+
else if (e.button & 4) { b = 2; }
|
1310 |
+
}
|
1311 |
+
if (mac && e.ctrlKey && b == 1) { b = 3; }
|
1312 |
+
return b
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
// Detect drag-and-drop
|
1316 |
+
var dragAndDrop = function() {
|
1317 |
+
// There is *some* kind of drag-and-drop support in IE6-8, but I
|
1318 |
+
// couldn't get it to work yet.
|
1319 |
+
if (ie && ie_version < 9) { return false }
|
1320 |
+
var div = elt('div');
|
1321 |
+
return "draggable" in div || "dragDrop" in div
|
1322 |
+
}();
|
1323 |
+
|
1324 |
+
var zwspSupported;
|
1325 |
+
function zeroWidthElement(measure) {
|
1326 |
+
if (zwspSupported == null) {
|
1327 |
+
var test = elt("span", "\u200b");
|
1328 |
+
removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
|
1329 |
+
if (measure.firstChild.offsetHeight != 0)
|
1330 |
+
{ zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
|
1331 |
+
}
|
1332 |
+
var node = zwspSupported ? elt("span", "\u200b") :
|
1333 |
+
elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
|
1334 |
+
node.setAttribute("cm-text", "");
|
1335 |
+
return node
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
// Feature-detect IE's crummy client rect reporting for bidi text
|
1339 |
+
var badBidiRects;
|
1340 |
+
function hasBadBidiRects(measure) {
|
1341 |
+
if (badBidiRects != null) { return badBidiRects }
|
1342 |
+
var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
|
1343 |
+
var r0 = range(txt, 0, 1).getBoundingClientRect();
|
1344 |
+
var r1 = range(txt, 1, 2).getBoundingClientRect();
|
1345 |
+
removeChildren(measure);
|
1346 |
+
if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
|
1347 |
+
return badBidiRects = (r1.right - r0.right < 3)
|
1348 |
+
}
|
1349 |
+
|
1350 |
+
// See if "".split is the broken IE version, if so, provide an
|
1351 |
+
// alternative way to split lines.
|
1352 |
+
var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
|
1353 |
+
var pos = 0, result = [], l = string.length;
|
1354 |
+
while (pos <= l) {
|
1355 |
+
var nl = string.indexOf("\n", pos);
|
1356 |
+
if (nl == -1) { nl = string.length; }
|
1357 |
+
var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
|
1358 |
+
var rt = line.indexOf("\r");
|
1359 |
+
if (rt != -1) {
|
1360 |
+
result.push(line.slice(0, rt));
|
1361 |
+
pos += rt + 1;
|
1362 |
+
} else {
|
1363 |
+
result.push(line);
|
1364 |
+
pos = nl + 1;
|
1365 |
+
}
|
1366 |
+
}
|
1367 |
+
return result
|
1368 |
+
} : function (string) { return string.split(/\r\n?|\n/); };
|
1369 |
+
|
1370 |
+
var hasSelection = window.getSelection ? function (te) {
|
1371 |
+
try { return te.selectionStart != te.selectionEnd }
|
1372 |
+
catch(e) { return false }
|
1373 |
+
} : function (te) {
|
1374 |
+
var range$$1;
|
1375 |
+
try {range$$1 = te.ownerDocument.selection.createRange();}
|
1376 |
+
catch(e) {}
|
1377 |
+
if (!range$$1 || range$$1.parentElement() != te) { return false }
|
1378 |
+
return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
|
1379 |
+
};
|
1380 |
+
|
1381 |
+
var hasCopyEvent = (function () {
|
1382 |
+
var e = elt("div");
|
1383 |
+
if ("oncopy" in e) { return true }
|
1384 |
+
e.setAttribute("oncopy", "return;");
|
1385 |
+
return typeof e.oncopy == "function"
|
1386 |
+
})();
|
1387 |
+
|
1388 |
+
var badZoomedRects = null;
|
1389 |
+
function hasBadZoomedRects(measure) {
|
1390 |
+
if (badZoomedRects != null) { return badZoomedRects }
|
1391 |
+
var node = removeChildrenAndAdd(measure, elt("span", "x"));
|
1392 |
+
var normal = node.getBoundingClientRect();
|
1393 |
+
var fromRange = range(node, 0, 1).getBoundingClientRect();
|
1394 |
+
return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
|
1395 |
+
}
|
1396 |
+
|
1397 |
+
// Known modes, by name and by MIME
|
1398 |
+
var modes = {};
|
1399 |
+
var mimeModes = {};
|
1400 |
+
|
1401 |
+
// Extra arguments are stored as the mode's dependencies, which is
|
1402 |
+
// used by (legacy) mechanisms like loadmode.js to automatically
|
1403 |
+
// load a mode. (Preferred mechanism is the require/define calls.)
|
1404 |
+
function defineMode(name, mode) {
|
1405 |
+
if (arguments.length > 2)
|
1406 |
+
{ mode.dependencies = Array.prototype.slice.call(arguments, 2); }
|
1407 |
+
modes[name] = mode;
|
1408 |
+
}
|
1409 |
+
|
1410 |
+
function defineMIME(mime, spec) {
|
1411 |
+
mimeModes[mime] = spec;
|
1412 |
+
}
|
1413 |
+
|
1414 |
+
// Given a MIME type, a {name, ...options} config object, or a name
|
1415 |
+
// string, return a mode config object.
|
1416 |
+
function resolveMode(spec) {
|
1417 |
+
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
|
1418 |
+
spec = mimeModes[spec];
|
1419 |
+
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
1420 |
+
var found = mimeModes[spec.name];
|
1421 |
+
if (typeof found == "string") { found = {name: found}; }
|
1422 |
+
spec = createObj(found, spec);
|
1423 |
+
spec.name = found.name;
|
1424 |
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
|
1425 |
+
return resolveMode("application/xml")
|
1426 |
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
|
1427 |
+
return resolveMode("application/json")
|
1428 |
+
}
|
1429 |
+
if (typeof spec == "string") { return {name: spec} }
|
1430 |
+
else { return spec || {name: "null"} }
|
1431 |
+
}
|
1432 |
+
|
1433 |
+
// Given a mode spec (anything that resolveMode accepts), find and
|
1434 |
+
// initialize an actual mode object.
|
1435 |
+
function getMode(options, spec) {
|
1436 |
+
spec = resolveMode(spec);
|
1437 |
+
var mfactory = modes[spec.name];
|
1438 |
+
if (!mfactory) { return getMode(options, "text/plain") }
|
1439 |
+
var modeObj = mfactory(options, spec);
|
1440 |
+
if (modeExtensions.hasOwnProperty(spec.name)) {
|
1441 |
+
var exts = modeExtensions[spec.name];
|
1442 |
+
for (var prop in exts) {
|
1443 |
+
if (!exts.hasOwnProperty(prop)) { continue }
|
1444 |
+
if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
|
1445 |
+
modeObj[prop] = exts[prop];
|
1446 |
+
}
|
1447 |
+
}
|
1448 |
+
modeObj.name = spec.name;
|
1449 |
+
if (spec.helperType) { modeObj.helperType = spec.helperType; }
|
1450 |
+
if (spec.modeProps) { for (var prop$1 in spec.modeProps)
|
1451 |
+
{ modeObj[prop$1] = spec.modeProps[prop$1]; } }
|
1452 |
+
|
1453 |
+
return modeObj
|
1454 |
+
}
|
1455 |
+
|
1456 |
+
// This can be used to attach properties to mode objects from
|
1457 |
+
// outside the actual mode definition.
|
1458 |
+
var modeExtensions = {};
|
1459 |
+
function extendMode(mode, properties) {
|
1460 |
+
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
|
1461 |
+
copyObj(properties, exts);
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
function copyState(mode, state) {
|
1465 |
+
if (state === true) { return state }
|
1466 |
+
if (mode.copyState) { return mode.copyState(state) }
|
1467 |
+
var nstate = {};
|
1468 |
+
for (var n in state) {
|
1469 |
+
var val = state[n];
|
1470 |
+
if (val instanceof Array) { val = val.concat([]); }
|
1471 |
+
nstate[n] = val;
|
1472 |
+
}
|
1473 |
+
return nstate
|
1474 |
+
}
|
1475 |
+
|
1476 |
+
// Given a mode and a state (for that mode), find the inner mode and
|
1477 |
+
// state at the position that the state refers to.
|
1478 |
+
function innerMode(mode, state) {
|
1479 |
+
var info;
|
1480 |
+
while (mode.innerMode) {
|
1481 |
+
info = mode.innerMode(state);
|
1482 |
+
if (!info || info.mode == mode) { break }
|
1483 |
+
state = info.state;
|
1484 |
+
mode = info.mode;
|
1485 |
+
}
|
1486 |
+
return info || {mode: mode, state: state}
|
1487 |
+
}
|
1488 |
+
|
1489 |
+
function startState(mode, a1, a2) {
|
1490 |
+
return mode.startState ? mode.startState(a1, a2) : true
|
1491 |
+
}
|
1492 |
+
|
1493 |
+
// STRING STREAM
|
1494 |
+
|
1495 |
+
// Fed to the mode parsers, provides helper functions to make
|
1496 |
+
// parsers more succinct.
|
1497 |
+
|
1498 |
+
var StringStream = function(string, tabSize) {
|
1499 |
+
this.pos = this.start = 0;
|
1500 |
+
this.string = string;
|
1501 |
+
this.tabSize = tabSize || 8;
|
1502 |
+
this.lastColumnPos = this.lastColumnValue = 0;
|
1503 |
+
this.lineStart = 0;
|
1504 |
+
};
|
1505 |
+
|
1506 |
+
StringStream.prototype.eol = function () {return this.pos >= this.string.length};
|
1507 |
+
StringStream.prototype.sol = function () {return this.pos == this.lineStart};
|
1508 |
+
StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
|
1509 |
+
StringStream.prototype.next = function () {
|
1510 |
+
if (this.pos < this.string.length)
|
1511 |
+
{ return this.string.charAt(this.pos++) }
|
1512 |
+
};
|
1513 |
+
StringStream.prototype.eat = function (match) {
|
1514 |
+
var ch = this.string.charAt(this.pos);
|
1515 |
+
var ok;
|
1516 |
+
if (typeof match == "string") { ok = ch == match; }
|
1517 |
+
else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
|
1518 |
+
if (ok) {++this.pos; return ch}
|
1519 |
+
};
|
1520 |
+
StringStream.prototype.eatWhile = function (match) {
|
1521 |
+
var start = this.pos;
|
1522 |
+
while (this.eat(match)){}
|
1523 |
+
return this.pos > start
|
1524 |
+
};
|
1525 |
+
StringStream.prototype.eatSpace = function () {
|
1526 |
+
var this$1 = this;
|
1527 |
+
|
1528 |
+
var start = this.pos;
|
1529 |
+
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
|
1530 |
+
return this.pos > start
|
1531 |
+
};
|
1532 |
+
StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
|
1533 |
+
StringStream.prototype.skipTo = function (ch) {
|
1534 |
+
var found = this.string.indexOf(ch, this.pos);
|
1535 |
+
if (found > -1) {this.pos = found; return true}
|
1536 |
+
};
|
1537 |
+
StringStream.prototype.backUp = function (n) {this.pos -= n;};
|
1538 |
+
StringStream.prototype.column = function () {
|
1539 |
+
if (this.lastColumnPos < this.start) {
|
1540 |
+
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
|
1541 |
+
this.lastColumnPos = this.start;
|
1542 |
+
}
|
1543 |
+
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
1544 |
+
};
|
1545 |
+
StringStream.prototype.indentation = function () {
|
1546 |
+
return countColumn(this.string, null, this.tabSize) -
|
1547 |
+
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
1548 |
+
};
|
1549 |
+
StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
|
1550 |
+
if (typeof pattern == "string") {
|
1551 |
+
var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
|
1552 |
+
var substr = this.string.substr(this.pos, pattern.length);
|
1553 |
+
if (cased(substr) == cased(pattern)) {
|
1554 |
+
if (consume !== false) { this.pos += pattern.length; }
|
1555 |
+
return true
|
1556 |
+
}
|
1557 |
+
} else {
|
1558 |
+
var match = this.string.slice(this.pos).match(pattern);
|
1559 |
+
if (match && match.index > 0) { return null }
|
1560 |
+
if (match && consume !== false) { this.pos += match[0].length; }
|
1561 |
+
return match
|
1562 |
+
}
|
1563 |
+
};
|
1564 |
+
StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
|
1565 |
+
StringStream.prototype.hideFirstChars = function (n, inner) {
|
1566 |
+
this.lineStart += n;
|
1567 |
+
try { return inner() }
|
1568 |
+
finally { this.lineStart -= n; }
|
1569 |
+
};
|
1570 |
+
|
1571 |
+
// Compute a style array (an array starting with a mode generation
|
1572 |
+
// -- for invalidation -- followed by pairs of end positions and
|
1573 |
+
// style strings), which is used to highlight the tokens on the
|
1574 |
+
// line.
|
1575 |
+
function highlightLine(cm, line, state, forceToEnd) {
|
1576 |
+
// A styles array always starts with a number identifying the
|
1577 |
+
// mode/overlays that it is based on (for easy invalidation).
|
1578 |
+
var st = [cm.state.modeGen], lineClasses = {};
|
1579 |
+
// Compute the base array of styles
|
1580 |
+
runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },
|
1581 |
+
lineClasses, forceToEnd);
|
1582 |
+
|
1583 |
+
// Run overlays, adjust style array.
|
1584 |
+
var loop = function ( o ) {
|
1585 |
+
var overlay = cm.state.overlays[o], i = 1, at = 0;
|
1586 |
+
runMode(cm, line.text, overlay.mode, true, function (end, style) {
|
1587 |
+
var start = i;
|
1588 |
+
// Ensure there's a token end at the current position, and that i points at it
|
1589 |
+
while (at < end) {
|
1590 |
+
var i_end = st[i];
|
1591 |
+
if (i_end > end)
|
1592 |
+
{ st.splice(i, 1, end, st[i+1], i_end); }
|
1593 |
+
i += 2;
|
1594 |
+
at = Math.min(end, i_end);
|
1595 |
+
}
|
1596 |
+
if (!style) { return }
|
1597 |
+
if (overlay.opaque) {
|
1598 |
+
st.splice(start, i - start, end, "overlay " + style);
|
1599 |
+
i = start + 2;
|
1600 |
+
} else {
|
1601 |
+
for (; start < i; start += 2) {
|
1602 |
+
var cur = st[start+1];
|
1603 |
+
st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
|
1604 |
+
}
|
1605 |
+
}
|
1606 |
+
}, lineClasses);
|
1607 |
+
};
|
1608 |
+
|
1609 |
+
for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
|
1610 |
+
|
1611 |
+
return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
|
1612 |
+
}
|
1613 |
+
|
1614 |
+
function getLineStyles(cm, line, updateFrontier) {
|
1615 |
+
if (!line.styles || line.styles[0] != cm.state.modeGen) {
|
1616 |
+
var state = getStateBefore(cm, lineNo(line));
|
1617 |
+
var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);
|
1618 |
+
line.stateAfter = state;
|
1619 |
+
line.styles = result.styles;
|
1620 |
+
if (result.classes) { line.styleClasses = result.classes; }
|
1621 |
+
else if (line.styleClasses) { line.styleClasses = null; }
|
1622 |
+
if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++; }
|
1623 |
+
}
|
1624 |
+
return line.styles
|
1625 |
+
}
|
1626 |
+
|
1627 |
+
function getStateBefore(cm, n, precise) {
|
1628 |
+
var doc = cm.doc, display = cm.display;
|
1629 |
+
if (!doc.mode.startState) { return true }
|
1630 |
+
var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
|
1631 |
+
if (!state) { state = startState(doc.mode); }
|
1632 |
+
else { state = copyState(doc.mode, state); }
|
1633 |
+
doc.iter(pos, n, function (line) {
|
1634 |
+
processLine(cm, line.text, state);
|
1635 |
+
var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
|
1636 |
+
line.stateAfter = save ? copyState(doc.mode, state) : null;
|
1637 |
+
++pos;
|
1638 |
+
});
|
1639 |
+
if (precise) { doc.frontier = pos; }
|
1640 |
+
return state
|
1641 |
+
}
|
1642 |
+
|
1643 |
+
// Lightweight form of highlight -- proceed over this line and
|
1644 |
+
// update state, but don't save a style array. Used for lines that
|
1645 |
+
// aren't currently visible.
|
1646 |
+
function processLine(cm, text, state, startAt) {
|
1647 |
+
var mode = cm.doc.mode;
|
1648 |
+
var stream = new StringStream(text, cm.options.tabSize);
|
1649 |
+
stream.start = stream.pos = startAt || 0;
|
1650 |
+
if (text == "") { callBlankLine(mode, state); }
|
1651 |
+
while (!stream.eol()) {
|
1652 |
+
readToken(mode, stream, state);
|
1653 |
+
stream.start = stream.pos;
|
1654 |
+
}
|
1655 |
+
}
|
1656 |
+
|
1657 |
+
function callBlankLine(mode, state) {
|
1658 |
+
if (mode.blankLine) { return mode.blankLine(state) }
|
1659 |
+
if (!mode.innerMode) { return }
|
1660 |
+
var inner = innerMode(mode, state);
|
1661 |
+
if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
|
1662 |
+
}
|
1663 |
+
|
1664 |
+
function readToken(mode, stream, state, inner) {
|
1665 |
+
for (var i = 0; i < 10; i++) {
|
1666 |
+
if (inner) { inner[0] = innerMode(mode, state).mode; }
|
1667 |
+
var style = mode.token(stream, state);
|
1668 |
+
if (stream.pos > stream.start) { return style }
|
1669 |
+
}
|
1670 |
+
throw new Error("Mode " + mode.name + " failed to advance stream.")
|
1671 |
+
}
|
1672 |
+
|
1673 |
+
// Utility for getTokenAt and getLineTokens
|
1674 |
+
function takeToken(cm, pos, precise, asArray) {
|
1675 |
+
var getObj = function (copy) { return ({
|
1676 |
+
start: stream.start, end: stream.pos,
|
1677 |
+
string: stream.current(),
|
1678 |
+
type: style || null,
|
1679 |
+
state: copy ? copyState(doc.mode, state) : state
|
1680 |
+
}); };
|
1681 |
+
|
1682 |
+
var doc = cm.doc, mode = doc.mode, style;
|
1683 |
+
pos = clipPos(doc, pos);
|
1684 |
+
var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);
|
1685 |
+
var stream = new StringStream(line.text, cm.options.tabSize), tokens;
|
1686 |
+
if (asArray) { tokens = []; }
|
1687 |
+
while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
|
1688 |
+
stream.start = stream.pos;
|
1689 |
+
style = readToken(mode, stream, state);
|
1690 |
+
if (asArray) { tokens.push(getObj(true)); }
|
1691 |
+
}
|
1692 |
+
return asArray ? tokens : getObj()
|
1693 |
+
}
|
1694 |
+
|
1695 |
+
function extractLineClasses(type, output) {
|
1696 |
+
if (type) { for (;;) {
|
1697 |
+
var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
|
1698 |
+
if (!lineClass) { break }
|
1699 |
+
type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
|
1700 |
+
var prop = lineClass[1] ? "bgClass" : "textClass";
|
1701 |
+
if (output[prop] == null)
|
1702 |
+
{ output[prop] = lineClass[2]; }
|
1703 |
+
else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
|
1704 |
+
{ output[prop] += " " + lineClass[2]; }
|
1705 |
+
} }
|
1706 |
+
return type
|
1707 |
+
}
|
1708 |
+
|
1709 |
+
// Run the given mode's parser over a line, calling f for each token.
|
1710 |
+
function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
|
1711 |
+
var flattenSpans = mode.flattenSpans;
|
1712 |
+
if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
|
1713 |
+
var curStart = 0, curStyle = null;
|
1714 |
+
var stream = new StringStream(text, cm.options.tabSize), style;
|
1715 |
+
var inner = cm.options.addModeClass && [null];
|
1716 |
+
if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses); }
|
1717 |
+
while (!stream.eol()) {
|
1718 |
+
if (stream.pos > cm.options.maxHighlightLength) {
|
1719 |
+
flattenSpans = false;
|
1720 |
+
if (forceToEnd) { processLine(cm, text, state, stream.pos); }
|
1721 |
+
stream.pos = text.length;
|
1722 |
+
style = null;
|
1723 |
+
} else {
|
1724 |
+
style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);
|
1725 |
+
}
|
1726 |
+
if (inner) {
|
1727 |
+
var mName = inner[0].name;
|
1728 |
+
if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
|
1729 |
+
}
|
1730 |
+
if (!flattenSpans || curStyle != style) {
|
1731 |
+
while (curStart < stream.start) {
|
1732 |
+
curStart = Math.min(stream.start, curStart + 5000);
|
1733 |
+
f(curStart, curStyle);
|
1734 |
+
}
|
1735 |
+
curStyle = style;
|
1736 |
+
}
|
1737 |
+
stream.start = stream.pos;
|
1738 |
+
}
|
1739 |
+
while (curStart < stream.pos) {
|
1740 |
+
// Webkit seems to refuse to render text nodes longer than 57444
|
1741 |
+
// characters, and returns inaccurate measurements in nodes
|
1742 |
+
// starting around 5000 chars.
|
1743 |
+
var pos = Math.min(stream.pos, curStart + 5000);
|
1744 |
+
f(pos, curStyle);
|
1745 |
+
curStart = pos;
|
1746 |
+
}
|
1747 |
+
}
|
1748 |
+
|
1749 |
+
// Finds the line to start with when starting a parse. Tries to
|
1750 |
+
// find a line with a stateAfter, so that it can start with a
|
1751 |
+
// valid state. If that fails, it returns the line with the
|
1752 |
+
// smallest indentation, which tends to need the least context to
|
1753 |
+
// parse correctly.
|
1754 |
+
function findStartLine(cm, n, precise) {
|
1755 |
+
var minindent, minline, doc = cm.doc;
|
1756 |
+
var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
|
1757 |
+
for (var search = n; search > lim; --search) {
|
1758 |
+
if (search <= doc.first) { return doc.first }
|
1759 |
+
var line = getLine(doc, search - 1);
|
1760 |
+
if (line.stateAfter && (!precise || search <= doc.frontier)) { return search }
|
1761 |
+
var indented = countColumn(line.text, null, cm.options.tabSize);
|
1762 |
+
if (minline == null || minindent > indented) {
|
1763 |
+
minline = search - 1;
|
1764 |
+
minindent = indented;
|
1765 |
+
}
|
1766 |
+
}
|
1767 |
+
return minline
|
1768 |
+
}
|
1769 |
+
|
1770 |
+
// LINE DATA STRUCTURE
|
1771 |
+
|
1772 |
+
// Line objects. These hold state related to a line, including
|
1773 |
+
// highlighting info (the styles array).
|
1774 |
+
var Line = function(text, markedSpans, estimateHeight) {
|
1775 |
+
this.text = text;
|
1776 |
+
attachMarkedSpans(this, markedSpans);
|
1777 |
+
this.height = estimateHeight ? estimateHeight(this) : 1;
|
1778 |
+
};
|
1779 |
+
|
1780 |
+
Line.prototype.lineNo = function () { return lineNo(this) };
|
1781 |
+
eventMixin(Line);
|
1782 |
+
|
1783 |
+
// Change the content (text, markers) of a line. Automatically
|
1784 |
+
// invalidates cached information and tries to re-estimate the
|
1785 |
+
// line's height.
|
1786 |
+
function updateLine(line, text, markedSpans, estimateHeight) {
|
1787 |
+
line.text = text;
|
1788 |
+
if (line.stateAfter) { line.stateAfter = null; }
|
1789 |
+
if (line.styles) { line.styles = null; }
|
1790 |
+
if (line.order != null) { line.order = null; }
|
1791 |
+
detachMarkedSpans(line);
|
1792 |
+
attachMarkedSpans(line, markedSpans);
|
1793 |
+
var estHeight = estimateHeight ? estimateHeight(line) : 1;
|
1794 |
+
if (estHeight != line.height) { updateLineHeight(line, estHeight); }
|
1795 |
+
}
|
1796 |
+
|
1797 |
+
// Detach a line from the document tree and its markers.
|
1798 |
+
function cleanUpLine(line) {
|
1799 |
+
line.parent = null;
|
1800 |
+
detachMarkedSpans(line);
|
1801 |
+
}
|
1802 |
+
|
1803 |
+
// Convert a style as returned by a mode (either null, or a string
|
1804 |
+
// containing one or more styles) to a CSS style. This is cached,
|
1805 |
+
// and also looks for line-wide styles.
|
1806 |
+
var styleToClassCache = {};
|
1807 |
+
var styleToClassCacheWithMode = {};
|
1808 |
+
function interpretTokenStyle(style, options) {
|
1809 |
+
if (!style || /^\s*$/.test(style)) { return null }
|
1810 |
+
var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
|
1811 |
+
return cache[style] ||
|
1812 |
+
(cache[style] = style.replace(/\S+/g, "cm-$&"))
|
1813 |
+
}
|
1814 |
+
|
1815 |
+
// Render the DOM representation of the text of a line. Also builds
|
1816 |
+
// up a 'line map', which points at the DOM nodes that represent
|
1817 |
+
// specific stretches of text, and is used by the measuring code.
|
1818 |
+
// The returned object contains the DOM node, this map, and
|
1819 |
+
// information about line-wide styles that were set by the mode.
|
1820 |
+
function buildLineContent(cm, lineView) {
|
1821 |
+
// The padding-right forces the element to have a 'border', which
|
1822 |
+
// is needed on Webkit to be able to get line-level bounding
|
1823 |
+
// rectangles for it (in measureChar).
|
1824 |
+
var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
|
1825 |
+
var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
|
1826 |
+
col: 0, pos: 0, cm: cm,
|
1827 |
+
trailingSpace: false,
|
1828 |
+
splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")};
|
1829 |
+
lineView.measure = {};
|
1830 |
+
|
1831 |
+
// Iterate over the logical lines that make up this visual line.
|
1832 |
+
for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
|
1833 |
+
var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
|
1834 |
+
builder.pos = 0;
|
1835 |
+
builder.addToken = buildToken;
|
1836 |
+
// Optionally wire in some hacks into the token-rendering
|
1837 |
+
// algorithm, to deal with browser quirks.
|
1838 |
+
if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
|
1839 |
+
{ builder.addToken = buildTokenBadBidi(builder.addToken, order); }
|
1840 |
+
builder.map = [];
|
1841 |
+
var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
|
1842 |
+
insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
|
1843 |
+
if (line.styleClasses) {
|
1844 |
+
if (line.styleClasses.bgClass)
|
1845 |
+
{ builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
|
1846 |
+
if (line.styleClasses.textClass)
|
1847 |
+
{ builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
|
1848 |
+
}
|
1849 |
+
|
1850 |
+
// Ensure at least a single node is present, for measuring.
|
1851 |
+
if (builder.map.length == 0)
|
1852 |
+
{ builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
|
1853 |
+
|
1854 |
+
// Store the map and a cache object for the current logical line
|
1855 |
+
if (i == 0) {
|
1856 |
+
lineView.measure.map = builder.map;
|
1857 |
+
lineView.measure.cache = {};
|
1858 |
+
} else {
|
1859 |
+
(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
|
1860 |
+
;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
|
1861 |
+
}
|
1862 |
+
}
|
1863 |
+
|
1864 |
+
// See issue #2901
|
1865 |
+
if (webkit) {
|
1866 |
+
var last = builder.content.lastChild;
|
1867 |
+
if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
|
1868 |
+
{ builder.content.className = "cm-tab-wrap-hack"; }
|
1869 |
+
}
|
1870 |
+
|
1871 |
+
signal(cm, "renderLine", cm, lineView.line, builder.pre);
|
1872 |
+
if (builder.pre.className)
|
1873 |
+
{ builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
|
1874 |
+
|
1875 |
+
return builder
|
1876 |
+
}
|
1877 |
+
|
1878 |
+
function defaultSpecialCharPlaceholder(ch) {
|
1879 |
+
var token = elt("span", "\u2022", "cm-invalidchar");
|
1880 |
+
token.title = "\\u" + ch.charCodeAt(0).toString(16);
|
1881 |
+
token.setAttribute("aria-label", token.title);
|
1882 |
+
return token
|
1883 |
+
}
|
1884 |
+
|
1885 |
+
// Build up the DOM representation for a single token, and add it to
|
1886 |
+
// the line map. Takes care to render special characters separately.
|
1887 |
+
function buildToken(builder, text, style, startStyle, endStyle, title, css) {
|
1888 |
+
if (!text) { return }
|
1889 |
+
var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
|
1890 |
+
var special = builder.cm.state.specialChars, mustWrap = false;
|
1891 |
+
var content;
|
1892 |
+
if (!special.test(text)) {
|
1893 |
+
builder.col += text.length;
|
1894 |
+
content = document.createTextNode(displayText);
|
1895 |
+
builder.map.push(builder.pos, builder.pos + text.length, content);
|
1896 |
+
if (ie && ie_version < 9) { mustWrap = true; }
|
1897 |
+
builder.pos += text.length;
|
1898 |
+
} else {
|
1899 |
+
content = document.createDocumentFragment();
|
1900 |
+
var pos = 0;
|
1901 |
+
while (true) {
|
1902 |
+
special.lastIndex = pos;
|
1903 |
+
var m = special.exec(text);
|
1904 |
+
var skipped = m ? m.index - pos : text.length - pos;
|
1905 |
+
if (skipped) {
|
1906 |
+
var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
|
1907 |
+
if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
|
1908 |
+
else { content.appendChild(txt); }
|
1909 |
+
builder.map.push(builder.pos, builder.pos + skipped, txt);
|
1910 |
+
builder.col += skipped;
|
1911 |
+
builder.pos += skipped;
|
1912 |
+
}
|
1913 |
+
if (!m) { break }
|
1914 |
+
pos += skipped + 1;
|
1915 |
+
var txt$1 = (void 0);
|
1916 |
+
if (m[0] == "\t") {
|
1917 |
+
var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
|
1918 |
+
txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
|
1919 |
+
txt$1.setAttribute("role", "presentation");
|
1920 |
+
txt$1.setAttribute("cm-text", "\t");
|
1921 |
+
builder.col += tabWidth;
|
1922 |
+
} else if (m[0] == "\r" || m[0] == "\n") {
|
1923 |
+
txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
|
1924 |
+
txt$1.setAttribute("cm-text", m[0]);
|
1925 |
+
builder.col += 1;
|
1926 |
+
} else {
|
1927 |
+
txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
|
1928 |
+
txt$1.setAttribute("cm-text", m[0]);
|
1929 |
+
if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
|
1930 |
+
else { content.appendChild(txt$1); }
|
1931 |
+
builder.col += 1;
|
1932 |
+
}
|
1933 |
+
builder.map.push(builder.pos, builder.pos + 1, txt$1);
|
1934 |
+
builder.pos++;
|
1935 |
+
}
|
1936 |
+
}
|
1937 |
+
builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
|
1938 |
+
if (style || startStyle || endStyle || mustWrap || css) {
|
1939 |
+
var fullStyle = style || "";
|
1940 |
+
if (startStyle) { fullStyle += startStyle; }
|
1941 |
+
if (endStyle) { fullStyle += endStyle; }
|
1942 |
+
var token = elt("span", [content], fullStyle, css);
|
1943 |
+
if (title) { token.title = title; }
|
1944 |
+
return builder.content.appendChild(token)
|
1945 |
+
}
|
1946 |
+
builder.content.appendChild(content);
|
1947 |
+
}
|
1948 |
+
|
1949 |
+
function splitSpaces(text, trailingBefore) {
|
1950 |
+
if (text.length > 1 && !/ /.test(text)) { return text }
|
1951 |
+
var spaceBefore = trailingBefore, result = "";
|
1952 |
+
for (var i = 0; i < text.length; i++) {
|
1953 |
+
var ch = text.charAt(i);
|
1954 |
+
if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
|
1955 |
+
{ ch = "\u00a0"; }
|
1956 |
+
result += ch;
|
1957 |
+
spaceBefore = ch == " ";
|
1958 |
+
}
|
1959 |
+
return result
|
1960 |
+
}
|
1961 |
+
|
1962 |
+
// Work around nonsense dimensions being reported for stretches of
|
1963 |
+
// right-to-left text.
|
1964 |
+
function buildTokenBadBidi(inner, order) {
|
1965 |
+
return function (builder, text, style, startStyle, endStyle, title, css) {
|
1966 |
+
style = style ? style + " cm-force-border" : "cm-force-border";
|
1967 |
+
var start = builder.pos, end = start + text.length;
|
1968 |
+
for (;;) {
|
1969 |
+
// Find the part that overlaps with the start of this text
|
1970 |
+
var part = (void 0);
|
1971 |
+
for (var i = 0; i < order.length; i++) {
|
1972 |
+
part = order[i];
|
1973 |
+
if (part.to > start && part.from <= start) { break }
|
1974 |
+
}
|
1975 |
+
if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
|
1976 |
+
inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);
|
1977 |
+
startStyle = null;
|
1978 |
+
text = text.slice(part.to - start);
|
1979 |
+
start = part.to;
|
1980 |
+
}
|
1981 |
+
}
|
1982 |
+
}
|
1983 |
+
|
1984 |
+
function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
|
1985 |
+
var widget = !ignoreWidget && marker.widgetNode;
|
1986 |
+
if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
|
1987 |
+
if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
|
1988 |
+
if (!widget)
|
1989 |
+
{ widget = builder.content.appendChild(document.createElement("span")); }
|
1990 |
+
widget.setAttribute("cm-marker", marker.id);
|
1991 |
+
}
|
1992 |
+
if (widget) {
|
1993 |
+
builder.cm.display.input.setUneditable(widget);
|
1994 |
+
builder.content.appendChild(widget);
|
1995 |
+
}
|
1996 |
+
builder.pos += size;
|
1997 |
+
builder.trailingSpace = false;
|
1998 |
+
}
|
1999 |
+
|
2000 |
+
// Outputs a number of spans to make up a line, taking highlighting
|
2001 |
+
// and marked text into account.
|
2002 |
+
function insertLineContent(line, builder, styles) {
|
2003 |
+
var spans = line.markedSpans, allText = line.text, at = 0;
|
2004 |
+
if (!spans) {
|
2005 |
+
for (var i$1 = 1; i$1 < styles.length; i$1+=2)
|
2006 |
+
{ builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
|
2007 |
+
return
|
2008 |
+
}
|
2009 |
+
|
2010 |
+
var len = allText.length, pos = 0, i = 1, text = "", style, css;
|
2011 |
+
var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
|
2012 |
+
for (;;) {
|
2013 |
+
if (nextChange == pos) { // Update current marker set
|
2014 |
+
spanStyle = spanEndStyle = spanStartStyle = title = css = "";
|
2015 |
+
collapsed = null; nextChange = Infinity;
|
2016 |
+
var foundBookmarks = [], endStyles = (void 0);
|
2017 |
+
for (var j = 0; j < spans.length; ++j) {
|
2018 |
+
var sp = spans[j], m = sp.marker;
|
2019 |
+
if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
|
2020 |
+
foundBookmarks.push(m);
|
2021 |
+
} else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
|
2022 |
+
if (sp.to != null && sp.to != pos && nextChange > sp.to) {
|
2023 |
+
nextChange = sp.to;
|
2024 |
+
spanEndStyle = "";
|
2025 |
+
}
|
2026 |
+
if (m.className) { spanStyle += " " + m.className; }
|
2027 |
+
if (m.css) { css = (css ? css + ";" : "") + m.css; }
|
2028 |
+
if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
|
2029 |
+
if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
|
2030 |
+
if (m.title && !title) { title = m.title; }
|
2031 |
+
if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
|
2032 |
+
{ collapsed = sp; }
|
2033 |
+
} else if (sp.from > pos && nextChange > sp.from) {
|
2034 |
+
nextChange = sp.from;
|
2035 |
+
}
|
2036 |
+
}
|
2037 |
+
if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
|
2038 |
+
{ if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
|
2039 |
+
|
2040 |
+
if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
|
2041 |
+
{ buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
|
2042 |
+
if (collapsed && (collapsed.from || 0) == pos) {
|
2043 |
+
buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
|
2044 |
+
collapsed.marker, collapsed.from == null);
|
2045 |
+
if (collapsed.to == null) { return }
|
2046 |
+
if (collapsed.to == pos) { collapsed = false; }
|
2047 |
+
}
|
2048 |
+
}
|
2049 |
+
if (pos >= len) { break }
|
2050 |
+
|
2051 |
+
var upto = Math.min(len, nextChange);
|
2052 |
+
while (true) {
|
2053 |
+
if (text) {
|
2054 |
+
var end = pos + text.length;
|
2055 |
+
if (!collapsed) {
|
2056 |
+
var tokenText = end > upto ? text.slice(0, upto - pos) : text;
|
2057 |
+
builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
|
2058 |
+
spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css);
|
2059 |
+
}
|
2060 |
+
if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
|
2061 |
+
pos = end;
|
2062 |
+
spanStartStyle = "";
|
2063 |
+
}
|
2064 |
+
text = allText.slice(at, at = styles[i++]);
|
2065 |
+
style = interpretTokenStyle(styles[i++], builder.cm.options);
|
2066 |
+
}
|
2067 |
+
}
|
2068 |
+
}
|
2069 |
+
|
2070 |
+
|
2071 |
+
// These objects are used to represent the visible (currently drawn)
|
2072 |
+
// part of the document. A LineView may correspond to multiple
|
2073 |
+
// logical lines, if those are connected by collapsed ranges.
|
2074 |
+
function LineView(doc, line, lineN) {
|
2075 |
+
// The starting line
|
2076 |
+
this.line = line;
|
2077 |
+
// Continuing lines, if any
|
2078 |
+
this.rest = visualLineContinued(line);
|
2079 |
+
// Number of logical lines in this visual line
|
2080 |
+
this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
|
2081 |
+
this.node = this.text = null;
|
2082 |
+
this.hidden = lineIsHidden(doc, line);
|
2083 |
+
}
|
2084 |
+
|
2085 |
+
// Create a range of LineView objects for the given lines.
|
2086 |
+
function buildViewArray(cm, from, to) {
|
2087 |
+
var array = [], nextPos;
|
2088 |
+
for (var pos = from; pos < to; pos = nextPos) {
|
2089 |
+
var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
|
2090 |
+
nextPos = pos + view.size;
|
2091 |
+
array.push(view);
|
2092 |
+
}
|
2093 |
+
return array
|
2094 |
+
}
|
2095 |
+
|
2096 |
+
var operationGroup = null;
|
2097 |
+
|
2098 |
+
function pushOperation(op) {
|
2099 |
+
if (operationGroup) {
|
2100 |
+
operationGroup.ops.push(op);
|
2101 |
+
} else {
|
2102 |
+
op.ownsGroup = operationGroup = {
|
2103 |
+
ops: [op],
|
2104 |
+
delayedCallbacks: []
|
2105 |
+
};
|
2106 |
+
}
|
2107 |
+
}
|
2108 |
+
|
2109 |
+
function fireCallbacksForOps(group) {
|
2110 |
+
// Calls delayed callbacks and cursorActivity handlers until no
|
2111 |
+
// new ones appear
|
2112 |
+
var callbacks = group.delayedCallbacks, i = 0;
|
2113 |
+
do {
|
2114 |
+
for (; i < callbacks.length; i++)
|
2115 |
+
{ callbacks[i].call(null); }
|
2116 |
+
for (var j = 0; j < group.ops.length; j++) {
|
2117 |
+
var op = group.ops[j];
|
2118 |
+
if (op.cursorActivityHandlers)
|
2119 |
+
{ while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
|
2120 |
+
{ op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
|
2121 |
+
}
|
2122 |
+
} while (i < callbacks.length)
|
2123 |
+
}
|
2124 |
+
|
2125 |
+
function finishOperation(op, endCb) {
|
2126 |
+
var group = op.ownsGroup;
|
2127 |
+
if (!group) { return }
|
2128 |
+
|
2129 |
+
try { fireCallbacksForOps(group); }
|
2130 |
+
finally {
|
2131 |
+
operationGroup = null;
|
2132 |
+
endCb(group);
|
2133 |
+
}
|
2134 |
+
}
|
2135 |
+
|
2136 |
+
var orphanDelayedCallbacks = null;
|
2137 |
+
|
2138 |
+
// Often, we want to signal events at a point where we are in the
|
2139 |
+
// middle of some work, but don't want the handler to start calling
|
2140 |
+
// other methods on the editor, which might be in an inconsistent
|
2141 |
+
// state or simply not expect any other events to happen.
|
2142 |
+
// signalLater looks whether there are any handlers, and schedules
|
2143 |
+
// them to be executed when the last operation ends, or, if no
|
2144 |
+
// operation is active, when a timeout fires.
|
2145 |
+
function signalLater(emitter, type /*, values...*/) {
|
2146 |
+
var arr = getHandlers(emitter, type);
|
2147 |
+
if (!arr.length) { return }
|
2148 |
+
var args = Array.prototype.slice.call(arguments, 2), list;
|
2149 |
+
if (operationGroup) {
|
2150 |
+
list = operationGroup.delayedCallbacks;
|
2151 |
+
} else if (orphanDelayedCallbacks) {
|
2152 |
+
list = orphanDelayedCallbacks;
|
2153 |
+
} else {
|
2154 |
+
list = orphanDelayedCallbacks = [];
|
2155 |
+
setTimeout(fireOrphanDelayed, 0);
|
2156 |
+
}
|
2157 |
+
var loop = function ( i ) {
|
2158 |
+
list.push(function () { return arr[i].apply(null, args); });
|
2159 |
+
};
|
2160 |
+
|
2161 |
+
for (var i = 0; i < arr.length; ++i)
|
2162 |
+
loop( i );
|
2163 |
+
}
|
2164 |
+
|
2165 |
+
function fireOrphanDelayed() {
|
2166 |
+
var delayed = orphanDelayedCallbacks;
|
2167 |
+
orphanDelayedCallbacks = null;
|
2168 |
+
for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
|
2169 |
+
}
|
2170 |
+
|
2171 |
+
// When an aspect of a line changes, a string is added to
|
2172 |
+
// lineView.changes. This updates the relevant part of the line's
|
2173 |
+
// DOM structure.
|
2174 |
+
function updateLineForChanges(cm, lineView, lineN, dims) {
|
2175 |
+
for (var j = 0; j < lineView.changes.length; j++) {
|
2176 |
+
var type = lineView.changes[j];
|
2177 |
+
if (type == "text") { updateLineText(cm, lineView); }
|
2178 |
+
else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
|
2179 |
+
else if (type == "class") { updateLineClasses(cm, lineView); }
|
2180 |
+
else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
|
2181 |
+
}
|
2182 |
+
lineView.changes = null;
|
2183 |
+
}
|
2184 |
+
|
2185 |
+
// Lines with gutter elements, widgets or a background class need to
|
2186 |
+
// be wrapped, and have the extra elements added to the wrapper div
|
2187 |
+
function ensureLineWrapped(lineView) {
|
2188 |
+
if (lineView.node == lineView.text) {
|
2189 |
+
lineView.node = elt("div", null, null, "position: relative");
|
2190 |
+
if (lineView.text.parentNode)
|
2191 |
+
{ lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
|
2192 |
+
lineView.node.appendChild(lineView.text);
|
2193 |
+
if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
|
2194 |
+
}
|
2195 |
+
return lineView.node
|
2196 |
+
}
|
2197 |
+
|
2198 |
+
function updateLineBackground(cm, lineView) {
|
2199 |
+
var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
|
2200 |
+
if (cls) { cls += " CodeMirror-linebackground"; }
|
2201 |
+
if (lineView.background) {
|
2202 |
+
if (cls) { lineView.background.className = cls; }
|
2203 |
+
else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
|
2204 |
+
} else if (cls) {
|
2205 |
+
var wrap = ensureLineWrapped(lineView);
|
2206 |
+
lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
|
2207 |
+
cm.display.input.setUneditable(lineView.background);
|
2208 |
+
}
|
2209 |
+
}
|
2210 |
+
|
2211 |
+
// Wrapper around buildLineContent which will reuse the structure
|
2212 |
+
// in display.externalMeasured when possible.
|
2213 |
+
function getLineContent(cm, lineView) {
|
2214 |
+
var ext = cm.display.externalMeasured;
|
2215 |
+
if (ext && ext.line == lineView.line) {
|
2216 |
+
cm.display.externalMeasured = null;
|
2217 |
+
lineView.measure = ext.measure;
|
2218 |
+
return ext.built
|
2219 |
+
}
|
2220 |
+
return buildLineContent(cm, lineView)
|
2221 |
+
}
|
2222 |
+
|
2223 |
+
// Redraw the line's text. Interacts with the background and text
|
2224 |
+
// classes because the mode may output tokens that influence these
|
2225 |
+
// classes.
|
2226 |
+
function updateLineText(cm, lineView) {
|
2227 |
+
var cls = lineView.text.className;
|
2228 |
+
var built = getLineContent(cm, lineView);
|
2229 |
+
if (lineView.text == lineView.node) { lineView.node = built.pre; }
|
2230 |
+
lineView.text.parentNode.replaceChild(built.pre, lineView.text);
|
2231 |
+
lineView.text = built.pre;
|
2232 |
+
if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
|
2233 |
+
lineView.bgClass = built.bgClass;
|
2234 |
+
lineView.textClass = built.textClass;
|
2235 |
+
updateLineClasses(cm, lineView);
|
2236 |
+
} else if (cls) {
|
2237 |
+
lineView.text.className = cls;
|
2238 |
+
}
|
2239 |
+
}
|
2240 |
+
|
2241 |
+
function updateLineClasses(cm, lineView) {
|
2242 |
+
updateLineBackground(cm, lineView);
|
2243 |
+
if (lineView.line.wrapClass)
|
2244 |
+
{ ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
|
2245 |
+
else if (lineView.node != lineView.text)
|
2246 |
+
{ lineView.node.className = ""; }
|
2247 |
+
var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
|
2248 |
+
lineView.text.className = textClass || "";
|
2249 |
+
}
|
2250 |
+
|
2251 |
+
function updateLineGutter(cm, lineView, lineN, dims) {
|
2252 |
+
if (lineView.gutter) {
|
2253 |
+
lineView.node.removeChild(lineView.gutter);
|
2254 |
+
lineView.gutter = null;
|
2255 |
+
}
|
2256 |
+
if (lineView.gutterBackground) {
|
2257 |
+
lineView.node.removeChild(lineView.gutterBackground);
|
2258 |
+
lineView.gutterBackground = null;
|
2259 |
+
}
|
2260 |
+
if (lineView.line.gutterClass) {
|
2261 |
+
var wrap = ensureLineWrapped(lineView);
|
2262 |
+
lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
|
2263 |
+
("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
|
2264 |
+
cm.display.input.setUneditable(lineView.gutterBackground);
|
2265 |
+
wrap.insertBefore(lineView.gutterBackground, lineView.text);
|
2266 |
+
}
|
2267 |
+
var markers = lineView.line.gutterMarkers;
|
2268 |
+
if (cm.options.lineNumbers || markers) {
|
2269 |
+
var wrap$1 = ensureLineWrapped(lineView);
|
2270 |
+
var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
|
2271 |
+
cm.display.input.setUneditable(gutterWrap);
|
2272 |
+
wrap$1.insertBefore(gutterWrap, lineView.text);
|
2273 |
+
if (lineView.line.gutterClass)
|
2274 |
+
{ gutterWrap.className += " " + lineView.line.gutterClass; }
|
2275 |
+
if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
|
2276 |
+
{ lineView.lineNumber = gutterWrap.appendChild(
|
2277 |
+
elt("div", lineNumberFor(cm.options, lineN),
|
2278 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt",
|
2279 |
+
("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
|
2280 |
+
if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
|
2281 |
+
var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
|
2282 |
+
if (found)
|
2283 |
+
{ gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
|
2284 |
+
("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
|
2285 |
+
} }
|
2286 |
+
}
|
2287 |
+
}
|
2288 |
+
|
2289 |
+
function updateLineWidgets(cm, lineView, dims) {
|
2290 |
+
if (lineView.alignable) { lineView.alignable = null; }
|
2291 |
+
for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
|
2292 |
+
next = node.nextSibling;
|
2293 |
+
if (node.className == "CodeMirror-linewidget")
|
2294 |
+
{ lineView.node.removeChild(node); }
|
2295 |
+
}
|
2296 |
+
insertLineWidgets(cm, lineView, dims);
|
2297 |
+
}
|
2298 |
+
|
2299 |
+
// Build a line's DOM representation from scratch
|
2300 |
+
function buildLineElement(cm, lineView, lineN, dims) {
|
2301 |
+
var built = getLineContent(cm, lineView);
|
2302 |
+
lineView.text = lineView.node = built.pre;
|
2303 |
+
if (built.bgClass) { lineView.bgClass = built.bgClass; }
|
2304 |
+
if (built.textClass) { lineView.textClass = built.textClass; }
|
2305 |
+
|
2306 |
+
updateLineClasses(cm, lineView);
|
2307 |
+
updateLineGutter(cm, lineView, lineN, dims);
|
2308 |
+
insertLineWidgets(cm, lineView, dims);
|
2309 |
+
return lineView.node
|
2310 |
+
}
|
2311 |
+
|
2312 |
+
// A lineView may contain multiple logical lines (when merged by
|
2313 |
+
// collapsed spans). The widgets for all of them need to be drawn.
|
2314 |
+
function insertLineWidgets(cm, lineView, dims) {
|
2315 |
+
insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
|
2316 |
+
if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
|
2317 |
+
{ insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
|
2318 |
+
}
|
2319 |
+
|
2320 |
+
function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
|
2321 |
+
if (!line.widgets) { return }
|
2322 |
+
var wrap = ensureLineWrapped(lineView);
|
2323 |
+
for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
|
2324 |
+
var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
|
2325 |
+
if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
|
2326 |
+
positionLineWidget(widget, node, lineView, dims);
|
2327 |
+
cm.display.input.setUneditable(node);
|
2328 |
+
if (allowAbove && widget.above)
|
2329 |
+
{ wrap.insertBefore(node, lineView.gutter || lineView.text); }
|
2330 |
+
else
|
2331 |
+
{ wrap.appendChild(node); }
|
2332 |
+
signalLater(widget, "redraw");
|
2333 |
+
}
|
2334 |
+
}
|
2335 |
+
|
2336 |
+
function positionLineWidget(widget, node, lineView, dims) {
|
2337 |
+
if (widget.noHScroll) {
|
2338 |
+
(lineView.alignable || (lineView.alignable = [])).push(node);
|
2339 |
+
var width = dims.wrapperWidth;
|
2340 |
+
node.style.left = dims.fixedPos + "px";
|
2341 |
+
if (!widget.coverGutter) {
|
2342 |
+
width -= dims.gutterTotalWidth;
|
2343 |
+
node.style.paddingLeft = dims.gutterTotalWidth + "px";
|
2344 |
+
}
|
2345 |
+
node.style.width = width + "px";
|
2346 |
+
}
|
2347 |
+
if (widget.coverGutter) {
|
2348 |
+
node.style.zIndex = 5;
|
2349 |
+
node.style.position = "relative";
|
2350 |
+
if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
|
2351 |
+
}
|
2352 |
+
}
|
2353 |
+
|
2354 |
+
function widgetHeight(widget) {
|
2355 |
+
if (widget.height != null) { return widget.height }
|
2356 |
+
var cm = widget.doc.cm;
|
2357 |
+
if (!cm) { return 0 }
|
2358 |
+
if (!contains(document.body, widget.node)) {
|
2359 |
+
var parentStyle = "position: relative;";
|
2360 |
+
if (widget.coverGutter)
|
2361 |
+
{ parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
|
2362 |
+
if (widget.noHScroll)
|
2363 |
+
{ parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
|
2364 |
+
removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
|
2365 |
+
}
|
2366 |
+
return widget.height = widget.node.parentNode.offsetHeight
|
2367 |
+
}
|
2368 |
+
|
2369 |
+
// Return true when the given mouse event happened in a widget
|
2370 |
+
function eventInWidget(display, e) {
|
2371 |
+
for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
|
2372 |
+
if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
|
2373 |
+
(n.parentNode == display.sizer && n != display.mover))
|
2374 |
+
{ return true }
|
2375 |
+
}
|
2376 |
+
}
|
2377 |
+
|
2378 |
+
// POSITION MEASUREMENT
|
2379 |
+
|
2380 |
+
function paddingTop(display) {return display.lineSpace.offsetTop}
|
2381 |
+
function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
|
2382 |
+
function paddingH(display) {
|
2383 |
+
if (display.cachedPaddingH) { return display.cachedPaddingH }
|
2384 |
+
var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
|
2385 |
+
var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
|
2386 |
+
var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
|
2387 |
+
if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
|
2388 |
+
return data
|
2389 |
+
}
|
2390 |
+
|
2391 |
+
function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
|
2392 |
+
function displayWidth(cm) {
|
2393 |
+
return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
|
2394 |
+
}
|
2395 |
+
function displayHeight(cm) {
|
2396 |
+
return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
|
2397 |
+
}
|
2398 |
+
|
2399 |
+
// Ensure the lineView.wrapping.heights array is populated. This is
|
2400 |
+
// an array of bottom offsets for the lines that make up a drawn
|
2401 |
+
// line. When lineWrapping is on, there might be more than one
|
2402 |
+
// height.
|
2403 |
+
function ensureLineHeights(cm, lineView, rect) {
|
2404 |
+
var wrapping = cm.options.lineWrapping;
|
2405 |
+
var curWidth = wrapping && displayWidth(cm);
|
2406 |
+
if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
|
2407 |
+
var heights = lineView.measure.heights = [];
|
2408 |
+
if (wrapping) {
|
2409 |
+
lineView.measure.width = curWidth;
|
2410 |
+
var rects = lineView.text.firstChild.getClientRects();
|
2411 |
+
for (var i = 0; i < rects.length - 1; i++) {
|
2412 |
+
var cur = rects[i], next = rects[i + 1];
|
2413 |
+
if (Math.abs(cur.bottom - next.bottom) > 2)
|
2414 |
+
{ heights.push((cur.bottom + next.top) / 2 - rect.top); }
|
2415 |
+
}
|
2416 |
+
}
|
2417 |
+
heights.push(rect.bottom - rect.top);
|
2418 |
+
}
|
2419 |
+
}
|
2420 |
+
|
2421 |
+
// Find a line map (mapping character offsets to text nodes) and a
|
2422 |
+
// measurement cache for the given line number. (A line view might
|
2423 |
+
// contain multiple lines when collapsed ranges are present.)
|
2424 |
+
function mapFromLineView(lineView, line, lineN) {
|
2425 |
+
if (lineView.line == line)
|
2426 |
+
{ return {map: lineView.measure.map, cache: lineView.measure.cache} }
|
2427 |
+
for (var i = 0; i < lineView.rest.length; i++)
|
2428 |
+
{ if (lineView.rest[i] == line)
|
2429 |
+
{ return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
|
2430 |
+
for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
|
2431 |
+
{ if (lineNo(lineView.rest[i$1]) > lineN)
|
2432 |
+
{ return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
|
2433 |
+
}
|
2434 |
+
|
2435 |
+
// Render a line into the hidden node display.externalMeasured. Used
|
2436 |
+
// when measurement is needed for a line that's not in the viewport.
|
2437 |
+
function updateExternalMeasurement(cm, line) {
|
2438 |
+
line = visualLine(line);
|
2439 |
+
var lineN = lineNo(line);
|
2440 |
+
var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
|
2441 |
+
view.lineN = lineN;
|
2442 |
+
var built = view.built = buildLineContent(cm, view);
|
2443 |
+
view.text = built.pre;
|
2444 |
+
removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
|
2445 |
+
return view
|
2446 |
+
}
|
2447 |
+
|
2448 |
+
// Get a {top, bottom, left, right} box (in line-local coordinates)
|
2449 |
+
// for a given character.
|
2450 |
+
function measureChar(cm, line, ch, bias) {
|
2451 |
+
return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
|
2452 |
+
}
|
2453 |
+
|
2454 |
+
// Find a line view that corresponds to the given line number.
|
2455 |
+
function findViewForLine(cm, lineN) {
|
2456 |
+
if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
|
2457 |
+
{ return cm.display.view[findViewIndex(cm, lineN)] }
|
2458 |
+
var ext = cm.display.externalMeasured;
|
2459 |
+
if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
|
2460 |
+
{ return ext }
|
2461 |
+
}
|
2462 |
+
|
2463 |
+
// Measurement can be split in two steps, the set-up work that
|
2464 |
+
// applies to the whole line, and the measurement of the actual
|
2465 |
+
// character. Functions like coordsChar, that need to do a lot of
|
2466 |
+
// measurements in a row, can thus ensure that the set-up work is
|
2467 |
+
// only done once.
|
2468 |
+
function prepareMeasureForLine(cm, line) {
|
2469 |
+
var lineN = lineNo(line);
|
2470 |
+
var view = findViewForLine(cm, lineN);
|
2471 |
+
if (view && !view.text) {
|
2472 |
+
view = null;
|
2473 |
+
} else if (view && view.changes) {
|
2474 |
+
updateLineForChanges(cm, view, lineN, getDimensions(cm));
|
2475 |
+
cm.curOp.forceUpdate = true;
|
2476 |
+
}
|
2477 |
+
if (!view)
|
2478 |
+
{ view = updateExternalMeasurement(cm, line); }
|
2479 |
+
|
2480 |
+
var info = mapFromLineView(view, line, lineN);
|
2481 |
+
return {
|
2482 |
+
line: line, view: view, rect: null,
|
2483 |
+
map: info.map, cache: info.cache, before: info.before,
|
2484 |
+
hasHeights: false
|
2485 |
+
}
|
2486 |
+
}
|
2487 |
+
|
2488 |
+
// Given a prepared measurement object, measures the position of an
|
2489 |
+
// actual character (or fetches it from the cache).
|
2490 |
+
function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
|
2491 |
+
if (prepared.before) { ch = -1; }
|
2492 |
+
var key = ch + (bias || ""), found;
|
2493 |
+
if (prepared.cache.hasOwnProperty(key)) {
|
2494 |
+
found = prepared.cache[key];
|
2495 |
+
} else {
|
2496 |
+
if (!prepared.rect)
|
2497 |
+
{ prepared.rect = prepared.view.text.getBoundingClientRect(); }
|
2498 |
+
if (!prepared.hasHeights) {
|
2499 |
+
ensureLineHeights(cm, prepared.view, prepared.rect);
|
2500 |
+
prepared.hasHeights = true;
|
2501 |
+
}
|
2502 |
+
found = measureCharInner(cm, prepared, ch, bias);
|
2503 |
+
if (!found.bogus) { prepared.cache[key] = found; }
|
2504 |
+
}
|
2505 |
+
return {left: found.left, right: found.right,
|
2506 |
+
top: varHeight ? found.rtop : found.top,
|
2507 |
+
bottom: varHeight ? found.rbottom : found.bottom}
|
2508 |
+
}
|
2509 |
+
|
2510 |
+
var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
|
2511 |
+
|
2512 |
+
function nodeAndOffsetInLineMap(map$$1, ch, bias) {
|
2513 |
+
var node, start, end, collapse, mStart, mEnd;
|
2514 |
+
// First, search the line map for the text node corresponding to,
|
2515 |
+
// or closest to, the target character.
|
2516 |
+
for (var i = 0; i < map$$1.length; i += 3) {
|
2517 |
+
mStart = map$$1[i];
|
2518 |
+
mEnd = map$$1[i + 1];
|
2519 |
+
if (ch < mStart) {
|
2520 |
+
start = 0; end = 1;
|
2521 |
+
collapse = "left";
|
2522 |
+
} else if (ch < mEnd) {
|
2523 |
+
start = ch - mStart;
|
2524 |
+
end = start + 1;
|
2525 |
+
} else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
|
2526 |
+
end = mEnd - mStart;
|
2527 |
+
start = end - 1;
|
2528 |
+
if (ch >= mEnd) { collapse = "right"; }
|
2529 |
+
}
|
2530 |
+
if (start != null) {
|
2531 |
+
node = map$$1[i + 2];
|
2532 |
+
if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
|
2533 |
+
{ collapse = bias; }
|
2534 |
+
if (bias == "left" && start == 0)
|
2535 |
+
{ while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
|
2536 |
+
node = map$$1[(i -= 3) + 2];
|
2537 |
+
collapse = "left";
|
2538 |
+
} }
|
2539 |
+
if (bias == "right" && start == mEnd - mStart)
|
2540 |
+
{ while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
|
2541 |
+
node = map$$1[(i += 3) + 2];
|
2542 |
+
collapse = "right";
|
2543 |
+
} }
|
2544 |
+
break
|
2545 |
+
}
|
2546 |
+
}
|
2547 |
+
return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
|
2548 |
+
}
|
2549 |
+
|
2550 |
+
function getUsefulRect(rects, bias) {
|
2551 |
+
var rect = nullRect;
|
2552 |
+
if (bias == "left") { for (var i = 0; i < rects.length; i++) {
|
2553 |
+
if ((rect = rects[i]).left != rect.right) { break }
|
2554 |
+
} } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
|
2555 |
+
if ((rect = rects[i$1]).left != rect.right) { break }
|
2556 |
+
} }
|
2557 |
+
return rect
|
2558 |
+
}
|
2559 |
+
|
2560 |
+
function measureCharInner(cm, prepared, ch, bias) {
|
2561 |
+
var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
|
2562 |
+
var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
|
2563 |
+
|
2564 |
+
var rect;
|
2565 |
+
if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
|
2566 |
+
for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
|
2567 |
+
while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
|
2568 |
+
while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
|
2569 |
+
if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
|
2570 |
+
{ rect = node.parentNode.getBoundingClientRect(); }
|
2571 |
+
else
|
2572 |
+
{ rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
|
2573 |
+
if (rect.left || rect.right || start == 0) { break }
|
2574 |
+
end = start;
|
2575 |
+
start = start - 1;
|
2576 |
+
collapse = "right";
|
2577 |
+
}
|
2578 |
+
if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
|
2579 |
+
} else { // If it is a widget, simply get the box for the whole widget.
|
2580 |
+
if (start > 0) { collapse = bias = "right"; }
|
2581 |
+
var rects;
|
2582 |
+
if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
|
2583 |
+
{ rect = rects[bias == "right" ? rects.length - 1 : 0]; }
|
2584 |
+
else
|
2585 |
+
{ rect = node.getBoundingClientRect(); }
|
2586 |
+
}
|
2587 |
+
if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
|
2588 |
+
var rSpan = node.parentNode.getClientRects()[0];
|
2589 |
+
if (rSpan)
|
2590 |
+
{ rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
|
2591 |
+
else
|
2592 |
+
{ rect = nullRect; }
|
2593 |
+
}
|
2594 |
+
|
2595 |
+
var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
|
2596 |
+
var mid = (rtop + rbot) / 2;
|
2597 |
+
var heights = prepared.view.measure.heights;
|
2598 |
+
var i = 0;
|
2599 |
+
for (; i < heights.length - 1; i++)
|
2600 |
+
{ if (mid < heights[i]) { break } }
|
2601 |
+
var top = i ? heights[i - 1] : 0, bot = heights[i];
|
2602 |
+
var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
|
2603 |
+
right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
|
2604 |
+
top: top, bottom: bot};
|
2605 |
+
if (!rect.left && !rect.right) { result.bogus = true; }
|
2606 |
+
if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
|
2607 |
+
|
2608 |
+
return result
|
2609 |
+
}
|
2610 |
+
|
2611 |
+
// Work around problem with bounding client rects on ranges being
|
2612 |
+
// returned incorrectly when zoomed on IE10 and below.
|
2613 |
+
function maybeUpdateRectForZooming(measure, rect) {
|
2614 |
+
if (!window.screen || screen.logicalXDPI == null ||
|
2615 |
+
screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
|
2616 |
+
{ return rect }
|
2617 |
+
var scaleX = screen.logicalXDPI / screen.deviceXDPI;
|
2618 |
+
var scaleY = screen.logicalYDPI / screen.deviceYDPI;
|
2619 |
+
return {left: rect.left * scaleX, right: rect.right * scaleX,
|
2620 |
+
top: rect.top * scaleY, bottom: rect.bottom * scaleY}
|
2621 |
+
}
|
2622 |
+
|
2623 |
+
function clearLineMeasurementCacheFor(lineView) {
|
2624 |
+
if (lineView.measure) {
|
2625 |
+
lineView.measure.cache = {};
|
2626 |
+
lineView.measure.heights = null;
|
2627 |
+
if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
|
2628 |
+
{ lineView.measure.caches[i] = {}; } }
|
2629 |
+
}
|
2630 |
+
}
|
2631 |
+
|
2632 |
+
function clearLineMeasurementCache(cm) {
|
2633 |
+
cm.display.externalMeasure = null;
|
2634 |
+
removeChildren(cm.display.lineMeasure);
|
2635 |
+
for (var i = 0; i < cm.display.view.length; i++)
|
2636 |
+
{ clearLineMeasurementCacheFor(cm.display.view[i]); }
|
2637 |
+
}
|
2638 |
+
|
2639 |
+
function clearCaches(cm) {
|
2640 |
+
clearLineMeasurementCache(cm);
|
2641 |
+
cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
|
2642 |
+
if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
|
2643 |
+
cm.display.lineNumChars = null;
|
2644 |
+
}
|
2645 |
+
|
2646 |
+
function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft }
|
2647 |
+
function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop }
|
2648 |
+
|
2649 |
+
// Converts a {top, bottom, left, right} box from line-local
|
2650 |
+
// coordinates into another coordinate system. Context may be one of
|
2651 |
+
// "line", "div" (display.lineDiv), "local"./null (editor), "window",
|
2652 |
+
// or "page".
|
2653 |
+
function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
|
2654 |
+
if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) {
|
2655 |
+
var size = widgetHeight(lineObj.widgets[i]);
|
2656 |
+
rect.top += size; rect.bottom += size;
|
2657 |
+
} } }
|
2658 |
+
if (context == "line") { return rect }
|
2659 |
+
if (!context) { context = "local"; }
|
2660 |
+
var yOff = heightAtLine(lineObj);
|
2661 |
+
if (context == "local") { yOff += paddingTop(cm.display); }
|
2662 |
+
else { yOff -= cm.display.viewOffset; }
|
2663 |
+
if (context == "page" || context == "window") {
|
2664 |
+
var lOff = cm.display.lineSpace.getBoundingClientRect();
|
2665 |
+
yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
|
2666 |
+
var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
|
2667 |
+
rect.left += xOff; rect.right += xOff;
|
2668 |
+
}
|
2669 |
+
rect.top += yOff; rect.bottom += yOff;
|
2670 |
+
return rect
|
2671 |
+
}
|
2672 |
+
|
2673 |
+
// Coverts a box from "div" coords to another coordinate system.
|
2674 |
+
// Context may be "window", "page", "div", or "local"./null.
|
2675 |
+
function fromCoordSystem(cm, coords, context) {
|
2676 |
+
if (context == "div") { return coords }
|
2677 |
+
var left = coords.left, top = coords.top;
|
2678 |
+
// First move into "page" coordinate system
|
2679 |
+
if (context == "page") {
|
2680 |
+
left -= pageScrollX();
|
2681 |
+
top -= pageScrollY();
|
2682 |
+
} else if (context == "local" || !context) {
|
2683 |
+
var localBox = cm.display.sizer.getBoundingClientRect();
|
2684 |
+
left += localBox.left;
|
2685 |
+
top += localBox.top;
|
2686 |
+
}
|
2687 |
+
|
2688 |
+
var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
|
2689 |
+
return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
|
2690 |
+
}
|
2691 |
+
|
2692 |
+
function charCoords(cm, pos, context, lineObj, bias) {
|
2693 |
+
if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
|
2694 |
+
return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
|
2695 |
+
}
|
2696 |
+
|
2697 |
+
// Returns a box for a given cursor position, which may have an
|
2698 |
+
// 'other' property containing the position of the secondary cursor
|
2699 |
+
// on a bidi boundary.
|
2700 |
+
// A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
|
2701 |
+
// and after `char - 1` in writing order of `char - 1`
|
2702 |
+
// A cursor Pos(line, char, "after") is on the same visual line as `char`
|
2703 |
+
// and before `char` in writing order of `char`
|
2704 |
+
// Examples (upper-case letters are RTL, lower-case are LTR):
|
2705 |
+
// Pos(0, 1, ...)
|
2706 |
+
// before after
|
2707 |
+
// ab a|b a|b
|
2708 |
+
// aB a|B aB|
|
2709 |
+
// Ab |Ab A|b
|
2710 |
+
// AB B|A B|A
|
2711 |
+
// Every position after the last character on a line is considered to stick
|
2712 |
+
// to the last character on the line.
|
2713 |
+
function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
|
2714 |
+
lineObj = lineObj || getLine(cm.doc, pos.line);
|
2715 |
+
if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
|
2716 |
+
function get(ch, right) {
|
2717 |
+
var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
|
2718 |
+
if (right) { m.left = m.right; } else { m.right = m.left; }
|
2719 |
+
return intoCoordSystem(cm, lineObj, m, context)
|
2720 |
+
}
|
2721 |
+
var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
|
2722 |
+
if (ch >= lineObj.text.length) {
|
2723 |
+
ch = lineObj.text.length;
|
2724 |
+
sticky = "before";
|
2725 |
+
} else if (ch <= 0) {
|
2726 |
+
ch = 0;
|
2727 |
+
sticky = "after";
|
2728 |
+
}
|
2729 |
+
if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
|
2730 |
+
|
2731 |
+
function getBidi(ch, partPos, invert) {
|
2732 |
+
var part = order[partPos], right = (part.level % 2) != 0;
|
2733 |
+
return get(invert ? ch - 1 : ch, right != invert)
|
2734 |
+
}
|
2735 |
+
var partPos = getBidiPartAt(order, ch, sticky);
|
2736 |
+
var other = bidiOther;
|
2737 |
+
var val = getBidi(ch, partPos, sticky == "before");
|
2738 |
+
if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
|
2739 |
+
return val
|
2740 |
+
}
|
2741 |
+
|
2742 |
+
// Used to cheaply estimate the coordinates for a position. Used for
|
2743 |
+
// intermediate scroll updates.
|
2744 |
+
function estimateCoords(cm, pos) {
|
2745 |
+
var left = 0;
|
2746 |
+
pos = clipPos(cm.doc, pos);
|
2747 |
+
if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
|
2748 |
+
var lineObj = getLine(cm.doc, pos.line);
|
2749 |
+
var top = heightAtLine(lineObj) + paddingTop(cm.display);
|
2750 |
+
return {left: left, right: left, top: top, bottom: top + lineObj.height}
|
2751 |
+
}
|
2752 |
+
|
2753 |
+
// Positions returned by coordsChar contain some extra information.
|
2754 |
+
// xRel is the relative x position of the input coordinates compared
|
2755 |
+
// to the found position (so xRel > 0 means the coordinates are to
|
2756 |
+
// the right of the character position, for example). When outside
|
2757 |
+
// is true, that means the coordinates lie outside the line's
|
2758 |
+
// vertical range.
|
2759 |
+
function PosWithInfo(line, ch, sticky, outside, xRel) {
|
2760 |
+
var pos = Pos(line, ch, sticky);
|
2761 |
+
pos.xRel = xRel;
|
2762 |
+
if (outside) { pos.outside = true; }
|
2763 |
+
return pos
|
2764 |
+
}
|
2765 |
+
|
2766 |
+
// Compute the character position closest to the given coordinates.
|
2767 |
+
// Input must be lineSpace-local ("div" coordinate system).
|
2768 |
+
function coordsChar(cm, x, y) {
|
2769 |
+
var doc = cm.doc;
|
2770 |
+
y += cm.display.viewOffset;
|
2771 |
+
if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
|
2772 |
+
var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
|
2773 |
+
if (lineN > last)
|
2774 |
+
{ return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
|
2775 |
+
if (x < 0) { x = 0; }
|
2776 |
+
|
2777 |
+
var lineObj = getLine(doc, lineN);
|
2778 |
+
for (;;) {
|
2779 |
+
var found = coordsCharInner(cm, lineObj, lineN, x, y);
|
2780 |
+
var merged = collapsedSpanAtEnd(lineObj);
|
2781 |
+
var mergedPos = merged && merged.find(0, true);
|
2782 |
+
if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
|
2783 |
+
{ lineN = lineNo(lineObj = mergedPos.to.line); }
|
2784 |
+
else
|
2785 |
+
{ return found }
|
2786 |
+
}
|
2787 |
+
}
|
2788 |
+
|
2789 |
+
function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
|
2790 |
+
var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); };
|
2791 |
+
var end = lineObj.text.length;
|
2792 |
+
var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0);
|
2793 |
+
end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end);
|
2794 |
+
return {begin: begin, end: end}
|
2795 |
+
}
|
2796 |
+
|
2797 |
+
function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
|
2798 |
+
var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
|
2799 |
+
return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
|
2800 |
+
}
|
2801 |
+
|
2802 |
+
function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
|
2803 |
+
y -= heightAtLine(lineObj);
|
2804 |
+
var begin = 0, end = lineObj.text.length;
|
2805 |
+
var preparedMeasure = prepareMeasureForLine(cm, lineObj);
|
2806 |
+
var pos;
|
2807 |
+
var order = getOrder(lineObj, cm.doc.direction);
|
2808 |
+
if (order) {
|
2809 |
+
if (cm.options.lineWrapping) {
|
2810 |
+
var assign;
|
2811 |
+
((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign));
|
2812 |
+
}
|
2813 |
+
pos = new Pos(lineNo$$1, begin);
|
2814 |
+
var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left;
|
2815 |
+
var dir = beginLeft < x ? 1 : -1;
|
2816 |
+
var prevDiff, diff = beginLeft - x, prevPos;
|
2817 |
+
do {
|
2818 |
+
prevDiff = diff;
|
2819 |
+
prevPos = pos;
|
2820 |
+
pos = moveVisually(cm, lineObj, pos, dir);
|
2821 |
+
if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
|
2822 |
+
pos = prevPos;
|
2823 |
+
break
|
2824 |
+
}
|
2825 |
+
diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x;
|
2826 |
+
} while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff)))
|
2827 |
+
if (Math.abs(diff) > Math.abs(prevDiff)) {
|
2828 |
+
if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") }
|
2829 |
+
pos = prevPos;
|
2830 |
+
}
|
2831 |
+
} else {
|
2832 |
+
var ch = findFirst(function (ch) {
|
2833 |
+
var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line");
|
2834 |
+
if (box.top > y) {
|
2835 |
+
// For the cursor stickiness
|
2836 |
+
end = Math.min(ch, end);
|
2837 |
+
return true
|
2838 |
+
}
|
2839 |
+
else if (box.bottom <= y) { return false }
|
2840 |
+
else if (box.left > x) { return true }
|
2841 |
+
else if (box.right < x) { return false }
|
2842 |
+
else { return (x - box.left < box.right - x) }
|
2843 |
+
}, begin, end);
|
2844 |
+
ch = skipExtendingChars(lineObj.text, ch, 1);
|
2845 |
+
pos = new Pos(lineNo$$1, ch, ch == end ? "before" : "after");
|
2846 |
+
}
|
2847 |
+
var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure);
|
2848 |
+
if (y < coords.top || coords.bottom < y) { pos.outside = true; }
|
2849 |
+
pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0);
|
2850 |
+
return pos
|
2851 |
+
}
|
2852 |
+
|
2853 |
+
var measureText;
|
2854 |
+
// Compute the default text height.
|
2855 |
+
function textHeight(display) {
|
2856 |
+
if (display.cachedTextHeight != null) { return display.cachedTextHeight }
|
2857 |
+
if (measureText == null) {
|
2858 |
+
measureText = elt("pre");
|
2859 |
+
// Measure a bunch of lines, for browsers that compute
|
2860 |
+
// fractional heights.
|
2861 |
+
for (var i = 0; i < 49; ++i) {
|
2862 |
+
measureText.appendChild(document.createTextNode("x"));
|
2863 |
+
measureText.appendChild(elt("br"));
|
2864 |
+
}
|
2865 |
+
measureText.appendChild(document.createTextNode("x"));
|
2866 |
+
}
|
2867 |
+
removeChildrenAndAdd(display.measure, measureText);
|
2868 |
+
var height = measureText.offsetHeight / 50;
|
2869 |
+
if (height > 3) { display.cachedTextHeight = height; }
|
2870 |
+
removeChildren(display.measure);
|
2871 |
+
return height || 1
|
2872 |
+
}
|
2873 |
+
|
2874 |
+
// Compute the default character width.
|
2875 |
+
function charWidth(display) {
|
2876 |
+
if (display.cachedCharWidth != null) { return display.cachedCharWidth }
|
2877 |
+
var anchor = elt("span", "xxxxxxxxxx");
|
2878 |
+
var pre = elt("pre", [anchor]);
|
2879 |
+
removeChildrenAndAdd(display.measure, pre);
|
2880 |
+
var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
|
2881 |
+
if (width > 2) { display.cachedCharWidth = width; }
|
2882 |
+
return width || 10
|
2883 |
+
}
|
2884 |
+
|
2885 |
+
// Do a bulk-read of the DOM positions and sizes needed to draw the
|
2886 |
+
// view, so that we don't interleave reading and writing to the DOM.
|
2887 |
+
function getDimensions(cm) {
|
2888 |
+
var d = cm.display, left = {}, width = {};
|
2889 |
+
var gutterLeft = d.gutters.clientLeft;
|
2890 |
+
for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
|
2891 |
+
left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
|
2892 |
+
width[cm.options.gutters[i]] = n.clientWidth;
|
2893 |
+
}
|
2894 |
+
return {fixedPos: compensateForHScroll(d),
|
2895 |
+
gutterTotalWidth: d.gutters.offsetWidth,
|
2896 |
+
gutterLeft: left,
|
2897 |
+
gutterWidth: width,
|
2898 |
+
wrapperWidth: d.wrapper.clientWidth}
|
2899 |
+
}
|
2900 |
+
|
2901 |
+
// Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
|
2902 |
+
// but using getBoundingClientRect to get a sub-pixel-accurate
|
2903 |
+
// result.
|
2904 |
+
function compensateForHScroll(display) {
|
2905 |
+
return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
|
2906 |
+
}
|
2907 |
+
|
2908 |
+
// Returns a function that estimates the height of a line, to use as
|
2909 |
+
// first approximation until the line becomes visible (and is thus
|
2910 |
+
// properly measurable).
|
2911 |
+
function estimateHeight(cm) {
|
2912 |
+
var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
|
2913 |
+
var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
|
2914 |
+
return function (line) {
|
2915 |
+
if (lineIsHidden(cm.doc, line)) { return 0 }
|
2916 |
+
|
2917 |
+
var widgetsHeight = 0;
|
2918 |
+
if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
|
2919 |
+
if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
|
2920 |
+
} }
|
2921 |
+
|
2922 |
+
if (wrapping)
|
2923 |
+
{ return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
|
2924 |
+
else
|
2925 |
+
{ return widgetsHeight + th }
|
2926 |
+
}
|
2927 |
+
}
|
2928 |
+
|
2929 |
+
function estimateLineHeights(cm) {
|
2930 |
+
var doc = cm.doc, est = estimateHeight(cm);
|
2931 |
+
doc.iter(function (line) {
|
2932 |
+
var estHeight = est(line);
|
2933 |
+
if (estHeight != line.height) { updateLineHeight(line, estHeight); }
|
2934 |
+
});
|
2935 |
+
}
|
2936 |
+
|
2937 |
+
// Given a mouse event, find the corresponding position. If liberal
|
2938 |
+
// is false, it checks whether a gutter or scrollbar was clicked,
|
2939 |
+
// and returns null if it was. forRect is used by rectangular
|
2940 |
+
// selections, and tries to estimate a character position even for
|
2941 |
+
// coordinates beyond the right of the text.
|
2942 |
+
function posFromMouse(cm, e, liberal, forRect) {
|
2943 |
+
var display = cm.display;
|
2944 |
+
if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
|
2945 |
+
|
2946 |
+
var x, y, space = display.lineSpace.getBoundingClientRect();
|
2947 |
+
// Fails unpredictably on IE[67] when mouse is dragged around quickly.
|
2948 |
+
try { x = e.clientX - space.left; y = e.clientY - space.top; }
|
2949 |
+
catch (e) { return null }
|
2950 |
+
var coords = coordsChar(cm, x, y), line;
|
2951 |
+
if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
|
2952 |
+
var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
|
2953 |
+
coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
|
2954 |
+
}
|
2955 |
+
return coords
|
2956 |
+
}
|
2957 |
+
|
2958 |
+
// Find the view element corresponding to a given line. Return null
|
2959 |
+
// when the line isn't visible.
|
2960 |
+
function findViewIndex(cm, n) {
|
2961 |
+
if (n >= cm.display.viewTo) { return null }
|
2962 |
+
n -= cm.display.viewFrom;
|
2963 |
+
if (n < 0) { return null }
|
2964 |
+
var view = cm.display.view;
|
2965 |
+
for (var i = 0; i < view.length; i++) {
|
2966 |
+
n -= view[i].size;
|
2967 |
+
if (n < 0) { return i }
|
2968 |
+
}
|
2969 |
+
}
|
2970 |
+
|
2971 |
+
function updateSelection(cm) {
|
2972 |
+
cm.display.input.showSelection(cm.display.input.prepareSelection());
|
2973 |
+
}
|
2974 |
+
|
2975 |
+
function prepareSelection(cm, primary) {
|
2976 |
+
var doc = cm.doc, result = {};
|
2977 |
+
var curFragment = result.cursors = document.createDocumentFragment();
|
2978 |
+
var selFragment = result.selection = document.createDocumentFragment();
|
2979 |
+
|
2980 |
+
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
2981 |
+
if (primary === false && i == doc.sel.primIndex) { continue }
|
2982 |
+
var range$$1 = doc.sel.ranges[i];
|
2983 |
+
if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
|
2984 |
+
var collapsed = range$$1.empty();
|
2985 |
+
if (collapsed || cm.options.showCursorWhenSelecting)
|
2986 |
+
{ drawSelectionCursor(cm, range$$1.head, curFragment); }
|
2987 |
+
if (!collapsed)
|
2988 |
+
{ drawSelectionRange(cm, range$$1, selFragment); }
|
2989 |
+
}
|
2990 |
+
return result
|
2991 |
+
}
|
2992 |
+
|
2993 |
+
// Draws a cursor for the given range
|
2994 |
+
function drawSelectionCursor(cm, head, output) {
|
2995 |
+
var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
|
2996 |
+
|
2997 |
+
var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
|
2998 |
+
cursor.style.left = pos.left + "px";
|
2999 |
+
cursor.style.top = pos.top + "px";
|
3000 |
+
cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
|
3001 |
+
|
3002 |
+
if (pos.other) {
|
3003 |
+
// Secondary cursor, shown when on a 'jump' in bi-directional text
|
3004 |
+
var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
|
3005 |
+
otherCursor.style.display = "";
|
3006 |
+
otherCursor.style.left = pos.other.left + "px";
|
3007 |
+
otherCursor.style.top = pos.other.top + "px";
|
3008 |
+
otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
|
3009 |
+
}
|
3010 |
+
}
|
3011 |
+
|
3012 |
+
// Draws the given range as a highlighted selection
|
3013 |
+
function drawSelectionRange(cm, range$$1, output) {
|
3014 |
+
var display = cm.display, doc = cm.doc;
|
3015 |
+
var fragment = document.createDocumentFragment();
|
3016 |
+
var padding = paddingH(cm.display), leftSide = padding.left;
|
3017 |
+
var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
|
3018 |
+
|
3019 |
+
function add(left, top, width, bottom) {
|
3020 |
+
if (top < 0) { top = 0; }
|
3021 |
+
top = Math.round(top);
|
3022 |
+
bottom = Math.round(bottom);
|
3023 |
+
fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")));
|
3024 |
+
}
|
3025 |
+
|
3026 |
+
function drawForLine(line, fromArg, toArg) {
|
3027 |
+
var lineObj = getLine(doc, line);
|
3028 |
+
var lineLen = lineObj.text.length;
|
3029 |
+
var start, end;
|
3030 |
+
function coords(ch, bias) {
|
3031 |
+
return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
|
3032 |
+
}
|
3033 |
+
|
3034 |
+
iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {
|
3035 |
+
var leftPos = coords(from, "left"), rightPos, left, right;
|
3036 |
+
if (from == to) {
|
3037 |
+
rightPos = leftPos;
|
3038 |
+
left = right = leftPos.left;
|
3039 |
+
} else {
|
3040 |
+
rightPos = coords(to - 1, "right");
|
3041 |
+
if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
|
3042 |
+
left = leftPos.left;
|
3043 |
+
right = rightPos.right;
|
3044 |
+
}
|
3045 |
+
if (fromArg == null && from == 0) { left = leftSide; }
|
3046 |
+
if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
|
3047 |
+
add(left, leftPos.top, null, leftPos.bottom);
|
3048 |
+
left = leftSide;
|
3049 |
+
if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top); }
|
3050 |
+
}
|
3051 |
+
if (toArg == null && to == lineLen) { right = rightSide; }
|
3052 |
+
if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
|
3053 |
+
{ start = leftPos; }
|
3054 |
+
if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
|
3055 |
+
{ end = rightPos; }
|
3056 |
+
if (left < leftSide + 1) { left = leftSide; }
|
3057 |
+
add(left, rightPos.top, right - left, rightPos.bottom);
|
3058 |
+
});
|
3059 |
+
return {start: start, end: end}
|
3060 |
+
}
|
3061 |
+
|
3062 |
+
var sFrom = range$$1.from(), sTo = range$$1.to();
|
3063 |
+
if (sFrom.line == sTo.line) {
|
3064 |
+
drawForLine(sFrom.line, sFrom.ch, sTo.ch);
|
3065 |
+
} else {
|
3066 |
+
var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
|
3067 |
+
var singleVLine = visualLine(fromLine) == visualLine(toLine);
|
3068 |
+
var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
|
3069 |
+
var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
|
3070 |
+
if (singleVLine) {
|
3071 |
+
if (leftEnd.top < rightStart.top - 2) {
|
3072 |
+
add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
|
3073 |
+
add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
|
3074 |
+
} else {
|
3075 |
+
add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
|
3076 |
+
}
|
3077 |
+
}
|
3078 |
+
if (leftEnd.bottom < rightStart.top)
|
3079 |
+
{ add(leftSide, leftEnd.bottom, null, rightStart.top); }
|
3080 |
+
}
|
3081 |
+
|
3082 |
+
output.appendChild(fragment);
|
3083 |
+
}
|
3084 |
+
|
3085 |
+
// Cursor-blinking
|
3086 |
+
function restartBlink(cm) {
|
3087 |
+
if (!cm.state.focused) { return }
|
3088 |
+
var display = cm.display;
|
3089 |
+
clearInterval(display.blinker);
|
3090 |
+
var on = true;
|
3091 |
+
display.cursorDiv.style.visibility = "";
|
3092 |
+
if (cm.options.cursorBlinkRate > 0)
|
3093 |
+
{ display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
|
3094 |
+
cm.options.cursorBlinkRate); }
|
3095 |
+
else if (cm.options.cursorBlinkRate < 0)
|
3096 |
+
{ display.cursorDiv.style.visibility = "hidden"; }
|
3097 |
+
}
|
3098 |
+
|
3099 |
+
function ensureFocus(cm) {
|
3100 |
+
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
|
3101 |
+
}
|
3102 |
+
|
3103 |
+
function delayBlurEvent(cm) {
|
3104 |
+
cm.state.delayingBlurEvent = true;
|
3105 |
+
setTimeout(function () { if (cm.state.delayingBlurEvent) {
|
3106 |
+
cm.state.delayingBlurEvent = false;
|
3107 |
+
onBlur(cm);
|
3108 |
+
} }, 100);
|
3109 |
+
}
|
3110 |
+
|
3111 |
+
function onFocus(cm, e) {
|
3112 |
+
if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
|
3113 |
+
|
3114 |
+
if (cm.options.readOnly == "nocursor") { return }
|
3115 |
+
if (!cm.state.focused) {
|
3116 |
+
signal(cm, "focus", cm, e);
|
3117 |
+
cm.state.focused = true;
|
3118 |
+
addClass(cm.display.wrapper, "CodeMirror-focused");
|
3119 |
+
// This test prevents this from firing when a context
|
3120 |
+
// menu is closed (since the input reset would kill the
|
3121 |
+
// select-all detection hack)
|
3122 |
+
if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
|
3123 |
+
cm.display.input.reset();
|
3124 |
+
if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
|
3125 |
+
}
|
3126 |
+
cm.display.input.receivedFocus();
|
3127 |
+
}
|
3128 |
+
restartBlink(cm);
|
3129 |
+
}
|
3130 |
+
function onBlur(cm, e) {
|
3131 |
+
if (cm.state.delayingBlurEvent) { return }
|
3132 |
+
|
3133 |
+
if (cm.state.focused) {
|
3134 |
+
signal(cm, "blur", cm, e);
|
3135 |
+
cm.state.focused = false;
|
3136 |
+
rmClass(cm.display.wrapper, "CodeMirror-focused");
|
3137 |
+
}
|
3138 |
+
clearInterval(cm.display.blinker);
|
3139 |
+
setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
|
3140 |
+
}
|
3141 |
+
|
3142 |
+
// Re-align line numbers and gutter marks to compensate for
|
3143 |
+
// horizontal scrolling.
|
3144 |
+
function alignHorizontally(cm) {
|
3145 |
+
var display = cm.display, view = display.view;
|
3146 |
+
if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
|
3147 |
+
var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
|
3148 |
+
var gutterW = display.gutters.offsetWidth, left = comp + "px";
|
3149 |
+
for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
|
3150 |
+
if (cm.options.fixedGutter) {
|
3151 |
+
if (view[i].gutter)
|
3152 |
+
{ view[i].gutter.style.left = left; }
|
3153 |
+
if (view[i].gutterBackground)
|
3154 |
+
{ view[i].gutterBackground.style.left = left; }
|
3155 |
+
}
|
3156 |
+
var align = view[i].alignable;
|
3157 |
+
if (align) { for (var j = 0; j < align.length; j++)
|
3158 |
+
{ align[j].style.left = left; } }
|
3159 |
+
} }
|
3160 |
+
if (cm.options.fixedGutter)
|
3161 |
+
{ display.gutters.style.left = (comp + gutterW) + "px"; }
|
3162 |
+
}
|
3163 |
+
|
3164 |
+
// Used to ensure that the line number gutter is still the right
|
3165 |
+
// size for the current document size. Returns true when an update
|
3166 |
+
// is needed.
|
3167 |
+
function maybeUpdateLineNumberWidth(cm) {
|
3168 |
+
if (!cm.options.lineNumbers) { return false }
|
3169 |
+
var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
|
3170 |
+
if (last.length != display.lineNumChars) {
|
3171 |
+
var test = display.measure.appendChild(elt("div", [elt("div", last)],
|
3172 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt"));
|
3173 |
+
var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
|
3174 |
+
display.lineGutter.style.width = "";
|
3175 |
+
display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
|
3176 |
+
display.lineNumWidth = display.lineNumInnerWidth + padding;
|
3177 |
+
display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
|
3178 |
+
display.lineGutter.style.width = display.lineNumWidth + "px";
|
3179 |
+
updateGutterSpace(cm);
|
3180 |
+
return true
|
3181 |
+
}
|
3182 |
+
return false
|
3183 |
+
}
|
3184 |
+
|
3185 |
+
// Read the actual heights of the rendered lines, and update their
|
3186 |
+
// stored heights to match.
|
3187 |
+
function updateHeightsInViewport(cm) {
|
3188 |
+
var display = cm.display;
|
3189 |
+
var prevBottom = display.lineDiv.offsetTop;
|
3190 |
+
for (var i = 0; i < display.view.length; i++) {
|
3191 |
+
var cur = display.view[i], height = (void 0);
|
3192 |
+
if (cur.hidden) { continue }
|
3193 |
+
if (ie && ie_version < 8) {
|
3194 |
+
var bot = cur.node.offsetTop + cur.node.offsetHeight;
|
3195 |
+
height = bot - prevBottom;
|
3196 |
+
prevBottom = bot;
|
3197 |
+
} else {
|
3198 |
+
var box = cur.node.getBoundingClientRect();
|
3199 |
+
height = box.bottom - box.top;
|
3200 |
+
}
|
3201 |
+
var diff = cur.line.height - height;
|
3202 |
+
if (height < 2) { height = textHeight(display); }
|
3203 |
+
if (diff > .001 || diff < -.001) {
|
3204 |
+
updateLineHeight(cur.line, height);
|
3205 |
+
updateWidgetHeight(cur.line);
|
3206 |
+
if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
|
3207 |
+
{ updateWidgetHeight(cur.rest[j]); } }
|
3208 |
+
}
|
3209 |
+
}
|
3210 |
+
}
|
3211 |
+
|
3212 |
+
// Read and store the height of line widgets associated with the
|
3213 |
+
// given line.
|
3214 |
+
function updateWidgetHeight(line) {
|
3215 |
+
if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
|
3216 |
+
{ line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }
|
3217 |
+
}
|
3218 |
+
|
3219 |
+
// Compute the lines that are visible in a given viewport (defaults
|
3220 |
+
// the the current scroll position). viewport may contain top,
|
3221 |
+
// height, and ensure (see op.scrollToPos) properties.
|
3222 |
+
function visibleLines(display, doc, viewport) {
|
3223 |
+
var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
|
3224 |
+
top = Math.floor(top - paddingTop(display));
|
3225 |
+
var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
|
3226 |
+
|
3227 |
+
var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
|
3228 |
+
// Ensure is a {from: {line, ch}, to: {line, ch}} object, and
|
3229 |
+
// forces those lines into the viewport (if possible).
|
3230 |
+
if (viewport && viewport.ensure) {
|
3231 |
+
var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
|
3232 |
+
if (ensureFrom < from) {
|
3233 |
+
from = ensureFrom;
|
3234 |
+
to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
|
3235 |
+
} else if (Math.min(ensureTo, doc.lastLine()) >= to) {
|
3236 |
+
from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
|
3237 |
+
to = ensureTo;
|
3238 |
+
}
|
3239 |
+
}
|
3240 |
+
return {from: from, to: Math.max(to, from + 1)}
|
3241 |
+
}
|
3242 |
+
|
3243 |
+
// Sync the scrollable area and scrollbars, ensure the viewport
|
3244 |
+
// covers the visible area.
|
3245 |
+
function setScrollTop(cm, val) {
|
3246 |
+
if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
|
3247 |
+
cm.doc.scrollTop = val;
|
3248 |
+
if (!gecko) { updateDisplaySimple(cm, {top: val}); }
|
3249 |
+
if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
|
3250 |
+
cm.display.scrollbars.setScrollTop(val);
|
3251 |
+
if (gecko) { updateDisplaySimple(cm); }
|
3252 |
+
startWorker(cm, 100);
|
3253 |
+
}
|
3254 |
+
// Sync scroller and scrollbar, ensure the gutter elements are
|
3255 |
+
// aligned.
|
3256 |
+
function setScrollLeft(cm, val, isScroller) {
|
3257 |
+
if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return }
|
3258 |
+
val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
|
3259 |
+
cm.doc.scrollLeft = val;
|
3260 |
+
alignHorizontally(cm);
|
3261 |
+
if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
|
3262 |
+
cm.display.scrollbars.setScrollLeft(val);
|
3263 |
+
}
|
3264 |
+
|
3265 |
+
// Since the delta values reported on mouse wheel events are
|
3266 |
+
// unstandardized between browsers and even browser versions, and
|
3267 |
+
// generally horribly unpredictable, this code starts by measuring
|
3268 |
+
// the scroll effect that the first few mouse wheel events have,
|
3269 |
+
// and, from that, detects the way it can convert deltas to pixel
|
3270 |
+
// offsets afterwards.
|
3271 |
+
//
|
3272 |
+
// The reason we want to know the amount a wheel event will scroll
|
3273 |
+
// is that it gives us a chance to update the display before the
|
3274 |
+
// actual scrolling happens, reducing flickering.
|
3275 |
+
|
3276 |
+
var wheelSamples = 0;
|
3277 |
+
var wheelPixelsPerUnit = null;
|
3278 |
+
// Fill in a browser-detected starting value on browsers where we
|
3279 |
+
// know one. These don't have to be accurate -- the result of them
|
3280 |
+
// being wrong would just be a slight flicker on the first wheel
|
3281 |
+
// scroll (if it is large enough).
|
3282 |
+
if (ie) { wheelPixelsPerUnit = -.53; }
|
3283 |
+
else if (gecko) { wheelPixelsPerUnit = 15; }
|
3284 |
+
else if (chrome) { wheelPixelsPerUnit = -.7; }
|
3285 |
+
else if (safari) { wheelPixelsPerUnit = -1/3; }
|
3286 |
+
|
3287 |
+
function wheelEventDelta(e) {
|
3288 |
+
var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
|
3289 |
+
if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
|
3290 |
+
if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
|
3291 |
+
else if (dy == null) { dy = e.wheelDelta; }
|
3292 |
+
return {x: dx, y: dy}
|
3293 |
+
}
|
3294 |
+
function wheelEventPixels(e) {
|
3295 |
+
var delta = wheelEventDelta(e);
|
3296 |
+
delta.x *= wheelPixelsPerUnit;
|
3297 |
+
delta.y *= wheelPixelsPerUnit;
|
3298 |
+
return delta
|
3299 |
+
}
|
3300 |
+
|
3301 |
+
function onScrollWheel(cm, e) {
|
3302 |
+
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
|
3303 |
+
|
3304 |
+
var display = cm.display, scroll = display.scroller;
|
3305 |
+
// Quit if there's nothing to scroll here
|
3306 |
+
var canScrollX = scroll.scrollWidth > scroll.clientWidth;
|
3307 |
+
var canScrollY = scroll.scrollHeight > scroll.clientHeight;
|
3308 |
+
if (!(dx && canScrollX || dy && canScrollY)) { return }
|
3309 |
+
|
3310 |
+
// Webkit browsers on OS X abort momentum scrolls when the target
|
3311 |
+
// of the scroll event is removed from the scrollable element.
|
3312 |
+
// This hack (see related code in patchDisplay) makes sure the
|
3313 |
+
// element is kept around.
|
3314 |
+
if (dy && mac && webkit) {
|
3315 |
+
outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
|
3316 |
+
for (var i = 0; i < view.length; i++) {
|
3317 |
+
if (view[i].node == cur) {
|
3318 |
+
cm.display.currentWheelTarget = cur;
|
3319 |
+
break outer
|
3320 |
+
}
|
3321 |
+
}
|
3322 |
+
}
|
3323 |
+
}
|
3324 |
+
|
3325 |
+
// On some browsers, horizontal scrolling will cause redraws to
|
3326 |
+
// happen before the gutter has been realigned, causing it to
|
3327 |
+
// wriggle around in a most unseemly way. When we have an
|
3328 |
+
// estimated pixels/delta value, we just handle horizontal
|
3329 |
+
// scrolling entirely here. It'll be slightly off from native, but
|
3330 |
+
// better than glitching out.
|
3331 |
+
if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
|
3332 |
+
if (dy && canScrollY)
|
3333 |
+
{ setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); }
|
3334 |
+
setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
|
3335 |
+
// Only prevent default scrolling if vertical scrolling is
|
3336 |
+
// actually possible. Otherwise, it causes vertical scroll
|
3337 |
+
// jitter on OSX trackpads when deltaX is small and deltaY
|
3338 |
+
// is large (issue #3579)
|
3339 |
+
if (!dy || (dy && canScrollY))
|
3340 |
+
{ e_preventDefault(e); }
|
3341 |
+
display.wheelStartX = null; // Abort measurement, if in progress
|
3342 |
+
return
|
3343 |
+
}
|
3344 |
+
|
3345 |
+
// 'Project' the visible viewport to cover the area that is being
|
3346 |
+
// scrolled into view (if we know enough to estimate it).
|
3347 |
+
if (dy && wheelPixelsPerUnit != null) {
|
3348 |
+
var pixels = dy * wheelPixelsPerUnit;
|
3349 |
+
var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
|
3350 |
+
if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
|
3351 |
+
else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
|
3352 |
+
updateDisplaySimple(cm, {top: top, bottom: bot});
|
3353 |
+
}
|
3354 |
+
|
3355 |
+
if (wheelSamples < 20) {
|
3356 |
+
if (display.wheelStartX == null) {
|
3357 |
+
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
|
3358 |
+
display.wheelDX = dx; display.wheelDY = dy;
|
3359 |
+
setTimeout(function () {
|
3360 |
+
if (display.wheelStartX == null) { return }
|
3361 |
+
var movedX = scroll.scrollLeft - display.wheelStartX;
|
3362 |
+
var movedY = scroll.scrollTop - display.wheelStartY;
|
3363 |
+
var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
|
3364 |
+
(movedX && display.wheelDX && movedX / display.wheelDX);
|
3365 |
+
display.wheelStartX = display.wheelStartY = null;
|
3366 |
+
if (!sample) { return }
|
3367 |
+
wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
|
3368 |
+
++wheelSamples;
|
3369 |
+
}, 200);
|
3370 |
+
} else {
|
3371 |
+
display.wheelDX += dx; display.wheelDY += dy;
|
3372 |
+
}
|
3373 |
+
}
|
3374 |
+
}
|
3375 |
+
|
3376 |
+
// SCROLLBARS
|
3377 |
+
|
3378 |
+
// Prepare DOM reads needed to update the scrollbars. Done in one
|
3379 |
+
// shot to minimize update/measure roundtrips.
|
3380 |
+
function measureForScrollbars(cm) {
|
3381 |
+
var d = cm.display, gutterW = d.gutters.offsetWidth;
|
3382 |
+
var docH = Math.round(cm.doc.height + paddingVert(cm.display));
|
3383 |
+
return {
|
3384 |
+
clientHeight: d.scroller.clientHeight,
|
3385 |
+
viewHeight: d.wrapper.clientHeight,
|
3386 |
+
scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
|
3387 |
+
viewWidth: d.wrapper.clientWidth,
|
3388 |
+
barLeft: cm.options.fixedGutter ? gutterW : 0,
|
3389 |
+
docHeight: docH,
|
3390 |
+
scrollHeight: docH + scrollGap(cm) + d.barHeight,
|
3391 |
+
nativeBarWidth: d.nativeBarWidth,
|
3392 |
+
gutterWidth: gutterW
|
3393 |
+
}
|
3394 |
+
}
|
3395 |
+
|
3396 |
+
var NativeScrollbars = function(place, scroll, cm) {
|
3397 |
+
this.cm = cm;
|
3398 |
+
var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
|
3399 |
+
var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
|
3400 |
+
place(vert); place(horiz);
|
3401 |
+
|
3402 |
+
on(vert, "scroll", function () {
|
3403 |
+
if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
|
3404 |
+
});
|
3405 |
+
on(horiz, "scroll", function () {
|
3406 |
+
if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
|
3407 |
+
});
|
3408 |
+
|
3409 |
+
this.checkedZeroWidth = false;
|
3410 |
+
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
|
3411 |
+
if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
|
3412 |
+
};
|
3413 |
+
|
3414 |
+
NativeScrollbars.prototype.update = function (measure) {
|
3415 |
+
var needsH = measure.scrollWidth > measure.clientWidth + 1;
|
3416 |
+
var needsV = measure.scrollHeight > measure.clientHeight + 1;
|
3417 |
+
var sWidth = measure.nativeBarWidth;
|
3418 |
+
|
3419 |
+
if (needsV) {
|
3420 |
+
this.vert.style.display = "block";
|
3421 |
+
this.vert.style.bottom = needsH ? sWidth + "px" : "0";
|
3422 |
+
var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
|
3423 |
+
// A bug in IE8 can cause this value to be negative, so guard it.
|
3424 |
+
this.vert.firstChild.style.height =
|
3425 |
+
Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
|
3426 |
+
} else {
|
3427 |
+
this.vert.style.display = "";
|
3428 |
+
this.vert.firstChild.style.height = "0";
|
3429 |
+
}
|
3430 |
+
|
3431 |
+
if (needsH) {
|
3432 |
+
this.horiz.style.display = "block";
|
3433 |
+
this.horiz.style.right = needsV ? sWidth + "px" : "0";
|
3434 |
+
this.horiz.style.left = measure.barLeft + "px";
|
3435 |
+
var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
|
3436 |
+
this.horiz.firstChild.style.width =
|
3437 |
+
Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
|
3438 |
+
} else {
|
3439 |
+
this.horiz.style.display = "";
|
3440 |
+
this.horiz.firstChild.style.width = "0";
|
3441 |
+
}
|
3442 |
+
|
3443 |
+
if (!this.checkedZeroWidth && measure.clientHeight > 0) {
|
3444 |
+
if (sWidth == 0) { this.zeroWidthHack(); }
|
3445 |
+
this.checkedZeroWidth = true;
|
3446 |
+
}
|
3447 |
+
|
3448 |
+
return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
|
3449 |
+
};
|
3450 |
+
|
3451 |
+
NativeScrollbars.prototype.setScrollLeft = function (pos) {
|
3452 |
+
if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
|
3453 |
+
if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz); }
|
3454 |
+
};
|
3455 |
+
|
3456 |
+
NativeScrollbars.prototype.setScrollTop = function (pos) {
|
3457 |
+
if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
|
3458 |
+
if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert); }
|
3459 |
+
};
|
3460 |
+
|
3461 |
+
NativeScrollbars.prototype.zeroWidthHack = function () {
|
3462 |
+
var w = mac && !mac_geMountainLion ? "12px" : "18px";
|
3463 |
+
this.horiz.style.height = this.vert.style.width = w;
|
3464 |
+
this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
|
3465 |
+
this.disableHoriz = new Delayed;
|
3466 |
+
this.disableVert = new Delayed;
|
3467 |
+
};
|
3468 |
+
|
3469 |
+
NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay) {
|
3470 |
+
bar.style.pointerEvents = "auto";
|
3471 |
+
function maybeDisable() {
|
3472 |
+
// To find out whether the scrollbar is still visible, we
|
3473 |
+
// check whether the element under the pixel in the bottom
|
3474 |
+
// left corner of the scrollbar box is the scrollbar box
|
3475 |
+
// itself (when the bar is still visible) or its filler child
|
3476 |
+
// (when the bar is hidden). If it is still visible, we keep
|
3477 |
+
// it enabled, if it's hidden, we disable pointer events.
|
3478 |
+
var box = bar.getBoundingClientRect();
|
3479 |
+
var elt$$1 = document.elementFromPoint(box.left + 1, box.bottom - 1);
|
3480 |
+
if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
|
3481 |
+
else { delay.set(1000, maybeDisable); }
|
3482 |
+
}
|
3483 |
+
delay.set(1000, maybeDisable);
|
3484 |
+
};
|
3485 |
+
|
3486 |
+
NativeScrollbars.prototype.clear = function () {
|
3487 |
+
var parent = this.horiz.parentNode;
|
3488 |
+
parent.removeChild(this.horiz);
|
3489 |
+
parent.removeChild(this.vert);
|
3490 |
+
};
|
3491 |
+
|
3492 |
+
var NullScrollbars = function () {};
|
3493 |
+
|
3494 |
+
NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
|
3495 |
+
NullScrollbars.prototype.setScrollLeft = function () {};
|
3496 |
+
NullScrollbars.prototype.setScrollTop = function () {};
|
3497 |
+
NullScrollbars.prototype.clear = function () {};
|
3498 |
+
|
3499 |
+
function updateScrollbars(cm, measure) {
|
3500 |
+
if (!measure) { measure = measureForScrollbars(cm); }
|
3501 |
+
var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
|
3502 |
+
updateScrollbarsInner(cm, measure);
|
3503 |
+
for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
|
3504 |
+
if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
|
3505 |
+
{ updateHeightsInViewport(cm); }
|
3506 |
+
updateScrollbarsInner(cm, measureForScrollbars(cm));
|
3507 |
+
startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
|
3508 |
+
}
|
3509 |
+
}
|
3510 |
+
|
3511 |
+
// Re-synchronize the fake scrollbars with the actual size of the
|
3512 |
+
// content.
|
3513 |
+
function updateScrollbarsInner(cm, measure) {
|
3514 |
+
var d = cm.display;
|
3515 |
+
var sizes = d.scrollbars.update(measure);
|
3516 |
+
|
3517 |
+
d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
|
3518 |
+
d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
|
3519 |
+
d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
|
3520 |
+
|
3521 |
+
if (sizes.right && sizes.bottom) {
|
3522 |
+
d.scrollbarFiller.style.display = "block";
|
3523 |
+
d.scrollbarFiller.style.height = sizes.bottom + "px";
|
3524 |
+
d.scrollbarFiller.style.width = sizes.right + "px";
|
3525 |
+
} else { d.scrollbarFiller.style.display = ""; }
|
3526 |
+
if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
|
3527 |
+
d.gutterFiller.style.display = "block";
|
3528 |
+
d.gutterFiller.style.height = sizes.bottom + "px";
|
3529 |
+
d.gutterFiller.style.width = measure.gutterWidth + "px";
|
3530 |
+
} else { d.gutterFiller.style.display = ""; }
|
3531 |
+
}
|
3532 |
+
|
3533 |
+
var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
|
3534 |
+
|
3535 |
+
function initScrollbars(cm) {
|
3536 |
+
if (cm.display.scrollbars) {
|
3537 |
+
cm.display.scrollbars.clear();
|
3538 |
+
if (cm.display.scrollbars.addClass)
|
3539 |
+
{ rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
|
3540 |
+
}
|
3541 |
+
|
3542 |
+
cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
|
3543 |
+
cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
|
3544 |
+
// Prevent clicks in the scrollbars from killing focus
|
3545 |
+
on(node, "mousedown", function () {
|
3546 |
+
if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
|
3547 |
+
});
|
3548 |
+
node.setAttribute("cm-not-content", "true");
|
3549 |
+
}, function (pos, axis) {
|
3550 |
+
if (axis == "horizontal") { setScrollLeft(cm, pos); }
|
3551 |
+
else { setScrollTop(cm, pos); }
|
3552 |
+
}, cm);
|
3553 |
+
if (cm.display.scrollbars.addClass)
|
3554 |
+
{ addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
|
3555 |
+
}
|
3556 |
+
|
3557 |
+
// SCROLLING THINGS INTO VIEW
|
3558 |
+
|
3559 |
+
// If an editor sits on the top or bottom of the window, partially
|
3560 |
+
// scrolled out of view, this ensures that the cursor is visible.
|
3561 |
+
function maybeScrollWindow(cm, rect) {
|
3562 |
+
if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
|
3563 |
+
|
3564 |
+
var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
|
3565 |
+
if (rect.top + box.top < 0) { doScroll = true; }
|
3566 |
+
else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
|
3567 |
+
if (doScroll != null && !phantom) {
|
3568 |
+
var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
|
3569 |
+
cm.display.lineSpace.appendChild(scrollNode);
|
3570 |
+
scrollNode.scrollIntoView(doScroll);
|
3571 |
+
cm.display.lineSpace.removeChild(scrollNode);
|
3572 |
+
}
|
3573 |
+
}
|
3574 |
+
|
3575 |
+
// Scroll a given position into view (immediately), verifying that
|
3576 |
+
// it actually became visible (as line heights are accurately
|
3577 |
+
// measured, the position of something may 'drift' during drawing).
|
3578 |
+
function scrollPosIntoView(cm, pos, end, margin) {
|
3579 |
+
if (margin == null) { margin = 0; }
|
3580 |
+
var rect;
|
3581 |
+
for (var limit = 0; limit < 5; limit++) {
|
3582 |
+
var changed = false;
|
3583 |
+
var coords = cursorCoords(cm, pos);
|
3584 |
+
var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
|
3585 |
+
rect = {left: Math.min(coords.left, endCoords.left),
|
3586 |
+
top: Math.min(coords.top, endCoords.top) - margin,
|
3587 |
+
right: Math.max(coords.left, endCoords.left),
|
3588 |
+
bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
|
3589 |
+
var scrollPos = calculateScrollPos(cm, rect);
|
3590 |
+
var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
|
3591 |
+
if (scrollPos.scrollTop != null) {
|
3592 |
+
setScrollTop(cm, scrollPos.scrollTop);
|
3593 |
+
if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
|
3594 |
+
}
|
3595 |
+
if (scrollPos.scrollLeft != null) {
|
3596 |
+
setScrollLeft(cm, scrollPos.scrollLeft);
|
3597 |
+
if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
|
3598 |
+
}
|
3599 |
+
if (!changed) { break }
|
3600 |
+
}
|
3601 |
+
return rect
|
3602 |
+
}
|
3603 |
+
|
3604 |
+
// Scroll a given set of coordinates into view (immediately).
|
3605 |
+
function scrollIntoView(cm, rect) {
|
3606 |
+
var scrollPos = calculateScrollPos(cm, rect);
|
3607 |
+
if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop); }
|
3608 |
+
if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
|
3609 |
+
}
|
3610 |
+
|
3611 |
+
// Calculate a new scroll position needed to scroll the given
|
3612 |
+
// rectangle into view. Returns an object with scrollTop and
|
3613 |
+
// scrollLeft properties. When these are undefined, the
|
3614 |
+
// vertical/horizontal position does not need to be adjusted.
|
3615 |
+
function calculateScrollPos(cm, rect) {
|
3616 |
+
var display = cm.display, snapMargin = textHeight(cm.display);
|
3617 |
+
if (rect.top < 0) { rect.top = 0; }
|
3618 |
+
var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
|
3619 |
+
var screen = displayHeight(cm), result = {};
|
3620 |
+
if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
|
3621 |
+
var docBottom = cm.doc.height + paddingVert(display);
|
3622 |
+
var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
|
3623 |
+
if (rect.top < screentop) {
|
3624 |
+
result.scrollTop = atTop ? 0 : rect.top;
|
3625 |
+
} else if (rect.bottom > screentop + screen) {
|
3626 |
+
var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
|
3627 |
+
if (newTop != screentop) { result.scrollTop = newTop; }
|
3628 |
+
}
|
3629 |
+
|
3630 |
+
var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
|
3631 |
+
var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
|
3632 |
+
var tooWide = rect.right - rect.left > screenw;
|
3633 |
+
if (tooWide) { rect.right = rect.left + screenw; }
|
3634 |
+
if (rect.left < 10)
|
3635 |
+
{ result.scrollLeft = 0; }
|
3636 |
+
else if (rect.left < screenleft)
|
3637 |
+
{ result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
|
3638 |
+
else if (rect.right > screenw + screenleft - 3)
|
3639 |
+
{ result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
|
3640 |
+
return result
|
3641 |
+
}
|
3642 |
+
|
3643 |
+
// Store a relative adjustment to the scroll position in the current
|
3644 |
+
// operation (to be applied when the operation finishes).
|
3645 |
+
function addToScrollPos(cm, left, top) {
|
3646 |
+
if (left != null || top != null) { resolveScrollToPos(cm); }
|
3647 |
+
if (left != null)
|
3648 |
+
{ cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; }
|
3649 |
+
if (top != null)
|
3650 |
+
{ cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; }
|
3651 |
+
}
|
3652 |
+
|
3653 |
+
// Make sure that at the end of the operation the current cursor is
|
3654 |
+
// shown.
|
3655 |
+
function ensureCursorVisible(cm) {
|
3656 |
+
resolveScrollToPos(cm);
|
3657 |
+
var cur = cm.getCursor(), from = cur, to = cur;
|
3658 |
+
if (!cm.options.lineWrapping) {
|
3659 |
+
from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
|
3660 |
+
to = Pos(cur.line, cur.ch + 1);
|
3661 |
+
}
|
3662 |
+
cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin};
|
3663 |
+
}
|
3664 |
+
|
3665 |
+
// When an operation has its scrollToPos property set, and another
|
3666 |
+
// scroll action is applied before the end of the operation, this
|
3667 |
+
// 'simulates' scrolling that position into view in a cheap way, so
|
3668 |
+
// that the effect of intermediate scroll commands is not ignored.
|
3669 |
+
function resolveScrollToPos(cm) {
|
3670 |
+
var range$$1 = cm.curOp.scrollToPos;
|
3671 |
+
if (range$$1) {
|
3672 |
+
cm.curOp.scrollToPos = null;
|
3673 |
+
var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
|
3674 |
+
var sPos = calculateScrollPos(cm, {
|
3675 |
+
left: Math.min(from.left, to.left),
|
3676 |
+
top: Math.min(from.top, to.top) - range$$1.margin,
|
3677 |
+
right: Math.max(from.right, to.right),
|
3678 |
+
bottom: Math.max(from.bottom, to.bottom) + range$$1.margin
|
3679 |
+
});
|
3680 |
+
cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
|
3681 |
+
}
|
3682 |
+
}
|
3683 |
+
|
3684 |
+
// Operations are used to wrap a series of changes to the editor
|
3685 |
+
// state in such a way that each change won't have to update the
|
3686 |
+
// cursor and display (which would be awkward, slow, and
|
3687 |
+
// error-prone). Instead, display updates are batched and then all
|
3688 |
+
// combined and executed at once.
|
3689 |
+
|
3690 |
+
var nextOpId = 0;
|
3691 |
+
// Start a new operation.
|
3692 |
+
function startOperation(cm) {
|
3693 |
+
cm.curOp = {
|
3694 |
+
cm: cm,
|
3695 |
+
viewChanged: false, // Flag that indicates that lines might need to be redrawn
|
3696 |
+
startHeight: cm.doc.height, // Used to detect need to update scrollbar
|
3697 |
+
forceUpdate: false, // Used to force a redraw
|
3698 |
+
updateInput: null, // Whether to reset the input textarea
|
3699 |
+
typing: false, // Whether this reset should be careful to leave existing text (for compositing)
|
3700 |
+
changeObjs: null, // Accumulated changes, for firing change events
|
3701 |
+
cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
|
3702 |
+
cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
|
3703 |
+
selectionChanged: false, // Whether the selection needs to be redrawn
|
3704 |
+
updateMaxLine: false, // Set when the widest line needs to be determined anew
|
3705 |
+
scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
|
3706 |
+
scrollToPos: null, // Used to scroll to a specific position
|
3707 |
+
focus: false,
|
3708 |
+
id: ++nextOpId // Unique ID
|
3709 |
+
};
|
3710 |
+
pushOperation(cm.curOp);
|
3711 |
+
}
|
3712 |
+
|
3713 |
+
// Finish an operation, updating the display and signalling delayed events
|
3714 |
+
function endOperation(cm) {
|
3715 |
+
var op = cm.curOp;
|
3716 |
+
finishOperation(op, function (group) {
|
3717 |
+
for (var i = 0; i < group.ops.length; i++)
|
3718 |
+
{ group.ops[i].cm.curOp = null; }
|
3719 |
+
endOperations(group);
|
3720 |
+
});
|
3721 |
+
}
|
3722 |
+
|
3723 |
+
// The DOM updates done when an operation finishes are batched so
|
3724 |
+
// that the minimum number of relayouts are required.
|
3725 |
+
function endOperations(group) {
|
3726 |
+
var ops = group.ops;
|
3727 |
+
for (var i = 0; i < ops.length; i++) // Read DOM
|
3728 |
+
{ endOperation_R1(ops[i]); }
|
3729 |
+
for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
|
3730 |
+
{ endOperation_W1(ops[i$1]); }
|
3731 |
+
for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
|
3732 |
+
{ endOperation_R2(ops[i$2]); }
|
3733 |
+
for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
|
3734 |
+
{ endOperation_W2(ops[i$3]); }
|
3735 |
+
for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
|
3736 |
+
{ endOperation_finish(ops[i$4]); }
|
3737 |
+
}
|
3738 |
+
|
3739 |
+
function endOperation_R1(op) {
|
3740 |
+
var cm = op.cm, display = cm.display;
|
3741 |
+
maybeClipScrollbars(cm);
|
3742 |
+
if (op.updateMaxLine) { findMaxLine(cm); }
|
3743 |
+
|
3744 |
+
op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
|
3745 |
+
op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
|
3746 |
+
op.scrollToPos.to.line >= display.viewTo) ||
|
3747 |
+
display.maxLineChanged && cm.options.lineWrapping;
|
3748 |
+
op.update = op.mustUpdate &&
|
3749 |
+
new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
|
3750 |
+
}
|
3751 |
+
|
3752 |
+
function endOperation_W1(op) {
|
3753 |
+
op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
|
3754 |
+
}
|
3755 |
+
|
3756 |
+
function endOperation_R2(op) {
|
3757 |
+
var cm = op.cm, display = cm.display;
|
3758 |
+
if (op.updatedDisplay) { updateHeightsInViewport(cm); }
|
3759 |
+
|
3760 |
+
op.barMeasure = measureForScrollbars(cm);
|
3761 |
+
|
3762 |
+
// If the max line changed since it was last measured, measure it,
|
3763 |
+
// and ensure the document's width matches it.
|
3764 |
+
// updateDisplay_W2 will use these properties to do the actual resizing
|
3765 |
+
if (display.maxLineChanged && !cm.options.lineWrapping) {
|
3766 |
+
op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
|
3767 |
+
cm.display.sizerWidth = op.adjustWidthTo;
|
3768 |
+
op.barMeasure.scrollWidth =
|
3769 |
+
Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
|
3770 |
+
op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
|
3771 |
+
}
|
3772 |
+
|
3773 |
+
if (op.updatedDisplay || op.selectionChanged)
|
3774 |
+
{ op.preparedSelection = display.input.prepareSelection(op.focus); }
|
3775 |
+
}
|
3776 |
+
|
3777 |
+
function endOperation_W2(op) {
|
3778 |
+
var cm = op.cm;
|
3779 |
+
|
3780 |
+
if (op.adjustWidthTo != null) {
|
3781 |
+
cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
|
3782 |
+
if (op.maxScrollLeft < cm.doc.scrollLeft)
|
3783 |
+
{ setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
|
3784 |
+
cm.display.maxLineChanged = false;
|
3785 |
+
}
|
3786 |
+
|
3787 |
+
var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus());
|
3788 |
+
if (op.preparedSelection)
|
3789 |
+
{ cm.display.input.showSelection(op.preparedSelection, takeFocus); }
|
3790 |
+
if (op.updatedDisplay || op.startHeight != cm.doc.height)
|
3791 |
+
{ updateScrollbars(cm, op.barMeasure); }
|
3792 |
+
if (op.updatedDisplay)
|
3793 |
+
{ setDocumentHeight(cm, op.barMeasure); }
|
3794 |
+
|
3795 |
+
if (op.selectionChanged) { restartBlink(cm); }
|
3796 |
+
|
3797 |
+
if (cm.state.focused && op.updateInput)
|
3798 |
+
{ cm.display.input.reset(op.typing); }
|
3799 |
+
if (takeFocus) { ensureFocus(op.cm); }
|
3800 |
+
}
|
3801 |
+
|
3802 |
+
function endOperation_finish(op) {
|
3803 |
+
var cm = op.cm, display = cm.display, doc = cm.doc;
|
3804 |
+
|
3805 |
+
if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
|
3806 |
+
|
3807 |
+
// Abort mouse wheel delta measurement, when scrolling explicitly
|
3808 |
+
if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
|
3809 |
+
{ display.wheelStartX = display.wheelStartY = null; }
|
3810 |
+
|
3811 |
+
// Propagate the scroll position to the actual DOM scroller
|
3812 |
+
if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
|
3813 |
+
doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
|
3814 |
+
display.scrollbars.setScrollTop(doc.scrollTop);
|
3815 |
+
display.scroller.scrollTop = doc.scrollTop;
|
3816 |
+
}
|
3817 |
+
if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
|
3818 |
+
doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
|
3819 |
+
display.scrollbars.setScrollLeft(doc.scrollLeft);
|
3820 |
+
display.scroller.scrollLeft = doc.scrollLeft;
|
3821 |
+
alignHorizontally(cm);
|
3822 |
+
}
|
3823 |
+
// If we need to scroll a specific position into view, do so.
|
3824 |
+
if (op.scrollToPos) {
|
3825 |
+
var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
|
3826 |
+
clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
|
3827 |
+
maybeScrollWindow(cm, rect);
|
3828 |
+
}
|
3829 |
+
|
3830 |
+
// Fire events for markers that are hidden/unidden by editing or
|
3831 |
+
// undoing
|
3832 |
+
var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
|
3833 |
+
if (hidden) { for (var i = 0; i < hidden.length; ++i)
|
3834 |
+
{ if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
|
3835 |
+
if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
|
3836 |
+
{ if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
|
3837 |
+
|
3838 |
+
if (display.wrapper.offsetHeight)
|
3839 |
+
{ doc.scrollTop = cm.display.scroller.scrollTop; }
|
3840 |
+
|
3841 |
+
// Fire change events, and delayed event handlers
|
3842 |
+
if (op.changeObjs)
|
3843 |
+
{ signal(cm, "changes", cm, op.changeObjs); }
|
3844 |
+
if (op.update)
|
3845 |
+
{ op.update.finish(); }
|
3846 |
+
}
|
3847 |
+
|
3848 |
+
// Run the given function in an operation
|
3849 |
+
function runInOp(cm, f) {
|
3850 |
+
if (cm.curOp) { return f() }
|
3851 |
+
startOperation(cm);
|
3852 |
+
try { return f() }
|
3853 |
+
finally { endOperation(cm); }
|
3854 |
+
}
|
3855 |
+
// Wraps a function in an operation. Returns the wrapped function.
|
3856 |
+
function operation(cm, f) {
|
3857 |
+
return function() {
|
3858 |
+
if (cm.curOp) { return f.apply(cm, arguments) }
|
3859 |
+
startOperation(cm);
|
3860 |
+
try { return f.apply(cm, arguments) }
|
3861 |
+
finally { endOperation(cm); }
|
3862 |
+
}
|
3863 |
+
}
|
3864 |
+
// Used to add methods to editor and doc instances, wrapping them in
|
3865 |
+
// operations.
|
3866 |
+
function methodOp(f) {
|
3867 |
+
return function() {
|
3868 |
+
if (this.curOp) { return f.apply(this, arguments) }
|
3869 |
+
startOperation(this);
|
3870 |
+
try { return f.apply(this, arguments) }
|
3871 |
+
finally { endOperation(this); }
|
3872 |
+
}
|
3873 |
+
}
|
3874 |
+
function docMethodOp(f) {
|
3875 |
+
return function() {
|
3876 |
+
var cm = this.cm;
|
3877 |
+
if (!cm || cm.curOp) { return f.apply(this, arguments) }
|
3878 |
+
startOperation(cm);
|
3879 |
+
try { return f.apply(this, arguments) }
|
3880 |
+
finally { endOperation(cm); }
|
3881 |
+
}
|
3882 |
+
}
|
3883 |
+
|
3884 |
+
// Updates the display.view data structure for a given change to the
|
3885 |
+
// document. From and to are in pre-change coordinates. Lendiff is
|
3886 |
+
// the amount of lines added or subtracted by the change. This is
|
3887 |
+
// used for changes that span multiple lines, or change the way
|
3888 |
+
// lines are divided into visual lines. regLineChange (below)
|
3889 |
+
// registers single-line changes.
|
3890 |
+
function regChange(cm, from, to, lendiff) {
|
3891 |
+
if (from == null) { from = cm.doc.first; }
|
3892 |
+
if (to == null) { to = cm.doc.first + cm.doc.size; }
|
3893 |
+
if (!lendiff) { lendiff = 0; }
|
3894 |
+
|
3895 |
+
var display = cm.display;
|
3896 |
+
if (lendiff && to < display.viewTo &&
|
3897 |
+
(display.updateLineNumbers == null || display.updateLineNumbers > from))
|
3898 |
+
{ display.updateLineNumbers = from; }
|
3899 |
+
|
3900 |
+
cm.curOp.viewChanged = true;
|
3901 |
+
|
3902 |
+
if (from >= display.viewTo) { // Change after
|
3903 |
+
if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
|
3904 |
+
{ resetView(cm); }
|
3905 |
+
} else if (to <= display.viewFrom) { // Change before
|
3906 |
+
if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
|
3907 |
+
resetView(cm);
|
3908 |
+
} else {
|
3909 |
+
display.viewFrom += lendiff;
|
3910 |
+
display.viewTo += lendiff;
|
3911 |
+
}
|
3912 |
+
} else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
|
3913 |
+
resetView(cm);
|
3914 |
+
} else if (from <= display.viewFrom) { // Top overlap
|
3915 |
+
var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
|
3916 |
+
if (cut) {
|
3917 |
+
display.view = display.view.slice(cut.index);
|
3918 |
+
display.viewFrom = cut.lineN;
|
3919 |
+
display.viewTo += lendiff;
|
3920 |
+
} else {
|
3921 |
+
resetView(cm);
|
3922 |
+
}
|
3923 |
+
} else if (to >= display.viewTo) { // Bottom overlap
|
3924 |
+
var cut$1 = viewCuttingPoint(cm, from, from, -1);
|
3925 |
+
if (cut$1) {
|
3926 |
+
display.view = display.view.slice(0, cut$1.index);
|
3927 |
+
display.viewTo = cut$1.lineN;
|
3928 |
+
} else {
|
3929 |
+
resetView(cm);
|
3930 |
+
}
|
3931 |
+
} else { // Gap in the middle
|
3932 |
+
var cutTop = viewCuttingPoint(cm, from, from, -1);
|
3933 |
+
var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
|
3934 |
+
if (cutTop && cutBot) {
|
3935 |
+
display.view = display.view.slice(0, cutTop.index)
|
3936 |
+
.concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
|
3937 |
+
.concat(display.view.slice(cutBot.index));
|
3938 |
+
display.viewTo += lendiff;
|
3939 |
+
} else {
|
3940 |
+
resetView(cm);
|
3941 |
+
}
|
3942 |
+
}
|
3943 |
+
|
3944 |
+
var ext = display.externalMeasured;
|
3945 |
+
if (ext) {
|
3946 |
+
if (to < ext.lineN)
|
3947 |
+
{ ext.lineN += lendiff; }
|
3948 |
+
else if (from < ext.lineN + ext.size)
|
3949 |
+
{ display.externalMeasured = null; }
|
3950 |
+
}
|
3951 |
+
}
|
3952 |
+
|
3953 |
+
// Register a change to a single line. Type must be one of "text",
|
3954 |
+
// "gutter", "class", "widget"
|
3955 |
+
function regLineChange(cm, line, type) {
|
3956 |
+
cm.curOp.viewChanged = true;
|
3957 |
+
var display = cm.display, ext = cm.display.externalMeasured;
|
3958 |
+
if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
|
3959 |
+
{ display.externalMeasured = null; }
|
3960 |
+
|
3961 |
+
if (line < display.viewFrom || line >= display.viewTo) { return }
|
3962 |
+
var lineView = display.view[findViewIndex(cm, line)];
|
3963 |
+
if (lineView.node == null) { return }
|
3964 |
+
var arr = lineView.changes || (lineView.changes = []);
|
3965 |
+
if (indexOf(arr, type) == -1) { arr.push(type); }
|
3966 |
+
}
|
3967 |
+
|
3968 |
+
// Clear the view.
|
3969 |
+
function resetView(cm) {
|
3970 |
+
cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
|
3971 |
+
cm.display.view = [];
|
3972 |
+
cm.display.viewOffset = 0;
|
3973 |
+
}
|
3974 |
+
|
3975 |
+
function viewCuttingPoint(cm, oldN, newN, dir) {
|
3976 |
+
var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
|
3977 |
+
if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
|
3978 |
+
{ return {index: index, lineN: newN} }
|
3979 |
+
var n = cm.display.viewFrom;
|
3980 |
+
for (var i = 0; i < index; i++)
|
3981 |
+
{ n += view[i].size; }
|
3982 |
+
if (n != oldN) {
|
3983 |
+
if (dir > 0) {
|
3984 |
+
if (index == view.length - 1) { return null }
|
3985 |
+
diff = (n + view[index].size) - oldN;
|
3986 |
+
index++;
|
3987 |
+
} else {
|
3988 |
+
diff = n - oldN;
|
3989 |
+
}
|
3990 |
+
oldN += diff; newN += diff;
|
3991 |
+
}
|
3992 |
+
while (visualLineNo(cm.doc, newN) != newN) {
|
3993 |
+
if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
|
3994 |
+
newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
|
3995 |
+
index += dir;
|
3996 |
+
}
|
3997 |
+
return {index: index, lineN: newN}
|
3998 |
+
}
|
3999 |
+
|
4000 |
+
// Force the view to cover a given range, adding empty view element
|
4001 |
+
// or clipping off existing ones as needed.
|
4002 |
+
function adjustView(cm, from, to) {
|
4003 |
+
var display = cm.display, view = display.view;
|
4004 |
+
if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
|
4005 |
+
display.view = buildViewArray(cm, from, to);
|
4006 |
+
display.viewFrom = from;
|
4007 |
+
} else {
|
4008 |
+
if (display.viewFrom > from)
|
4009 |
+
{ display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
|
4010 |
+
else if (display.viewFrom < from)
|
4011 |
+
{ display.view = display.view.slice(findViewIndex(cm, from)); }
|
4012 |
+
display.viewFrom = from;
|
4013 |
+
if (display.viewTo < to)
|
4014 |
+
{ display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
|
4015 |
+
else if (display.viewTo > to)
|
4016 |
+
{ display.view = display.view.slice(0, findViewIndex(cm, to)); }
|
4017 |
+
}
|
4018 |
+
display.viewTo = to;
|
4019 |
+
}
|
4020 |
+
|
4021 |
+
// Count the number of lines in the view whose DOM representation is
|
4022 |
+
// out of date (or nonexistent).
|
4023 |
+
function countDirtyView(cm) {
|
4024 |
+
var view = cm.display.view, dirty = 0;
|
4025 |
+
for (var i = 0; i < view.length; i++) {
|
4026 |
+
var lineView = view[i];
|
4027 |
+
if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
|
4028 |
+
}
|
4029 |
+
return dirty
|
4030 |
+
}
|
4031 |
+
|
4032 |
+
// HIGHLIGHT WORKER
|
4033 |
+
|
4034 |
+
function startWorker(cm, time) {
|
4035 |
+
if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
|
4036 |
+
{ cm.state.highlight.set(time, bind(highlightWorker, cm)); }
|
4037 |
+
}
|
4038 |
+
|
4039 |
+
function highlightWorker(cm) {
|
4040 |
+
var doc = cm.doc;
|
4041 |
+
if (doc.frontier < doc.first) { doc.frontier = doc.first; }
|
4042 |
+
if (doc.frontier >= cm.display.viewTo) { return }
|
4043 |
+
var end = +new Date + cm.options.workTime;
|
4044 |
+
var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
|
4045 |
+
var changedLines = [];
|
4046 |
+
|
4047 |
+
doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
|
4048 |
+
if (doc.frontier >= cm.display.viewFrom) { // Visible
|
4049 |
+
var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
|
4050 |
+
var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
|
4051 |
+
line.styles = highlighted.styles;
|
4052 |
+
var oldCls = line.styleClasses, newCls = highlighted.classes;
|
4053 |
+
if (newCls) { line.styleClasses = newCls; }
|
4054 |
+
else if (oldCls) { line.styleClasses = null; }
|
4055 |
+
var ischange = !oldStyles || oldStyles.length != line.styles.length ||
|
4056 |
+
oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
|
4057 |
+
for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
|
4058 |
+
if (ischange) { changedLines.push(doc.frontier); }
|
4059 |
+
line.stateAfter = tooLong ? state : copyState(doc.mode, state);
|
4060 |
+
} else {
|
4061 |
+
if (line.text.length <= cm.options.maxHighlightLength)
|
4062 |
+
{ processLine(cm, line.text, state); }
|
4063 |
+
line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
|
4064 |
+
}
|
4065 |
+
++doc.frontier;
|
4066 |
+
if (+new Date > end) {
|
4067 |
+
startWorker(cm, cm.options.workDelay);
|
4068 |
+
return true
|
4069 |
+
}
|
4070 |
+
});
|
4071 |
+
if (changedLines.length) { runInOp(cm, function () {
|
4072 |
+
for (var i = 0; i < changedLines.length; i++)
|
4073 |
+
{ regLineChange(cm, changedLines[i], "text"); }
|
4074 |
+
}); }
|
4075 |
+
}
|
4076 |
+
|
4077 |
+
// DISPLAY DRAWING
|
4078 |
+
|
4079 |
+
var DisplayUpdate = function(cm, viewport, force) {
|
4080 |
+
var display = cm.display;
|
4081 |
+
|
4082 |
+
this.viewport = viewport;
|
4083 |
+
// Store some values that we'll need later (but don't want to force a relayout for)
|
4084 |
+
this.visible = visibleLines(display, cm.doc, viewport);
|
4085 |
+
this.editorIsHidden = !display.wrapper.offsetWidth;
|
4086 |
+
this.wrapperHeight = display.wrapper.clientHeight;
|
4087 |
+
this.wrapperWidth = display.wrapper.clientWidth;
|
4088 |
+
this.oldDisplayWidth = displayWidth(cm);
|
4089 |
+
this.force = force;
|
4090 |
+
this.dims = getDimensions(cm);
|
4091 |
+
this.events = [];
|
4092 |
+
};
|
4093 |
+
|
4094 |
+
DisplayUpdate.prototype.signal = function (emitter, type) {
|
4095 |
+
if (hasHandler(emitter, type))
|
4096 |
+
{ this.events.push(arguments); }
|
4097 |
+
};
|
4098 |
+
DisplayUpdate.prototype.finish = function () {
|
4099 |
+
var this$1 = this;
|
4100 |
+
|
4101 |
+
for (var i = 0; i < this.events.length; i++)
|
4102 |
+
{ signal.apply(null, this$1.events[i]); }
|
4103 |
+
};
|
4104 |
+
|
4105 |
+
function maybeClipScrollbars(cm) {
|
4106 |
+
var display = cm.display;
|
4107 |
+
if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
|
4108 |
+
display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
|
4109 |
+
display.heightForcer.style.height = scrollGap(cm) + "px";
|
4110 |
+
display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
|
4111 |
+
display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
|
4112 |
+
display.scrollbarsClipped = true;
|
4113 |
+
}
|
4114 |
+
}
|
4115 |
+
|
4116 |
+
// Does the actual updating of the line display. Bails out
|
4117 |
+
// (returning false) when there is nothing to be done and forced is
|
4118 |
+
// false.
|
4119 |
+
function updateDisplayIfNeeded(cm, update) {
|
4120 |
+
var display = cm.display, doc = cm.doc;
|
4121 |
+
|
4122 |
+
if (update.editorIsHidden) {
|
4123 |
+
resetView(cm);
|
4124 |
+
return false
|
4125 |
+
}
|
4126 |
+
|
4127 |
+
// Bail out if the visible area is already rendered and nothing changed.
|
4128 |
+
if (!update.force &&
|
4129 |
+
update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
|
4130 |
+
(display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
|
4131 |
+
display.renderedView == display.view && countDirtyView(cm) == 0)
|
4132 |
+
{ return false }
|
4133 |
+
|
4134 |
+
if (maybeUpdateLineNumberWidth(cm)) {
|
4135 |
+
resetView(cm);
|
4136 |
+
update.dims = getDimensions(cm);
|
4137 |
+
}
|
4138 |
+
|
4139 |
+
// Compute a suitable new viewport (from & to)
|
4140 |
+
var end = doc.first + doc.size;
|
4141 |
+
var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
|
4142 |
+
var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
|
4143 |
+
if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
|
4144 |
+
if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
|
4145 |
+
if (sawCollapsedSpans) {
|
4146 |
+
from = visualLineNo(cm.doc, from);
|
4147 |
+
to = visualLineEndNo(cm.doc, to);
|
4148 |
+
}
|
4149 |
+
|
4150 |
+
var different = from != display.viewFrom || to != display.viewTo ||
|
4151 |
+
display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
|
4152 |
+
adjustView(cm, from, to);
|
4153 |
+
|
4154 |
+
display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
|
4155 |
+
// Position the mover div to align with the current scroll position
|
4156 |
+
cm.display.mover.style.top = display.viewOffset + "px";
|
4157 |
+
|
4158 |
+
var toUpdate = countDirtyView(cm);
|
4159 |
+
if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
|
4160 |
+
(display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
|
4161 |
+
{ return false }
|
4162 |
+
|
4163 |
+
// For big changes, we hide the enclosing element during the
|
4164 |
+
// update, since that speeds up the operations on most browsers.
|
4165 |
+
var focused = activeElt();
|
4166 |
+
if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
|
4167 |
+
patchDisplay(cm, display.updateLineNumbers, update.dims);
|
4168 |
+
if (toUpdate > 4) { display.lineDiv.style.display = ""; }
|
4169 |
+
display.renderedView = display.view;
|
4170 |
+
// There might have been a widget with a focused element that got
|
4171 |
+
// hidden or updated, if so re-focus it.
|
4172 |
+
if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus(); }
|
4173 |
+
|
4174 |
+
// Prevent selection and cursors from interfering with the scroll
|
4175 |
+
// width and height.
|
4176 |
+
removeChildren(display.cursorDiv);
|
4177 |
+
removeChildren(display.selectionDiv);
|
4178 |
+
display.gutters.style.height = display.sizer.style.minHeight = 0;
|
4179 |
+
|
4180 |
+
if (different) {
|
4181 |
+
display.lastWrapHeight = update.wrapperHeight;
|
4182 |
+
display.lastWrapWidth = update.wrapperWidth;
|
4183 |
+
startWorker(cm, 400);
|
4184 |
+
}
|
4185 |
+
|
4186 |
+
display.updateLineNumbers = null;
|
4187 |
+
|
4188 |
+
return true
|
4189 |
+
}
|
4190 |
+
|
4191 |
+
function postUpdateDisplay(cm, update) {
|
4192 |
+
var viewport = update.viewport;
|
4193 |
+
|
4194 |
+
for (var first = true;; first = false) {
|
4195 |
+
if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
|
4196 |
+
// Clip forced viewport to actual scrollable area.
|
4197 |
+
if (viewport && viewport.top != null)
|
4198 |
+
{ viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
|
4199 |
+
// Updated line heights might result in the drawn area not
|
4200 |
+
// actually covering the viewport. Keep looping until it does.
|
4201 |
+
update.visible = visibleLines(cm.display, cm.doc, viewport);
|
4202 |
+
if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
|
4203 |
+
{ break }
|
4204 |
+
}
|
4205 |
+
if (!updateDisplayIfNeeded(cm, update)) { break }
|
4206 |
+
updateHeightsInViewport(cm);
|
4207 |
+
var barMeasure = measureForScrollbars(cm);
|
4208 |
+
updateSelection(cm);
|
4209 |
+
updateScrollbars(cm, barMeasure);
|
4210 |
+
setDocumentHeight(cm, barMeasure);
|
4211 |
+
}
|
4212 |
+
|
4213 |
+
update.signal(cm, "update", cm);
|
4214 |
+
if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
|
4215 |
+
update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
|
4216 |
+
cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
|
4217 |
+
}
|
4218 |
+
}
|
4219 |
+
|
4220 |
+
function updateDisplaySimple(cm, viewport) {
|
4221 |
+
var update = new DisplayUpdate(cm, viewport);
|
4222 |
+
if (updateDisplayIfNeeded(cm, update)) {
|
4223 |
+
updateHeightsInViewport(cm);
|
4224 |
+
postUpdateDisplay(cm, update);
|
4225 |
+
var barMeasure = measureForScrollbars(cm);
|
4226 |
+
updateSelection(cm);
|
4227 |
+
updateScrollbars(cm, barMeasure);
|
4228 |
+
setDocumentHeight(cm, barMeasure);
|
4229 |
+
update.finish();
|
4230 |
+
}
|
4231 |
+
}
|
4232 |
+
|
4233 |
+
// Sync the actual display DOM structure with display.view, removing
|
4234 |
+
// nodes for lines that are no longer in view, and creating the ones
|
4235 |
+
// that are not there yet, and updating the ones that are out of
|
4236 |
+
// date.
|
4237 |
+
function patchDisplay(cm, updateNumbersFrom, dims) {
|
4238 |
+
var display = cm.display, lineNumbers = cm.options.lineNumbers;
|
4239 |
+
var container = display.lineDiv, cur = container.firstChild;
|
4240 |
+
|
4241 |
+
function rm(node) {
|
4242 |
+
var next = node.nextSibling;
|
4243 |
+
// Works around a throw-scroll bug in OS X Webkit
|
4244 |
+
if (webkit && mac && cm.display.currentWheelTarget == node)
|
4245 |
+
{ node.style.display = "none"; }
|
4246 |
+
else
|
4247 |
+
{ node.parentNode.removeChild(node); }
|
4248 |
+
return next
|
4249 |
+
}
|
4250 |
+
|
4251 |
+
var view = display.view, lineN = display.viewFrom;
|
4252 |
+
// Loop over the elements in the view, syncing cur (the DOM nodes
|
4253 |
+
// in display.lineDiv) with the view as we go.
|
4254 |
+
for (var i = 0; i < view.length; i++) {
|
4255 |
+
var lineView = view[i];
|
4256 |
+
if (lineView.hidden) {
|
4257 |
+
} else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
|
4258 |
+
var node = buildLineElement(cm, lineView, lineN, dims);
|
4259 |
+
container.insertBefore(node, cur);
|
4260 |
+
} else { // Already drawn
|
4261 |
+
while (cur != lineView.node) { cur = rm(cur); }
|
4262 |
+
var updateNumber = lineNumbers && updateNumbersFrom != null &&
|
4263 |
+
updateNumbersFrom <= lineN && lineView.lineNumber;
|
4264 |
+
if (lineView.changes) {
|
4265 |
+
if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
|
4266 |
+
updateLineForChanges(cm, lineView, lineN, dims);
|
4267 |
+
}
|
4268 |
+
if (updateNumber) {
|
4269 |
+
removeChildren(lineView.lineNumber);
|
4270 |
+
lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
|
4271 |
+
}
|
4272 |
+
cur = lineView.node.nextSibling;
|
4273 |
+
}
|
4274 |
+
lineN += lineView.size;
|
4275 |
+
}
|
4276 |
+
while (cur) { cur = rm(cur); }
|
4277 |
+
}
|
4278 |
+
|
4279 |
+
function updateGutterSpace(cm) {
|
4280 |
+
var width = cm.display.gutters.offsetWidth;
|
4281 |
+
cm.display.sizer.style.marginLeft = width + "px";
|
4282 |
+
}
|
4283 |
+
|
4284 |
+
function setDocumentHeight(cm, measure) {
|
4285 |
+
cm.display.sizer.style.minHeight = measure.docHeight + "px";
|
4286 |
+
cm.display.heightForcer.style.top = measure.docHeight + "px";
|
4287 |
+
cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
|
4288 |
+
}
|
4289 |
+
|
4290 |
+
// Rebuild the gutter elements, ensure the margin to the left of the
|
4291 |
+
// code matches their width.
|
4292 |
+
function updateGutters(cm) {
|
4293 |
+
var gutters = cm.display.gutters, specs = cm.options.gutters;
|
4294 |
+
removeChildren(gutters);
|
4295 |
+
var i = 0;
|
4296 |
+
for (; i < specs.length; ++i) {
|
4297 |
+
var gutterClass = specs[i];
|
4298 |
+
var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
|
4299 |
+
if (gutterClass == "CodeMirror-linenumbers") {
|
4300 |
+
cm.display.lineGutter = gElt;
|
4301 |
+
gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
|
4302 |
+
}
|
4303 |
+
}
|
4304 |
+
gutters.style.display = i ? "" : "none";
|
4305 |
+
updateGutterSpace(cm);
|
4306 |
+
}
|
4307 |
+
|
4308 |
+
// Make sure the gutters options contains the element
|
4309 |
+
// "CodeMirror-linenumbers" when the lineNumbers option is true.
|
4310 |
+
function setGuttersForLineNumbers(options) {
|
4311 |
+
var found = indexOf(options.gutters, "CodeMirror-linenumbers");
|
4312 |
+
if (found == -1 && options.lineNumbers) {
|
4313 |
+
options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
|
4314 |
+
} else if (found > -1 && !options.lineNumbers) {
|
4315 |
+
options.gutters = options.gutters.slice(0);
|
4316 |
+
options.gutters.splice(found, 1);
|
4317 |
+
}
|
4318 |
+
}
|
4319 |
+
|
4320 |
+
// Selection objects are immutable. A new one is created every time
|
4321 |
+
// the selection changes. A selection is one or more non-overlapping
|
4322 |
+
// (and non-touching) ranges, sorted, and an integer that indicates
|
4323 |
+
// which one is the primary selection (the one that's scrolled into
|
4324 |
+
// view, that getCursor returns, etc).
|
4325 |
+
var Selection = function(ranges, primIndex) {
|
4326 |
+
this.ranges = ranges;
|
4327 |
+
this.primIndex = primIndex;
|
4328 |
+
};
|
4329 |
+
|
4330 |
+
Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
|
4331 |
+
|
4332 |
+
Selection.prototype.equals = function (other) {
|
4333 |
+
var this$1 = this;
|
4334 |
+
|
4335 |
+
if (other == this) { return true }
|
4336 |
+
if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
|
4337 |
+
for (var i = 0; i < this.ranges.length; i++) {
|
4338 |
+
var here = this$1.ranges[i], there = other.ranges[i];
|
4339 |
+
if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
|
4340 |
+
}
|
4341 |
+
return true
|
4342 |
+
};
|
4343 |
+
|
4344 |
+
Selection.prototype.deepCopy = function () {
|
4345 |
+
var this$1 = this;
|
4346 |
+
|
4347 |
+
var out = [];
|
4348 |
+
for (var i = 0; i < this.ranges.length; i++)
|
4349 |
+
{ out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
|
4350 |
+
return new Selection(out, this.primIndex)
|
4351 |
+
};
|
4352 |
+
|
4353 |
+
Selection.prototype.somethingSelected = function () {
|
4354 |
+
var this$1 = this;
|
4355 |
+
|
4356 |
+
for (var i = 0; i < this.ranges.length; i++)
|
4357 |
+
{ if (!this$1.ranges[i].empty()) { return true } }
|
4358 |
+
return false
|
4359 |
+
};
|
4360 |
+
|
4361 |
+
Selection.prototype.contains = function (pos, end) {
|
4362 |
+
var this$1 = this;
|
4363 |
+
|
4364 |
+
if (!end) { end = pos; }
|
4365 |
+
for (var i = 0; i < this.ranges.length; i++) {
|
4366 |
+
var range = this$1.ranges[i];
|
4367 |
+
if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
|
4368 |
+
{ return i }
|
4369 |
+
}
|
4370 |
+
return -1
|
4371 |
+
};
|
4372 |
+
|
4373 |
+
var Range = function(anchor, head) {
|
4374 |
+
this.anchor = anchor; this.head = head;
|
4375 |
+
};
|
4376 |
+
|
4377 |
+
Range.prototype.from = function () { return minPos(this.anchor, this.head) };
|
4378 |
+
Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
|
4379 |
+
Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
|
4380 |
+
|
4381 |
+
// Take an unsorted, potentially overlapping set of ranges, and
|
4382 |
+
// build a selection out of it. 'Consumes' ranges array (modifying
|
4383 |
+
// it).
|
4384 |
+
function normalizeSelection(ranges, primIndex) {
|
4385 |
+
var prim = ranges[primIndex];
|
4386 |
+
ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
|
4387 |
+
primIndex = indexOf(ranges, prim);
|
4388 |
+
for (var i = 1; i < ranges.length; i++) {
|
4389 |
+
var cur = ranges[i], prev = ranges[i - 1];
|
4390 |
+
if (cmp(prev.to(), cur.from()) >= 0) {
|
4391 |
+
var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
|
4392 |
+
var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
|
4393 |
+
if (i <= primIndex) { --primIndex; }
|
4394 |
+
ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
|
4395 |
+
}
|
4396 |
+
}
|
4397 |
+
return new Selection(ranges, primIndex)
|
4398 |
+
}
|
4399 |
+
|
4400 |
+
function simpleSelection(anchor, head) {
|
4401 |
+
return new Selection([new Range(anchor, head || anchor)], 0)
|
4402 |
+
}
|
4403 |
+
|
4404 |
+
// Compute the position of the end of a change (its 'to' property
|
4405 |
+
// refers to the pre-change end).
|
4406 |
+
function changeEnd(change) {
|
4407 |
+
if (!change.text) { return change.to }
|
4408 |
+
return Pos(change.from.line + change.text.length - 1,
|
4409 |
+
lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
|
4410 |
+
}
|
4411 |
+
|
4412 |
+
// Adjust a position to refer to the post-change position of the
|
4413 |
+
// same text, or the end of the change if the change covers it.
|
4414 |
+
function adjustForChange(pos, change) {
|
4415 |
+
if (cmp(pos, change.from) < 0) { return pos }
|
4416 |
+
if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
|
4417 |
+
|
4418 |
+
var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
|
4419 |
+
if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
|
4420 |
+
return Pos(line, ch)
|
4421 |
+
}
|
4422 |
+
|
4423 |
+
function computeSelAfterChange(doc, change) {
|
4424 |
+
var out = [];
|
4425 |
+
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
4426 |
+
var range = doc.sel.ranges[i];
|
4427 |
+
out.push(new Range(adjustForChange(range.anchor, change),
|
4428 |
+
adjustForChange(range.head, change)));
|
4429 |
+
}
|
4430 |
+
return normalizeSelection(out, doc.sel.primIndex)
|
4431 |
+
}
|
4432 |
+
|
4433 |
+
function offsetPos(pos, old, nw) {
|
4434 |
+
if (pos.line == old.line)
|
4435 |
+
{ return Pos(nw.line, pos.ch - old.ch + nw.ch) }
|
4436 |
+
else
|
4437 |
+
{ return Pos(nw.line + (pos.line - old.line), pos.ch) }
|
4438 |
+
}
|
4439 |
+
|
4440 |
+
// Used by replaceSelections to allow moving the selection to the
|
4441 |
+
// start or around the replaced test. Hint may be "start" or "around".
|
4442 |
+
function computeReplacedSel(doc, changes, hint) {
|
4443 |
+
var out = [];
|
4444 |
+
var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
|
4445 |
+
for (var i = 0; i < changes.length; i++) {
|
4446 |
+
var change = changes[i];
|
4447 |
+
var from = offsetPos(change.from, oldPrev, newPrev);
|
4448 |
+
var to = offsetPos(changeEnd(change), oldPrev, newPrev);
|
4449 |
+
oldPrev = change.to;
|
4450 |
+
newPrev = to;
|
4451 |
+
if (hint == "around") {
|
4452 |
+
var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
|
4453 |
+
out[i] = new Range(inv ? to : from, inv ? from : to);
|
4454 |
+
} else {
|
4455 |
+
out[i] = new Range(from, from);
|
4456 |
+
}
|
4457 |
+
}
|
4458 |
+
return new Selection(out, doc.sel.primIndex)
|
4459 |
+
}
|
4460 |
+
|
4461 |
+
// Used to get the editor into a consistent state again when options change.
|
4462 |
+
|
4463 |
+
function loadMode(cm) {
|
4464 |
+
cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
|
4465 |
+
resetModeState(cm);
|
4466 |
+
}
|
4467 |
+
|
4468 |
+
function resetModeState(cm) {
|
4469 |
+
cm.doc.iter(function (line) {
|
4470 |
+
if (line.stateAfter) { line.stateAfter = null; }
|
4471 |
+
if (line.styles) { line.styles = null; }
|
4472 |
+
});
|
4473 |
+
cm.doc.frontier = cm.doc.first;
|
4474 |
+
startWorker(cm, 100);
|
4475 |
+
cm.state.modeGen++;
|
4476 |
+
if (cm.curOp) { regChange(cm); }
|
4477 |
+
}
|
4478 |
+
|
4479 |
+
// DOCUMENT DATA STRUCTURE
|
4480 |
+
|
4481 |
+
// By default, updates that start and end at the beginning of a line
|
4482 |
+
// are treated specially, in order to make the association of line
|
4483 |
+
// widgets and marker elements with the text behave more intuitive.
|
4484 |
+
function isWholeLineUpdate(doc, change) {
|
4485 |
+
return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
|
4486 |
+
(!doc.cm || doc.cm.options.wholeLineUpdateBefore)
|
4487 |
+
}
|
4488 |
+
|
4489 |
+
// Perform a change on the document data structure.
|
4490 |
+
function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
|
4491 |
+
function spansFor(n) {return markedSpans ? markedSpans[n] : null}
|
4492 |
+
function update(line, text, spans) {
|
4493 |
+
updateLine(line, text, spans, estimateHeight$$1);
|
4494 |
+
signalLater(line, "change", line, change);
|
4495 |
+
}
|
4496 |
+
function linesFor(start, end) {
|
4497 |
+
var result = [];
|
4498 |
+
for (var i = start; i < end; ++i)
|
4499 |
+
{ result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
|
4500 |
+
return result
|
4501 |
+
}
|
4502 |
+
|
4503 |
+
var from = change.from, to = change.to, text = change.text;
|
4504 |
+
var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
|
4505 |
+
var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
|
4506 |
+
|
4507 |
+
// Adjust the line structure
|
4508 |
+
if (change.full) {
|
4509 |
+
doc.insert(0, linesFor(0, text.length));
|
4510 |
+
doc.remove(text.length, doc.size - text.length);
|
4511 |
+
} else if (isWholeLineUpdate(doc, change)) {
|
4512 |
+
// This is a whole-line replace. Treated specially to make
|
4513 |
+
// sure line objects move the way they are supposed to.
|
4514 |
+
var added = linesFor(0, text.length - 1);
|
4515 |
+
update(lastLine, lastLine.text, lastSpans);
|
4516 |
+
if (nlines) { doc.remove(from.line, nlines); }
|
4517 |
+
if (added.length) { doc.insert(from.line, added); }
|
4518 |
+
} else if (firstLine == lastLine) {
|
4519 |
+
if (text.length == 1) {
|
4520 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
|
4521 |
+
} else {
|
4522 |
+
var added$1 = linesFor(1, text.length - 1);
|
4523 |
+
added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
|
4524 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
|
4525 |
+
doc.insert(from.line + 1, added$1);
|
4526 |
+
}
|
4527 |
+
} else if (text.length == 1) {
|
4528 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
|
4529 |
+
doc.remove(from.line + 1, nlines);
|
4530 |
+
} else {
|
4531 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
|
4532 |
+
update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
|
4533 |
+
var added$2 = linesFor(1, text.length - 1);
|
4534 |
+
if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
|
4535 |
+
doc.insert(from.line + 1, added$2);
|
4536 |
+
}
|
4537 |
+
|
4538 |
+
signalLater(doc, "change", doc, change);
|
4539 |
+
}
|
4540 |
+
|
4541 |
+
// Call f for all linked documents.
|
4542 |
+
function linkedDocs(doc, f, sharedHistOnly) {
|
4543 |
+
function propagate(doc, skip, sharedHist) {
|
4544 |
+
if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
|
4545 |
+
var rel = doc.linked[i];
|
4546 |
+
if (rel.doc == skip) { continue }
|
4547 |
+
var shared = sharedHist && rel.sharedHist;
|
4548 |
+
if (sharedHistOnly && !shared) { continue }
|
4549 |
+
f(rel.doc, shared);
|
4550 |
+
propagate(rel.doc, doc, shared);
|
4551 |
+
} }
|
4552 |
+
}
|
4553 |
+
propagate(doc, null, true);
|
4554 |
+
}
|
4555 |
+
|
4556 |
+
// Attach a document to an editor.
|
4557 |
+
function attachDoc(cm, doc) {
|
4558 |
+
if (doc.cm) { throw new Error("This document is already in use.") }
|
4559 |
+
cm.doc = doc;
|
4560 |
+
doc.cm = cm;
|
4561 |
+
estimateLineHeights(cm);
|
4562 |
+
loadMode(cm);
|
4563 |
+
setDirectionClass(cm);
|
4564 |
+
if (!cm.options.lineWrapping) { findMaxLine(cm); }
|
4565 |
+
cm.options.mode = doc.modeOption;
|
4566 |
+
regChange(cm);
|
4567 |
+
}
|
4568 |
+
|
4569 |
+
function setDirectionClass(cm) {
|
4570 |
+
(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
|
4571 |
+
}
|
4572 |
+
|
4573 |
+
function directionChanged(cm) {
|
4574 |
+
runInOp(cm, function () {
|
4575 |
+
setDirectionClass(cm);
|
4576 |
+
regChange(cm);
|
4577 |
+
});
|
4578 |
+
}
|
4579 |
+
|
4580 |
+
function History(startGen) {
|
4581 |
+
// Arrays of change events and selections. Doing something adds an
|
4582 |
+
// event to done and clears undo. Undoing moves events from done
|
4583 |
+
// to undone, redoing moves them in the other direction.
|
4584 |
+
this.done = []; this.undone = [];
|
4585 |
+
this.undoDepth = Infinity;
|
4586 |
+
// Used to track when changes can be merged into a single undo
|
4587 |
+
// event
|
4588 |
+
this.lastModTime = this.lastSelTime = 0;
|
4589 |
+
this.lastOp = this.lastSelOp = null;
|
4590 |
+
this.lastOrigin = this.lastSelOrigin = null;
|
4591 |
+
// Used by the isClean() method
|
4592 |
+
this.generation = this.maxGeneration = startGen || 1;
|
4593 |
+
}
|
4594 |
+
|
4595 |
+
// Create a history change event from an updateDoc-style change
|
4596 |
+
// object.
|
4597 |
+
function historyChangeFromChange(doc, change) {
|
4598 |
+
var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
|
4599 |
+
attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
|
4600 |
+
linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
|
4601 |
+
return histChange
|
4602 |
+
}
|
4603 |
+
|
4604 |
+
// Pop all selection events off the end of a history array. Stop at
|
4605 |
+
// a change event.
|
4606 |
+
function clearSelectionEvents(array) {
|
4607 |
+
while (array.length) {
|
4608 |
+
var last = lst(array);
|
4609 |
+
if (last.ranges) { array.pop(); }
|
4610 |
+
else { break }
|
4611 |
+
}
|
4612 |
+
}
|
4613 |
+
|
4614 |
+
// Find the top change event in the history. Pop off selection
|
4615 |
+
// events that are in the way.
|
4616 |
+
function lastChangeEvent(hist, force) {
|
4617 |
+
if (force) {
|
4618 |
+
clearSelectionEvents(hist.done);
|
4619 |
+
return lst(hist.done)
|
4620 |
+
} else if (hist.done.length && !lst(hist.done).ranges) {
|
4621 |
+
return lst(hist.done)
|
4622 |
+
} else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
|
4623 |
+
hist.done.pop();
|
4624 |
+
return lst(hist.done)
|
4625 |
+
}
|
4626 |
+
}
|
4627 |
+
|
4628 |
+
// Register a change in the history. Merges changes that are within
|
4629 |
+
// a single operation, or are close together with an origin that
|
4630 |
+
// allows merging (starting with "+") into a single event.
|
4631 |
+
function addChangeToHistory(doc, change, selAfter, opId) {
|
4632 |
+
var hist = doc.history;
|
4633 |
+
hist.undone.length = 0;
|
4634 |
+
var time = +new Date, cur;
|
4635 |
+
var last;
|
4636 |
+
|
4637 |
+
if ((hist.lastOp == opId ||
|
4638 |
+
hist.lastOrigin == change.origin && change.origin &&
|
4639 |
+
((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
|
4640 |
+
change.origin.charAt(0) == "*")) &&
|
4641 |
+
(cur = lastChangeEvent(hist, hist.lastOp == opId))) {
|
4642 |
+
// Merge this change into the last event
|
4643 |
+
last = lst(cur.changes);
|
4644 |
+
if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
|
4645 |
+
// Optimized case for simple insertion -- don't want to add
|
4646 |
+
// new changesets for every character typed
|
4647 |
+
last.to = changeEnd(change);
|
4648 |
+
} else {
|
4649 |
+
// Add new sub-event
|
4650 |
+
cur.changes.push(historyChangeFromChange(doc, change));
|
4651 |
+
}
|
4652 |
+
} else {
|
4653 |
+
// Can not be merged, start a new event.
|
4654 |
+
var before = lst(hist.done);
|
4655 |
+
if (!before || !before.ranges)
|
4656 |
+
{ pushSelectionToHistory(doc.sel, hist.done); }
|
4657 |
+
cur = {changes: [historyChangeFromChange(doc, change)],
|
4658 |
+
generation: hist.generation};
|
4659 |
+
hist.done.push(cur);
|
4660 |
+
while (hist.done.length > hist.undoDepth) {
|
4661 |
+
hist.done.shift();
|
4662 |
+
if (!hist.done[0].ranges) { hist.done.shift(); }
|
4663 |
+
}
|
4664 |
+
}
|
4665 |
+
hist.done.push(selAfter);
|
4666 |
+
hist.generation = ++hist.maxGeneration;
|
4667 |
+
hist.lastModTime = hist.lastSelTime = time;
|
4668 |
+
hist.lastOp = hist.lastSelOp = opId;
|
4669 |
+
hist.lastOrigin = hist.lastSelOrigin = change.origin;
|
4670 |
+
|
4671 |
+
if (!last) { signal(doc, "historyAdded"); }
|
4672 |
+
}
|
4673 |
+
|
4674 |
+
function selectionEventCanBeMerged(doc, origin, prev, sel) {
|
4675 |
+
var ch = origin.charAt(0);
|
4676 |
+
return ch == "*" ||
|
4677 |
+
ch == "+" &&
|
4678 |
+
prev.ranges.length == sel.ranges.length &&
|
4679 |
+
prev.somethingSelected() == sel.somethingSelected() &&
|
4680 |
+
new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
|
4681 |
+
}
|
4682 |
+
|
4683 |
+
// Called whenever the selection changes, sets the new selection as
|
4684 |
+
// the pending selection in the history, and pushes the old pending
|
4685 |
+
// selection into the 'done' array when it was significantly
|
4686 |
+
// different (in number of selected ranges, emptiness, or time).
|
4687 |
+
function addSelectionToHistory(doc, sel, opId, options) {
|
4688 |
+
var hist = doc.history, origin = options && options.origin;
|
4689 |
+
|
4690 |
+
// A new event is started when the previous origin does not match
|
4691 |
+
// the current, or the origins don't allow matching. Origins
|
4692 |
+
// starting with * are always merged, those starting with + are
|
4693 |
+
// merged when similar and close together in time.
|
4694 |
+
if (opId == hist.lastSelOp ||
|
4695 |
+
(origin && hist.lastSelOrigin == origin &&
|
4696 |
+
(hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
|
4697 |
+
selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
|
4698 |
+
{ hist.done[hist.done.length - 1] = sel; }
|
4699 |
+
else
|
4700 |
+
{ pushSelectionToHistory(sel, hist.done); }
|
4701 |
+
|
4702 |
+
hist.lastSelTime = +new Date;
|
4703 |
+
hist.lastSelOrigin = origin;
|
4704 |
+
hist.lastSelOp = opId;
|
4705 |
+
if (options && options.clearRedo !== false)
|
4706 |
+
{ clearSelectionEvents(hist.undone); }
|
4707 |
+
}
|
4708 |
+
|
4709 |
+
function pushSelectionToHistory(sel, dest) {
|
4710 |
+
var top = lst(dest);
|
4711 |
+
if (!(top && top.ranges && top.equals(sel)))
|
4712 |
+
{ dest.push(sel); }
|
4713 |
+
}
|
4714 |
+
|
4715 |
+
// Used to store marked span information in the history.
|
4716 |
+
function attachLocalSpans(doc, change, from, to) {
|
4717 |
+
var existing = change["spans_" + doc.id], n = 0;
|
4718 |
+
doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
|
4719 |
+
if (line.markedSpans)
|
4720 |
+
{ (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
|
4721 |
+
++n;
|
4722 |
+
});
|
4723 |
+
}
|
4724 |
+
|
4725 |
+
// When un/re-doing restores text containing marked spans, those
|
4726 |
+
// that have been explicitly cleared should not be restored.
|
4727 |
+
function removeClearedSpans(spans) {
|
4728 |
+
if (!spans) { return null }
|
4729 |
+
var out;
|
4730 |
+
for (var i = 0; i < spans.length; ++i) {
|
4731 |
+
if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
|
4732 |
+
else if (out) { out.push(spans[i]); }
|
4733 |
+
}
|
4734 |
+
return !out ? spans : out.length ? out : null
|
4735 |
+
}
|
4736 |
+
|
4737 |
+
// Retrieve and filter the old marked spans stored in a change event.
|
4738 |
+
function getOldSpans(doc, change) {
|
4739 |
+
var found = change["spans_" + doc.id];
|
4740 |
+
if (!found) { return null }
|
4741 |
+
var nw = [];
|
4742 |
+
for (var i = 0; i < change.text.length; ++i)
|
4743 |
+
{ nw.push(removeClearedSpans(found[i])); }
|
4744 |
+
return nw
|
4745 |
+
}
|
4746 |
+
|
4747 |
+
// Used for un/re-doing changes from the history. Combines the
|
4748 |
+
// result of computing the existing spans with the set of spans that
|
4749 |
+
// existed in the history (so that deleting around a span and then
|
4750 |
+
// undoing brings back the span).
|
4751 |
+
function mergeOldSpans(doc, change) {
|
4752 |
+
var old = getOldSpans(doc, change);
|
4753 |
+
var stretched = stretchSpansOverChange(doc, change);
|
4754 |
+
if (!old) { return stretched }
|
4755 |
+
if (!stretched) { return old }
|
4756 |
+
|
4757 |
+
for (var i = 0; i < old.length; ++i) {
|
4758 |
+
var oldCur = old[i], stretchCur = stretched[i];
|
4759 |
+
if (oldCur && stretchCur) {
|
4760 |
+
spans: for (var j = 0; j < stretchCur.length; ++j) {
|
4761 |
+
var span = stretchCur[j];
|
4762 |
+
for (var k = 0; k < oldCur.length; ++k)
|
4763 |
+
{ if (oldCur[k].marker == span.marker) { continue spans } }
|
4764 |
+
oldCur.push(span);
|
4765 |
+
}
|
4766 |
+
} else if (stretchCur) {
|
4767 |
+
old[i] = stretchCur;
|
4768 |
+
}
|
4769 |
+
}
|
4770 |
+
return old
|
4771 |
+
}
|
4772 |
+
|
4773 |
+
// Used both to provide a JSON-safe object in .getHistory, and, when
|
4774 |
+
// detaching a document, to split the history in two
|
4775 |
+
function copyHistoryArray(events, newGroup, instantiateSel) {
|
4776 |
+
var copy = [];
|
4777 |
+
for (var i = 0; i < events.length; ++i) {
|
4778 |
+
var event = events[i];
|
4779 |
+
if (event.ranges) {
|
4780 |
+
copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
|
4781 |
+
continue
|
4782 |
+
}
|
4783 |
+
var changes = event.changes, newChanges = [];
|
4784 |
+
copy.push({changes: newChanges});
|
4785 |
+
for (var j = 0; j < changes.length; ++j) {
|
4786 |
+
var change = changes[j], m = (void 0);
|
4787 |
+
newChanges.push({from: change.from, to: change.to, text: change.text});
|
4788 |
+
if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
|
4789 |
+
if (indexOf(newGroup, Number(m[1])) > -1) {
|
4790 |
+
lst(newChanges)[prop] = change[prop];
|
4791 |
+
delete change[prop];
|
4792 |
+
}
|
4793 |
+
} } }
|
4794 |
+
}
|
4795 |
+
}
|
4796 |
+
return copy
|
4797 |
+
}
|
4798 |
+
|
4799 |
+
// The 'scroll' parameter given to many of these indicated whether
|
4800 |
+
// the new cursor position should be scrolled into view after
|
4801 |
+
// modifying the selection.
|
4802 |
+
|
4803 |
+
// If shift is held or the extend flag is set, extends a range to
|
4804 |
+
// include a given position (and optionally a second position).
|
4805 |
+
// Otherwise, simply returns the range between the given positions.
|
4806 |
+
// Used for cursor motion and such.
|
4807 |
+
function extendRange(doc, range, head, other) {
|
4808 |
+
if (doc.cm && doc.cm.display.shift || doc.extend) {
|
4809 |
+
var anchor = range.anchor;
|
4810 |
+
if (other) {
|
4811 |
+
var posBefore = cmp(head, anchor) < 0;
|
4812 |
+
if (posBefore != (cmp(other, anchor) < 0)) {
|
4813 |
+
anchor = head;
|
4814 |
+
head = other;
|
4815 |
+
} else if (posBefore != (cmp(head, other) < 0)) {
|
4816 |
+
head = other;
|
4817 |
+
}
|
4818 |
+
}
|
4819 |
+
return new Range(anchor, head)
|
4820 |
+
} else {
|
4821 |
+
return new Range(other || head, head)
|
4822 |
+
}
|
4823 |
+
}
|
4824 |
+
|
4825 |
+
// Extend the primary selection range, discard the rest.
|
4826 |
+
function extendSelection(doc, head, other, options) {
|
4827 |
+
setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
|
4828 |
+
}
|
4829 |
+
|
4830 |
+
// Extend all selections (pos is an array of selections with length
|
4831 |
+
// equal the number of selections)
|
4832 |
+
function extendSelections(doc, heads, options) {
|
4833 |
+
var out = [];
|
4834 |
+
for (var i = 0; i < doc.sel.ranges.length; i++)
|
4835 |
+
{ out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); }
|
4836 |
+
var newSel = normalizeSelection(out, doc.sel.primIndex);
|
4837 |
+
setSelection(doc, newSel, options);
|
4838 |
+
}
|
4839 |
+
|
4840 |
+
// Updates a single range in the selection.
|
4841 |
+
function replaceOneSelection(doc, i, range, options) {
|
4842 |
+
var ranges = doc.sel.ranges.slice(0);
|
4843 |
+
ranges[i] = range;
|
4844 |
+
setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);
|
4845 |
+
}
|
4846 |
+
|
4847 |
+
// Reset the selection to a single range.
|
4848 |
+
function setSimpleSelection(doc, anchor, head, options) {
|
4849 |
+
setSelection(doc, simpleSelection(anchor, head), options);
|
4850 |
+
}
|
4851 |
+
|
4852 |
+
// Give beforeSelectionChange handlers a change to influence a
|
4853 |
+
// selection update.
|
4854 |
+
function filterSelectionChange(doc, sel, options) {
|
4855 |
+
var obj = {
|
4856 |
+
ranges: sel.ranges,
|
4857 |
+
update: function(ranges) {
|
4858 |
+
var this$1 = this;
|
4859 |
+
|
4860 |
+
this.ranges = [];
|
4861 |
+
for (var i = 0; i < ranges.length; i++)
|
4862 |
+
{ this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
|
4863 |
+
clipPos(doc, ranges[i].head)); }
|
4864 |
+
},
|
4865 |
+
origin: options && options.origin
|
4866 |
+
};
|
4867 |
+
signal(doc, "beforeSelectionChange", doc, obj);
|
4868 |
+
if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
|
4869 |
+
if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
|
4870 |
+
else { return sel }
|
4871 |
+
}
|
4872 |
+
|
4873 |
+
function setSelectionReplaceHistory(doc, sel, options) {
|
4874 |
+
var done = doc.history.done, last = lst(done);
|
4875 |
+
if (last && last.ranges) {
|
4876 |
+
done[done.length - 1] = sel;
|
4877 |
+
setSelectionNoUndo(doc, sel, options);
|
4878 |
+
} else {
|
4879 |
+
setSelection(doc, sel, options);
|
4880 |
+
}
|
4881 |
+
}
|
4882 |
+
|
4883 |
+
// Set a new selection.
|
4884 |
+
function setSelection(doc, sel, options) {
|
4885 |
+
setSelectionNoUndo(doc, sel, options);
|
4886 |
+
addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
|
4887 |
+
}
|
4888 |
+
|
4889 |
+
function setSelectionNoUndo(doc, sel, options) {
|
4890 |
+
if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
|
4891 |
+
{ sel = filterSelectionChange(doc, sel, options); }
|
4892 |
+
|
4893 |
+
var bias = options && options.bias ||
|
4894 |
+
(cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
|
4895 |
+
setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
|
4896 |
+
|
4897 |
+
if (!(options && options.scroll === false) && doc.cm)
|
4898 |
+
{ ensureCursorVisible(doc.cm); }
|
4899 |
+
}
|
4900 |
+
|
4901 |
+
function setSelectionInner(doc, sel) {
|
4902 |
+
if (sel.equals(doc.sel)) { return }
|
4903 |
+
|
4904 |
+
doc.sel = sel;
|
4905 |
+
|
4906 |
+
if (doc.cm) {
|
4907 |
+
doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
|
4908 |
+
signalCursorActivity(doc.cm);
|
4909 |
+
}
|
4910 |
+
signalLater(doc, "cursorActivity", doc);
|
4911 |
+
}
|
4912 |
+
|
4913 |
+
// Verify that the selection does not partially select any atomic
|
4914 |
+
// marked ranges.
|
4915 |
+
function reCheckSelection(doc) {
|
4916 |
+
setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);
|
4917 |
+
}
|
4918 |
+
|
4919 |
+
// Return a selection that does not partially select any atomic
|
4920 |
+
// ranges.
|
4921 |
+
function skipAtomicInSelection(doc, sel, bias, mayClear) {
|
4922 |
+
var out;
|
4923 |
+
for (var i = 0; i < sel.ranges.length; i++) {
|
4924 |
+
var range = sel.ranges[i];
|
4925 |
+
var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
|
4926 |
+
var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
|
4927 |
+
var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
|
4928 |
+
if (out || newAnchor != range.anchor || newHead != range.head) {
|
4929 |
+
if (!out) { out = sel.ranges.slice(0, i); }
|
4930 |
+
out[i] = new Range(newAnchor, newHead);
|
4931 |
+
}
|
4932 |
+
}
|
4933 |
+
return out ? normalizeSelection(out, sel.primIndex) : sel
|
4934 |
+
}
|
4935 |
+
|
4936 |
+
function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
|
4937 |
+
var line = getLine(doc, pos.line);
|
4938 |
+
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
4939 |
+
var sp = line.markedSpans[i], m = sp.marker;
|
4940 |
+
if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
|
4941 |
+
(sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
|
4942 |
+
if (mayClear) {
|
4943 |
+
signal(m, "beforeCursorEnter");
|
4944 |
+
if (m.explicitlyCleared) {
|
4945 |
+
if (!line.markedSpans) { break }
|
4946 |
+
else {--i; continue}
|
4947 |
+
}
|
4948 |
+
}
|
4949 |
+
if (!m.atomic) { continue }
|
4950 |
+
|
4951 |
+
if (oldPos) {
|
4952 |
+
var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
|
4953 |
+
if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
|
4954 |
+
{ near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
|
4955 |
+
if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
|
4956 |
+
{ return skipAtomicInner(doc, near, pos, dir, mayClear) }
|
4957 |
+
}
|
4958 |
+
|
4959 |
+
var far = m.find(dir < 0 ? -1 : 1);
|
4960 |
+
if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
|
4961 |
+
{ far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
|
4962 |
+
return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
|
4963 |
+
}
|
4964 |
+
} }
|
4965 |
+
return pos
|
4966 |
+
}
|
4967 |
+
|
4968 |
+
// Ensure a given position is not inside an atomic range.
|
4969 |
+
function skipAtomic(doc, pos, oldPos, bias, mayClear) {
|
4970 |
+
var dir = bias || 1;
|
4971 |
+
var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
|
4972 |
+
(!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
|
4973 |
+
skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
|
4974 |
+
(!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
|
4975 |
+
if (!found) {
|
4976 |
+
doc.cantEdit = true;
|
4977 |
+
return Pos(doc.first, 0)
|
4978 |
+
}
|
4979 |
+
return found
|
4980 |
+
}
|
4981 |
+
|
4982 |
+
function movePos(doc, pos, dir, line) {
|
4983 |
+
if (dir < 0 && pos.ch == 0) {
|
4984 |
+
if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
|
4985 |
+
else { return null }
|
4986 |
+
} else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
|
4987 |
+
if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
|
4988 |
+
else { return null }
|
4989 |
+
} else {
|
4990 |
+
return new Pos(pos.line, pos.ch + dir)
|
4991 |
+
}
|
4992 |
+
}
|
4993 |
+
|
4994 |
+
function selectAll(cm) {
|
4995 |
+
cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
|
4996 |
+
}
|
4997 |
+
|
4998 |
+
// UPDATING
|
4999 |
+
|
5000 |
+
// Allow "beforeChange" event handlers to influence a change
|
5001 |
+
function filterChange(doc, change, update) {
|
5002 |
+
var obj = {
|
5003 |
+
canceled: false,
|
5004 |
+
from: change.from,
|
5005 |
+
to: change.to,
|
5006 |
+
text: change.text,
|
5007 |
+
origin: change.origin,
|
5008 |
+
cancel: function () { return obj.canceled = true; }
|
5009 |
+
};
|
5010 |
+
if (update) { obj.update = function (from, to, text, origin) {
|
5011 |
+
if (from) { obj.from = clipPos(doc, from); }
|
5012 |
+
if (to) { obj.to = clipPos(doc, to); }
|
5013 |
+
if (text) { obj.text = text; }
|
5014 |
+
if (origin !== undefined) { obj.origin = origin; }
|
5015 |
+
}; }
|
5016 |
+
signal(doc, "beforeChange", doc, obj);
|
5017 |
+
if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
|
5018 |
+
|
5019 |
+
if (obj.canceled) { return null }
|
5020 |
+
return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
|
5021 |
+
}
|
5022 |
+
|
5023 |
+
// Apply a change to a document, and add it to the document's
|
5024 |
+
// history, and propagating it to all linked documents.
|
5025 |
+
function makeChange(doc, change, ignoreReadOnly) {
|
5026 |
+
if (doc.cm) {
|
5027 |
+
if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
|
5028 |
+
if (doc.cm.state.suppressEdits) { return }
|
5029 |
+
}
|
5030 |
+
|
5031 |
+
if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
|
5032 |
+
change = filterChange(doc, change, true);
|
5033 |
+
if (!change) { return }
|
5034 |
+
}
|
5035 |
+
|
5036 |
+
// Possibly split or suppress the update based on the presence
|
5037 |
+
// of read-only spans in its range.
|
5038 |
+
var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
|
5039 |
+
if (split) {
|
5040 |
+
for (var i = split.length - 1; i >= 0; --i)
|
5041 |
+
{ makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); }
|
5042 |
+
} else {
|
5043 |
+
makeChangeInner(doc, change);
|
5044 |
+
}
|
5045 |
+
}
|
5046 |
+
|
5047 |
+
function makeChangeInner(doc, change) {
|
5048 |
+
if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
|
5049 |
+
var selAfter = computeSelAfterChange(doc, change);
|
5050 |
+
addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
|
5051 |
+
|
5052 |
+
makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
|
5053 |
+
var rebased = [];
|
5054 |
+
|
5055 |
+
linkedDocs(doc, function (doc, sharedHist) {
|
5056 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
5057 |
+
rebaseHist(doc.history, change);
|
5058 |
+
rebased.push(doc.history);
|
5059 |
+
}
|
5060 |
+
makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
|
5061 |
+
});
|
5062 |
+
}
|
5063 |
+
|
5064 |
+
// Revert a change stored in a document's history.
|
5065 |
+
function makeChangeFromHistory(doc, type, allowSelectionOnly) {
|
5066 |
+
if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }
|
5067 |
+
|
5068 |
+
var hist = doc.history, event, selAfter = doc.sel;
|
5069 |
+
var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
|
5070 |
+
|
5071 |
+
// Verify that there is a useable event (so that ctrl-z won't
|
5072 |
+
// needlessly clear selection events)
|
5073 |
+
var i = 0;
|
5074 |
+
for (; i < source.length; i++) {
|
5075 |
+
event = source[i];
|
5076 |
+
if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
|
5077 |
+
{ break }
|
5078 |
+
}
|
5079 |
+
if (i == source.length) { return }
|
5080 |
+
hist.lastOrigin = hist.lastSelOrigin = null;
|
5081 |
+
|
5082 |
+
for (;;) {
|
5083 |
+
event = source.pop();
|
5084 |
+
if (event.ranges) {
|
5085 |
+
pushSelectionToHistory(event, dest);
|
5086 |
+
if (allowSelectionOnly && !event.equals(doc.sel)) {
|
5087 |
+
setSelection(doc, event, {clearRedo: false});
|
5088 |
+
return
|
5089 |
+
}
|
5090 |
+
selAfter = event;
|
5091 |
+
}
|
5092 |
+
else { break }
|
5093 |
+
}
|
5094 |
+
|
5095 |
+
// Build up a reverse change object to add to the opposite history
|
5096 |
+
// stack (redo when undoing, and vice versa).
|
5097 |
+
var antiChanges = [];
|
5098 |
+
pushSelectionToHistory(selAfter, dest);
|
5099 |
+
dest.push({changes: antiChanges, generation: hist.generation});
|
5100 |
+
hist.generation = event.generation || ++hist.maxGeneration;
|
5101 |
+
|
5102 |
+
var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
|
5103 |
+
|
5104 |
+
var loop = function ( i ) {
|
5105 |
+
var change = event.changes[i];
|
5106 |
+
change.origin = type;
|
5107 |
+
if (filter && !filterChange(doc, change, false)) {
|
5108 |
+
source.length = 0;
|
5109 |
+
return {}
|
5110 |
+
}
|
5111 |
+
|
5112 |
+
antiChanges.push(historyChangeFromChange(doc, change));
|
5113 |
+
|
5114 |
+
var after = i ? computeSelAfterChange(doc, change) : lst(source);
|
5115 |
+
makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
|
5116 |
+
if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
|
5117 |
+
var rebased = [];
|
5118 |
+
|
5119 |
+
// Propagate to the linked documents
|
5120 |
+
linkedDocs(doc, function (doc, sharedHist) {
|
5121 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
5122 |
+
rebaseHist(doc.history, change);
|
5123 |
+
rebased.push(doc.history);
|
5124 |
+
}
|
5125 |
+
makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
|
5126 |
+
});
|
5127 |
+
};
|
5128 |
+
|
5129 |
+
for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
|
5130 |
+
var returned = loop( i$1 );
|
5131 |
+
|
5132 |
+
if ( returned ) return returned.v;
|
5133 |
+
}
|
5134 |
+
}
|
5135 |
+
|
5136 |
+
// Sub-views need their line numbers shifted when text is added
|
5137 |
+
// above or below them in the parent document.
|
5138 |
+
function shiftDoc(doc, distance) {
|
5139 |
+
if (distance == 0) { return }
|
5140 |
+
doc.first += distance;
|
5141 |
+
doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
|
5142 |
+
Pos(range.anchor.line + distance, range.anchor.ch),
|
5143 |
+
Pos(range.head.line + distance, range.head.ch)
|
5144 |
+
); }), doc.sel.primIndex);
|
5145 |
+
if (doc.cm) {
|
5146 |
+
regChange(doc.cm, doc.first, doc.first - distance, distance);
|
5147 |
+
for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
|
5148 |
+
{ regLineChange(doc.cm, l, "gutter"); }
|
5149 |
+
}
|
5150 |
+
}
|
5151 |
+
|
5152 |
+
// More lower-level change function, handling only a single document
|
5153 |
+
// (not linked ones).
|
5154 |
+
function makeChangeSingleDoc(doc, change, selAfter, spans) {
|
5155 |
+
if (doc.cm && !doc.cm.curOp)
|
5156 |
+
{ return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
|
5157 |
+
|
5158 |
+
if (change.to.line < doc.first) {
|
5159 |
+
shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
|
5160 |
+
return
|
5161 |
+
}
|
5162 |
+
if (change.from.line > doc.lastLine()) { return }
|
5163 |
+
|
5164 |
+
// Clip the change to the size of this doc
|
5165 |
+
if (change.from.line < doc.first) {
|
5166 |
+
var shift = change.text.length - 1 - (doc.first - change.from.line);
|
5167 |
+
shiftDoc(doc, shift);
|
5168 |
+
change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
|
5169 |
+
text: [lst(change.text)], origin: change.origin};
|
5170 |
+
}
|
5171 |
+
var last = doc.lastLine();
|
5172 |
+
if (change.to.line > last) {
|
5173 |
+
change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
|
5174 |
+
text: [change.text[0]], origin: change.origin};
|
5175 |
+
}
|
5176 |
+
|
5177 |
+
change.removed = getBetween(doc, change.from, change.to);
|
5178 |
+
|
5179 |
+
if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
|
5180 |
+
if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
|
5181 |
+
else { updateDoc(doc, change, spans); }
|
5182 |
+
setSelectionNoUndo(doc, selAfter, sel_dontScroll);
|
5183 |
+
}
|
5184 |
+
|
5185 |
+
// Handle the interaction of a change to a document with the editor
|
5186 |
+
// that this document is part of.
|
5187 |
+
function makeChangeSingleDocInEditor(cm, change, spans) {
|
5188 |
+
var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
|
5189 |
+
|
5190 |
+
var recomputeMaxLength = false, checkWidthStart = from.line;
|
5191 |
+
if (!cm.options.lineWrapping) {
|
5192 |
+
checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
|
5193 |
+
doc.iter(checkWidthStart, to.line + 1, function (line) {
|
5194 |
+
if (line == display.maxLine) {
|
5195 |
+
recomputeMaxLength = true;
|
5196 |
+
return true
|
5197 |
+
}
|
5198 |
+
});
|
5199 |
+
}
|
5200 |
+
|
5201 |
+
if (doc.sel.contains(change.from, change.to) > -1)
|
5202 |
+
{ signalCursorActivity(cm); }
|
5203 |
+
|
5204 |
+
updateDoc(doc, change, spans, estimateHeight(cm));
|
5205 |
+
|
5206 |
+
if (!cm.options.lineWrapping) {
|
5207 |
+
doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
|
5208 |
+
var len = lineLength(line);
|
5209 |
+
if (len > display.maxLineLength) {
|
5210 |
+
display.maxLine = line;
|
5211 |
+
display.maxLineLength = len;
|
5212 |
+
display.maxLineChanged = true;
|
5213 |
+
recomputeMaxLength = false;
|
5214 |
+
}
|
5215 |
+
});
|
5216 |
+
if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
|
5217 |
+
}
|
5218 |
+
|
5219 |
+
// Adjust frontier, schedule worker
|
5220 |
+
doc.frontier = Math.min(doc.frontier, from.line);
|
5221 |
+
startWorker(cm, 400);
|
5222 |
+
|
5223 |
+
var lendiff = change.text.length - (to.line - from.line) - 1;
|
5224 |
+
// Remember that these lines changed, for updating the display
|
5225 |
+
if (change.full)
|
5226 |
+
{ regChange(cm); }
|
5227 |
+
else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
|
5228 |
+
{ regLineChange(cm, from.line, "text"); }
|
5229 |
+
else
|
5230 |
+
{ regChange(cm, from.line, to.line + 1, lendiff); }
|
5231 |
+
|
5232 |
+
var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
|
5233 |
+
if (changeHandler || changesHandler) {
|
5234 |
+
var obj = {
|
5235 |
+
from: from, to: to,
|
5236 |
+
text: change.text,
|
5237 |
+
removed: change.removed,
|
5238 |
+
origin: change.origin
|
5239 |
+
};
|
5240 |
+
if (changeHandler) { signalLater(cm, "change", cm, obj); }
|
5241 |
+
if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
|
5242 |
+
}
|
5243 |
+
cm.display.selForContextMenu = null;
|
5244 |
+
}
|
5245 |
+
|
5246 |
+
function replaceRange(doc, code, from, to, origin) {
|
5247 |
+
if (!to) { to = from; }
|
5248 |
+
if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
|
5249 |
+
if (typeof code == "string") { code = doc.splitLines(code); }
|
5250 |
+
makeChange(doc, {from: from, to: to, text: code, origin: origin});
|
5251 |
+
}
|
5252 |
+
|
5253 |
+
// Rebasing/resetting history to deal with externally-sourced changes
|
5254 |
+
|
5255 |
+
function rebaseHistSelSingle(pos, from, to, diff) {
|
5256 |
+
if (to < pos.line) {
|
5257 |
+
pos.line += diff;
|
5258 |
+
} else if (from < pos.line) {
|
5259 |
+
pos.line = from;
|
5260 |
+
pos.ch = 0;
|
5261 |
+
}
|
5262 |
+
}
|
5263 |
+
|
5264 |
+
// Tries to rebase an array of history events given a change in the
|
5265 |
+
// document. If the change touches the same lines as the event, the
|
5266 |
+
// event, and everything 'behind' it, is discarded. If the change is
|
5267 |
+
// before the event, the event's positions are updated. Uses a
|
5268 |
+
// copy-on-write scheme for the positions, to avoid having to
|
5269 |
+
// reallocate them all on every rebase, but also avoid problems with
|
5270 |
+
// shared position objects being unsafely updated.
|
5271 |
+
function rebaseHistArray(array, from, to, diff) {
|
5272 |
+
for (var i = 0; i < array.length; ++i) {
|
5273 |
+
var sub = array[i], ok = true;
|
5274 |
+
if (sub.ranges) {
|
5275 |
+
if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
|
5276 |
+
for (var j = 0; j < sub.ranges.length; j++) {
|
5277 |
+
rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
|
5278 |
+
rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
|
5279 |
+
}
|
5280 |
+
continue
|
5281 |
+
}
|
5282 |
+
for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
|
5283 |
+
var cur = sub.changes[j$1];
|
5284 |
+
if (to < cur.from.line) {
|
5285 |
+
cur.from = Pos(cur.from.line + diff, cur.from.ch);
|
5286 |
+
cur.to = Pos(cur.to.line + diff, cur.to.ch);
|
5287 |
+
} else if (from <= cur.to.line) {
|
5288 |
+
ok = false;
|
5289 |
+
break
|
5290 |
+
}
|
5291 |
+
}
|
5292 |
+
if (!ok) {
|
5293 |
+
array.splice(0, i + 1);
|
5294 |
+
i = 0;
|
5295 |
+
}
|
5296 |
+
}
|
5297 |
+
}
|
5298 |
+
|
5299 |
+
function rebaseHist(hist, change) {
|
5300 |
+
var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
|
5301 |
+
rebaseHistArray(hist.done, from, to, diff);
|
5302 |
+
rebaseHistArray(hist.undone, from, to, diff);
|
5303 |
+
}
|
5304 |
+
|
5305 |
+
// Utility for applying a change to a line by handle or number,
|
5306 |
+
// returning the number and optionally registering the line as
|
5307 |
+
// changed.
|
5308 |
+
function changeLine(doc, handle, changeType, op) {
|
5309 |
+
var no = handle, line = handle;
|
5310 |
+
if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
|
5311 |
+
else { no = lineNo(handle); }
|
5312 |
+
if (no == null) { return null }
|
5313 |
+
if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
|
5314 |
+
return line
|
5315 |
+
}
|
5316 |
+
|
5317 |
+
// The document is represented as a BTree consisting of leaves, with
|
5318 |
+
// chunk of lines in them, and branches, with up to ten leaves or
|
5319 |
+
// other branch nodes below them. The top node is always a branch
|
5320 |
+
// node, and is the document object itself (meaning it has
|
5321 |
+
// additional methods and properties).
|
5322 |
+
//
|
5323 |
+
// All nodes have parent links. The tree is used both to go from
|
5324 |
+
// line numbers to line objects, and to go from objects to numbers.
|
5325 |
+
// It also indexes by height, and is used to convert between height
|
5326 |
+
// and line object, and to find the total height of the document.
|
5327 |
+
//
|
5328 |
+
// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
|
5329 |
+
|
5330 |
+
var LeafChunk = function(lines) {
|
5331 |
+
var this$1 = this;
|
5332 |
+
|
5333 |
+
this.lines = lines;
|
5334 |
+
this.parent = null;
|
5335 |
+
var height = 0;
|
5336 |
+
for (var i = 0; i < lines.length; ++i) {
|
5337 |
+
lines[i].parent = this$1;
|
5338 |
+
height += lines[i].height;
|
5339 |
+
}
|
5340 |
+
this.height = height;
|
5341 |
+
};
|
5342 |
+
|
5343 |
+
LeafChunk.prototype.chunkSize = function () { return this.lines.length };
|
5344 |
+
|
5345 |
+
// Remove the n lines at offset 'at'.
|
5346 |
+
LeafChunk.prototype.removeInner = function (at, n) {
|
5347 |
+
var this$1 = this;
|
5348 |
+
|
5349 |
+
for (var i = at, e = at + n; i < e; ++i) {
|
5350 |
+
var line = this$1.lines[i];
|
5351 |
+
this$1.height -= line.height;
|
5352 |
+
cleanUpLine(line);
|
5353 |
+
signalLater(line, "delete");
|
5354 |
+
}
|
5355 |
+
this.lines.splice(at, n);
|
5356 |
+
};
|
5357 |
+
|
5358 |
+
// Helper used to collapse a small branch into a single leaf.
|
5359 |
+
LeafChunk.prototype.collapse = function (lines) {
|
5360 |
+
lines.push.apply(lines, this.lines);
|
5361 |
+
};
|
5362 |
+
|
5363 |
+
// Insert the given array of lines at offset 'at', count them as
|
5364 |
+
// having the given height.
|
5365 |
+
LeafChunk.prototype.insertInner = function (at, lines, height) {
|
5366 |
+
var this$1 = this;
|
5367 |
+
|
5368 |
+
this.height += height;
|
5369 |
+
this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
|
5370 |
+
for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
|
5371 |
+
};
|
5372 |
+
|
5373 |
+
// Used to iterate over a part of the tree.
|
5374 |
+
LeafChunk.prototype.iterN = function (at, n, op) {
|
5375 |
+
var this$1 = this;
|
5376 |
+
|
5377 |
+
for (var e = at + n; at < e; ++at)
|
5378 |
+
{ if (op(this$1.lines[at])) { return true } }
|
5379 |
+
};
|
5380 |
+
|
5381 |
+
var BranchChunk = function(children) {
|
5382 |
+
var this$1 = this;
|
5383 |
+
|
5384 |
+
this.children = children;
|
5385 |
+
var size = 0, height = 0;
|
5386 |
+
for (var i = 0; i < children.length; ++i) {
|
5387 |
+
var ch = children[i];
|
5388 |
+
size += ch.chunkSize(); height += ch.height;
|
5389 |
+
ch.parent = this$1;
|
5390 |
+
}
|
5391 |
+
this.size = size;
|
5392 |
+
this.height = height;
|
5393 |
+
this.parent = null;
|
5394 |
+
};
|
5395 |
+
|
5396 |
+
BranchChunk.prototype.chunkSize = function () { return this.size };
|
5397 |
+
|
5398 |
+
BranchChunk.prototype.removeInner = function (at, n) {
|
5399 |
+
var this$1 = this;
|
5400 |
+
|
5401 |
+
this.size -= n;
|
5402 |
+
for (var i = 0; i < this.children.length; ++i) {
|
5403 |
+
var child = this$1.children[i], sz = child.chunkSize();
|
5404 |
+
if (at < sz) {
|
5405 |
+
var rm = Math.min(n, sz - at), oldHeight = child.height;
|
5406 |
+
child.removeInner(at, rm);
|
5407 |
+
this$1.height -= oldHeight - child.height;
|
5408 |
+
if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
|
5409 |
+
if ((n -= rm) == 0) { break }
|
5410 |
+
at = 0;
|
5411 |
+
} else { at -= sz; }
|
5412 |
+
}
|
5413 |
+
// If the result is smaller than 25 lines, ensure that it is a
|
5414 |
+
// single leaf node.
|
5415 |
+
if (this.size - n < 25 &&
|
5416 |
+
(this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
|
5417 |
+
var lines = [];
|
5418 |
+
this.collapse(lines);
|
5419 |
+
this.children = [new LeafChunk(lines)];
|
5420 |
+
this.children[0].parent = this;
|
5421 |
+
}
|
5422 |
+
};
|
5423 |
+
|
5424 |
+
BranchChunk.prototype.collapse = function (lines) {
|
5425 |
+
var this$1 = this;
|
5426 |
+
|
5427 |
+
for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
|
5428 |
+
};
|
5429 |
+
|
5430 |
+
BranchChunk.prototype.insertInner = function (at, lines, height) {
|
5431 |
+
var this$1 = this;
|
5432 |
+
|
5433 |
+
this.size += lines.length;
|
5434 |
+
this.height += height;
|
5435 |
+
for (var i = 0; i < this.children.length; ++i) {
|
5436 |
+
var child = this$1.children[i], sz = child.chunkSize();
|
5437 |
+
if (at <= sz) {
|
5438 |
+
child.insertInner(at, lines, height);
|
5439 |
+
if (child.lines && child.lines.length > 50) {
|
5440 |
+
// To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
|
5441 |
+
// Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
|
5442 |
+
var remaining = child.lines.length % 25 + 25;
|
5443 |
+
for (var pos = remaining; pos < child.lines.length;) {
|
5444 |
+
var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
|
5445 |
+
child.height -= leaf.height;
|
5446 |
+
this$1.children.splice(++i, 0, leaf);
|
5447 |
+
leaf.parent = this$1;
|
5448 |
+
}
|
5449 |
+
child.lines = child.lines.slice(0, remaining);
|
5450 |
+
this$1.maybeSpill();
|
5451 |
+
}
|
5452 |
+
break
|
5453 |
+
}
|
5454 |
+
at -= sz;
|
5455 |
+
}
|
5456 |
+
};
|
5457 |
+
|
5458 |
+
// When a node has grown, check whether it should be split.
|
5459 |
+
BranchChunk.prototype.maybeSpill = function () {
|
5460 |
+
if (this.children.length <= 10) { return }
|
5461 |
+
var me = this;
|
5462 |
+
do {
|
5463 |
+
var spilled = me.children.splice(me.children.length - 5, 5);
|
5464 |
+
var sibling = new BranchChunk(spilled);
|
5465 |
+
if (!me.parent) { // Become the parent node
|
5466 |
+
var copy = new BranchChunk(me.children);
|
5467 |
+
copy.parent = me;
|
5468 |
+
me.children = [copy, sibling];
|
5469 |
+
me = copy;
|
5470 |
+
} else {
|
5471 |
+
me.size -= sibling.size;
|
5472 |
+
me.height -= sibling.height;
|
5473 |
+
var myIndex = indexOf(me.parent.children, me);
|
5474 |
+
me.parent.children.splice(myIndex + 1, 0, sibling);
|
5475 |
+
}
|
5476 |
+
sibling.parent = me.parent;
|
5477 |
+
} while (me.children.length > 10)
|
5478 |
+
me.parent.maybeSpill();
|
5479 |
+
};
|
5480 |
+
|
5481 |
+
BranchChunk.prototype.iterN = function (at, n, op) {
|
5482 |
+
var this$1 = this;
|
5483 |
+
|
5484 |
+
for (var i = 0; i < this.children.length; ++i) {
|
5485 |
+
var child = this$1.children[i], sz = child.chunkSize();
|
5486 |
+
if (at < sz) {
|
5487 |
+
var used = Math.min(n, sz - at);
|
5488 |
+
if (child.iterN(at, used, op)) { return true }
|
5489 |
+
if ((n -= used) == 0) { break }
|
5490 |
+
at = 0;
|
5491 |
+
} else { at -= sz; }
|
5492 |
+
}
|
5493 |
+
};
|
5494 |
+
|
5495 |
+
// Line widgets are block elements displayed above or below a line.
|
5496 |
+
|
5497 |
+
var LineWidget = function(doc, node, options) {
|
5498 |
+
var this$1 = this;
|
5499 |
+
|
5500 |
+
if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
|
5501 |
+
{ this$1[opt] = options[opt]; } } }
|
5502 |
+
this.doc = doc;
|
5503 |
+
this.node = node;
|
5504 |
+
};
|
5505 |
+
|
5506 |
+
LineWidget.prototype.clear = function () {
|
5507 |
+
var this$1 = this;
|
5508 |
+
|
5509 |
+
var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
|
5510 |
+
if (no == null || !ws) { return }
|
5511 |
+
for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
|
5512 |
+
if (!ws.length) { line.widgets = null; }
|
5513 |
+
var height = widgetHeight(this);
|
5514 |
+
updateLineHeight(line, Math.max(0, line.height - height));
|
5515 |
+
if (cm) {
|
5516 |
+
runInOp(cm, function () {
|
5517 |
+
adjustScrollWhenAboveVisible(cm, line, -height);
|
5518 |
+
regLineChange(cm, no, "widget");
|
5519 |
+
});
|
5520 |
+
signalLater(cm, "lineWidgetCleared", cm, this, no);
|
5521 |
+
}
|
5522 |
+
};
|
5523 |
+
|
5524 |
+
LineWidget.prototype.changed = function () {
|
5525 |
+
var this$1 = this;
|
5526 |
+
|
5527 |
+
var oldH = this.height, cm = this.doc.cm, line = this.line;
|
5528 |
+
this.height = null;
|
5529 |
+
var diff = widgetHeight(this) - oldH;
|
5530 |
+
if (!diff) { return }
|
5531 |
+
updateLineHeight(line, line.height + diff);
|
5532 |
+
if (cm) {
|
5533 |
+
runInOp(cm, function () {
|
5534 |
+
cm.curOp.forceUpdate = true;
|
5535 |
+
adjustScrollWhenAboveVisible(cm, line, diff);
|
5536 |
+
signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
|
5537 |
+
});
|
5538 |
+
}
|
5539 |
+
};
|
5540 |
+
eventMixin(LineWidget);
|
5541 |
+
|
5542 |
+
function adjustScrollWhenAboveVisible(cm, line, diff) {
|
5543 |
+
if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
|
5544 |
+
{ addToScrollPos(cm, null, diff); }
|
5545 |
+
}
|
5546 |
+
|
5547 |
+
function addLineWidget(doc, handle, node, options) {
|
5548 |
+
var widget = new LineWidget(doc, node, options);
|
5549 |
+
var cm = doc.cm;
|
5550 |
+
if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
|
5551 |
+
changeLine(doc, handle, "widget", function (line) {
|
5552 |
+
var widgets = line.widgets || (line.widgets = []);
|
5553 |
+
if (widget.insertAt == null) { widgets.push(widget); }
|
5554 |
+
else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
|
5555 |
+
widget.line = line;
|
5556 |
+
if (cm && !lineIsHidden(doc, line)) {
|
5557 |
+
var aboveVisible = heightAtLine(line) < doc.scrollTop;
|
5558 |
+
updateLineHeight(line, line.height + widgetHeight(widget));
|
5559 |
+
if (aboveVisible) { addToScrollPos(cm, null, widget.height); }
|
5560 |
+
cm.curOp.forceUpdate = true;
|
5561 |
+
}
|
5562 |
+
return true
|
5563 |
+
});
|
5564 |
+
signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle));
|
5565 |
+
return widget
|
5566 |
+
}
|
5567 |
+
|
5568 |
+
// TEXTMARKERS
|
5569 |
+
|
5570 |
+
// Created with markText and setBookmark methods. A TextMarker is a
|
5571 |
+
// handle that can be used to clear or find a marked position in the
|
5572 |
+
// document. Line objects hold arrays (markedSpans) containing
|
5573 |
+
// {from, to, marker} object pointing to such marker objects, and
|
5574 |
+
// indicating that such a marker is present on that line. Multiple
|
5575 |
+
// lines may point to the same marker when it spans across lines.
|
5576 |
+
// The spans will have null for their from/to properties when the
|
5577 |
+
// marker continues beyond the start/end of the line. Markers have
|
5578 |
+
// links back to the lines they currently touch.
|
5579 |
+
|
5580 |
+
// Collapsed markers have unique ids, in order to be able to order
|
5581 |
+
// them, which is needed for uniquely determining an outer marker
|
5582 |
+
// when they overlap (they may nest, but not partially overlap).
|
5583 |
+
var nextMarkerId = 0;
|
5584 |
+
|
5585 |
+
var TextMarker = function(doc, type) {
|
5586 |
+
this.lines = [];
|
5587 |
+
this.type = type;
|
5588 |
+
this.doc = doc;
|
5589 |
+
this.id = ++nextMarkerId;
|
5590 |
+
};
|
5591 |
+
|
5592 |
+
// Clear the marker.
|
5593 |
+
TextMarker.prototype.clear = function () {
|
5594 |
+
var this$1 = this;
|
5595 |
+
|
5596 |
+
if (this.explicitlyCleared) { return }
|
5597 |
+
var cm = this.doc.cm, withOp = cm && !cm.curOp;
|
5598 |
+
if (withOp) { startOperation(cm); }
|
5599 |
+
if (hasHandler(this, "clear")) {
|
5600 |
+
var found = this.find();
|
5601 |
+
if (found) { signalLater(this, "clear", found.from, found.to); }
|
5602 |
+
}
|
5603 |
+
var min = null, max = null;
|
5604 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
5605 |
+
var line = this$1.lines[i];
|
5606 |
+
var span = getMarkedSpanFor(line.markedSpans, this$1);
|
5607 |
+
if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
|
5608 |
+
else if (cm) {
|
5609 |
+
if (span.to != null) { max = lineNo(line); }
|
5610 |
+
if (span.from != null) { min = lineNo(line); }
|
5611 |
+
}
|
5612 |
+
line.markedSpans = removeMarkedSpan(line.markedSpans, span);
|
5613 |
+
if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
|
5614 |
+
{ updateLineHeight(line, textHeight(cm.display)); }
|
5615 |
+
}
|
5616 |
+
if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
|
5617 |
+
var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
|
5618 |
+
if (len > cm.display.maxLineLength) {
|
5619 |
+
cm.display.maxLine = visual;
|
5620 |
+
cm.display.maxLineLength = len;
|
5621 |
+
cm.display.maxLineChanged = true;
|
5622 |
+
}
|
5623 |
+
} }
|
5624 |
+
|
5625 |
+
if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
|
5626 |
+
this.lines.length = 0;
|
5627 |
+
this.explicitlyCleared = true;
|
5628 |
+
if (this.atomic && this.doc.cantEdit) {
|
5629 |
+
this.doc.cantEdit = false;
|
5630 |
+
if (cm) { reCheckSelection(cm.doc); }
|
5631 |
+
}
|
5632 |
+
if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
|
5633 |
+
if (withOp) { endOperation(cm); }
|
5634 |
+
if (this.parent) { this.parent.clear(); }
|
5635 |
+
};
|
5636 |
+
|
5637 |
+
// Find the position of the marker in the document. Returns a {from,
|
5638 |
+
// to} object by default. Side can be passed to get a specific side
|
5639 |
+
// -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
|
5640 |
+
// Pos objects returned contain a line object, rather than a line
|
5641 |
+
// number (used to prevent looking up the same line twice).
|
5642 |
+
TextMarker.prototype.find = function (side, lineObj) {
|
5643 |
+
var this$1 = this;
|
5644 |
+
|
5645 |
+
if (side == null && this.type == "bookmark") { side = 1; }
|
5646 |
+
var from, to;
|
5647 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
5648 |
+
var line = this$1.lines[i];
|
5649 |
+
var span = getMarkedSpanFor(line.markedSpans, this$1);
|
5650 |
+
if (span.from != null) {
|
5651 |
+
from = Pos(lineObj ? line : lineNo(line), span.from);
|
5652 |
+
if (side == -1) { return from }
|
5653 |
+
}
|
5654 |
+
if (span.to != null) {
|
5655 |
+
to = Pos(lineObj ? line : lineNo(line), span.to);
|
5656 |
+
if (side == 1) { return to }
|
5657 |
+
}
|
5658 |
+
}
|
5659 |
+
return from && {from: from, to: to}
|
5660 |
+
};
|
5661 |
+
|
5662 |
+
// Signals that the marker's widget changed, and surrounding layout
|
5663 |
+
// should be recomputed.
|
5664 |
+
TextMarker.prototype.changed = function () {
|
5665 |
+
var this$1 = this;
|
5666 |
+
|
5667 |
+
var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
|
5668 |
+
if (!pos || !cm) { return }
|
5669 |
+
runInOp(cm, function () {
|
5670 |
+
var line = pos.line, lineN = lineNo(pos.line);
|
5671 |
+
var view = findViewForLine(cm, lineN);
|
5672 |
+
if (view) {
|
5673 |
+
clearLineMeasurementCacheFor(view);
|
5674 |
+
cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
|
5675 |
+
}
|
5676 |
+
cm.curOp.updateMaxLine = true;
|
5677 |
+
if (!lineIsHidden(widget.doc, line) && widget.height != null) {
|
5678 |
+
var oldHeight = widget.height;
|
5679 |
+
widget.height = null;
|
5680 |
+
var dHeight = widgetHeight(widget) - oldHeight;
|
5681 |
+
if (dHeight)
|
5682 |
+
{ updateLineHeight(line, line.height + dHeight); }
|
5683 |
+
}
|
5684 |
+
signalLater(cm, "markerChanged", cm, this$1);
|
5685 |
+
});
|
5686 |
+
};
|
5687 |
+
|
5688 |
+
TextMarker.prototype.attachLine = function (line) {
|
5689 |
+
if (!this.lines.length && this.doc.cm) {
|
5690 |
+
var op = this.doc.cm.curOp;
|
5691 |
+
if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
|
5692 |
+
{ (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
|
5693 |
+
}
|
5694 |
+
this.lines.push(line);
|
5695 |
+
};
|
5696 |
+
|
5697 |
+
TextMarker.prototype.detachLine = function (line) {
|
5698 |
+
this.lines.splice(indexOf(this.lines, line), 1);
|
5699 |
+
if (!this.lines.length && this.doc.cm) {
|
5700 |
+
var op = this.doc.cm.curOp;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
|
5701 |
+
}
|
5702 |
+
};
|
5703 |
+
eventMixin(TextMarker);
|
5704 |
+
|
5705 |
+
// Create a marker, wire it up to the right lines, and
|
5706 |
+
function markText(doc, from, to, options, type) {
|
5707 |
+
// Shared markers (across linked documents) are handled separately
|
5708 |
+
// (markTextShared will call out to this again, once per
|
5709 |
+
// document).
|
5710 |
+
if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
|
5711 |
+
// Ensure we are in an operation.
|
5712 |
+
if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
|
5713 |
+
|
5714 |
+
var marker = new TextMarker(doc, type), diff = cmp(from, to);
|
5715 |
+
if (options) { copyObj(options, marker, false); }
|
5716 |
+
// Don't connect empty markers unless clearWhenEmpty is false
|
5717 |
+
if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
|
5718 |
+
{ return marker }
|
5719 |
+
if (marker.replacedWith) {
|
5720 |
+
// Showing up as a widget implies collapsed (widget replaces text)
|
5721 |
+
marker.collapsed = true;
|
5722 |
+
marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
|
5723 |
+
if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
|
5724 |
+
if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
|
5725 |
+
}
|
5726 |
+
if (marker.collapsed) {
|
5727 |
+
if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
|
5728 |
+
from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
|
5729 |
+
{ throw new Error("Inserting collapsed marker partially overlapping an existing one") }
|
5730 |
+
seeCollapsedSpans();
|
5731 |
+
}
|
5732 |
+
|
5733 |
+
if (marker.addToHistory)
|
5734 |
+
{ addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
|
5735 |
+
|
5736 |
+
var curLine = from.line, cm = doc.cm, updateMaxLine;
|
5737 |
+
doc.iter(curLine, to.line + 1, function (line) {
|
5738 |
+
if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
|
5739 |
+
{ updateMaxLine = true; }
|
5740 |
+
if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
|
5741 |
+
addMarkedSpan(line, new MarkedSpan(marker,
|
5742 |
+
curLine == from.line ? from.ch : null,
|
5743 |
+
curLine == to.line ? to.ch : null));
|
5744 |
+
++curLine;
|
5745 |
+
});
|
5746 |
+
// lineIsHidden depends on the presence of the spans, so needs a second pass
|
5747 |
+
if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
|
5748 |
+
if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
|
5749 |
+
}); }
|
5750 |
+
|
5751 |
+
if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
|
5752 |
+
|
5753 |
+
if (marker.readOnly) {
|
5754 |
+
seeReadOnlySpans();
|
5755 |
+
if (doc.history.done.length || doc.history.undone.length)
|
5756 |
+
{ doc.clearHistory(); }
|
5757 |
+
}
|
5758 |
+
if (marker.collapsed) {
|
5759 |
+
marker.id = ++nextMarkerId;
|
5760 |
+
marker.atomic = true;
|
5761 |
+
}
|
5762 |
+
if (cm) {
|
5763 |
+
// Sync editor state
|
5764 |
+
if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
|
5765 |
+
if (marker.collapsed)
|
5766 |
+
{ regChange(cm, from.line, to.line + 1); }
|
5767 |
+
else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
|
5768 |
+
{ for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
|
5769 |
+
if (marker.atomic) { reCheckSelection(cm.doc); }
|
5770 |
+
signalLater(cm, "markerAdded", cm, marker);
|
5771 |
+
}
|
5772 |
+
return marker
|
5773 |
+
}
|
5774 |
+
|
5775 |
+
// SHARED TEXTMARKERS
|
5776 |
+
|
5777 |
+
// A shared marker spans multiple linked documents. It is
|
5778 |
+
// implemented as a meta-marker-object controlling multiple normal
|
5779 |
+
// markers.
|
5780 |
+
var SharedTextMarker = function(markers, primary) {
|
5781 |
+
var this$1 = this;
|
5782 |
+
|
5783 |
+
this.markers = markers;
|
5784 |
+
this.primary = primary;
|
5785 |
+
for (var i = 0; i < markers.length; ++i)
|
5786 |
+
{ markers[i].parent = this$1; }
|
5787 |
+
};
|
5788 |
+
|
5789 |
+
SharedTextMarker.prototype.clear = function () {
|
5790 |
+
var this$1 = this;
|
5791 |
+
|
5792 |
+
if (this.explicitlyCleared) { return }
|
5793 |
+
this.explicitlyCleared = true;
|
5794 |
+
for (var i = 0; i < this.markers.length; ++i)
|
5795 |
+
{ this$1.markers[i].clear(); }
|
5796 |
+
signalLater(this, "clear");
|
5797 |
+
};
|
5798 |
+
|
5799 |
+
SharedTextMarker.prototype.find = function (side, lineObj) {
|
5800 |
+
return this.primary.find(side, lineObj)
|
5801 |
+
};
|
5802 |
+
eventMixin(SharedTextMarker);
|
5803 |
+
|
5804 |
+
function markTextShared(doc, from, to, options, type) {
|
5805 |
+
options = copyObj(options);
|
5806 |
+
options.shared = false;
|
5807 |
+
var markers = [markText(doc, from, to, options, type)], primary = markers[0];
|
5808 |
+
var widget = options.widgetNode;
|
5809 |
+
linkedDocs(doc, function (doc) {
|
5810 |
+
if (widget) { options.widgetNode = widget.cloneNode(true); }
|
5811 |
+
markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
|
5812 |
+
for (var i = 0; i < doc.linked.length; ++i)
|
5813 |
+
{ if (doc.linked[i].isParent) { return } }
|
5814 |
+
primary = lst(markers);
|
5815 |
+
});
|
5816 |
+
return new SharedTextMarker(markers, primary)
|
5817 |
+
}
|
5818 |
+
|
5819 |
+
function findSharedMarkers(doc) {
|
5820 |
+
return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
|
5821 |
+
}
|
5822 |
+
|
5823 |
+
function copySharedMarkers(doc, markers) {
|
5824 |
+
for (var i = 0; i < markers.length; i++) {
|
5825 |
+
var marker = markers[i], pos = marker.find();
|
5826 |
+
var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
|
5827 |
+
if (cmp(mFrom, mTo)) {
|
5828 |
+
var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
|
5829 |
+
marker.markers.push(subMark);
|
5830 |
+
subMark.parent = marker;
|
5831 |
+
}
|
5832 |
+
}
|
5833 |
+
}
|
5834 |
+
|
5835 |
+
function detachSharedMarkers(markers) {
|
5836 |
+
var loop = function ( i ) {
|
5837 |
+
var marker = markers[i], linked = [marker.primary.doc];
|
5838 |
+
linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
|
5839 |
+
for (var j = 0; j < marker.markers.length; j++) {
|
5840 |
+
var subMarker = marker.markers[j];
|
5841 |
+
if (indexOf(linked, subMarker.doc) == -1) {
|
5842 |
+
subMarker.parent = null;
|
5843 |
+
marker.markers.splice(j--, 1);
|
5844 |
+
}
|
5845 |
+
}
|
5846 |
+
};
|
5847 |
+
|
5848 |
+
for (var i = 0; i < markers.length; i++) loop( i );
|
5849 |
+
}
|
5850 |
+
|
5851 |
+
var nextDocId = 0;
|
5852 |
+
var Doc = function(text, mode, firstLine, lineSep, direction) {
|
5853 |
+
if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
|
5854 |
+
if (firstLine == null) { firstLine = 0; }
|
5855 |
+
|
5856 |
+
BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
|
5857 |
+
this.first = firstLine;
|
5858 |
+
this.scrollTop = this.scrollLeft = 0;
|
5859 |
+
this.cantEdit = false;
|
5860 |
+
this.cleanGeneration = 1;
|
5861 |
+
this.frontier = firstLine;
|
5862 |
+
var start = Pos(firstLine, 0);
|
5863 |
+
this.sel = simpleSelection(start);
|
5864 |
+
this.history = new History(null);
|
5865 |
+
this.id = ++nextDocId;
|
5866 |
+
this.modeOption = mode;
|
5867 |
+
this.lineSep = lineSep;
|
5868 |
+
this.direction = (direction == "rtl") ? "rtl" : "ltr";
|
5869 |
+
this.extend = false;
|
5870 |
+
|
5871 |
+
if (typeof text == "string") { text = this.splitLines(text); }
|
5872 |
+
updateDoc(this, {from: start, to: start, text: text});
|
5873 |
+
setSelection(this, simpleSelection(start), sel_dontScroll);
|
5874 |
+
};
|
5875 |
+
|
5876 |
+
Doc.prototype = createObj(BranchChunk.prototype, {
|
5877 |
+
constructor: Doc,
|
5878 |
+
// Iterate over the document. Supports two forms -- with only one
|
5879 |
+
// argument, it calls that for each line in the document. With
|
5880 |
+
// three, it iterates over the range given by the first two (with
|
5881 |
+
// the second being non-inclusive).
|
5882 |
+
iter: function(from, to, op) {
|
5883 |
+
if (op) { this.iterN(from - this.first, to - from, op); }
|
5884 |
+
else { this.iterN(this.first, this.first + this.size, from); }
|
5885 |
+
},
|
5886 |
+
|
5887 |
+
// Non-public interface for adding and removing lines.
|
5888 |
+
insert: function(at, lines) {
|
5889 |
+
var height = 0;
|
5890 |
+
for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
|
5891 |
+
this.insertInner(at - this.first, lines, height);
|
5892 |
+
},
|
5893 |
+
remove: function(at, n) { this.removeInner(at - this.first, n); },
|
5894 |
+
|
5895 |
+
// From here, the methods are part of the public interface. Most
|
5896 |
+
// are also available from CodeMirror (editor) instances.
|
5897 |
+
|
5898 |
+
getValue: function(lineSep) {
|
5899 |
+
var lines = getLines(this, this.first, this.first + this.size);
|
5900 |
+
if (lineSep === false) { return lines }
|
5901 |
+
return lines.join(lineSep || this.lineSeparator())
|
5902 |
+
},
|
5903 |
+
setValue: docMethodOp(function(code) {
|
5904 |
+
var top = Pos(this.first, 0), last = this.first + this.size - 1;
|
5905 |
+
makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
|
5906 |
+
text: this.splitLines(code), origin: "setValue", full: true}, true);
|
5907 |
+
setSelection(this, simpleSelection(top));
|
5908 |
+
}),
|
5909 |
+
replaceRange: function(code, from, to, origin) {
|
5910 |
+
from = clipPos(this, from);
|
5911 |
+
to = to ? clipPos(this, to) : from;
|
5912 |
+
replaceRange(this, code, from, to, origin);
|
5913 |
+
},
|
5914 |
+
getRange: function(from, to, lineSep) {
|
5915 |
+
var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
|
5916 |
+
if (lineSep === false) { return lines }
|
5917 |
+
return lines.join(lineSep || this.lineSeparator())
|
5918 |
+
},
|
5919 |
+
|
5920 |
+
getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
|
5921 |
+
|
5922 |
+
getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
|
5923 |
+
getLineNumber: function(line) {return lineNo(line)},
|
5924 |
+
|
5925 |
+
getLineHandleVisualStart: function(line) {
|
5926 |
+
if (typeof line == "number") { line = getLine(this, line); }
|
5927 |
+
return visualLine(line)
|
5928 |
+
},
|
5929 |
+
|
5930 |
+
lineCount: function() {return this.size},
|
5931 |
+
firstLine: function() {return this.first},
|
5932 |
+
lastLine: function() {return this.first + this.size - 1},
|
5933 |
+
|
5934 |
+
clipPos: function(pos) {return clipPos(this, pos)},
|
5935 |
+
|
5936 |
+
getCursor: function(start) {
|
5937 |
+
var range$$1 = this.sel.primary(), pos;
|
5938 |
+
if (start == null || start == "head") { pos = range$$1.head; }
|
5939 |
+
else if (start == "anchor") { pos = range$$1.anchor; }
|
5940 |
+
else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
|
5941 |
+
else { pos = range$$1.from(); }
|
5942 |
+
return pos
|
5943 |
+
},
|
5944 |
+
listSelections: function() { return this.sel.ranges },
|
5945 |
+
somethingSelected: function() {return this.sel.somethingSelected()},
|
5946 |
+
|
5947 |
+
setCursor: docMethodOp(function(line, ch, options) {
|
5948 |
+
setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
|
5949 |
+
}),
|
5950 |
+
setSelection: docMethodOp(function(anchor, head, options) {
|
5951 |
+
setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
|
5952 |
+
}),
|
5953 |
+
extendSelection: docMethodOp(function(head, other, options) {
|
5954 |
+
extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
|
5955 |
+
}),
|
5956 |
+
extendSelections: docMethodOp(function(heads, options) {
|
5957 |
+
extendSelections(this, clipPosArray(this, heads), options);
|
5958 |
+
}),
|
5959 |
+
extendSelectionsBy: docMethodOp(function(f, options) {
|
5960 |
+
var heads = map(this.sel.ranges, f);
|
5961 |
+
extendSelections(this, clipPosArray(this, heads), options);
|
5962 |
+
}),
|
5963 |
+
setSelections: docMethodOp(function(ranges, primary, options) {
|
5964 |
+
var this$1 = this;
|
5965 |
+
|
5966 |
+
if (!ranges.length) { return }
|
5967 |
+
var out = [];
|
5968 |
+
for (var i = 0; i < ranges.length; i++)
|
5969 |
+
{ out[i] = new Range(clipPos(this$1, ranges[i].anchor),
|
5970 |
+
clipPos(this$1, ranges[i].head)); }
|
5971 |
+
if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
|
5972 |
+
setSelection(this, normalizeSelection(out, primary), options);
|
5973 |
+
}),
|
5974 |
+
addSelection: docMethodOp(function(anchor, head, options) {
|
5975 |
+
var ranges = this.sel.ranges.slice(0);
|
5976 |
+
ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
|
5977 |
+
setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);
|
5978 |
+
}),
|
5979 |
+
|
5980 |
+
getSelection: function(lineSep) {
|
5981 |
+
var this$1 = this;
|
5982 |
+
|
5983 |
+
var ranges = this.sel.ranges, lines;
|
5984 |
+
for (var i = 0; i < ranges.length; i++) {
|
5985 |
+
var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
|
5986 |
+
lines = lines ? lines.concat(sel) : sel;
|
5987 |
+
}
|
5988 |
+
if (lineSep === false) { return lines }
|
5989 |
+
else { return lines.join(lineSep || this.lineSeparator()) }
|
5990 |
+
},
|
5991 |
+
getSelections: function(lineSep) {
|
5992 |
+
var this$1 = this;
|
5993 |
+
|
5994 |
+
var parts = [], ranges = this.sel.ranges;
|
5995 |
+
for (var i = 0; i < ranges.length; i++) {
|
5996 |
+
var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
|
5997 |
+
if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
|
5998 |
+
parts[i] = sel;
|
5999 |
+
}
|
6000 |
+
return parts
|
6001 |
+
},
|
6002 |
+
replaceSelection: function(code, collapse, origin) {
|
6003 |
+
var dup = [];
|
6004 |
+
for (var i = 0; i < this.sel.ranges.length; i++)
|
6005 |
+
{ dup[i] = code; }
|
6006 |
+
this.replaceSelections(dup, collapse, origin || "+input");
|
6007 |
+
},
|
6008 |
+
replaceSelections: docMethodOp(function(code, collapse, origin) {
|
6009 |
+
var this$1 = this;
|
6010 |
+
|
6011 |
+
var changes = [], sel = this.sel;
|
6012 |
+
for (var i = 0; i < sel.ranges.length; i++) {
|
6013 |
+
var range$$1 = sel.ranges[i];
|
6014 |
+
changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
|
6015 |
+
}
|
6016 |
+
var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
|
6017 |
+
for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
|
6018 |
+
{ makeChange(this$1, changes[i$1]); }
|
6019 |
+
if (newSel) { setSelectionReplaceHistory(this, newSel); }
|
6020 |
+
else if (this.cm) { ensureCursorVisible(this.cm); }
|
6021 |
+
}),
|
6022 |
+
undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
|
6023 |
+
redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
|
6024 |
+
undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
|
6025 |
+
redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
|
6026 |
+
|
6027 |
+
setExtending: function(val) {this.extend = val;},
|
6028 |
+
getExtending: function() {return this.extend},
|
6029 |
+
|
6030 |
+
historySize: function() {
|
6031 |
+
var hist = this.history, done = 0, undone = 0;
|
6032 |
+
for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
|
6033 |
+
for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
|
6034 |
+
return {undo: done, redo: undone}
|
6035 |
+
},
|
6036 |
+
clearHistory: function() {this.history = new History(this.history.maxGeneration);},
|
6037 |
+
|
6038 |
+
markClean: function() {
|
6039 |
+
this.cleanGeneration = this.changeGeneration(true);
|
6040 |
+
},
|
6041 |
+
changeGeneration: function(forceSplit) {
|
6042 |
+
if (forceSplit)
|
6043 |
+
{ this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
|
6044 |
+
return this.history.generation
|
6045 |
+
},
|
6046 |
+
isClean: function (gen) {
|
6047 |
+
return this.history.generation == (gen || this.cleanGeneration)
|
6048 |
+
},
|
6049 |
+
|
6050 |
+
getHistory: function() {
|
6051 |
+
return {done: copyHistoryArray(this.history.done),
|
6052 |
+
undone: copyHistoryArray(this.history.undone)}
|
6053 |
+
},
|
6054 |
+
setHistory: function(histData) {
|
6055 |
+
var hist = this.history = new History(this.history.maxGeneration);
|
6056 |
+
hist.done = copyHistoryArray(histData.done.slice(0), null, true);
|
6057 |
+
hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
|
6058 |
+
},
|
6059 |
+
|
6060 |
+
setGutterMarker: docMethodOp(function(line, gutterID, value) {
|
6061 |
+
return changeLine(this, line, "gutter", function (line) {
|
6062 |
+
var markers = line.gutterMarkers || (line.gutterMarkers = {});
|
6063 |
+
markers[gutterID] = value;
|
6064 |
+
if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
|
6065 |
+
return true
|
6066 |
+
})
|
6067 |
+
}),
|
6068 |
+
|
6069 |
+
clearGutter: docMethodOp(function(gutterID) {
|
6070 |
+
var this$1 = this;
|
6071 |
+
|
6072 |
+
this.iter(function (line) {
|
6073 |
+
if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
|
6074 |
+
changeLine(this$1, line, "gutter", function () {
|
6075 |
+
line.gutterMarkers[gutterID] = null;
|
6076 |
+
if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
|
6077 |
+
return true
|
6078 |
+
});
|
6079 |
+
}
|
6080 |
+
});
|
6081 |
+
}),
|
6082 |
+
|
6083 |
+
lineInfo: function(line) {
|
6084 |
+
var n;
|
6085 |
+
if (typeof line == "number") {
|
6086 |
+
if (!isLine(this, line)) { return null }
|
6087 |
+
n = line;
|
6088 |
+
line = getLine(this, line);
|
6089 |
+
if (!line) { return null }
|
6090 |
+
} else {
|
6091 |
+
n = lineNo(line);
|
6092 |
+
if (n == null) { return null }
|
6093 |
+
}
|
6094 |
+
return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
|
6095 |
+
textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
|
6096 |
+
widgets: line.widgets}
|
6097 |
+
},
|
6098 |
+
|
6099 |
+
addLineClass: docMethodOp(function(handle, where, cls) {
|
6100 |
+
return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
|
6101 |
+
var prop = where == "text" ? "textClass"
|
6102 |
+
: where == "background" ? "bgClass"
|
6103 |
+
: where == "gutter" ? "gutterClass" : "wrapClass";
|
6104 |
+
if (!line[prop]) { line[prop] = cls; }
|
6105 |
+
else if (classTest(cls).test(line[prop])) { return false }
|
6106 |
+
else { line[prop] += " " + cls; }
|
6107 |
+
return true
|
6108 |
+
})
|
6109 |
+
}),
|
6110 |
+
removeLineClass: docMethodOp(function(handle, where, cls) {
|
6111 |
+
return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
|
6112 |
+
var prop = where == "text" ? "textClass"
|
6113 |
+
: where == "background" ? "bgClass"
|
6114 |
+
: where == "gutter" ? "gutterClass" : "wrapClass";
|
6115 |
+
var cur = line[prop];
|
6116 |
+
if (!cur) { return false }
|
6117 |
+
else if (cls == null) { line[prop] = null; }
|
6118 |
+
else {
|
6119 |
+
var found = cur.match(classTest(cls));
|
6120 |
+
if (!found) { return false }
|
6121 |
+
var end = found.index + found[0].length;
|
6122 |
+
line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
|
6123 |
+
}
|
6124 |
+
return true
|
6125 |
+
})
|
6126 |
+
}),
|
6127 |
+
|
6128 |
+
addLineWidget: docMethodOp(function(handle, node, options) {
|
6129 |
+
return addLineWidget(this, handle, node, options)
|
6130 |
+
}),
|
6131 |
+
removeLineWidget: function(widget) { widget.clear(); },
|
6132 |
+
|
6133 |
+
markText: function(from, to, options) {
|
6134 |
+
return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
|
6135 |
+
},
|
6136 |
+
setBookmark: function(pos, options) {
|
6137 |
+
var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
|
6138 |
+
insertLeft: options && options.insertLeft,
|
6139 |
+
clearWhenEmpty: false, shared: options && options.shared,
|
6140 |
+
handleMouseEvents: options && options.handleMouseEvents};
|
6141 |
+
pos = clipPos(this, pos);
|
6142 |
+
return markText(this, pos, pos, realOpts, "bookmark")
|
6143 |
+
},
|
6144 |
+
findMarksAt: function(pos) {
|
6145 |
+
pos = clipPos(this, pos);
|
6146 |
+
var markers = [], spans = getLine(this, pos.line).markedSpans;
|
6147 |
+
if (spans) { for (var i = 0; i < spans.length; ++i) {
|
6148 |
+
var span = spans[i];
|
6149 |
+
if ((span.from == null || span.from <= pos.ch) &&
|
6150 |
+
(span.to == null || span.to >= pos.ch))
|
6151 |
+
{ markers.push(span.marker.parent || span.marker); }
|
6152 |
+
} }
|
6153 |
+
return markers
|
6154 |
+
},
|
6155 |
+
findMarks: function(from, to, filter) {
|
6156 |
+
from = clipPos(this, from); to = clipPos(this, to);
|
6157 |
+
var found = [], lineNo$$1 = from.line;
|
6158 |
+
this.iter(from.line, to.line + 1, function (line) {
|
6159 |
+
var spans = line.markedSpans;
|
6160 |
+
if (spans) { for (var i = 0; i < spans.length; i++) {
|
6161 |
+
var span = spans[i];
|
6162 |
+
if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
|
6163 |
+
span.from == null && lineNo$$1 != from.line ||
|
6164 |
+
span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
|
6165 |
+
(!filter || filter(span.marker)))
|
6166 |
+
{ found.push(span.marker.parent || span.marker); }
|
6167 |
+
} }
|
6168 |
+
++lineNo$$1;
|
6169 |
+
});
|
6170 |
+
return found
|
6171 |
+
},
|
6172 |
+
getAllMarks: function() {
|
6173 |
+
var markers = [];
|
6174 |
+
this.iter(function (line) {
|
6175 |
+
var sps = line.markedSpans;
|
6176 |
+
if (sps) { for (var i = 0; i < sps.length; ++i)
|
6177 |
+
{ if (sps[i].from != null) { markers.push(sps[i].marker); } } }
|
6178 |
+
});
|
6179 |
+
return markers
|
6180 |
+
},
|
6181 |
+
|
6182 |
+
posFromIndex: function(off) {
|
6183 |
+
var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
|
6184 |
+
this.iter(function (line) {
|
6185 |
+
var sz = line.text.length + sepSize;
|
6186 |
+
if (sz > off) { ch = off; return true }
|
6187 |
+
off -= sz;
|
6188 |
+
++lineNo$$1;
|
6189 |
+
});
|
6190 |
+
return clipPos(this, Pos(lineNo$$1, ch))
|
6191 |
+
},
|
6192 |
+
indexFromPos: function (coords) {
|
6193 |
+
coords = clipPos(this, coords);
|
6194 |
+
var index = coords.ch;
|
6195 |
+
if (coords.line < this.first || coords.ch < 0) { return 0 }
|
6196 |
+
var sepSize = this.lineSeparator().length;
|
6197 |
+
this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
|
6198 |
+
index += line.text.length + sepSize;
|
6199 |
+
});
|
6200 |
+
return index
|
6201 |
+
},
|
6202 |
+
|
6203 |
+
copy: function(copyHistory) {
|
6204 |
+
var doc = new Doc(getLines(this, this.first, this.first + this.size),
|
6205 |
+
this.modeOption, this.first, this.lineSep, this.direction);
|
6206 |
+
doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
|
6207 |
+
doc.sel = this.sel;
|
6208 |
+
doc.extend = false;
|
6209 |
+
if (copyHistory) {
|
6210 |
+
doc.history.undoDepth = this.history.undoDepth;
|
6211 |
+
doc.setHistory(this.getHistory());
|
6212 |
+
}
|
6213 |
+
return doc
|
6214 |
+
},
|
6215 |
+
|
6216 |
+
linkedDoc: function(options) {
|
6217 |
+
if (!options) { options = {}; }
|
6218 |
+
var from = this.first, to = this.first + this.size;
|
6219 |
+
if (options.from != null && options.from > from) { from = options.from; }
|
6220 |
+
if (options.to != null && options.to < to) { to = options.to; }
|
6221 |
+
var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
|
6222 |
+
if (options.sharedHist) { copy.history = this.history
|
6223 |
+
; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
|
6224 |
+
copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
|
6225 |
+
copySharedMarkers(copy, findSharedMarkers(this));
|
6226 |
+
return copy
|
6227 |
+
},
|
6228 |
+
unlinkDoc: function(other) {
|
6229 |
+
var this$1 = this;
|
6230 |
+
|
6231 |
+
if (other instanceof CodeMirror$1) { other = other.doc; }
|
6232 |
+
if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
|
6233 |
+
var link = this$1.linked[i];
|
6234 |
+
if (link.doc != other) { continue }
|
6235 |
+
this$1.linked.splice(i, 1);
|
6236 |
+
other.unlinkDoc(this$1);
|
6237 |
+
detachSharedMarkers(findSharedMarkers(this$1));
|
6238 |
+
break
|
6239 |
+
} }
|
6240 |
+
// If the histories were shared, split them again
|
6241 |
+
if (other.history == this.history) {
|
6242 |
+
var splitIds = [other.id];
|
6243 |
+
linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
|
6244 |
+
other.history = new History(null);
|
6245 |
+
other.history.done = copyHistoryArray(this.history.done, splitIds);
|
6246 |
+
other.history.undone = copyHistoryArray(this.history.undone, splitIds);
|
6247 |
+
}
|
6248 |
+
},
|
6249 |
+
iterLinkedDocs: function(f) {linkedDocs(this, f);},
|
6250 |
+
|
6251 |
+
getMode: function() {return this.mode},
|
6252 |
+
getEditor: function() {return this.cm},
|
6253 |
+
|
6254 |
+
splitLines: function(str) {
|
6255 |
+
if (this.lineSep) { return str.split(this.lineSep) }
|
6256 |
+
return splitLinesAuto(str)
|
6257 |
+
},
|
6258 |
+
lineSeparator: function() { return this.lineSep || "\n" },
|
6259 |
+
|
6260 |
+
setDirection: docMethodOp(function (dir) {
|
6261 |
+
if (dir != "rtl") { dir = "ltr"; }
|
6262 |
+
if (dir == this.direction) { return }
|
6263 |
+
this.direction = dir;
|
6264 |
+
this.iter(function (line) { return line.order = null; });
|
6265 |
+
if (this.cm) { directionChanged(this.cm); }
|
6266 |
+
})
|
6267 |
+
});
|
6268 |
+
|
6269 |
+
// Public alias.
|
6270 |
+
Doc.prototype.eachLine = Doc.prototype.iter;
|
6271 |
+
|
6272 |
+
// Kludge to work around strange IE behavior where it'll sometimes
|
6273 |
+
// re-fire a series of drag-related events right after the drop (#1551)
|
6274 |
+
var lastDrop = 0;
|
6275 |
+
|
6276 |
+
function onDrop(e) {
|
6277 |
+
var cm = this;
|
6278 |
+
clearDragCursor(cm);
|
6279 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
|
6280 |
+
{ return }
|
6281 |
+
e_preventDefault(e);
|
6282 |
+
if (ie) { lastDrop = +new Date; }
|
6283 |
+
var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
|
6284 |
+
if (!pos || cm.isReadOnly()) { return }
|
6285 |
+
// Might be a file drop, in which case we simply extract the text
|
6286 |
+
// and insert it.
|
6287 |
+
if (files && files.length && window.FileReader && window.File) {
|
6288 |
+
var n = files.length, text = Array(n), read = 0;
|
6289 |
+
var loadFile = function (file, i) {
|
6290 |
+
if (cm.options.allowDropFileTypes &&
|
6291 |
+
indexOf(cm.options.allowDropFileTypes, file.type) == -1)
|
6292 |
+
{ return }
|
6293 |
+
|
6294 |
+
var reader = new FileReader;
|
6295 |
+
reader.onload = operation(cm, function () {
|
6296 |
+
var content = reader.result;
|
6297 |
+
if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
|
6298 |
+
text[i] = content;
|
6299 |
+
if (++read == n) {
|
6300 |
+
pos = clipPos(cm.doc, pos);
|
6301 |
+
var change = {from: pos, to: pos,
|
6302 |
+
text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
|
6303 |
+
origin: "paste"};
|
6304 |
+
makeChange(cm.doc, change);
|
6305 |
+
setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
|
6306 |
+
}
|
6307 |
+
});
|
6308 |
+
reader.readAsText(file);
|
6309 |
+
};
|
6310 |
+
for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
|
6311 |
+
} else { // Normal drop
|
6312 |
+
// Don't do a replace if the drop happened inside of the selected text.
|
6313 |
+
if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
|
6314 |
+
cm.state.draggingText(e);
|
6315 |
+
// Ensure the editor is re-focused
|
6316 |
+
setTimeout(function () { return cm.display.input.focus(); }, 20);
|
6317 |
+
return
|
6318 |
+
}
|
6319 |
+
try {
|
6320 |
+
var text$1 = e.dataTransfer.getData("Text");
|
6321 |
+
if (text$1) {
|
6322 |
+
var selected;
|
6323 |
+
if (cm.state.draggingText && !cm.state.draggingText.copy)
|
6324 |
+
{ selected = cm.listSelections(); }
|
6325 |
+
setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
|
6326 |
+
if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
|
6327 |
+
{ replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
|
6328 |
+
cm.replaceSelection(text$1, "around", "paste");
|
6329 |
+
cm.display.input.focus();
|
6330 |
+
}
|
6331 |
+
}
|
6332 |
+
catch(e){}
|
6333 |
+
}
|
6334 |
+
}
|
6335 |
+
|
6336 |
+
function onDragStart(cm, e) {
|
6337 |
+
if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
|
6338 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
|
6339 |
+
|
6340 |
+
e.dataTransfer.setData("Text", cm.getSelection());
|
6341 |
+
e.dataTransfer.effectAllowed = "copyMove";
|
6342 |
+
|
6343 |
+
// Use dummy image instead of default browsers image.
|
6344 |
+
// Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
|
6345 |
+
if (e.dataTransfer.setDragImage && !safari) {
|
6346 |
+
var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
|
6347 |
+
img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
6348 |
+
if (presto) {
|
6349 |
+
img.width = img.height = 1;
|
6350 |
+
cm.display.wrapper.appendChild(img);
|
6351 |
+
// Force a relayout, or Opera won't use our image for some obscure reason
|
6352 |
+
img._top = img.offsetTop;
|
6353 |
+
}
|
6354 |
+
e.dataTransfer.setDragImage(img, 0, 0);
|
6355 |
+
if (presto) { img.parentNode.removeChild(img); }
|
6356 |
+
}
|
6357 |
+
}
|
6358 |
+
|
6359 |
+
function onDragOver(cm, e) {
|
6360 |
+
var pos = posFromMouse(cm, e);
|
6361 |
+
if (!pos) { return }
|
6362 |
+
var frag = document.createDocumentFragment();
|
6363 |
+
drawSelectionCursor(cm, pos, frag);
|
6364 |
+
if (!cm.display.dragCursor) {
|
6365 |
+
cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
|
6366 |
+
cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
|
6367 |
+
}
|
6368 |
+
removeChildrenAndAdd(cm.display.dragCursor, frag);
|
6369 |
+
}
|
6370 |
+
|
6371 |
+
function clearDragCursor(cm) {
|
6372 |
+
if (cm.display.dragCursor) {
|
6373 |
+
cm.display.lineSpace.removeChild(cm.display.dragCursor);
|
6374 |
+
cm.display.dragCursor = null;
|
6375 |
+
}
|
6376 |
+
}
|
6377 |
+
|
6378 |
+
// These must be handled carefully, because naively registering a
|
6379 |
+
// handler for each editor will cause the editors to never be
|
6380 |
+
// garbage collected.
|
6381 |
+
|
6382 |
+
function forEachCodeMirror(f) {
|
6383 |
+
if (!document.body.getElementsByClassName) { return }
|
6384 |
+
var byClass = document.body.getElementsByClassName("CodeMirror");
|
6385 |
+
for (var i = 0; i < byClass.length; i++) {
|
6386 |
+
var cm = byClass[i].CodeMirror;
|
6387 |
+
if (cm) { f(cm); }
|
6388 |
+
}
|
6389 |
+
}
|
6390 |
+
|
6391 |
+
var globalsRegistered = false;
|
6392 |
+
function ensureGlobalHandlers() {
|
6393 |
+
if (globalsRegistered) { return }
|
6394 |
+
registerGlobalHandlers();
|
6395 |
+
globalsRegistered = true;
|
6396 |
+
}
|
6397 |
+
function registerGlobalHandlers() {
|
6398 |
+
// When the window resizes, we need to refresh active editors.
|
6399 |
+
var resizeTimer;
|
6400 |
+
on(window, "resize", function () {
|
6401 |
+
if (resizeTimer == null) { resizeTimer = setTimeout(function () {
|
6402 |
+
resizeTimer = null;
|
6403 |
+
forEachCodeMirror(onResize);
|
6404 |
+
}, 100); }
|
6405 |
+
});
|
6406 |
+
// When the window loses focus, we want to show the editor as blurred
|
6407 |
+
on(window, "blur", function () { return forEachCodeMirror(onBlur); });
|
6408 |
+
}
|
6409 |
+
// Called when the window resizes
|
6410 |
+
function onResize(cm) {
|
6411 |
+
var d = cm.display;
|
6412 |
+
if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
|
6413 |
+
{ return }
|
6414 |
+
// Might be a text scaling operation, clear size caches.
|
6415 |
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
|
6416 |
+
d.scrollbarsClipped = false;
|
6417 |
+
cm.setSize();
|
6418 |
+
}
|
6419 |
+
|
6420 |
+
var keyNames = {
|
6421 |
+
3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
|
6422 |
+
19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
|
6423 |
+
36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
|
6424 |
+
46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
|
6425 |
+
106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
|
6426 |
+
173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
|
6427 |
+
221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
|
6428 |
+
63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
|
6429 |
+
};
|
6430 |
+
|
6431 |
+
// Number keys
|
6432 |
+
for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
|
6433 |
+
// Alphabetic keys
|
6434 |
+
for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
|
6435 |
+
// Function keys
|
6436 |
+
for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
|
6437 |
+
|
6438 |
+
var keyMap = {};
|
6439 |
+
|
6440 |
+
keyMap.basic = {
|
6441 |
+
"Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
|
6442 |
+
"End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
|
6443 |
+
"Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
|
6444 |
+
"Tab": "defaultTab", "Shift-Tab": "indentAuto",
|
6445 |
+
"Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
|
6446 |
+
"Esc": "singleSelection"
|
6447 |
+
};
|
6448 |
+
// Note that the save and find-related commands aren't defined by
|
6449 |
+
// default. User code or addons can define them. Unknown commands
|
6450 |
+
// are simply ignored.
|
6451 |
+
keyMap.pcDefault = {
|
6452 |
+
"Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
|
6453 |
+
"Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
|
6454 |
+
"Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
|
6455 |
+
"Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
|
6456 |
+
"Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
|
6457 |
+
"Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
|
6458 |
+
"Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
|
6459 |
+
fallthrough: "basic"
|
6460 |
+
};
|
6461 |
+
// Very basic readline/emacs-style bindings, which are standard on Mac.
|
6462 |
+
keyMap.emacsy = {
|
6463 |
+
"Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
|
6464 |
+
"Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
|
6465 |
+
"Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
|
6466 |
+
"Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
|
6467 |
+
"Ctrl-O": "openLine"
|
6468 |
+
};
|
6469 |
+
keyMap.macDefault = {
|
6470 |
+
"Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
|
6471 |
+
"Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
|
6472 |
+
"Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
|
6473 |
+
"Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
|
6474 |
+
"Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
|
6475 |
+
"Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
|
6476 |
+
"Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
|
6477 |
+
fallthrough: ["basic", "emacsy"]
|
6478 |
+
};
|
6479 |
+
keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
|
6480 |
+
|
6481 |
+
// KEYMAP DISPATCH
|
6482 |
+
|
6483 |
+
function normalizeKeyName(name) {
|
6484 |
+
var parts = name.split(/-(?!$)/);
|
6485 |
+
name = parts[parts.length - 1];
|
6486 |
+
var alt, ctrl, shift, cmd;
|
6487 |
+
for (var i = 0; i < parts.length - 1; i++) {
|
6488 |
+
var mod = parts[i];
|
6489 |
+
if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
|
6490 |
+
else if (/^a(lt)?$/i.test(mod)) { alt = true; }
|
6491 |
+
else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
|
6492 |
+
else if (/^s(hift)?$/i.test(mod)) { shift = true; }
|
6493 |
+
else { throw new Error("Unrecognized modifier name: " + mod) }
|
6494 |
+
}
|
6495 |
+
if (alt) { name = "Alt-" + name; }
|
6496 |
+
if (ctrl) { name = "Ctrl-" + name; }
|
6497 |
+
if (cmd) { name = "Cmd-" + name; }
|
6498 |
+
if (shift) { name = "Shift-" + name; }
|
6499 |
+
return name
|
6500 |
+
}
|
6501 |
+
|
6502 |
+
// This is a kludge to keep keymaps mostly working as raw objects
|
6503 |
+
// (backwards compatibility) while at the same time support features
|
6504 |
+
// like normalization and multi-stroke key bindings. It compiles a
|
6505 |
+
// new normalized keymap, and then updates the old object to reflect
|
6506 |
+
// this.
|
6507 |
+
function normalizeKeyMap(keymap) {
|
6508 |
+
var copy = {};
|
6509 |
+
for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
|
6510 |
+
var value = keymap[keyname];
|
6511 |
+
if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
|
6512 |
+
if (value == "...") { delete keymap[keyname]; continue }
|
6513 |
+
|
6514 |
+
var keys = map(keyname.split(" "), normalizeKeyName);
|
6515 |
+
for (var i = 0; i < keys.length; i++) {
|
6516 |
+
var val = (void 0), name = (void 0);
|
6517 |
+
if (i == keys.length - 1) {
|
6518 |
+
name = keys.join(" ");
|
6519 |
+
val = value;
|
6520 |
+
} else {
|
6521 |
+
name = keys.slice(0, i + 1).join(" ");
|
6522 |
+
val = "...";
|
6523 |
+
}
|
6524 |
+
var prev = copy[name];
|
6525 |
+
if (!prev) { copy[name] = val; }
|
6526 |
+
else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
|
6527 |
+
}
|
6528 |
+
delete keymap[keyname];
|
6529 |
+
} }
|
6530 |
+
for (var prop in copy) { keymap[prop] = copy[prop]; }
|
6531 |
+
return keymap
|
6532 |
+
}
|
6533 |
+
|
6534 |
+
function lookupKey(key, map$$1, handle, context) {
|
6535 |
+
map$$1 = getKeyMap(map$$1);
|
6536 |
+
var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
|
6537 |
+
if (found === false) { return "nothing" }
|
6538 |
+
if (found === "...") { return "multi" }
|
6539 |
+
if (found != null && handle(found)) { return "handled" }
|
6540 |
+
|
6541 |
+
if (map$$1.fallthrough) {
|
6542 |
+
if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
|
6543 |
+
{ return lookupKey(key, map$$1.fallthrough, handle, context) }
|
6544 |
+
for (var i = 0; i < map$$1.fallthrough.length; i++) {
|
6545 |
+
var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
|
6546 |
+
if (result) { return result }
|
6547 |
+
}
|
6548 |
+
}
|
6549 |
+
}
|
6550 |
+
|
6551 |
+
// Modifier key presses don't count as 'real' key presses for the
|
6552 |
+
// purpose of keymap fallthrough.
|
6553 |
+
function isModifierKey(value) {
|
6554 |
+
var name = typeof value == "string" ? value : keyNames[value.keyCode];
|
6555 |
+
return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
|
6556 |
+
}
|
6557 |
+
|
6558 |
+
// Look up the name of a key as indicated by an event object.
|
6559 |
+
function keyName(event, noShift) {
|
6560 |
+
if (presto && event.keyCode == 34 && event["char"]) { return false }
|
6561 |
+
var base = keyNames[event.keyCode], name = base;
|
6562 |
+
if (name == null || event.altGraphKey) { return false }
|
6563 |
+
if (event.altKey && base != "Alt") { name = "Alt-" + name; }
|
6564 |
+
if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
|
6565 |
+
if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; }
|
6566 |
+
if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
|
6567 |
+
return name
|
6568 |
+
}
|
6569 |
+
|
6570 |
+
function getKeyMap(val) {
|
6571 |
+
return typeof val == "string" ? keyMap[val] : val
|
6572 |
+
}
|
6573 |
+
|
6574 |
+
// Helper for deleting text near the selection(s), used to implement
|
6575 |
+
// backspace, delete, and similar functionality.
|
6576 |
+
function deleteNearSelection(cm, compute) {
|
6577 |
+
var ranges = cm.doc.sel.ranges, kill = [];
|
6578 |
+
// Build up a set of ranges to kill first, merging overlapping
|
6579 |
+
// ranges.
|
6580 |
+
for (var i = 0; i < ranges.length; i++) {
|
6581 |
+
var toKill = compute(ranges[i]);
|
6582 |
+
while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
|
6583 |
+
var replaced = kill.pop();
|
6584 |
+
if (cmp(replaced.from, toKill.from) < 0) {
|
6585 |
+
toKill.from = replaced.from;
|
6586 |
+
break
|
6587 |
+
}
|
6588 |
+
}
|
6589 |
+
kill.push(toKill);
|
6590 |
+
}
|
6591 |
+
// Next, remove those actual ranges.
|
6592 |
+
runInOp(cm, function () {
|
6593 |
+
for (var i = kill.length - 1; i >= 0; i--)
|
6594 |
+
{ replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
|
6595 |
+
ensureCursorVisible(cm);
|
6596 |
+
});
|
6597 |
+
}
|
6598 |
+
|
6599 |
+
// Commands are parameter-less actions that can be performed on an
|
6600 |
+
// editor, mostly used for keybindings.
|
6601 |
+
var commands = {
|
6602 |
+
selectAll: selectAll,
|
6603 |
+
singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
|
6604 |
+
killLine: function (cm) { return deleteNearSelection(cm, function (range) {
|
6605 |
+
if (range.empty()) {
|
6606 |
+
var len = getLine(cm.doc, range.head.line).text.length;
|
6607 |
+
if (range.head.ch == len && range.head.line < cm.lastLine())
|
6608 |
+
{ return {from: range.head, to: Pos(range.head.line + 1, 0)} }
|
6609 |
+
else
|
6610 |
+
{ return {from: range.head, to: Pos(range.head.line, len)} }
|
6611 |
+
} else {
|
6612 |
+
return {from: range.from(), to: range.to()}
|
6613 |
+
}
|
6614 |
+
}); },
|
6615 |
+
deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
|
6616 |
+
from: Pos(range.from().line, 0),
|
6617 |
+
to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
|
6618 |
+
}); }); },
|
6619 |
+
delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
|
6620 |
+
from: Pos(range.from().line, 0), to: range.from()
|
6621 |
+
}); }); },
|
6622 |
+
delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
|
6623 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
6624 |
+
var leftPos = cm.coordsChar({left: 0, top: top}, "div");
|
6625 |
+
return {from: leftPos, to: range.from()}
|
6626 |
+
}); },
|
6627 |
+
delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
|
6628 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
6629 |
+
var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
|
6630 |
+
return {from: range.from(), to: rightPos }
|
6631 |
+
}); },
|
6632 |
+
undo: function (cm) { return cm.undo(); },
|
6633 |
+
redo: function (cm) { return cm.redo(); },
|
6634 |
+
undoSelection: function (cm) { return cm.undoSelection(); },
|
6635 |
+
redoSelection: function (cm) { return cm.redoSelection(); },
|
6636 |
+
goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
|
6637 |
+
goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
|
6638 |
+
goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
|
6639 |
+
{origin: "+move", bias: 1}
|
6640 |
+
); },
|
6641 |
+
goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
|
6642 |
+
{origin: "+move", bias: 1}
|
6643 |
+
); },
|
6644 |
+
goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
|
6645 |
+
{origin: "+move", bias: -1}
|
6646 |
+
); },
|
6647 |
+
goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
|
6648 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
6649 |
+
return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
|
6650 |
+
}, sel_move); },
|
6651 |
+
goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
|
6652 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
6653 |
+
return cm.coordsChar({left: 0, top: top}, "div")
|
6654 |
+
}, sel_move); },
|
6655 |
+
goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
|
6656 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
6657 |
+
var pos = cm.coordsChar({left: 0, top: top}, "div");
|
6658 |
+
if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
|
6659 |
+
return pos
|
6660 |
+
}, sel_move); },
|
6661 |
+
goLineUp: function (cm) { return cm.moveV(-1, "line"); },
|
6662 |
+
goLineDown: function (cm) { return cm.moveV(1, "line"); },
|
6663 |
+
goPageUp: function (cm) { return cm.moveV(-1, "page"); },
|
6664 |
+
goPageDown: function (cm) { return cm.moveV(1, "page"); },
|
6665 |
+
goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
|
6666 |
+
goCharRight: function (cm) { return cm.moveH(1, "char"); },
|
6667 |
+
goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
|
6668 |
+
goColumnRight: function (cm) { return cm.moveH(1, "column"); },
|
6669 |
+
goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
|
6670 |
+
goGroupRight: function (cm) { return cm.moveH(1, "group"); },
|
6671 |
+
goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
|
6672 |
+
goWordRight: function (cm) { return cm.moveH(1, "word"); },
|
6673 |
+
delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
|
6674 |
+
delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
|
6675 |
+
delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
|
6676 |
+
delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
|
6677 |
+
delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
|
6678 |
+
delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
|
6679 |
+
indentAuto: function (cm) { return cm.indentSelection("smart"); },
|
6680 |
+
indentMore: function (cm) { return cm.indentSelection("add"); },
|
6681 |
+
indentLess: function (cm) { return cm.indentSelection("subtract"); },
|
6682 |
+
insertTab: function (cm) { return cm.replaceSelection("\t"); },
|
6683 |
+
insertSoftTab: function (cm) {
|
6684 |
+
var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
|
6685 |
+
for (var i = 0; i < ranges.length; i++) {
|
6686 |
+
var pos = ranges[i].from();
|
6687 |
+
var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
|
6688 |
+
spaces.push(spaceStr(tabSize - col % tabSize));
|
6689 |
+
}
|
6690 |
+
cm.replaceSelections(spaces);
|
6691 |
+
},
|
6692 |
+
defaultTab: function (cm) {
|
6693 |
+
if (cm.somethingSelected()) { cm.indentSelection("add"); }
|
6694 |
+
else { cm.execCommand("insertTab"); }
|
6695 |
+
},
|
6696 |
+
// Swap the two chars left and right of each selection's head.
|
6697 |
+
// Move cursor behind the two swapped characters afterwards.
|
6698 |
+
//
|
6699 |
+
// Doesn't consider line feeds a character.
|
6700 |
+
// Doesn't scan more than one line above to find a character.
|
6701 |
+
// Doesn't do anything on an empty line.
|
6702 |
+
// Doesn't do anything with non-empty selections.
|
6703 |
+
transposeChars: function (cm) { return runInOp(cm, function () {
|
6704 |
+
var ranges = cm.listSelections(), newSel = [];
|
6705 |
+
for (var i = 0; i < ranges.length; i++) {
|
6706 |
+
if (!ranges[i].empty()) { continue }
|
6707 |
+
var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
|
6708 |
+
if (line) {
|
6709 |
+
if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
|
6710 |
+
if (cur.ch > 0) {
|
6711 |
+
cur = new Pos(cur.line, cur.ch + 1);
|
6712 |
+
cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
|
6713 |
+
Pos(cur.line, cur.ch - 2), cur, "+transpose");
|
6714 |
+
} else if (cur.line > cm.doc.first) {
|
6715 |
+
var prev = getLine(cm.doc, cur.line - 1).text;
|
6716 |
+
if (prev) {
|
6717 |
+
cur = new Pos(cur.line, 1);
|
6718 |
+
cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
|
6719 |
+
prev.charAt(prev.length - 1),
|
6720 |
+
Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
|
6721 |
+
}
|
6722 |
+
}
|
6723 |
+
}
|
6724 |
+
newSel.push(new Range(cur, cur));
|
6725 |
+
}
|
6726 |
+
cm.setSelections(newSel);
|
6727 |
+
}); },
|
6728 |
+
newlineAndIndent: function (cm) { return runInOp(cm, function () {
|
6729 |
+
var sels = cm.listSelections();
|
6730 |
+
for (var i = sels.length - 1; i >= 0; i--)
|
6731 |
+
{ cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
|
6732 |
+
sels = cm.listSelections();
|
6733 |
+
for (var i$1 = 0; i$1 < sels.length; i$1++)
|
6734 |
+
{ cm.indentLine(sels[i$1].from().line, null, true); }
|
6735 |
+
ensureCursorVisible(cm);
|
6736 |
+
}); },
|
6737 |
+
openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
|
6738 |
+
toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
|
6739 |
+
};
|
6740 |
+
|
6741 |
+
|
6742 |
+
function lineStart(cm, lineN) {
|
6743 |
+
var line = getLine(cm.doc, lineN);
|
6744 |
+
var visual = visualLine(line);
|
6745 |
+
if (visual != line) { lineN = lineNo(visual); }
|
6746 |
+
return endOfLine(true, cm, visual, lineN, 1)
|
6747 |
+
}
|
6748 |
+
function lineEnd(cm, lineN) {
|
6749 |
+
var line = getLine(cm.doc, lineN);
|
6750 |
+
var visual = visualLineEnd(line);
|
6751 |
+
if (visual != line) { lineN = lineNo(visual); }
|
6752 |
+
return endOfLine(true, cm, line, lineN, -1)
|
6753 |
+
}
|
6754 |
+
function lineStartSmart(cm, pos) {
|
6755 |
+
var start = lineStart(cm, pos.line);
|
6756 |
+
var line = getLine(cm.doc, start.line);
|
6757 |
+
var order = getOrder(line, cm.doc.direction);
|
6758 |
+
if (!order || order[0].level == 0) {
|
6759 |
+
var firstNonWS = Math.max(0, line.text.search(/\S/));
|
6760 |
+
var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
|
6761 |
+
return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
|
6762 |
+
}
|
6763 |
+
return start
|
6764 |
+
}
|
6765 |
+
|
6766 |
+
// Run a handler that was bound to a key.
|
6767 |
+
function doHandleBinding(cm, bound, dropShift) {
|
6768 |
+
if (typeof bound == "string") {
|
6769 |
+
bound = commands[bound];
|
6770 |
+
if (!bound) { return false }
|
6771 |
+
}
|
6772 |
+
// Ensure previous input has been read, so that the handler sees a
|
6773 |
+
// consistent view of the document
|
6774 |
+
cm.display.input.ensurePolled();
|
6775 |
+
var prevShift = cm.display.shift, done = false;
|
6776 |
+
try {
|
6777 |
+
if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
|
6778 |
+
if (dropShift) { cm.display.shift = false; }
|
6779 |
+
done = bound(cm) != Pass;
|
6780 |
+
} finally {
|
6781 |
+
cm.display.shift = prevShift;
|
6782 |
+
cm.state.suppressEdits = false;
|
6783 |
+
}
|
6784 |
+
return done
|
6785 |
+
}
|
6786 |
+
|
6787 |
+
function lookupKeyForEditor(cm, name, handle) {
|
6788 |
+
for (var i = 0; i < cm.state.keyMaps.length; i++) {
|
6789 |
+
var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
|
6790 |
+
if (result) { return result }
|
6791 |
+
}
|
6792 |
+
return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
|
6793 |
+
|| lookupKey(name, cm.options.keyMap, handle, cm)
|
6794 |
+
}
|
6795 |
+
|
6796 |
+
var stopSeq = new Delayed;
|
6797 |
+
function dispatchKey(cm, name, e, handle) {
|
6798 |
+
var seq = cm.state.keySeq;
|
6799 |
+
if (seq) {
|
6800 |
+
if (isModifierKey(name)) { return "handled" }
|
6801 |
+
stopSeq.set(50, function () {
|
6802 |
+
if (cm.state.keySeq == seq) {
|
6803 |
+
cm.state.keySeq = null;
|
6804 |
+
cm.display.input.reset();
|
6805 |
+
}
|
6806 |
+
});
|
6807 |
+
name = seq + " " + name;
|
6808 |
+
}
|
6809 |
+
var result = lookupKeyForEditor(cm, name, handle);
|
6810 |
+
|
6811 |
+
if (result == "multi")
|
6812 |
+
{ cm.state.keySeq = name; }
|
6813 |
+
if (result == "handled")
|
6814 |
+
{ signalLater(cm, "keyHandled", cm, name, e); }
|
6815 |
+
|
6816 |
+
if (result == "handled" || result == "multi") {
|
6817 |
+
e_preventDefault(e);
|
6818 |
+
restartBlink(cm);
|
6819 |
+
}
|
6820 |
+
|
6821 |
+
if (seq && !result && /\'$/.test(name)) {
|
6822 |
+
e_preventDefault(e);
|
6823 |
+
return true
|
6824 |
+
}
|
6825 |
+
return !!result
|
6826 |
+
}
|
6827 |
+
|
6828 |
+
// Handle a key from the keydown event.
|
6829 |
+
function handleKeyBinding(cm, e) {
|
6830 |
+
var name = keyName(e, true);
|
6831 |
+
if (!name) { return false }
|
6832 |
+
|
6833 |
+
if (e.shiftKey && !cm.state.keySeq) {
|
6834 |
+
// First try to resolve full name (including 'Shift-'). Failing
|
6835 |
+
// that, see if there is a cursor-motion command (starting with
|
6836 |
+
// 'go') bound to the keyname without 'Shift-'.
|
6837 |
+
return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
|
6838 |
+
|| dispatchKey(cm, name, e, function (b) {
|
6839 |
+
if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
|
6840 |
+
{ return doHandleBinding(cm, b) }
|
6841 |
+
})
|
6842 |
+
} else {
|
6843 |
+
return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
|
6844 |
+
}
|
6845 |
+
}
|
6846 |
+
|
6847 |
+
// Handle a key from the keypress event
|
6848 |
+
function handleCharBinding(cm, e, ch) {
|
6849 |
+
return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
|
6850 |
+
}
|
6851 |
+
|
6852 |
+
var lastStoppedKey = null;
|
6853 |
+
function onKeyDown(e) {
|
6854 |
+
var cm = this;
|
6855 |
+
cm.curOp.focus = activeElt();
|
6856 |
+
if (signalDOMEvent(cm, e)) { return }
|
6857 |
+
// IE does strange things with escape.
|
6858 |
+
if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
|
6859 |
+
var code = e.keyCode;
|
6860 |
+
cm.display.shift = code == 16 || e.shiftKey;
|
6861 |
+
var handled = handleKeyBinding(cm, e);
|
6862 |
+
if (presto) {
|
6863 |
+
lastStoppedKey = handled ? code : null;
|
6864 |
+
// Opera has no cut event... we try to at least catch the key combo
|
6865 |
+
if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
|
6866 |
+
{ cm.replaceSelection("", null, "cut"); }
|
6867 |
+
}
|
6868 |
+
|
6869 |
+
// Turn mouse into crosshair when Alt is held on Mac.
|
6870 |
+
if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
|
6871 |
+
{ showCrossHair(cm); }
|
6872 |
+
}
|
6873 |
+
|
6874 |
+
function showCrossHair(cm) {
|
6875 |
+
var lineDiv = cm.display.lineDiv;
|
6876 |
+
addClass(lineDiv, "CodeMirror-crosshair");
|
6877 |
+
|
6878 |
+
function up(e) {
|
6879 |
+
if (e.keyCode == 18 || !e.altKey) {
|
6880 |
+
rmClass(lineDiv, "CodeMirror-crosshair");
|
6881 |
+
off(document, "keyup", up);
|
6882 |
+
off(document, "mouseover", up);
|
6883 |
+
}
|
6884 |
+
}
|
6885 |
+
on(document, "keyup", up);
|
6886 |
+
on(document, "mouseover", up);
|
6887 |
+
}
|
6888 |
+
|
6889 |
+
function onKeyUp(e) {
|
6890 |
+
if (e.keyCode == 16) { this.doc.sel.shift = false; }
|
6891 |
+
signalDOMEvent(this, e);
|
6892 |
+
}
|
6893 |
+
|
6894 |
+
function onKeyPress(e) {
|
6895 |
+
var cm = this;
|
6896 |
+
if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
|
6897 |
+
var keyCode = e.keyCode, charCode = e.charCode;
|
6898 |
+
if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
|
6899 |
+
if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
|
6900 |
+
var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
|
6901 |
+
// Some browsers fire keypress events for backspace
|
6902 |
+
if (ch == "\x08") { return }
|
6903 |
+
if (handleCharBinding(cm, e, ch)) { return }
|
6904 |
+
cm.display.input.onKeyPress(e);
|
6905 |
+
}
|
6906 |
+
|
6907 |
+
// A mouse down can be a single click, double click, triple click,
|
6908 |
+
// start of selection drag, start of text drag, new cursor
|
6909 |
+
// (ctrl-click), rectangle drag (alt-drag), or xwin
|
6910 |
+
// middle-click-paste. Or it might be a click on something we should
|
6911 |
+
// not interfere with, such as a scrollbar or widget.
|
6912 |
+
function onMouseDown(e) {
|
6913 |
+
var cm = this, display = cm.display;
|
6914 |
+
if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
|
6915 |
+
display.input.ensurePolled();
|
6916 |
+
display.shift = e.shiftKey;
|
6917 |
+
|
6918 |
+
if (eventInWidget(display, e)) {
|
6919 |
+
if (!webkit) {
|
6920 |
+
// Briefly turn off draggability, to allow widgets to do
|
6921 |
+
// normal dragging things.
|
6922 |
+
display.scroller.draggable = false;
|
6923 |
+
setTimeout(function () { return display.scroller.draggable = true; }, 100);
|
6924 |
+
}
|
6925 |
+
return
|
6926 |
+
}
|
6927 |
+
if (clickInGutter(cm, e)) { return }
|
6928 |
+
var start = posFromMouse(cm, e);
|
6929 |
+
window.focus();
|
6930 |
+
|
6931 |
+
switch (e_button(e)) {
|
6932 |
+
case 1:
|
6933 |
+
// #3261: make sure, that we're not starting a second selection
|
6934 |
+
if (cm.state.selectingText)
|
6935 |
+
{ cm.state.selectingText(e); }
|
6936 |
+
else if (start)
|
6937 |
+
{ leftButtonDown(cm, e, start); }
|
6938 |
+
else if (e_target(e) == display.scroller)
|
6939 |
+
{ e_preventDefault(e); }
|
6940 |
+
break
|
6941 |
+
case 2:
|
6942 |
+
if (webkit) { cm.state.lastMiddleDown = +new Date; }
|
6943 |
+
if (start) { extendSelection(cm.doc, start); }
|
6944 |
+
setTimeout(function () { return display.input.focus(); }, 20);
|
6945 |
+
e_preventDefault(e);
|
6946 |
+
break
|
6947 |
+
case 3:
|
6948 |
+
if (captureRightClick) { onContextMenu(cm, e); }
|
6949 |
+
else { delayBlurEvent(cm); }
|
6950 |
+
break
|
6951 |
+
}
|
6952 |
+
}
|
6953 |
+
|
6954 |
+
var lastClick;
|
6955 |
+
var lastDoubleClick;
|
6956 |
+
function leftButtonDown(cm, e, start) {
|
6957 |
+
if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
|
6958 |
+
else { cm.curOp.focus = activeElt(); }
|
6959 |
+
|
6960 |
+
var now = +new Date, type;
|
6961 |
+
if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
|
6962 |
+
type = "triple";
|
6963 |
+
} else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
|
6964 |
+
type = "double";
|
6965 |
+
lastDoubleClick = {time: now, pos: start};
|
6966 |
+
} else {
|
6967 |
+
type = "single";
|
6968 |
+
lastClick = {time: now, pos: start};
|
6969 |
+
}
|
6970 |
+
|
6971 |
+
var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
|
6972 |
+
if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
|
6973 |
+
type == "single" && (contained = sel.contains(start)) > -1 &&
|
6974 |
+
(cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
|
6975 |
+
(cmp(contained.to(), start) > 0 || start.xRel < 0))
|
6976 |
+
{ leftButtonStartDrag(cm, e, start, modifier); }
|
6977 |
+
else
|
6978 |
+
{ leftButtonSelect(cm, e, start, type, modifier); }
|
6979 |
+
}
|
6980 |
+
|
6981 |
+
// Start a text drag. When it ends, see if any dragging actually
|
6982 |
+
// happen, and treat as a click if it didn't.
|
6983 |
+
function leftButtonStartDrag(cm, e, start, modifier) {
|
6984 |
+
var display = cm.display, startTime = +new Date;
|
6985 |
+
var dragEnd = operation(cm, function (e2) {
|
6986 |
+
if (webkit) { display.scroller.draggable = false; }
|
6987 |
+
cm.state.draggingText = false;
|
6988 |
+
off(document, "mouseup", dragEnd);
|
6989 |
+
off(display.scroller, "drop", dragEnd);
|
6990 |
+
if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
|
6991 |
+
e_preventDefault(e2);
|
6992 |
+
if (!modifier && +new Date - 200 < startTime)
|
6993 |
+
{ extendSelection(cm.doc, start); }
|
6994 |
+
// Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
|
6995 |
+
if (webkit || ie && ie_version == 9)
|
6996 |
+
{ setTimeout(function () {document.body.focus(); display.input.focus();}, 20); }
|
6997 |
+
else
|
6998 |
+
{ display.input.focus(); }
|
6999 |
+
}
|
7000 |
+
});
|
7001 |
+
// Let the drag handler handle this.
|
7002 |
+
if (webkit) { display.scroller.draggable = true; }
|
7003 |
+
cm.state.draggingText = dragEnd;
|
7004 |
+
dragEnd.copy = mac ? e.altKey : e.ctrlKey;
|
7005 |
+
// IE's approach to draggable
|
7006 |
+
if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
|
7007 |
+
on(document, "mouseup", dragEnd);
|
7008 |
+
on(display.scroller, "drop", dragEnd);
|
7009 |
+
}
|
7010 |
+
|
7011 |
+
// Normal selection, as opposed to text dragging.
|
7012 |
+
function leftButtonSelect(cm, e, start, type, addNew) {
|
7013 |
+
var display = cm.display, doc = cm.doc;
|
7014 |
+
e_preventDefault(e);
|
7015 |
+
|
7016 |
+
var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
|
7017 |
+
if (addNew && !e.shiftKey) {
|
7018 |
+
ourIndex = doc.sel.contains(start);
|
7019 |
+
if (ourIndex > -1)
|
7020 |
+
{ ourRange = ranges[ourIndex]; }
|
7021 |
+
else
|
7022 |
+
{ ourRange = new Range(start, start); }
|
7023 |
+
} else {
|
7024 |
+
ourRange = doc.sel.primary();
|
7025 |
+
ourIndex = doc.sel.primIndex;
|
7026 |
+
}
|
7027 |
+
|
7028 |
+
if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
|
7029 |
+
type = "rect";
|
7030 |
+
if (!addNew) { ourRange = new Range(start, start); }
|
7031 |
+
start = posFromMouse(cm, e, true, true);
|
7032 |
+
ourIndex = -1;
|
7033 |
+
} else if (type == "double") {
|
7034 |
+
var word = cm.findWordAt(start);
|
7035 |
+
if (cm.display.shift || doc.extend)
|
7036 |
+
{ ourRange = extendRange(doc, ourRange, word.anchor, word.head); }
|
7037 |
+
else
|
7038 |
+
{ ourRange = word; }
|
7039 |
+
} else if (type == "triple") {
|
7040 |
+
var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));
|
7041 |
+
if (cm.display.shift || doc.extend)
|
7042 |
+
{ ourRange = extendRange(doc, ourRange, line.anchor, line.head); }
|
7043 |
+
else
|
7044 |
+
{ ourRange = line; }
|
7045 |
+
} else {
|
7046 |
+
ourRange = extendRange(doc, ourRange, start);
|
7047 |
+
}
|
7048 |
+
|
7049 |
+
if (!addNew) {
|
7050 |
+
ourIndex = 0;
|
7051 |
+
setSelection(doc, new Selection([ourRange], 0), sel_mouse);
|
7052 |
+
startSel = doc.sel;
|
7053 |
+
} else if (ourIndex == -1) {
|
7054 |
+
ourIndex = ranges.length;
|
7055 |
+
setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
|
7056 |
+
{scroll: false, origin: "*mouse"});
|
7057 |
+
} else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
|
7058 |
+
setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
|
7059 |
+
{scroll: false, origin: "*mouse"});
|
7060 |
+
startSel = doc.sel;
|
7061 |
+
} else {
|
7062 |
+
replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
|
7063 |
+
}
|
7064 |
+
|
7065 |
+
var lastPos = start;
|
7066 |
+
function extendTo(pos) {
|
7067 |
+
if (cmp(lastPos, pos) == 0) { return }
|
7068 |
+
lastPos = pos;
|
7069 |
+
|
7070 |
+
if (type == "rect") {
|
7071 |
+
var ranges = [], tabSize = cm.options.tabSize;
|
7072 |
+
var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
|
7073 |
+
var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
|
7074 |
+
var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
|
7075 |
+
for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
|
7076 |
+
line <= end; line++) {
|
7077 |
+
var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
|
7078 |
+
if (left == right)
|
7079 |
+
{ ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
|
7080 |
+
else if (text.length > leftPos)
|
7081 |
+
{ ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
|
7082 |
+
}
|
7083 |
+
if (!ranges.length) { ranges.push(new Range(start, start)); }
|
7084 |
+
setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
|
7085 |
+
{origin: "*mouse", scroll: false});
|
7086 |
+
cm.scrollIntoView(pos);
|
7087 |
+
} else {
|
7088 |
+
var oldRange = ourRange;
|
7089 |
+
var anchor = oldRange.anchor, head = pos;
|
7090 |
+
if (type != "single") {
|
7091 |
+
var range$$1;
|
7092 |
+
if (type == "double")
|
7093 |
+
{ range$$1 = cm.findWordAt(pos); }
|
7094 |
+
else
|
7095 |
+
{ range$$1 = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); }
|
7096 |
+
if (cmp(range$$1.anchor, anchor) > 0) {
|
7097 |
+
head = range$$1.head;
|
7098 |
+
anchor = minPos(oldRange.from(), range$$1.anchor);
|
7099 |
+
} else {
|
7100 |
+
head = range$$1.anchor;
|
7101 |
+
anchor = maxPos(oldRange.to(), range$$1.head);
|
7102 |
+
}
|
7103 |
+
}
|
7104 |
+
var ranges$1 = startSel.ranges.slice(0);
|
7105 |
+
ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head);
|
7106 |
+
setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);
|
7107 |
+
}
|
7108 |
+
}
|
7109 |
+
|
7110 |
+
var editorSize = display.wrapper.getBoundingClientRect();
|
7111 |
+
// Used to ensure timeout re-tries don't fire when another extend
|
7112 |
+
// happened in the meantime (clearTimeout isn't reliable -- at
|
7113 |
+
// least on Chrome, the timeouts still happen even when cleared,
|
7114 |
+
// if the clear happens after their scheduled firing time).
|
7115 |
+
var counter = 0;
|
7116 |
+
|
7117 |
+
function extend(e) {
|
7118 |
+
var curCount = ++counter;
|
7119 |
+
var cur = posFromMouse(cm, e, true, type == "rect");
|
7120 |
+
if (!cur) { return }
|
7121 |
+
if (cmp(cur, lastPos) != 0) {
|
7122 |
+
cm.curOp.focus = activeElt();
|
7123 |
+
extendTo(cur);
|
7124 |
+
var visible = visibleLines(display, doc);
|
7125 |
+
if (cur.line >= visible.to || cur.line < visible.from)
|
7126 |
+
{ setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
|
7127 |
+
} else {
|
7128 |
+
var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
|
7129 |
+
if (outside) { setTimeout(operation(cm, function () {
|
7130 |
+
if (counter != curCount) { return }
|
7131 |
+
display.scroller.scrollTop += outside;
|
7132 |
+
extend(e);
|
7133 |
+
}), 50); }
|
7134 |
+
}
|
7135 |
+
}
|
7136 |
+
|
7137 |
+
function done(e) {
|
7138 |
+
cm.state.selectingText = false;
|
7139 |
+
counter = Infinity;
|
7140 |
+
e_preventDefault(e);
|
7141 |
+
display.input.focus();
|
7142 |
+
off(document, "mousemove", move);
|
7143 |
+
off(document, "mouseup", up);
|
7144 |
+
doc.history.lastSelOrigin = null;
|
7145 |
+
}
|
7146 |
+
|
7147 |
+
var move = operation(cm, function (e) {
|
7148 |
+
if (!e_button(e)) { done(e); }
|
7149 |
+
else { extend(e); }
|
7150 |
+
});
|
7151 |
+
var up = operation(cm, done);
|
7152 |
+
cm.state.selectingText = up;
|
7153 |
+
on(document, "mousemove", move);
|
7154 |
+
on(document, "mouseup", up);
|
7155 |
+
}
|
7156 |
+
|
7157 |
+
|
7158 |
+
// Determines whether an event happened in the gutter, and fires the
|
7159 |
+
// handlers for the corresponding event.
|
7160 |
+
function gutterEvent(cm, e, type, prevent) {
|
7161 |
+
var mX, mY;
|
7162 |
+
try { mX = e.clientX; mY = e.clientY; }
|
7163 |
+
catch(e) { return false }
|
7164 |
+
if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
|
7165 |
+
if (prevent) { e_preventDefault(e); }
|
7166 |
+
|
7167 |
+
var display = cm.display;
|
7168 |
+
var lineBox = display.lineDiv.getBoundingClientRect();
|
7169 |
+
|
7170 |
+
if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
|
7171 |
+
mY -= lineBox.top - display.viewOffset;
|
7172 |
+
|
7173 |
+
for (var i = 0; i < cm.options.gutters.length; ++i) {
|
7174 |
+
var g = display.gutters.childNodes[i];
|
7175 |
+
if (g && g.getBoundingClientRect().right >= mX) {
|
7176 |
+
var line = lineAtHeight(cm.doc, mY);
|
7177 |
+
var gutter = cm.options.gutters[i];
|
7178 |
+
signal(cm, type, cm, line, gutter, e);
|
7179 |
+
return e_defaultPrevented(e)
|
7180 |
+
}
|
7181 |
+
}
|
7182 |
+
}
|
7183 |
+
|
7184 |
+
function clickInGutter(cm, e) {
|
7185 |
+
return gutterEvent(cm, e, "gutterClick", true)
|
7186 |
+
}
|
7187 |
+
|
7188 |
+
// CONTEXT MENU HANDLING
|
7189 |
+
|
7190 |
+
// To make the context menu work, we need to briefly unhide the
|
7191 |
+
// textarea (making it as unobtrusive as possible) to let the
|
7192 |
+
// right-click take effect on it.
|
7193 |
+
function onContextMenu(cm, e) {
|
7194 |
+
if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
|
7195 |
+
if (signalDOMEvent(cm, e, "contextmenu")) { return }
|
7196 |
+
cm.display.input.onContextMenu(e);
|
7197 |
+
}
|
7198 |
+
|
7199 |
+
function contextMenuInGutter(cm, e) {
|
7200 |
+
if (!hasHandler(cm, "gutterContextMenu")) { return false }
|
7201 |
+
return gutterEvent(cm, e, "gutterContextMenu", false)
|
7202 |
+
}
|
7203 |
+
|
7204 |
+
function themeChanged(cm) {
|
7205 |
+
cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
|
7206 |
+
cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
|
7207 |
+
clearCaches(cm);
|
7208 |
+
}
|
7209 |
+
|
7210 |
+
var Init = {toString: function(){return "CodeMirror.Init"}};
|
7211 |
+
|
7212 |
+
var defaults = {};
|
7213 |
+
var optionHandlers = {};
|
7214 |
+
|
7215 |
+
function defineOptions(CodeMirror) {
|
7216 |
+
var optionHandlers = CodeMirror.optionHandlers;
|
7217 |
+
|
7218 |
+
function option(name, deflt, handle, notOnInit) {
|
7219 |
+
CodeMirror.defaults[name] = deflt;
|
7220 |
+
if (handle) { optionHandlers[name] =
|
7221 |
+
notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
|
7222 |
+
}
|
7223 |
+
|
7224 |
+
CodeMirror.defineOption = option;
|
7225 |
+
|
7226 |
+
// Passed to option handlers when there is no old value.
|
7227 |
+
CodeMirror.Init = Init;
|
7228 |
+
|
7229 |
+
// These two are, on init, called from the constructor because they
|
7230 |
+
// have to be initialized before the editor can start at all.
|
7231 |
+
option("value", "", function (cm, val) { return cm.setValue(val); }, true);
|
7232 |
+
option("mode", null, function (cm, val) {
|
7233 |
+
cm.doc.modeOption = val;
|
7234 |
+
loadMode(cm);
|
7235 |
+
}, true);
|
7236 |
+
|
7237 |
+
option("indentUnit", 2, loadMode, true);
|
7238 |
+
option("indentWithTabs", false);
|
7239 |
+
option("smartIndent", true);
|
7240 |
+
option("tabSize", 4, function (cm) {
|
7241 |
+
resetModeState(cm);
|
7242 |
+
clearCaches(cm);
|
7243 |
+
regChange(cm);
|
7244 |
+
}, true);
|
7245 |
+
option("lineSeparator", null, function (cm, val) {
|
7246 |
+
cm.doc.lineSep = val;
|
7247 |
+
if (!val) { return }
|
7248 |
+
var newBreaks = [], lineNo = cm.doc.first;
|
7249 |
+
cm.doc.iter(function (line) {
|
7250 |
+
for (var pos = 0;;) {
|
7251 |
+
var found = line.text.indexOf(val, pos);
|
7252 |
+
if (found == -1) { break }
|
7253 |
+
pos = found + val.length;
|
7254 |
+
newBreaks.push(Pos(lineNo, found));
|
7255 |
+
}
|
7256 |
+
lineNo++;
|
7257 |
+
});
|
7258 |
+
for (var i = newBreaks.length - 1; i >= 0; i--)
|
7259 |
+
{ replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
|
7260 |
+
});
|
7261 |
+
option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
|
7262 |
+
cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
|
7263 |
+
if (old != Init) { cm.refresh(); }
|
7264 |
+
});
|
7265 |
+
option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
|
7266 |
+
option("electricChars", true);
|
7267 |
+
option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
|
7268 |
+
throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
|
7269 |
+
}, true);
|
7270 |
+
option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
|
7271 |
+
option("rtlMoveVisually", !windows);
|
7272 |
+
option("wholeLineUpdateBefore", true);
|
7273 |
+
|
7274 |
+
option("theme", "default", function (cm) {
|
7275 |
+
themeChanged(cm);
|
7276 |
+
guttersChanged(cm);
|
7277 |
+
}, true);
|
7278 |
+
option("keyMap", "default", function (cm, val, old) {
|
7279 |
+
var next = getKeyMap(val);
|
7280 |
+
var prev = old != Init && getKeyMap(old);
|
7281 |
+
if (prev && prev.detach) { prev.detach(cm, next); }
|
7282 |
+
if (next.attach) { next.attach(cm, prev || null); }
|
7283 |
+
});
|
7284 |
+
option("extraKeys", null);
|
7285 |
+
|
7286 |
+
option("lineWrapping", false, wrappingChanged, true);
|
7287 |
+
option("gutters", [], function (cm) {
|
7288 |
+
setGuttersForLineNumbers(cm.options);
|
7289 |
+
guttersChanged(cm);
|
7290 |
+
}, true);
|
7291 |
+
option("fixedGutter", true, function (cm, val) {
|
7292 |
+
cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
|
7293 |
+
cm.refresh();
|
7294 |
+
}, true);
|
7295 |
+
option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
|
7296 |
+
option("scrollbarStyle", "native", function (cm) {
|
7297 |
+
initScrollbars(cm);
|
7298 |
+
updateScrollbars(cm);
|
7299 |
+
cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
|
7300 |
+
cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
|
7301 |
+
}, true);
|
7302 |
+
option("lineNumbers", false, function (cm) {
|
7303 |
+
setGuttersForLineNumbers(cm.options);
|
7304 |
+
guttersChanged(cm);
|
7305 |
+
}, true);
|
7306 |
+
option("firstLineNumber", 1, guttersChanged, true);
|
7307 |
+
option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true);
|
7308 |
+
option("showCursorWhenSelecting", false, updateSelection, true);
|
7309 |
+
|
7310 |
+
option("resetSelectionOnContextMenu", true);
|
7311 |
+
option("lineWiseCopyCut", true);
|
7312 |
+
|
7313 |
+
option("readOnly", false, function (cm, val) {
|
7314 |
+
if (val == "nocursor") {
|
7315 |
+
onBlur(cm);
|
7316 |
+
cm.display.input.blur();
|
7317 |
+
cm.display.disabled = true;
|
7318 |
+
} else {
|
7319 |
+
cm.display.disabled = false;
|
7320 |
+
}
|
7321 |
+
cm.display.input.readOnlyChanged(val);
|
7322 |
+
});
|
7323 |
+
option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
|
7324 |
+
option("dragDrop", true, dragDropChanged);
|
7325 |
+
option("allowDropFileTypes", null);
|
7326 |
+
|
7327 |
+
option("cursorBlinkRate", 530);
|
7328 |
+
option("cursorScrollMargin", 0);
|
7329 |
+
option("cursorHeight", 1, updateSelection, true);
|
7330 |
+
option("singleCursorHeightPerLine", true, updateSelection, true);
|
7331 |
+
option("workTime", 100);
|
7332 |
+
option("workDelay", 100);
|
7333 |
+
option("flattenSpans", true, resetModeState, true);
|
7334 |
+
option("addModeClass", false, resetModeState, true);
|
7335 |
+
option("pollInterval", 100);
|
7336 |
+
option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
|
7337 |
+
option("historyEventDelay", 1250);
|
7338 |
+
option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
|
7339 |
+
option("maxHighlightLength", 10000, resetModeState, true);
|
7340 |
+
option("moveInputWithCursor", true, function (cm, val) {
|
7341 |
+
if (!val) { cm.display.input.resetPosition(); }
|
7342 |
+
});
|
7343 |
+
|
7344 |
+
option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
|
7345 |
+
option("autofocus", null);
|
7346 |
+
option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
|
7347 |
+
}
|
7348 |
+
|
7349 |
+
function guttersChanged(cm) {
|
7350 |
+
updateGutters(cm);
|
7351 |
+
regChange(cm);
|
7352 |
+
alignHorizontally(cm);
|
7353 |
+
}
|
7354 |
+
|
7355 |
+
function dragDropChanged(cm, value, old) {
|
7356 |
+
var wasOn = old && old != Init;
|
7357 |
+
if (!value != !wasOn) {
|
7358 |
+
var funcs = cm.display.dragFunctions;
|
7359 |
+
var toggle = value ? on : off;
|
7360 |
+
toggle(cm.display.scroller, "dragstart", funcs.start);
|
7361 |
+
toggle(cm.display.scroller, "dragenter", funcs.enter);
|
7362 |
+
toggle(cm.display.scroller, "dragover", funcs.over);
|
7363 |
+
toggle(cm.display.scroller, "dragleave", funcs.leave);
|
7364 |
+
toggle(cm.display.scroller, "drop", funcs.drop);
|
7365 |
+
}
|
7366 |
+
}
|
7367 |
+
|
7368 |
+
function wrappingChanged(cm) {
|
7369 |
+
if (cm.options.lineWrapping) {
|
7370 |
+
addClass(cm.display.wrapper, "CodeMirror-wrap");
|
7371 |
+
cm.display.sizer.style.minWidth = "";
|
7372 |
+
cm.display.sizerWidth = null;
|
7373 |
+
} else {
|
7374 |
+
rmClass(cm.display.wrapper, "CodeMirror-wrap");
|
7375 |
+
findMaxLine(cm);
|
7376 |
+
}
|
7377 |
+
estimateLineHeights(cm);
|
7378 |
+
regChange(cm);
|
7379 |
+
clearCaches(cm);
|
7380 |
+
setTimeout(function () { return updateScrollbars(cm); }, 100);
|
7381 |
+
}
|
7382 |
+
|
7383 |
+
// A CodeMirror instance represents an editor. This is the object
|
7384 |
+
// that user code is usually dealing with.
|
7385 |
+
|
7386 |
+
function CodeMirror$1(place, options) {
|
7387 |
+
var this$1 = this;
|
7388 |
+
|
7389 |
+
if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }
|
7390 |
+
|
7391 |
+
this.options = options = options ? copyObj(options) : {};
|
7392 |
+
// Determine effective options based on given values and defaults.
|
7393 |
+
copyObj(defaults, options, false);
|
7394 |
+
setGuttersForLineNumbers(options);
|
7395 |
+
|
7396 |
+
var doc = options.value;
|
7397 |
+
if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
|
7398 |
+
this.doc = doc;
|
7399 |
+
|
7400 |
+
var input = new CodeMirror$1.inputStyles[options.inputStyle](this);
|
7401 |
+
var display = this.display = new Display(place, doc, input);
|
7402 |
+
display.wrapper.CodeMirror = this;
|
7403 |
+
updateGutters(this);
|
7404 |
+
themeChanged(this);
|
7405 |
+
if (options.lineWrapping)
|
7406 |
+
{ this.display.wrapper.className += " CodeMirror-wrap"; }
|
7407 |
+
initScrollbars(this);
|
7408 |
+
|
7409 |
+
this.state = {
|
7410 |
+
keyMaps: [], // stores maps added by addKeyMap
|
7411 |
+
overlays: [], // highlighting overlays, as added by addOverlay
|
7412 |
+
modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
|
7413 |
+
overwrite: false,
|
7414 |
+
delayingBlurEvent: false,
|
7415 |
+
focused: false,
|
7416 |
+
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
|
7417 |
+
pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
|
7418 |
+
selectingText: false,
|
7419 |
+
draggingText: false,
|
7420 |
+
highlight: new Delayed(), // stores highlight worker timeout
|
7421 |
+
keySeq: null, // Unfinished key sequence
|
7422 |
+
specialChars: null
|
7423 |
+
};
|
7424 |
+
|
7425 |
+
if (options.autofocus && !mobile) { display.input.focus(); }
|
7426 |
+
|
7427 |
+
// Override magic textarea content restore that IE sometimes does
|
7428 |
+
// on our hidden textarea on reload
|
7429 |
+
if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
|
7430 |
+
|
7431 |
+
registerEventHandlers(this);
|
7432 |
+
ensureGlobalHandlers();
|
7433 |
+
|
7434 |
+
startOperation(this);
|
7435 |
+
this.curOp.forceUpdate = true;
|
7436 |
+
attachDoc(this, doc);
|
7437 |
+
|
7438 |
+
if ((options.autofocus && !mobile) || this.hasFocus())
|
7439 |
+
{ setTimeout(bind(onFocus, this), 20); }
|
7440 |
+
else
|
7441 |
+
{ onBlur(this); }
|
7442 |
+
|
7443 |
+
for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
|
7444 |
+
{ optionHandlers[opt](this$1, options[opt], Init); } }
|
7445 |
+
maybeUpdateLineNumberWidth(this);
|
7446 |
+
if (options.finishInit) { options.finishInit(this); }
|
7447 |
+
for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }
|
7448 |
+
endOperation(this);
|
7449 |
+
// Suppress optimizelegibility in Webkit, since it breaks text
|
7450 |
+
// measuring on line wrapping boundaries.
|
7451 |
+
if (webkit && options.lineWrapping &&
|
7452 |
+
getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
|
7453 |
+
{ display.lineDiv.style.textRendering = "auto"; }
|
7454 |
+
}
|
7455 |
+
|
7456 |
+
// The default configuration options.
|
7457 |
+
CodeMirror$1.defaults = defaults;
|
7458 |
+
// Functions to run when options are changed.
|
7459 |
+
CodeMirror$1.optionHandlers = optionHandlers;
|
7460 |
+
|
7461 |
+
// Attach the necessary event handlers when initializing the editor
|
7462 |
+
function registerEventHandlers(cm) {
|
7463 |
+
var d = cm.display;
|
7464 |
+
on(d.scroller, "mousedown", operation(cm, onMouseDown));
|
7465 |
+
// Older IE's will not fire a second mousedown for a double click
|
7466 |
+
if (ie && ie_version < 11)
|
7467 |
+
{ on(d.scroller, "dblclick", operation(cm, function (e) {
|
7468 |
+
if (signalDOMEvent(cm, e)) { return }
|
7469 |
+
var pos = posFromMouse(cm, e);
|
7470 |
+
if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
|
7471 |
+
e_preventDefault(e);
|
7472 |
+
var word = cm.findWordAt(pos);
|
7473 |
+
extendSelection(cm.doc, word.anchor, word.head);
|
7474 |
+
})); }
|
7475 |
+
else
|
7476 |
+
{ on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
|
7477 |
+
// Some browsers fire contextmenu *after* opening the menu, at
|
7478 |
+
// which point we can't mess with it anymore. Context menu is
|
7479 |
+
// handled in onMouseDown for these browsers.
|
7480 |
+
if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); }
|
7481 |
+
|
7482 |
+
// Used to suppress mouse event handling when a touch happens
|
7483 |
+
var touchFinished, prevTouch = {end: 0};
|
7484 |
+
function finishTouch() {
|
7485 |
+
if (d.activeTouch) {
|
7486 |
+
touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
|
7487 |
+
prevTouch = d.activeTouch;
|
7488 |
+
prevTouch.end = +new Date;
|
7489 |
+
}
|
7490 |
+
}
|
7491 |
+
function isMouseLikeTouchEvent(e) {
|
7492 |
+
if (e.touches.length != 1) { return false }
|
7493 |
+
var touch = e.touches[0];
|
7494 |
+
return touch.radiusX <= 1 && touch.radiusY <= 1
|
7495 |
+
}
|
7496 |
+
function farAway(touch, other) {
|
7497 |
+
if (other.left == null) { return true }
|
7498 |
+
var dx = other.left - touch.left, dy = other.top - touch.top;
|
7499 |
+
return dx * dx + dy * dy > 20 * 20
|
7500 |
+
}
|
7501 |
+
on(d.scroller, "touchstart", function (e) {
|
7502 |
+
if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
|
7503 |
+
d.input.ensurePolled();
|
7504 |
+
clearTimeout(touchFinished);
|
7505 |
+
var now = +new Date;
|
7506 |
+
d.activeTouch = {start: now, moved: false,
|
7507 |
+
prev: now - prevTouch.end <= 300 ? prevTouch : null};
|
7508 |
+
if (e.touches.length == 1) {
|
7509 |
+
d.activeTouch.left = e.touches[0].pageX;
|
7510 |
+
d.activeTouch.top = e.touches[0].pageY;
|
7511 |
+
}
|
7512 |
+
}
|
7513 |
+
});
|
7514 |
+
on(d.scroller, "touchmove", function () {
|
7515 |
+
if (d.activeTouch) { d.activeTouch.moved = true; }
|
7516 |
+
});
|
7517 |
+
on(d.scroller, "touchend", function (e) {
|
7518 |
+
var touch = d.activeTouch;
|
7519 |
+
if (touch && !eventInWidget(d, e) && touch.left != null &&
|
7520 |
+
!touch.moved && new Date - touch.start < 300) {
|
7521 |
+
var pos = cm.coordsChar(d.activeTouch, "page"), range;
|
7522 |
+
if (!touch.prev || farAway(touch, touch.prev)) // Single tap
|
7523 |
+
{ range = new Range(pos, pos); }
|
7524 |
+
else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
|
7525 |
+
{ range = cm.findWordAt(pos); }
|
7526 |
+
else // Triple tap
|
7527 |
+
{ range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
|
7528 |
+
cm.setSelection(range.anchor, range.head);
|
7529 |
+
cm.focus();
|
7530 |
+
e_preventDefault(e);
|
7531 |
+
}
|
7532 |
+
finishTouch();
|
7533 |
+
});
|
7534 |
+
on(d.scroller, "touchcancel", finishTouch);
|
7535 |
+
|
7536 |
+
// Sync scrolling between fake scrollbars and real scrollable
|
7537 |
+
// area, ensure viewport is updated when scrolling.
|
7538 |
+
on(d.scroller, "scroll", function () {
|
7539 |
+
if (d.scroller.clientHeight) {
|
7540 |
+
setScrollTop(cm, d.scroller.scrollTop);
|
7541 |
+
setScrollLeft(cm, d.scroller.scrollLeft, true);
|
7542 |
+
signal(cm, "scroll", cm);
|
7543 |
+
}
|
7544 |
+
});
|
7545 |
+
|
7546 |
+
// Listen to wheel events in order to try and update the viewport on time.
|
7547 |
+
on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
|
7548 |
+
on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
|
7549 |
+
|
7550 |
+
// Prevent wrapper from ever scrolling
|
7551 |
+
on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
|
7552 |
+
|
7553 |
+
d.dragFunctions = {
|
7554 |
+
enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
|
7555 |
+
over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
|
7556 |
+
start: function (e) { return onDragStart(cm, e); },
|
7557 |
+
drop: operation(cm, onDrop),
|
7558 |
+
leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
|
7559 |
+
};
|
7560 |
+
|
7561 |
+
var inp = d.input.getField();
|
7562 |
+
on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
|
7563 |
+
on(inp, "keydown", operation(cm, onKeyDown));
|
7564 |
+
on(inp, "keypress", operation(cm, onKeyPress));
|
7565 |
+
on(inp, "focus", function (e) { return onFocus(cm, e); });
|
7566 |
+
on(inp, "blur", function (e) { return onBlur(cm, e); });
|
7567 |
+
}
|
7568 |
+
|
7569 |
+
var initHooks = [];
|
7570 |
+
CodeMirror$1.defineInitHook = function (f) { return initHooks.push(f); };
|
7571 |
+
|
7572 |
+
// Indent the given line. The how parameter can be "smart",
|
7573 |
+
// "add"/null, "subtract", or "prev". When aggressive is false
|
7574 |
+
// (typically set to true for forced single-line indents), empty
|
7575 |
+
// lines are not indented, and places where the mode returns Pass
|
7576 |
+
// are left alone.
|
7577 |
+
function indentLine(cm, n, how, aggressive) {
|
7578 |
+
var doc = cm.doc, state;
|
7579 |
+
if (how == null) { how = "add"; }
|
7580 |
+
if (how == "smart") {
|
7581 |
+
// Fall back to "prev" when the mode doesn't have an indentation
|
7582 |
+
// method.
|
7583 |
+
if (!doc.mode.indent) { how = "prev"; }
|
7584 |
+
else { state = getStateBefore(cm, n); }
|
7585 |
+
}
|
7586 |
+
|
7587 |
+
var tabSize = cm.options.tabSize;
|
7588 |
+
var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
|
7589 |
+
if (line.stateAfter) { line.stateAfter = null; }
|
7590 |
+
var curSpaceString = line.text.match(/^\s*/)[0], indentation;
|
7591 |
+
if (!aggressive && !/\S/.test(line.text)) {
|
7592 |
+
indentation = 0;
|
7593 |
+
how = "not";
|
7594 |
+
} else if (how == "smart") {
|
7595 |
+
indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
|
7596 |
+
if (indentation == Pass || indentation > 150) {
|
7597 |
+
if (!aggressive) { return }
|
7598 |
+
how = "prev";
|
7599 |
+
}
|
7600 |
+
}
|
7601 |
+
if (how == "prev") {
|
7602 |
+
if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
|
7603 |
+
else { indentation = 0; }
|
7604 |
+
} else if (how == "add") {
|
7605 |
+
indentation = curSpace + cm.options.indentUnit;
|
7606 |
+
} else if (how == "subtract") {
|
7607 |
+
indentation = curSpace - cm.options.indentUnit;
|
7608 |
+
} else if (typeof how == "number") {
|
7609 |
+
indentation = curSpace + how;
|
7610 |
+
}
|
7611 |
+
indentation = Math.max(0, indentation);
|
7612 |
+
|
7613 |
+
var indentString = "", pos = 0;
|
7614 |
+
if (cm.options.indentWithTabs)
|
7615 |
+
{ for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
|
7616 |
+
if (pos < indentation) { indentString += spaceStr(indentation - pos); }
|
7617 |
+
|
7618 |
+
if (indentString != curSpaceString) {
|
7619 |
+
replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
|
7620 |
+
line.stateAfter = null;
|
7621 |
+
return true
|
7622 |
+
} else {
|
7623 |
+
// Ensure that, if the cursor was in the whitespace at the start
|
7624 |
+
// of the line, it is moved to the end of that space.
|
7625 |
+
for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
|
7626 |
+
var range = doc.sel.ranges[i$1];
|
7627 |
+
if (range.head.line == n && range.head.ch < curSpaceString.length) {
|
7628 |
+
var pos$1 = Pos(n, curSpaceString.length);
|
7629 |
+
replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
|
7630 |
+
break
|
7631 |
+
}
|
7632 |
+
}
|
7633 |
+
}
|
7634 |
+
}
|
7635 |
+
|
7636 |
+
// This will be set to a {lineWise: bool, text: [string]} object, so
|
7637 |
+
// that, when pasting, we know what kind of selections the copied
|
7638 |
+
// text was made out of.
|
7639 |
+
var lastCopied = null;
|
7640 |
+
|
7641 |
+
function setLastCopied(newLastCopied) {
|
7642 |
+
lastCopied = newLastCopied;
|
7643 |
+
}
|
7644 |
+
|
7645 |
+
function applyTextInput(cm, inserted, deleted, sel, origin) {
|
7646 |
+
var doc = cm.doc;
|
7647 |
+
cm.display.shift = false;
|
7648 |
+
if (!sel) { sel = doc.sel; }
|
7649 |
+
|
7650 |
+
var paste = cm.state.pasteIncoming || origin == "paste";
|
7651 |
+
var textLines = splitLinesAuto(inserted), multiPaste = null;
|
7652 |
+
// When pasing N lines into N selections, insert one line per selection
|
7653 |
+
if (paste && sel.ranges.length > 1) {
|
7654 |
+
if (lastCopied && lastCopied.text.join("\n") == inserted) {
|
7655 |
+
if (sel.ranges.length % lastCopied.text.length == 0) {
|
7656 |
+
multiPaste = [];
|
7657 |
+
for (var i = 0; i < lastCopied.text.length; i++)
|
7658 |
+
{ multiPaste.push(doc.splitLines(lastCopied.text[i])); }
|
7659 |
+
}
|
7660 |
+
} else if (textLines.length == sel.ranges.length) {
|
7661 |
+
multiPaste = map(textLines, function (l) { return [l]; });
|
7662 |
+
}
|
7663 |
+
}
|
7664 |
+
|
7665 |
+
var updateInput;
|
7666 |
+
// Normal behavior is to insert the new text into every selection
|
7667 |
+
for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
|
7668 |
+
var range$$1 = sel.ranges[i$1];
|
7669 |
+
var from = range$$1.from(), to = range$$1.to();
|
7670 |
+
if (range$$1.empty()) {
|
7671 |
+
if (deleted && deleted > 0) // Handle deletion
|
7672 |
+
{ from = Pos(from.line, from.ch - deleted); }
|
7673 |
+
else if (cm.state.overwrite && !paste) // Handle overwrite
|
7674 |
+
{ to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
|
7675 |
+
else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
|
7676 |
+
{ from = to = Pos(from.line, 0); }
|
7677 |
+
}
|
7678 |
+
updateInput = cm.curOp.updateInput;
|
7679 |
+
var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
|
7680 |
+
origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
|
7681 |
+
makeChange(cm.doc, changeEvent);
|
7682 |
+
signalLater(cm, "inputRead", cm, changeEvent);
|
7683 |
+
}
|
7684 |
+
if (inserted && !paste)
|
7685 |
+
{ triggerElectric(cm, inserted); }
|
7686 |
+
|
7687 |
+
ensureCursorVisible(cm);
|
7688 |
+
cm.curOp.updateInput = updateInput;
|
7689 |
+
cm.curOp.typing = true;
|
7690 |
+
cm.state.pasteIncoming = cm.state.cutIncoming = false;
|
7691 |
+
}
|
7692 |
+
|
7693 |
+
function handlePaste(e, cm) {
|
7694 |
+
var pasted = e.clipboardData && e.clipboardData.getData("Text");
|
7695 |
+
if (pasted) {
|
7696 |
+
e.preventDefault();
|
7697 |
+
if (!cm.isReadOnly() && !cm.options.disableInput)
|
7698 |
+
{ runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
|
7699 |
+
return true
|
7700 |
+
}
|
7701 |
+
}
|
7702 |
+
|
7703 |
+
function triggerElectric(cm, inserted) {
|
7704 |
+
// When an 'electric' character is inserted, immediately trigger a reindent
|
7705 |
+
if (!cm.options.electricChars || !cm.options.smartIndent) { return }
|
7706 |
+
var sel = cm.doc.sel;
|
7707 |
+
|
7708 |
+
for (var i = sel.ranges.length - 1; i >= 0; i--) {
|
7709 |
+
var range$$1 = sel.ranges[i];
|
7710 |
+
if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }
|
7711 |
+
var mode = cm.getModeAt(range$$1.head);
|
7712 |
+
var indented = false;
|
7713 |
+
if (mode.electricChars) {
|
7714 |
+
for (var j = 0; j < mode.electricChars.length; j++)
|
7715 |
+
{ if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
|
7716 |
+
indented = indentLine(cm, range$$1.head.line, "smart");
|
7717 |
+
break
|
7718 |
+
} }
|
7719 |
+
} else if (mode.electricInput) {
|
7720 |
+
if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))
|
7721 |
+
{ indented = indentLine(cm, range$$1.head.line, "smart"); }
|
7722 |
+
}
|
7723 |
+
if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); }
|
7724 |
+
}
|
7725 |
+
}
|
7726 |
+
|
7727 |
+
function copyableRanges(cm) {
|
7728 |
+
var text = [], ranges = [];
|
7729 |
+
for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
|
7730 |
+
var line = cm.doc.sel.ranges[i].head.line;
|
7731 |
+
var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
|
7732 |
+
ranges.push(lineRange);
|
7733 |
+
text.push(cm.getRange(lineRange.anchor, lineRange.head));
|
7734 |
+
}
|
7735 |
+
return {text: text, ranges: ranges}
|
7736 |
+
}
|
7737 |
+
|
7738 |
+
function disableBrowserMagic(field, spellcheck) {
|
7739 |
+
field.setAttribute("autocorrect", "off");
|
7740 |
+
field.setAttribute("autocapitalize", "off");
|
7741 |
+
field.setAttribute("spellcheck", !!spellcheck);
|
7742 |
+
}
|
7743 |
+
|
7744 |
+
function hiddenTextarea() {
|
7745 |
+
var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
|
7746 |
+
var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
|
7747 |
+
// The textarea is kept positioned near the cursor to prevent the
|
7748 |
+
// fact that it'll be scrolled into view on input from scrolling
|
7749 |
+
// our fake cursor out of view. On webkit, when wrap=off, paste is
|
7750 |
+
// very slow. So make the area wide instead.
|
7751 |
+
if (webkit) { te.style.width = "1000px"; }
|
7752 |
+
else { te.setAttribute("wrap", "off"); }
|
7753 |
+
// If border: 0; -- iOS fails to open keyboard (issue #1287)
|
7754 |
+
if (ios) { te.style.border = "1px solid black"; }
|
7755 |
+
disableBrowserMagic(te);
|
7756 |
+
return div
|
7757 |
+
}
|
7758 |
+
|
7759 |
+
// The publicly visible API. Note that methodOp(f) means
|
7760 |
+
// 'wrap f in an operation, performed on its `this` parameter'.
|
7761 |
+
|
7762 |
+
// This is not the complete set of editor methods. Most of the
|
7763 |
+
// methods defined on the Doc type are also injected into
|
7764 |
+
// CodeMirror.prototype, for backwards compatibility and
|
7765 |
+
// convenience.
|
7766 |
+
|
7767 |
+
var addEditorMethods = function(CodeMirror) {
|
7768 |
+
var optionHandlers = CodeMirror.optionHandlers;
|
7769 |
+
|
7770 |
+
var helpers = CodeMirror.helpers = {};
|
7771 |
+
|
7772 |
+
CodeMirror.prototype = {
|
7773 |
+
constructor: CodeMirror,
|
7774 |
+
focus: function(){window.focus(); this.display.input.focus();},
|
7775 |
+
|
7776 |
+
setOption: function(option, value) {
|
7777 |
+
var options = this.options, old = options[option];
|
7778 |
+
if (options[option] == value && option != "mode") { return }
|
7779 |
+
options[option] = value;
|
7780 |
+
if (optionHandlers.hasOwnProperty(option))
|
7781 |
+
{ operation(this, optionHandlers[option])(this, value, old); }
|
7782 |
+
signal(this, "optionChange", this, option);
|
7783 |
+
},
|
7784 |
+
|
7785 |
+
getOption: function(option) {return this.options[option]},
|
7786 |
+
getDoc: function() {return this.doc},
|
7787 |
+
|
7788 |
+
addKeyMap: function(map$$1, bottom) {
|
7789 |
+
this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1));
|
7790 |
+
},
|
7791 |
+
removeKeyMap: function(map$$1) {
|
7792 |
+
var maps = this.state.keyMaps;
|
7793 |
+
for (var i = 0; i < maps.length; ++i)
|
7794 |
+
{ if (maps[i] == map$$1 || maps[i].name == map$$1) {
|
7795 |
+
maps.splice(i, 1);
|
7796 |
+
return true
|
7797 |
+
} }
|
7798 |
+
},
|
7799 |
+
|
7800 |
+
addOverlay: methodOp(function(spec, options) {
|
7801 |
+
var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
|
7802 |
+
if (mode.startState) { throw new Error("Overlays may not be stateful.") }
|
7803 |
+
insertSorted(this.state.overlays,
|
7804 |
+
{mode: mode, modeSpec: spec, opaque: options && options.opaque,
|
7805 |
+
priority: (options && options.priority) || 0},
|
7806 |
+
function (overlay) { return overlay.priority; });
|
7807 |
+
this.state.modeGen++;
|
7808 |
+
regChange(this);
|
7809 |
+
}),
|
7810 |
+
removeOverlay: methodOp(function(spec) {
|
7811 |
+
var this$1 = this;
|
7812 |
+
|
7813 |
+
var overlays = this.state.overlays;
|
7814 |
+
for (var i = 0; i < overlays.length; ++i) {
|
7815 |
+
var cur = overlays[i].modeSpec;
|
7816 |
+
if (cur == spec || typeof spec == "string" && cur.name == spec) {
|
7817 |
+
overlays.splice(i, 1);
|
7818 |
+
this$1.state.modeGen++;
|
7819 |
+
regChange(this$1);
|
7820 |
+
return
|
7821 |
+
}
|
7822 |
+
}
|
7823 |
+
}),
|
7824 |
+
|
7825 |
+
indentLine: methodOp(function(n, dir, aggressive) {
|
7826 |
+
if (typeof dir != "string" && typeof dir != "number") {
|
7827 |
+
if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
|
7828 |
+
else { dir = dir ? "add" : "subtract"; }
|
7829 |
+
}
|
7830 |
+
if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
|
7831 |
+
}),
|
7832 |
+
indentSelection: methodOp(function(how) {
|
7833 |
+
var this$1 = this;
|
7834 |
+
|
7835 |
+
var ranges = this.doc.sel.ranges, end = -1;
|
7836 |
+
for (var i = 0; i < ranges.length; i++) {
|
7837 |
+
var range$$1 = ranges[i];
|
7838 |
+
if (!range$$1.empty()) {
|
7839 |
+
var from = range$$1.from(), to = range$$1.to();
|
7840 |
+
var start = Math.max(end, from.line);
|
7841 |
+
end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
|
7842 |
+
for (var j = start; j < end; ++j)
|
7843 |
+
{ indentLine(this$1, j, how); }
|
7844 |
+
var newRanges = this$1.doc.sel.ranges;
|
7845 |
+
if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
|
7846 |
+
{ replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
|
7847 |
+
} else if (range$$1.head.line > end) {
|
7848 |
+
indentLine(this$1, range$$1.head.line, how, true);
|
7849 |
+
end = range$$1.head.line;
|
7850 |
+
if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }
|
7851 |
+
}
|
7852 |
+
}
|
7853 |
+
}),
|
7854 |
+
|
7855 |
+
// Fetch the parser token for a given character. Useful for hacks
|
7856 |
+
// that want to inspect the mode state (say, for completion).
|
7857 |
+
getTokenAt: function(pos, precise) {
|
7858 |
+
return takeToken(this, pos, precise)
|
7859 |
+
},
|
7860 |
+
|
7861 |
+
getLineTokens: function(line, precise) {
|
7862 |
+
return takeToken(this, Pos(line), precise, true)
|
7863 |
+
},
|
7864 |
+
|
7865 |
+
getTokenTypeAt: function(pos) {
|
7866 |
+
pos = clipPos(this.doc, pos);
|
7867 |
+
var styles = getLineStyles(this, getLine(this.doc, pos.line));
|
7868 |
+
var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
|
7869 |
+
var type;
|
7870 |
+
if (ch == 0) { type = styles[2]; }
|
7871 |
+
else { for (;;) {
|
7872 |
+
var mid = (before + after) >> 1;
|
7873 |
+
if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
|
7874 |
+
else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
|
7875 |
+
else { type = styles[mid * 2 + 2]; break }
|
7876 |
+
} }
|
7877 |
+
var cut = type ? type.indexOf("overlay ") : -1;
|
7878 |
+
return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
|
7879 |
+
},
|
7880 |
+
|
7881 |
+
getModeAt: function(pos) {
|
7882 |
+
var mode = this.doc.mode;
|
7883 |
+
if (!mode.innerMode) { return mode }
|
7884 |
+
return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
|
7885 |
+
},
|
7886 |
+
|
7887 |
+
getHelper: function(pos, type) {
|
7888 |
+
return this.getHelpers(pos, type)[0]
|
7889 |
+
},
|
7890 |
+
|
7891 |
+
getHelpers: function(pos, type) {
|
7892 |
+
var this$1 = this;
|
7893 |
+
|
7894 |
+
var found = [];
|
7895 |
+
if (!helpers.hasOwnProperty(type)) { return found }
|
7896 |
+
var help = helpers[type], mode = this.getModeAt(pos);
|
7897 |
+
if (typeof mode[type] == "string") {
|
7898 |
+
if (help[mode[type]]) { found.push(help[mode[type]]); }
|
7899 |
+
} else if (mode[type]) {
|
7900 |
+
for (var i = 0; i < mode[type].length; i++) {
|
7901 |
+
var val = help[mode[type][i]];
|
7902 |
+
if (val) { found.push(val); }
|
7903 |
+
}
|
7904 |
+
} else if (mode.helperType && help[mode.helperType]) {
|
7905 |
+
found.push(help[mode.helperType]);
|
7906 |
+
} else if (help[mode.name]) {
|
7907 |
+
found.push(help[mode.name]);
|
7908 |
+
}
|
7909 |
+
for (var i$1 = 0; i$1 < help._global.length; i$1++) {
|
7910 |
+
var cur = help._global[i$1];
|
7911 |
+
if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
|
7912 |
+
{ found.push(cur.val); }
|
7913 |
+
}
|
7914 |
+
return found
|
7915 |
+
},
|
7916 |
+
|
7917 |
+
getStateAfter: function(line, precise) {
|
7918 |
+
var doc = this.doc;
|
7919 |
+
line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
|
7920 |
+
return getStateBefore(this, line + 1, precise)
|
7921 |
+
},
|
7922 |
+
|
7923 |
+
cursorCoords: function(start, mode) {
|
7924 |
+
var pos, range$$1 = this.doc.sel.primary();
|
7925 |
+
if (start == null) { pos = range$$1.head; }
|
7926 |
+
else if (typeof start == "object") { pos = clipPos(this.doc, start); }
|
7927 |
+
else { pos = start ? range$$1.from() : range$$1.to(); }
|
7928 |
+
return cursorCoords(this, pos, mode || "page")
|
7929 |
+
},
|
7930 |
+
|
7931 |
+
charCoords: function(pos, mode) {
|
7932 |
+
return charCoords(this, clipPos(this.doc, pos), mode || "page")
|
7933 |
+
},
|
7934 |
+
|
7935 |
+
coordsChar: function(coords, mode) {
|
7936 |
+
coords = fromCoordSystem(this, coords, mode || "page");
|
7937 |
+
return coordsChar(this, coords.left, coords.top)
|
7938 |
+
},
|
7939 |
+
|
7940 |
+
lineAtHeight: function(height, mode) {
|
7941 |
+
height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
|
7942 |
+
return lineAtHeight(this.doc, height + this.display.viewOffset)
|
7943 |
+
},
|
7944 |
+
heightAtLine: function(line, mode, includeWidgets) {
|
7945 |
+
var end = false, lineObj;
|
7946 |
+
if (typeof line == "number") {
|
7947 |
+
var last = this.doc.first + this.doc.size - 1;
|
7948 |
+
if (line < this.doc.first) { line = this.doc.first; }
|
7949 |
+
else if (line > last) { line = last; end = true; }
|
7950 |
+
lineObj = getLine(this.doc, line);
|
7951 |
+
} else {
|
7952 |
+
lineObj = line;
|
7953 |
+
}
|
7954 |
+
return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
|
7955 |
+
(end ? this.doc.height - heightAtLine(lineObj) : 0)
|
7956 |
+
},
|
7957 |
+
|
7958 |
+
defaultTextHeight: function() { return textHeight(this.display) },
|
7959 |
+
defaultCharWidth: function() { return charWidth(this.display) },
|
7960 |
+
|
7961 |
+
getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
|
7962 |
+
|
7963 |
+
addWidget: function(pos, node, scroll, vert, horiz) {
|
7964 |
+
var display = this.display;
|
7965 |
+
pos = cursorCoords(this, clipPos(this.doc, pos));
|
7966 |
+
var top = pos.bottom, left = pos.left;
|
7967 |
+
node.style.position = "absolute";
|
7968 |
+
node.setAttribute("cm-ignore-events", "true");
|
7969 |
+
this.display.input.setUneditable(node);
|
7970 |
+
display.sizer.appendChild(node);
|
7971 |
+
if (vert == "over") {
|
7972 |
+
top = pos.top;
|
7973 |
+
} else if (vert == "above" || vert == "near") {
|
7974 |
+
var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
|
7975 |
+
hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
|
7976 |
+
// Default to positioning above (if specified and possible); otherwise default to positioning below
|
7977 |
+
if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
|
7978 |
+
{ top = pos.top - node.offsetHeight; }
|
7979 |
+
else if (pos.bottom + node.offsetHeight <= vspace)
|
7980 |
+
{ top = pos.bottom; }
|
7981 |
+
if (left + node.offsetWidth > hspace)
|
7982 |
+
{ left = hspace - node.offsetWidth; }
|
7983 |
+
}
|
7984 |
+
node.style.top = top + "px";
|
7985 |
+
node.style.left = node.style.right = "";
|
7986 |
+
if (horiz == "right") {
|
7987 |
+
left = display.sizer.clientWidth - node.offsetWidth;
|
7988 |
+
node.style.right = "0px";
|
7989 |
+
} else {
|
7990 |
+
if (horiz == "left") { left = 0; }
|
7991 |
+
else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
|
7992 |
+
node.style.left = left + "px";
|
7993 |
+
}
|
7994 |
+
if (scroll)
|
7995 |
+
{ scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
|
7996 |
+
},
|
7997 |
+
|
7998 |
+
triggerOnKeyDown: methodOp(onKeyDown),
|
7999 |
+
triggerOnKeyPress: methodOp(onKeyPress),
|
8000 |
+
triggerOnKeyUp: onKeyUp,
|
8001 |
+
|
8002 |
+
execCommand: function(cmd) {
|
8003 |
+
if (commands.hasOwnProperty(cmd))
|
8004 |
+
{ return commands[cmd].call(null, this) }
|
8005 |
+
},
|
8006 |
+
|
8007 |
+
triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
|
8008 |
+
|
8009 |
+
findPosH: function(from, amount, unit, visually) {
|
8010 |
+
var this$1 = this;
|
8011 |
+
|
8012 |
+
var dir = 1;
|
8013 |
+
if (amount < 0) { dir = -1; amount = -amount; }
|
8014 |
+
var cur = clipPos(this.doc, from);
|
8015 |
+
for (var i = 0; i < amount; ++i) {
|
8016 |
+
cur = findPosH(this$1.doc, cur, dir, unit, visually);
|
8017 |
+
if (cur.hitSide) { break }
|
8018 |
+
}
|
8019 |
+
return cur
|
8020 |
+
},
|
8021 |
+
|
8022 |
+
moveH: methodOp(function(dir, unit) {
|
8023 |
+
var this$1 = this;
|
8024 |
+
|
8025 |
+
this.extendSelectionsBy(function (range$$1) {
|
8026 |
+
if (this$1.display.shift || this$1.doc.extend || range$$1.empty())
|
8027 |
+
{ return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }
|
8028 |
+
else
|
8029 |
+
{ return dir < 0 ? range$$1.from() : range$$1.to() }
|
8030 |
+
}, sel_move);
|
8031 |
+
}),
|
8032 |
+
|
8033 |
+
deleteH: methodOp(function(dir, unit) {
|
8034 |
+
var sel = this.doc.sel, doc = this.doc;
|
8035 |
+
if (sel.somethingSelected())
|
8036 |
+
{ doc.replaceSelection("", null, "+delete"); }
|
8037 |
+
else
|
8038 |
+
{ deleteNearSelection(this, function (range$$1) {
|
8039 |
+
var other = findPosH(doc, range$$1.head, dir, unit, false);
|
8040 |
+
return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}
|
8041 |
+
}); }
|
8042 |
+
}),
|
8043 |
+
|
8044 |
+
findPosV: function(from, amount, unit, goalColumn) {
|
8045 |
+
var this$1 = this;
|
8046 |
+
|
8047 |
+
var dir = 1, x = goalColumn;
|
8048 |
+
if (amount < 0) { dir = -1; amount = -amount; }
|
8049 |
+
var cur = clipPos(this.doc, from);
|
8050 |
+
for (var i = 0; i < amount; ++i) {
|
8051 |
+
var coords = cursorCoords(this$1, cur, "div");
|
8052 |
+
if (x == null) { x = coords.left; }
|
8053 |
+
else { coords.left = x; }
|
8054 |
+
cur = findPosV(this$1, coords, dir, unit);
|
8055 |
+
if (cur.hitSide) { break }
|
8056 |
+
}
|
8057 |
+
return cur
|
8058 |
+
},
|
8059 |
+
|
8060 |
+
moveV: methodOp(function(dir, unit) {
|
8061 |
+
var this$1 = this;
|
8062 |
+
|
8063 |
+
var doc = this.doc, goals = [];
|
8064 |
+
var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
|
8065 |
+
doc.extendSelectionsBy(function (range$$1) {
|
8066 |
+
if (collapse)
|
8067 |
+
{ return dir < 0 ? range$$1.from() : range$$1.to() }
|
8068 |
+
var headPos = cursorCoords(this$1, range$$1.head, "div");
|
8069 |
+
if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }
|
8070 |
+
goals.push(headPos.left);
|
8071 |
+
var pos = findPosV(this$1, headPos, dir, unit);
|
8072 |
+
if (unit == "page" && range$$1 == doc.sel.primary())
|
8073 |
+
{ addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top); }
|
8074 |
+
return pos
|
8075 |
+
}, sel_move);
|
8076 |
+
if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
|
8077 |
+
{ doc.sel.ranges[i].goalColumn = goals[i]; } }
|
8078 |
+
}),
|
8079 |
+
|
8080 |
+
// Find the word at the given position (as returned by coordsChar).
|
8081 |
+
findWordAt: function(pos) {
|
8082 |
+
var doc = this.doc, line = getLine(doc, pos.line).text;
|
8083 |
+
var start = pos.ch, end = pos.ch;
|
8084 |
+
if (line) {
|
8085 |
+
var helper = this.getHelper(pos, "wordChars");
|
8086 |
+
if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
|
8087 |
+
var startChar = line.charAt(start);
|
8088 |
+
var check = isWordChar(startChar, helper)
|
8089 |
+
? function (ch) { return isWordChar(ch, helper); }
|
8090 |
+
: /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
|
8091 |
+
: function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
|
8092 |
+
while (start > 0 && check(line.charAt(start - 1))) { --start; }
|
8093 |
+
while (end < line.length && check(line.charAt(end))) { ++end; }
|
8094 |
+
}
|
8095 |
+
return new Range(Pos(pos.line, start), Pos(pos.line, end))
|
8096 |
+
},
|
8097 |
+
|
8098 |
+
toggleOverwrite: function(value) {
|
8099 |
+
if (value != null && value == this.state.overwrite) { return }
|
8100 |
+
if (this.state.overwrite = !this.state.overwrite)
|
8101 |
+
{ addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
|
8102 |
+
else
|
8103 |
+
{ rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
|
8104 |
+
|
8105 |
+
signal(this, "overwriteToggle", this, this.state.overwrite);
|
8106 |
+
},
|
8107 |
+
hasFocus: function() { return this.display.input.getField() == activeElt() },
|
8108 |
+
isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
|
8109 |
+
|
8110 |
+
scrollTo: methodOp(function(x, y) {
|
8111 |
+
if (x != null || y != null) { resolveScrollToPos(this); }
|
8112 |
+
if (x != null) { this.curOp.scrollLeft = x; }
|
8113 |
+
if (y != null) { this.curOp.scrollTop = y; }
|
8114 |
+
}),
|
8115 |
+
getScrollInfo: function() {
|
8116 |
+
var scroller = this.display.scroller;
|
8117 |
+
return {left: scroller.scrollLeft, top: scroller.scrollTop,
|
8118 |
+
height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
|
8119 |
+
width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
|
8120 |
+
clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
|
8121 |
+
},
|
8122 |
+
|
8123 |
+
scrollIntoView: methodOp(function(range$$1, margin) {
|
8124 |
+
if (range$$1 == null) {
|
8125 |
+
range$$1 = {from: this.doc.sel.primary().head, to: null};
|
8126 |
+
if (margin == null) { margin = this.options.cursorScrollMargin; }
|
8127 |
+
} else if (typeof range$$1 == "number") {
|
8128 |
+
range$$1 = {from: Pos(range$$1, 0), to: null};
|
8129 |
+
} else if (range$$1.from == null) {
|
8130 |
+
range$$1 = {from: range$$1, to: null};
|
8131 |
+
}
|
8132 |
+
if (!range$$1.to) { range$$1.to = range$$1.from; }
|
8133 |
+
range$$1.margin = margin || 0;
|
8134 |
+
|
8135 |
+
if (range$$1.from.line != null) {
|
8136 |
+
resolveScrollToPos(this);
|
8137 |
+
this.curOp.scrollToPos = range$$1;
|
8138 |
+
} else {
|
8139 |
+
var sPos = calculateScrollPos(this, {
|
8140 |
+
left: Math.min(range$$1.from.left, range$$1.to.left),
|
8141 |
+
top: Math.min(range$$1.from.top, range$$1.to.top) - range$$1.margin,
|
8142 |
+
right: Math.max(range$$1.from.right, range$$1.to.right),
|
8143 |
+
bottom: Math.max(range$$1.from.bottom, range$$1.to.bottom) + range$$1.margin
|
8144 |
+
});
|
8145 |
+
this.scrollTo(sPos.scrollLeft, sPos.scrollTop);
|
8146 |
+
}
|
8147 |
+
}),
|
8148 |
+
|
8149 |
+
setSize: methodOp(function(width, height) {
|
8150 |
+
var this$1 = this;
|
8151 |
+
|
8152 |
+
var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
|
8153 |
+
if (width != null) { this.display.wrapper.style.width = interpret(width); }
|
8154 |
+
if (height != null) { this.display.wrapper.style.height = interpret(height); }
|
8155 |
+
if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
|
8156 |
+
var lineNo$$1 = this.display.viewFrom;
|
8157 |
+
this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {
|
8158 |
+
if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
|
8159 |
+
{ if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } }
|
8160 |
+
++lineNo$$1;
|
8161 |
+
});
|
8162 |
+
this.curOp.forceUpdate = true;
|
8163 |
+
signal(this, "refresh", this);
|
8164 |
+
}),
|
8165 |
+
|
8166 |
+
operation: function(f){return runInOp(this, f)},
|
8167 |
+
|
8168 |
+
refresh: methodOp(function() {
|
8169 |
+
var oldHeight = this.display.cachedTextHeight;
|
8170 |
+
regChange(this);
|
8171 |
+
this.curOp.forceUpdate = true;
|
8172 |
+
clearCaches(this);
|
8173 |
+
this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);
|
8174 |
+
updateGutterSpace(this);
|
8175 |
+
if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
|
8176 |
+
{ estimateLineHeights(this); }
|
8177 |
+
signal(this, "refresh", this);
|
8178 |
+
}),
|
8179 |
+
|
8180 |
+
swapDoc: methodOp(function(doc) {
|
8181 |
+
var old = this.doc;
|
8182 |
+
old.cm = null;
|
8183 |
+
attachDoc(this, doc);
|
8184 |
+
clearCaches(this);
|
8185 |
+
this.display.input.reset();
|
8186 |
+
this.scrollTo(doc.scrollLeft, doc.scrollTop);
|
8187 |
+
this.curOp.forceScroll = true;
|
8188 |
+
signalLater(this, "swapDoc", this, old);
|
8189 |
+
return old
|
8190 |
+
}),
|
8191 |
+
|
8192 |
+
getInputField: function(){return this.display.input.getField()},
|
8193 |
+
getWrapperElement: function(){return this.display.wrapper},
|
8194 |
+
getScrollerElement: function(){return this.display.scroller},
|
8195 |
+
getGutterElement: function(){return this.display.gutters}
|
8196 |
+
};
|
8197 |
+
eventMixin(CodeMirror);
|
8198 |
+
|
8199 |
+
CodeMirror.registerHelper = function(type, name, value) {
|
8200 |
+
if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
|
8201 |
+
helpers[type][name] = value;
|
8202 |
+
};
|
8203 |
+
CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
|
8204 |
+
CodeMirror.registerHelper(type, name, value);
|
8205 |
+
helpers[type]._global.push({pred: predicate, val: value});
|
8206 |
+
};
|
8207 |
+
};
|
8208 |
+
|
8209 |
+
// Used for horizontal relative motion. Dir is -1 or 1 (left or
|
8210 |
+
// right), unit can be "char", "column" (like char, but doesn't
|
8211 |
+
// cross line boundaries), "word" (across next word), or "group" (to
|
8212 |
+
// the start of next group of word or non-word-non-whitespace
|
8213 |
+
// chars). The visually param controls whether, in right-to-left
|
8214 |
+
// text, direction 1 means to move towards the next index in the
|
8215 |
+
// string, or towards the character to the right of the current
|
8216 |
+
// position. The resulting position will have a hitSide=true
|
8217 |
+
// property if it reached the end of the document.
|
8218 |
+
function findPosH(doc, pos, dir, unit, visually) {
|
8219 |
+
var oldPos = pos;
|
8220 |
+
var origDir = dir;
|
8221 |
+
var lineObj = getLine(doc, pos.line);
|
8222 |
+
function findNextLine() {
|
8223 |
+
var l = pos.line + dir;
|
8224 |
+
if (l < doc.first || l >= doc.first + doc.size) { return false }
|
8225 |
+
pos = new Pos(l, pos.ch, pos.sticky);
|
8226 |
+
return lineObj = getLine(doc, l)
|
8227 |
+
}
|
8228 |
+
function moveOnce(boundToLine) {
|
8229 |
+
var next;
|
8230 |
+
if (visually) {
|
8231 |
+
next = moveVisually(doc.cm, lineObj, pos, dir);
|
8232 |
+
} else {
|
8233 |
+
next = moveLogically(lineObj, pos, dir);
|
8234 |
+
}
|
8235 |
+
if (next == null) {
|
8236 |
+
if (!boundToLine && findNextLine())
|
8237 |
+
{ pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }
|
8238 |
+
else
|
8239 |
+
{ return false }
|
8240 |
+
} else {
|
8241 |
+
pos = next;
|
8242 |
+
}
|
8243 |
+
return true
|
8244 |
+
}
|
8245 |
+
|
8246 |
+
if (unit == "char") {
|
8247 |
+
moveOnce();
|
8248 |
+
} else if (unit == "column") {
|
8249 |
+
moveOnce(true);
|
8250 |
+
} else if (unit == "word" || unit == "group") {
|
8251 |
+
var sawType = null, group = unit == "group";
|
8252 |
+
var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
|
8253 |
+
for (var first = true;; first = false) {
|
8254 |
+
if (dir < 0 && !moveOnce(!first)) { break }
|
8255 |
+
var cur = lineObj.text.charAt(pos.ch) || "\n";
|
8256 |
+
var type = isWordChar(cur, helper) ? "w"
|
8257 |
+
: group && cur == "\n" ? "n"
|
8258 |
+
: !group || /\s/.test(cur) ? null
|
8259 |
+
: "p";
|
8260 |
+
if (group && !first && !type) { type = "s"; }
|
8261 |
+
if (sawType && sawType != type) {
|
8262 |
+
if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
|
8263 |
+
break
|
8264 |
+
}
|
8265 |
+
|
8266 |
+
if (type) { sawType = type; }
|
8267 |
+
if (dir > 0 && !moveOnce(!first)) { break }
|
8268 |
+
}
|
8269 |
+
}
|
8270 |
+
var result = skipAtomic(doc, pos, oldPos, origDir, true);
|
8271 |
+
if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
|
8272 |
+
return result
|
8273 |
+
}
|
8274 |
+
|
8275 |
+
// For relative vertical movement. Dir may be -1 or 1. Unit can be
|
8276 |
+
// "page" or "line". The resulting position will have a hitSide=true
|
8277 |
+
// property if it reached the end of the document.
|
8278 |
+
function findPosV(cm, pos, dir, unit) {
|
8279 |
+
var doc = cm.doc, x = pos.left, y;
|
8280 |
+
if (unit == "page") {
|
8281 |
+
var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
|
8282 |
+
var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
|
8283 |
+
y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
|
8284 |
+
|
8285 |
+
} else if (unit == "line") {
|
8286 |
+
y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
|
8287 |
+
}
|
8288 |
+
var target;
|
8289 |
+
for (;;) {
|
8290 |
+
target = coordsChar(cm, x, y);
|
8291 |
+
if (!target.outside) { break }
|
8292 |
+
if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
|
8293 |
+
y += dir * 5;
|
8294 |
+
}
|
8295 |
+
return target
|
8296 |
+
}
|
8297 |
+
|
8298 |
+
// CONTENTEDITABLE INPUT STYLE
|
8299 |
+
|
8300 |
+
var ContentEditableInput = function(cm) {
|
8301 |
+
this.cm = cm;
|
8302 |
+
this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
|
8303 |
+
this.polling = new Delayed();
|
8304 |
+
this.composing = null;
|
8305 |
+
this.gracePeriod = false;
|
8306 |
+
this.readDOMTimeout = null;
|
8307 |
+
};
|
8308 |
+
|
8309 |
+
ContentEditableInput.prototype.init = function (display) {
|
8310 |
+
var this$1 = this;
|
8311 |
+
|
8312 |
+
var input = this, cm = input.cm;
|
8313 |
+
var div = input.div = display.lineDiv;
|
8314 |
+
disableBrowserMagic(div, cm.options.spellcheck);
|
8315 |
+
|
8316 |
+
on(div, "paste", function (e) {
|
8317 |
+
if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
|
8318 |
+
// IE doesn't fire input events, so we schedule a read for the pasted content in this way
|
8319 |
+
if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
|
8320 |
+
});
|
8321 |
+
|
8322 |
+
on(div, "compositionstart", function (e) {
|
8323 |
+
this$1.composing = {data: e.data, done: false};
|
8324 |
+
});
|
8325 |
+
on(div, "compositionupdate", function (e) {
|
8326 |
+
if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
|
8327 |
+
});
|
8328 |
+
on(div, "compositionend", function (e) {
|
8329 |
+
if (this$1.composing) {
|
8330 |
+
if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
|
8331 |
+
this$1.composing.done = true;
|
8332 |
+
}
|
8333 |
+
});
|
8334 |
+
|
8335 |
+
on(div, "touchstart", function () { return input.forceCompositionEnd(); });
|
8336 |
+
|
8337 |
+
on(div, "input", function () {
|
8338 |
+
if (!this$1.composing) { this$1.readFromDOMSoon(); }
|
8339 |
+
});
|
8340 |
+
|
8341 |
+
function onCopyCut(e) {
|
8342 |
+
if (signalDOMEvent(cm, e)) { return }
|
8343 |
+
if (cm.somethingSelected()) {
|
8344 |
+
setLastCopied({lineWise: false, text: cm.getSelections()});
|
8345 |
+
if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
|
8346 |
+
} else if (!cm.options.lineWiseCopyCut) {
|
8347 |
+
return
|
8348 |
+
} else {
|
8349 |
+
var ranges = copyableRanges(cm);
|
8350 |
+
setLastCopied({lineWise: true, text: ranges.text});
|
8351 |
+
if (e.type == "cut") {
|
8352 |
+
cm.operation(function () {
|
8353 |
+
cm.setSelections(ranges.ranges, 0, sel_dontScroll);
|
8354 |
+
cm.replaceSelection("", null, "cut");
|
8355 |
+
});
|
8356 |
+
}
|
8357 |
+
}
|
8358 |
+
if (e.clipboardData) {
|
8359 |
+
e.clipboardData.clearData();
|
8360 |
+
var content = lastCopied.text.join("\n");
|
8361 |
+
// iOS exposes the clipboard API, but seems to discard content inserted into it
|
8362 |
+
e.clipboardData.setData("Text", content);
|
8363 |
+
if (e.clipboardData.getData("Text") == content) {
|
8364 |
+
e.preventDefault();
|
8365 |
+
return
|
8366 |
+
}
|
8367 |
+
}
|
8368 |
+
// Old-fashioned briefly-focus-a-textarea hack
|
8369 |
+
var kludge = hiddenTextarea(), te = kludge.firstChild;
|
8370 |
+
cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
|
8371 |
+
te.value = lastCopied.text.join("\n");
|
8372 |
+
var hadFocus = document.activeElement;
|
8373 |
+
selectInput(te);
|
8374 |
+
setTimeout(function () {
|
8375 |
+
cm.display.lineSpace.removeChild(kludge);
|
8376 |
+
hadFocus.focus();
|
8377 |
+
if (hadFocus == div) { input.showPrimarySelection(); }
|
8378 |
+
}, 50);
|
8379 |
+
}
|
8380 |
+
on(div, "copy", onCopyCut);
|
8381 |
+
on(div, "cut", onCopyCut);
|
8382 |
+
};
|
8383 |
+
|
8384 |
+
ContentEditableInput.prototype.prepareSelection = function () {
|
8385 |
+
var result = prepareSelection(this.cm, false);
|
8386 |
+
result.focus = this.cm.state.focused;
|
8387 |
+
return result
|
8388 |
+
};
|
8389 |
+
|
8390 |
+
ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
|
8391 |
+
if (!info || !this.cm.display.view.length) { return }
|
8392 |
+
if (info.focus || takeFocus) { this.showPrimarySelection(); }
|
8393 |
+
this.showMultipleSelections(info);
|
8394 |
+
};
|
8395 |
+
|
8396 |
+
ContentEditableInput.prototype.showPrimarySelection = function () {
|
8397 |
+
var sel = window.getSelection(), prim = this.cm.doc.sel.primary();
|
8398 |
+
var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);
|
8399 |
+
var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);
|
8400 |
+
if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
|
8401 |
+
cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&
|
8402 |
+
cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)
|
8403 |
+
{ return }
|
8404 |
+
|
8405 |
+
var start = posToDOM(this.cm, prim.from());
|
8406 |
+
var end = posToDOM(this.cm, prim.to());
|
8407 |
+
if (!start && !end) {
|
8408 |
+
sel.removeAllRanges();
|
8409 |
+
return
|
8410 |
+
}
|
8411 |
+
|
8412 |
+
var view = this.cm.display.view;
|
8413 |
+
var old = sel.rangeCount && sel.getRangeAt(0);
|
8414 |
+
if (!start) {
|
8415 |
+
start = {node: view[0].measure.map[2], offset: 0};
|
8416 |
+
} else if (!end) { // FIXME dangerously hacky
|
8417 |
+
var measure = view[view.length - 1].measure;
|
8418 |
+
var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
|
8419 |
+
end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};
|
8420 |
+
}
|
8421 |
+
|
8422 |
+
var rng;
|
8423 |
+
try { rng = range(start.node, start.offset, end.offset, end.node); }
|
8424 |
+
catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
|
8425 |
+
if (rng) {
|
8426 |
+
if (!gecko && this.cm.state.focused) {
|
8427 |
+
sel.collapse(start.node, start.offset);
|
8428 |
+
if (!rng.collapsed) {
|
8429 |
+
sel.removeAllRanges();
|
8430 |
+
sel.addRange(rng);
|
8431 |
+
}
|
8432 |
+
} else {
|
8433 |
+
sel.removeAllRanges();
|
8434 |
+
sel.addRange(rng);
|
8435 |
+
}
|
8436 |
+
if (old && sel.anchorNode == null) { sel.addRange(old); }
|
8437 |
+
else if (gecko) { this.startGracePeriod(); }
|
8438 |
+
}
|
8439 |
+
this.rememberSelection();
|
8440 |
+
};
|
8441 |
+
|
8442 |
+
ContentEditableInput.prototype.startGracePeriod = function () {
|
8443 |
+
var this$1 = this;
|
8444 |
+
|
8445 |
+
clearTimeout(this.gracePeriod);
|
8446 |
+
this.gracePeriod = setTimeout(function () {
|
8447 |
+
this$1.gracePeriod = false;
|
8448 |
+
if (this$1.selectionChanged())
|
8449 |
+
{ this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
|
8450 |
+
}, 20);
|
8451 |
+
};
|
8452 |
+
|
8453 |
+
ContentEditableInput.prototype.showMultipleSelections = function (info) {
|
8454 |
+
removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
|
8455 |
+
removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
|
8456 |
+
};
|
8457 |
+
|
8458 |
+
ContentEditableInput.prototype.rememberSelection = function () {
|
8459 |
+
var sel = window.getSelection();
|
8460 |
+
this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
|
8461 |
+
this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
|
8462 |
+
};
|
8463 |
+
|
8464 |
+
ContentEditableInput.prototype.selectionInEditor = function () {
|
8465 |
+
var sel = window.getSelection();
|
8466 |
+
if (!sel.rangeCount) { return false }
|
8467 |
+
var node = sel.getRangeAt(0).commonAncestorContainer;
|
8468 |
+
return contains(this.div, node)
|
8469 |
+
};
|
8470 |
+
|
8471 |
+
ContentEditableInput.prototype.focus = function () {
|
8472 |
+
if (this.cm.options.readOnly != "nocursor") {
|
8473 |
+
if (!this.selectionInEditor())
|
8474 |
+
{ this.showSelection(this.prepareSelection(), true); }
|
8475 |
+
this.div.focus();
|
8476 |
+
}
|
8477 |
+
};
|
8478 |
+
ContentEditableInput.prototype.blur = function () { this.div.blur(); };
|
8479 |
+
ContentEditableInput.prototype.getField = function () { return this.div };
|
8480 |
+
|
8481 |
+
ContentEditableInput.prototype.supportsTouch = function () { return true };
|
8482 |
+
|
8483 |
+
ContentEditableInput.prototype.receivedFocus = function () {
|
8484 |
+
var input = this;
|
8485 |
+
if (this.selectionInEditor())
|
8486 |
+
{ this.pollSelection(); }
|
8487 |
+
else
|
8488 |
+
{ runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
|
8489 |
+
|
8490 |
+
function poll() {
|
8491 |
+
if (input.cm.state.focused) {
|
8492 |
+
input.pollSelection();
|
8493 |
+
input.polling.set(input.cm.options.pollInterval, poll);
|
8494 |
+
}
|
8495 |
+
}
|
8496 |
+
this.polling.set(this.cm.options.pollInterval, poll);
|
8497 |
+
};
|
8498 |
+
|
8499 |
+
ContentEditableInput.prototype.selectionChanged = function () {
|
8500 |
+
var sel = window.getSelection();
|
8501 |
+
return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
|
8502 |
+
sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
|
8503 |
+
};
|
8504 |
+
|
8505 |
+
ContentEditableInput.prototype.pollSelection = function () {
|
8506 |
+
if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
|
8507 |
+
var sel = window.getSelection(), cm = this.cm;
|
8508 |
+
// On Android Chrome (version 56, at least), backspacing into an
|
8509 |
+
// uneditable block element will put the cursor in that element,
|
8510 |
+
// and then, because it's not editable, hide the virtual keyboard.
|
8511 |
+
// Because Android doesn't allow us to actually detect backspace
|
8512 |
+
// presses in a sane way, this code checks for when that happens
|
8513 |
+
// and simulates a backspace press in this case.
|
8514 |
+
if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {
|
8515 |
+
this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
|
8516 |
+
this.blur();
|
8517 |
+
this.focus();
|
8518 |
+
return
|
8519 |
+
}
|
8520 |
+
if (this.composing) { return }
|
8521 |
+
this.rememberSelection();
|
8522 |
+
var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
|
8523 |
+
var head = domToPos(cm, sel.focusNode, sel.focusOffset);
|
8524 |
+
if (anchor && head) { runInOp(cm, function () {
|
8525 |
+
setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
|
8526 |
+
if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
|
8527 |
+
}); }
|
8528 |
+
};
|
8529 |
+
|
8530 |
+
ContentEditableInput.prototype.pollContent = function () {
|
8531 |
+
if (this.readDOMTimeout != null) {
|
8532 |
+
clearTimeout(this.readDOMTimeout);
|
8533 |
+
this.readDOMTimeout = null;
|
8534 |
+
}
|
8535 |
+
|
8536 |
+
var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
|
8537 |
+
var from = sel.from(), to = sel.to();
|
8538 |
+
if (from.ch == 0 && from.line > cm.firstLine())
|
8539 |
+
{ from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
|
8540 |
+
if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
|
8541 |
+
{ to = Pos(to.line + 1, 0); }
|
8542 |
+
if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
|
8543 |
+
|
8544 |
+
var fromIndex, fromLine, fromNode;
|
8545 |
+
if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
|
8546 |
+
fromLine = lineNo(display.view[0].line);
|
8547 |
+
fromNode = display.view[0].node;
|
8548 |
+
} else {
|
8549 |
+
fromLine = lineNo(display.view[fromIndex].line);
|
8550 |
+
fromNode = display.view[fromIndex - 1].node.nextSibling;
|
8551 |
+
}
|
8552 |
+
var toIndex = findViewIndex(cm, to.line);
|
8553 |
+
var toLine, toNode;
|
8554 |
+
if (toIndex == display.view.length - 1) {
|
8555 |
+
toLine = display.viewTo - 1;
|
8556 |
+
toNode = display.lineDiv.lastChild;
|
8557 |
+
} else {
|
8558 |
+
toLine = lineNo(display.view[toIndex + 1].line) - 1;
|
8559 |
+
toNode = display.view[toIndex + 1].node.previousSibling;
|
8560 |
+
}
|
8561 |
+
|
8562 |
+
if (!fromNode) { return false }
|
8563 |
+
var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
|
8564 |
+
var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
|
8565 |
+
while (newText.length > 1 && oldText.length > 1) {
|
8566 |
+
if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
|
8567 |
+
else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
|
8568 |
+
else { break }
|
8569 |
+
}
|
8570 |
+
|
8571 |
+
var cutFront = 0, cutEnd = 0;
|
8572 |
+
var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
|
8573 |
+
while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
|
8574 |
+
{ ++cutFront; }
|
8575 |
+
var newBot = lst(newText), oldBot = lst(oldText);
|
8576 |
+
var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
|
8577 |
+
oldBot.length - (oldText.length == 1 ? cutFront : 0));
|
8578 |
+
while (cutEnd < maxCutEnd &&
|
8579 |
+
newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
|
8580 |
+
{ ++cutEnd; }
|
8581 |
+
// Try to move start of change to start of selection if ambiguous
|
8582 |
+
if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
|
8583 |
+
while (cutFront && cutFront > from.ch &&
|
8584 |
+
newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
|
8585 |
+
cutFront--;
|
8586 |
+
cutEnd++;
|
8587 |
+
}
|
8588 |
+
}
|
8589 |
+
|
8590 |
+
newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
|
8591 |
+
newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
|
8592 |
+
|
8593 |
+
var chFrom = Pos(fromLine, cutFront);
|
8594 |
+
var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
|
8595 |
+
if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
|
8596 |
+
replaceRange(cm.doc, newText, chFrom, chTo, "+input");
|
8597 |
+
return true
|
8598 |
+
}
|
8599 |
+
};
|
8600 |
+
|
8601 |
+
ContentEditableInput.prototype.ensurePolled = function () {
|
8602 |
+
this.forceCompositionEnd();
|
8603 |
+
};
|
8604 |
+
ContentEditableInput.prototype.reset = function () {
|
8605 |
+
this.forceCompositionEnd();
|
8606 |
+
};
|
8607 |
+
ContentEditableInput.prototype.forceCompositionEnd = function () {
|
8608 |
+
if (!this.composing) { return }
|
8609 |
+
clearTimeout(this.readDOMTimeout);
|
8610 |
+
this.composing = null;
|
8611 |
+
this.updateFromDOM();
|
8612 |
+
this.div.blur();
|
8613 |
+
this.div.focus();
|
8614 |
+
};
|
8615 |
+
ContentEditableInput.prototype.readFromDOMSoon = function () {
|
8616 |
+
var this$1 = this;
|
8617 |
+
|
8618 |
+
if (this.readDOMTimeout != null) { return }
|
8619 |
+
this.readDOMTimeout = setTimeout(function () {
|
8620 |
+
this$1.readDOMTimeout = null;
|
8621 |
+
if (this$1.composing) {
|
8622 |
+
if (this$1.composing.done) { this$1.composing = null; }
|
8623 |
+
else { return }
|
8624 |
+
}
|
8625 |
+
this$1.updateFromDOM();
|
8626 |
+
}, 80);
|
8627 |
+
};
|
8628 |
+
|
8629 |
+
ContentEditableInput.prototype.updateFromDOM = function () {
|
8630 |
+
var this$1 = this;
|
8631 |
+
|
8632 |
+
if (this.cm.isReadOnly() || !this.pollContent())
|
8633 |
+
{ runInOp(this.cm, function () { return regChange(this$1.cm); }); }
|
8634 |
+
};
|
8635 |
+
|
8636 |
+
ContentEditableInput.prototype.setUneditable = function (node) {
|
8637 |
+
node.contentEditable = "false";
|
8638 |
+
};
|
8639 |
+
|
8640 |
+
ContentEditableInput.prototype.onKeyPress = function (e) {
|
8641 |
+
if (e.charCode == 0) { return }
|
8642 |
+
e.preventDefault();
|
8643 |
+
if (!this.cm.isReadOnly())
|
8644 |
+
{ operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
|
8645 |
+
};
|
8646 |
+
|
8647 |
+
ContentEditableInput.prototype.readOnlyChanged = function (val) {
|
8648 |
+
this.div.contentEditable = String(val != "nocursor");
|
8649 |
+
};
|
8650 |
+
|
8651 |
+
ContentEditableInput.prototype.onContextMenu = function () {};
|
8652 |
+
ContentEditableInput.prototype.resetPosition = function () {};
|
8653 |
+
|
8654 |
+
ContentEditableInput.prototype.needsContentAttribute = true;
|
8655 |
+
|
8656 |
+
function posToDOM(cm, pos) {
|
8657 |
+
var view = findViewForLine(cm, pos.line);
|
8658 |
+
if (!view || view.hidden) { return null }
|
8659 |
+
var line = getLine(cm.doc, pos.line);
|
8660 |
+
var info = mapFromLineView(view, line, pos.line);
|
8661 |
+
|
8662 |
+
var order = getOrder(line, cm.doc.direction), side = "left";
|
8663 |
+
if (order) {
|
8664 |
+
var partPos = getBidiPartAt(order, pos.ch);
|
8665 |
+
side = partPos % 2 ? "right" : "left";
|
8666 |
+
}
|
8667 |
+
var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
|
8668 |
+
result.offset = result.collapse == "right" ? result.end : result.start;
|
8669 |
+
return result
|
8670 |
+
}
|
8671 |
+
|
8672 |
+
function isInGutter(node) {
|
8673 |
+
for (var scan = node; scan; scan = scan.parentNode)
|
8674 |
+
{ if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
|
8675 |
+
return false
|
8676 |
+
}
|
8677 |
+
|
8678 |
+
function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
|
8679 |
+
|
8680 |
+
function domTextBetween(cm, from, to, fromLine, toLine) {
|
8681 |
+
var text = "", closing = false, lineSep = cm.doc.lineSeparator();
|
8682 |
+
function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
|
8683 |
+
function close() {
|
8684 |
+
if (closing) {
|
8685 |
+
text += lineSep;
|
8686 |
+
closing = false;
|
8687 |
+
}
|
8688 |
+
}
|
8689 |
+
function addText(str) {
|
8690 |
+
if (str) {
|
8691 |
+
close();
|
8692 |
+
text += str;
|
8693 |
+
}
|
8694 |
+
}
|
8695 |
+
function walk(node) {
|
8696 |
+
if (node.nodeType == 1) {
|
8697 |
+
var cmText = node.getAttribute("cm-text");
|
8698 |
+
if (cmText != null) {
|
8699 |
+
addText(cmText || node.textContent.replace(/\u200b/g, ""));
|
8700 |
+
return
|
8701 |
+
}
|
8702 |
+
var markerID = node.getAttribute("cm-marker"), range$$1;
|
8703 |
+
if (markerID) {
|
8704 |
+
var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
|
8705 |
+
if (found.length && (range$$1 = found[0].find()))
|
8706 |
+
{ addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }
|
8707 |
+
return
|
8708 |
+
}
|
8709 |
+
if (node.getAttribute("contenteditable") == "false") { return }
|
8710 |
+
var isBlock = /^(pre|div|p)$/i.test(node.nodeName);
|
8711 |
+
if (isBlock) { close(); }
|
8712 |
+
for (var i = 0; i < node.childNodes.length; i++)
|
8713 |
+
{ walk(node.childNodes[i]); }
|
8714 |
+
if (isBlock) { closing = true; }
|
8715 |
+
} else if (node.nodeType == 3) {
|
8716 |
+
addText(node.nodeValue);
|
8717 |
+
}
|
8718 |
+
}
|
8719 |
+
for (;;) {
|
8720 |
+
walk(from);
|
8721 |
+
if (from == to) { break }
|
8722 |
+
from = from.nextSibling;
|
8723 |
+
}
|
8724 |
+
return text
|
8725 |
+
}
|
8726 |
+
|
8727 |
+
function domToPos(cm, node, offset) {
|
8728 |
+
var lineNode;
|
8729 |
+
if (node == cm.display.lineDiv) {
|
8730 |
+
lineNode = cm.display.lineDiv.childNodes[offset];
|
8731 |
+
if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
|
8732 |
+
node = null; offset = 0;
|
8733 |
+
} else {
|
8734 |
+
for (lineNode = node;; lineNode = lineNode.parentNode) {
|
8735 |
+
if (!lineNode || lineNode == cm.display.lineDiv) { return null }
|
8736 |
+
if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
|
8737 |
+
}
|
8738 |
+
}
|
8739 |
+
for (var i = 0; i < cm.display.view.length; i++) {
|
8740 |
+
var lineView = cm.display.view[i];
|
8741 |
+
if (lineView.node == lineNode)
|
8742 |
+
{ return locateNodeInLineView(lineView, node, offset) }
|
8743 |
+
}
|
8744 |
+
}
|
8745 |
+
|
8746 |
+
function locateNodeInLineView(lineView, node, offset) {
|
8747 |
+
var wrapper = lineView.text.firstChild, bad = false;
|
8748 |
+
if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
|
8749 |
+
if (node == wrapper) {
|
8750 |
+
bad = true;
|
8751 |
+
node = wrapper.childNodes[offset];
|
8752 |
+
offset = 0;
|
8753 |
+
if (!node) {
|
8754 |
+
var line = lineView.rest ? lst(lineView.rest) : lineView.line;
|
8755 |
+
return badPos(Pos(lineNo(line), line.text.length), bad)
|
8756 |
+
}
|
8757 |
+
}
|
8758 |
+
|
8759 |
+
var textNode = node.nodeType == 3 ? node : null, topNode = node;
|
8760 |
+
if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
|
8761 |
+
textNode = node.firstChild;
|
8762 |
+
if (offset) { offset = textNode.nodeValue.length; }
|
8763 |
+
}
|
8764 |
+
while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
|
8765 |
+
var measure = lineView.measure, maps = measure.maps;
|
8766 |
+
|
8767 |
+
function find(textNode, topNode, offset) {
|
8768 |
+
for (var i = -1; i < (maps ? maps.length : 0); i++) {
|
8769 |
+
var map$$1 = i < 0 ? measure.map : maps[i];
|
8770 |
+
for (var j = 0; j < map$$1.length; j += 3) {
|
8771 |
+
var curNode = map$$1[j + 2];
|
8772 |
+
if (curNode == textNode || curNode == topNode) {
|
8773 |
+
var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
|
8774 |
+
var ch = map$$1[j] + offset;
|
8775 |
+
if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }
|
8776 |
+
return Pos(line, ch)
|
8777 |
+
}
|
8778 |
+
}
|
8779 |
+
}
|
8780 |
+
}
|
8781 |
+
var found = find(textNode, topNode, offset);
|
8782 |
+
if (found) { return badPos(found, bad) }
|
8783 |
+
|
8784 |
+
// FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
|
8785 |
+
for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
|
8786 |
+
found = find(after, after.firstChild, 0);
|
8787 |
+
if (found)
|
8788 |
+
{ return badPos(Pos(found.line, found.ch - dist), bad) }
|
8789 |
+
else
|
8790 |
+
{ dist += after.textContent.length; }
|
8791 |
+
}
|
8792 |
+
for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
|
8793 |
+
found = find(before, before.firstChild, -1);
|
8794 |
+
if (found)
|
8795 |
+
{ return badPos(Pos(found.line, found.ch + dist$1), bad) }
|
8796 |
+
else
|
8797 |
+
{ dist$1 += before.textContent.length; }
|
8798 |
+
}
|
8799 |
+
}
|
8800 |
+
|
8801 |
+
// TEXTAREA INPUT STYLE
|
8802 |
+
|
8803 |
+
var TextareaInput = function(cm) {
|
8804 |
+
this.cm = cm;
|
8805 |
+
// See input.poll and input.reset
|
8806 |
+
this.prevInput = "";
|
8807 |
+
|
8808 |
+
// Flag that indicates whether we expect input to appear real soon
|
8809 |
+
// now (after some event like 'keypress' or 'input') and are
|
8810 |
+
// polling intensively.
|
8811 |
+
this.pollingFast = false;
|
8812 |
+
// Self-resetting timeout for the poller
|
8813 |
+
this.polling = new Delayed();
|
8814 |
+
// Tracks when input.reset has punted to just putting a short
|
8815 |
+
// string into the textarea instead of the full selection.
|
8816 |
+
this.inaccurateSelection = false;
|
8817 |
+
// Used to work around IE issue with selection being forgotten when focus moves away from textarea
|
8818 |
+
this.hasSelection = false;
|
8819 |
+
this.composing = null;
|
8820 |
+
};
|
8821 |
+
|
8822 |
+
TextareaInput.prototype.init = function (display) {
|
8823 |
+
var this$1 = this;
|
8824 |
+
|
8825 |
+
var input = this, cm = this.cm;
|
8826 |
+
|
8827 |
+
// Wraps and hides input textarea
|
8828 |
+
var div = this.wrapper = hiddenTextarea();
|
8829 |
+
// The semihidden textarea that is focused when the editor is
|
8830 |
+
// focused, and receives input.
|
8831 |
+
var te = this.textarea = div.firstChild;
|
8832 |
+
display.wrapper.insertBefore(div, display.wrapper.firstChild);
|
8833 |
+
|
8834 |
+
// Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
|
8835 |
+
if (ios) { te.style.width = "0px"; }
|
8836 |
+
|
8837 |
+
on(te, "input", function () {
|
8838 |
+
if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
|
8839 |
+
input.poll();
|
8840 |
+
});
|
8841 |
+
|
8842 |
+
on(te, "paste", function (e) {
|
8843 |
+
if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
|
8844 |
+
|
8845 |
+
cm.state.pasteIncoming = true;
|
8846 |
+
input.fastPoll();
|
8847 |
+
});
|
8848 |
+
|
8849 |
+
function prepareCopyCut(e) {
|
8850 |
+
if (signalDOMEvent(cm, e)) { return }
|
8851 |
+
if (cm.somethingSelected()) {
|
8852 |
+
setLastCopied({lineWise: false, text: cm.getSelections()});
|
8853 |
+
if (input.inaccurateSelection) {
|
8854 |
+
input.prevInput = "";
|
8855 |
+
input.inaccurateSelection = false;
|
8856 |
+
te.value = lastCopied.text.join("\n");
|
8857 |
+
selectInput(te);
|
8858 |
+
}
|
8859 |
+
} else if (!cm.options.lineWiseCopyCut) {
|
8860 |
+
return
|
8861 |
+
} else {
|
8862 |
+
var ranges = copyableRanges(cm);
|
8863 |
+
setLastCopied({lineWise: true, text: ranges.text});
|
8864 |
+
if (e.type == "cut") {
|
8865 |
+
cm.setSelections(ranges.ranges, null, sel_dontScroll);
|
8866 |
+
} else {
|
8867 |
+
input.prevInput = "";
|
8868 |
+
te.value = ranges.text.join("\n");
|
8869 |
+
selectInput(te);
|
8870 |
+
}
|
8871 |
+
}
|
8872 |
+
if (e.type == "cut") { cm.state.cutIncoming = true; }
|
8873 |
+
}
|
8874 |
+
on(te, "cut", prepareCopyCut);
|
8875 |
+
on(te, "copy", prepareCopyCut);
|
8876 |
+
|
8877 |
+
on(display.scroller, "paste", function (e) {
|
8878 |
+
if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
|
8879 |
+
cm.state.pasteIncoming = true;
|
8880 |
+
input.focus();
|
8881 |
+
});
|
8882 |
+
|
8883 |
+
// Prevent normal selection in the editor (we handle our own)
|
8884 |
+
on(display.lineSpace, "selectstart", function (e) {
|
8885 |
+
if (!eventInWidget(display, e)) { e_preventDefault(e); }
|
8886 |
+
});
|
8887 |
+
|
8888 |
+
on(te, "compositionstart", function () {
|
8889 |
+
var start = cm.getCursor("from");
|
8890 |
+
if (input.composing) { input.composing.range.clear(); }
|
8891 |
+
input.composing = {
|
8892 |
+
start: start,
|
8893 |
+
range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
|
8894 |
+
};
|
8895 |
+
});
|
8896 |
+
on(te, "compositionend", function () {
|
8897 |
+
if (input.composing) {
|
8898 |
+
input.poll();
|
8899 |
+
input.composing.range.clear();
|
8900 |
+
input.composing = null;
|
8901 |
+
}
|
8902 |
+
});
|
8903 |
+
};
|
8904 |
+
|
8905 |
+
TextareaInput.prototype.prepareSelection = function () {
|
8906 |
+
// Redraw the selection and/or cursor
|
8907 |
+
var cm = this.cm, display = cm.display, doc = cm.doc;
|
8908 |
+
var result = prepareSelection(cm);
|
8909 |
+
|
8910 |
+
// Move the hidden textarea near the cursor to prevent scrolling artifacts
|
8911 |
+
if (cm.options.moveInputWithCursor) {
|
8912 |
+
var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
|
8913 |
+
var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
|
8914 |
+
result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
|
8915 |
+
headPos.top + lineOff.top - wrapOff.top));
|
8916 |
+
result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
|
8917 |
+
headPos.left + lineOff.left - wrapOff.left));
|
8918 |
+
}
|
8919 |
+
|
8920 |
+
return result
|
8921 |
+
};
|
8922 |
+
|
8923 |
+
TextareaInput.prototype.showSelection = function (drawn) {
|
8924 |
+
var cm = this.cm, display = cm.display;
|
8925 |
+
removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
|
8926 |
+
removeChildrenAndAdd(display.selectionDiv, drawn.selection);
|
8927 |
+
if (drawn.teTop != null) {
|
8928 |
+
this.wrapper.style.top = drawn.teTop + "px";
|
8929 |
+
this.wrapper.style.left = drawn.teLeft + "px";
|
8930 |
+
}
|
8931 |
+
};
|
8932 |
+
|
8933 |
+
// Reset the input to correspond to the selection (or to be empty,
|
8934 |
+
// when not typing and nothing is selected)
|
8935 |
+
TextareaInput.prototype.reset = function (typing) {
|
8936 |
+
if (this.contextMenuPending) { return }
|
8937 |
+
var minimal, selected, cm = this.cm, doc = cm.doc;
|
8938 |
+
if (cm.somethingSelected()) {
|
8939 |
+
this.prevInput = "";
|
8940 |
+
var range$$1 = doc.sel.primary();
|
8941 |
+
minimal = hasCopyEvent &&
|
8942 |
+
(range$$1.to().line - range$$1.from().line > 100 || (selected = cm.getSelection()).length > 1000);
|
8943 |
+
var content = minimal ? "-" : selected || cm.getSelection();
|
8944 |
+
this.textarea.value = content;
|
8945 |
+
if (cm.state.focused) { selectInput(this.textarea); }
|
8946 |
+
if (ie && ie_version >= 9) { this.hasSelection = content; }
|
8947 |
+
} else if (!typing) {
|
8948 |
+
this.prevInput = this.textarea.value = "";
|
8949 |
+
if (ie && ie_version >= 9) { this.hasSelection = null; }
|
8950 |
+
}
|
8951 |
+
this.inaccurateSelection = minimal;
|
8952 |
+
};
|
8953 |
+
|
8954 |
+
TextareaInput.prototype.getField = function () { return this.textarea };
|
8955 |
+
|
8956 |
+
TextareaInput.prototype.supportsTouch = function () { return false };
|
8957 |
+
|
8958 |
+
TextareaInput.prototype.focus = function () {
|
8959 |
+
if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
|
8960 |
+
try { this.textarea.focus(); }
|
8961 |
+
catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
|
8962 |
+
}
|
8963 |
+
};
|
8964 |
+
|
8965 |
+
TextareaInput.prototype.blur = function () { this.textarea.blur(); };
|
8966 |
+
|
8967 |
+
TextareaInput.prototype.resetPosition = function () {
|
8968 |
+
this.wrapper.style.top = this.wrapper.style.left = 0;
|
8969 |
+
};
|
8970 |
+
|
8971 |
+
TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
|
8972 |
+
|
8973 |
+
// Poll for input changes, using the normal rate of polling. This
|
8974 |
+
// runs as long as the editor is focused.
|
8975 |
+
TextareaInput.prototype.slowPoll = function () {
|
8976 |
+
var this$1 = this;
|
8977 |
+
|
8978 |
+
if (this.pollingFast) { return }
|
8979 |
+
this.polling.set(this.cm.options.pollInterval, function () {
|
8980 |
+
this$1.poll();
|
8981 |
+
if (this$1.cm.state.focused) { this$1.slowPoll(); }
|
8982 |
+
});
|
8983 |
+
};
|
8984 |
+
|
8985 |
+
// When an event has just come in that is likely to add or change
|
8986 |
+
// something in the input textarea, we poll faster, to ensure that
|
8987 |
+
// the change appears on the screen quickly.
|
8988 |
+
TextareaInput.prototype.fastPoll = function () {
|
8989 |
+
var missed = false, input = this;
|
8990 |
+
input.pollingFast = true;
|
8991 |
+
function p() {
|
8992 |
+
var changed = input.poll();
|
8993 |
+
if (!changed && !missed) {missed = true; input.polling.set(60, p);}
|
8994 |
+
else {input.pollingFast = false; input.slowPoll();}
|
8995 |
+
}
|
8996 |
+
input.polling.set(20, p);
|
8997 |
+
};
|
8998 |
+
|
8999 |
+
// Read input from the textarea, and update the document to match.
|
9000 |
+
// When something is selected, it is present in the textarea, and
|
9001 |
+
// selected (unless it is huge, in which case a placeholder is
|
9002 |
+
// used). When nothing is selected, the cursor sits after previously
|
9003 |
+
// seen text (can be empty), which is stored in prevInput (we must
|
9004 |
+
// not reset the textarea when typing, because that breaks IME).
|
9005 |
+
TextareaInput.prototype.poll = function () {
|
9006 |
+
var this$1 = this;
|
9007 |
+
|
9008 |
+
var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
|
9009 |
+
// Since this is called a *lot*, try to bail out as cheaply as
|
9010 |
+
// possible when it is clear that nothing happened. hasSelection
|
9011 |
+
// will be the case when there is a lot of text in the textarea,
|
9012 |
+
// in which case reading its value would be expensive.
|
9013 |
+
if (this.contextMenuPending || !cm.state.focused ||
|
9014 |
+
(hasSelection(input) && !prevInput && !this.composing) ||
|
9015 |
+
cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
|
9016 |
+
{ return false }
|
9017 |
+
|
9018 |
+
var text = input.value;
|
9019 |
+
// If nothing changed, bail.
|
9020 |
+
if (text == prevInput && !cm.somethingSelected()) { return false }
|
9021 |
+
// Work around nonsensical selection resetting in IE9/10, and
|
9022 |
+
// inexplicable appearance of private area unicode characters on
|
9023 |
+
// some key combos in Mac (#2689).
|
9024 |
+
if (ie && ie_version >= 9 && this.hasSelection === text ||
|
9025 |
+
mac && /[\uf700-\uf7ff]/.test(text)) {
|
9026 |
+
cm.display.input.reset();
|
9027 |
+
return false
|
9028 |
+
}
|
9029 |
+
|
9030 |
+
if (cm.doc.sel == cm.display.selForContextMenu) {
|
9031 |
+
var first = text.charCodeAt(0);
|
9032 |
+
if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
|
9033 |
+
if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
|
9034 |
+
}
|
9035 |
+
// Find the part of the input that is actually new
|
9036 |
+
var same = 0, l = Math.min(prevInput.length, text.length);
|
9037 |
+
while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
|
9038 |
+
|
9039 |
+
runInOp(cm, function () {
|
9040 |
+
applyTextInput(cm, text.slice(same), prevInput.length - same,
|
9041 |
+
null, this$1.composing ? "*compose" : null);
|
9042 |
+
|
9043 |
+
// Don't leave long text in the textarea, since it makes further polling slow
|
9044 |
+
if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
|
9045 |
+
else { this$1.prevInput = text; }
|
9046 |
+
|
9047 |
+
if (this$1.composing) {
|
9048 |
+
this$1.composing.range.clear();
|
9049 |
+
this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
|
9050 |
+
{className: "CodeMirror-composing"});
|
9051 |
+
}
|
9052 |
+
});
|
9053 |
+
return true
|
9054 |
+
};
|
9055 |
+
|
9056 |
+
TextareaInput.prototype.ensurePolled = function () {
|
9057 |
+
if (this.pollingFast && this.poll()) { this.pollingFast = false; }
|
9058 |
+
};
|
9059 |
+
|
9060 |
+
TextareaInput.prototype.onKeyPress = function () {
|
9061 |
+
if (ie && ie_version >= 9) { this.hasSelection = null; }
|
9062 |
+
this.fastPoll();
|
9063 |
+
};
|
9064 |
+
|
9065 |
+
TextareaInput.prototype.onContextMenu = function (e) {
|
9066 |
+
var input = this, cm = input.cm, display = cm.display, te = input.textarea;
|
9067 |
+
var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
|
9068 |
+
if (!pos || presto) { return } // Opera is difficult.
|
9069 |
+
|
9070 |
+
// Reset the current text selection only if the click is done outside of the selection
|
9071 |
+
// and 'resetSelectionOnContextMenu' option is true.
|
9072 |
+
var reset = cm.options.resetSelectionOnContextMenu;
|
9073 |
+
if (reset && cm.doc.sel.contains(pos) == -1)
|
9074 |
+
{ operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
|
9075 |
+
|
9076 |
+
var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
|
9077 |
+
input.wrapper.style.cssText = "position: absolute";
|
9078 |
+
var wrapperBox = input.wrapper.getBoundingClientRect();
|
9079 |
+
te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
|
9080 |
+
var oldScrollY;
|
9081 |
+
if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
|
9082 |
+
display.input.focus();
|
9083 |
+
if (webkit) { window.scrollTo(null, oldScrollY); }
|
9084 |
+
display.input.reset();
|
9085 |
+
// Adds "Select all" to context menu in FF
|
9086 |
+
if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
|
9087 |
+
input.contextMenuPending = true;
|
9088 |
+
display.selForContextMenu = cm.doc.sel;
|
9089 |
+
clearTimeout(display.detectingSelectAll);
|
9090 |
+
|
9091 |
+
// Select-all will be greyed out if there's nothing to select, so
|
9092 |
+
// this adds a zero-width space so that we can later check whether
|
9093 |
+
// it got selected.
|
9094 |
+
function prepareSelectAllHack() {
|
9095 |
+
if (te.selectionStart != null) {
|
9096 |
+
var selected = cm.somethingSelected();
|
9097 |
+
var extval = "\u200b" + (selected ? te.value : "");
|
9098 |
+
te.value = "\u21da"; // Used to catch context-menu undo
|
9099 |
+
te.value = extval;
|
9100 |
+
input.prevInput = selected ? "" : "\u200b";
|
9101 |
+
te.selectionStart = 1; te.selectionEnd = extval.length;
|
9102 |
+
// Re-set this, in case some other handler touched the
|
9103 |
+
// selection in the meantime.
|
9104 |
+
display.selForContextMenu = cm.doc.sel;
|
9105 |
+
}
|
9106 |
+
}
|
9107 |
+
function rehide() {
|
9108 |
+
input.contextMenuPending = false;
|
9109 |
+
input.wrapper.style.cssText = oldWrapperCSS;
|
9110 |
+
te.style.cssText = oldCSS;
|
9111 |
+
if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
|
9112 |
+
|
9113 |
+
// Try to detect the user choosing select-all
|
9114 |
+
if (te.selectionStart != null) {
|
9115 |
+
if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
|
9116 |
+
var i = 0, poll = function () {
|
9117 |
+
if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
|
9118 |
+
te.selectionEnd > 0 && input.prevInput == "\u200b") {
|
9119 |
+
operation(cm, selectAll)(cm);
|
9120 |
+
} else if (i++ < 10) {
|
9121 |
+
display.detectingSelectAll = setTimeout(poll, 500);
|
9122 |
+
} else {
|
9123 |
+
display.selForContextMenu = null;
|
9124 |
+
display.input.reset();
|
9125 |
+
}
|
9126 |
+
};
|
9127 |
+
display.detectingSelectAll = setTimeout(poll, 200);
|
9128 |
+
}
|
9129 |
+
}
|
9130 |
+
|
9131 |
+
if (ie && ie_version >= 9) { prepareSelectAllHack(); }
|
9132 |
+
if (captureRightClick) {
|
9133 |
+
e_stop(e);
|
9134 |
+
var mouseup = function () {
|
9135 |
+
off(window, "mouseup", mouseup);
|
9136 |
+
setTimeout(rehide, 20);
|
9137 |
+
};
|
9138 |
+
on(window, "mouseup", mouseup);
|
9139 |
+
} else {
|
9140 |
+
setTimeout(rehide, 50);
|
9141 |
+
}
|
9142 |
+
};
|
9143 |
+
|
9144 |
+
TextareaInput.prototype.readOnlyChanged = function (val) {
|
9145 |
+
if (!val) { this.reset(); }
|
9146 |
+
};
|
9147 |
+
|
9148 |
+
TextareaInput.prototype.setUneditable = function () {};
|
9149 |
+
|
9150 |
+
TextareaInput.prototype.needsContentAttribute = false;
|
9151 |
+
|
9152 |
+
function fromTextArea(textarea, options) {
|
9153 |
+
options = options ? copyObj(options) : {};
|
9154 |
+
options.value = textarea.value;
|
9155 |
+
if (!options.tabindex && textarea.tabIndex)
|
9156 |
+
{ options.tabindex = textarea.tabIndex; }
|
9157 |
+
if (!options.placeholder && textarea.placeholder)
|
9158 |
+
{ options.placeholder = textarea.placeholder; }
|
9159 |
+
// Set autofocus to true if this textarea is focused, or if it has
|
9160 |
+
// autofocus and no other element is focused.
|
9161 |
+
if (options.autofocus == null) {
|
9162 |
+
var hasFocus = activeElt();
|
9163 |
+
options.autofocus = hasFocus == textarea ||
|
9164 |
+
textarea.getAttribute("autofocus") != null && hasFocus == document.body;
|
9165 |
+
}
|
9166 |
+
|
9167 |
+
function save() {textarea.value = cm.getValue();}
|
9168 |
+
|
9169 |
+
var realSubmit;
|
9170 |
+
if (textarea.form) {
|
9171 |
+
on(textarea.form, "submit", save);
|
9172 |
+
// Deplorable hack to make the submit method do the right thing.
|
9173 |
+
if (!options.leaveSubmitMethodAlone) {
|
9174 |
+
var form = textarea.form;
|
9175 |
+
realSubmit = form.submit;
|
9176 |
+
try {
|
9177 |
+
var wrappedSubmit = form.submit = function () {
|
9178 |
+
save();
|
9179 |
+
form.submit = realSubmit;
|
9180 |
+
form.submit();
|
9181 |
+
form.submit = wrappedSubmit;
|
9182 |
+
};
|
9183 |
+
} catch(e) {}
|
9184 |
+
}
|
9185 |
+
}
|
9186 |
+
|
9187 |
+
options.finishInit = function (cm) {
|
9188 |
+
cm.save = save;
|
9189 |
+
cm.getTextArea = function () { return textarea; };
|
9190 |
+
cm.toTextArea = function () {
|
9191 |
+
cm.toTextArea = isNaN; // Prevent this from being ran twice
|
9192 |
+
save();
|
9193 |
+
textarea.parentNode.removeChild(cm.getWrapperElement());
|
9194 |
+
textarea.style.display = "";
|
9195 |
+
if (textarea.form) {
|
9196 |
+
off(textarea.form, "submit", save);
|
9197 |
+
if (typeof textarea.form.submit == "function")
|
9198 |
+
{ textarea.form.submit = realSubmit; }
|
9199 |
+
}
|
9200 |
+
};
|
9201 |
+
};
|
9202 |
+
|
9203 |
+
textarea.style.display = "none";
|
9204 |
+
var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
|
9205 |
+
options);
|
9206 |
+
return cm
|
9207 |
+
}
|
9208 |
+
|
9209 |
+
function addLegacyProps(CodeMirror) {
|
9210 |
+
CodeMirror.off = off;
|
9211 |
+
CodeMirror.on = on;
|
9212 |
+
CodeMirror.wheelEventPixels = wheelEventPixels;
|
9213 |
+
CodeMirror.Doc = Doc;
|
9214 |
+
CodeMirror.splitLines = splitLinesAuto;
|
9215 |
+
CodeMirror.countColumn = countColumn;
|
9216 |
+
CodeMirror.findColumn = findColumn;
|
9217 |
+
CodeMirror.isWordChar = isWordCharBasic;
|
9218 |
+
CodeMirror.Pass = Pass;
|
9219 |
+
CodeMirror.signal = signal;
|
9220 |
+
CodeMirror.Line = Line;
|
9221 |
+
CodeMirror.changeEnd = changeEnd;
|
9222 |
+
CodeMirror.scrollbarModel = scrollbarModel;
|
9223 |
+
CodeMirror.Pos = Pos;
|
9224 |
+
CodeMirror.cmpPos = cmp;
|
9225 |
+
CodeMirror.modes = modes;
|
9226 |
+
CodeMirror.mimeModes = mimeModes;
|
9227 |
+
CodeMirror.resolveMode = resolveMode;
|
9228 |
+
CodeMirror.getMode = getMode;
|
9229 |
+
CodeMirror.modeExtensions = modeExtensions;
|
9230 |
+
CodeMirror.extendMode = extendMode;
|
9231 |
+
CodeMirror.copyState = copyState;
|
9232 |
+
CodeMirror.startState = startState;
|
9233 |
+
CodeMirror.innerMode = innerMode;
|
9234 |
+
CodeMirror.commands = commands;
|
9235 |
+
CodeMirror.keyMap = keyMap;
|
9236 |
+
CodeMirror.keyName = keyName;
|
9237 |
+
CodeMirror.isModifierKey = isModifierKey;
|
9238 |
+
CodeMirror.lookupKey = lookupKey;
|
9239 |
+
CodeMirror.normalizeKeyMap = normalizeKeyMap;
|
9240 |
+
CodeMirror.StringStream = StringStream;
|
9241 |
+
CodeMirror.SharedTextMarker = SharedTextMarker;
|
9242 |
+
CodeMirror.TextMarker = TextMarker;
|
9243 |
+
CodeMirror.LineWidget = LineWidget;
|
9244 |
+
CodeMirror.e_preventDefault = e_preventDefault;
|
9245 |
+
CodeMirror.e_stopPropagation = e_stopPropagation;
|
9246 |
+
CodeMirror.e_stop = e_stop;
|
9247 |
+
CodeMirror.addClass = addClass;
|
9248 |
+
CodeMirror.contains = contains;
|
9249 |
+
CodeMirror.rmClass = rmClass;
|
9250 |
+
CodeMirror.keyNames = keyNames;
|
9251 |
+
}
|
9252 |
+
|
9253 |
+
// EDITOR CONSTRUCTOR
|
9254 |
+
|
9255 |
+
defineOptions(CodeMirror$1);
|
9256 |
+
|
9257 |
+
addEditorMethods(CodeMirror$1);
|
9258 |
+
|
9259 |
+
// Set up methods on CodeMirror's prototype to redirect to the editor's document.
|
9260 |
+
var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
|
9261 |
+
for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
|
9262 |
+
{ CodeMirror$1.prototype[prop] = (function(method) {
|
9263 |
+
return function() {return method.apply(this.doc, arguments)}
|
9264 |
+
})(Doc.prototype[prop]); } }
|
9265 |
+
|
9266 |
+
eventMixin(Doc);
|
9267 |
+
|
9268 |
+
// INPUT HANDLING
|
9269 |
+
|
9270 |
+
CodeMirror$1.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
|
9271 |
+
|
9272 |
+
// MODE DEFINITION AND QUERYING
|
9273 |
+
|
9274 |
+
// Extra arguments are stored as the mode's dependencies, which is
|
9275 |
+
// used by (legacy) mechanisms like loadmode.js to automatically
|
9276 |
+
// load a mode. (Preferred mechanism is the require/define calls.)
|
9277 |
+
CodeMirror$1.defineMode = function(name/*, mode, …*/) {
|
9278 |
+
if (!CodeMirror$1.defaults.mode && name != "null") { CodeMirror$1.defaults.mode = name; }
|
9279 |
+
defineMode.apply(this, arguments);
|
9280 |
+
};
|
9281 |
+
|
9282 |
+
CodeMirror$1.defineMIME = defineMIME;
|
9283 |
+
|
9284 |
+
// Minimal default mode.
|
9285 |
+
CodeMirror$1.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
|
9286 |
+
CodeMirror$1.defineMIME("text/plain", "null");
|
9287 |
+
|
9288 |
+
// EXTENSIONS
|
9289 |
+
|
9290 |
+
CodeMirror$1.defineExtension = function (name, func) {
|
9291 |
+
CodeMirror$1.prototype[name] = func;
|
9292 |
+
};
|
9293 |
+
CodeMirror$1.defineDocExtension = function (name, func) {
|
9294 |
+
Doc.prototype[name] = func;
|
9295 |
+
};
|
9296 |
+
|
9297 |
+
CodeMirror$1.fromTextArea = fromTextArea;
|
9298 |
+
|
9299 |
+
addLegacyProps(CodeMirror$1);
|
9300 |
+
|
9301 |
+
CodeMirror$1.version = "5.25.0";
|
9302 |
+
|
9303 |
+
return CodeMirror$1;
|
9304 |
+
|
9305 |
+
})));
|
9306 |
+
|
9307 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
9308 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
9309 |
+
|
9310 |
+
(function(mod) {
|
9311 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
9312 |
+
mod(require("../../lib/codemirror"));
|
9313 |
+
else if (typeof define == "function" && define.amd) // AMD
|
9314 |
+
define(["../../lib/codemirror"], mod);
|
9315 |
+
else // Plain browser env
|
9316 |
+
mod(CodeMirror);
|
9317 |
+
})(function(CodeMirror) {
|
9318 |
+
"use strict";
|
9319 |
+
|
9320 |
+
var htmlConfig = {
|
9321 |
+
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
|
9322 |
+
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
|
9323 |
+
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
|
9324 |
+
'track': true, 'wbr': true, 'menuitem': true},
|
9325 |
+
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
|
9326 |
+
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
|
9327 |
+
'th': true, 'tr': true},
|
9328 |
+
contextGrabbers: {
|
9329 |
+
'dd': {'dd': true, 'dt': true},
|
9330 |
+
'dt': {'dd': true, 'dt': true},
|
9331 |
+
'li': {'li': true},
|
9332 |
+
'option': {'option': true, 'optgroup': true},
|
9333 |
+
'optgroup': {'optgroup': true},
|
9334 |
+
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
|
9335 |
+
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
|
9336 |
+
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
|
9337 |
+
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
|
9338 |
+
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
|
9339 |
+
'rp': {'rp': true, 'rt': true},
|
9340 |
+
'rt': {'rp': true, 'rt': true},
|
9341 |
+
'tbody': {'tbody': true, 'tfoot': true},
|
9342 |
+
'td': {'td': true, 'th': true},
|
9343 |
+
'tfoot': {'tbody': true},
|
9344 |
+
'th': {'td': true, 'th': true},
|
9345 |
+
'thead': {'tbody': true, 'tfoot': true},
|
9346 |
+
'tr': {'tr': true}
|
9347 |
+
},
|
9348 |
+
doNotIndent: {"pre": true},
|
9349 |
+
allowUnquoted: true,
|
9350 |
+
allowMissing: true,
|
9351 |
+
caseFold: true
|
9352 |
+
}
|
9353 |
+
|
9354 |
+
var xmlConfig = {
|
9355 |
+
autoSelfClosers: {},
|
9356 |
+
implicitlyClosed: {},
|
9357 |
+
contextGrabbers: {},
|
9358 |
+
doNotIndent: {},
|
9359 |
+
allowUnquoted: false,
|
9360 |
+
allowMissing: false,
|
9361 |
+
caseFold: false
|
9362 |
+
}
|
9363 |
+
|
9364 |
+
CodeMirror.defineMode("xml", function(editorConf, config_) {
|
9365 |
+
var indentUnit = editorConf.indentUnit
|
9366 |
+
var config = {}
|
9367 |
+
var defaults = config_.htmlMode ? htmlConfig : xmlConfig
|
9368 |
+
for (var prop in defaults) config[prop] = defaults[prop]
|
9369 |
+
for (var prop in config_) config[prop] = config_[prop]
|
9370 |
+
|
9371 |
+
// Return variables for tokenizers
|
9372 |
+
var type, setStyle;
|
9373 |
+
|
9374 |
+
function inText(stream, state) {
|
9375 |
+
function chain(parser) {
|
9376 |
+
state.tokenize = parser;
|
9377 |
+
return parser(stream, state);
|
9378 |
+
}
|
9379 |
+
|
9380 |
+
var ch = stream.next();
|
9381 |
+
if (ch == "<") {
|
9382 |
+
if (stream.eat("!")) {
|
9383 |
+
if (stream.eat("[")) {
|
9384 |
+
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
|
9385 |
+
else return null;
|
9386 |
+
} else if (stream.match("--")) {
|
9387 |
+
return chain(inBlock("comment", "-->"));
|
9388 |
+
} else if (stream.match("DOCTYPE", true, true)) {
|
9389 |
+
stream.eatWhile(/[\w\._\-]/);
|
9390 |
+
return chain(doctype(1));
|
9391 |
+
} else {
|
9392 |
+
return null;
|
9393 |
+
}
|
9394 |
+
} else if (stream.eat("?")) {
|
9395 |
+
stream.eatWhile(/[\w\._\-]/);
|
9396 |
+
state.tokenize = inBlock("meta", "?>");
|
9397 |
+
return "meta";
|
9398 |
+
} else {
|
9399 |
+
type = stream.eat("/") ? "closeTag" : "openTag";
|
9400 |
+
state.tokenize = inTag;
|
9401 |
+
return "tag bracket";
|
9402 |
+
}
|
9403 |
+
} else if (ch == "&") {
|
9404 |
+
var ok;
|
9405 |
+
if (stream.eat("#")) {
|
9406 |
+
if (stream.eat("x")) {
|
9407 |
+
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
9408 |
+
} else {
|
9409 |
+
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
9410 |
+
}
|
9411 |
+
} else {
|
9412 |
+
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
|
9413 |
+
}
|
9414 |
+
return ok ? "atom" : "error";
|
9415 |
+
} else {
|
9416 |
+
stream.eatWhile(/[^&<]/);
|
9417 |
+
return null;
|
9418 |
+
}
|
9419 |
+
}
|
9420 |
+
inText.isInText = true;
|
9421 |
+
|
9422 |
+
function inTag(stream, state) {
|
9423 |
+
var ch = stream.next();
|
9424 |
+
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
|
9425 |
+
state.tokenize = inText;
|
9426 |
+
type = ch == ">" ? "endTag" : "selfcloseTag";
|
9427 |
+
return "tag bracket";
|
9428 |
+
} else if (ch == "=") {
|
9429 |
+
type = "equals";
|
9430 |
+
return null;
|
9431 |
+
} else if (ch == "<") {
|
9432 |
+
state.tokenize = inText;
|
9433 |
+
state.state = baseState;
|
9434 |
+
state.tagName = state.tagStart = null;
|
9435 |
+
var next = state.tokenize(stream, state);
|
9436 |
+
return next ? next + " tag error" : "tag error";
|
9437 |
+
} else if (/[\'\"]/.test(ch)) {
|
9438 |
+
state.tokenize = inAttribute(ch);
|
9439 |
+
state.stringStartCol = stream.column();
|
9440 |
+
return state.tokenize(stream, state);
|
9441 |
+
} else {
|
9442 |
+
stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
|
9443 |
+
return "word";
|
9444 |
+
}
|
9445 |
+
}
|
9446 |
+
|
9447 |
+
function inAttribute(quote) {
|
9448 |
+
var closure = function(stream, state) {
|
9449 |
+
while (!stream.eol()) {
|
9450 |
+
if (stream.next() == quote) {
|
9451 |
+
state.tokenize = inTag;
|
9452 |
+
break;
|
9453 |
+
}
|
9454 |
+
}
|
9455 |
+
return "string";
|
9456 |
+
};
|
9457 |
+
closure.isInAttribute = true;
|
9458 |
+
return closure;
|
9459 |
+
}
|
9460 |
+
|
9461 |
+
function inBlock(style, terminator) {
|
9462 |
+
return function(stream, state) {
|
9463 |
+
while (!stream.eol()) {
|
9464 |
+
if (stream.match(terminator)) {
|
9465 |
+
state.tokenize = inText;
|
9466 |
+
break;
|
9467 |
+
}
|
9468 |
+
stream.next();
|
9469 |
+
}
|
9470 |
+
return style;
|
9471 |
+
};
|
9472 |
+
}
|
9473 |
+
function doctype(depth) {
|
9474 |
+
return function(stream, state) {
|
9475 |
+
var ch;
|
9476 |
+
while ((ch = stream.next()) != null) {
|
9477 |
+
if (ch == "<") {
|
9478 |
+
state.tokenize = doctype(depth + 1);
|
9479 |
+
return state.tokenize(stream, state);
|
9480 |
+
} else if (ch == ">") {
|
9481 |
+
if (depth == 1) {
|
9482 |
+
state.tokenize = inText;
|
9483 |
+
break;
|
9484 |
+
} else {
|
9485 |
+
state.tokenize = doctype(depth - 1);
|
9486 |
+
return state.tokenize(stream, state);
|
9487 |
+
}
|
9488 |
+
}
|
9489 |
+
}
|
9490 |
+
return "meta";
|
9491 |
+
};
|
9492 |
+
}
|
9493 |
+
|
9494 |
+
function Context(state, tagName, startOfLine) {
|
9495 |
+
this.prev = state.context;
|
9496 |
+
this.tagName = tagName;
|
9497 |
+
this.indent = state.indented;
|
9498 |
+
this.startOfLine = startOfLine;
|
9499 |
+
if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
|
9500 |
+
this.noIndent = true;
|
9501 |
+
}
|
9502 |
+
function popContext(state) {
|
9503 |
+
if (state.context) state.context = state.context.prev;
|
9504 |
+
}
|
9505 |
+
function maybePopContext(state, nextTagName) {
|
9506 |
+
var parentTagName;
|
9507 |
+
while (true) {
|
9508 |
+
if (!state.context) {
|
9509 |
+
return;
|
9510 |
+
}
|
9511 |
+
parentTagName = state.context.tagName;
|
9512 |
+
if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
|
9513 |
+
!config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
9514 |
+
return;
|
9515 |
+
}
|
9516 |
+
popContext(state);
|
9517 |
+
}
|
9518 |
+
}
|
9519 |
+
|
9520 |
+
function baseState(type, stream, state) {
|
9521 |
+
if (type == "openTag") {
|
9522 |
+
state.tagStart = stream.column();
|
9523 |
+
return tagNameState;
|
9524 |
+
} else if (type == "closeTag") {
|
9525 |
+
return closeTagNameState;
|
9526 |
+
} else {
|
9527 |
+
return baseState;
|
9528 |
+
}
|
9529 |
+
}
|
9530 |
+
function tagNameState(type, stream, state) {
|
9531 |
+
if (type == "word") {
|
9532 |
+
state.tagName = stream.current();
|
9533 |
+
setStyle = "tag";
|
9534 |
+
return attrState;
|
9535 |
+
} else {
|
9536 |
+
setStyle = "error";
|
9537 |
+
return tagNameState;
|
9538 |
+
}
|
9539 |
+
}
|
9540 |
+
function closeTagNameState(type, stream, state) {
|
9541 |
+
if (type == "word") {
|
9542 |
+
var tagName = stream.current();
|
9543 |
+
if (state.context && state.context.tagName != tagName &&
|
9544 |
+
config.implicitlyClosed.hasOwnProperty(state.context.tagName))
|
9545 |
+
popContext(state);
|
9546 |
+
if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
|
9547 |
+
setStyle = "tag";
|
9548 |
+
return closeState;
|
9549 |
+
} else {
|
9550 |
+
setStyle = "tag error";
|
9551 |
+
return closeStateErr;
|
9552 |
+
}
|
9553 |
+
} else {
|
9554 |
+
setStyle = "error";
|
9555 |
+
return closeStateErr;
|
9556 |
+
}
|
9557 |
+
}
|
9558 |
+
|
9559 |
+
function closeState(type, _stream, state) {
|
9560 |
+
if (type != "endTag") {
|
9561 |
+
setStyle = "error";
|
9562 |
+
return closeState;
|
9563 |
+
}
|
9564 |
+
popContext(state);
|
9565 |
+
return baseState;
|
9566 |
+
}
|
9567 |
+
function closeStateErr(type, stream, state) {
|
9568 |
+
setStyle = "error";
|
9569 |
+
return closeState(type, stream, state);
|
9570 |
+
}
|
9571 |
+
|
9572 |
+
function attrState(type, _stream, state) {
|
9573 |
+
if (type == "word") {
|
9574 |
+
setStyle = "attribute";
|
9575 |
+
return attrEqState;
|
9576 |
+
} else if (type == "endTag" || type == "selfcloseTag") {
|
9577 |
+
var tagName = state.tagName, tagStart = state.tagStart;
|
9578 |
+
state.tagName = state.tagStart = null;
|
9579 |
+
if (type == "selfcloseTag" ||
|
9580 |
+
config.autoSelfClosers.hasOwnProperty(tagName)) {
|
9581 |
+
maybePopContext(state, tagName);
|
9582 |
+
} else {
|
9583 |
+
maybePopContext(state, tagName);
|
9584 |
+
state.context = new Context(state, tagName, tagStart == state.indented);
|
9585 |
+
}
|
9586 |
+
return baseState;
|
9587 |
+
}
|
9588 |
+
setStyle = "error";
|
9589 |
+
return attrState;
|
9590 |
+
}
|
9591 |
+
function attrEqState(type, stream, state) {
|
9592 |
+
if (type == "equals") return attrValueState;
|
9593 |
+
if (!config.allowMissing) setStyle = "error";
|
9594 |
+
return attrState(type, stream, state);
|
9595 |
+
}
|
9596 |
+
function attrValueState(type, stream, state) {
|
9597 |
+
if (type == "string") return attrContinuedState;
|
9598 |
+
if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
|
9599 |
+
setStyle = "error";
|
9600 |
+
return attrState(type, stream, state);
|
9601 |
+
}
|
9602 |
+
function attrContinuedState(type, stream, state) {
|
9603 |
+
if (type == "string") return attrContinuedState;
|
9604 |
+
return attrState(type, stream, state);
|
9605 |
+
}
|
9606 |
+
|
9607 |
+
return {
|
9608 |
+
startState: function(baseIndent) {
|
9609 |
+
var state = {tokenize: inText,
|
9610 |
+
state: baseState,
|
9611 |
+
indented: baseIndent || 0,
|
9612 |
+
tagName: null, tagStart: null,
|
9613 |
+
context: null}
|
9614 |
+
if (baseIndent != null) state.baseIndent = baseIndent
|
9615 |
+
return state
|
9616 |
+
},
|
9617 |
+
|
9618 |
+
token: function(stream, state) {
|
9619 |
+
if (!state.tagName && stream.sol())
|
9620 |
+
state.indented = stream.indentation();
|
9621 |
+
|
9622 |
+
if (stream.eatSpace()) return null;
|
9623 |
+
type = null;
|
9624 |
+
var style = state.tokenize(stream, state);
|
9625 |
+
if ((style || type) && style != "comment") {
|
9626 |
+
setStyle = null;
|
9627 |
+
state.state = state.state(type || style, stream, state);
|
9628 |
+
if (setStyle)
|
9629 |
+
style = setStyle == "error" ? style + " error" : setStyle;
|
9630 |
+
}
|
9631 |
+
return style;
|
9632 |
+
},
|
9633 |
+
|
9634 |
+
indent: function(state, textAfter, fullLine) {
|
9635 |
+
var context = state.context;
|
9636 |
+
// Indent multi-line strings (e.g. css).
|
9637 |
+
if (state.tokenize.isInAttribute) {
|
9638 |
+
if (state.tagStart == state.indented)
|
9639 |
+
return state.stringStartCol + 1;
|
9640 |
+
else
|
9641 |
+
return state.indented + indentUnit;
|
9642 |
+
}
|
9643 |
+
if (context && context.noIndent) return CodeMirror.Pass;
|
9644 |
+
if (state.tokenize != inTag && state.tokenize != inText)
|
9645 |
+
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
9646 |
+
// Indent the starts of attribute names.
|
9647 |
+
if (state.tagName) {
|
9648 |
+
if (config.multilineTagIndentPastTag !== false)
|
9649 |
+
return state.tagStart + state.tagName.length + 2;
|
9650 |
+
else
|
9651 |
+
return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
|
9652 |
+
}
|
9653 |
+
if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
|
9654 |
+
var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
|
9655 |
+
if (tagAfter && tagAfter[1]) { // Closing tag spotted
|
9656 |
+
while (context) {
|
9657 |
+
if (context.tagName == tagAfter[2]) {
|
9658 |
+
context = context.prev;
|
9659 |
+
break;
|
9660 |
+
} else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
|
9661 |
+
context = context.prev;
|
9662 |
+
} else {
|
9663 |
+
break;
|
9664 |
+
}
|
9665 |
+
}
|
9666 |
+
} else if (tagAfter) { // Opening tag spotted
|
9667 |
+
while (context) {
|
9668 |
+
var grabbers = config.contextGrabbers[context.tagName];
|
9669 |
+
if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
|
9670 |
+
context = context.prev;
|
9671 |
+
else
|
9672 |
+
break;
|
9673 |
+
}
|
9674 |
+
}
|
9675 |
+
while (context && context.prev && !context.startOfLine)
|
9676 |
+
context = context.prev;
|
9677 |
+
if (context) return context.indent + indentUnit;
|
9678 |
+
else return state.baseIndent || 0;
|
9679 |
+
},
|
9680 |
+
|
9681 |
+
electricInput: /<\/[\s\w:]+>$/,
|
9682 |
+
blockCommentStart: "<!--",
|
9683 |
+
blockCommentEnd: "-->",
|
9684 |
+
|
9685 |
+
configuration: config.htmlMode ? "html" : "xml",
|
9686 |
+
helperType: config.htmlMode ? "html" : "xml",
|
9687 |
+
|
9688 |
+
skipAttribute: function(state) {
|
9689 |
+
if (state.state == attrValueState)
|
9690 |
+
state.state = attrState
|
9691 |
+
}
|
9692 |
+
};
|
9693 |
+
});
|
9694 |
+
|
9695 |
+
CodeMirror.defineMIME("text/xml", "xml");
|
9696 |
+
CodeMirror.defineMIME("application/xml", "xml");
|
9697 |
+
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
9698 |
+
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
9699 |
+
|
9700 |
+
});
|
9701 |
+
|
9702 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
9703 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
9704 |
+
|
9705 |
+
(function(mod) {
|
9706 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
9707 |
+
mod(require("../../lib/codemirror"));
|
9708 |
+
else if (typeof define == "function" && define.amd) // AMD
|
9709 |
+
define(["../../lib/codemirror"], mod);
|
9710 |
+
else // Plain browser env
|
9711 |
+
mod(CodeMirror);
|
9712 |
+
})(function(CodeMirror) {
|
9713 |
+
"use strict";
|
9714 |
+
|
9715 |
+
function expressionAllowed(stream, state, backUp) {
|
9716 |
+
return /^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
|
9717 |
+
(state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
|
9718 |
+
}
|
9719 |
+
|
9720 |
+
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
9721 |
+
var indentUnit = config.indentUnit;
|
9722 |
+
var statementIndent = parserConfig.statementIndent;
|
9723 |
+
var jsonldMode = parserConfig.jsonld;
|
9724 |
+
var jsonMode = parserConfig.json || jsonldMode;
|
9725 |
+
var isTS = parserConfig.typescript;
|
9726 |
+
var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
|
9727 |
+
|
9728 |
+
// Tokenizer
|
9729 |
+
|
9730 |
+
var keywords = function(){
|
9731 |
+
function kw(type) {return {type: type, style: "keyword"};}
|
9732 |
+
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
9733 |
+
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
9734 |
+
|
9735 |
+
var jsKeywords = {
|
9736 |
+
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
9737 |
+
"return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
|
9738 |
+
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
9739 |
+
"function": kw("function"), "catch": kw("catch"),
|
9740 |
+
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
9741 |
+
"in": operator, "typeof": operator, "instanceof": operator,
|
9742 |
+
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
9743 |
+
"this": kw("this"), "class": kw("class"), "super": kw("atom"),
|
9744 |
+
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
|
9745 |
+
"await": C, "async": kw("async")
|
9746 |
+
};
|
9747 |
+
|
9748 |
+
// Extend the 'normal' keywords with the TypeScript language extensions
|
9749 |
+
if (isTS) {
|
9750 |
+
var type = {type: "variable", style: "variable-3"};
|
9751 |
+
var tsKeywords = {
|
9752 |
+
// object-like things
|
9753 |
+
"interface": kw("class"),
|
9754 |
+
"implements": C,
|
9755 |
+
"namespace": C,
|
9756 |
+
"module": kw("module"),
|
9757 |
+
"enum": kw("module"),
|
9758 |
+
"type": kw("type"),
|
9759 |
+
|
9760 |
+
// scope modifiers
|
9761 |
+
"public": kw("modifier"),
|
9762 |
+
"private": kw("modifier"),
|
9763 |
+
"protected": kw("modifier"),
|
9764 |
+
"abstract": kw("modifier"),
|
9765 |
+
|
9766 |
+
// operators
|
9767 |
+
"as": operator,
|
9768 |
+
|
9769 |
+
// types
|
9770 |
+
"string": type, "number": type, "boolean": type, "any": type
|
9771 |
+
};
|
9772 |
+
|
9773 |
+
for (var attr in tsKeywords) {
|
9774 |
+
jsKeywords[attr] = tsKeywords[attr];
|
9775 |
+
}
|
9776 |
+
}
|
9777 |
+
|
9778 |
+
return jsKeywords;
|
9779 |
+
}();
|
9780 |
+
|
9781 |
+
var isOperatorChar = /[+\-*&%=<>!?|~^]/;
|
9782 |
+
var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
|
9783 |
+
|
9784 |
+
function readRegexp(stream) {
|
9785 |
+
var escaped = false, next, inSet = false;
|
9786 |
+
while ((next = stream.next()) != null) {
|
9787 |
+
if (!escaped) {
|
9788 |
+
if (next == "/" && !inSet) return;
|
9789 |
+
if (next == "[") inSet = true;
|
9790 |
+
else if (inSet && next == "]") inSet = false;
|
9791 |
+
}
|
9792 |
+
escaped = !escaped && next == "\\";
|
9793 |
+
}
|
9794 |
+
}
|
9795 |
+
|
9796 |
+
// Used as scratch variables to communicate multiple values without
|
9797 |
+
// consing up tons of objects.
|
9798 |
+
var type, content;
|
9799 |
+
function ret(tp, style, cont) {
|
9800 |
+
type = tp; content = cont;
|
9801 |
+
return style;
|
9802 |
+
}
|
9803 |
+
function tokenBase(stream, state) {
|
9804 |
+
var ch = stream.next();
|
9805 |
+
if (ch == '"' || ch == "'") {
|
9806 |
+
state.tokenize = tokenString(ch);
|
9807 |
+
return state.tokenize(stream, state);
|
9808 |
+
} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
|
9809 |
+
return ret("number", "number");
|
9810 |
+
} else if (ch == "." && stream.match("..")) {
|
9811 |
+
return ret("spread", "meta");
|
9812 |
+
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
9813 |
+
return ret(ch);
|
9814 |
+
} else if (ch == "=" && stream.eat(">")) {
|
9815 |
+
return ret("=>", "operator");
|
9816 |
+
} else if (ch == "0" && stream.eat(/x/i)) {
|
9817 |
+
stream.eatWhile(/[\da-f]/i);
|
9818 |
+
return ret("number", "number");
|
9819 |
+
} else if (ch == "0" && stream.eat(/o/i)) {
|
9820 |
+
stream.eatWhile(/[0-7]/i);
|
9821 |
+
return ret("number", "number");
|
9822 |
+
} else if (ch == "0" && stream.eat(/b/i)) {
|
9823 |
+
stream.eatWhile(/[01]/i);
|
9824 |
+
return ret("number", "number");
|
9825 |
+
} else if (/\d/.test(ch)) {
|
9826 |
+
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
9827 |
+
return ret("number", "number");
|
9828 |
+
} else if (ch == "/") {
|
9829 |
+
if (stream.eat("*")) {
|
9830 |
+
state.tokenize = tokenComment;
|
9831 |
+
return tokenComment(stream, state);
|
9832 |
+
} else if (stream.eat("/")) {
|
9833 |
+
stream.skipToEnd();
|
9834 |
+
return ret("comment", "comment");
|
9835 |
+
} else if (expressionAllowed(stream, state, 1)) {
|
9836 |
+
readRegexp(stream);
|
9837 |
+
stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
|
9838 |
+
return ret("regexp", "string-2");
|
9839 |
+
} else {
|
9840 |
+
stream.eatWhile(isOperatorChar);
|
9841 |
+
return ret("operator", "operator", stream.current());
|
9842 |
+
}
|
9843 |
+
} else if (ch == "`") {
|
9844 |
+
state.tokenize = tokenQuasi;
|
9845 |
+
return tokenQuasi(stream, state);
|
9846 |
+
} else if (ch == "#") {
|
9847 |
+
stream.skipToEnd();
|
9848 |
+
return ret("error", "error");
|
9849 |
+
} else if (isOperatorChar.test(ch)) {
|
9850 |
+
if (ch != ">" || !state.lexical || state.lexical.type != ">")
|
9851 |
+
stream.eatWhile(isOperatorChar);
|
9852 |
+
return ret("operator", "operator", stream.current());
|
9853 |
+
} else if (wordRE.test(ch)) {
|
9854 |
+
stream.eatWhile(wordRE);
|
9855 |
+
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
9856 |
+
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
9857 |
+
ret("variable", "variable", word);
|
9858 |
+
}
|
9859 |
+
}
|
9860 |
+
|
9861 |
+
function tokenString(quote) {
|
9862 |
+
return function(stream, state) {
|
9863 |
+
var escaped = false, next;
|
9864 |
+
if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
|
9865 |
+
state.tokenize = tokenBase;
|
9866 |
+
return ret("jsonld-keyword", "meta");
|
9867 |
+
}
|
9868 |
+
while ((next = stream.next()) != null) {
|
9869 |
+
if (next == quote && !escaped) break;
|
9870 |
+
escaped = !escaped && next == "\\";
|
9871 |
+
}
|
9872 |
+
if (!escaped) state.tokenize = tokenBase;
|
9873 |
+
return ret("string", "string");
|
9874 |
+
};
|
9875 |
+
}
|
9876 |
+
|
9877 |
+
function tokenComment(stream, state) {
|
9878 |
+
var maybeEnd = false, ch;
|
9879 |
+
while (ch = stream.next()) {
|
9880 |
+
if (ch == "/" && maybeEnd) {
|
9881 |
+
state.tokenize = tokenBase;
|
9882 |
+
break;
|
9883 |
+
}
|
9884 |
+
maybeEnd = (ch == "*");
|
9885 |
+
}
|
9886 |
+
return ret("comment", "comment");
|
9887 |
+
}
|
9888 |
+
|
9889 |
+
function tokenQuasi(stream, state) {
|
9890 |
+
var escaped = false, next;
|
9891 |
+
while ((next = stream.next()) != null) {
|
9892 |
+
if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
|
9893 |
+
state.tokenize = tokenBase;
|
9894 |
+
break;
|
9895 |
+
}
|
9896 |
+
escaped = !escaped && next == "\\";
|
9897 |
+
}
|
9898 |
+
return ret("quasi", "string-2", stream.current());
|
9899 |
+
}
|
9900 |
+
|
9901 |
+
var brackets = "([{}])";
|
9902 |
+
// This is a crude lookahead trick to try and notice that we're
|
9903 |
+
// parsing the argument patterns for a fat-arrow function before we
|
9904 |
+
// actually hit the arrow token. It only works if the arrow is on
|
9905 |
+
// the same line as the arguments and there's no strange noise
|
9906 |
+
// (comments) in between. Fallback is to only notice when we hit the
|
9907 |
+
// arrow, and not declare the arguments as locals for the arrow
|
9908 |
+
// body.
|
9909 |
+
function findFatArrow(stream, state) {
|
9910 |
+
if (state.fatArrowAt) state.fatArrowAt = null;
|
9911 |
+
var arrow = stream.string.indexOf("=>", stream.start);
|
9912 |
+
if (arrow < 0) return;
|
9913 |
+
|
9914 |
+
if (isTS) { // Try to skip TypeScript return type declarations after the arguments
|
9915 |
+
var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow))
|
9916 |
+
if (m) arrow = m.index
|
9917 |
+
}
|
9918 |
+
|
9919 |
+
var depth = 0, sawSomething = false;
|
9920 |
+
for (var pos = arrow - 1; pos >= 0; --pos) {
|
9921 |
+
var ch = stream.string.charAt(pos);
|
9922 |
+
var bracket = brackets.indexOf(ch);
|
9923 |
+
if (bracket >= 0 && bracket < 3) {
|
9924 |
+
if (!depth) { ++pos; break; }
|
9925 |
+
if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
|
9926 |
+
} else if (bracket >= 3 && bracket < 6) {
|
9927 |
+
++depth;
|
9928 |
+
} else if (wordRE.test(ch)) {
|
9929 |
+
sawSomething = true;
|
9930 |
+
} else if (/["'\/]/.test(ch)) {
|
9931 |
+
return;
|
9932 |
+
} else if (sawSomething && !depth) {
|
9933 |
+
++pos;
|
9934 |
+
break;
|
9935 |
+
}
|
9936 |
+
}
|
9937 |
+
if (sawSomething && !depth) state.fatArrowAt = pos;
|
9938 |
+
}
|
9939 |
+
|
9940 |
+
// Parser
|
9941 |
+
|
9942 |
+
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
|
9943 |
+
|
9944 |
+
function JSLexical(indented, column, type, align, prev, info) {
|
9945 |
+
this.indented = indented;
|
9946 |
+
this.column = column;
|
9947 |
+
this.type = type;
|
9948 |
+
this.prev = prev;
|
9949 |
+
this.info = info;
|
9950 |
+
if (align != null) this.align = align;
|
9951 |
+
}
|
9952 |
+
|
9953 |
+
function inScope(state, varname) {
|
9954 |
+
for (var v = state.localVars; v; v = v.next)
|
9955 |
+
if (v.name == varname) return true;
|
9956 |
+
for (var cx = state.context; cx; cx = cx.prev) {
|
9957 |
+
for (var v = cx.vars; v; v = v.next)
|
9958 |
+
if (v.name == varname) return true;
|
9959 |
+
}
|
9960 |
+
}
|
9961 |
+
|
9962 |
+
function parseJS(state, style, type, content, stream) {
|
9963 |
+
var cc = state.cc;
|
9964 |
+
// Communicate our context to the combinators.
|
9965 |
+
// (Less wasteful than consing up a hundred closures on every call.)
|
9966 |
+
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
|
9967 |
+
|
9968 |
+
if (!state.lexical.hasOwnProperty("align"))
|
9969 |
+
state.lexical.align = true;
|
9970 |
+
|
9971 |
+
while(true) {
|
9972 |
+
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
9973 |
+
if (combinator(type, content)) {
|
9974 |
+
while(cc.length && cc[cc.length - 1].lex)
|
9975 |
+
cc.pop()();
|
9976 |
+
if (cx.marked) return cx.marked;
|
9977 |
+
if (type == "variable" && inScope(state, content)) return "variable-2";
|
9978 |
+
return style;
|
9979 |
+
}
|
9980 |
+
}
|
9981 |
+
}
|
9982 |
+
|
9983 |
+
// Combinator utils
|
9984 |
+
|
9985 |
+
var cx = {state: null, column: null, marked: null, cc: null};
|
9986 |
+
function pass() {
|
9987 |
+
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
9988 |
+
}
|
9989 |
+
function cont() {
|
9990 |
+
pass.apply(null, arguments);
|
9991 |
+
return true;
|
9992 |
+
}
|
9993 |
+
function register(varname) {
|
9994 |
+
function inList(list) {
|
9995 |
+
for (var v = list; v; v = v.next)
|
9996 |
+
if (v.name == varname) return true;
|
9997 |
+
return false;
|
9998 |
+
}
|
9999 |
+
var state = cx.state;
|
10000 |
+
cx.marked = "def";
|
10001 |
+
if (state.context) {
|
10002 |
+
if (inList(state.localVars)) return;
|
10003 |
+
state.localVars = {name: varname, next: state.localVars};
|
10004 |
+
} else {
|
10005 |
+
if (inList(state.globalVars)) return;
|
10006 |
+
if (parserConfig.globalVars)
|
10007 |
+
state.globalVars = {name: varname, next: state.globalVars};
|
10008 |
+
}
|
10009 |
+
}
|
10010 |
+
|
10011 |
+
// Combinators
|
10012 |
+
|
10013 |
+
var defaultVars = {name: "this", next: {name: "arguments"}};
|
10014 |
+
function pushcontext() {
|
10015 |
+
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
10016 |
+
cx.state.localVars = defaultVars;
|
10017 |
+
}
|
10018 |
+
function popcontext() {
|
10019 |
+
cx.state.localVars = cx.state.context.vars;
|
10020 |
+
cx.state.context = cx.state.context.prev;
|
10021 |
+
}
|
10022 |
+
function pushlex(type, info) {
|
10023 |
+
var result = function() {
|
10024 |
+
var state = cx.state, indent = state.indented;
|
10025 |
+
if (state.lexical.type == "stat") indent = state.lexical.indented;
|
10026 |
+
else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
|
10027 |
+
indent = outer.indented;
|
10028 |
+
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
|
10029 |
+
};
|
10030 |
+
result.lex = true;
|
10031 |
+
return result;
|
10032 |
+
}
|
10033 |
+
function poplex() {
|
10034 |
+
var state = cx.state;
|
10035 |
+
if (state.lexical.prev) {
|
10036 |
+
if (state.lexical.type == ")")
|
10037 |
+
state.indented = state.lexical.indented;
|
10038 |
+
state.lexical = state.lexical.prev;
|
10039 |
+
}
|
10040 |
+
}
|
10041 |
+
poplex.lex = true;
|
10042 |
+
|
10043 |
+
function expect(wanted) {
|
10044 |
+
function exp(type) {
|
10045 |
+
if (type == wanted) return cont();
|
10046 |
+
else if (wanted == ";") return pass();
|
10047 |
+
else return cont(exp);
|
10048 |
+
};
|
10049 |
+
return exp;
|
10050 |
+
}
|
10051 |
+
|
10052 |
+
function statement(type, value) {
|
10053 |
+
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
|
10054 |
+
if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
|
10055 |
+
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
10056 |
+
if (type == "{") return cont(pushlex("}"), block, poplex);
|
10057 |
+
if (type == ";") return cont();
|
10058 |
+
if (type == "if") {
|
10059 |
+
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
|
10060 |
+
cx.state.cc.pop()();
|
10061 |
+
return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
|
10062 |
+
}
|
10063 |
+
if (type == "function") return cont(functiondef);
|
10064 |
+
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
|
10065 |
+
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
10066 |
+
if (type == "switch") return cont(pushlex("form"), parenExpr, pushlex("}", "switch"), expect("{"),
|
10067 |
+
block, poplex, poplex);
|
10068 |
+
if (type == "case") return cont(expression, expect(":"));
|
10069 |
+
if (type == "default") return cont(expect(":"));
|
10070 |
+
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
10071 |
+
statement, poplex, popcontext);
|
10072 |
+
if (type == "class") return cont(pushlex("form"), className, poplex);
|
10073 |
+
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
|
10074 |
+
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
|
10075 |
+
if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
|
10076 |
+
if (type == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
|
10077 |
+
if (type == "async") return cont(statement)
|
10078 |
+
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
10079 |
+
}
|
10080 |
+
function expression(type) {
|
10081 |
+
return expressionInner(type, false);
|
10082 |
+
}
|
10083 |
+
function expressionNoComma(type) {
|
10084 |
+
return expressionInner(type, true);
|
10085 |
+
}
|
10086 |
+
function parenExpr(type) {
|
10087 |
+
if (type != "(") return pass()
|
10088 |
+
return cont(pushlex(")"), expression, expect(")"), poplex)
|
10089 |
+
}
|
10090 |
+
function expressionInner(type, noComma) {
|
10091 |
+
if (cx.state.fatArrowAt == cx.stream.start) {
|
10092 |
+
var body = noComma ? arrowBodyNoComma : arrowBody;
|
10093 |
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
|
10094 |
+
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
|
10095 |
+
}
|
10096 |
+
|
10097 |
+
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
10098 |
+
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
10099 |
+
if (type == "function") return cont(functiondef, maybeop);
|
10100 |
+
if (type == "class") return cont(pushlex("form"), classExpression, poplex);
|
10101 |
+
if (type == "keyword c" || type == "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
|
10102 |
+
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
|
10103 |
+
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
|
10104 |
+
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
|
10105 |
+
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
|
10106 |
+
if (type == "quasi") return pass(quasi, maybeop);
|
10107 |
+
if (type == "new") return cont(maybeTarget(noComma));
|
10108 |
+
return cont();
|
10109 |
+
}
|
10110 |
+
function maybeexpression(type) {
|
10111 |
+
if (type.match(/[;\}\)\],]/)) return pass();
|
10112 |
+
return pass(expression);
|
10113 |
+
}
|
10114 |
+
function maybeexpressionNoComma(type) {
|
10115 |
+
if (type.match(/[;\}\)\],]/)) return pass();
|
10116 |
+
return pass(expressionNoComma);
|
10117 |
+
}
|
10118 |
+
|
10119 |
+
function maybeoperatorComma(type, value) {
|
10120 |
+
if (type == ",") return cont(expression);
|
10121 |
+
return maybeoperatorNoComma(type, value, false);
|
10122 |
+
}
|
10123 |
+
function maybeoperatorNoComma(type, value, noComma) {
|
10124 |
+
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
10125 |
+
var expr = noComma == false ? expression : expressionNoComma;
|
10126 |
+
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
10127 |
+
if (type == "operator") {
|
10128 |
+
if (/\+\+|--/.test(value)) return cont(me);
|
10129 |
+
if (value == "?") return cont(expression, expect(":"), expr);
|
10130 |
+
return cont(expr);
|
10131 |
+
}
|
10132 |
+
if (type == "quasi") { return pass(quasi, me); }
|
10133 |
+
if (type == ";") return;
|
10134 |
+
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
|
10135 |
+
if (type == ".") return cont(property, me);
|
10136 |
+
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
|
10137 |
+
}
|
10138 |
+
function quasi(type, value) {
|
10139 |
+
if (type != "quasi") return pass();
|
10140 |
+
if (value.slice(value.length - 2) != "${") return cont(quasi);
|
10141 |
+
return cont(expression, continueQuasi);
|
10142 |
+
}
|
10143 |
+
function continueQuasi(type) {
|
10144 |
+
if (type == "}") {
|
10145 |
+
cx.marked = "string-2";
|
10146 |
+
cx.state.tokenize = tokenQuasi;
|
10147 |
+
return cont(quasi);
|
10148 |
+
}
|
10149 |
+
}
|
10150 |
+
function arrowBody(type) {
|
10151 |
+
findFatArrow(cx.stream, cx.state);
|
10152 |
+
return pass(type == "{" ? statement : expression);
|
10153 |
+
}
|
10154 |
+
function arrowBodyNoComma(type) {
|
10155 |
+
findFatArrow(cx.stream, cx.state);
|
10156 |
+
return pass(type == "{" ? statement : expressionNoComma);
|
10157 |
+
}
|
10158 |
+
function maybeTarget(noComma) {
|
10159 |
+
return function(type) {
|
10160 |
+
if (type == ".") return cont(noComma ? targetNoComma : target);
|
10161 |
+
else return pass(noComma ? expressionNoComma : expression);
|
10162 |
+
};
|
10163 |
+
}
|
10164 |
+
function target(_, value) {
|
10165 |
+
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
|
10166 |
+
}
|
10167 |
+
function targetNoComma(_, value) {
|
10168 |
+
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
|
10169 |
+
}
|
10170 |
+
function maybelabel(type) {
|
10171 |
+
if (type == ":") return cont(poplex, statement);
|
10172 |
+
return pass(maybeoperatorComma, expect(";"), poplex);
|
10173 |
+
}
|
10174 |
+
function property(type) {
|
10175 |
+
if (type == "variable") {cx.marked = "property"; return cont();}
|
10176 |
+
}
|
10177 |
+
function objprop(type, value) {
|
10178 |
+
if (type == "async") {
|
10179 |
+
cx.marked = "property";
|
10180 |
+
return cont(objprop);
|
10181 |
+
} else if (type == "variable" || cx.style == "keyword") {
|
10182 |
+
cx.marked = "property";
|
10183 |
+
if (value == "get" || value == "set") return cont(getterSetter);
|
10184 |
+
return cont(afterprop);
|
10185 |
+
} else if (type == "number" || type == "string") {
|
10186 |
+
cx.marked = jsonldMode ? "property" : (cx.style + " property");
|
10187 |
+
return cont(afterprop);
|
10188 |
+
} else if (type == "jsonld-keyword") {
|
10189 |
+
return cont(afterprop);
|
10190 |
+
} else if (type == "modifier") {
|
10191 |
+
return cont(objprop)
|
10192 |
+
} else if (type == "[") {
|
10193 |
+
return cont(expression, expect("]"), afterprop);
|
10194 |
+
} else if (type == "spread") {
|
10195 |
+
return cont(expression);
|
10196 |
+
} else if (type == ":") {
|
10197 |
+
return pass(afterprop)
|
10198 |
+
}
|
10199 |
+
}
|
10200 |
+
function getterSetter(type) {
|
10201 |
+
if (type != "variable") return pass(afterprop);
|
10202 |
+
cx.marked = "property";
|
10203 |
+
return cont(functiondef);
|
10204 |
+
}
|
10205 |
+
function afterprop(type) {
|
10206 |
+
if (type == ":") return cont(expressionNoComma);
|
10207 |
+
if (type == "(") return pass(functiondef);
|
10208 |
+
}
|
10209 |
+
function commasep(what, end, sep) {
|
10210 |
+
function proceed(type, value) {
|
10211 |
+
if (sep ? sep.indexOf(type) > -1 : type == ",") {
|
10212 |
+
var lex = cx.state.lexical;
|
10213 |
+
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
10214 |
+
return cont(function(type, value) {
|
10215 |
+
if (type == end || value == end) return pass()
|
10216 |
+
return pass(what)
|
10217 |
+
}, proceed);
|
10218 |
+
}
|
10219 |
+
if (type == end || value == end) return cont();
|
10220 |
+
return cont(expect(end));
|
10221 |
+
}
|
10222 |
+
return function(type, value) {
|
10223 |
+
if (type == end || value == end) return cont();
|
10224 |
+
return pass(what, proceed);
|
10225 |
+
};
|
10226 |
+
}
|
10227 |
+
function contCommasep(what, end, info) {
|
10228 |
+
for (var i = 3; i < arguments.length; i++)
|
10229 |
+
cx.cc.push(arguments[i]);
|
10230 |
+
return cont(pushlex(end, info), commasep(what, end), poplex);
|
10231 |
+
}
|
10232 |
+
function block(type) {
|
10233 |
+
if (type == "}") return cont();
|
10234 |
+
return pass(statement, block);
|
10235 |
+
}
|
10236 |
+
function maybetype(type, value) {
|
10237 |
+
if (isTS) {
|
10238 |
+
if (type == ":") return cont(typeexpr);
|
10239 |
+
if (value == "?") return cont(maybetype);
|
10240 |
+
}
|
10241 |
+
}
|
10242 |
+
function typeexpr(type) {
|
10243 |
+
if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
|
10244 |
+
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
|
10245 |
+
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex)
|
10246 |
+
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
|
10247 |
+
}
|
10248 |
+
function maybeReturnType(type) {
|
10249 |
+
if (type == "=>") return cont(typeexpr)
|
10250 |
+
}
|
10251 |
+
function typeprop(type, value) {
|
10252 |
+
if (type == "variable" || cx.style == "keyword") {
|
10253 |
+
cx.marked = "property"
|
10254 |
+
return cont(typeprop)
|
10255 |
+
} else if (value == "?") {
|
10256 |
+
return cont(typeprop)
|
10257 |
+
} else if (type == ":") {
|
10258 |
+
return cont(typeexpr)
|
10259 |
+
}
|
10260 |
+
}
|
10261 |
+
function typearg(type) {
|
10262 |
+
if (type == "variable") return cont(typearg)
|
10263 |
+
else if (type == ":") return cont(typeexpr)
|
10264 |
+
}
|
10265 |
+
function afterType(type, value) {
|
10266 |
+
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
|
10267 |
+
if (value == "|" || type == ".") return cont(typeexpr)
|
10268 |
+
if (type == "[") return cont(expect("]"), afterType)
|
10269 |
+
}
|
10270 |
+
function vardef() {
|
10271 |
+
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
10272 |
+
}
|
10273 |
+
function pattern(type, value) {
|
10274 |
+
if (type == "modifier") return cont(pattern)
|
10275 |
+
if (type == "variable") { register(value); return cont(); }
|
10276 |
+
if (type == "spread") return cont(pattern);
|
10277 |
+
if (type == "[") return contCommasep(pattern, "]");
|
10278 |
+
if (type == "{") return contCommasep(proppattern, "}");
|
10279 |
+
}
|
10280 |
+
function proppattern(type, value) {
|
10281 |
+
if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
|
10282 |
+
register(value);
|
10283 |
+
return cont(maybeAssign);
|
10284 |
+
}
|
10285 |
+
if (type == "variable") cx.marked = "property";
|
10286 |
+
if (type == "spread") return cont(pattern);
|
10287 |
+
if (type == "}") return pass();
|
10288 |
+
return cont(expect(":"), pattern, maybeAssign);
|
10289 |
+
}
|
10290 |
+
function maybeAssign(_type, value) {
|
10291 |
+
if (value == "=") return cont(expressionNoComma);
|
10292 |
+
}
|
10293 |
+
function vardefCont(type) {
|
10294 |
+
if (type == ",") return cont(vardef);
|
10295 |
+
}
|
10296 |
+
function maybeelse(type, value) {
|
10297 |
+
if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
|
10298 |
+
}
|
10299 |
+
function forspec(type) {
|
10300 |
+
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
|
10301 |
+
}
|
10302 |
+
function forspec1(type) {
|
10303 |
+
if (type == "var") return cont(vardef, expect(";"), forspec2);
|
10304 |
+
if (type == ";") return cont(forspec2);
|
10305 |
+
if (type == "variable") return cont(formaybeinof);
|
10306 |
+
return pass(expression, expect(";"), forspec2);
|
10307 |
+
}
|
10308 |
+
function formaybeinof(_type, value) {
|
10309 |
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
10310 |
+
return cont(maybeoperatorComma, forspec2);
|
10311 |
+
}
|
10312 |
+
function forspec2(type, value) {
|
10313 |
+
if (type == ";") return cont(forspec3);
|
10314 |
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
10315 |
+
return pass(expression, expect(";"), forspec3);
|
10316 |
+
}
|
10317 |
+
function forspec3(type) {
|
10318 |
+
if (type != ")") cont(expression);
|
10319 |
+
}
|
10320 |
+
function functiondef(type, value) {
|
10321 |
+
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
10322 |
+
if (type == "variable") {register(value); return cont(functiondef);}
|
10323 |
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
|
10324 |
+
}
|
10325 |
+
function funarg(type) {
|
10326 |
+
if (type == "spread") return cont(funarg);
|
10327 |
+
return pass(pattern, maybetype, maybeAssign);
|
10328 |
+
}
|
10329 |
+
function classExpression(type, value) {
|
10330 |
+
// Class expressions may have an optional name.
|
10331 |
+
if (type == "variable") return className(type, value);
|
10332 |
+
return classNameAfter(type, value);
|
10333 |
+
}
|
10334 |
+
function className(type, value) {
|
10335 |
+
if (type == "variable") {register(value); return cont(classNameAfter);}
|
10336 |
+
}
|
10337 |
+
function classNameAfter(type, value) {
|
10338 |
+
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, classNameAfter)
|
10339 |
+
if (value == "extends" || value == "implements" || (isTS && type == ","))
|
10340 |
+
return cont(isTS ? typeexpr : expression, classNameAfter);
|
10341 |
+
if (type == "{") return cont(pushlex("}"), classBody, poplex);
|
10342 |
+
}
|
10343 |
+
function classBody(type, value) {
|
10344 |
+
if (type == "variable" || cx.style == "keyword") {
|
10345 |
+
if ((value == "async" || value == "static" || value == "get" || value == "set" ||
|
10346 |
+
(isTS && (value == "public" || value == "private" || value == "protected" || value == "readonly" || value == "abstract"))) &&
|
10347 |
+
cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false)) {
|
10348 |
+
cx.marked = "keyword";
|
10349 |
+
return cont(classBody);
|
10350 |
+
}
|
10351 |
+
cx.marked = "property";
|
10352 |
+
return cont(isTS ? classfield : functiondef, classBody);
|
10353 |
+
}
|
10354 |
+
if (type == "[")
|
10355 |
+
return cont(expression, expect("]"), isTS ? classfield : functiondef, classBody)
|
10356 |
+
if (value == "*") {
|
10357 |
+
cx.marked = "keyword";
|
10358 |
+
return cont(classBody);
|
10359 |
+
}
|
10360 |
+
if (type == ";") return cont(classBody);
|
10361 |
+
if (type == "}") return cont();
|
10362 |
+
}
|
10363 |
+
function classfield(type, value) {
|
10364 |
+
if (value == "?") return cont(classfield)
|
10365 |
+
if (type == ":") return cont(typeexpr, maybeAssign)
|
10366 |
+
if (value == "=") return cont(expressionNoComma)
|
10367 |
+
return pass(functiondef)
|
10368 |
+
}
|
10369 |
+
function afterExport(type, value) {
|
10370 |
+
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
|
10371 |
+
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
|
10372 |
+
if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
|
10373 |
+
return pass(statement);
|
10374 |
+
}
|
10375 |
+
function exportField(type, value) {
|
10376 |
+
if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); }
|
10377 |
+
if (type == "variable") return pass(expressionNoComma, exportField);
|
10378 |
+
}
|
10379 |
+
function afterImport(type) {
|
10380 |
+
if (type == "string") return cont();
|
10381 |
+
return pass(importSpec, maybeMoreImports, maybeFrom);
|
10382 |
+
}
|
10383 |
+
function importSpec(type, value) {
|
10384 |
+
if (type == "{") return contCommasep(importSpec, "}");
|
10385 |
+
if (type == "variable") register(value);
|
10386 |
+
if (value == "*") cx.marked = "keyword";
|
10387 |
+
return cont(maybeAs);
|
10388 |
+
}
|
10389 |
+
function maybeMoreImports(type) {
|
10390 |
+
if (type == ",") return cont(importSpec, maybeMoreImports)
|
10391 |
+
}
|
10392 |
+
function maybeAs(_type, value) {
|
10393 |
+
if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
|
10394 |
+
}
|
10395 |
+
function maybeFrom(_type, value) {
|
10396 |
+
if (value == "from") { cx.marked = "keyword"; return cont(expression); }
|
10397 |
+
}
|
10398 |
+
function arrayLiteral(type) {
|
10399 |
+
if (type == "]") return cont();
|
10400 |
+
return pass(commasep(expressionNoComma, "]"));
|
10401 |
+
}
|
10402 |
+
|
10403 |
+
function isContinuedStatement(state, textAfter) {
|
10404 |
+
return state.lastType == "operator" || state.lastType == "," ||
|
10405 |
+
isOperatorChar.test(textAfter.charAt(0)) ||
|
10406 |
+
/[,.]/.test(textAfter.charAt(0));
|
10407 |
+
}
|
10408 |
+
|
10409 |
+
// Interface
|
10410 |
+
|
10411 |
+
return {
|
10412 |
+
startState: function(basecolumn) {
|
10413 |
+
var state = {
|
10414 |
+
tokenize: tokenBase,
|
10415 |
+
lastType: "sof",
|
10416 |
+
cc: [],
|
10417 |
+
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
10418 |
+
localVars: parserConfig.localVars,
|
10419 |
+
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
10420 |
+
indented: basecolumn || 0
|
10421 |
+
};
|
10422 |
+
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
|
10423 |
+
state.globalVars = parserConfig.globalVars;
|
10424 |
+
return state;
|
10425 |
+
},
|
10426 |
+
|
10427 |
+
token: function(stream, state) {
|
10428 |
+
if (stream.sol()) {
|
10429 |
+
if (!state.lexical.hasOwnProperty("align"))
|
10430 |
+
state.lexical.align = false;
|
10431 |
+
state.indented = stream.indentation();
|
10432 |
+
findFatArrow(stream, state);
|
10433 |
+
}
|
10434 |
+
if (state.tokenize != tokenComment && stream.eatSpace()) return null;
|
10435 |
+
var style = state.tokenize(stream, state);
|
10436 |
+
if (type == "comment") return style;
|
10437 |
+
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
|
10438 |
+
return parseJS(state, style, type, content, stream);
|
10439 |
+
},
|
10440 |
+
|
10441 |
+
indent: function(state, textAfter) {
|
10442 |
+
if (state.tokenize == tokenComment) return CodeMirror.Pass;
|
10443 |
+
if (state.tokenize != tokenBase) return 0;
|
10444 |
+
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
|
10445 |
+
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
10446 |
+
if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
|
10447 |
+
var c = state.cc[i];
|
10448 |
+
if (c == poplex) lexical = lexical.prev;
|
10449 |
+
else if (c != maybeelse) break;
|
10450 |
+
}
|
10451 |
+
while ((lexical.type == "stat" || lexical.type == "form") &&
|
10452 |
+
(firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
|
10453 |
+
(top == maybeoperatorComma || top == maybeoperatorNoComma) &&
|
10454 |
+
!/^[,\.=+\-*:?[\(]/.test(textAfter))))
|
10455 |
+
lexical = lexical.prev;
|
10456 |
+
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
|
10457 |
+
lexical = lexical.prev;
|
10458 |
+
var type = lexical.type, closing = firstChar == type;
|
10459 |
+
|
10460 |
+
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
|
10461 |
+
else if (type == "form" && firstChar == "{") return lexical.indented;
|
10462 |
+
else if (type == "form") return lexical.indented + indentUnit;
|
10463 |
+
else if (type == "stat")
|
10464 |
+
return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
|
10465 |
+
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
|
10466 |
+
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
10467 |
+
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
10468 |
+
else return lexical.indented + (closing ? 0 : indentUnit);
|
10469 |
+
},
|
10470 |
+
|
10471 |
+
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
|
10472 |
+
blockCommentStart: jsonMode ? null : "/*",
|
10473 |
+
blockCommentEnd: jsonMode ? null : "*/",
|
10474 |
+
lineComment: jsonMode ? null : "//",
|
10475 |
+
fold: "brace",
|
10476 |
+
closeBrackets: "()[]{}''\"\"``",
|
10477 |
+
|
10478 |
+
helperType: jsonMode ? "json" : "javascript",
|
10479 |
+
jsonldMode: jsonldMode,
|
10480 |
+
jsonMode: jsonMode,
|
10481 |
+
|
10482 |
+
expressionAllowed: expressionAllowed,
|
10483 |
+
skipExpression: function(state) {
|
10484 |
+
var top = state.cc[state.cc.length - 1]
|
10485 |
+
if (top == expression || top == expressionNoComma) state.cc.pop()
|
10486 |
+
}
|
10487 |
+
};
|
10488 |
+
});
|
10489 |
+
|
10490 |
+
CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
|
10491 |
+
|
10492 |
+
CodeMirror.defineMIME("text/javascript", "javascript");
|
10493 |
+
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
10494 |
+
CodeMirror.defineMIME("application/javascript", "javascript");
|
10495 |
+
CodeMirror.defineMIME("application/x-javascript", "javascript");
|
10496 |
+
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
10497 |
+
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
10498 |
+
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
|
10499 |
+
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
|
10500 |
+
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
10501 |
+
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
10502 |
+
|
10503 |
+
});
|
10504 |
+
|
10505 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
10506 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
10507 |
+
|
10508 |
+
(function(mod) {
|
10509 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
10510 |
+
mod(require("../../lib/codemirror"));
|
10511 |
+
else if (typeof define == "function" && define.amd) // AMD
|
10512 |
+
define(["../../lib/codemirror"], mod);
|
10513 |
+
else // Plain browser env
|
10514 |
+
mod(CodeMirror);
|
10515 |
+
})(function(CodeMirror) {
|
10516 |
+
"use strict";
|
10517 |
+
|
10518 |
+
CodeMirror.defineMode("css", function(config, parserConfig) {
|
10519 |
+
var inline = parserConfig.inline
|
10520 |
+
if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
|
10521 |
+
|
10522 |
+
var indentUnit = config.indentUnit,
|
10523 |
+
tokenHooks = parserConfig.tokenHooks,
|
10524 |
+
documentTypes = parserConfig.documentTypes || {},
|
10525 |
+
mediaTypes = parserConfig.mediaTypes || {},
|
10526 |
+
mediaFeatures = parserConfig.mediaFeatures || {},
|
10527 |
+
mediaValueKeywords = parserConfig.mediaValueKeywords || {},
|
10528 |
+
propertyKeywords = parserConfig.propertyKeywords || {},
|
10529 |
+
nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
|
10530 |
+
fontProperties = parserConfig.fontProperties || {},
|
10531 |
+
counterDescriptors = parserConfig.counterDescriptors || {},
|
10532 |
+
colorKeywords = parserConfig.colorKeywords || {},
|
10533 |
+
valueKeywords = parserConfig.valueKeywords || {},
|
10534 |
+
allowNested = parserConfig.allowNested,
|
10535 |
+
lineComment = parserConfig.lineComment,
|
10536 |
+
supportsAtComponent = parserConfig.supportsAtComponent === true;
|
10537 |
+
|
10538 |
+
var type, override;
|
10539 |
+
function ret(style, tp) { type = tp; return style; }
|
10540 |
+
|
10541 |
+
// Tokenizers
|
10542 |
+
|
10543 |
+
function tokenBase(stream, state) {
|
10544 |
+
var ch = stream.next();
|
10545 |
+
if (tokenHooks[ch]) {
|
10546 |
+
var result = tokenHooks[ch](stream, state);
|
10547 |
+
if (result !== false) return result;
|
10548 |
+
}
|
10549 |
+
if (ch == "@") {
|
10550 |
+
stream.eatWhile(/[\w\\\-]/);
|
10551 |
+
return ret("def", stream.current());
|
10552 |
+
} else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
|
10553 |
+
return ret(null, "compare");
|
10554 |
+
} else if (ch == "\"" || ch == "'") {
|
10555 |
+
state.tokenize = tokenString(ch);
|
10556 |
+
return state.tokenize(stream, state);
|
10557 |
+
} else if (ch == "#") {
|
10558 |
+
stream.eatWhile(/[\w\\\-]/);
|
10559 |
+
return ret("atom", "hash");
|
10560 |
+
} else if (ch == "!") {
|
10561 |
+
stream.match(/^\s*\w*/);
|
10562 |
+
return ret("keyword", "important");
|
10563 |
+
} else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
|
10564 |
+
stream.eatWhile(/[\w.%]/);
|
10565 |
+
return ret("number", "unit");
|
10566 |
+
} else if (ch === "-") {
|
10567 |
+
if (/[\d.]/.test(stream.peek())) {
|
10568 |
+
stream.eatWhile(/[\w.%]/);
|
10569 |
+
return ret("number", "unit");
|
10570 |
+
} else if (stream.match(/^-[\w\\\-]+/)) {
|
10571 |
+
stream.eatWhile(/[\w\\\-]/);
|
10572 |
+
if (stream.match(/^\s*:/, false))
|
10573 |
+
return ret("variable-2", "variable-definition");
|
10574 |
+
return ret("variable-2", "variable");
|
10575 |
+
} else if (stream.match(/^\w+-/)) {
|
10576 |
+
return ret("meta", "meta");
|
10577 |
+
}
|
10578 |
+
} else if (/[,+>*\/]/.test(ch)) {
|
10579 |
+
return ret(null, "select-op");
|
10580 |
+
} else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
|
10581 |
+
return ret("qualifier", "qualifier");
|
10582 |
+
} else if (/[:;{}\[\]\(\)]/.test(ch)) {
|
10583 |
+
return ret(null, ch);
|
10584 |
+
} else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) ||
|
10585 |
+
(ch == "d" && stream.match("omain(")) ||
|
10586 |
+
(ch == "r" && stream.match("egexp("))) {
|
10587 |
+
stream.backUp(1);
|
10588 |
+
state.tokenize = tokenParenthesized;
|
10589 |
+
return ret("property", "word");
|
10590 |
+
} else if (/[\w\\\-]/.test(ch)) {
|
10591 |
+
stream.eatWhile(/[\w\\\-]/);
|
10592 |
+
return ret("property", "word");
|
10593 |
+
} else {
|
10594 |
+
return ret(null, null);
|
10595 |
+
}
|
10596 |
+
}
|
10597 |
+
|
10598 |
+
function tokenString(quote) {
|
10599 |
+
return function(stream, state) {
|
10600 |
+
var escaped = false, ch;
|
10601 |
+
while ((ch = stream.next()) != null) {
|
10602 |
+
if (ch == quote && !escaped) {
|
10603 |
+
if (quote == ")") stream.backUp(1);
|
10604 |
+
break;
|
10605 |
+
}
|
10606 |
+
escaped = !escaped && ch == "\\";
|
10607 |
+
}
|
10608 |
+
if (ch == quote || !escaped && quote != ")") state.tokenize = null;
|
10609 |
+
return ret("string", "string");
|
10610 |
+
};
|
10611 |
+
}
|
10612 |
+
|
10613 |
+
function tokenParenthesized(stream, state) {
|
10614 |
+
stream.next(); // Must be '('
|
10615 |
+
if (!stream.match(/\s*[\"\')]/, false))
|
10616 |
+
state.tokenize = tokenString(")");
|
10617 |
+
else
|
10618 |
+
state.tokenize = null;
|
10619 |
+
return ret(null, "(");
|
10620 |
+
}
|
10621 |
+
|
10622 |
+
// Context management
|
10623 |
+
|
10624 |
+
function Context(type, indent, prev) {
|
10625 |
+
this.type = type;
|
10626 |
+
this.indent = indent;
|
10627 |
+
this.prev = prev;
|
10628 |
+
}
|
10629 |
+
|
10630 |
+
function pushContext(state, stream, type, indent) {
|
10631 |
+
state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);
|
10632 |
+
return type;
|
10633 |
+
}
|
10634 |
+
|
10635 |
+
function popContext(state) {
|
10636 |
+
if (state.context.prev)
|
10637 |
+
state.context = state.context.prev;
|
10638 |
+
return state.context.type;
|
10639 |
+
}
|
10640 |
+
|
10641 |
+
function pass(type, stream, state) {
|
10642 |
+
return states[state.context.type](type, stream, state);
|
10643 |
+
}
|
10644 |
+
function popAndPass(type, stream, state, n) {
|
10645 |
+
for (var i = n || 1; i > 0; i--)
|
10646 |
+
state.context = state.context.prev;
|
10647 |
+
return pass(type, stream, state);
|
10648 |
+
}
|
10649 |
+
|
10650 |
+
// Parser
|
10651 |
+
|
10652 |
+
function wordAsValue(stream) {
|
10653 |
+
var word = stream.current().toLowerCase();
|
10654 |
+
if (valueKeywords.hasOwnProperty(word))
|
10655 |
+
override = "atom";
|
10656 |
+
else if (colorKeywords.hasOwnProperty(word))
|
10657 |
+
override = "keyword";
|
10658 |
+
else
|
10659 |
+
override = "variable";
|
10660 |
+
}
|
10661 |
+
|
10662 |
+
var states = {};
|
10663 |
+
|
10664 |
+
states.top = function(type, stream, state) {
|
10665 |
+
if (type == "{") {
|
10666 |
+
return pushContext(state, stream, "block");
|
10667 |
+
} else if (type == "}" && state.context.prev) {
|
10668 |
+
return popContext(state);
|
10669 |
+
} else if (supportsAtComponent && /@component/.test(type)) {
|
10670 |
+
return pushContext(state, stream, "atComponentBlock");
|
10671 |
+
} else if (/^@(-moz-)?document$/.test(type)) {
|
10672 |
+
return pushContext(state, stream, "documentTypes");
|
10673 |
+
} else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {
|
10674 |
+
return pushContext(state, stream, "atBlock");
|
10675 |
+
} else if (/^@(font-face|counter-style)/.test(type)) {
|
10676 |
+
state.stateArg = type;
|
10677 |
+
return "restricted_atBlock_before";
|
10678 |
+
} else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
|
10679 |
+
return "keyframes";
|
10680 |
+
} else if (type && type.charAt(0) == "@") {
|
10681 |
+
return pushContext(state, stream, "at");
|
10682 |
+
} else if (type == "hash") {
|
10683 |
+
override = "builtin";
|
10684 |
+
} else if (type == "word") {
|
10685 |
+
override = "tag";
|
10686 |
+
} else if (type == "variable-definition") {
|
10687 |
+
return "maybeprop";
|
10688 |
+
} else if (type == "interpolation") {
|
10689 |
+
return pushContext(state, stream, "interpolation");
|
10690 |
+
} else if (type == ":") {
|
10691 |
+
return "pseudo";
|
10692 |
+
} else if (allowNested && type == "(") {
|
10693 |
+
return pushContext(state, stream, "parens");
|
10694 |
+
}
|
10695 |
+
return state.context.type;
|
10696 |
+
};
|
10697 |
+
|
10698 |
+
states.block = function(type, stream, state) {
|
10699 |
+
if (type == "word") {
|
10700 |
+
var word = stream.current().toLowerCase();
|
10701 |
+
if (propertyKeywords.hasOwnProperty(word)) {
|
10702 |
+
override = "property";
|
10703 |
+
return "maybeprop";
|
10704 |
+
} else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
|
10705 |
+
override = "string-2";
|
10706 |
+
return "maybeprop";
|
10707 |
+
} else if (allowNested) {
|
10708 |
+
override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
|
10709 |
+
return "block";
|
10710 |
+
} else {
|
10711 |
+
override += " error";
|
10712 |
+
return "maybeprop";
|
10713 |
+
}
|
10714 |
+
} else if (type == "meta") {
|
10715 |
+
return "block";
|
10716 |
+
} else if (!allowNested && (type == "hash" || type == "qualifier")) {
|
10717 |
+
override = "error";
|
10718 |
+
return "block";
|
10719 |
+
} else {
|
10720 |
+
return states.top(type, stream, state);
|
10721 |
+
}
|
10722 |
+
};
|
10723 |
+
|
10724 |
+
states.maybeprop = function(type, stream, state) {
|
10725 |
+
if (type == ":") return pushContext(state, stream, "prop");
|
10726 |
+
return pass(type, stream, state);
|
10727 |
+
};
|
10728 |
+
|
10729 |
+
states.prop = function(type, stream, state) {
|
10730 |
+
if (type == ";") return popContext(state);
|
10731 |
+
if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
|
10732 |
+
if (type == "}" || type == "{") return popAndPass(type, stream, state);
|
10733 |
+
if (type == "(") return pushContext(state, stream, "parens");
|
10734 |
+
|
10735 |
+
if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {
|
10736 |
+
override += " error";
|
10737 |
+
} else if (type == "word") {
|
10738 |
+
wordAsValue(stream);
|
10739 |
+
} else if (type == "interpolation") {
|
10740 |
+
return pushContext(state, stream, "interpolation");
|
10741 |
+
}
|
10742 |
+
return "prop";
|
10743 |
+
};
|
10744 |
+
|
10745 |
+
states.propBlock = function(type, _stream, state) {
|
10746 |
+
if (type == "}") return popContext(state);
|
10747 |
+
if (type == "word") { override = "property"; return "maybeprop"; }
|
10748 |
+
return state.context.type;
|
10749 |
+
};
|
10750 |
+
|
10751 |
+
states.parens = function(type, stream, state) {
|
10752 |
+
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
10753 |
+
if (type == ")") return popContext(state);
|
10754 |
+
if (type == "(") return pushContext(state, stream, "parens");
|
10755 |
+
if (type == "interpolation") return pushContext(state, stream, "interpolation");
|
10756 |
+
if (type == "word") wordAsValue(stream);
|
10757 |
+
return "parens";
|
10758 |
+
};
|
10759 |
+
|
10760 |
+
states.pseudo = function(type, stream, state) {
|
10761 |
+
if (type == "meta") return "pseudo";
|
10762 |
+
|
10763 |
+
if (type == "word") {
|
10764 |
+
override = "variable-3";
|
10765 |
+
return state.context.type;
|
10766 |
+
}
|
10767 |
+
return pass(type, stream, state);
|
10768 |
+
};
|
10769 |
+
|
10770 |
+
states.documentTypes = function(type, stream, state) {
|
10771 |
+
if (type == "word" && documentTypes.hasOwnProperty(stream.current())) {
|
10772 |
+
override = "tag";
|
10773 |
+
return state.context.type;
|
10774 |
+
} else {
|
10775 |
+
return states.atBlock(type, stream, state);
|
10776 |
+
}
|
10777 |
+
};
|
10778 |
+
|
10779 |
+
states.atBlock = function(type, stream, state) {
|
10780 |
+
if (type == "(") return pushContext(state, stream, "atBlock_parens");
|
10781 |
+
if (type == "}" || type == ";") return popAndPass(type, stream, state);
|
10782 |
+
if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
|
10783 |
+
|
10784 |
+
if (type == "interpolation") return pushContext(state, stream, "interpolation");
|
10785 |
+
|
10786 |
+
if (type == "word") {
|
10787 |
+
var word = stream.current().toLowerCase();
|
10788 |
+
if (word == "only" || word == "not" || word == "and" || word == "or")
|
10789 |
+
override = "keyword";
|
10790 |
+
else if (mediaTypes.hasOwnProperty(word))
|
10791 |
+
override = "attribute";
|
10792 |
+
else if (mediaFeatures.hasOwnProperty(word))
|
10793 |
+
override = "property";
|
10794 |
+
else if (mediaValueKeywords.hasOwnProperty(word))
|
10795 |
+
override = "keyword";
|
10796 |
+
else if (propertyKeywords.hasOwnProperty(word))
|
10797 |
+
override = "property";
|
10798 |
+
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
|
10799 |
+
override = "string-2";
|
10800 |
+
else if (valueKeywords.hasOwnProperty(word))
|
10801 |
+
override = "atom";
|
10802 |
+
else if (colorKeywords.hasOwnProperty(word))
|
10803 |
+
override = "keyword";
|
10804 |
+
else
|
10805 |
+
override = "error";
|
10806 |
+
}
|
10807 |
+
return state.context.type;
|
10808 |
+
};
|
10809 |
+
|
10810 |
+
states.atComponentBlock = function(type, stream, state) {
|
10811 |
+
if (type == "}")
|
10812 |
+
return popAndPass(type, stream, state);
|
10813 |
+
if (type == "{")
|
10814 |
+
return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false);
|
10815 |
+
if (type == "word")
|
10816 |
+
override = "error";
|
10817 |
+
return state.context.type;
|
10818 |
+
};
|
10819 |
+
|
10820 |
+
states.atBlock_parens = function(type, stream, state) {
|
10821 |
+
if (type == ")") return popContext(state);
|
10822 |
+
if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
|
10823 |
+
return states.atBlock(type, stream, state);
|
10824 |
+
};
|
10825 |
+
|
10826 |
+
states.restricted_atBlock_before = function(type, stream, state) {
|
10827 |
+
if (type == "{")
|
10828 |
+
return pushContext(state, stream, "restricted_atBlock");
|
10829 |
+
if (type == "word" && state.stateArg == "@counter-style") {
|
10830 |
+
override = "variable";
|
10831 |
+
return "restricted_atBlock_before";
|
10832 |
+
}
|
10833 |
+
return pass(type, stream, state);
|
10834 |
+
};
|
10835 |
+
|
10836 |
+
states.restricted_atBlock = function(type, stream, state) {
|
10837 |
+
if (type == "}") {
|
10838 |
+
state.stateArg = null;
|
10839 |
+
return popContext(state);
|
10840 |
+
}
|
10841 |
+
if (type == "word") {
|
10842 |
+
if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
|
10843 |
+
(state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
|
10844 |
+
override = "error";
|
10845 |
+
else
|
10846 |
+
override = "property";
|
10847 |
+
return "maybeprop";
|
10848 |
+
}
|
10849 |
+
return "restricted_atBlock";
|
10850 |
+
};
|
10851 |
+
|
10852 |
+
states.keyframes = function(type, stream, state) {
|
10853 |
+
if (type == "word") { override = "variable"; return "keyframes"; }
|
10854 |
+
if (type == "{") return pushContext(state, stream, "top");
|
10855 |
+
return pass(type, stream, state);
|
10856 |
+
};
|
10857 |
+
|
10858 |
+
states.at = function(type, stream, state) {
|
10859 |
+
if (type == ";") return popContext(state);
|
10860 |
+
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
10861 |
+
if (type == "word") override = "tag";
|
10862 |
+
else if (type == "hash") override = "builtin";
|
10863 |
+
return "at";
|
10864 |
+
};
|
10865 |
+
|
10866 |
+
states.interpolation = function(type, stream, state) {
|
10867 |
+
if (type == "}") return popContext(state);
|
10868 |
+
if (type == "{" || type == ";") return popAndPass(type, stream, state);
|
10869 |
+
if (type == "word") override = "variable";
|
10870 |
+
else if (type != "variable" && type != "(" && type != ")") override = "error";
|
10871 |
+
return "interpolation";
|
10872 |
+
};
|
10873 |
+
|
10874 |
+
return {
|
10875 |
+
startState: function(base) {
|
10876 |
+
return {tokenize: null,
|
10877 |
+
state: inline ? "block" : "top",
|
10878 |
+
stateArg: null,
|
10879 |
+
context: new Context(inline ? "block" : "top", base || 0, null)};
|
10880 |
+
},
|
10881 |
+
|
10882 |
+
token: function(stream, state) {
|
10883 |
+
if (!state.tokenize && stream.eatSpace()) return null;
|
10884 |
+
var style = (state.tokenize || tokenBase)(stream, state);
|
10885 |
+
if (style && typeof style == "object") {
|
10886 |
+
type = style[1];
|
10887 |
+
style = style[0];
|
10888 |
+
}
|
10889 |
+
override = style;
|
10890 |
+
state.state = states[state.state](type, stream, state);
|
10891 |
+
return override;
|
10892 |
+
},
|
10893 |
+
|
10894 |
+
indent: function(state, textAfter) {
|
10895 |
+
var cx = state.context, ch = textAfter && textAfter.charAt(0);
|
10896 |
+
var indent = cx.indent;
|
10897 |
+
if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
|
10898 |
+
if (cx.prev) {
|
10899 |
+
if (ch == "}" && (cx.type == "block" || cx.type == "top" ||
|
10900 |
+
cx.type == "interpolation" || cx.type == "restricted_atBlock")) {
|
10901 |
+
// Resume indentation from parent context.
|
10902 |
+
cx = cx.prev;
|
10903 |
+
indent = cx.indent;
|
10904 |
+
} else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
|
10905 |
+
ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
|
10906 |
+
// Dedent relative to current context.
|
10907 |
+
indent = Math.max(0, cx.indent - indentUnit);
|
10908 |
+
cx = cx.prev;
|
10909 |
+
}
|
10910 |
+
}
|
10911 |
+
return indent;
|
10912 |
+
},
|
10913 |
+
|
10914 |
+
electricChars: "}",
|
10915 |
+
blockCommentStart: "/*",
|
10916 |
+
blockCommentEnd: "*/",
|
10917 |
+
lineComment: lineComment,
|
10918 |
+
fold: "brace"
|
10919 |
+
};
|
10920 |
+
});
|
10921 |
+
|
10922 |
+
function keySet(array) {
|
10923 |
+
var keys = {};
|
10924 |
+
for (var i = 0; i < array.length; ++i) {
|
10925 |
+
keys[array[i].toLowerCase()] = true;
|
10926 |
+
}
|
10927 |
+
return keys;
|
10928 |
+
}
|
10929 |
+
|
10930 |
+
var documentTypes_ = [
|
10931 |
+
"domain", "regexp", "url", "url-prefix"
|
10932 |
+
], documentTypes = keySet(documentTypes_);
|
10933 |
+
|
10934 |
+
var mediaTypes_ = [
|
10935 |
+
"all", "aural", "braille", "handheld", "print", "projection", "screen",
|
10936 |
+
"tty", "tv", "embossed"
|
10937 |
+
], mediaTypes = keySet(mediaTypes_);
|
10938 |
+
|
10939 |
+
var mediaFeatures_ = [
|
10940 |
+
"width", "min-width", "max-width", "height", "min-height", "max-height",
|
10941 |
+
"device-width", "min-device-width", "max-device-width", "device-height",
|
10942 |
+
"min-device-height", "max-device-height", "aspect-ratio",
|
10943 |
+
"min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
|
10944 |
+
"min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
|
10945 |
+
"max-color", "color-index", "min-color-index", "max-color-index",
|
10946 |
+
"monochrome", "min-monochrome", "max-monochrome", "resolution",
|
10947 |
+
"min-resolution", "max-resolution", "scan", "grid", "orientation",
|
10948 |
+
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
|
10949 |
+
"pointer", "any-pointer", "hover", "any-hover"
|
10950 |
+
], mediaFeatures = keySet(mediaFeatures_);
|
10951 |
+
|
10952 |
+
var mediaValueKeywords_ = [
|
10953 |
+
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
|
10954 |
+
"interlace", "progressive"
|
10955 |
+
], mediaValueKeywords = keySet(mediaValueKeywords_);
|
10956 |
+
|
10957 |
+
var propertyKeywords_ = [
|
10958 |
+
"align-content", "align-items", "align-self", "alignment-adjust",
|
10959 |
+
"alignment-baseline", "anchor-point", "animation", "animation-delay",
|
10960 |
+
"animation-direction", "animation-duration", "animation-fill-mode",
|
10961 |
+
"animation-iteration-count", "animation-name", "animation-play-state",
|
10962 |
+
"animation-timing-function", "appearance", "azimuth", "backface-visibility",
|
10963 |
+
"background", "background-attachment", "background-blend-mode", "background-clip",
|
10964 |
+
"background-color", "background-image", "background-origin", "background-position",
|
10965 |
+
"background-repeat", "background-size", "baseline-shift", "binding",
|
10966 |
+
"bleed", "bookmark-label", "bookmark-level", "bookmark-state",
|
10967 |
+
"bookmark-target", "border", "border-bottom", "border-bottom-color",
|
10968 |
+
"border-bottom-left-radius", "border-bottom-right-radius",
|
10969 |
+
"border-bottom-style", "border-bottom-width", "border-collapse",
|
10970 |
+
"border-color", "border-image", "border-image-outset",
|
10971 |
+
"border-image-repeat", "border-image-slice", "border-image-source",
|
10972 |
+
"border-image-width", "border-left", "border-left-color",
|
10973 |
+
"border-left-style", "border-left-width", "border-radius", "border-right",
|
10974 |
+
"border-right-color", "border-right-style", "border-right-width",
|
10975 |
+
"border-spacing", "border-style", "border-top", "border-top-color",
|
10976 |
+
"border-top-left-radius", "border-top-right-radius", "border-top-style",
|
10977 |
+
"border-top-width", "border-width", "bottom", "box-decoration-break",
|
10978 |
+
"box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
|
10979 |
+
"caption-side", "clear", "clip", "color", "color-profile", "column-count",
|
10980 |
+
"column-fill", "column-gap", "column-rule", "column-rule-color",
|
10981 |
+
"column-rule-style", "column-rule-width", "column-span", "column-width",
|
10982 |
+
"columns", "content", "counter-increment", "counter-reset", "crop", "cue",
|
10983 |
+
"cue-after", "cue-before", "cursor", "direction", "display",
|
10984 |
+
"dominant-baseline", "drop-initial-after-adjust",
|
10985 |
+
"drop-initial-after-align", "drop-initial-before-adjust",
|
10986 |
+
"drop-initial-before-align", "drop-initial-size", "drop-initial-value",
|
10987 |
+
"elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
|
10988 |
+
"flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
|
10989 |
+
"float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings",
|
10990 |
+
"font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust",
|
10991 |
+
"font-stretch", "font-style", "font-synthesis", "font-variant",
|
10992 |
+
"font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
|
10993 |
+
"font-variant-ligatures", "font-variant-numeric", "font-variant-position",
|
10994 |
+
"font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow",
|
10995 |
+
"grid-auto-rows", "grid-column", "grid-column-end", "grid-column-gap",
|
10996 |
+
"grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap",
|
10997 |
+
"grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns",
|
10998 |
+
"grid-template-rows", "hanging-punctuation", "height", "hyphens",
|
10999 |
+
"icon", "image-orientation", "image-rendering", "image-resolution",
|
11000 |
+
"inline-box-align", "justify-content", "left", "letter-spacing",
|
11001 |
+
"line-break", "line-height", "line-stacking", "line-stacking-ruby",
|
11002 |
+
"line-stacking-shift", "line-stacking-strategy", "list-style",
|
11003 |
+
"list-style-image", "list-style-position", "list-style-type", "margin",
|
11004 |
+
"margin-bottom", "margin-left", "margin-right", "margin-top",
|
11005 |
+
"marks", "marquee-direction", "marquee-loop",
|
11006 |
+
"marquee-play-count", "marquee-speed", "marquee-style", "max-height",
|
11007 |
+
"max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
|
11008 |
+
"nav-left", "nav-right", "nav-up", "object-fit", "object-position",
|
11009 |
+
"opacity", "order", "orphans", "outline",
|
11010 |
+
"outline-color", "outline-offset", "outline-style", "outline-width",
|
11011 |
+
"overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
|
11012 |
+
"padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
|
11013 |
+
"page", "page-break-after", "page-break-before", "page-break-inside",
|
11014 |
+
"page-policy", "pause", "pause-after", "pause-before", "perspective",
|
11015 |
+
"perspective-origin", "pitch", "pitch-range", "play-during", "position",
|
11016 |
+
"presentation-level", "punctuation-trim", "quotes", "region-break-after",
|
11017 |
+
"region-break-before", "region-break-inside", "region-fragment",
|
11018 |
+
"rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
|
11019 |
+
"right", "rotation", "rotation-point", "ruby-align", "ruby-overhang",
|
11020 |
+
"ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin",
|
11021 |
+
"shape-outside", "size", "speak", "speak-as", "speak-header",
|
11022 |
+
"speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
|
11023 |
+
"tab-size", "table-layout", "target", "target-name", "target-new",
|
11024 |
+
"target-position", "text-align", "text-align-last", "text-decoration",
|
11025 |
+
"text-decoration-color", "text-decoration-line", "text-decoration-skip",
|
11026 |
+
"text-decoration-style", "text-emphasis", "text-emphasis-color",
|
11027 |
+
"text-emphasis-position", "text-emphasis-style", "text-height",
|
11028 |
+
"text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
|
11029 |
+
"text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
|
11030 |
+
"text-wrap", "top", "transform", "transform-origin", "transform-style",
|
11031 |
+
"transition", "transition-delay", "transition-duration",
|
11032 |
+
"transition-property", "transition-timing-function", "unicode-bidi",
|
11033 |
+
"user-select", "vertical-align", "visibility", "voice-balance", "voice-duration",
|
11034 |
+
"voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
|
11035 |
+
"voice-volume", "volume", "white-space", "widows", "width", "will-change", "word-break",
|
11036 |
+
"word-spacing", "word-wrap", "z-index",
|
11037 |
+
// SVG-specific
|
11038 |
+
"clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
|
11039 |
+
"flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
|
11040 |
+
"color-interpolation", "color-interpolation-filters",
|
11041 |
+
"color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
|
11042 |
+
"marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
|
11043 |
+
"stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
|
11044 |
+
"stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
|
11045 |
+
"baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
|
11046 |
+
"glyph-orientation-vertical", "text-anchor", "writing-mode"
|
11047 |
+
], propertyKeywords = keySet(propertyKeywords_);
|
11048 |
+
|
11049 |
+
var nonStandardPropertyKeywords_ = [
|
11050 |
+
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
|
11051 |
+
"scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
|
11052 |
+
"scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside",
|
11053 |
+
"searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
|
11054 |
+
"searchfield-results-decoration", "zoom"
|
11055 |
+
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
|
11056 |
+
|
11057 |
+
var fontProperties_ = [
|
11058 |
+
"font-family", "src", "unicode-range", "font-variant", "font-feature-settings",
|
11059 |
+
"font-stretch", "font-weight", "font-style"
|
11060 |
+
], fontProperties = keySet(fontProperties_);
|
11061 |
+
|
11062 |
+
var counterDescriptors_ = [
|
11063 |
+
"additive-symbols", "fallback", "negative", "pad", "prefix", "range",
|
11064 |
+
"speak-as", "suffix", "symbols", "system"
|
11065 |
+
], counterDescriptors = keySet(counterDescriptors_);
|
11066 |
+
|
11067 |
+
var colorKeywords_ = [
|
11068 |
+
"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
|
11069 |
+
"bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
|
11070 |
+
"burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
|
11071 |
+
"cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
|
11072 |
+
"darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
|
11073 |
+
"darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
|
11074 |
+
"darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
|
11075 |
+
"deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
|
11076 |
+
"floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
|
11077 |
+
"gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
|
11078 |
+
"hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
|
11079 |
+
"lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
|
11080 |
+
"lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
|
11081 |
+
"lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
|
11082 |
+
"lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
|
11083 |
+
"maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
|
11084 |
+
"mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
11085 |
+
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
|
11086 |
+
"navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
|
11087 |
+
"orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
|
11088 |
+
"papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
|
11089 |
+
"purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
|
11090 |
+
"salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
|
11091 |
+
"slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
|
11092 |
+
"teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
|
11093 |
+
"whitesmoke", "yellow", "yellowgreen"
|
11094 |
+
], colorKeywords = keySet(colorKeywords_);
|
11095 |
+
|
11096 |
+
var valueKeywords_ = [
|
11097 |
+
"above", "absolute", "activeborder", "additive", "activecaption", "afar",
|
11098 |
+
"after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
|
11099 |
+
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
|
11100 |
+
"arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
|
11101 |
+
"avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
|
11102 |
+
"bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
|
11103 |
+
"both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
|
11104 |
+
"buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
|
11105 |
+
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
|
11106 |
+
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
|
11107 |
+
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
|
11108 |
+
"col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
|
11109 |
+
"compact", "condensed", "contain", "content", "contents",
|
11110 |
+
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
|
11111 |
+
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
|
11112 |
+
"decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
|
11113 |
+
"destination-in", "destination-out", "destination-over", "devanagari", "difference",
|
11114 |
+
"disc", "discard", "disclosure-closed", "disclosure-open", "document",
|
11115 |
+
"dot-dash", "dot-dot-dash",
|
11116 |
+
"dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
|
11117 |
+
"element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
|
11118 |
+
"ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
|
11119 |
+
"ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
|
11120 |
+
"ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
|
11121 |
+
"ethiopic-halehame-gez", "ethiopic-halehame-om-et",
|
11122 |
+
"ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
|
11123 |
+
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
|
11124 |
+
"ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
|
11125 |
+
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
|
11126 |
+
"forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove",
|
11127 |
+
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
|
11128 |
+
"help", "hidden", "hide", "higher", "highlight", "highlighttext",
|
11129 |
+
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore",
|
11130 |
+
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
|
11131 |
+
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
|
11132 |
+
"inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert",
|
11133 |
+
"italic", "japanese-formal", "japanese-informal", "justify", "kannada",
|
11134 |
+
"katakana", "katakana-iroha", "keep-all", "khmer",
|
11135 |
+
"korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
|
11136 |
+
"landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten",
|
11137 |
+
"line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
|
11138 |
+
"local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
|
11139 |
+
"lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
|
11140 |
+
"lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "match", "matrix", "matrix3d",
|
11141 |
+
"media-controls-background", "media-current-time-display",
|
11142 |
+
"media-fullscreen-button", "media-mute-button", "media-play-button",
|
11143 |
+
"media-return-to-realtime-button", "media-rewind-button",
|
11144 |
+
"media-seek-back-button", "media-seek-forward-button", "media-slider",
|
11145 |
+
"media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
|
11146 |
+
"media-volume-slider-container", "media-volume-sliderthumb", "medium",
|
11147 |
+
"menu", "menulist", "menulist-button", "menulist-text",
|
11148 |
+
"menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
|
11149 |
+
"mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize",
|
11150 |
+
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
|
11151 |
+
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
|
11152 |
+
"ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote",
|
11153 |
+
"optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
|
11154 |
+
"outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
|
11155 |
+
"painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
|
11156 |
+
"pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
|
11157 |
+
"progress", "push-button", "radial-gradient", "radio", "read-only",
|
11158 |
+
"read-write", "read-write-plaintext-only", "rectangle", "region",
|
11159 |
+
"relative", "repeat", "repeating-linear-gradient",
|
11160 |
+
"repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
|
11161 |
+
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
|
11162 |
+
"rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
|
11163 |
+
"s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
|
11164 |
+
"scroll", "scrollbar", "scroll-position", "se-resize", "searchfield",
|
11165 |
+
"searchfield-cancel-button", "searchfield-decoration",
|
11166 |
+
"searchfield-results-button", "searchfield-results-decoration",
|
11167 |
+
"semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
|
11168 |
+
"simp-chinese-formal", "simp-chinese-informal", "single",
|
11169 |
+
"skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
|
11170 |
+
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
|
11171 |
+
"small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
|
11172 |
+
"source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square",
|
11173 |
+
"square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
|
11174 |
+
"subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table",
|
11175 |
+
"table-caption", "table-cell", "table-column", "table-column-group",
|
11176 |
+
"table-footer-group", "table-header-group", "table-row", "table-row-group",
|
11177 |
+
"tamil",
|
11178 |
+
"telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
|
11179 |
+
"thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
|
11180 |
+
"threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
|
11181 |
+
"tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
|
11182 |
+
"trad-chinese-formal", "trad-chinese-informal", "transform",
|
11183 |
+
"translate", "translate3d", "translateX", "translateY", "translateZ",
|
11184 |
+
"transparent", "ultra-condensed", "ultra-expanded", "underline", "unset", "up",
|
11185 |
+
"upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
|
11186 |
+
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
|
11187 |
+
"var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
|
11188 |
+
"visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
|
11189 |
+
"window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
|
11190 |
+
"xx-large", "xx-small"
|
11191 |
+
], valueKeywords = keySet(valueKeywords_);
|
11192 |
+
|
11193 |
+
var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
|
11194 |
+
.concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
|
11195 |
+
.concat(valueKeywords_);
|
11196 |
+
CodeMirror.registerHelper("hintWords", "css", allWords);
|
11197 |
+
|
11198 |
+
function tokenCComment(stream, state) {
|
11199 |
+
var maybeEnd = false, ch;
|
11200 |
+
while ((ch = stream.next()) != null) {
|
11201 |
+
if (maybeEnd && ch == "/") {
|
11202 |
+
state.tokenize = null;
|
11203 |
+
break;
|
11204 |
+
}
|
11205 |
+
maybeEnd = (ch == "*");
|
11206 |
+
}
|
11207 |
+
return ["comment", "comment"];
|
11208 |
+
}
|
11209 |
+
|
11210 |
+
CodeMirror.defineMIME("text/css", {
|
11211 |
+
documentTypes: documentTypes,
|
11212 |
+
mediaTypes: mediaTypes,
|
11213 |
+
mediaFeatures: mediaFeatures,
|
11214 |
+
mediaValueKeywords: mediaValueKeywords,
|
11215 |
+
propertyKeywords: propertyKeywords,
|
11216 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
11217 |
+
fontProperties: fontProperties,
|
11218 |
+
counterDescriptors: counterDescriptors,
|
11219 |
+
colorKeywords: colorKeywords,
|
11220 |
+
valueKeywords: valueKeywords,
|
11221 |
+
tokenHooks: {
|
11222 |
+
"/": function(stream, state) {
|
11223 |
+
if (!stream.eat("*")) return false;
|
11224 |
+
state.tokenize = tokenCComment;
|
11225 |
+
return tokenCComment(stream, state);
|
11226 |
+
}
|
11227 |
+
},
|
11228 |
+
name: "css"
|
11229 |
+
});
|
11230 |
+
|
11231 |
+
CodeMirror.defineMIME("text/x-scss", {
|
11232 |
+
mediaTypes: mediaTypes,
|
11233 |
+
mediaFeatures: mediaFeatures,
|
11234 |
+
mediaValueKeywords: mediaValueKeywords,
|
11235 |
+
propertyKeywords: propertyKeywords,
|
11236 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
11237 |
+
colorKeywords: colorKeywords,
|
11238 |
+
valueKeywords: valueKeywords,
|
11239 |
+
fontProperties: fontProperties,
|
11240 |
+
allowNested: true,
|
11241 |
+
lineComment: "//",
|
11242 |
+
tokenHooks: {
|
11243 |
+
"/": function(stream, state) {
|
11244 |
+
if (stream.eat("/")) {
|
11245 |
+
stream.skipToEnd();
|
11246 |
+
return ["comment", "comment"];
|
11247 |
+
} else if (stream.eat("*")) {
|
11248 |
+
state.tokenize = tokenCComment;
|
11249 |
+
return tokenCComment(stream, state);
|
11250 |
+
} else {
|
11251 |
+
return ["operator", "operator"];
|
11252 |
+
}
|
11253 |
+
},
|
11254 |
+
":": function(stream) {
|
11255 |
+
if (stream.match(/\s*\{/))
|
11256 |
+
return [null, "{"];
|
11257 |
+
return false;
|
11258 |
+
},
|
11259 |
+
"$": function(stream) {
|
11260 |
+
stream.match(/^[\w-]+/);
|
11261 |
+
if (stream.match(/^\s*:/, false))
|
11262 |
+
return ["variable-2", "variable-definition"];
|
11263 |
+
return ["variable-2", "variable"];
|
11264 |
+
},
|
11265 |
+
"#": function(stream) {
|
11266 |
+
if (!stream.eat("{")) return false;
|
11267 |
+
return [null, "interpolation"];
|
11268 |
+
}
|
11269 |
+
},
|
11270 |
+
name: "css",
|
11271 |
+
helperType: "scss"
|
11272 |
+
});
|
11273 |
+
|
11274 |
+
CodeMirror.defineMIME("text/x-less", {
|
11275 |
+
mediaTypes: mediaTypes,
|
11276 |
+
mediaFeatures: mediaFeatures,
|
11277 |
+
mediaValueKeywords: mediaValueKeywords,
|
11278 |
+
propertyKeywords: propertyKeywords,
|
11279 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
11280 |
+
colorKeywords: colorKeywords,
|
11281 |
+
valueKeywords: valueKeywords,
|
11282 |
+
fontProperties: fontProperties,
|
11283 |
+
allowNested: true,
|
11284 |
+
lineComment: "//",
|
11285 |
+
tokenHooks: {
|
11286 |
+
"/": function(stream, state) {
|
11287 |
+
if (stream.eat("/")) {
|
11288 |
+
stream.skipToEnd();
|
11289 |
+
return ["comment", "comment"];
|
11290 |
+
} else if (stream.eat("*")) {
|
11291 |
+
state.tokenize = tokenCComment;
|
11292 |
+
return tokenCComment(stream, state);
|
11293 |
+
} else {
|
11294 |
+
return ["operator", "operator"];
|
11295 |
+
}
|
11296 |
+
},
|
11297 |
+
"@": function(stream) {
|
11298 |
+
if (stream.eat("{")) return [null, "interpolation"];
|
11299 |
+
if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false;
|
11300 |
+
stream.eatWhile(/[\w\\\-]/);
|
11301 |
+
if (stream.match(/^\s*:/, false))
|
11302 |
+
return ["variable-2", "variable-definition"];
|
11303 |
+
return ["variable-2", "variable"];
|
11304 |
+
},
|
11305 |
+
"&": function() {
|
11306 |
+
return ["atom", "atom"];
|
11307 |
+
}
|
11308 |
+
},
|
11309 |
+
name: "css",
|
11310 |
+
helperType: "less"
|
11311 |
+
});
|
11312 |
+
|
11313 |
+
CodeMirror.defineMIME("text/x-gss", {
|
11314 |
+
documentTypes: documentTypes,
|
11315 |
+
mediaTypes: mediaTypes,
|
11316 |
+
mediaFeatures: mediaFeatures,
|
11317 |
+
propertyKeywords: propertyKeywords,
|
11318 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
11319 |
+
fontProperties: fontProperties,
|
11320 |
+
counterDescriptors: counterDescriptors,
|
11321 |
+
colorKeywords: colorKeywords,
|
11322 |
+
valueKeywords: valueKeywords,
|
11323 |
+
supportsAtComponent: true,
|
11324 |
+
tokenHooks: {
|
11325 |
+
"/": function(stream, state) {
|
11326 |
+
if (!stream.eat("*")) return false;
|
11327 |
+
state.tokenize = tokenCComment;
|
11328 |
+
return tokenCComment(stream, state);
|
11329 |
+
}
|
11330 |
+
},
|
11331 |
+
name: "css",
|
11332 |
+
helperType: "gss"
|
11333 |
+
});
|
11334 |
+
|
11335 |
+
});
|
11336 |
+
|
11337 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
11338 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
11339 |
+
|
11340 |
+
(function(mod) {
|
11341 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
11342 |
+
mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../css/css"));
|
11343 |
+
else if (typeof define == "function" && define.amd) // AMD
|
11344 |
+
define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod);
|
11345 |
+
else // Plain browser env
|
11346 |
+
mod(CodeMirror);
|
11347 |
+
})(function(CodeMirror) {
|
11348 |
+
"use strict";
|
11349 |
+
|
11350 |
+
var defaultTags = {
|
11351 |
+
script: [
|
11352 |
+
["lang", /(javascript|babel)/i, "javascript"],
|
11353 |
+
["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "javascript"],
|
11354 |
+
["type", /./, "text/plain"],
|
11355 |
+
[null, null, "javascript"]
|
11356 |
+
],
|
11357 |
+
style: [
|
11358 |
+
["lang", /^css$/i, "css"],
|
11359 |
+
["type", /^(text\/)?(x-)?(stylesheet|css)$/i, "css"],
|
11360 |
+
["type", /./, "text/plain"],
|
11361 |
+
[null, null, "css"]
|
11362 |
+
]
|
11363 |
+
};
|
11364 |
+
|
11365 |
+
function maybeBackup(stream, pat, style) {
|
11366 |
+
var cur = stream.current(), close = cur.search(pat);
|
11367 |
+
if (close > -1) {
|
11368 |
+
stream.backUp(cur.length - close);
|
11369 |
+
} else if (cur.match(/<\/?$/)) {
|
11370 |
+
stream.backUp(cur.length);
|
11371 |
+
if (!stream.match(pat, false)) stream.match(cur);
|
11372 |
+
}
|
11373 |
+
return style;
|
11374 |
+
}
|
11375 |
+
|
11376 |
+
var attrRegexpCache = {};
|
11377 |
+
function getAttrRegexp(attr) {
|
11378 |
+
var regexp = attrRegexpCache[attr];
|
11379 |
+
if (regexp) return regexp;
|
11380 |
+
return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*");
|
11381 |
+
}
|
11382 |
+
|
11383 |
+
function getAttrValue(text, attr) {
|
11384 |
+
var match = text.match(getAttrRegexp(attr))
|
11385 |
+
return match ? /^\s*(.*?)\s*$/.exec(match[2])[1] : ""
|
11386 |
+
}
|
11387 |
+
|
11388 |
+
function getTagRegexp(tagName, anchored) {
|
11389 |
+
return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i");
|
11390 |
+
}
|
11391 |
+
|
11392 |
+
function addTags(from, to) {
|
11393 |
+
for (var tag in from) {
|
11394 |
+
var dest = to[tag] || (to[tag] = []);
|
11395 |
+
var source = from[tag];
|
11396 |
+
for (var i = source.length - 1; i >= 0; i--)
|
11397 |
+
dest.unshift(source[i])
|
11398 |
+
}
|
11399 |
+
}
|
11400 |
+
|
11401 |
+
function findMatchingMode(tagInfo, tagText) {
|
11402 |
+
for (var i = 0; i < tagInfo.length; i++) {
|
11403 |
+
var spec = tagInfo[i];
|
11404 |
+
if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];
|
11405 |
+
}
|
11406 |
+
}
|
11407 |
+
|
11408 |
+
CodeMirror.defineMode("htmlmixed", function (config, parserConfig) {
|
11409 |
+
var htmlMode = CodeMirror.getMode(config, {
|
11410 |
+
name: "xml",
|
11411 |
+
htmlMode: true,
|
11412 |
+
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
|
11413 |
+
multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag
|
11414 |
+
});
|
11415 |
+
|
11416 |
+
var tags = {};
|
11417 |
+
var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes;
|
11418 |
+
addTags(defaultTags, tags);
|
11419 |
+
if (configTags) addTags(configTags, tags);
|
11420 |
+
if (configScript) for (var i = configScript.length - 1; i >= 0; i--)
|
11421 |
+
tags.script.unshift(["type", configScript[i].matches, configScript[i].mode])
|
11422 |
+
|
11423 |
+
function html(stream, state) {
|
11424 |
+
var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName
|
11425 |
+
if (tag && !/[<>\s\/]/.test(stream.current()) &&
|
11426 |
+
(tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) &&
|
11427 |
+
tags.hasOwnProperty(tagName)) {
|
11428 |
+
state.inTag = tagName + " "
|
11429 |
+
} else if (state.inTag && tag && />$/.test(stream.current())) {
|
11430 |
+
var inTag = /^([\S]+) (.*)/.exec(state.inTag)
|
11431 |
+
state.inTag = null
|
11432 |
+
var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2])
|
11433 |
+
var mode = CodeMirror.getMode(config, modeSpec)
|
11434 |
+
var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);
|
11435 |
+
state.token = function (stream, state) {
|
11436 |
+
if (stream.match(endTagA, false)) {
|
11437 |
+
state.token = html;
|
11438 |
+
state.localState = state.localMode = null;
|
11439 |
+
return null;
|
11440 |
+
}
|
11441 |
+
return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState));
|
11442 |
+
};
|
11443 |
+
state.localMode = mode;
|
11444 |
+
state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, ""));
|
11445 |
+
} else if (state.inTag) {
|
11446 |
+
state.inTag += stream.current()
|
11447 |
+
if (stream.eol()) state.inTag += " "
|
11448 |
+
}
|
11449 |
+
return style;
|
11450 |
+
};
|
11451 |
+
|
11452 |
+
return {
|
11453 |
+
startState: function () {
|
11454 |
+
var state = CodeMirror.startState(htmlMode);
|
11455 |
+
return {token: html, inTag: null, localMode: null, localState: null, htmlState: state};
|
11456 |
+
},
|
11457 |
+
|
11458 |
+
copyState: function (state) {
|
11459 |
+
var local;
|
11460 |
+
if (state.localState) {
|
11461 |
+
local = CodeMirror.copyState(state.localMode, state.localState);
|
11462 |
+
}
|
11463 |
+
return {token: state.token, inTag: state.inTag,
|
11464 |
+
localMode: state.localMode, localState: local,
|
11465 |
+
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
|
11466 |
+
},
|
11467 |
+
|
11468 |
+
token: function (stream, state) {
|
11469 |
+
return state.token(stream, state);
|
11470 |
+
},
|
11471 |
+
|
11472 |
+
indent: function (state, textAfter) {
|
11473 |
+
if (!state.localMode || /^\s*<\//.test(textAfter))
|
11474 |
+
return htmlMode.indent(state.htmlState, textAfter);
|
11475 |
+
else if (state.localMode.indent)
|
11476 |
+
return state.localMode.indent(state.localState, textAfter);
|
11477 |
+
else
|
11478 |
+
return CodeMirror.Pass;
|
11479 |
+
},
|
11480 |
+
|
11481 |
+
innerMode: function (state) {
|
11482 |
+
return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
|
11483 |
+
}
|
11484 |
+
};
|
11485 |
+
}, "xml", "javascript", "css");
|
11486 |
+
|
11487 |
+
CodeMirror.defineMIME("text/html", "htmlmixed");
|
11488 |
+
});
|
11489 |
+
|
11490 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
11491 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
11492 |
+
|
11493 |
+
(function(mod) {
|
11494 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
11495 |
+
mod(require("../../lib/codemirror"));
|
11496 |
+
else if (typeof define == "function" && define.amd) // AMD
|
11497 |
+
define(["../../lib/codemirror"], mod);
|
11498 |
+
else // Plain browser env
|
11499 |
+
mod(CodeMirror);
|
11500 |
+
})(function(CodeMirror) {
|
11501 |
+
"use strict";
|
11502 |
+
|
11503 |
+
function Context(indented, column, type, info, align, prev) {
|
11504 |
+
this.indented = indented;
|
11505 |
+
this.column = column;
|
11506 |
+
this.type = type;
|
11507 |
+
this.info = info;
|
11508 |
+
this.align = align;
|
11509 |
+
this.prev = prev;
|
11510 |
+
}
|
11511 |
+
function pushContext(state, col, type, info) {
|
11512 |
+
var indent = state.indented;
|
11513 |
+
if (state.context && state.context.type == "statement" && type != "statement")
|
11514 |
+
indent = state.context.indented;
|
11515 |
+
return state.context = new Context(indent, col, type, info, null, state.context);
|
11516 |
+
}
|
11517 |
+
function popContext(state) {
|
11518 |
+
var t = state.context.type;
|
11519 |
+
if (t == ")" || t == "]" || t == "}")
|
11520 |
+
state.indented = state.context.indented;
|
11521 |
+
return state.context = state.context.prev;
|
11522 |
+
}
|
11523 |
+
|
11524 |
+
function typeBefore(stream, state, pos) {
|
11525 |
+
if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
|
11526 |
+
if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
|
11527 |
+
if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
|
11528 |
+
}
|
11529 |
+
|
11530 |
+
function isTopScope(context) {
|
11531 |
+
for (;;) {
|
11532 |
+
if (!context || context.type == "top") return true;
|
11533 |
+
if (context.type == "}" && context.prev.info != "namespace") return false;
|
11534 |
+
context = context.prev;
|
11535 |
+
}
|
11536 |
+
}
|
11537 |
+
|
11538 |
+
CodeMirror.defineMode("clike", function(config, parserConfig) {
|
11539 |
+
var indentUnit = config.indentUnit,
|
11540 |
+
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
|
11541 |
+
dontAlignCalls = parserConfig.dontAlignCalls,
|
11542 |
+
keywords = parserConfig.keywords || {},
|
11543 |
+
types = parserConfig.types || {},
|
11544 |
+
builtin = parserConfig.builtin || {},
|
11545 |
+
blockKeywords = parserConfig.blockKeywords || {},
|
11546 |
+
defKeywords = parserConfig.defKeywords || {},
|
11547 |
+
atoms = parserConfig.atoms || {},
|
11548 |
+
hooks = parserConfig.hooks || {},
|
11549 |
+
multiLineStrings = parserConfig.multiLineStrings,
|
11550 |
+
indentStatements = parserConfig.indentStatements !== false,
|
11551 |
+
indentSwitch = parserConfig.indentSwitch !== false,
|
11552 |
+
namespaceSeparator = parserConfig.namespaceSeparator,
|
11553 |
+
isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/,
|
11554 |
+
numberStart = parserConfig.numberStart || /[\d\.]/,
|
11555 |
+
number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,
|
11556 |
+
isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/;
|
11557 |
+
|
11558 |
+
var curPunc, isDefKeyword;
|
11559 |
+
|
11560 |
+
function tokenBase(stream, state) {
|
11561 |
+
var ch = stream.next();
|
11562 |
+
if (hooks[ch]) {
|
11563 |
+
var result = hooks[ch](stream, state);
|
11564 |
+
if (result !== false) return result;
|
11565 |
+
}
|
11566 |
+
if (ch == '"' || ch == "'") {
|
11567 |
+
state.tokenize = tokenString(ch);
|
11568 |
+
return state.tokenize(stream, state);
|
11569 |
+
}
|
11570 |
+
if (isPunctuationChar.test(ch)) {
|
11571 |
+
curPunc = ch;
|
11572 |
+
return null;
|
11573 |
+
}
|
11574 |
+
if (numberStart.test(ch)) {
|
11575 |
+
stream.backUp(1)
|
11576 |
+
if (stream.match(number)) return "number"
|
11577 |
+
stream.next()
|
11578 |
+
}
|
11579 |
+
if (ch == "/") {
|
11580 |
+
if (stream.eat("*")) {
|
11581 |
+
state.tokenize = tokenComment;
|
11582 |
+
return tokenComment(stream, state);
|
11583 |
+
}
|
11584 |
+
if (stream.eat("/")) {
|
11585 |
+
stream.skipToEnd();
|
11586 |
+
return "comment";
|
11587 |
+
}
|
11588 |
+
}
|
11589 |
+
if (isOperatorChar.test(ch)) {
|
11590 |
+
while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {}
|
11591 |
+
return "operator";
|
11592 |
+
}
|
11593 |
+
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
11594 |
+
if (namespaceSeparator) while (stream.match(namespaceSeparator))
|
11595 |
+
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
11596 |
+
|
11597 |
+
var cur = stream.current();
|
11598 |
+
if (contains(keywords, cur)) {
|
11599 |
+
if (contains(blockKeywords, cur)) curPunc = "newstatement";
|
11600 |
+
if (contains(defKeywords, cur)) isDefKeyword = true;
|
11601 |
+
return "keyword";
|
11602 |
+
}
|
11603 |
+
if (contains(types, cur)) return "variable-3";
|
11604 |
+
if (contains(builtin, cur)) {
|
11605 |
+
if (contains(blockKeywords, cur)) curPunc = "newstatement";
|
11606 |
+
return "builtin";
|
11607 |
+
}
|
11608 |
+
if (contains(atoms, cur)) return "atom";
|
11609 |
+
return "variable";
|
11610 |
+
}
|
11611 |
+
|
11612 |
+
function tokenString(quote) {
|
11613 |
+
return function(stream, state) {
|
11614 |
+
var escaped = false, next, end = false;
|
11615 |
+
while ((next = stream.next()) != null) {
|
11616 |
+
if (next == quote && !escaped) {end = true; break;}
|
11617 |
+
escaped = !escaped && next == "\\";
|
11618 |
+
}
|
11619 |
+
if (end || !(escaped || multiLineStrings))
|
11620 |
+
state.tokenize = null;
|
11621 |
+
return "string";
|
11622 |
+
};
|
11623 |
+
}
|
11624 |
+
|
11625 |
+
function tokenComment(stream, state) {
|
11626 |
+
var maybeEnd = false, ch;
|
11627 |
+
while (ch = stream.next()) {
|
11628 |
+
if (ch == "/" && maybeEnd) {
|
11629 |
+
state.tokenize = null;
|
11630 |
+
break;
|
11631 |
+
}
|
11632 |
+
maybeEnd = (ch == "*");
|
11633 |
+
}
|
11634 |
+
return "comment";
|
11635 |
+
}
|
11636 |
+
|
11637 |
+
function maybeEOL(stream, state) {
|
11638 |
+
if (parserConfig.typeFirstDefinitions && stream.eol() && isTopScope(state.context))
|
11639 |
+
state.typeAtEndOfLine = typeBefore(stream, state, stream.pos)
|
11640 |
+
}
|
11641 |
+
|
11642 |
+
// Interface
|
11643 |
+
|
11644 |
+
return {
|
11645 |
+
startState: function(basecolumn) {
|
11646 |
+
return {
|
11647 |
+
tokenize: null,
|
11648 |
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", null, false),
|
11649 |
+
indented: 0,
|
11650 |
+
startOfLine: true,
|
11651 |
+
prevToken: null
|
11652 |
+
};
|
11653 |
+
},
|
11654 |
+
|
11655 |
+
token: function(stream, state) {
|
11656 |
+
var ctx = state.context;
|
11657 |
+
if (stream.sol()) {
|
11658 |
+
if (ctx.align == null) ctx.align = false;
|
11659 |
+
state.indented = stream.indentation();
|
11660 |
+
state.startOfLine = true;
|
11661 |
+
}
|
11662 |
+
if (stream.eatSpace()) { maybeEOL(stream, state); return null; }
|
11663 |
+
curPunc = isDefKeyword = null;
|
11664 |
+
var style = (state.tokenize || tokenBase)(stream, state);
|
11665 |
+
if (style == "comment" || style == "meta") return style;
|
11666 |
+
if (ctx.align == null) ctx.align = true;
|
11667 |
+
|
11668 |
+
if (curPunc == ";" || curPunc == ":" || (curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false)))
|
11669 |
+
while (state.context.type == "statement") popContext(state);
|
11670 |
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
11671 |
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
11672 |
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
11673 |
+
else if (curPunc == "}") {
|
11674 |
+
while (ctx.type == "statement") ctx = popContext(state);
|
11675 |
+
if (ctx.type == "}") ctx = popContext(state);
|
11676 |
+
while (ctx.type == "statement") ctx = popContext(state);
|
11677 |
+
}
|
11678 |
+
else if (curPunc == ctx.type) popContext(state);
|
11679 |
+
else if (indentStatements &&
|
11680 |
+
(((ctx.type == "}" || ctx.type == "top") && curPunc != ";") ||
|
11681 |
+
(ctx.type == "statement" && curPunc == "newstatement"))) {
|
11682 |
+
pushContext(state, stream.column(), "statement", stream.current());
|
11683 |
+
}
|
11684 |
+
|
11685 |
+
if (style == "variable" &&
|
11686 |
+
((state.prevToken == "def" ||
|
11687 |
+
(parserConfig.typeFirstDefinitions && typeBefore(stream, state, stream.start) &&
|
11688 |
+
isTopScope(state.context) && stream.match(/^\s*\(/, false)))))
|
11689 |
+
style = "def";
|
11690 |
+
|
11691 |
+
if (hooks.token) {
|
11692 |
+
var result = hooks.token(stream, state, style);
|
11693 |
+
if (result !== undefined) style = result;
|
11694 |
+
}
|
11695 |
+
|
11696 |
+
if (style == "def" && parserConfig.styleDefs === false) style = "variable";
|
11697 |
+
|
11698 |
+
state.startOfLine = false;
|
11699 |
+
state.prevToken = isDefKeyword ? "def" : style || curPunc;
|
11700 |
+
maybeEOL(stream, state);
|
11701 |
+
return style;
|
11702 |
+
},
|
11703 |
+
|
11704 |
+
indent: function(state, textAfter) {
|
11705 |
+
if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine) return CodeMirror.Pass;
|
11706 |
+
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
11707 |
+
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
|
11708 |
+
if (parserConfig.dontIndentStatements)
|
11709 |
+
while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info))
|
11710 |
+
ctx = ctx.prev
|
11711 |
+
if (hooks.indent) {
|
11712 |
+
var hook = hooks.indent(state, ctx, textAfter);
|
11713 |
+
if (typeof hook == "number") return hook
|
11714 |
+
}
|
11715 |
+
var closing = firstChar == ctx.type;
|
11716 |
+
var switchBlock = ctx.prev && ctx.prev.info == "switch";
|
11717 |
+
if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
|
11718 |
+
while (ctx.type != "top" && ctx.type != "}") ctx = ctx.prev
|
11719 |
+
return ctx.indented
|
11720 |
+
}
|
11721 |
+
if (ctx.type == "statement")
|
11722 |
+
return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
|
11723 |
+
if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
|
11724 |
+
return ctx.column + (closing ? 0 : 1);
|
11725 |
+
if (ctx.type == ")" && !closing)
|
11726 |
+
return ctx.indented + statementIndentUnit;
|
11727 |
+
|
11728 |
+
return ctx.indented + (closing ? 0 : indentUnit) +
|
11729 |
+
(!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0);
|
11730 |
+
},
|
11731 |
+
|
11732 |
+
electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
|
11733 |
+
blockCommentStart: "/*",
|
11734 |
+
blockCommentEnd: "*/",
|
11735 |
+
lineComment: "//",
|
11736 |
+
fold: "brace"
|
11737 |
+
};
|
11738 |
+
});
|
11739 |
+
|
11740 |
+
function words(str) {
|
11741 |
+
var obj = {}, words = str.split(" ");
|
11742 |
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
11743 |
+
return obj;
|
11744 |
+
}
|
11745 |
+
function contains(words, word) {
|
11746 |
+
if (typeof words === "function") {
|
11747 |
+
return words(word);
|
11748 |
+
} else {
|
11749 |
+
return words.propertyIsEnumerable(word);
|
11750 |
+
}
|
11751 |
+
}
|
11752 |
+
var cKeywords = "auto if break case register continue return default do sizeof " +
|
11753 |
+
"static else struct switch extern typedef union for goto while enum const volatile";
|
11754 |
+
var cTypes = "int long char short double float unsigned signed void size_t ptrdiff_t";
|
11755 |
+
|
11756 |
+
function cppHook(stream, state) {
|
11757 |
+
if (!state.startOfLine) return false
|
11758 |
+
for (var ch, next = null; ch = stream.peek();) {
|
11759 |
+
if (ch == "\\" && stream.match(/^.$/)) {
|
11760 |
+
next = cppHook
|
11761 |
+
break
|
11762 |
+
} else if (ch == "/" && stream.match(/^\/[\/\*]/, false)) {
|
11763 |
+
break
|
11764 |
+
}
|
11765 |
+
stream.next()
|
11766 |
+
}
|
11767 |
+
state.tokenize = next
|
11768 |
+
return "meta"
|
11769 |
+
}
|
11770 |
+
|
11771 |
+
function pointerHook(_stream, state) {
|
11772 |
+
if (state.prevToken == "variable-3") return "variable-3";
|
11773 |
+
return false;
|
11774 |
+
}
|
11775 |
+
|
11776 |
+
function cpp14Literal(stream) {
|
11777 |
+
stream.eatWhile(/[\w\.']/);
|
11778 |
+
return "number";
|
11779 |
+
}
|
11780 |
+
|
11781 |
+
function cpp11StringHook(stream, state) {
|
11782 |
+
stream.backUp(1);
|
11783 |
+
// Raw strings.
|
11784 |
+
if (stream.match(/(R|u8R|uR|UR|LR)/)) {
|
11785 |
+
var match = stream.match(/"([^\s\\()]{0,16})\(/);
|
11786 |
+
if (!match) {
|
11787 |
+
return false;
|
11788 |
+
}
|
11789 |
+
state.cpp11RawStringDelim = match[1];
|
11790 |
+
state.tokenize = tokenRawString;
|
11791 |
+
return tokenRawString(stream, state);
|
11792 |
+
}
|
11793 |
+
// Unicode strings/chars.
|
11794 |
+
if (stream.match(/(u8|u|U|L)/)) {
|
11795 |
+
if (stream.match(/["']/, /* eat */ false)) {
|
11796 |
+
return "string";
|
11797 |
+
}
|
11798 |
+
return false;
|
11799 |
+
}
|
11800 |
+
// Ignore this hook.
|
11801 |
+
stream.next();
|
11802 |
+
return false;
|
11803 |
+
}
|
11804 |
+
|
11805 |
+
function cppLooksLikeConstructor(word) {
|
11806 |
+
var lastTwo = /(\w+)::(\w+)$/.exec(word);
|
11807 |
+
return lastTwo && lastTwo[1] == lastTwo[2];
|
11808 |
+
}
|
11809 |
+
|
11810 |
+
// C#-style strings where "" escapes a quote.
|
11811 |
+
function tokenAtString(stream, state) {
|
11812 |
+
var next;
|
11813 |
+
while ((next = stream.next()) != null) {
|
11814 |
+
if (next == '"' && !stream.eat('"')) {
|
11815 |
+
state.tokenize = null;
|
11816 |
+
break;
|
11817 |
+
}
|
11818 |
+
}
|
11819 |
+
return "string";
|
11820 |
+
}
|
11821 |
+
|
11822 |
+
// C++11 raw string literal is <prefix>"<delim>( anything )<delim>", where
|
11823 |
+
// <delim> can be a string up to 16 characters long.
|
11824 |
+
function tokenRawString(stream, state) {
|
11825 |
+
// Escape characters that have special regex meanings.
|
11826 |
+
var delim = state.cpp11RawStringDelim.replace(/[^\w\s]/g, '\\$&');
|
11827 |
+
var match = stream.match(new RegExp(".*?\\)" + delim + '"'));
|
11828 |
+
if (match)
|
11829 |
+
state.tokenize = null;
|
11830 |
+
else
|
11831 |
+
stream.skipToEnd();
|
11832 |
+
return "string";
|
11833 |
+
}
|
11834 |
+
|
11835 |
+
function def(mimes, mode) {
|
11836 |
+
if (typeof mimes == "string") mimes = [mimes];
|
11837 |
+
var words = [];
|
11838 |
+
function add(obj) {
|
11839 |
+
if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop))
|
11840 |
+
words.push(prop);
|
11841 |
+
}
|
11842 |
+
add(mode.keywords);
|
11843 |
+
add(mode.types);
|
11844 |
+
add(mode.builtin);
|
11845 |
+
add(mode.atoms);
|
11846 |
+
if (words.length) {
|
11847 |
+
mode.helperType = mimes[0];
|
11848 |
+
CodeMirror.registerHelper("hintWords", mimes[0], words);
|
11849 |
+
}
|
11850 |
+
|
11851 |
+
for (var i = 0; i < mimes.length; ++i)
|
11852 |
+
CodeMirror.defineMIME(mimes[i], mode);
|
11853 |
+
}
|
11854 |
+
|
11855 |
+
def(["text/x-csrc", "text/x-c", "text/x-chdr"], {
|
11856 |
+
name: "clike",
|
11857 |
+
keywords: words(cKeywords),
|
11858 |
+
types: words(cTypes + " bool _Complex _Bool float_t double_t intptr_t intmax_t " +
|
11859 |
+
"int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t " +
|
11860 |
+
"uint32_t uint64_t"),
|
11861 |
+
blockKeywords: words("case do else for if switch while struct"),
|
11862 |
+
defKeywords: words("struct"),
|
11863 |
+
typeFirstDefinitions: true,
|
11864 |
+
atoms: words("null true false"),
|
11865 |
+
hooks: {"#": cppHook, "*": pointerHook},
|
11866 |
+
modeProps: {fold: ["brace", "include"]}
|
11867 |
+
});
|
11868 |
+
|
11869 |
+
def(["text/x-c++src", "text/x-c++hdr"], {
|
11870 |
+
name: "clike",
|
11871 |
+
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try explicit new " +
|
11872 |
+
"static_cast typeid catch operator template typename class friend private " +
|
11873 |
+
"this using const_cast inline public throw virtual delete mutable protected " +
|
11874 |
+
"alignas alignof constexpr decltype nullptr noexcept thread_local final " +
|
11875 |
+
"static_assert override"),
|
11876 |
+
types: words(cTypes + " bool wchar_t"),
|
11877 |
+
blockKeywords: words("catch class do else finally for if struct switch try while"),
|
11878 |
+
defKeywords: words("class namespace struct enum union"),
|
11879 |
+
typeFirstDefinitions: true,
|
11880 |
+
atoms: words("true false null"),
|
11881 |
+
dontIndentStatements: /^template$/,
|
11882 |
+
hooks: {
|
11883 |
+
"#": cppHook,
|
11884 |
+
"*": pointerHook,
|
11885 |
+
"u": cpp11StringHook,
|
11886 |
+
"U": cpp11StringHook,
|
11887 |
+
"L": cpp11StringHook,
|
11888 |
+
"R": cpp11StringHook,
|
11889 |
+
"0": cpp14Literal,
|
11890 |
+
"1": cpp14Literal,
|
11891 |
+
"2": cpp14Literal,
|
11892 |
+
"3": cpp14Literal,
|
11893 |
+
"4": cpp14Literal,
|
11894 |
+
"5": cpp14Literal,
|
11895 |
+
"6": cpp14Literal,
|
11896 |
+
"7": cpp14Literal,
|
11897 |
+
"8": cpp14Literal,
|
11898 |
+
"9": cpp14Literal,
|
11899 |
+
token: function(stream, state, style) {
|
11900 |
+
if (style == "variable" && stream.peek() == "(" &&
|
11901 |
+
(state.prevToken == ";" || state.prevToken == null ||
|
11902 |
+
state.prevToken == "}") &&
|
11903 |
+
cppLooksLikeConstructor(stream.current()))
|
11904 |
+
return "def";
|
11905 |
+
}
|
11906 |
+
},
|
11907 |
+
namespaceSeparator: "::",
|
11908 |
+
modeProps: {fold: ["brace", "include"]}
|
11909 |
+
});
|
11910 |
+
|
11911 |
+
def("text/x-java", {
|
11912 |
+
name: "clike",
|
11913 |
+
keywords: words("abstract assert break case catch class const continue default " +
|
11914 |
+
"do else enum extends final finally float for goto if implements import " +
|
11915 |
+
"instanceof interface native new package private protected public " +
|
11916 |
+
"return static strictfp super switch synchronized this throw throws transient " +
|
11917 |
+
"try volatile while @interface"),
|
11918 |
+
types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " +
|
11919 |
+
"Integer Long Number Object Short String StringBuffer StringBuilder Void"),
|
11920 |
+
blockKeywords: words("catch class do else finally for if switch try while"),
|
11921 |
+
defKeywords: words("class interface package enum @interface"),
|
11922 |
+
typeFirstDefinitions: true,
|
11923 |
+
atoms: words("true false null"),
|
11924 |
+
number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
|
11925 |
+
hooks: {
|
11926 |
+
"@": function(stream) {
|
11927 |
+
// Don't match the @interface keyword.
|
11928 |
+
if (stream.match('interface', false)) return false;
|
11929 |
+
|
11930 |
+
stream.eatWhile(/[\w\$_]/);
|
11931 |
+
return "meta";
|
11932 |
+
}
|
11933 |
+
},
|
11934 |
+
modeProps: {fold: ["brace", "import"]}
|
11935 |
+
});
|
11936 |
+
|
11937 |
+
def("text/x-csharp", {
|
11938 |
+
name: "clike",
|
11939 |
+
keywords: words("abstract as async await base break case catch checked class const continue" +
|
11940 |
+
" default delegate do else enum event explicit extern finally fixed for" +
|
11941 |
+
" foreach goto if implicit in interface internal is lock namespace new" +
|
11942 |
+
" operator out override params private protected public readonly ref return sealed" +
|
11943 |
+
" sizeof stackalloc static struct switch this throw try typeof unchecked" +
|
11944 |
+
" unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
|
11945 |
+
" global group into join let orderby partial remove select set value var yield"),
|
11946 |
+
types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func" +
|
11947 |
+
" Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32" +
|
11948 |
+
" UInt64 bool byte char decimal double short int long object" +
|
11949 |
+
" sbyte float string ushort uint ulong"),
|
11950 |
+
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
|
11951 |
+
defKeywords: words("class interface namespace struct var"),
|
11952 |
+
typeFirstDefinitions: true,
|
11953 |
+
atoms: words("true false null"),
|
11954 |
+
hooks: {
|
11955 |
+
"@": function(stream, state) {
|
11956 |
+
if (stream.eat('"')) {
|
11957 |
+
state.tokenize = tokenAtString;
|
11958 |
+
return tokenAtString(stream, state);
|
11959 |
+
}
|
11960 |
+
stream.eatWhile(/[\w\$_]/);
|
11961 |
+
return "meta";
|
11962 |
+
}
|
11963 |
+
}
|
11964 |
+
});
|
11965 |
+
|
11966 |
+
function tokenTripleString(stream, state) {
|
11967 |
+
var escaped = false;
|
11968 |
+
while (!stream.eol()) {
|
11969 |
+
if (!escaped && stream.match('"""')) {
|
11970 |
+
state.tokenize = null;
|
11971 |
+
break;
|
11972 |
+
}
|
11973 |
+
escaped = stream.next() == "\\" && !escaped;
|
11974 |
+
}
|
11975 |
+
return "string";
|
11976 |
+
}
|
11977 |
+
|
11978 |
+
def("text/x-scala", {
|
11979 |
+
name: "clike",
|
11980 |
+
keywords: words(
|
11981 |
+
|
11982 |
+
/* scala */
|
11983 |
+
"abstract case catch class def do else extends final finally for forSome if " +
|
11984 |
+
"implicit import lazy match new null object override package private protected return " +
|
11985 |
+
"sealed super this throw trait try type val var while with yield _ " +
|
11986 |
+
|
11987 |
+
/* package scala */
|
11988 |
+
"assert assume require print println printf readLine readBoolean readByte readShort " +
|
11989 |
+
"readChar readInt readLong readFloat readDouble"
|
11990 |
+
),
|
11991 |
+
types: words(
|
11992 |
+
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
|
11993 |
+
"Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable " +
|
11994 |
+
"Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
|
11995 |
+
"Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
|
11996 |
+
"StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " +
|
11997 |
+
|
11998 |
+
/* package java.lang */
|
11999 |
+
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
|
12000 |
+
"Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
|
12001 |
+
"Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
|
12002 |
+
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
|
12003 |
+
),
|
12004 |
+
multiLineStrings: true,
|
12005 |
+
blockKeywords: words("catch class do else finally for forSome if match switch try while"),
|
12006 |
+
defKeywords: words("class def object package trait type val var"),
|
12007 |
+
atoms: words("true false null"),
|
12008 |
+
indentStatements: false,
|
12009 |
+
indentSwitch: false,
|
12010 |
+
isOperatorChar: /[+\-*&%=<>!?|\/#:@]/,
|
12011 |
+
hooks: {
|
12012 |
+
"@": function(stream) {
|
12013 |
+
stream.eatWhile(/[\w\$_]/);
|
12014 |
+
return "meta";
|
12015 |
+
},
|
12016 |
+
'"': function(stream, state) {
|
12017 |
+
if (!stream.match('""')) return false;
|
12018 |
+
state.tokenize = tokenTripleString;
|
12019 |
+
return state.tokenize(stream, state);
|
12020 |
+
},
|
12021 |
+
"'": function(stream) {
|
12022 |
+
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
12023 |
+
return "atom";
|
12024 |
+
},
|
12025 |
+
"=": function(stream, state) {
|
12026 |
+
var cx = state.context
|
12027 |
+
if (cx.type == "}" && cx.align && stream.eat(">")) {
|
12028 |
+
state.context = new Context(cx.indented, cx.column, cx.type, cx.info, null, cx.prev)
|
12029 |
+
return "operator"
|
12030 |
+
} else {
|
12031 |
+
return false
|
12032 |
+
}
|
12033 |
+
}
|
12034 |
+
},
|
12035 |
+
modeProps: {closeBrackets: {triples: '"'}}
|
12036 |
+
});
|
12037 |
+
|
12038 |
+
function tokenKotlinString(tripleString){
|
12039 |
+
return function (stream, state) {
|
12040 |
+
var escaped = false, next, end = false;
|
12041 |
+
while (!stream.eol()) {
|
12042 |
+
if (!tripleString && !escaped && stream.match('"') ) {end = true; break;}
|
12043 |
+
if (tripleString && stream.match('"""')) {end = true; break;}
|
12044 |
+
next = stream.next();
|
12045 |
+
if(!escaped && next == "$" && stream.match('{'))
|
12046 |
+
stream.skipTo("}");
|
12047 |
+
escaped = !escaped && next == "\\" && !tripleString;
|
12048 |
+
}
|
12049 |
+
if (end || !tripleString)
|
12050 |
+
state.tokenize = null;
|
12051 |
+
return "string";
|
12052 |
+
}
|
12053 |
+
}
|
12054 |
+
|
12055 |
+
def("text/x-kotlin", {
|
12056 |
+
name: "clike",
|
12057 |
+
keywords: words(
|
12058 |
+
/*keywords*/
|
12059 |
+
"package as typealias class interface this super val " +
|
12060 |
+
"var fun for is in This throw return " +
|
12061 |
+
"break continue object if else while do try when !in !is as? " +
|
12062 |
+
|
12063 |
+
/*soft keywords*/
|
12064 |
+
"file import where by get set abstract enum open inner override private public internal " +
|
12065 |
+
"protected catch finally out final vararg reified dynamic companion constructor init " +
|
12066 |
+
"sealed field property receiver param sparam lateinit data inline noinline tailrec " +
|
12067 |
+
"external annotation crossinline const operator infix suspend"
|
12068 |
+
),
|
12069 |
+
types: words(
|
12070 |
+
/* package java.lang */
|
12071 |
+
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
|
12072 |
+
"Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
|
12073 |
+
"Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
|
12074 |
+
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
|
12075 |
+
),
|
12076 |
+
intendSwitch: false,
|
12077 |
+
indentStatements: false,
|
12078 |
+
multiLineStrings: true,
|
12079 |
+
number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
|
12080 |
+
blockKeywords: words("catch class do else finally for if where try while enum"),
|
12081 |
+
defKeywords: words("class val var object package interface fun"),
|
12082 |
+
atoms: words("true false null this"),
|
12083 |
+
hooks: {
|
12084 |
+
'"': function(stream, state) {
|
12085 |
+
state.tokenize = tokenKotlinString(stream.match('""'));
|
12086 |
+
return state.tokenize(stream, state);
|
12087 |
+
}
|
12088 |
+
},
|
12089 |
+
modeProps: {closeBrackets: {triples: '"'}}
|
12090 |
+
});
|
12091 |
+
|
12092 |
+
def(["x-shader/x-vertex", "x-shader/x-fragment"], {
|
12093 |
+
name: "clike",
|
12094 |
+
keywords: words("sampler1D sampler2D sampler3D samplerCube " +
|
12095 |
+
"sampler1DShadow sampler2DShadow " +
|
12096 |
+
"const attribute uniform varying " +
|
12097 |
+
"break continue discard return " +
|
12098 |
+
"for while do if else struct " +
|
12099 |
+
"in out inout"),
|
12100 |
+
types: words("float int bool void " +
|
12101 |
+
"vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
|
12102 |
+
"mat2 mat3 mat4"),
|
12103 |
+
blockKeywords: words("for while do if else struct"),
|
12104 |
+
builtin: words("radians degrees sin cos tan asin acos atan " +
|
12105 |
+
"pow exp log exp2 sqrt inversesqrt " +
|
12106 |
+
"abs sign floor ceil fract mod min max clamp mix step smoothstep " +
|
12107 |
+
"length distance dot cross normalize ftransform faceforward " +
|
12108 |
+
"reflect refract matrixCompMult " +
|
12109 |
+
"lessThan lessThanEqual greaterThan greaterThanEqual " +
|
12110 |
+
"equal notEqual any all not " +
|
12111 |
+
"texture1D texture1DProj texture1DLod texture1DProjLod " +
|
12112 |
+
"texture2D texture2DProj texture2DLod texture2DProjLod " +
|
12113 |
+
"texture3D texture3DProj texture3DLod texture3DProjLod " +
|
12114 |
+
"textureCube textureCubeLod " +
|
12115 |
+
"shadow1D shadow2D shadow1DProj shadow2DProj " +
|
12116 |
+
"shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod " +
|
12117 |
+
"dFdx dFdy fwidth " +
|
12118 |
+
"noise1 noise2 noise3 noise4"),
|
12119 |
+
atoms: words("true false " +
|
12120 |
+
"gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex " +
|
12121 |
+
"gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 " +
|
12122 |
+
"gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 " +
|
12123 |
+
"gl_FogCoord gl_PointCoord " +
|
12124 |
+
"gl_Position gl_PointSize gl_ClipVertex " +
|
12125 |
+
"gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor " +
|
12126 |
+
"gl_TexCoord gl_FogFragCoord " +
|
12127 |
+
"gl_FragCoord gl_FrontFacing " +
|
12128 |
+
"gl_FragData gl_FragDepth " +
|
12129 |
+
"gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix " +
|
12130 |
+
"gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse " +
|
12131 |
+
"gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse " +
|
12132 |
+
"gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose " +
|
12133 |
+
"gl_ProjectionMatrixInverseTranspose " +
|
12134 |
+
"gl_ModelViewProjectionMatrixInverseTranspose " +
|
12135 |
+
"gl_TextureMatrixInverseTranspose " +
|
12136 |
+
"gl_NormalScale gl_DepthRange gl_ClipPlane " +
|
12137 |
+
"gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel " +
|
12138 |
+
"gl_FrontLightModelProduct gl_BackLightModelProduct " +
|
12139 |
+
"gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ " +
|
12140 |
+
"gl_FogParameters " +
|
12141 |
+
"gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords " +
|
12142 |
+
"gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats " +
|
12143 |
+
"gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " +
|
12144 |
+
"gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " +
|
12145 |
+
"gl_MaxDrawBuffers"),
|
12146 |
+
indentSwitch: false,
|
12147 |
+
hooks: {"#": cppHook},
|
12148 |
+
modeProps: {fold: ["brace", "include"]}
|
12149 |
+
});
|
12150 |
+
|
12151 |
+
def("text/x-nesc", {
|
12152 |
+
name: "clike",
|
12153 |
+
keywords: words(cKeywords + "as atomic async call command component components configuration event generic " +
|
12154 |
+
"implementation includes interface module new norace nx_struct nx_union post provides " +
|
12155 |
+
"signal task uses abstract extends"),
|
12156 |
+
types: words(cTypes),
|
12157 |
+
blockKeywords: words("case do else for if switch while struct"),
|
12158 |
+
atoms: words("null true false"),
|
12159 |
+
hooks: {"#": cppHook},
|
12160 |
+
modeProps: {fold: ["brace", "include"]}
|
12161 |
+
});
|
12162 |
+
|
12163 |
+
def("text/x-objectivec", {
|
12164 |
+
name: "clike",
|
12165 |
+
keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in " +
|
12166 |
+
"inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),
|
12167 |
+
types: words(cTypes),
|
12168 |
+
atoms: words("YES NO NULL NILL ON OFF true false"),
|
12169 |
+
hooks: {
|
12170 |
+
"@": function(stream) {
|
12171 |
+
stream.eatWhile(/[\w\$]/);
|
12172 |
+
return "keyword";
|
12173 |
+
},
|
12174 |
+
"#": cppHook,
|
12175 |
+
indent: function(_state, ctx, textAfter) {
|
12176 |
+
if (ctx.type == "statement" && /^@\w/.test(textAfter)) return ctx.indented
|
12177 |
+
}
|
12178 |
+
},
|
12179 |
+
modeProps: {fold: "brace"}
|
12180 |
+
});
|
12181 |
+
|
12182 |
+
def("text/x-squirrel", {
|
12183 |
+
name: "clike",
|
12184 |
+
keywords: words("base break clone continue const default delete enum extends function in class" +
|
12185 |
+
" foreach local resume return this throw typeof yield constructor instanceof static"),
|
12186 |
+
types: words(cTypes),
|
12187 |
+
blockKeywords: words("case catch class else for foreach if switch try while"),
|
12188 |
+
defKeywords: words("function local class"),
|
12189 |
+
typeFirstDefinitions: true,
|
12190 |
+
atoms: words("true false null"),
|
12191 |
+
hooks: {"#": cppHook},
|
12192 |
+
modeProps: {fold: ["brace", "include"]}
|
12193 |
+
});
|
12194 |
+
|
12195 |
+
// Ceylon Strings need to deal with interpolation
|
12196 |
+
var stringTokenizer = null;
|
12197 |
+
function tokenCeylonString(type) {
|
12198 |
+
return function(stream, state) {
|
12199 |
+
var escaped = false, next, end = false;
|
12200 |
+
while (!stream.eol()) {
|
12201 |
+
if (!escaped && stream.match('"') &&
|
12202 |
+
(type == "single" || stream.match('""'))) {
|
12203 |
+
end = true;
|
12204 |
+
break;
|
12205 |
+
}
|
12206 |
+
if (!escaped && stream.match('``')) {
|
12207 |
+
stringTokenizer = tokenCeylonString(type);
|
12208 |
+
end = true;
|
12209 |
+
break;
|
12210 |
+
}
|
12211 |
+
next = stream.next();
|
12212 |
+
escaped = type == "single" && !escaped && next == "\\";
|
12213 |
+
}
|
12214 |
+
if (end)
|
12215 |
+
state.tokenize = null;
|
12216 |
+
return "string";
|
12217 |
+
}
|
12218 |
+
}
|
12219 |
+
|
12220 |
+
def("text/x-ceylon", {
|
12221 |
+
name: "clike",
|
12222 |
+
keywords: words("abstracts alias assembly assert assign break case catch class continue dynamic else" +
|
12223 |
+
" exists extends finally for function given if import in interface is let module new" +
|
12224 |
+
" nonempty object of out outer package return satisfies super switch then this throw" +
|
12225 |
+
" try value void while"),
|
12226 |
+
types: function(word) {
|
12227 |
+
// In Ceylon all identifiers that start with an uppercase are types
|
12228 |
+
var first = word.charAt(0);
|
12229 |
+
return (first === first.toUpperCase() && first !== first.toLowerCase());
|
12230 |
+
},
|
12231 |
+
blockKeywords: words("case catch class dynamic else finally for function if interface module new object switch try while"),
|
12232 |
+
defKeywords: words("class dynamic function interface module object package value"),
|
12233 |
+
builtin: words("abstract actual aliased annotation by default deprecated doc final formal late license" +
|
12234 |
+
" native optional sealed see serializable shared suppressWarnings tagged throws variable"),
|
12235 |
+
isPunctuationChar: /[\[\]{}\(\),;\:\.`]/,
|
12236 |
+
isOperatorChar: /[+\-*&%=<>!?|^~:\/]/,
|
12237 |
+
numberStart: /[\d#$]/,
|
12238 |
+
number: /^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,
|
12239 |
+
multiLineStrings: true,
|
12240 |
+
typeFirstDefinitions: true,
|
12241 |
+
atoms: words("true false null larger smaller equal empty finished"),
|
12242 |
+
indentSwitch: false,
|
12243 |
+
styleDefs: false,
|
12244 |
+
hooks: {
|
12245 |
+
"@": function(stream) {
|
12246 |
+
stream.eatWhile(/[\w\$_]/);
|
12247 |
+
return "meta";
|
12248 |
+
},
|
12249 |
+
'"': function(stream, state) {
|
12250 |
+
state.tokenize = tokenCeylonString(stream.match('""') ? "triple" : "single");
|
12251 |
+
return state.tokenize(stream, state);
|
12252 |
+
},
|
12253 |
+
'`': function(stream, state) {
|
12254 |
+
if (!stringTokenizer || !stream.match('`')) return false;
|
12255 |
+
state.tokenize = stringTokenizer;
|
12256 |
+
stringTokenizer = null;
|
12257 |
+
return state.tokenize(stream, state);
|
12258 |
+
},
|
12259 |
+
"'": function(stream) {
|
12260 |
+
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
12261 |
+
return "atom";
|
12262 |
+
},
|
12263 |
+
token: function(_stream, state, style) {
|
12264 |
+
if ((style == "variable" || style == "variable-3") &&
|
12265 |
+
state.prevToken == ".") {
|
12266 |
+
return "variable-2";
|
12267 |
+
}
|
12268 |
+
}
|
12269 |
+
},
|
12270 |
+
modeProps: {
|
12271 |
+
fold: ["brace", "import"],
|
12272 |
+
closeBrackets: {triples: '"'}
|
12273 |
+
}
|
12274 |
+
});
|
12275 |
+
|
12276 |
+
});
|
12277 |
+
|
12278 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
12279 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
12280 |
+
|
12281 |
+
(function(mod) {
|
12282 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
12283 |
+
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../clike/clike"));
|
12284 |
+
else if (typeof define == "function" && define.amd) // AMD
|
12285 |
+
define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../clike/clike"], mod);
|
12286 |
+
else // Plain browser env
|
12287 |
+
mod(CodeMirror);
|
12288 |
+
})(function(CodeMirror) {
|
12289 |
+
"use strict";
|
12290 |
+
|
12291 |
+
function keywords(str) {
|
12292 |
+
var obj = {}, words = str.split(" ");
|
12293 |
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
12294 |
+
return obj;
|
12295 |
+
}
|
12296 |
+
|
12297 |
+
// Helper for phpString
|
12298 |
+
function matchSequence(list, end, escapes) {
|
12299 |
+
if (list.length == 0) return phpString(end);
|
12300 |
+
return function (stream, state) {
|
12301 |
+
var patterns = list[0];
|
12302 |
+
for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) {
|
12303 |
+
state.tokenize = matchSequence(list.slice(1), end);
|
12304 |
+
return patterns[i][1];
|
12305 |
+
}
|
12306 |
+
state.tokenize = phpString(end, escapes);
|
12307 |
+
return "string";
|
12308 |
+
};
|
12309 |
+
}
|
12310 |
+
function phpString(closing, escapes) {
|
12311 |
+
return function(stream, state) { return phpString_(stream, state, closing, escapes); };
|
12312 |
+
}
|
12313 |
+
function phpString_(stream, state, closing, escapes) {
|
12314 |
+
// "Complex" syntax
|
12315 |
+
if (escapes !== false && stream.match("${", false) || stream.match("{$", false)) {
|
12316 |
+
state.tokenize = null;
|
12317 |
+
return "string";
|
12318 |
+
}
|
12319 |
+
|
12320 |
+
// Simple syntax
|
12321 |
+
if (escapes !== false && stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
|
12322 |
+
// After the variable name there may appear array or object operator.
|
12323 |
+
if (stream.match("[", false)) {
|
12324 |
+
// Match array operator
|
12325 |
+
state.tokenize = matchSequence([
|
12326 |
+
[["[", null]],
|
12327 |
+
[[/\d[\w\.]*/, "number"],
|
12328 |
+
[/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"],
|
12329 |
+
[/[\w\$]+/, "variable"]],
|
12330 |
+
[["]", null]]
|
12331 |
+
], closing, escapes);
|
12332 |
+
}
|
12333 |
+
if (stream.match(/\-\>\w/, false)) {
|
12334 |
+
// Match object operator
|
12335 |
+
state.tokenize = matchSequence([
|
12336 |
+
[["->", null]],
|
12337 |
+
[[/[\w]+/, "variable"]]
|
12338 |
+
], closing, escapes);
|
12339 |
+
}
|
12340 |
+
return "variable-2";
|
12341 |
+
}
|
12342 |
+
|
12343 |
+
var escaped = false;
|
12344 |
+
// Normal string
|
12345 |
+
while (!stream.eol() &&
|
12346 |
+
(escaped || escapes === false ||
|
12347 |
+
(!stream.match("{$", false) &&
|
12348 |
+
!stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) {
|
12349 |
+
if (!escaped && stream.match(closing)) {
|
12350 |
+
state.tokenize = null;
|
12351 |
+
state.tokStack.pop(); state.tokStack.pop();
|
12352 |
+
break;
|
12353 |
+
}
|
12354 |
+
escaped = stream.next() == "\\" && !escaped;
|
12355 |
+
}
|
12356 |
+
return "string";
|
12357 |
+
}
|
12358 |
+
|
12359 |
+
var phpKeywords = "abstract and array as break case catch class clone const continue declare default " +
|
12360 |
+
"do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " +
|
12361 |
+
"for foreach function global goto if implements interface instanceof namespace " +
|
12362 |
+
"new or private protected public static switch throw trait try use var while xor " +
|
12363 |
+
"die echo empty exit eval include include_once isset list require require_once return " +
|
12364 |
+
"print unset __halt_compiler self static parent yield insteadof finally";
|
12365 |
+
var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__";
|
12366 |
+
var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";
|
12367 |
+
CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" "));
|
12368 |
+
CodeMirror.registerHelper("wordChars", "php", /[\w$]/);
|
12369 |
+
|
12370 |
+
var phpConfig = {
|
12371 |
+
name: "clike",
|
12372 |
+
helperType: "php",
|
12373 |
+
keywords: keywords(phpKeywords),
|
12374 |
+
blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"),
|
12375 |
+
defKeywords: keywords("class function interface namespace trait"),
|
12376 |
+
atoms: keywords(phpAtoms),
|
12377 |
+
builtin: keywords(phpBuiltin),
|
12378 |
+
multiLineStrings: true,
|
12379 |
+
hooks: {
|
12380 |
+
"$": function(stream) {
|
12381 |
+
stream.eatWhile(/[\w\$_]/);
|
12382 |
+
return "variable-2";
|
12383 |
+
},
|
12384 |
+
"<": function(stream, state) {
|
12385 |
+
var before;
|
12386 |
+
if (before = stream.match(/<<\s*/)) {
|
12387 |
+
var quoted = stream.eat(/['"]/);
|
12388 |
+
stream.eatWhile(/[\w\.]/);
|
12389 |
+
var delim = stream.current().slice(before[0].length + (quoted ? 2 : 1));
|
12390 |
+
if (quoted) stream.eat(quoted);
|
12391 |
+
if (delim) {
|
12392 |
+
(state.tokStack || (state.tokStack = [])).push(delim, 0);
|
12393 |
+
state.tokenize = phpString(delim, quoted != "'");
|
12394 |
+
return "string";
|
12395 |
+
}
|
12396 |
+
}
|
12397 |
+
return false;
|
12398 |
+
},
|
12399 |
+
"#": function(stream) {
|
12400 |
+
while (!stream.eol() && !stream.match("?>", false)) stream.next();
|
12401 |
+
return "comment";
|
12402 |
+
},
|
12403 |
+
"/": function(stream) {
|
12404 |
+
if (stream.eat("/")) {
|
12405 |
+
while (!stream.eol() && !stream.match("?>", false)) stream.next();
|
12406 |
+
return "comment";
|
12407 |
+
}
|
12408 |
+
return false;
|
12409 |
+
},
|
12410 |
+
'"': function(_stream, state) {
|
12411 |
+
(state.tokStack || (state.tokStack = [])).push('"', 0);
|
12412 |
+
state.tokenize = phpString('"');
|
12413 |
+
return "string";
|
12414 |
+
},
|
12415 |
+
"{": function(_stream, state) {
|
12416 |
+
if (state.tokStack && state.tokStack.length)
|
12417 |
+
state.tokStack[state.tokStack.length - 1]++;
|
12418 |
+
return false;
|
12419 |
+
},
|
12420 |
+
"}": function(_stream, state) {
|
12421 |
+
if (state.tokStack && state.tokStack.length > 0 &&
|
12422 |
+
!--state.tokStack[state.tokStack.length - 1]) {
|
12423 |
+
state.tokenize = phpString(state.tokStack[state.tokStack.length - 2]);
|
12424 |
+
}
|
12425 |
+
return false;
|
12426 |
+
}
|
12427 |
+
}
|
12428 |
+
};
|
12429 |
+
|
12430 |
+
CodeMirror.defineMode("php", function(config, parserConfig) {
|
12431 |
+
var htmlMode = CodeMirror.getMode(config, "text/html");
|
12432 |
+
var phpMode = CodeMirror.getMode(config, phpConfig);
|
12433 |
+
|
12434 |
+
function dispatch(stream, state) {
|
12435 |
+
var isPHP = state.curMode == phpMode;
|
12436 |
+
if (stream.sol() && state.pending && state.pending != '"' && state.pending != "'") state.pending = null;
|
12437 |
+
if (!isPHP) {
|
12438 |
+
if (stream.match(/^<\?\w*/)) {
|
12439 |
+
state.curMode = phpMode;
|
12440 |
+
if (!state.php) state.php = CodeMirror.startState(phpMode, htmlMode.indent(state.html, ""))
|
12441 |
+
state.curState = state.php;
|
12442 |
+
return "meta";
|
12443 |
+
}
|
12444 |
+
if (state.pending == '"' || state.pending == "'") {
|
12445 |
+
while (!stream.eol() && stream.next() != state.pending) {}
|
12446 |
+
var style = "string";
|
12447 |
+
} else if (state.pending && stream.pos < state.pending.end) {
|
12448 |
+
stream.pos = state.pending.end;
|
12449 |
+
var style = state.pending.style;
|
12450 |
+
} else {
|
12451 |
+
var style = htmlMode.token(stream, state.curState);
|
12452 |
+
}
|
12453 |
+
if (state.pending) state.pending = null;
|
12454 |
+
var cur = stream.current(), openPHP = cur.search(/<\?/), m;
|
12455 |
+
if (openPHP != -1) {
|
12456 |
+
if (style == "string" && (m = cur.match(/[\'\"]$/)) && !/\?>/.test(cur)) state.pending = m[0];
|
12457 |
+
else state.pending = {end: stream.pos, style: style};
|
12458 |
+
stream.backUp(cur.length - openPHP);
|
12459 |
+
}
|
12460 |
+
return style;
|
12461 |
+
} else if (isPHP && state.php.tokenize == null && stream.match("?>")) {
|
12462 |
+
state.curMode = htmlMode;
|
12463 |
+
state.curState = state.html;
|
12464 |
+
if (!state.php.context.prev) state.php = null;
|
12465 |
+
return "meta";
|
12466 |
+
} else {
|
12467 |
+
return phpMode.token(stream, state.curState);
|
12468 |
+
}
|
12469 |
+
}
|
12470 |
+
|
12471 |
+
return {
|
12472 |
+
startState: function() {
|
12473 |
+
var html = CodeMirror.startState(htmlMode)
|
12474 |
+
var php = parserConfig.startOpen ? CodeMirror.startState(phpMode) : null
|
12475 |
+
return {html: html,
|
12476 |
+
php: php,
|
12477 |
+
curMode: parserConfig.startOpen ? phpMode : htmlMode,
|
12478 |
+
curState: parserConfig.startOpen ? php : html,
|
12479 |
+
pending: null};
|
12480 |
+
},
|
12481 |
+
|
12482 |
+
copyState: function(state) {
|
12483 |
+
var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
|
12484 |
+
php = state.php, phpNew = php && CodeMirror.copyState(phpMode, php), cur;
|
12485 |
+
if (state.curMode == htmlMode) cur = htmlNew;
|
12486 |
+
else cur = phpNew;
|
12487 |
+
return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur,
|
12488 |
+
pending: state.pending};
|
12489 |
+
},
|
12490 |
+
|
12491 |
+
token: dispatch,
|
12492 |
+
|
12493 |
+
indent: function(state, textAfter) {
|
12494 |
+
if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
|
12495 |
+
(state.curMode == phpMode && /^\?>/.test(textAfter)))
|
12496 |
+
return htmlMode.indent(state.html, textAfter);
|
12497 |
+
return state.curMode.indent(state.curState, textAfter);
|
12498 |
+
},
|
12499 |
+
|
12500 |
+
blockCommentStart: "/*",
|
12501 |
+
blockCommentEnd: "*/",
|
12502 |
+
lineComment: "//",
|
12503 |
+
|
12504 |
+
innerMode: function(state) { return {state: state.curState, mode: state.curMode}; }
|
12505 |
+
};
|
12506 |
+
}, "htmlmixed", "clike");
|
12507 |
+
|
12508 |
+
CodeMirror.defineMIME("application/x-httpd-php", "php");
|
12509 |
+
CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
|
12510 |
+
CodeMirror.defineMIME("text/x-php", phpConfig);
|
12511 |
+
});
|
12512 |
+
|
12513 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
12514 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
12515 |
+
/**
|
12516 |
+
* @name CodeMirror Shortcode Mode
|
12517 |
+
* @description WordPress shortcode syntax highlighting for CodeMirror
|
12518 |
+
* @author James Bradford
|
12519 |
+
* @link http://arniebradfo.com
|
12520 |
+
* @license MIT
|
12521 |
+
*
|
12522 |
+
* derived from the CodeMirror xml mode
|
12523 |
+
**/
|
12524 |
+
|
12525 |
+
(function (mod) {
|
12526 |
+
if (typeof exports === 'object' && typeof module === 'object') { // CommonJS
|
12527 |
+
mod(require('../../lib/codemirror'));
|
12528 |
+
} else if (typeof define === 'function' && define.amd) { // AMD
|
12529 |
+
define(['../../lib/codemirror'], mod);
|
12530 |
+
} else { // Plain browser env
|
12531 |
+
mod(CodeMirror);
|
12532 |
+
}
|
12533 |
+
}(function (CodeMirror) {
|
12534 |
+
'use strict';
|
12535 |
+
|
12536 |
+
var shortcodeConfig = {
|
12537 |
+
allowUnquoted: true,
|
12538 |
+
allowMissing: true,
|
12539 |
+
caseFold: true
|
12540 |
+
};
|
12541 |
+
|
12542 |
+
/**
|
12543 |
+
* @link https://codex.wordpress.org/Shortcode_API
|
12544 |
+
**/
|
12545 |
+
|
12546 |
+
CodeMirror.defineMode('shortcode', function (editorConf, config_) {
|
12547 |
+
var indentUnit = editorConf.indentUnit;
|
12548 |
+
var config = {};
|
12549 |
+
var defaults = shortcodeConfig;
|
12550 |
+
for (var propDefault in defaults) config[propDefault] = defaults[propDefault];
|
12551 |
+
for (var propConfig in config_) config[propConfig] = config_[propConfig];
|
12552 |
+
|
12553 |
+
// Return variables for tokenizers
|
12554 |
+
var type, setStyle;
|
12555 |
+
|
12556 |
+
function inText (stream, state) {
|
12557 |
+
var ch = stream.next();
|
12558 |
+
if (ch === '[') {
|
12559 |
+
if (stream.peek() === '[') {
|
12560 |
+
state.tokenize = inEscape;
|
12561 |
+
return 'comment';
|
12562 |
+
}
|
12563 |
+
if (/\s/.test(stream.peek())) return null;
|
12564 |
+
type = stream.eat('/') ? 'closeTag' : 'openTag';
|
12565 |
+
state.tokenize = inTag;
|
12566 |
+
return 'tag bracket';
|
12567 |
+
} else {
|
12568 |
+
stream.eatWhile(/[^\[]/);
|
12569 |
+
return null;
|
12570 |
+
}
|
12571 |
+
}
|
12572 |
+
inText.isInText = true;
|
12573 |
+
|
12574 |
+
function inEscape (stream, state) {
|
12575 |
+
var inEscapeFinal = function (stream, state) {
|
12576 |
+
stream.next();
|
12577 |
+
state.tokenize = inText;
|
12578 |
+
return 'comment';
|
12579 |
+
};
|
12580 |
+
inEscapeFinal.isInEscape = true;
|
12581 |
+
var ch = stream.next();
|
12582 |
+
if (ch === ']' && stream.peek() === ']') state.tokenize = inEscapeFinal;
|
12583 |
+
stream.eatWhile(/[^\]]/);
|
12584 |
+
return null;
|
12585 |
+
}
|
12586 |
+
inEscape.isInEscape = true;
|
12587 |
+
|
12588 |
+
function inTag (stream, state) {
|
12589 |
+
var ch = stream.next();
|
12590 |
+
if (ch === ']' || (ch === '/' && stream.eat(']'))) {
|
12591 |
+
state.tokenize = inText;
|
12592 |
+
type = 'endTag';
|
12593 |
+
return 'tag bracket';
|
12594 |
+
} else if (ch === '=') {
|
12595 |
+
type = 'equals';
|
12596 |
+
return null;
|
12597 |
+
} else if (ch === '[') {
|
12598 |
+
state.tokenize = inText;
|
12599 |
+
state.state = baseState;
|
12600 |
+
state.tagName = state.tagStart = null;
|
12601 |
+
var next = state.tokenize(stream, state);
|
12602 |
+
return next ? next + ' tag error' : 'tag error';
|
12603 |
+
} else if (/[\'\"]/.test(ch)) {
|
12604 |
+
state.tokenize = inAttribute(ch);
|
12605 |
+
state.stringStartCol = stream.column();
|
12606 |
+
return state.tokenize(stream, state);
|
12607 |
+
} else {
|
12608 |
+
stream.match(/^[^\s\u00a0=\[\]\"\']*[^\s\u00a0=\[\]\"\'\/]/);
|
12609 |
+
return 'word';
|
12610 |
+
}
|
12611 |
+
}
|
12612 |
+
|
12613 |
+
function inAttribute (quote) {
|
12614 |
+
var closure = function (stream, state) {
|
12615 |
+
var ch = stream.next();
|
12616 |
+
if (ch === quote) {
|
12617 |
+
state.tokenize = inTag;
|
12618 |
+
return 'string';
|
12619 |
+
} else if (/[\[\]]/.test(ch)) {
|
12620 |
+
return 'string error';
|
12621 |
+
} else {
|
12622 |
+
stream.eatWhile(/[^\[\]\'\"]/);
|
12623 |
+
return 'string';
|
12624 |
+
}
|
12625 |
+
};
|
12626 |
+
closure.isInAttribute = true;
|
12627 |
+
return closure;
|
12628 |
+
}
|
12629 |
+
|
12630 |
+
function Context (state, tagName, startOfLine) {
|
12631 |
+
this.tagHistory = [tagName];
|
12632 |
+
if (state.context) this.tagHistory = this.tagHistory.concat(state.context.tagHistory);
|
12633 |
+
this.prev = state.context;
|
12634 |
+
this.tagName = tagName;
|
12635 |
+
this.indent = state.indented;
|
12636 |
+
this.startOfLine = startOfLine;
|
12637 |
+
}
|
12638 |
+
|
12639 |
+
function popContext (state) {
|
12640 |
+
if (state.context) state.context = state.context.prev;
|
12641 |
+
}
|
12642 |
+
|
12643 |
+
function baseState (type, stream, state) {
|
12644 |
+
if (type === 'openTag') {
|
12645 |
+
state.tagStart = stream.column();
|
12646 |
+
return tagNameState;
|
12647 |
+
} else if (type === 'closeTag') {
|
12648 |
+
return closeTagNameState;
|
12649 |
+
} else {
|
12650 |
+
return baseState;
|
12651 |
+
}
|
12652 |
+
}
|
12653 |
+
|
12654 |
+
function tagNameState (type, stream, state) {
|
12655 |
+
if (type === 'word') {
|
12656 |
+
var cur = stream.current();
|
12657 |
+
if (/[\[\]\/\'\"<>&]/.test(cur)) {
|
12658 |
+
setStyle = 'error';
|
12659 |
+
} else {
|
12660 |
+
state.tagName = stream.current();
|
12661 |
+
setStyle = 'tag';
|
12662 |
+
}
|
12663 |
+
return attrState;
|
12664 |
+
} else {
|
12665 |
+
setStyle = 'error';
|
12666 |
+
return tagNameState;
|
12667 |
+
}
|
12668 |
+
}
|
12669 |
+
|
12670 |
+
function closeTagNameState (type, stream, state) {
|
12671 |
+
if (type === 'word') {
|
12672 |
+
var tagName = stream.current();
|
12673 |
+
if ((state.context && state.context.tagName === tagName) || config.matchClosing === false) {
|
12674 |
+
setStyle = 'tag';
|
12675 |
+
return closeState;
|
12676 |
+
} else if (state.context && state.context.tagHistory.indexOf(tagName) > 0) {
|
12677 |
+
var level = state.context.tagHistory.indexOf(tagName);
|
12678 |
+
for (var i = 0; i < level; i++) popContext(state);
|
12679 |
+
setStyle = 'tag';
|
12680 |
+
return closeState;
|
12681 |
+
} else {
|
12682 |
+
setStyle = 'tag error';
|
12683 |
+
return closeStateErr;
|
12684 |
+
}
|
12685 |
+
} else {
|
12686 |
+
setStyle = 'error';
|
12687 |
+
return closeStateErr;
|
12688 |
+
}
|
12689 |
+
}
|
12690 |
+
|
12691 |
+
function closeState (type, _stream, state) {
|
12692 |
+
if (type !== 'endTag') {
|
12693 |
+
setStyle = 'error';
|
12694 |
+
return closeState;
|
12695 |
+
}
|
12696 |
+
popContext(state);
|
12697 |
+
return baseState;
|
12698 |
+
}
|
12699 |
+
function closeStateErr (type, stream, state) {
|
12700 |
+
setStyle = 'error';
|
12701 |
+
return closeState(type, stream, state);
|
12702 |
+
}
|
12703 |
+
|
12704 |
+
function attrState (type, _stream, state) {
|
12705 |
+
if (type === 'word') {
|
12706 |
+
if (!/^[a-z0-9_\-]+$/i.test(_stream.current())) setStyle = 'error';
|
12707 |
+
else setStyle = 'attribute';
|
12708 |
+
return attrEqState;
|
12709 |
+
} else if (type === 'endTag') {
|
12710 |
+
var tagName = state.tagName;
|
12711 |
+
var tagStart = state.tagStart;
|
12712 |
+
state.tagName = state.tagStart = null;
|
12713 |
+
state.context = new Context(state, tagName, tagStart === state.indented);
|
12714 |
+
return baseState;
|
12715 |
+
}
|
12716 |
+
setStyle = 'error';
|
12717 |
+
return attrState;
|
12718 |
+
}
|
12719 |
+
function attrEqState (type, stream, state) {
|
12720 |
+
if (type === 'equals') return attrValueState;
|
12721 |
+
if (!config.allowMissing) setStyle = 'error';
|
12722 |
+
return attrState(type, stream, state);
|
12723 |
+
}
|
12724 |
+
function attrValueState (type, stream, state) {
|
12725 |
+
if (type === 'string') return attrContinuedState;
|
12726 |
+
if (type === 'word' && config.allowUnquoted) {
|
12727 |
+
setStyle = 'string';
|
12728 |
+
return attrState;
|
12729 |
+
}
|
12730 |
+
setStyle = 'error';
|
12731 |
+
return attrState(type, stream, state);
|
12732 |
+
}
|
12733 |
+
function attrContinuedState (type, stream, state) {
|
12734 |
+
if (type === 'string') return attrContinuedState;
|
12735 |
+
return attrState(type, stream, state);
|
12736 |
+
}
|
12737 |
+
|
12738 |
+
return {
|
12739 |
+
startState: function (baseIndent) {
|
12740 |
+
var state = {
|
12741 |
+
tokenize: inText,
|
12742 |
+
state: baseState,
|
12743 |
+
indented: baseIndent || 0,
|
12744 |
+
tagName: null,
|
12745 |
+
tagStart: null,
|
12746 |
+
context: null
|
12747 |
+
};
|
12748 |
+
if (baseIndent != null) state.baseIndent = baseIndent;
|
12749 |
+
return state;
|
12750 |
+
},
|
12751 |
+
|
12752 |
+
token: function (stream, state) {
|
12753 |
+
if (!state.tagName && stream.sol()) state.indented = stream.indentation();
|
12754 |
+
if (stream.eatSpace()) return null;
|
12755 |
+
type = null;
|
12756 |
+
var style = state.tokenize(stream, state);
|
12757 |
+
if ((style || type) && style !== 'comment') {
|
12758 |
+
setStyle = null;
|
12759 |
+
state.state = state.state(type || style, stream, state);
|
12760 |
+
if (setStyle) style = setStyle === 'error' ? style + ' error' : setStyle;
|
12761 |
+
}
|
12762 |
+
return style;
|
12763 |
+
},
|
12764 |
+
|
12765 |
+
indent: function (state, textAfter, fullLine) {
|
12766 |
+
var context = state.context;
|
12767 |
+
// Indent multi-line strings (e.g. css).
|
12768 |
+
if (state.tokenize.isInAttribute) {
|
12769 |
+
if (state.tagStart === state.indented) {
|
12770 |
+
return state.stringStartCol + 1;
|
12771 |
+
} else {
|
12772 |
+
return state.indented + indentUnit;
|
12773 |
+
}
|
12774 |
+
}
|
12775 |
+
if (state.tokenize !== inTag && state.tokenize !== inText) {
|
12776 |
+
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
12777 |
+
}
|
12778 |
+
// Indent the starts of attribute names.
|
12779 |
+
if (state.tagName) {
|
12780 |
+
if (config.multilineTagIndentPastTag !== false) {
|
12781 |
+
return state.tagStart + state.tagName.length + 2;
|
12782 |
+
} else {
|
12783 |
+
return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
|
12784 |
+
}
|
12785 |
+
}
|
12786 |
+
var tagAfter = textAfter && /^\[(\/)?([\w_:\.-]*)/.exec(textAfter);
|
12787 |
+
if (tagAfter && tagAfter[1]) { // Closing tag spotted
|
12788 |
+
while (context) {
|
12789 |
+
if (context.tagName === tagAfter[2]) {
|
12790 |
+
context = context.prev;
|
12791 |
+
break;
|
12792 |
+
} else {
|
12793 |
+
break;
|
12794 |
+
}
|
12795 |
+
}
|
12796 |
+
}
|
12797 |
+
while (context && context.prev && !context.startOfLine) {
|
12798 |
+
context = context.prev;
|
12799 |
+
}
|
12800 |
+
if (context) {
|
12801 |
+
return context.indent + indentUnit;
|
12802 |
+
} else {
|
12803 |
+
return state.baseIndent || 0;
|
12804 |
+
}
|
12805 |
+
},
|
12806 |
+
|
12807 |
+
skipAttribute: function (state) {
|
12808 |
+
if (state.state === attrValueState) state.state = attrState;
|
12809 |
+
}
|
12810 |
+
};
|
12811 |
+
});
|
12812 |
+
|
12813 |
+
}));
|
12814 |
+
|
12815 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
12816 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
12817 |
+
/**
|
12818 |
+
* @name CodeMirror WordPress Post Editor Mode
|
12819 |
+
* @description Combines htmlmixed with the WordPress' shortcode syntax for use in the WordPress post text editor
|
12820 |
+
* @author James Bradford
|
12821 |
+
* @link http://arniebradfo.com
|
12822 |
+
* @license MIT
|
12823 |
+
*
|
12824 |
+
* derived from the CodeMirror htmlmixed mode
|
12825 |
+
**/
|
12826 |
+
|
12827 |
+
(function (mod) {
|
12828 |
+
if (typeof exports === 'object' && typeof module === 'object') { // CommonJS
|
12829 |
+
mod(require('../../lib/codemirror'), require('../xml/xml'), require('../javascript/javascript'), require('../css/css'));
|
12830 |
+
} else if (typeof define === 'function' && define.amd) { // AMD
|
12831 |
+
define(['../../lib/codemirror', '../xml/xml', '../javascript/javascript', '../css/css'], mod);
|
12832 |
+
} else { // Plain browser env
|
12833 |
+
mod(CodeMirror);
|
12834 |
+
}
|
12835 |
+
}(function (CodeMirror) {
|
12836 |
+
'use strict';
|
12837 |
+
|
12838 |
+
CodeMirror.defineMode('wordpresspost', function (config, parserConfig) {
|
12839 |
+
|
12840 |
+
var htmlmixedMode = CodeMirror.getMode(config, {
|
12841 |
+
name: 'htmlmixed',
|
12842 |
+
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
|
12843 |
+
multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag
|
12844 |
+
});
|
12845 |
+
|
12846 |
+
var shortcodeMode = CodeMirror.getMode(config, {
|
12847 |
+
name: 'shortcode',
|
12848 |
+
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
|
12849 |
+
multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag
|
12850 |
+
});
|
12851 |
+
|
12852 |
+
function shortcodeToken (stream, state) {
|
12853 |
+
state.isInShortcode = true;
|
12854 |
+
var style = shortcodeMode.token(stream, state.shortcodeState);
|
12855 |
+
var inText = state.shortcodeState.tokenize.isInText;
|
12856 |
+
var inEscape = state.shortcodeState.tokenize.isInEscape;
|
12857 |
+
if (inText) {
|
12858 |
+
state.token = htmlmixedToken;
|
12859 |
+
} else if (inEscape && /\]/.test(stream.current())) {
|
12860 |
+
var cur = stream.current();
|
12861 |
+
var open = cur.search(/\]/);
|
12862 |
+
stream.backUp(cur.length - open - 1);
|
12863 |
+
if (stream.peek() !== ']') state.token = htmlmixedToken;
|
12864 |
+
}
|
12865 |
+
return style;
|
12866 |
+
}
|
12867 |
+
|
12868 |
+
function htmlmixedToken (stream, state) {
|
12869 |
+
state.isInShortcode = false;
|
12870 |
+
var style = htmlmixedMode.token(stream, state.htmlmixedState);
|
12871 |
+
var inText = state.htmlmixedState.htmlState.tokenize.isInText;
|
12872 |
+
if (inText && /\[/.test(stream.current()) && !state.htmlmixedState.localState && style === null) {
|
12873 |
+
var cur = stream.current();
|
12874 |
+
var open = cur.search(/\[/);
|
12875 |
+
stream.backUp(cur.length - open);
|
12876 |
+
if (state.shortcodeState == null) { // ===null or ===undefined
|
12877 |
+
state.shortcodeState = shortcodeMode.startState(htmlmixedMode.indent(state.htmlmixedState, ''));
|
12878 |
+
}
|
12879 |
+
state.token = shortcodeToken;
|
12880 |
+
} else if (inText && /<!\-\-more|<!\-\-noteaser\-\->/.test(stream.current()) && !state.htmlmixedState.localState && style === 'comment') {
|
12881 |
+
stream.backUp(stream.current().length);
|
12882 |
+
state.token = moreToken;
|
12883 |
+
}
|
12884 |
+
return style;
|
12885 |
+
}
|
12886 |
+
|
12887 |
+
function moreToken (stream, state) {
|
12888 |
+
if (stream.match('<!--more')) {
|
12889 |
+
return 'meta';
|
12890 |
+
} else if (stream.match('-->') || stream.match('<!--noteaser-->')) {
|
12891 |
+
state.token = htmlmixedToken;
|
12892 |
+
return 'meta';
|
12893 |
+
} else {
|
12894 |
+
stream.eatWhile(/[^\-/]/);
|
12895 |
+
return 'string';
|
12896 |
+
}
|
12897 |
+
}
|
12898 |
+
|
12899 |
+
return {
|
12900 |
+
startState: function () {
|
12901 |
+
var state = htmlmixedMode.startState();
|
12902 |
+
return {
|
12903 |
+
token: htmlmixedToken,
|
12904 |
+
isInShortcode: false,
|
12905 |
+
shortcodeState: null,
|
12906 |
+
htmlmixedState: state
|
12907 |
+
};
|
12908 |
+
},
|
12909 |
+
|
12910 |
+
copyState: function (state) {
|
12911 |
+
var shortcodeStateProx;
|
12912 |
+
if (state.shortcodeState) {
|
12913 |
+
shortcodeStateProx = CodeMirror.copyState(shortcodeMode, state.shortcodeState);
|
12914 |
+
}
|
12915 |
+
return {
|
12916 |
+
token: state.token,
|
12917 |
+
shortcodeState: shortcodeStateProx,
|
12918 |
+
htmlmixedState: CodeMirror.copyState(htmlmixedMode, state.htmlmixedState)
|
12919 |
+
};
|
12920 |
+
},
|
12921 |
+
|
12922 |
+
token: function (stream, state) {
|
12923 |
+
return state.token(stream, state);
|
12924 |
+
},
|
12925 |
+
|
12926 |
+
indent: function (state, textAfter) {
|
12927 |
+
if (!state.isInShortcode) return htmlmixedMode.indent(state.htmlmixedState, textAfter);
|
12928 |
+
else if (state.isInShortcode) return shortcodeMode.indent(state.shortcodeState, textAfter);
|
12929 |
+
else return CodeMirror.Pass;
|
12930 |
+
},
|
12931 |
+
|
12932 |
+
innerMode: function (state) {
|
12933 |
+
if (state.isInShortcode) {
|
12934 |
+
return {
|
12935 |
+
state: state.shortcodeState,
|
12936 |
+
mode: shortcodeMode
|
12937 |
+
};
|
12938 |
+
} else {
|
12939 |
+
return {
|
12940 |
+
state: state.htmlmixedState,
|
12941 |
+
mode: htmlmixedMode
|
12942 |
+
};
|
12943 |
+
}
|
12944 |
+
}
|
12945 |
+
};
|
12946 |
+
}, 'htmlmixed', 'shortcode');
|
12947 |
+
|
12948 |
+
}));
|
12949 |
+
|
12950 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
12951 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
12952 |
+
|
12953 |
+
(function(mod) {
|
12954 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
12955 |
+
mod(require("../../lib/codemirror"));
|
12956 |
+
else if (typeof define == "function" && define.amd) // AMD
|
12957 |
+
define(["../../lib/codemirror"], mod);
|
12958 |
+
else // Plain browser env
|
12959 |
+
mod(CodeMirror);
|
12960 |
+
})(function(CodeMirror) {
|
12961 |
+
"use strict";
|
12962 |
+
var WRAP_CLASS = "CodeMirror-activeline";
|
12963 |
+
var BACK_CLASS = "CodeMirror-activeline-background";
|
12964 |
+
var GUTT_CLASS = "CodeMirror-activeline-gutter";
|
12965 |
+
|
12966 |
+
CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
|
12967 |
+
var prev = old == CodeMirror.Init ? false : old;
|
12968 |
+
if (val == prev) return
|
12969 |
+
if (prev) {
|
12970 |
+
cm.off("beforeSelectionChange", selectionChange);
|
12971 |
+
clearActiveLines(cm);
|
12972 |
+
delete cm.state.activeLines;
|
12973 |
+
}
|
12974 |
+
if (val) {
|
12975 |
+
cm.state.activeLines = [];
|
12976 |
+
updateActiveLines(cm, cm.listSelections());
|
12977 |
+
cm.on("beforeSelectionChange", selectionChange);
|
12978 |
+
}
|
12979 |
+
});
|
12980 |
+
|
12981 |
+
function clearActiveLines(cm) {
|
12982 |
+
for (var i = 0; i < cm.state.activeLines.length; i++) {
|
12983 |
+
cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS);
|
12984 |
+
cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS);
|
12985 |
+
cm.removeLineClass(cm.state.activeLines[i], "gutter", GUTT_CLASS);
|
12986 |
+
}
|
12987 |
+
}
|
12988 |
+
|
12989 |
+
function sameArray(a, b) {
|
12990 |
+
if (a.length != b.length) return false;
|
12991 |
+
for (var i = 0; i < a.length; i++)
|
12992 |
+
if (a[i] != b[i]) return false;
|
12993 |
+
return true;
|
12994 |
+
}
|
12995 |
+
|
12996 |
+
function updateActiveLines(cm, ranges) {
|
12997 |
+
var active = [];
|
12998 |
+
for (var i = 0; i < ranges.length; i++) {
|
12999 |
+
var range = ranges[i];
|
13000 |
+
var option = cm.getOption("styleActiveLine");
|
13001 |
+
if (typeof option == "object" && option.nonEmpty ? range.anchor.line != range.head.line : !range.empty())
|
13002 |
+
continue
|
13003 |
+
var line = cm.getLineHandleVisualStart(range.head.line);
|
13004 |
+
if (active[active.length - 1] != line) active.push(line);
|
13005 |
+
}
|
13006 |
+
if (sameArray(cm.state.activeLines, active)) return;
|
13007 |
+
cm.operation(function() {
|
13008 |
+
clearActiveLines(cm);
|
13009 |
+
for (var i = 0; i < active.length; i++) {
|
13010 |
+
cm.addLineClass(active[i], "wrap", WRAP_CLASS);
|
13011 |
+
cm.addLineClass(active[i], "background", BACK_CLASS);
|
13012 |
+
cm.addLineClass(active[i], "gutter", GUTT_CLASS);
|
13013 |
+
}
|
13014 |
+
cm.state.activeLines = active;
|
13015 |
+
});
|
13016 |
+
}
|
13017 |
+
|
13018 |
+
function selectionChange(cm, sel) {
|
13019 |
+
updateActiveLines(cm, sel.ranges);
|
13020 |
+
}
|
13021 |
+
});
|
13022 |
+
|
13023 |
+
/**
|
13024 |
+
* @name HTML Editor Syntax Highlighter
|
13025 |
+
* @author James Bradford
|
13026 |
+
* @link http://arniebradfo.com/
|
13027 |
+
* @author Petr Mukhortov
|
13028 |
+
* @link http://mukhortov.com/
|
13029 |
+
* @since 2.0.0
|
13030 |
+
*/
|
13031 |
+
|
13032 |
+
// console.log(window.heshOptions); // from wordpress php
|
13033 |
+
|
13034 |
+
(function (
|
13035 |
+
document,
|
13036 |
+
window,
|
13037 |
+
CodeMirror,
|
13038 |
+
$,
|
13039 |
+
heshOptions
|
13040 |
+
) {
|
13041 |
+
'use strict';
|
13042 |
+
|
13043 |
+
|
13044 |
+
|
13045 |
+
// ELEMENTS //
|
13046 |
+
var editor;
|
13047 |
+
var scrollPanel;
|
13048 |
+
var settingsPanel = document.getElementById('CodeMirror-settings');
|
13049 |
+
var theForm = document.getElementById('CodeMirror-settings__form');
|
13050 |
+
var toolbar = document.getElementById('ed_toolbar');
|
13051 |
+
var target = document.getElementById('content') || document.getElementById('newcontent');
|
13052 |
+
var tabText = document.getElementById('content-html');
|
13053 |
+
var tabVisual = document.getElementById('content-tmce');
|
13054 |
+
var publishButton = document.getElementById('save-post') || document.getElementById('publish');
|
13055 |
+
var postID = document.getElementById('post_ID') != null ? document.getElementById('post_ID').value : 0;
|
13056 |
+
var fullHeightToggle = document.getElementById('editor-expand-toggle');
|
13057 |
+
|
13058 |
+
var state = {
|
13059 |
+
isVisualEnabled: document.getElementById('content-tmce') != null,
|
13060 |
+
isThemeOrPlugin: document.getElementById('newcontent') != null,
|
13061 |
+
|
13062 |
+
isActive: function () {
|
13063 |
+
return document.getElementsByClassName('CodeMirror')[0] != null;
|
13064 |
+
},
|
13065 |
+
|
13066 |
+
isVisualActive: function () {
|
13067 |
+
return document.getElementsByClassName('tmce-active')[0] != null;
|
13068 |
+
},
|
13069 |
+
|
13070 |
+
isFullHeight: function () {
|
13071 |
+
if (!fullHeightToggle) return false;
|
13072 |
+
return fullHeightToggle.checked;
|
13073 |
+
},
|
13074 |
+
|
13075 |
+
previousSettingsPosition: 'none',
|
13076 |
+
settingsPosition: function () { // : 'top' | 'middle' | 'bottom' | 'normal' | 'none'
|
13077 |
+
var position;
|
13078 |
+
var self = this;
|
13079 |
+
if (!toolbar) {
|
13080 |
+
position = 'none';
|
13081 |
+
} else if (toolbar.style.position === 'absolute') {
|
13082 |
+
if (toolbar.style.top === '0px') position = 'top';
|
13083 |
+
else position = 'bottom';
|
13084 |
+
} else if (toolbar.style.position === 'fixed') {
|
13085 |
+
position = 'middle';
|
13086 |
+
} else {
|
13087 |
+
position = 'normal';
|
13088 |
+
}
|
13089 |
+
window.setTimeout(function () {
|
13090 |
+
self.previousSettingsPosition = position;
|
13091 |
+
}, 0);
|
13092 |
+
return position;
|
13093 |
+
},
|
13094 |
+
|
13095 |
+
charWidth: 0
|
13096 |
+
};
|
13097 |
+
|
13098 |
+
var options = {
|
13099 |
+
mode: 'wordpresspost',
|
13100 |
+
tabMode: 'indent',
|
13101 |
+
matchBrackets: true,
|
13102 |
+
indentWithTabs: true,
|
13103 |
+
enterMode: 'keep',
|
13104 |
+
autofocus: true,
|
13105 |
+
styleActiveLine: true,
|
13106 |
+
electricChars: false,
|
13107 |
+
viewportMargin: 10,
|
13108 |
+
extraKeys: {
|
13109 |
+
'F11': function () {
|
13110 |
+
toggleFullscreen();
|
13111 |
+
},
|
13112 |
+
'Esc': function () {
|
13113 |
+
toggleFullscreen();
|
13114 |
+
},
|
13115 |
+
'Ctrl-S': function () {
|
13116 |
+
publishButton.click();
|
13117 |
+
},
|
13118 |
+
'Cmd-S': function () {
|
13119 |
+
publishButton.click();
|
13120 |
+
}
|
13121 |
+
},
|
13122 |
+
};
|
13123 |
+
|
13124 |
+
function updateOptions() {
|
13125 |
+
options.theme = heshOptions.theme;
|
13126 |
+
options.lineNumbers = !!heshOptions.lineNumbers;
|
13127 |
+
options.tabSize = options.indentUnit = +heshOptions.tabSize; // indentUnit must always equal tabSize
|
13128 |
+
options.lineWrapping = !!heshOptions.lineWrapping;
|
13129 |
+
}
|
13130 |
+
|
13131 |
+
|
13132 |
+
|
13133 |
+
function throttleAnimationFrame (callback) {
|
13134 |
+
var wait = false;
|
13135 |
+
return function () {
|
13136 |
+
var context = this, args = arguments;
|
13137 |
+
if (!wait) {
|
13138 |
+
callback.apply(context, args);
|
13139 |
+
wait = true;
|
13140 |
+
window.requestAnimationFrame(function () {
|
13141 |
+
window.requestAnimationFrame(function () {
|
13142 |
+
wait = false;
|
13143 |
+
});
|
13144 |
+
});
|
13145 |
+
}
|
13146 |
+
};
|
13147 |
+
}
|
13148 |
+
|
13149 |
+
|
13150 |
+
|
13151 |
+
function setSettingsPositionTopValues() {
|
13152 |
+
for (var index = 0; index < settingsPanel.children.length; index++) {
|
13153 |
+
var element = settingsPanel.children[index];
|
13154 |
+
element.style.position = '';
|
13155 |
+
element.style.top = '';
|
13156 |
+
element.style.left = '';
|
13157 |
+
element.style.right = '';
|
13158 |
+
element.style.width = '';
|
13159 |
+
}
|
13160 |
+
}
|
13161 |
+
|
13162 |
+
function setSettingsPositionMiddleValues() {
|
13163 |
+
var toolbarRect = toolbar.getBoundingClientRect();
|
13164 |
+
for (var index = 0; index < settingsPanel.children.length; index++) {
|
13165 |
+
var element = settingsPanel.children[index];
|
13166 |
+
element.style.position = 'fixed';
|
13167 |
+
element.style.top = toolbarRect.bottom + 'px';
|
13168 |
+
element.style.right = (document.documentElement.getBoundingClientRect().width - toolbarRect.right) + 'px';
|
13169 |
+
if (!element.id.match(/toggle/ig)) {
|
13170 |
+
element.style.left = toolbarRect.left + 'px';
|
13171 |
+
element.style.width = 'auto';
|
13172 |
+
}
|
13173 |
+
}
|
13174 |
+
}
|
13175 |
+
|
13176 |
+
function setSettingsPositionBottomValues() {
|
13177 |
+
var toolbarRect = toolbar.getBoundingClientRect();
|
13178 |
+
var codeMirrorRect = editor.getWrapperElement().getBoundingClientRect();
|
13179 |
+
for (var index = 0; index < settingsPanel.children.length; index++) {
|
13180 |
+
var element = settingsPanel.children[index];
|
13181 |
+
element.style.position = 'absolute';
|
13182 |
+
element.style.top = (codeMirrorRect.top - toolbarRect.bottom) * -1 + 'px';
|
13183 |
+
element.style.left = '';
|
13184 |
+
element.style.right = '';
|
13185 |
+
element.style.width = '';
|
13186 |
+
}
|
13187 |
+
}
|
13188 |
+
|
13189 |
+
var throttledSetSettingsPosition = throttleAnimationFrame(setSettingsPosition);
|
13190 |
+
function setSettingsPosition(event) {
|
13191 |
+
updateFullHeightMaxHeight();
|
13192 |
+
var currentSettingsPosition = state.settingsPosition();
|
13193 |
+
if (currentSettingsPosition === state.previousSettingsPosition && !(event && event.type === 'resize')) return;
|
13194 |
+
fullHeightMatch();
|
13195 |
+
switch (currentSettingsPosition) {
|
13196 |
+
case 'top':
|
13197 |
+
setSettingsPositionTopValues();
|
13198 |
+
break;
|
13199 |
+
case 'middle':
|
13200 |
+
setSettingsPositionMiddleValues();
|
13201 |
+
break;
|
13202 |
+
case 'bottom':
|
13203 |
+
setSettingsPositionBottomValues();
|
13204 |
+
break;
|
13205 |
+
case 'normal':
|
13206 |
+
case 'none':
|
13207 |
+
break;
|
13208 |
+
}
|
13209 |
+
}
|
13210 |
+
|
13211 |
+
|
13212 |
+
|
13213 |
+
var isIE = !!navigator.userAgent.match(/Trident/ig);
|
13214 |
+
|
13215 |
+
function updateFullHeightMaxHeight() {
|
13216 |
+
if (!theForm) return;
|
13217 |
+
var margin = 6; // arbitrary
|
13218 |
+
var formTop = theForm.getBoundingClientRect().top;
|
13219 |
+
var editorBottom = document.getElementById('post-status-info').getBoundingClientRect().top;
|
13220 |
+
var editorBottomMaxHeight = editorBottom - formTop;
|
13221 |
+
var screenBottomMaxHeight = window.innerHeight - formTop;
|
13222 |
+
theForm.style.maxHeight = Math.min(editorBottomMaxHeight, screenBottomMaxHeight) - margin + 'px';
|
13223 |
+
if (isIE) theForm.style.height = theForm.style.maxHeight;
|
13224 |
+
}
|
13225 |
+
|
13226 |
+
function removeFullHeightMaxHeight() {
|
13227 |
+
theForm.style.maxHeight = '';
|
13228 |
+
if (isIE) theForm.style.height = '';
|
13229 |
+
}
|
13230 |
+
|
13231 |
+
|
13232 |
+
|
13233 |
+
function attachFullHeightToggle() {
|
13234 |
+
if (!fullHeightToggle) return;
|
13235 |
+
fullHeightToggle.addEventListener('change', fullHeightToggled);
|
13236 |
+
fullHeightToggled();
|
13237 |
+
}
|
13238 |
+
|
13239 |
+
function fullHeightToggled() {
|
13240 |
+
if (state.isFullHeight()) {
|
13241 |
+
editor.setOption('viewportMargin', Infinity);
|
13242 |
+
editor.on('change', fullHeightMatch);
|
13243 |
+
window.addEventListener('scroll', throttledSetSettingsPosition);
|
13244 |
+
window.addEventListener('resize', throttledSetSettingsPosition);
|
13245 |
+
window.addEventListener('resize', throttledMatchTextAreaMarginTop);
|
13246 |
+
editor.getWrapperElement().style.height = 'auto';
|
13247 |
+
setSettingsPosition();
|
13248 |
+
matchTextAreaMarginTop();
|
13249 |
+
window.setTimeout(function () {
|
13250 |
+
updateFullHeightMaxHeight();
|
13251 |
+
fullHeightMatch();
|
13252 |
+
}, 100); // TODO: find a better way to override
|
13253 |
+
} else {
|
13254 |
+
editor.setOption('viewportMargin', options.viewportMargin);
|
13255 |
+
editor.off('change', fullHeightMatch);
|
13256 |
+
window.removeEventListener('scroll', throttledSetSettingsPosition);
|
13257 |
+
window.removeEventListener('resize', throttledSetSettingsPosition);
|
13258 |
+
window.removeEventListener('resize', throttledMatchTextAreaMarginTop);
|
13259 |
+
// window.setTimeout(function(){
|
13260 |
+
editor.getWrapperElement().style.marginTop = '';
|
13261 |
+
removeFullHeightMaxHeight();
|
13262 |
+
setSettingsPositionTopValues();
|
13263 |
+
matchTextAreaHeight();
|
13264 |
+
// }, 100);
|
13265 |
+
}
|
13266 |
+
}
|
13267 |
+
|
13268 |
+
|
13269 |
+
|
13270 |
+
// initalize the settings panel
|
13271 |
+
function attachSettings() {
|
13272 |
+
// move the settingsPanel (produced in php) to inside the codemirror instance
|
13273 |
+
editor.getWrapperElement().appendChild(settingsPanel);
|
13274 |
+
settingsPanel.style.display = 'block';
|
13275 |
+
settingsPanel.querySelector('.CodeMirror-settings__toggle').addEventListener('click', toggleSettings);
|
13276 |
+
settingsPanel.querySelector('.CodeMirror-settings__toggle-advanced').addEventListener('click', toggleSettings);
|
13277 |
+
|
13278 |
+
// attach all the inputs to live update
|
13279 |
+
var options = settingsPanel.querySelectorAll('.CodeMirror-settings__option');
|
13280 |
+
for (var index = 0; index < options.length; index++) {
|
13281 |
+
var option = options[index];
|
13282 |
+
option.addEventListener('change', submitForm);
|
13283 |
+
}
|
13284 |
+
settingsPanel.querySelector('#theme').addEventListener('change', updateOption);
|
13285 |
+
settingsPanel.querySelector('#tabSize').addEventListener('change', updateOption);
|
13286 |
+
settingsPanel.querySelector('#lineWrapping').addEventListener('change', updateOption);
|
13287 |
+
settingsPanel.querySelector('#lineNumbers').addEventListener('change', updateOption);
|
13288 |
+
settingsPanel.querySelector('#fontSize').addEventListener('change', updateFontSize);
|
13289 |
+
settingsPanel.querySelector('#lineHeight').addEventListener('change', updateLineHeight);
|
13290 |
+
}
|
13291 |
+
|
13292 |
+
// toggle classes for settingsPanel state
|
13293 |
+
function toggleSettings(event) {
|
13294 |
+
if (event.target.id.match(/advanced/ig)) {
|
13295 |
+
if (!settingsPanel.classList.contains('open-advanced')) setSettingsPanelState('advanced');
|
13296 |
+
else setSettingsPanelState('open');
|
13297 |
+
} else {
|
13298 |
+
if (settingsPanel.classList.contains('open')) setSettingsPanelState('closed');
|
13299 |
+
else setSettingsPanelState('open');
|
13300 |
+
}
|
13301 |
+
}
|
13302 |
+
|
13303 |
+
function setSettingsPanelState(toState) {
|
13304 |
+
switch (toState) {
|
13305 |
+
case 'open':
|
13306 |
+
settingsPanel.classList.add('open');
|
13307 |
+
settingsPanel.classList.remove('open-advanced');
|
13308 |
+
settingsPanel.classList.remove('closed');
|
13309 |
+
break;
|
13310 |
+
case 'advanced':
|
13311 |
+
settingsPanel.classList.add('open');
|
13312 |
+
settingsPanel.classList.add('open-advanced');
|
13313 |
+
settingsPanel.classList.remove('closed');
|
13314 |
+
break;
|
13315 |
+
// case 'closed':
|
13316 |
+
default:
|
13317 |
+
settingsPanel.classList.remove('open');
|
13318 |
+
settingsPanel.classList.remove('open-advanced');
|
13319 |
+
settingsPanel.classList.add('closed');
|
13320 |
+
break;
|
13321 |
+
}
|
13322 |
+
}
|
13323 |
+
|
13324 |
+
|
13325 |
+
|
13326 |
+
// set a codemirror option from an input.onchange event callback
|
13327 |
+
function updateOption(event) {
|
13328 |
+
var value = +event.target.value;
|
13329 |
+
value = isNaN(value) ? event.target.value : value;
|
13330 |
+
if (event.target.checked != null)
|
13331 |
+
value = event.target.checked;
|
13332 |
+
heshOptions[event.target.id] = value;
|
13333 |
+
editor.setOption(event.target.id, value);
|
13334 |
+
if(event.target.id === 'tabSize') // special case for tabSize
|
13335 |
+
editor.setOption('indentUnit', value); // indentUnit must always equal tabSize
|
13336 |
+
}
|
13337 |
+
|
13338 |
+
function setCharWidth() {
|
13339 |
+
state.charWidth = editor.defaultCharWidth() * (heshOptions.fontSize/13);
|
13340 |
+
}
|
13341 |
+
|
13342 |
+
function setFontSizeAndLineHeight(fontSize, lineHeight) {
|
13343 |
+
scrollPanel.style.fontSize = fontSize + 'px';
|
13344 |
+
heshOptions.fontSize = fontSize;
|
13345 |
+
scrollPanel.style.lineHeight = lineHeight + 'em';
|
13346 |
+
heshOptions.lineHeight = lineHeight;
|
13347 |
+
setCharWidth();
|
13348 |
+
editor.refresh();
|
13349 |
+
}
|
13350 |
+
|
13351 |
+
function updateFontSize(event) {
|
13352 |
+
var fontSize = event.target.value;
|
13353 |
+
heshOptions.fontSize = fontSize;
|
13354 |
+
scrollPanel.style.fontSize = fontSize + 'px';
|
13355 |
+
setCharWidth();
|
13356 |
+
editor.refresh();
|
13357 |
+
}
|
13358 |
+
|
13359 |
+
function updateLineHeight(event) {
|
13360 |
+
var lineHeight = event.target.value;
|
13361 |
+
heshOptions.lineHeight = lineHeight;
|
13362 |
+
scrollPanel.style.lineHeight = lineHeight + 'em';
|
13363 |
+
editor.refresh();
|
13364 |
+
}
|
13365 |
+
|
13366 |
+
|
13367 |
+
|
13368 |
+
// updates the user settings in the wordpress DB
|
13369 |
+
function submitForm() {
|
13370 |
+
var formArray = $('#CodeMirror-settings__form').serializeArray();
|
13371 |
+
// TODO: drop jQuery dependency
|
13372 |
+
// console.log(formArray); // for debug
|
13373 |
+
$.post(heshOptions.ajaxUrl, formArray, function (/*response*/) {
|
13374 |
+
// console.log(response); // for debug
|
13375 |
+
});
|
13376 |
+
}
|
13377 |
+
|
13378 |
+
|
13379 |
+
|
13380 |
+
// setup the fullscreen button
|
13381 |
+
var fullscreenBox = document.getElementById('wp-content-editor-container');
|
13382 |
+
var fullscreenClass = 'heshFullscreen';
|
13383 |
+
function attachFullscreen() {
|
13384 |
+
toolbar.insertAdjacentHTML(
|
13385 |
+
'afterbegin',
|
13386 |
+
'<button type="button" id="cm_content_fullscreen" class="ed_button qt-dfw" title="Full Screen"></button>'
|
13387 |
+
);
|
13388 |
+
document.getElementById('cm_content_fullscreen').onclick = toggleFullscreen;
|
13389 |
+
}
|
13390 |
+
|
13391 |
+
function toggleFullscreen() {
|
13392 |
+
if (state.isFullHeight()){
|
13393 |
+
fullscreenBox.classList.remove(fullscreenClass);
|
13394 |
+
} else {
|
13395 |
+
fullscreenBox.classList.toggle(fullscreenClass);
|
13396 |
+
editor.focus();
|
13397 |
+
}
|
13398 |
+
}
|
13399 |
+
|
13400 |
+
|
13401 |
+
|
13402 |
+
function fullHeightMatch() {
|
13403 |
+
editor.save();
|
13404 |
+
editor.getTextArea().style.height = editor.getWrapperElement().getBoundingClientRect().height + 'px';
|
13405 |
+
}
|
13406 |
+
|
13407 |
+
function matchTextAreaHeight() {
|
13408 |
+
editor.getWrapperElement().style.height = editor.getTextArea().style.height;
|
13409 |
+
}
|
13410 |
+
|
13411 |
+
var throttledMatchTextAreaMarginTop = throttleAnimationFrame(matchTextAreaMarginTop);
|
13412 |
+
function matchTextAreaMarginTop() {
|
13413 |
+
editor.getWrapperElement().style.marginTop = editor.getTextArea().style.marginTop;
|
13414 |
+
}
|
13415 |
+
|
13416 |
+
|
13417 |
+
|
13418 |
+
// copy the resize of the textarea in codemirror
|
13419 |
+
function attachDragResizePostOrPage() {
|
13420 |
+
document.getElementById('content-resize-handle').addEventListener('mousedown', function () {
|
13421 |
+
document.addEventListener('mousemove', matchTextAreaHeight);
|
13422 |
+
});
|
13423 |
+
document.addEventListener('mouseup', function () {
|
13424 |
+
document.removeEventListener('mousemove', matchTextAreaHeight);
|
13425 |
+
// editor.refresh(); // TODO: put this somewhere else
|
13426 |
+
});
|
13427 |
+
}
|
13428 |
+
|
13429 |
+
// attaches a dragger to the bottom right of the theme/plugin editor to control editor height
|
13430 |
+
function attachDragResizeThemeOrPlugin() {
|
13431 |
+
var editorHeight = 500;
|
13432 |
+
var minEditorHieght = 200;
|
13433 |
+
editor.getWrapperElement().style.height = editorHeight + 'px';
|
13434 |
+
var resizeHandle = document.createElement('div');
|
13435 |
+
resizeHandle.className = 'hesh-content-resize-handle';
|
13436 |
+
resizeHandle.id = 'content-resize-handle';
|
13437 |
+
editor.getWrapperElement().appendChild(resizeHandle);
|
13438 |
+
var isDragging = false;
|
13439 |
+
var yStartPosition;
|
13440 |
+
var newHeight = editorHeight;
|
13441 |
+
function changeCodemirrorHeight(event) {
|
13442 |
+
newHeight = editorHeight + (event.pageY - yStartPosition);
|
13443 |
+
editor.getWrapperElement().style.height = Math.max(minEditorHieght, newHeight) + 'px';
|
13444 |
+
}
|
13445 |
+
document.getElementById('content-resize-handle').addEventListener('mousedown', function (event) {
|
13446 |
+
yStartPosition = event.pageY;
|
13447 |
+
isDragging = true;
|
13448 |
+
document.addEventListener('mousemove', changeCodemirrorHeight);
|
13449 |
+
event.preventDefault();
|
13450 |
+
});
|
13451 |
+
document.addEventListener('mouseup', function () {
|
13452 |
+
isDragging = false;
|
13453 |
+
editorHeight = Math.max(minEditorHieght, newHeight);
|
13454 |
+
document.removeEventListener('mousemove', changeCodemirrorHeight);
|
13455 |
+
editor.refresh();
|
13456 |
+
});
|
13457 |
+
}
|
13458 |
+
|
13459 |
+
|
13460 |
+
|
13461 |
+
function setFileType() {
|
13462 |
+
var fileNameElement = document.querySelector('.fileedit-sub .alignleft');
|
13463 |
+
var fileTypeMatches = fileNameElement.textContent.match(/\.[a-z\d]{2,}/ig); // find the file extention
|
13464 |
+
var fileType = fileTypeMatches[fileTypeMatches.length - 1].match(/[a-z]*/ig)[1]; // remove the dot
|
13465 |
+
var filetypeToMode = { // map file extensions to their CodeMirror modes
|
13466 |
+
php: 'php',
|
13467 |
+
css: 'css',
|
13468 |
+
xml: 'xml',
|
13469 |
+
html: 'htmlmixed',
|
13470 |
+
js: 'javascript',
|
13471 |
+
json: 'javascript'
|
13472 |
+
};
|
13473 |
+
options.mode = filetypeToMode[fileType];
|
13474 |
+
}
|
13475 |
+
|
13476 |
+
|
13477 |
+
|
13478 |
+
function getCookie(name) {
|
13479 |
+
var value = '; ' + document.cookie;
|
13480 |
+
var parts = value.split('; ' + name + '=');
|
13481 |
+
if (parts.length === 2) return parts.pop().split(';').shift();
|
13482 |
+
}
|
13483 |
+
|
13484 |
+
function restoreSelectionState() {
|
13485 |
+
var selectionState = (getCookie('hesh_plugin_selection_state') || '0,0,0,0,0,0,0').split(',');
|
13486 |
+
if (postID === selectionState[0]) {
|
13487 |
+
editor.doc.setSelection(
|
13488 |
+
{ line: +selectionState[1], ch: +selectionState[2] },
|
13489 |
+
{ line: +selectionState[3], ch: +selectionState[4] },
|
13490 |
+
{ scroll: false }
|
13491 |
+
);
|
13492 |
+
editor.scrollTo(+selectionState[5], +selectionState[6]);
|
13493 |
+
}
|
13494 |
+
}
|
13495 |
+
|
13496 |
+
var throttledRecordSelectionState = throttleAnimationFrame(recordSelectionState);
|
13497 |
+
function recordSelectionState() {
|
13498 |
+
var selection = editor.doc.listSelections()[0];
|
13499 |
+
var scrollPosition = editor.getScrollInfo();
|
13500 |
+
document.cookie = 'hesh_plugin_selection_state=' +
|
13501 |
+
postID + ',' +
|
13502 |
+
selection.anchor.line + ',' +
|
13503 |
+
selection.anchor.ch + ',' +
|
13504 |
+
selection.head.line + ',' +
|
13505 |
+
selection.head.ch + ',' +
|
13506 |
+
scrollPosition.left + ',' +
|
13507 |
+
scrollPosition.top;
|
13508 |
+
}
|
13509 |
+
|
13510 |
+
|
13511 |
+
|
13512 |
+
// make wrapped text line up with the base indentation of the line
|
13513 |
+
// https://codemirror.net/demo/indentwrap.html
|
13514 |
+
function indentWrappedLine() {
|
13515 |
+
var css = '.CodeMirror pre > * { text-indent: 0px; }';
|
13516 |
+
var head = document.head || document.getElementsByTagName('head')[0];
|
13517 |
+
var style = document.createElement('style');
|
13518 |
+
style.type = 'text/css';
|
13519 |
+
if (style.styleSheet) style.styleSheet.cssText = css;
|
13520 |
+
else style.appendChild(document.createTextNode(css));
|
13521 |
+
head.appendChild(style);
|
13522 |
+
|
13523 |
+
var basePadding = 4;
|
13524 |
+
editor.on('renderLine', function (cm, line, elt) {
|
13525 |
+
var offSet = CodeMirror.countColumn(line.text, null, cm.getOption('tabSize')) * state.charWidth;
|
13526 |
+
elt.style.textIndent = '-' + offSet + 'px';
|
13527 |
+
elt.style.paddingLeft = (basePadding + offSet) + 'px';
|
13528 |
+
});
|
13529 |
+
editor.refresh();
|
13530 |
+
}
|
13531 |
+
|
13532 |
+
|
13533 |
+
|
13534 |
+
// cursor & selection pairity between codemirror and the textarea
|
13535 |
+
function giveFocusToTextArea() {
|
13536 |
+
var selection = editor.doc.listSelections()[0];
|
13537 |
+
var head, anchor, i;
|
13538 |
+
head = anchor = i = 0;
|
13539 |
+
editor.doc.eachLine(function (line) {
|
13540 |
+
if (i <= (selection.head.line - 1)) head += line.text.length + 1;
|
13541 |
+
if (i <= (selection.anchor.line - 1)) anchor += line.text.length + 1;
|
13542 |
+
i++;
|
13543 |
+
});
|
13544 |
+
head += selection.head.ch;
|
13545 |
+
anchor += selection.anchor.ch;
|
13546 |
+
editor.getTextArea().setSelectionRange(Math.min(anchor, head), Math.max(anchor, head));
|
13547 |
+
editor.getTextArea().focus();
|
13548 |
+
runTextAreaChangeDetection();
|
13549 |
+
}
|
13550 |
+
|
13551 |
+
function runTextAreaChangeDetection() {
|
13552 |
+
var currentValueLength = editor.getTextArea().value.length;
|
13553 |
+
var checkForChanges = window.setInterval(function(){
|
13554 |
+
// console.log(editor.getTextArea().value.length);
|
13555 |
+
if (currentValueLength === editor.getTextArea().value.length) return;
|
13556 |
+
window.clearInterval(checkForChanges);
|
13557 |
+
returnFocusFromTextArea();
|
13558 |
+
},10);
|
13559 |
+
var clearCheckForChanges = function () {
|
13560 |
+
window.clearInterval(checkForChanges);
|
13561 |
+
editor.off('focus', clearCheckForChanges);
|
13562 |
+
// console.log(editor.getTextArea().value);
|
13563 |
+
};
|
13564 |
+
editor.on('focus', clearCheckForChanges);
|
13565 |
+
}
|
13566 |
+
|
13567 |
+
// Check if any edits were made to the textarea.value
|
13568 |
+
function returnFocusFromTextArea() {
|
13569 |
+
// save the selection state and scroll state
|
13570 |
+
var selectionStart = editor.getTextArea().selectionStart;
|
13571 |
+
var selectionEnd = editor.getTextArea().selectionEnd;
|
13572 |
+
var cmScrollPosition = editor.getScrollInfo();
|
13573 |
+
var windowScrollPosition = { top: window.pageYOffset, left: window.pageXOffset }
|
13574 |
+
|
13575 |
+
// update codemirror with the new textarea.value
|
13576 |
+
editor.doc.setValue(editor.getTextArea().value);
|
13577 |
+
editor.focus();
|
13578 |
+
|
13579 |
+
var startLine = 0, endLine = 0, currentLine = 0;
|
13580 |
+
var startCh = selectionStart;
|
13581 |
+
var endCh = selectionEnd;
|
13582 |
+
var lineLength = editor.getLineHandle(currentLine).text.length + 1;
|
13583 |
+
while (lineLength <= startCh && lineLength <= endCh) {
|
13584 |
+
currentLine++;
|
13585 |
+
if (lineLength <= startCh) {
|
13586 |
+
startCh -= lineLength;
|
13587 |
+
startLine = currentLine;
|
13588 |
+
}
|
13589 |
+
if (lineLength <= endCh) {
|
13590 |
+
endCh -= lineLength;
|
13591 |
+
endLine = currentLine;
|
13592 |
+
}
|
13593 |
+
lineLength = editor.getLineHandle(currentLine).text.length + 1;
|
13594 |
+
// console.log('line: '+currentLine, 'startCh: '+startCh, 'endCh: '+endCh); // for debug
|
13595 |
+
}
|
13596 |
+
|
13597 |
+
editor.doc.setSelection(
|
13598 |
+
{ line: startLine, ch: startCh },
|
13599 |
+
{ line: endLine, ch: endCh },
|
13600 |
+
{ scroll: false }
|
13601 |
+
);
|
13602 |
+
window.scrollTo(windowScrollPosition.left, windowScrollPosition.top);
|
13603 |
+
editor.scrollTo(cmScrollPosition.left, cmScrollPosition.top);
|
13604 |
+
|
13605 |
+
editor.save();
|
13606 |
+
}
|
13607 |
+
|
13608 |
+
// remap native WP function for adding media
|
13609 |
+
function remapAddMedia() {
|
13610 |
+
var oldSendToEditor = window.send_to_editor;
|
13611 |
+
var whichSendToEditor = function (html) {
|
13612 |
+
if (state.isActive() && window.wpActiveEditor === 'content') {
|
13613 |
+
editor.replaceSelection(html);
|
13614 |
+
editor.save();
|
13615 |
+
} else {
|
13616 |
+
oldSendToEditor(html);
|
13617 |
+
}
|
13618 |
+
};
|
13619 |
+
window.send_to_editor = whichSendToEditor;
|
13620 |
+
}
|
13621 |
+
|
13622 |
+
|
13623 |
+
function startEditor() {
|
13624 |
+
if (state.isActive()) return;
|
13625 |
+
|
13626 |
+
updateOptions();
|
13627 |
+
|
13628 |
+
// change the mode if on the theme/plugin editor page
|
13629 |
+
if (state.isThemeOrPlugin) setFileType();
|
13630 |
+
|
13631 |
+
// start up codemirror
|
13632 |
+
editor = CodeMirror.fromTextArea(target, options);
|
13633 |
+
scrollPanel = editor.getWrapperElement().querySelector('.CodeMirror-code');
|
13634 |
+
target.classList.add('CodeMirror-mirrored');
|
13635 |
+
|
13636 |
+
// Save save all changes to the textarea.value
|
13637 |
+
editor.on('change', function () { editor.save(); });
|
13638 |
+
|
13639 |
+
restoreSelectionState();
|
13640 |
+
editor.on('cursorActivity', throttledRecordSelectionState);
|
13641 |
+
editor.on('scroll', throttledRecordSelectionState);
|
13642 |
+
|
13643 |
+
if (state.isThemeOrPlugin) {
|
13644 |
+
attachDragResizeThemeOrPlugin();
|
13645 |
+
publishButton = document.getElementById('submit');
|
13646 |
+
} else {
|
13647 |
+
toolbar.addEventListener('mousedown', giveFocusToTextArea);
|
13648 |
+
// document.getElementById('insert-media-button').addEventListener('mousedown', giveFocusToTextArea);
|
13649 |
+
remapAddMedia();
|
13650 |
+
attachDragResizePostOrPage();
|
13651 |
+
attachFullHeightToggle();
|
13652 |
+
attachFullscreen();
|
13653 |
+
}
|
13654 |
+
attachSettings();
|
13655 |
+
setFontSizeAndLineHeight(+heshOptions.fontSize, +heshOptions.lineHeight);
|
13656 |
+
indentWrappedLine();
|
13657 |
+
}
|
13658 |
+
|
13659 |
+
function stopEditor() {
|
13660 |
+
if (!state.isActive()) return;
|
13661 |
+
setSettingsPanelState('closed');
|
13662 |
+
editor.toTextArea();
|
13663 |
+
}
|
13664 |
+
|
13665 |
+
|
13666 |
+
|
13667 |
+
function initialise() {
|
13668 |
+
if (state.isThemeOrPlugin) {
|
13669 |
+
startEditor();
|
13670 |
+
} else if (state.isVisualEnabled) {
|
13671 |
+
tabText.addEventListener('click', function () {
|
13672 |
+
window.setTimeout(startEditor, 0);
|
13673 |
+
});
|
13674 |
+
tabVisual.addEventListener('click', stopEditor);
|
13675 |
+
if (!state.isVisualActive()) startEditor();
|
13676 |
+
} else {
|
13677 |
+
startEditor();
|
13678 |
+
document.body.className += ' visual-editor-is-disabled';
|
13679 |
+
}
|
13680 |
+
}
|
13681 |
+
|
13682 |
+
if (document.readyState !== 'complete') {
|
13683 |
+
if (window.addEventListener) window.addEventListener('load', initialise, false);
|
13684 |
+
else if (window.attachEvent) window.attachEvent('onload', initialise);
|
13685 |
+
} else {
|
13686 |
+
initialise();
|
13687 |
+
}
|
13688 |
+
|
13689 |
+
|
13690 |
+
|
13691 |
+
})(
|
13692 |
+
document,
|
13693 |
+
window,
|
13694 |
+
window.CodeMirror,
|
13695 |
+
window.jQuery,
|
13696 |
+
window.heshOptions
|
13697 |
+
);
|
dist/hesh.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.CodeMirror{font-family:monospace;height:300px;color:#000}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.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-animate-fat-cursor{width:auto;border:0;animation:a 1.06s steps(1) infinite;background-color:#7e7}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.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:700}.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-2{color:#05a}.cm-s-default .cm-variable-3{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,.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-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:none}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display: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:-30px}.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}.CodeMirror pre{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;font-variant-ligatures:contextual}.CodeMirror-wrap pre{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;overflow:auto}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{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}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{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:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:none}.cm-s-3024-day.CodeMirror{background:#f7f7f7;color:#3a3432}.cm-s-3024-day div.CodeMirror-selected{background:#d6d5d4}.cm-s-3024-day .CodeMirror-line::-moz-selection,.cm-s-3024-day .CodeMirror-line>span::-moz-selection,.cm-s-3024-day .CodeMirror-line>span>span::-moz-selection{background:#d6d5d4}.cm-s-3024-day .CodeMirror-line::selection,.cm-s-3024-day .CodeMirror-line>span::selection,.cm-s-3024-day .CodeMirror-line>span>span::selection{background:#d6d5d4}.cm-s-3024-day .CodeMirror-line::-moz-selection,.cm-s-3024-day .CodeMirror-line>span::-moz-selection,.cm-s-3024-day .CodeMirror-line>span>span::-moz-selection{background:#d9d9d9}.cm-s-3024-day .CodeMirror-line::-moz-selection,.cm-s-3024-day .CodeMirror-line>span::-moz-selection,.cm-s-3024-day .CodeMirror-line>span>span::selection{background:#d9d9d9}.cm-s-3024-day .CodeMirror-gutters{background:#f7f7f7;border-right:0}.cm-s-3024-day .CodeMirror-guttermarker{color:#db2d20}.cm-s-3024-day .CodeMirror-guttermarker-subtle,.cm-s-3024-day .CodeMirror-linenumber{color:#807d7c}.cm-s-3024-day .CodeMirror-cursor{border-left:1px solid #5c5855}.cm-s-3024-day span.cm-comment{color:#cdab53}.cm-s-3024-day span.cm-atom,.cm-s-3024-day span.cm-number{color:#a16a94}.cm-s-3024-day span.cm-attribute,.cm-s-3024-day span.cm-property{color:#01a252}.cm-s-3024-day span.cm-keyword{color:#db2d20}.cm-s-3024-day span.cm-string{color:#fded02}.cm-s-3024-day span.cm-variable{color:#01a252}.cm-s-3024-day span.cm-variable-2{color:#01a0e4}.cm-s-3024-day span.cm-def{color:#e8bbd0}.cm-s-3024-day span.cm-bracket{color:#3a3432}.cm-s-3024-day span.cm-tag{color:#db2d20}.cm-s-3024-day span.cm-link{color:#a16a94}.cm-s-3024-day span.cm-error{background:#db2d20;color:#5c5855}.cm-s-3024-day .CodeMirror-activeline-background{background:#e8f2ff}.cm-s-3024-day .CodeMirror-matchingbracket{text-decoration:underline;color:#a16a94!important}.cm-s-3024-night.CodeMirror{background:#090300;color:#d6d5d4}.cm-s-3024-night div.CodeMirror-selected{background:#3a3432}.cm-s-3024-night .CodeMirror-line::selection,.cm-s-3024-night .CodeMirror-line>span::selection,.cm-s-3024-night .CodeMirror-line>span>span::selection{background:rgba(58,52,50,.99)}.cm-s-3024-night .CodeMirror-line::-moz-selection,.cm-s-3024-night .CodeMirror-line>span::-moz-selection,.cm-s-3024-night .CodeMirror-line>span>span::-moz-selection{background:rgba(58,52,50,.99)}.cm-s-3024-night .CodeMirror-gutters{background:#090300;border-right:0}.cm-s-3024-night .CodeMirror-guttermarker{color:#db2d20}.cm-s-3024-night .CodeMirror-guttermarker-subtle,.cm-s-3024-night .CodeMirror-linenumber{color:#5c5855}.cm-s-3024-night .CodeMirror-cursor{border-left:1px solid #807d7c}.cm-s-3024-night span.cm-comment{color:#cdab53}.cm-s-3024-night span.cm-atom,.cm-s-3024-night span.cm-number{color:#a16a94}.cm-s-3024-night span.cm-attribute,.cm-s-3024-night span.cm-property{color:#01a252}.cm-s-3024-night span.cm-keyword{color:#db2d20}.cm-s-3024-night span.cm-string{color:#fded02}.cm-s-3024-night span.cm-variable{color:#01a252}.cm-s-3024-night span.cm-variable-2{color:#01a0e4}.cm-s-3024-night span.cm-def{color:#e8bbd0}.cm-s-3024-night span.cm-bracket{color:#d6d5d4}.cm-s-3024-night span.cm-tag{color:#db2d20}.cm-s-3024-night span.cm-link{color:#a16a94}.cm-s-3024-night span.cm-error{background:#db2d20;color:#807d7c}.cm-s-3024-night .CodeMirror-activeline-background{background:#2f2f2f}.cm-s-3024-night .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-abcdef.CodeMirror{background:#0f0f0f;color:#defdef}.cm-s-abcdef div.CodeMirror-selected{background:#515151}.cm-s-abcdef .CodeMirror-line::selection,.cm-s-abcdef .CodeMirror-line>span::selection,.cm-s-abcdef .CodeMirror-line>span>span::selection{background:rgba(56,56,56,.99)}.cm-s-abcdef .CodeMirror-line::-moz-selection,.cm-s-abcdef .CodeMirror-line>span::-moz-selection,.cm-s-abcdef .CodeMirror-line>span>span::-moz-selection{background:rgba(56,56,56,.99)}.cm-s-abcdef .CodeMirror-gutters{background:#555;border-right:2px solid #314151}.cm-s-abcdef .CodeMirror-guttermarker{color:#222}.cm-s-abcdef .CodeMirror-guttermarker-subtle{color:azure}.cm-s-abcdef .CodeMirror-linenumber{color:#fff}.cm-s-abcdef .CodeMirror-cursor{border-left:1px solid #0f0}.cm-s-abcdef span.cm-keyword{color:#b8860b;font-weight:700}.cm-s-abcdef span.cm-atom{color:#77f}.cm-s-abcdef span.cm-number{color:violet}.cm-s-abcdef span.cm-def{color:#fffabc}.cm-s-abcdef span.cm-variable{color:#abcdef}.cm-s-abcdef span.cm-variable-2{color:#cacbcc}.cm-s-abcdef span.cm-variable-3{color:#def}.cm-s-abcdef span.cm-property{color:#fedcba}.cm-s-abcdef span.cm-operator{color:#ff0}.cm-s-abcdef span.cm-comment{color:#7a7b7c;font-style:italic}.cm-s-abcdef span.cm-string{color:#2b4}.cm-s-abcdef span.cm-meta{color:#c9f}.cm-s-abcdef span.cm-qualifier{color:#fff700}.cm-s-abcdef span.cm-builtin{color:#30aabc}.cm-s-abcdef span.cm-bracket{color:#8a8a8a}.cm-s-abcdef span.cm-tag{color:#fd4}.cm-s-abcdef span.cm-attribute{color:#df0}.cm-s-abcdef span.cm-error{color:red}.cm-s-abcdef span.cm-header{color:#7fffd4;font-weight:700}.cm-s-abcdef span.cm-link{color:#8a2be2}.cm-s-abcdef .CodeMirror-activeline-background{background:#314151}.cm-s-ambiance.CodeMirror{box-shadow:none}.cm-s-ambiance .cm-header{color:blue}.cm-s-ambiance .cm-quote{color:#24c2c7}.cm-s-ambiance .cm-keyword{color:#cda869}.cm-s-ambiance .cm-atom{color:#cf7ea9}.cm-s-ambiance .cm-number{color:#78cf8a}.cm-s-ambiance .cm-def{color:#aac6e3}.cm-s-ambiance .cm-variable{color:#ffb795}.cm-s-ambiance .cm-variable-2{color:#eed1b3}.cm-s-ambiance .cm-variable-3{color:#faded3}.cm-s-ambiance .cm-property{color:#eed1b3}.cm-s-ambiance .cm-operator{color:#fa8d6a}.cm-s-ambiance .cm-comment{color:#555;font-style:italic}.cm-s-ambiance .cm-string{color:#8f9d6a}.cm-s-ambiance .cm-string-2{color:#9d937c}.cm-s-ambiance .cm-meta{color:#d2a8a1}.cm-s-ambiance .cm-qualifier{color:#ff0}.cm-s-ambiance .cm-builtin{color:#99c}.cm-s-ambiance .cm-bracket{color:#24c2c7}.cm-s-ambiance .cm-tag{color:#fee4ff}.cm-s-ambiance .cm-attribute{color:#9b859d}.cm-s-ambiance .cm-hr{color:pink}.cm-s-ambiance .cm-link{color:#f4c20b}.cm-s-ambiance .cm-special{color:#ff9d00}.cm-s-ambiance .cm-error{color:#af2018}.cm-s-ambiance .CodeMirror-matchingbracket{color:#0f0}.cm-s-ambiance .CodeMirror-nonmatchingbracket{color:#f22}.cm-s-ambiance div.CodeMirror-selected{background:hsla(0,0%,100%,.15)}.cm-s-ambiance.CodeMirror-focused div.CodeMirror-selected{background:hsla(0,0%,100%,.1)}.cm-s-ambiance .CodeMirror-line::selection,.cm-s-ambiance .CodeMirror-line>span::selection,.cm-s-ambiance .CodeMirror-line>span>span::selection{background:hsla(0,0%,100%,.1)}.cm-s-ambiance .CodeMirror-line::-moz-selection,.cm-s-ambiance .CodeMirror-line>span::-moz-selection,.cm-s-ambiance .CodeMirror-line>span>span::-moz-selection{background:hsla(0,0%,100%,.1)}.cm-s-ambiance.CodeMirror{line-height:1.4em;color:#e6e1dc;background-color:#202020;box-shadow:inset 0 0 10px #000}.cm-s-ambiance .CodeMirror-gutters{background:#3d3d3d;border-right:1px solid #4d4d4d;box-shadow:0 10px 20px #000}.cm-s-ambiance .CodeMirror-linenumber{text-shadow:0 1px 1px #4d4d4d;color:#111;padding:0 5px}.cm-s-ambiance .CodeMirror-guttermarker{color:#aaa}.cm-s-ambiance .CodeMirror-guttermarker-subtle{color:#111}.cm-s-ambiance .CodeMirror-cursor{border-left:1px solid #7991e8}.cm-s-ambiance .CodeMirror-activeline-background{background:none repeat scroll 0 0 hsla(0,0%,100%,.031)}.cm-s-ambiance.CodeMirror,.cm-s-ambiance .CodeMirror-gutters{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ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zwlKij6ZAW9ne4L0s8C6XeBMEkd/LQy1VucBRot6QMlbivaBhoBgjqGiCJNhsqVp/S2SsG6DIONCR0dXhvWbJ+MRRZJkkuEjgDXJjFQW6SSL7GXK8Z2CZg7cVsbWGoKmEpzQ5elpiy8Ryg7dMkLLUEauzeO86CuwlSOlgYLojZWeJ9xM3S1PWfEfKl5ISLQ0MEKR8YOB2QfCxJBjrKPCN4f9MkaSsqoVXJBmP7EpFZ9UQfOoOFwSzBN4MQ8LsGrymlipcJQhmy0GaQjPqCHaXRwuCZwRbqK2Fg9wlClZqYicrIgMdZfxTQ0c7TBIbrChxmuzoKG8XRaSrIhhiyNFJkrC7oIAWMEOQa5aBekPCRknCo4IKPrYkvCDI8aYmY7WFtprgekcJZ3oLIqssCSMtFbQTJKwXYy3BY5oCh2iKPCpJOE+zRdpYgi6O2KmOAgvVCYaU4ySRek1sgyFhJ403QFHiVEmJHwtybO1gs8Hr5+BETQX3War0qZngYGgtVZtoqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC")}.cm-s-base16-dark.CodeMirror{background:#151515;color:#e0e0e0}.cm-s-base16-dark div.CodeMirror-selected{background:#303030}.cm-s-base16-dark .CodeMirror-line::selection,.cm-s-base16-dark .CodeMirror-line>span::selection,.cm-s-base16-dark .CodeMirror-line>span>span::selection{background:rgba(48,48,48,.99)}.cm-s-base16-dark .CodeMirror-line::-moz-selection,.cm-s-base16-dark .CodeMirror-line>span::-moz-selection,.cm-s-base16-dark .CodeMirror-line>span>span::-moz-selection{background:rgba(48,48,48,.99)}.cm-s-base16-dark .CodeMirror-gutters{background:#151515;border-right:0}.cm-s-base16-dark .CodeMirror-guttermarker{color:#ac4142}.cm-s-base16-dark .CodeMirror-guttermarker-subtle,.cm-s-base16-dark .CodeMirror-linenumber{color:#505050}.cm-s-base16-dark .CodeMirror-cursor{border-left:1px solid #b0b0b0}.cm-s-base16-dark span.cm-comment{color:#8f5536}.cm-s-base16-dark span.cm-atom,.cm-s-base16-dark span.cm-number{color:#aa759f}.cm-s-base16-dark span.cm-attribute,.cm-s-base16-dark span.cm-property{color:#90a959}.cm-s-base16-dark span.cm-keyword{color:#ac4142}.cm-s-base16-dark span.cm-string{color:#f4bf75}.cm-s-base16-dark span.cm-variable{color:#90a959}.cm-s-base16-dark span.cm-variable-2{color:#6a9fb5}.cm-s-base16-dark span.cm-def{color:#d28445}.cm-s-base16-dark span.cm-bracket{color:#e0e0e0}.cm-s-base16-dark span.cm-tag{color:#ac4142}.cm-s-base16-dark span.cm-link{color:#aa759f}.cm-s-base16-dark span.cm-error{background:#ac4142;color:#b0b0b0}.cm-s-base16-dark .CodeMirror-activeline-background{background:#202020}.cm-s-base16-dark .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-base16-light.CodeMirror{background:#f5f5f5;color:#202020}.cm-s-base16-light div.CodeMirror-selected{background:#e0e0e0}.cm-s-base16-light .CodeMirror-line::selection,.cm-s-base16-light .CodeMirror-line>span::selection,.cm-s-base16-light .CodeMirror-line>span>span::selection{background:#e0e0e0}.cm-s-base16-light .CodeMirror-line::-moz-selection,.cm-s-base16-light .CodeMirror-line>span::-moz-selection,.cm-s-base16-light .CodeMirror-line>span>span::-moz-selection{background:#e0e0e0}.cm-s-base16-light .CodeMirror-gutters{background:#f5f5f5;border-right:0}.cm-s-base16-light .CodeMirror-guttermarker{color:#ac4142}.cm-s-base16-light .CodeMirror-guttermarker-subtle,.cm-s-base16-light .CodeMirror-linenumber{color:#b0b0b0}.cm-s-base16-light .CodeMirror-cursor{border-left:1px solid #505050}.cm-s-base16-light span.cm-comment{color:#8f5536}.cm-s-base16-light span.cm-atom,.cm-s-base16-light span.cm-number{color:#aa759f}.cm-s-base16-light span.cm-attribute,.cm-s-base16-light span.cm-property{color:#90a959}.cm-s-base16-light span.cm-keyword{color:#ac4142}.cm-s-base16-light span.cm-string{color:#f4bf75}.cm-s-base16-light span.cm-variable{color:#90a959}.cm-s-base16-light span.cm-variable-2{color:#6a9fb5}.cm-s-base16-light span.cm-def{color:#d28445}.cm-s-base16-light span.cm-bracket{color:#202020}.cm-s-base16-light span.cm-tag{color:#ac4142}.cm-s-base16-light span.cm-link{color:#aa759f}.cm-s-base16-light span.cm-error{background:#ac4142;color:#505050}.cm-s-base16-light .CodeMirror-activeline-background{background:#dddcdc}.cm-s-base16-light .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-bespin.CodeMirror{background:#28211c;color:#9d9b97}.cm-s-bespin div.CodeMirror-selected{background:#36312e!important}.cm-s-bespin .CodeMirror-gutters{background:#28211c;border-right:0}.cm-s-bespin .CodeMirror-linenumber{color:#666}.cm-s-bespin .CodeMirror-cursor{border-left:1px solid #797977!important}.cm-s-bespin span.cm-comment{color:#937121}.cm-s-bespin span.cm-atom,.cm-s-bespin span.cm-number{color:#9b859d}.cm-s-bespin span.cm-attribute,.cm-s-bespin span.cm-property{color:#54be0d}.cm-s-bespin span.cm-keyword{color:#cf6a4c}.cm-s-bespin span.cm-string{color:#f9ee98}.cm-s-bespin span.cm-variable{color:#54be0d}.cm-s-bespin span.cm-variable-2{color:#5ea6ea}.cm-s-bespin span.cm-def{color:#cf7d34}.cm-s-bespin span.cm-error{background:#cf6a4c;color:#797977}.cm-s-bespin span.cm-bracket{color:#9d9b97}.cm-s-bespin span.cm-tag{color:#cf6a4c}.cm-s-bespin span.cm-link{color:#9b859d}.cm-s-bespin .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-bespin .CodeMirror-activeline-background{background:#404040}.cm-s-blackboard.CodeMirror{background:#0c1021;color:#f8f8f8}.cm-s-blackboard div.CodeMirror-selected{background:#253b76}.cm-s-blackboard .CodeMirror-line::selection,.cm-s-blackboard .CodeMirror-line>span::selection,.cm-s-blackboard .CodeMirror-line>span>span::selection{background:rgba(37,59,118,.99)}.cm-s-blackboard .CodeMirror-line::-moz-selection,.cm-s-blackboard .CodeMirror-line>span::-moz-selection,.cm-s-blackboard .CodeMirror-line>span>span::-moz-selection{background:rgba(37,59,118,.99)}.cm-s-blackboard .CodeMirror-gutters{background:#0c1021;border-right:0}.cm-s-blackboard .CodeMirror-guttermarker{color:#fbde2d}.cm-s-blackboard .CodeMirror-guttermarker-subtle,.cm-s-blackboard .CodeMirror-linenumber{color:#888}.cm-s-blackboard .CodeMirror-cursor{border-left:1px solid #a7a7a7}.cm-s-blackboard .cm-keyword{color:#fbde2d}.cm-s-blackboard .cm-atom,.cm-s-blackboard .cm-number{color:#d8fa3c}.cm-s-blackboard .cm-def{color:#8da6ce}.cm-s-blackboard .cm-variable{color:#ff6400}.cm-s-blackboard .cm-operator{color:#fbde2d}.cm-s-blackboard .cm-comment{color:#aeaeae}.cm-s-blackboard .cm-string,.cm-s-blackboard .cm-string-2{color:#61ce3c}.cm-s-blackboard .cm-meta{color:#d8fa3c}.cm-s-blackboard .cm-attribute,.cm-s-blackboard .cm-builtin,.cm-s-blackboard .cm-tag{color:#8da6ce}.cm-s-blackboard .cm-header{color:#ff6400}.cm-s-blackboard .cm-hr{color:#aeaeae}.cm-s-blackboard .cm-link{color:#8da6ce}.cm-s-blackboard .cm-error{background:#9d1e15;color:#f8f8f8}.cm-s-blackboard .CodeMirror-activeline-background{background:#3c3636}.cm-s-blackboard .CodeMirror-matchingbracket{outline:1px solid grey;color:#fff!important}.cm-s-cobalt.CodeMirror{background:#002240;color:#fff}.cm-s-cobalt div.CodeMirror-selected{background:#b36539}.cm-s-cobalt .CodeMirror-line::selection,.cm-s-cobalt .CodeMirror-line>span::selection,.cm-s-cobalt .CodeMirror-line>span>span::selection{background:rgba(179,101,57,.99)}.cm-s-cobalt .CodeMirror-line::-moz-selection,.cm-s-cobalt .CodeMirror-line>span::-moz-selection,.cm-s-cobalt .CodeMirror-line>span>span::-moz-selection{background:rgba(179,101,57,.99)}.cm-s-cobalt .CodeMirror-gutters{background:#002240;border-right:1px solid #aaa}.cm-s-cobalt .CodeMirror-guttermarker{color:#ffee80}.cm-s-cobalt .CodeMirror-guttermarker-subtle,.cm-s-cobalt .CodeMirror-linenumber{color:#d0d0d0}.cm-s-cobalt .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-cobalt span.cm-comment{color:#08f}.cm-s-cobalt span.cm-atom{color:#845dc4}.cm-s-cobalt span.cm-attribute,.cm-s-cobalt span.cm-number{color:#ff80e1}.cm-s-cobalt span.cm-keyword{color:#ffee80}.cm-s-cobalt span.cm-string{color:#3ad900}.cm-s-cobalt span.cm-meta{color:#ff9d00}.cm-s-cobalt span.cm-tag,.cm-s-cobalt span.cm-variable-2{color:#9effff}.cm-s-cobalt span.cm-def,.cm-s-cobalt span.cm-variable-3{color:#fff}.cm-s-cobalt span.cm-bracket{color:#d8d8d8}.cm-s-cobalt span.cm-builtin,.cm-s-cobalt span.cm-special{color:#ff9e59}.cm-s-cobalt span.cm-link{color:#845dc4}.cm-s-cobalt span.cm-error{color:#9d1e15}.cm-s-cobalt .CodeMirror-activeline-background{background:#002d57}.cm-s-cobalt .CodeMirror-matchingbracket{outline:1px solid grey;color:#fff!important}.cm-s-colorforth.CodeMirror{background:#000;color:#f8f8f8}.cm-s-colorforth .CodeMirror-gutters{background:#0a001f;border-right:1px solid #aaa}.cm-s-colorforth .CodeMirror-guttermarker{color:#ffbd40}.cm-s-colorforth .CodeMirror-guttermarker-subtle{color:#78846f}.cm-s-colorforth .CodeMirror-linenumber{color:#bababa}.cm-s-colorforth .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-colorforth span.cm-comment{color:#ededed}.cm-s-colorforth span.cm-def{color:#ff1c1c;font-weight:700}.cm-s-colorforth span.cm-keyword{color:#ffd900}.cm-s-colorforth span.cm-builtin{color:#00d95a}.cm-s-colorforth span.cm-variable{color:#73ff00}.cm-s-colorforth span.cm-string{color:#007bff}.cm-s-colorforth span.cm-number{color:#00c4ff}.cm-s-colorforth span.cm-atom{color:#606060}.cm-s-colorforth span.cm-variable-2{color:#eee}.cm-s-colorforth span.cm-variable-3{color:#ddd}.cm-s-colorforth span.cm-meta{color:#ff0}.cm-s-colorforth span.cm-qualifier{color:#fff700}.cm-s-colorforth span.cm-bracket{color:#cc7}.cm-s-colorforth span.cm-tag{color:#ffbd40}.cm-s-colorforth span.cm-attribute{color:#fff700}.cm-s-colorforth span.cm-error{color:red}.cm-s-colorforth div.CodeMirror-selected{background:#333d53}.cm-s-colorforth span.cm-compilation{background:hsla(0,0%,100%,.12)}.cm-s-colorforth .CodeMirror-activeline-background{background:#253540}.cm-s-dracula.CodeMirror,.cm-s-dracula .CodeMirror-gutters{background-color:#282a36!important;color:#f8f8f2!important;border:none}.cm-s-dracula .CodeMirror-gutters{color:#282a36}.cm-s-dracula .CodeMirror-cursor{border-left:thin solid #f8f8f0}.cm-s-dracula .CodeMirror-linenumber{color:#6d8a88}.cm-s-dracula .CodeMirror-selected{background:hsla(0,0%,100%,.1)}.cm-s-dracula .CodeMirror-line::selection,.cm-s-dracula .CodeMirror-line>span::selection,.cm-s-dracula .CodeMirror-line>span>span::selection{background:hsla(0,0%,100%,.1)}.cm-s-dracula .CodeMirror-line::-moz-selection,.cm-s-dracula .CodeMirror-line>span::-moz-selection,.cm-s-dracula .CodeMirror-line>span>span::-moz-selection{background:hsla(0,0%,100%,.1)}.cm-s-dracula span.cm-comment{color:#6272a4}.cm-s-dracula span.cm-string,.cm-s-dracula span.cm-string-2{color:#f1fa8c}.cm-s-dracula span.cm-number{color:#bd93f9}.cm-s-dracula span.cm-variable{color:#50fa7b}.cm-s-dracula span.cm-variable-2{color:#fff}.cm-s-dracula span.cm-def{color:#50fa7b}.cm-s-dracula span.cm-keyword,.cm-s-dracula span.cm-operator{color:#ff79c6}.cm-s-dracula span.cm-atom{color:#bd93f9}.cm-s-dracula span.cm-meta{color:#f8f8f2}.cm-s-dracula span.cm-tag{color:#ff79c6}.cm-s-dracula span.cm-attribute,.cm-s-dracula span.cm-qualifier{color:#50fa7b}.cm-s-dracula span.cm-property{color:#66d9ef}.cm-s-dracula span.cm-builtin{color:#50fa7b}.cm-s-dracula span.cm-variable-3{color:#ffb86c}.cm-s-dracula .CodeMirror-activeline-background{background:hsla(0,0%,100%,.1)}.cm-s-dracula .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-duotone-dark.CodeMirror{background:#2a2734;color:#6c6783}.cm-s-duotone-dark div.CodeMirror-selected{background:#545167!important}.cm-s-duotone-dark .CodeMirror-gutters{background:#2a2734;border-right:0}.cm-s-duotone-dark .CodeMirror-linenumber{color:#545167}.cm-s-duotone-dark .CodeMirror-cursor{border-left:1px solid #ffad5c;border-right:.5em solid #ffad5c;opacity:.5}.cm-s-duotone-dark .CodeMirror-activeline-background{background:#363342;opacity:.5}.cm-s-duotone-dark .cm-fat-cursor .CodeMirror-cursor{background:#ffad5c;opacity:.5}.cm-s-duotone-dark span.cm-atom,.cm-s-duotone-dark span.cm-attribute,.cm-s-duotone-dark span.cm-hr,.cm-s-duotone-dark span.cm-keyword,.cm-s-duotone-dark span.cm-link,.cm-s-duotone-dark span.cm-number,.cm-s-duotone-dark span.cm-quote,.cm-s-duotone-dark span.cm-variable{color:#fc9}.cm-s-duotone-dark span.cm-property{color:#9a86fd}.cm-s-duotone-dark span.cm-negative,.cm-s-duotone-dark span.cm-punctuation,.cm-s-duotone-dark span.cm-unit{color:#e09142}.cm-s-duotone-dark span.cm-string{color:#ffb870}.cm-s-duotone-dark span.cm-operator{color:#ffad5c}.cm-s-duotone-dark span.cm-positive{color:#6a51e6}.cm-s-duotone-dark span.cm-string-2,.cm-s-duotone-dark span.cm-url,.cm-s-duotone-dark span.cm-variable-2,.cm-s-duotone-dark span.cm-variable-3{color:#7a63ee}.cm-s-duotone-dark span.cm-builtin,.cm-s-duotone-dark span.cm-def,.cm-s-duotone-dark span.cm-em,.cm-s-duotone-dark span.cm-header,.cm-s-duotone-dark span.cm-qualifier,.cm-s-duotone-dark span.cm-tag{color:#eeebff}.cm-s-duotone-dark span.cm-bracket,.cm-s-duotone-dark span.cm-comment{color:#6c6783}.cm-s-duotone-dark span.cm-error,.cm-s-duotone-dark span.cm-invalidchar{color:red}.cm-s-duotone-dark span.cm-header{font-weight:400}.cm-s-duotone-dark .CodeMirror-matchingbracket{text-decoration:underline;color:#eeebff!important}.cm-s-duotone-light.CodeMirror{background:#faf8f5;color:#b29762}.cm-s-duotone-light div.CodeMirror-selected{background:#e3dcce!important}.cm-s-duotone-light .CodeMirror-gutters{background:#faf8f5;border-right:0}.cm-s-duotone-light .CodeMirror-linenumber{color:#cdc4b1}.cm-s-duotone-light .CodeMirror-cursor{border-left:1px solid #93abdc;border-right:.5em solid #93abdc;opacity:.5}.cm-s-duotone-light .CodeMirror-activeline-background{background:#e3dcce;opacity:.5}.cm-s-duotone-light .cm-fat-cursor .CodeMirror-cursor{background:#93abdc;opacity:.5}.cm-s-duotone-light-light span.cm-hr,.cm-s-duotone-light-light span.cm-link,.cm-s-duotone-light span.cm-atom,.cm-s-duotone-light span.cm-attribute,.cm-s-duotone-light span.cm-keyword,.cm-s-duotone-light span.cm-number,.cm-s-duotone-light span.cm-quote,.cm-s-duotone-light span.cm-variable{color:#063289}.cm-s-duotone-light span.cm-property{color:#b29762}.cm-s-duotone-light span.cm-negative,.cm-s-duotone-light span.cm-punctuation,.cm-s-duotone-light span.cm-unit{color:#063289}.cm-s-duotone-light span.cm-operator,.cm-s-duotone-light span.cm-string{color:#1659df}.cm-s-duotone-light span.cm-positive,.cm-s-duotone-light span.cm-string-2,.cm-s-duotone-light span.cm-url,.cm-s-duotone-light span.cm-variable-2,.cm-s-duotone-light span.cm-variable-3{color:#896724}.cm-s-duotone-light span.cm-builtin,.cm-s-duotone-light span.cm-def,.cm-s-duotone-light span.cm-em,.cm-s-duotone-light span.cm-header,.cm-s-duotone-light span.cm-qualifier,.cm-s-duotone-light span.cm-tag{color:#2d2006}.cm-s-duotone-light span.cm-bracket,.cm-s-duotone-light span.cm-comment{color:#b6ad9a}.cm-s-duotone-light span.cm-error,.cm-s-duotone-light span.cm-invalidchar{color:red}.cm-s-duotone-light span.cm-header{font-weight:400}.cm-s-duotone-light .CodeMirror-matchingbracket{text-decoration:underline;color:#faf8f5!important}.cm-s-eclipse span.cm-meta{color:#ff1717}.cm-s-eclipse span.cm-keyword{line-height:1em;font-weight:700;color:#7f0055}.cm-s-eclipse span.cm-atom{color:#219}.cm-s-eclipse span.cm-number{color:#164}.cm-s-eclipse span.cm-def{color:#00f}.cm-s-eclipse span.cm-variable{color:#000}.cm-s-eclipse span.cm-variable-2,.cm-s-eclipse span.cm-variable-3{color:#0000c0}.cm-s-eclipse span.cm-operator,.cm-s-eclipse span.cm-property{color:#000}.cm-s-eclipse span.cm-comment{color:#3f7f5f}.cm-s-eclipse span.cm-string{color:#2a00ff}.cm-s-eclipse span.cm-string-2{color:#f50}.cm-s-eclipse span.cm-qualifier{color:#555}.cm-s-eclipse span.cm-builtin{color:#30a}.cm-s-eclipse span.cm-bracket{color:#cc7}.cm-s-eclipse span.cm-tag{color:#170}.cm-s-eclipse span.cm-attribute{color:#00c}.cm-s-eclipse span.cm-link{color:#219}.cm-s-eclipse span.cm-error{color:red}.cm-s-eclipse .CodeMirror-activeline-background{background:#e8f2ff}.cm-s-eclipse .CodeMirror-matchingbracket{outline:1px solid grey;color:#000!important}.cm-s-elegant span.cm-atom,.cm-s-elegant span.cm-number,.cm-s-elegant span.cm-string{color:#762}.cm-s-elegant span.cm-comment{color:#262;font-style:italic;line-height:1em}.cm-s-elegant span.cm-meta{color:#555;font-style:italic;line-height:1em}.cm-s-elegant span.cm-variable{color:#000}.cm-s-elegant span.cm-variable-2{color:#b11}.cm-s-elegant span.cm-qualifier{color:#555}.cm-s-elegant span.cm-keyword{color:#730}.cm-s-elegant span.cm-builtin{color:#30a}.cm-s-elegant span.cm-link{color:#762}.cm-s-elegant span.cm-error{background-color:#fdd}.cm-s-elegant .CodeMirror-activeline-background{background:#e8f2ff}.cm-s-elegant .CodeMirror-matchingbracket{outline:1px solid grey;color:#000!important}.cm-s-erlang-dark.CodeMirror{background:#002240;color:#fff}.cm-s-erlang-dark div.CodeMirror-selected{background:#b36539}.cm-s-erlang-dark .CodeMirror-line::selection,.cm-s-erlang-dark .CodeMirror-line>span::selection,.cm-s-erlang-dark .CodeMirror-line>span>span::selection{background:rgba(179,101,57,.99)}.cm-s-erlang-dark .CodeMirror-line::-moz-selection,.cm-s-erlang-dark .CodeMirror-line>span::-moz-selection,.cm-s-erlang-dark .CodeMirror-line>span>span::-moz-selection{background:rgba(179,101,57,.99)}.cm-s-erlang-dark .CodeMirror-gutters{background:#002240;border-right:1px solid #aaa}.cm-s-erlang-dark .CodeMirror-guttermarker{color:#fff}.cm-s-erlang-dark .CodeMirror-guttermarker-subtle,.cm-s-erlang-dark .CodeMirror-linenumber{color:#d0d0d0}.cm-s-erlang-dark .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-erlang-dark span.cm-quote{color:#ccc}.cm-s-erlang-dark span.cm-atom{color:#f133f1}.cm-s-erlang-dark span.cm-attribute{color:#ff80e1}.cm-s-erlang-dark span.cm-bracket{color:#ff9d00}.cm-s-erlang-dark span.cm-builtin{color:#eaa}.cm-s-erlang-dark span.cm-comment{color:#77f}.cm-s-erlang-dark span.cm-def{color:#e7a}.cm-s-erlang-dark span.cm-keyword{color:#ffee80}.cm-s-erlang-dark span.cm-meta{color:#50fefe}.cm-s-erlang-dark span.cm-number{color:#ffd0d0}.cm-s-erlang-dark span.cm-operator{color:#d55}.cm-s-erlang-dark span.cm-property,.cm-s-erlang-dark span.cm-qualifier{color:#ccc}.cm-s-erlang-dark span.cm-special{color:#fbb}.cm-s-erlang-dark span.cm-string{color:#3ad900}.cm-s-erlang-dark span.cm-string-2{color:#ccc}.cm-s-erlang-dark span.cm-tag{color:#9effff}.cm-s-erlang-dark span.cm-variable{color:#50fe50}.cm-s-erlang-dark span.cm-variable-2{color:#e0e}.cm-s-erlang-dark span.cm-variable-3{color:#ccc}.cm-s-erlang-dark span.cm-error{color:#9d1e15}.cm-s-erlang-dark .CodeMirror-activeline-background{background:#013461}.cm-s-erlang-dark .CodeMirror-matchingbracket{outline:1px solid grey;color:#fff!important}.cm-s-hopscotch.CodeMirror{background:#322931;color:#d5d3d5}.cm-s-hopscotch div.CodeMirror-selected{background:#433b42!important}.cm-s-hopscotch .CodeMirror-gutters{background:#322931;border-right:0}.cm-s-hopscotch .CodeMirror-linenumber{color:#797379}.cm-s-hopscotch .CodeMirror-cursor{border-left:1px solid #989498!important}.cm-s-hopscotch span.cm-comment{color:#b33508}.cm-s-hopscotch span.cm-atom,.cm-s-hopscotch span.cm-number{color:#c85e7c}.cm-s-hopscotch span.cm-attribute,.cm-s-hopscotch span.cm-property{color:#8fc13e}.cm-s-hopscotch span.cm-keyword{color:#dd464c}.cm-s-hopscotch span.cm-string{color:#fdcc59}.cm-s-hopscotch span.cm-variable{color:#8fc13e}.cm-s-hopscotch span.cm-variable-2{color:#1290bf}.cm-s-hopscotch span.cm-def{color:#fd8b19}.cm-s-hopscotch span.cm-error{background:#dd464c;color:#989498}.cm-s-hopscotch span.cm-bracket{color:#d5d3d5}.cm-s-hopscotch span.cm-tag{color:#dd464c}.cm-s-hopscotch span.cm-link{color:#c85e7c}.cm-s-hopscotch .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-hopscotch .CodeMirror-activeline-background{background:#302020}.cm-s-icecoder{color:#666;background:#1d1d1b}.cm-s-icecoder span.cm-keyword{color:#eee;font-weight:700}.cm-s-icecoder span.cm-atom{color:#e1c76e}.cm-s-icecoder span.cm-number{color:#6cb5d9}.cm-s-icecoder span.cm-def{color:#b9ca4a}.cm-s-icecoder span.cm-variable{color:#6cb5d9}.cm-s-icecoder span.cm-variable-2{color:#cc1e5c}.cm-s-icecoder span.cm-variable-3{color:#f9602c}.cm-s-icecoder span.cm-property{color:#eee}.cm-s-icecoder span.cm-operator{color:#9179bb}.cm-s-icecoder span.cm-comment{color:#97a3aa}.cm-s-icecoder span.cm-string{color:#b9ca4a}.cm-s-icecoder span.cm-string-2{color:#6cb5d9}.cm-s-icecoder span.cm-meta,.cm-s-icecoder span.cm-qualifier{color:#555}.cm-s-icecoder span.cm-builtin{color:#214e7b}.cm-s-icecoder span.cm-bracket{color:#cc7}.cm-s-icecoder span.cm-tag{color:#e8e8e8}.cm-s-icecoder span.cm-attribute{color:#099}.cm-s-icecoder span.cm-header{color:#6a0d6a}.cm-s-icecoder span.cm-quote{color:#186718}.cm-s-icecoder span.cm-hr{color:#888}.cm-s-icecoder span.cm-link{color:#e1c76e}.cm-s-icecoder span.cm-error{color:#d00}.cm-s-icecoder .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-icecoder div.CodeMirror-selected{color:#fff;background:#037}.cm-s-icecoder .CodeMirror-gutters{background:#1d1d1b;min-width:41px;border-right:0}.cm-s-icecoder .CodeMirror-linenumber{color:#555;cursor:default}.cm-s-icecoder .CodeMirror-matchingbracket{color:#fff!important;background:#555!important}.cm-s-icecoder .CodeMirror-activeline-background{background:#000}.cm-s-isotope.CodeMirror{background:#000;color:#e0e0e0}.cm-s-isotope div.CodeMirror-selected{background:#404040!important}.cm-s-isotope .CodeMirror-gutters{background:#000;border-right:0}.cm-s-isotope .CodeMirror-linenumber{color:gray}.cm-s-isotope .CodeMirror-cursor{border-left:1px solid silver!important}.cm-s-isotope span.cm-comment{color:#30f}.cm-s-isotope span.cm-atom,.cm-s-isotope span.cm-number{color:#c0f}.cm-s-isotope span.cm-attribute,.cm-s-isotope span.cm-property{color:#3f0}.cm-s-isotope span.cm-keyword{color:red}.cm-s-isotope span.cm-string{color:#f09}.cm-s-isotope span.cm-variable{color:#3f0}.cm-s-isotope span.cm-variable-2{color:#06f}.cm-s-isotope span.cm-def{color:#f90}.cm-s-isotope span.cm-error{background:red;color:silver}.cm-s-isotope span.cm-bracket{color:#e0e0e0}.cm-s-isotope span.cm-tag{color:red}.cm-s-isotope span.cm-link{color:#c0f}.cm-s-isotope .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-isotope .CodeMirror-activeline-background{background:#202020}.cm-s-lesser-dark{line-height:1.3em}.cm-s-lesser-dark.CodeMirror{background:#262626;color:#ebefe7;text-shadow:0 -1px 1px #262626}.cm-s-lesser-dark div.CodeMirror-selected{background:#45443b}.cm-s-lesser-dark .CodeMirror-line::selection,.cm-s-lesser-dark .CodeMirror-line>span::selection,.cm-s-lesser-dark .CodeMirror-line>span>span::selection{background:rgba(69,68,59,.99)}.cm-s-lesser-dark .CodeMirror-line::-moz-selection,.cm-s-lesser-dark .CodeMirror-line>span::-moz-selection,.cm-s-lesser-dark .CodeMirror-line>span>span::-moz-selection{background:rgba(69,68,59,.99)}.cm-s-lesser-dark .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-lesser-dark pre{padding:0 8px}.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket{color:#7efc7e}.cm-s-lesser-dark .CodeMirror-gutters{background:#262626;border-right:1px solid #aaa}.cm-s-lesser-dark .CodeMirror-guttermarker{color:#599eff}.cm-s-lesser-dark .CodeMirror-guttermarker-subtle,.cm-s-lesser-dark .CodeMirror-linenumber{color:#777}.cm-s-lesser-dark span.cm-header{color:#a0a}.cm-s-lesser-dark span.cm-quote{color:#090}.cm-s-lesser-dark span.cm-keyword{color:#599eff}.cm-s-lesser-dark span.cm-atom{color:#c2b470}.cm-s-lesser-dark span.cm-number{color:#b35e4d}.cm-s-lesser-dark span.cm-def{color:#fff}.cm-s-lesser-dark span.cm-variable{color:#d9bf8c}.cm-s-lesser-dark span.cm-variable-2{color:#669199}.cm-s-lesser-dark span.cm-variable-3{color:#fff}.cm-s-lesser-dark span.cm-operator,.cm-s-lesser-dark span.cm-property{color:#92a75c}.cm-s-lesser-dark span.cm-comment{color:#666}.cm-s-lesser-dark span.cm-string{color:#bcd279}.cm-s-lesser-dark span.cm-string-2{color:#f50}.cm-s-lesser-dark span.cm-meta{color:#738c73}.cm-s-lesser-dark span.cm-qualifier{color:#555}.cm-s-lesser-dark span.cm-builtin{color:#ff9e59}.cm-s-lesser-dark span.cm-bracket{color:#ebefe7}.cm-s-lesser-dark span.cm-tag{color:#669199}.cm-s-lesser-dark span.cm-attribute{color:#00c}.cm-s-lesser-dark span.cm-hr{color:#999}.cm-s-lesser-dark span.cm-link{color:#00c}.cm-s-lesser-dark span.cm-error{color:#9d1e15}.cm-s-lesser-dark .CodeMirror-activeline-background{background:#3c3a3a}.cm-s-lesser-dark .CodeMirror-matchingbracket{outline:1px solid grey;color:#fff!important}.cm-s-liquibyte.CodeMirror{background-color:#000;color:#fff;line-height:1.2em;font-size:1em}.cm-s-liquibyte .CodeMirror-focused .cm-matchhighlight{text-decoration:underline;-webkit-text-decoration-color:#0f0;text-decoration-color:#0f0;-webkit-text-decoration-style:wavy;text-decoration-style:wavy}.cm-s-liquibyte .cm-trailingspace{text-decoration:line-through;-webkit-text-decoration-color:red;text-decoration-color:red;-webkit-text-decoration-style:dotted;text-decoration-style:dotted}.cm-s-liquibyte .cm-tab{text-decoration:line-through;-webkit-text-decoration-color:#404040;text-decoration-color:#404040;-webkit-text-decoration-style:dotted;text-decoration-style:dotted}.cm-s-liquibyte .CodeMirror-gutters{background-color:#262626;border-right:1px solid #505050;padding-right:.8em}.cm-s-liquibyte .CodeMirror-gutter-elt div{font-size:1.2em}.cm-s-liquibyte .CodeMirror-linenumber{color:#606060;padding-left:0}.cm-s-liquibyte .CodeMirror-cursor{border-left:1px solid #eee}.cm-s-liquibyte span.cm-comment{color:green}.cm-s-liquibyte span.cm-def{color:#ffaf40;font-weight:700}.cm-s-liquibyte span.cm-keyword{color:#c080ff;font-weight:700}.cm-s-liquibyte span.cm-builtin{color:#ffaf40;font-weight:700}.cm-s-liquibyte span.cm-variable{color:#5967ff;font-weight:700}.cm-s-liquibyte span.cm-string{color:#ff8000}.cm-s-liquibyte span.cm-number{color:#0f0;font-weight:700}.cm-s-liquibyte span.cm-atom{color:#bf3030;font-weight:700}.cm-s-liquibyte span.cm-variable-2{color:#007f7f;font-weight:700}.cm-s-liquibyte span.cm-variable-3{color:#c080ff;font-weight:700}.cm-s-liquibyte span.cm-property{color:#999;font-weight:700}.cm-s-liquibyte span.cm-operator{color:#fff}.cm-s-liquibyte span.cm-meta{color:#0f0}.cm-s-liquibyte span.cm-qualifier{color:#fff700;font-weight:700}.cm-s-liquibyte span.cm-bracket{color:#cc7}.cm-s-liquibyte span.cm-tag{color:#ff0;font-weight:700}.cm-s-liquibyte span.cm-attribute{color:#c080ff;font-weight:700}.cm-s-liquibyte span.cm-error{color:red}.cm-s-liquibyte div.CodeMirror-selected{background-color:rgba(255,0,0,.25)}.cm-s-liquibyte span.cm-compilation{background-color:hsla(0,0%,100%,.12)}.cm-s-liquibyte .CodeMirror-activeline-background{background-color:rgba(0,255,0,.15)}.cm-s-liquibyte .CodeMirror span.CodeMirror-matchingbracket{color:#0f0;font-weight:700}.cm-s-liquibyte .CodeMirror span.CodeMirror-nonmatchingbracket{color:red;font-weight:700}.CodeMirror-matchingtag{background-color:rgba(150,255,0,.3)}.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div:hover,div.CodeMirror-simplescroll-vertical div:hover{background-color:rgba(80,80,80,.7)}.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div,div.CodeMirror-simplescroll-vertical div{background-color:rgba(80,80,80,.3);border:1px solid #404040;border-radius:5px}.cm-s-liquibyte div.CodeMirror-simplescroll-vertical div{border-top:1px solid #404040;border-bottom:1px solid #404040}.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div{border-left:1px solid #404040;border-right:1px solid #404040}.cm-s-liquibyte div.CodeMirror-simplescroll-vertical{background-color:#262626}.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal{background-color:#262626;border-top:1px solid #404040}.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div,div.CodeMirror-overlayscroll-vertical div{background-color:#404040;border-radius:5px}.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div,.cm-s-liquibyte div.CodeMirror-overlayscroll-vertical div{border:1px solid #404040}.cm-s-material.CodeMirror{background-color:#263238;color:#e9eded}.cm-s-material .CodeMirror-gutters{background:#263238;color:#537f7e;border:none}.cm-s-material .CodeMirror-guttermarker,.cm-s-material .CodeMirror-guttermarker-subtle,.cm-s-material .CodeMirror-linenumber{color:#537f7e}.cm-s-material .CodeMirror-cursor{border-left:1px solid #f8f8f0}.cm-s-material div.CodeMirror-selected{background:hsla(0,0%,100%,.15)}.cm-s-material.CodeMirror-focused div.CodeMirror-selected{background:hsla(0,0%,100%,.1)}.cm-s-material .CodeMirror-line::selection,.cm-s-material .CodeMirror-line>span::selection,.cm-s-material .CodeMirror-line>span>span::selection{background:hsla(0,0%,100%,.1)}.cm-s-material .CodeMirror-line::-moz-selection,.cm-s-material .CodeMirror-line>span::-moz-selection,.cm-s-material .CodeMirror-line>span>span::-moz-selection{background:hsla(0,0%,100%,.1)}.cm-s-material .CodeMirror-activeline-background{background:transparent}.cm-s-material .cm-keyword{color:#c792ea}.cm-s-material .cm-operator{color:#e9eded}.cm-s-material .cm-variable-2{color:#80cbc4}.cm-s-material .cm-variable-3{color:#82b1ff}.cm-s-material .cm-builtin{color:#decb6b}.cm-s-material .cm-atom,.cm-s-material .cm-number{color:#f77669}.cm-s-material .cm-def{color:#e9eded}.cm-s-material .cm-string{color:#c3e88d}.cm-s-material .cm-string-2{color:#80cbc4}.cm-s-material .cm-comment{color:#546e7a}.cm-s-material .cm-variable{color:#82b1ff}.cm-s-material .cm-meta,.cm-s-material .cm-tag{color:#80cbc4}.cm-s-material .cm-attribute{color:#ffcb6b}.cm-s-material .cm-property{color:#80cbae}.cm-s-material .cm-qualifier,.cm-s-material .cm-variable-3{color:#decb6b}.cm-s-material .cm-tag{color:#ff5370}.cm-s-material .cm-error{color:#fff;background-color:#ec5f67}.cm-s-material .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-mbo.CodeMirror{background:#2c2c2c;color:#ffffec}.cm-s-mbo div.CodeMirror-selected{background:#716c62}.cm-s-mbo .CodeMirror-line::selection,.cm-s-mbo .CodeMirror-line>span::selection,.cm-s-mbo .CodeMirror-line>span>span::selection{background:hsla(40,7%,41%,.99)}.cm-s-mbo .CodeMirror-line::-moz-selection,.cm-s-mbo .CodeMirror-line>span::-moz-selection,.cm-s-mbo .CodeMirror-line>span>span::-moz-selection{background:hsla(40,7%,41%,.99)}.cm-s-mbo .CodeMirror-gutters{background:#4e4e4e;border-right:0}.cm-s-mbo .CodeMirror-guttermarker{color:#fff}.cm-s-mbo .CodeMirror-guttermarker-subtle{color:grey}.cm-s-mbo .CodeMirror-linenumber{color:#dadada}.cm-s-mbo .CodeMirror-cursor{border-left:1px solid #ffffec}.cm-s-mbo span.cm-comment{color:#95958a}.cm-s-mbo span.cm-atom,.cm-s-mbo span.cm-number{color:#00a8c6}.cm-s-mbo span.cm-attribute,.cm-s-mbo span.cm-property{color:#9ddfe9}.cm-s-mbo span.cm-keyword{color:#ffb928}.cm-s-mbo span.cm-string{color:#ffcf6c}.cm-s-mbo span.cm-string.cm-property,.cm-s-mbo span.cm-variable{color:#ffffec}.cm-s-mbo span.cm-variable-2{color:#00a8c6}.cm-s-mbo span.cm-def{color:#ffffec}.cm-s-mbo span.cm-bracket{color:#fffffc;font-weight:700}.cm-s-mbo span.cm-tag{color:#9ddfe9}.cm-s-mbo span.cm-link{color:#f54b07}.cm-s-mbo span.cm-error{border-bottom:#636363;color:#ffffec}.cm-s-mbo span.cm-qualifier{color:#ffffec}.cm-s-mbo .CodeMirror-activeline-background{background:#494b41}.cm-s-mbo .CodeMirror-matchingbracket{color:#ffb928!important}.cm-s-mbo .CodeMirror-matchingtag{background:hsla(0,0%,100%,.37)}.cm-s-mdn-like.CodeMirror{color:#999;background-color:#fff}.cm-s-mdn-like div.CodeMirror-selected{background:#cfc}.cm-s-mdn-like .CodeMirror-line::selection,.cm-s-mdn-like .CodeMirror-line>span::selection,.cm-s-mdn-like .CodeMirror-line>span>span::selection{background:#cfc}.cm-s-mdn-like .CodeMirror-line::-moz-selection,.cm-s-mdn-like .CodeMirror-line>span::-moz-selection,.cm-s-mdn-like .CodeMirror-line>span>span::-moz-selection{background:#cfc}.cm-s-mdn-like .CodeMirror-gutters{background:#f8f8f8;border-left:6px solid rgba(0,83,159,.65);color:#333}.cm-s-mdn-like .CodeMirror-linenumber{color:#aaa;padding-left:8px}.cm-s-mdn-like .CodeMirror-cursor{border-left:2px solid #222}.cm-s-mdn-like .cm-keyword{color:#6262ff}.cm-s-mdn-like .cm-atom{color:#f90}.cm-s-mdn-like .cm-number{color:#ca7841}.cm-s-mdn-like .cm-def{color:#8da6ce}.cm-s-mdn-like span.cm-tag,.cm-s-mdn-like span.cm-variable-2{color:#690}.cm-s-mdn-like .cm-variable,.cm-s-mdn-like span.cm-def,.cm-s-mdn-like span.cm-variable-3{color:#07a}.cm-s-mdn-like .cm-property{color:#905}.cm-s-mdn-like .cm-qualifier{color:#690}.cm-s-mdn-like .cm-operator{color:#cda869}.cm-s-mdn-like .cm-comment{color:#777;font-weight:400}.cm-s-mdn-like .cm-string{color:#07a;font-style:italic}.cm-s-mdn-like .cm-string-2{color:#bd6b18}.cm-s-mdn-like .cm-meta{color:#000}.cm-s-mdn-like .cm-builtin{color:#9b7536}.cm-s-mdn-like .cm-tag{color:#997643}.cm-s-mdn-like .cm-attribute{color:#d6bb6d}.cm-s-mdn-like .cm-header{color:#ff6400}.cm-s-mdn-like .cm-hr{color:#aeaeae}.cm-s-mdn-like .cm-link{color:#ad9361;font-style:italic;text-decoration:none}.cm-s-mdn-like .cm-error{border-bottom:1px solid red}div.cm-s-mdn-like .CodeMirror-activeline-background{background:#efefff}div.cm-s-mdn-like span.CodeMirror-matchingbracket{outline:1px solid grey;color:inherit}.cm-s-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vClH59YGbHx1J8VZTyAjQepJjmXwAKTDQI3omc3p1U4gDUf6RfcdYfrUp5ClAi2J3Ba6UOXGo+K+bQrjjssitG2SJzshaLwMtXgRagUNpYYoVkMSBLM+9GGiJZMvduG6DRZ4qc04DMPtQQxOjEtACmhO7K1AbNbQDEggZyJwscFpAGwENhoBeUwh3bWolhe8BTYVKxQEWrSUn/uhcM5KhvUu/+eQu0Lzhi+VrK0PrZZNDQKs9cpYUuFYgMVpD4/NxenJTiMCNqdUEUf1qZWjppLT5qSkkUZbCwkbZMSuVnu80hfSkzRbQeqCZSAh6huR4VtoM2gHAlLf72smuWgE+VV7XpE25Ab2WFDgyhnSuKbs4GuGzCjR+tIoUuMFg3kgcWKLTwRqanJQ2W00hAsenfaApRC42hbCvK1SlE0HtE9BGgneJO+ELamitD1YjjOYnNYVcraGhtKkW0EqVVeDx733I2NH581k1NNxNLG0i0IJ8/NjVaOZ0tYZ2Vtr0Xv7tPV3hkWp9EFkgS/J0vosngTaSoaG06WHi+xObQkaAdlbanP8B2+2l0f90LmUAAAAASUVORK5CYII=)}.cm-s-midnight span.CodeMirror-matchhighlight{background:#494949}.cm-s-midnight.CodeMirror-focused span.CodeMirror-matchhighlight{background:#314d67!important}.cm-s-midnight .CodeMirror-activeline-background{background:#253540}.cm-s-midnight.CodeMirror{background:#0f192a;color:#d1edff;border-top:1px solid #000;border-bottom:1px solid #000}.cm-s-midnight div.CodeMirror-selected{background:#314d67}.cm-s-midnight .CodeMirror-line::selection,.cm-s-midnight .CodeMirror-line>span::selection,.cm-s-midnight .CodeMirror-line>span>span::selection{background:rgba(49,77,103,.99)}.cm-s-midnight .CodeMirror-line::-moz-selection,.cm-s-midnight .CodeMirror-line>span::-moz-selection,.cm-s-midnight .CodeMirror-line>span>span::-moz-selection{background:rgba(49,77,103,.99)}.cm-s-midnight .CodeMirror-gutters{background:#0f192a;border-right:1px solid}.cm-s-midnight .CodeMirror-guttermarker{color:#fff}.cm-s-midnight .CodeMirror-guttermarker-subtle,.cm-s-midnight .CodeMirror-linenumber{color:#d0d0d0}.cm-s-midnight .CodeMirror-cursor{border-left:1px solid #f8f8f0}.cm-s-midnight span.cm-comment{color:#428bdd}.cm-s-midnight span.cm-atom{color:#ae81ff}.cm-s-midnight span.cm-number{color:#d1edff}.cm-s-midnight span.cm-attribute,.cm-s-midnight span.cm-property{color:#a6e22e}.cm-s-midnight span.cm-keyword{color:#e83737}.cm-s-midnight span.cm-string{color:#1dc116}.cm-s-midnight span.cm-variable,.cm-s-midnight span.cm-variable-2{color:#ffaa3e}.cm-s-midnight span.cm-def{color:#4dd}.cm-s-midnight span.cm-bracket{color:#d1edff}.cm-s-midnight span.cm-tag{color:#449}.cm-s-midnight span.cm-link{color:#ae81ff}.cm-s-midnight span.cm-error{background:#f92672;color:#f8f8f0}.cm-s-midnight .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.cm-s-monokai div.CodeMirror-selected{background:#49483e}.cm-s-monokai .CodeMirror-line::selection,.cm-s-monokai .CodeMirror-line>span::selection,.cm-s-monokai .CodeMirror-line>span>span::selection{background:rgba(73,72,62,.99)}.cm-s-monokai .CodeMirror-line::-moz-selection,.cm-s-monokai .CodeMirror-line>span::-moz-selection,.cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,.99)}.cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0}.cm-s-monokai .CodeMirror-guttermarker{color:#fff}.cm-s-monokai .CodeMirror-guttermarker-subtle,.cm-s-monokai .CodeMirror-linenumber{color:#d0d0d0}.cm-s-monokai .CodeMirror-cursor{border-left:1px solid #f8f8f0}.cm-s-monokai span.cm-comment{color:#75715e}.cm-s-monokai span.cm-atom,.cm-s-monokai span.cm-number{color:#ae81ff}.cm-s-monokai span.cm-attribute,.cm-s-monokai span.cm-property{color:#a6e22e}.cm-s-monokai span.cm-keyword{color:#f92672}.cm-s-monokai span.cm-builtin{color:#66d9ef}.cm-s-monokai span.cm-string{color:#e6db74}.cm-s-monokai span.cm-variable{color:#f8f8f2}.cm-s-monokai span.cm-variable-2{color:#9effff}.cm-s-monokai span.cm-variable-3{color:#66d9ef}.cm-s-monokai span.cm-def{color:#fd971f}.cm-s-monokai span.cm-bracket{color:#f8f8f2}.cm-s-monokai span.cm-tag{color:#f92672}.cm-s-monokai span.cm-header,.cm-s-monokai span.cm-link{color:#ae81ff}.cm-s-monokai span.cm-error{background:#f92672;color:#f8f8f0}.cm-s-monokai .CodeMirror-activeline-background{background:#373831}.cm-s-monokai .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-neat span.cm-comment{color:#a86}.cm-s-neat span.cm-keyword{line-height:1em;font-weight:700;color:blue}.cm-s-neat span.cm-string{color:#a22}.cm-s-neat span.cm-builtin{line-height:1em;font-weight:700;color:#077}.cm-s-neat span.cm-special{line-height:1em;font-weight:700;color:#0aa}.cm-s-neat span.cm-variable{color:#000}.cm-s-neat span.cm-atom,.cm-s-neat span.cm-number{color:#3a3}.cm-s-neat span.cm-meta{color:#555}.cm-s-neat span.cm-link{color:#3a3}.cm-s-neat .CodeMirror-activeline-background{background:#e8f2ff}.cm-s-neat .CodeMirror-matchingbracket{outline:1px solid grey;color:#000!important}.cm-s-neo.CodeMirror{background-color:#fff;color:#2e383c;line-height:1.4375}.cm-s-neo .cm-comment{color:#75787b}.cm-s-neo .cm-keyword,.cm-s-neo .cm-property{color:#1d75b3}.cm-s-neo .cm-atom,.cm-s-neo .cm-number{color:#75438a}.cm-s-neo .cm-node,.cm-s-neo .cm-tag{color:#9c3328}.cm-s-neo .cm-string{color:#b35e14}.cm-s-neo .cm-qualifier,.cm-s-neo .cm-variable{color:#047d65}.cm-s-neo pre{padding:0}.cm-s-neo .CodeMirror-gutters{border:none;border-right:10px solid transparent;background-color:transparent}.cm-s-neo .CodeMirror-linenumber{padding:0;color:#e0e2e5}.cm-s-neo .CodeMirror-guttermarker{color:#1d75b3}.cm-s-neo .CodeMirror-guttermarker-subtle{color:#e0e2e5}.cm-s-neo .CodeMirror-cursor{width:auto;border:0;background:hsla(223,4%,62%,.37);z-index:1}.cm-s-night.CodeMirror{background:#0a001f;color:#f8f8f8}.cm-s-night div.CodeMirror-selected{background:#447}.cm-s-night .CodeMirror-line::selection,.cm-s-night .CodeMirror-line>span::selection,.cm-s-night .CodeMirror-line>span>span::selection{background:rgba(68,68,119,.99)}.cm-s-night .CodeMirror-line::-moz-selection,.cm-s-night .CodeMirror-line>span::-moz-selection,.cm-s-night .CodeMirror-line>span>span::-moz-selection{background:rgba(68,68,119,.99)}.cm-s-night .CodeMirror-gutters{background:#0a001f;border-right:1px solid #aaa}.cm-s-night .CodeMirror-guttermarker{color:#fff}.cm-s-night .CodeMirror-guttermarker-subtle{color:#bbb}.cm-s-night .CodeMirror-linenumber{color:#f8f8f8}.cm-s-night .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-night span.cm-comment{color:#8900d1}.cm-s-night span.cm-atom{color:#845dc4}.cm-s-night span.cm-attribute,.cm-s-night span.cm-number{color:#ffd500}.cm-s-night span.cm-keyword{color:#599eff}.cm-s-night span.cm-string{color:#37f14a}.cm-s-night span.cm-meta{color:#7678e2}.cm-s-night span.cm-tag,.cm-s-night span.cm-variable-2{color:#99b2ff}.cm-s-night span.cm-def,.cm-s-night span.cm-variable-3{color:#fff}.cm-s-night span.cm-bracket{color:#8da6ce}.cm-s-night span.cm-builtin,.cm-s-night span.cm-special{color:#ff9e59}.cm-s-night span.cm-link{color:#845dc4}.cm-s-night span.cm-error{color:#9d1e15}.cm-s-night .CodeMirror-activeline-background{background:#1c005a}.cm-s-night .CodeMirror-matchingbracket{outline:1px solid grey;color:#fff!important}.cm-s-panda-syntax{background:#292a2b;color:#e6e6e6;line-height:1.5;font-family:Operator Mono,Source Sans Pro,Menlo,Monaco,Consolas,Courier New,monospace}.cm-s-panda-syntax .CodeMirror-cursor{border-color:#ff2c6d}.cm-s-panda-syntax .CodeMirror-activeline-background{background:rgba(99,123,156,.1)}.cm-s-panda-syntax .CodeMirror-selected{background:#fff}.cm-s-panda-syntax .cm-comment{font-style:italic;color:#676b79}.cm-s-panda-syntax .cm-operator{color:#f3f3f3}.cm-s-panda-syntax .cm-string{color:#19f9d8}.cm-s-panda-syntax .cm-string-2{color:#ffb86c}.cm-s-panda-syntax .cm-tag{color:#ff2c6d}.cm-s-panda-syntax .cm-meta{color:#b084eb}.cm-s-panda-syntax .cm-number{color:#ffb86c}.cm-s-panda-syntax .cm-atom{color:#ff2c6d}.cm-s-panda-syntax .cm-keyword{color:#ff75b5}.cm-s-panda-syntax .cm-variable{color:#ffb86c}.cm-s-panda-syntax .cm-variable-2,.cm-s-panda-syntax .cm-variable-3{color:#ff9ac1}.cm-s-panda-syntax .cm-def{color:#e6e6e6}.cm-s-panda-syntax .cm-property{color:#f3f3f3}.cm-s-panda-syntax .cm-attribute,.cm-s-panda-syntax .cm-unit{color:#ffb86c}.cm-s-panda-syntax .CodeMirror-matchingbracket{border-bottom:1px dotted #19f9d8;padding-bottom:2px;color:#e6e6e6}.cm-s-panda-syntax .CodeMirror-gutters{background:#292a2b;border-right-color:hsla(0,0%,100%,.1)}.cm-s-panda-syntax .CodeMirror-linenumber{color:#e6e6e6;opacity:.6}.cm-s-paraiso-dark.CodeMirror{background:#2f1e2e;color:#b9b6b0}.cm-s-paraiso-dark div.CodeMirror-selected{background:#41323f}.cm-s-paraiso-dark .CodeMirror-line::selection,.cm-s-paraiso-dark .CodeMirror-line>span::selection,.cm-s-paraiso-dark .CodeMirror-line>span>span::selection{background:rgba(65,50,63,.99)}.cm-s-paraiso-dark .CodeMirror-line::-moz-selection,.cm-s-paraiso-dark .CodeMirror-line>span::-moz-selection,.cm-s-paraiso-dark .CodeMirror-line>span>span::-moz-selection{background:rgba(65,50,63,.99)}.cm-s-paraiso-dark .CodeMirror-gutters{background:#2f1e2e;border-right:0}.cm-s-paraiso-dark .CodeMirror-guttermarker{color:#ef6155}.cm-s-paraiso-dark .CodeMirror-guttermarker-subtle,.cm-s-paraiso-dark .CodeMirror-linenumber{color:#776e71}.cm-s-paraiso-dark .CodeMirror-cursor{border-left:1px solid #8d8687}.cm-s-paraiso-dark span.cm-comment{color:#e96ba8}.cm-s-paraiso-dark span.cm-atom,.cm-s-paraiso-dark span.cm-number{color:#815ba4}.cm-s-paraiso-dark span.cm-attribute,.cm-s-paraiso-dark span.cm-property{color:#48b685}.cm-s-paraiso-dark span.cm-keyword{color:#ef6155}.cm-s-paraiso-dark span.cm-string{color:#fec418}.cm-s-paraiso-dark span.cm-variable{color:#48b685}.cm-s-paraiso-dark span.cm-variable-2{color:#06b6ef}.cm-s-paraiso-dark span.cm-def{color:#f99b15}.cm-s-paraiso-dark span.cm-bracket{color:#b9b6b0}.cm-s-paraiso-dark span.cm-tag{color:#ef6155}.cm-s-paraiso-dark span.cm-link{color:#815ba4}.cm-s-paraiso-dark span.cm-error{background:#ef6155;color:#8d8687}.cm-s-paraiso-dark .CodeMirror-activeline-background{background:#4d344a}.cm-s-paraiso-dark .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-paraiso-light.CodeMirror{background:#e7e9db;color:#41323f}.cm-s-paraiso-light div.CodeMirror-selected{background:#b9b6b0}.cm-s-paraiso-light .CodeMirror-line::selection,.cm-s-paraiso-light .CodeMirror-line>span::selection,.cm-s-paraiso-light .CodeMirror-line>span>span::selection{background:#b9b6b0}.cm-s-paraiso-light .CodeMirror-line::-moz-selection,.cm-s-paraiso-light .CodeMirror-line>span::-moz-selection,.cm-s-paraiso-light .CodeMirror-line>span>span::-moz-selection{background:#b9b6b0}.cm-s-paraiso-light .CodeMirror-gutters{background:#e7e9db;border-right:0}.cm-s-paraiso-light .CodeMirror-guttermarker{color:#000}.cm-s-paraiso-light .CodeMirror-guttermarker-subtle,.cm-s-paraiso-light .CodeMirror-linenumber{color:#8d8687}.cm-s-paraiso-light .CodeMirror-cursor{border-left:1px solid #776e71}.cm-s-paraiso-light span.cm-comment{color:#e96ba8}.cm-s-paraiso-light span.cm-atom,.cm-s-paraiso-light span.cm-number{color:#815ba4}.cm-s-paraiso-light span.cm-attribute,.cm-s-paraiso-light span.cm-property{color:#48b685}.cm-s-paraiso-light span.cm-keyword{color:#ef6155}.cm-s-paraiso-light span.cm-string{color:#fec418}.cm-s-paraiso-light span.cm-variable{color:#48b685}.cm-s-paraiso-light span.cm-variable-2{color:#06b6ef}.cm-s-paraiso-light span.cm-def{color:#f99b15}.cm-s-paraiso-light span.cm-bracket{color:#41323f}.cm-s-paraiso-light span.cm-tag{color:#ef6155}.cm-s-paraiso-light span.cm-link{color:#815ba4}.cm-s-paraiso-light span.cm-error{background:#ef6155;color:#776e71}.cm-s-paraiso-light .CodeMirror-activeline-background{background:#cfd1c4}.cm-s-paraiso-light .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-pastel-on-dark.CodeMirror{background:#2c2827;color:#8f938f;line-height:1.5}.cm-s-pastel-on-dark div.CodeMirror-selected{background:rgba(221,240,255,.2)}.cm-s-pastel-on-dark .CodeMirror-line::selection,.cm-s-pastel-on-dark .CodeMirror-line>span::selection,.cm-s-pastel-on-dark .CodeMirror-line>span>span::selection{background:rgba(221,240,255,.2)}.cm-s-pastel-on-dark .CodeMirror-line::-moz-selection,.cm-s-pastel-on-dark .CodeMirror-line>span::-moz-selection,.cm-s-pastel-on-dark .CodeMirror-line>span>span::-moz-selection{background:rgba(221,240,255,.2)}.cm-s-pastel-on-dark .CodeMirror-gutters{background:#34302f;border-right:0;padding:0 3px}.cm-s-pastel-on-dark .CodeMirror-guttermarker{color:#fff}.cm-s-pastel-on-dark .CodeMirror-guttermarker-subtle,.cm-s-pastel-on-dark .CodeMirror-linenumber{color:#8f938f}.cm-s-pastel-on-dark .CodeMirror-cursor{border-left:1px solid #a7a7a7}.cm-s-pastel-on-dark span.cm-comment{color:#a6c6ff}.cm-s-pastel-on-dark span.cm-atom{color:#de8e30}.cm-s-pastel-on-dark span.cm-number{color:#ccc}.cm-s-pastel-on-dark span.cm-property{color:#8f938f}.cm-s-pastel-on-dark span.cm-attribute{color:#a6e22e}.cm-s-pastel-on-dark span.cm-keyword{color:#aeb2f8}.cm-s-pastel-on-dark span.cm-string{color:#66a968}.cm-s-pastel-on-dark span.cm-variable{color:#aeb2f8}.cm-s-pastel-on-dark span.cm-variable-2{color:#bebf55}.cm-s-pastel-on-dark span.cm-variable-3{color:#de8e30}.cm-s-pastel-on-dark span.cm-def{color:#757ad8}.cm-s-pastel-on-dark span.cm-bracket{color:#f8f8f2}.cm-s-pastel-on-dark span.cm-tag{color:#c1c144}.cm-s-pastel-on-dark span.cm-link{color:#ae81ff}.cm-s-pastel-on-dark span.cm-builtin,.cm-s-pastel-on-dark span.cm-qualifier{color:#c1c144}.cm-s-pastel-on-dark span.cm-error{background:#757ad8;color:#f8f8f0}.cm-s-pastel-on-dark .CodeMirror-activeline-background{background:hsla(0,0%,100%,.031)}.cm-s-pastel-on-dark .CodeMirror-matchingbracket{border:1px solid hsla(0,0%,100%,.25);color:#8f938f!important;margin:-1px -1px 0}.cm-s-railscasts.CodeMirror{background:#2b2b2b;color:#f4f1ed}.cm-s-railscasts div.CodeMirror-selected{background:#272935!important}.cm-s-railscasts .CodeMirror-gutters{background:#2b2b2b;border-right:0}.cm-s-railscasts .CodeMirror-linenumber{color:#5a647e}.cm-s-railscasts .CodeMirror-cursor{border-left:1px solid #d4cfc9!important}.cm-s-railscasts span.cm-comment{color:#bc9458}.cm-s-railscasts span.cm-atom,.cm-s-railscasts span.cm-number{color:#b6b3eb}.cm-s-railscasts span.cm-attribute,.cm-s-railscasts span.cm-property{color:#a5c261}.cm-s-railscasts span.cm-keyword{color:#da4939}.cm-s-railscasts span.cm-string{color:#ffc66d}.cm-s-railscasts span.cm-variable{color:#a5c261}.cm-s-railscasts span.cm-variable-2{color:#6d9cbe}.cm-s-railscasts span.cm-def{color:#cc7833}.cm-s-railscasts span.cm-error{background:#da4939;color:#d4cfc9}.cm-s-railscasts span.cm-bracket{color:#f4f1ed}.cm-s-railscasts span.cm-tag{color:#da4939}.cm-s-railscasts span.cm-link{color:#b6b3eb}.cm-s-railscasts .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-railscasts .CodeMirror-activeline-background{background:#303040}.cm-s-rubyblue.CodeMirror{background:#112435;color:#fff}.cm-s-rubyblue div.CodeMirror-selected{background:#38566f}.cm-s-rubyblue .CodeMirror-line::selection,.cm-s-rubyblue .CodeMirror-line>span::selection,.cm-s-rubyblue .CodeMirror-line>span>span::selection{background:rgba(56,86,111,.99)}.cm-s-rubyblue .CodeMirror-line::-moz-selection,.cm-s-rubyblue .CodeMirror-line>span::-moz-selection,.cm-s-rubyblue .CodeMirror-line>span>span::-moz-selection{background:rgba(56,86,111,.99)}.cm-s-rubyblue .CodeMirror-gutters{background:#1f4661;border-right:7px solid #3e7087}.cm-s-rubyblue .CodeMirror-guttermarker{color:#fff}.cm-s-rubyblue .CodeMirror-guttermarker-subtle{color:#3e7087}.cm-s-rubyblue .CodeMirror-linenumber{color:#fff}.cm-s-rubyblue .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-rubyblue span.cm-comment{color:#999;font-style:italic;line-height:1em}.cm-s-rubyblue span.cm-atom{color:#f4c20b}.cm-s-rubyblue span.cm-attribute,.cm-s-rubyblue span.cm-number{color:#82c6e0}.cm-s-rubyblue span.cm-keyword{color:#f0f}.cm-s-rubyblue span.cm-string{color:#f08047}.cm-s-rubyblue span.cm-meta{color:#f0f}.cm-s-rubyblue span.cm-tag,.cm-s-rubyblue span.cm-variable-2{color:#7bd827}.cm-s-rubyblue span.cm-def,.cm-s-rubyblue span.cm-variable-3{color:#fff}.cm-s-rubyblue span.cm-bracket{color:#f0f}.cm-s-rubyblue span.cm-link{color:#f4c20b}.cm-s-rubyblue span.CodeMirror-matchingbracket{color:#f0f!important}.cm-s-rubyblue span.cm-builtin,.cm-s-rubyblue span.cm-special{color:#ff9d00}.cm-s-rubyblue span.cm-error{color:#af2018}.cm-s-rubyblue .CodeMirror-activeline-background{background:#173047}.cm-s-seti.CodeMirror{background-color:#151718!important;color:#cfd2d1!important;border:none}.cm-s-seti .CodeMirror-gutters{color:#404b53;background-color:#0e1112;border:none}.cm-s-seti .CodeMirror-cursor{border-left:thin solid #f8f8f0}.cm-s-seti .CodeMirror-linenumber{color:#6d8a88}.cm-s-seti.CodeMirror-focused div.CodeMirror-selected{background:hsla(0,0%,100%,.1)}.cm-s-seti .CodeMirror-line::selection,.cm-s-seti .CodeMirror-line>span::selection,.cm-s-seti .CodeMirror-line>span>span::selection{background:hsla(0,0%,100%,.1)}.cm-s-seti .CodeMirror-line::-moz-selection,.cm-s-seti .CodeMirror-line>span::-moz-selection,.cm-s-seti .CodeMirror-line>span>span::-moz-selection{background:hsla(0,0%,100%,.1)}.cm-s-seti span.cm-comment{color:#41535b}.cm-s-seti span.cm-string,.cm-s-seti span.cm-string-2{color:#55b5db}.cm-s-seti span.cm-number{color:#cd3f45}.cm-s-seti span.cm-variable{color:#55b5db}.cm-s-seti span.cm-variable-2{color:#a074c4}.cm-s-seti span.cm-def{color:#55b5db}.cm-s-seti span.cm-keyword{color:#ff79c6}.cm-s-seti span.cm-operator{color:#9fca56}.cm-s-seti span.cm-keyword{color:#e6cd69}.cm-s-seti span.cm-atom{color:#cd3f45}.cm-s-seti span.cm-meta,.cm-s-seti span.cm-tag{color:#55b5db}.cm-s-seti span.cm-attribute,.cm-s-seti span.cm-qualifier{color:#9fca56}.cm-s-seti span.cm-property{color:#a074c4}.cm-s-seti span.cm-builtin,.cm-s-seti span.cm-variable-3{color:#9fca56}.cm-s-seti .CodeMirror-activeline-background{background:#101213}.cm-s-seti .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.solarized.base03{color:#002b36}.solarized.base02{color:#073642}.solarized.base01{color:#586e75}.solarized.base00{color:#657b83}.solarized.base0{color:#839496}.solarized.base1{color:#93a1a1}.solarized.base2{color:#eee8d5}.solarized.base3{color:#fdf6e3}.solarized.solar-yellow{color:#b58900}.solarized.solar-orange{color:#cb4b16}.solarized.solar-red{color:#dc322f}.solarized.solar-magenta{color:#d33682}.solarized.solar-violet{color:#6c71c4}.solarized.solar-blue{color:#268bd2}.solarized.solar-cyan{color:#2aa198}.solarized.solar-green{color:#859900}.cm-s-solarized{line-height:1.45em;color-profile:sRGB;rendering-intent:auto}.cm-s-solarized.cm-s-dark{color:#839496;background-color:#002b36;text-shadow:#002b36 0 1px}.cm-s-solarized.cm-s-light{background-color:#fdf6e3;color:#657b83;text-shadow:#eee8d5 0 1px}.cm-s-solarized .CodeMirror-widget{text-shadow:none}.cm-s-solarized .cm-header{color:#586e75}.cm-s-solarized .cm-quote{color:#93a1a1}.cm-s-solarized .cm-keyword{color:#cb4b16}.cm-s-solarized .cm-atom,.cm-s-solarized .cm-number{color:#d33682}.cm-s-solarized .cm-def{color:#2aa198}.cm-s-solarized .cm-variable{color:#839496}.cm-s-solarized .cm-variable-2{color:#b58900}.cm-s-solarized .cm-variable-3{color:#6c71c4}.cm-s-solarized .cm-property{color:#2aa198}.cm-s-solarized .cm-operator{color:#6c71c4}.cm-s-solarized .cm-comment{color:#586e75;font-style:italic}.cm-s-solarized .cm-string{color:#859900}.cm-s-solarized .cm-string-2{color:#b58900}.cm-s-solarized .cm-meta{color:#859900}.cm-s-solarized .cm-qualifier{color:#b58900}.cm-s-solarized .cm-builtin{color:#d33682}.cm-s-solarized .cm-bracket{color:#cb4b16}.cm-s-solarized .CodeMirror-matchingbracket{color:#859900}.cm-s-solarized .CodeMirror-nonmatchingbracket{color:#dc322f}.cm-s-solarized .cm-tag{color:#93a1a1}.cm-s-solarized .cm-attribute{color:#2aa198}.cm-s-solarized .cm-hr{color:transparent;border-top:1px solid #586e75;display:block}.cm-s-solarized .cm-link{color:#93a1a1;cursor:pointer}.cm-s-solarized .cm-special{color:#6c71c4}.cm-s-solarized .cm-em{color:#999;text-decoration:underline;-webkit-text-decoration-style:dotted;text-decoration-style:dotted}.cm-s-solarized .cm-strong{color:#eee}.cm-s-solarized .cm-error,.cm-s-solarized .cm-invalidchar{color:#586e75;border-bottom:1px dotted #dc322f}.cm-s-solarized.cm-s-dark div.CodeMirror-selected{background:#073642}.cm-s-solarized.cm-s-dark.CodeMirror ::-moz-selection{background:rgba(7,54,66,.99)}.cm-s-solarized.cm-s-dark.CodeMirror ::selection{background:rgba(7,54,66,.99)}.cm-s-dark .CodeMirror-line>span::-moz-selection,.cm-s-dark .CodeMirror-line>span>span::-moz-selection,.cm-s-solarized.cm-s-dark .CodeMirror-line::-moz-selection{background:rgba(7,54,66,.99)}.cm-s-solarized.cm-s-light div.CodeMirror-selected{background:#eee8d5}.cm-s-light .CodeMirror-line>span::-moz-selection,.cm-s-light .CodeMirror-line>span>span::-moz-selection,.cm-s-solarized.cm-s-light .CodeMirror-line::-moz-selection{background:#eee8d5}.cm-s-light .CodeMirror-line>span::selection,.cm-s-light .CodeMirror-line>span>span::selection,.cm-s-solarized.cm-s-light .CodeMirror-line::selection{background:#eee8d5}.cm-s-ligh .CodeMirror-line>span::-moz-selection,.cm-s-ligh .CodeMirror-line>span>span::-moz-selection,.cm-s-solarized.cm-s-light .CodeMirror-line::-moz-selection{background:#eee8d5}.cm-s-solarized.CodeMirror{box-shadow:inset 7px 0 12px -6px #000}.cm-s-solarized .CodeMirror-gutters{border-right:0}.cm-s-solarized.cm-s-dark .CodeMirror-gutters{background-color:#073642}.cm-s-solarized.cm-s-dark .CodeMirror-linenumber{color:#586e75;text-shadow:#021014 0 -1px}.cm-s-solarized.cm-s-light .CodeMirror-gutters{background-color:#eee8d5}.cm-s-solarized.cm-s-light .CodeMirror-linenumber{color:#839496}.cm-s-solarized .CodeMirror-linenumber{padding:0 5px}.cm-s-solarized .CodeMirror-guttermarker-subtle{color:#586e75}.cm-s-solarized.cm-s-dark .CodeMirror-guttermarker{color:#ddd}.cm-s-solarized.cm-s-light .CodeMirror-guttermarker{color:#cb4b16}.cm-s-solarized .CodeMirror-gutter .CodeMirror-gutter-text{color:#586e75}.cm-s-solarized .CodeMirror-cursor{border-left:1px solid #819090}.cm-s-solarized.cm-s-light.cm-fat-cursor .CodeMirror-cursor{background:#7e7}.cm-s-solarized.cm-s-light .cm-animate-fat-cursor{background-color:#7e7}.cm-s-solarized.cm-s-dark.cm-fat-cursor .CodeMirror-cursor{background:#586e75}.cm-s-solarized.cm-s-dark .cm-animate-fat-cursor{background-color:#586e75}.cm-s-solarized.cm-s-dark .CodeMirror-activeline-background{background:hsla(0,0%,100%,.06)}.cm-s-solarized.cm-s-light .CodeMirror-activeline-background{background:rgba(0,0,0,.06)}.cm-s-the-matrix.CodeMirror{background:#000;color:#0f0}.cm-s-the-matrix div.CodeMirror-selected{background:#2d2d2d}.cm-s-the-matrix .CodeMirror-line::selection,.cm-s-the-matrix .CodeMirror-line>span::selection,.cm-s-the-matrix .CodeMirror-line>span>span::selection{background:rgba(45,45,45,.99)}.cm-s-the-matrix .CodeMirror-line::-moz-selection,.cm-s-the-matrix .CodeMirror-line>span::-moz-selection,.cm-s-the-matrix .CodeMirror-line>span>span::-moz-selection{background:rgba(45,45,45,.99)}.cm-s-the-matrix .CodeMirror-gutters{background:#060;border-right:2px solid #0f0}.cm-s-the-matrix .CodeMirror-guttermarker{color:#0f0}.cm-s-the-matrix .CodeMirror-guttermarker-subtle,.cm-s-the-matrix .CodeMirror-linenumber{color:#fff}.cm-s-the-matrix .CodeMirror-cursor{border-left:1px solid #0f0}.cm-s-the-matrix span.cm-keyword{color:#008803;font-weight:700}.cm-s-the-matrix span.cm-atom{color:#3ff}.cm-s-the-matrix span.cm-number{color:#ffb94f}.cm-s-the-matrix span.cm-def{color:#99c}.cm-s-the-matrix span.cm-variable{color:#f6c}.cm-s-the-matrix span.cm-variable-2{color:#c6f}.cm-s-the-matrix span.cm-variable-3{color:#96f}.cm-s-the-matrix span.cm-property{color:#62ffa0}.cm-s-the-matrix span.cm-operator{color:#999}.cm-s-the-matrix span.cm-comment{color:#ccc}.cm-s-the-matrix span.cm-string{color:#39c}.cm-s-the-matrix span.cm-meta{color:#c9f}.cm-s-the-matrix span.cm-qualifier{color:#fff700}.cm-s-the-matrix span.cm-builtin{color:#30a}.cm-s-the-matrix span.cm-bracket{color:#cc7}.cm-s-the-matrix span.cm-tag{color:#ffbd40}.cm-s-the-matrix span.cm-attribute{color:#fff700}.cm-s-the-matrix span.cm-error{color:red}.cm-s-the-matrix .CodeMirror-activeline-background{background:#040}.cm-s-tomorrow-night-bright.CodeMirror{background:#000;color:#eaeaea}.cm-s-tomorrow-night-bright div.CodeMirror-selected{background:#424242}.cm-s-tomorrow-night-bright .CodeMirror-gutters{background:#000;border-right:0}.cm-s-tomorrow-night-bright .CodeMirror-guttermarker{color:#e78c45}.cm-s-tomorrow-night-bright .CodeMirror-guttermarker-subtle{color:#777}.cm-s-tomorrow-night-bright .CodeMirror-linenumber{color:#424242}.cm-s-tomorrow-night-bright .CodeMirror-cursor{border-left:1px solid #6a6a6a}.cm-s-tomorrow-night-bright span.cm-comment{color:#d27b53}.cm-s-tomorrow-night-bright span.cm-atom,.cm-s-tomorrow-night-bright span.cm-number{color:#a16a94}.cm-s-tomorrow-night-bright span.cm-attribute,.cm-s-tomorrow-night-bright span.cm-property{color:#9c9}.cm-s-tomorrow-night-bright span.cm-keyword{color:#d54e53}.cm-s-tomorrow-night-bright span.cm-string{color:#e7c547}.cm-s-tomorrow-night-bright span.cm-variable{color:#b9ca4a}.cm-s-tomorrow-night-bright span.cm-variable-2{color:#7aa6da}.cm-s-tomorrow-night-bright span.cm-def{color:#e78c45}.cm-s-tomorrow-night-bright span.cm-bracket{color:#eaeaea}.cm-s-tomorrow-night-bright span.cm-tag{color:#d54e53}.cm-s-tomorrow-night-bright span.cm-link{color:#a16a94}.cm-s-tomorrow-night-bright span.cm-error{background:#d54e53;color:#6a6a6a}.cm-s-tomorrow-night-bright .CodeMirror-activeline-background{background:#2a2a2a}.cm-s-tomorrow-night-bright .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-tomorrow-night-eighties.CodeMirror{background:#000;color:#ccc}.cm-s-tomorrow-night-eighties div.CodeMirror-selected{background:#2d2d2d}.cm-s-tomorrow-night-eighties .CodeMirror-line::selection,.cm-s-tomorrow-night-eighties .CodeMirror-line>span::selection,.cm-s-tomorrow-night-eighties .CodeMirror-line>span>span::selection{background:rgba(45,45,45,.99)}.cm-s-tomorrow-night-eighties .CodeMirror-line::-moz-selection,.cm-s-tomorrow-night-eighties .CodeMirror-line>span::-moz-selection,.cm-s-tomorrow-night-eighties .CodeMirror-line>span>span::-moz-selection{background:rgba(45,45,45,.99)}.cm-s-tomorrow-night-eighties .CodeMirror-gutters{background:#000;border-right:0}.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker{color:#f2777a}.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker-subtle{color:#777}.cm-s-tomorrow-night-eighties .CodeMirror-linenumber{color:#515151}.cm-s-tomorrow-night-eighties .CodeMirror-cursor{border-left:1px solid #6a6a6a}.cm-s-tomorrow-night-eighties span.cm-comment{color:#d27b53}.cm-s-tomorrow-night-eighties span.cm-atom,.cm-s-tomorrow-night-eighties span.cm-number{color:#a16a94}.cm-s-tomorrow-night-eighties span.cm-attribute,.cm-s-tomorrow-night-eighties span.cm-property{color:#9c9}.cm-s-tomorrow-night-eighties span.cm-keyword{color:#f2777a}.cm-s-tomorrow-night-eighties span.cm-string{color:#fc6}.cm-s-tomorrow-night-eighties span.cm-variable{color:#9c9}.cm-s-tomorrow-night-eighties span.cm-variable-2{color:#69c}.cm-s-tomorrow-night-eighties span.cm-def{color:#f99157}.cm-s-tomorrow-night-eighties span.cm-bracket{color:#ccc}.cm-s-tomorrow-night-eighties span.cm-tag{color:#f2777a}.cm-s-tomorrow-night-eighties span.cm-link{color:#a16a94}.cm-s-tomorrow-night-eighties span.cm-error{background:#f2777a;color:#6a6a6a}.cm-s-tomorrow-night-eighties .CodeMirror-activeline-background{background:#343600}.cm-s-tomorrow-night-eighties .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}.cm-s-ttcn .cm-quote{color:#090}.cm-s-ttcn .cm-header,.cm-strong{font-weight:700}.cm-s-ttcn .cm-header{color:#00f;font-weight:700}.cm-s-ttcn .cm-atom{color:#219}.cm-s-ttcn .cm-attribute{color:#00c}.cm-s-ttcn .cm-bracket{color:#997}.cm-s-ttcn .cm-comment{color:#333}.cm-s-ttcn .cm-def{color:#00f}.cm-s-ttcn .cm-em{font-style:italic}.cm-s-ttcn .cm-error{color:red}.cm-s-ttcn .cm-hr{color:#999}.cm-s-ttcn .cm-keyword{font-weight:700}.cm-s-ttcn .cm-link{color:#00c;text-decoration:underline}.cm-s-ttcn .cm-meta{color:#555}.cm-s-ttcn .cm-negative{color:#d44}.cm-s-ttcn .cm-positive{color:#292}.cm-s-ttcn .cm-qualifier{color:#555}.cm-s-ttcn .cm-strikethrough{text-decoration:line-through}.cm-s-ttcn .cm-string{color:#006400}.cm-s-ttcn .cm-string-2{color:#f50}.cm-s-ttcn .cm-strong{font-weight:700}.cm-s-ttcn .cm-tag{color:#170}.cm-s-ttcn .cm-variable{color:#8b2252}.cm-s-ttcn .cm-variable-2{color:#05a}.cm-s-ttcn .cm-variable-3{color:#085}.cm-s-ttcn .cm-invalidchar{color:red}.cm-s-ttcn .cm-accessTypes,.cm-s-ttcn .cm-compareTypes{color:#27408b}.cm-s-ttcn .cm-cmipVerbs{color:#8b2252}.cm-s-ttcn .cm-modifier{color:#d2691e}.cm-s-ttcn .cm-status{color:#8b4545}.cm-s-ttcn .cm-storage{color:#a020f0}.cm-s-ttcn .cm-tags{color:#006400}.cm-s-ttcn .cm-externalCommands{color:#8b4545;font-weight:700}.cm-s-ttcn .cm-fileNCtrlMaskOptions,.cm-s-ttcn .cm-sectionTitle{color:#2e8b57;font-weight:700}.cm-s-ttcn .cm-booleanConsts,.cm-s-ttcn .cm-otherConsts,.cm-s-ttcn .cm-verdictConsts{color:#006400}.cm-s-ttcn .cm-configOps,.cm-s-ttcn .cm-functionOps,.cm-s-ttcn .cm-portOps,.cm-s-ttcn .cm-sutOps,.cm-s-ttcn .cm-timerOps,.cm-s-ttcn .cm-verdictOps{color:#00f}.cm-s-ttcn .cm-preprocessor,.cm-s-ttcn .cm-templateMatch,.cm-s-ttcn .cm-ttcn3Macros{color:#27408b}.cm-s-ttcn .cm-types{color:brown;font-weight:700}.cm-s-ttcn .cm-visibilityModifiers{font-weight:700}.cm-s-twilight.CodeMirror{background:#141414;color:#f7f7f7}.cm-s-twilight div.CodeMirror-selected{background:#323232}.cm-s-twilight .CodeMirror-line::selection,.cm-s-twilight .CodeMirror-line>span::selection,.cm-s-twilight .CodeMirror-line>span>span::selection{background:rgba(50,50,50,.99)}.cm-s-twilight .CodeMirror-line::-moz-selection,.cm-s-twilight .CodeMirror-line>span::-moz-selection,.cm-s-twilight .CodeMirror-line>span>span::-moz-selection{background:rgba(50,50,50,.99)}.cm-s-twilight .CodeMirror-gutters{background:#222;border-right:1px solid #aaa}.cm-s-twilight .CodeMirror-guttermarker{color:#fff}.cm-s-twilight .CodeMirror-guttermarker-subtle,.cm-s-twilight .CodeMirror-linenumber{color:#aaa}.cm-s-twilight .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-twilight .cm-keyword{color:#f9ee98}.cm-s-twilight .cm-atom{color:#fc0}.cm-s-twilight .cm-number{color:#ca7841}.cm-s-twilight .cm-def{color:#8da6ce}.cm-s-twilight span.cm-def,.cm-s-twilight span.cm-tag,.cm-s-twilight span.cm-variable-2,.cm-s-twilight span.cm-variable-3{color:#607392}.cm-s-twilight .cm-operator{color:#cda869}.cm-s-twilight .cm-comment{color:#777;font-style:italic;font-weight:400}.cm-s-twilight .cm-string{color:#8f9d6a;font-style:italic}.cm-s-twilight .cm-string-2{color:#bd6b18}.cm-s-twilight .cm-meta{background-color:#141414;color:#f7f7f7}.cm-s-twilight .cm-builtin{color:#cda869}.cm-s-twilight .cm-tag{color:#997643}.cm-s-twilight .cm-attribute{color:#d6bb6d}.cm-s-twilight .cm-header{color:#ff6400}.cm-s-twilight .cm-hr{color:#aeaeae}.cm-s-twilight .cm-link{color:#ad9361;font-style:italic;text-decoration:none}.cm-s-twilight .cm-error{border-bottom:1px solid red}.cm-s-twilight .CodeMirror-activeline-background{background:#27282e}.cm-s-twilight .CodeMirror-matchingbracket{outline:1px solid grey;color:#fff!important}.cm-s-vibrant-ink.CodeMirror{background:#000;color:#fff}.cm-s-vibrant-ink div.CodeMirror-selected{background:#35493c}.cm-s-vibrant-ink .CodeMirror-line::selection,.cm-s-vibrant-ink .CodeMirror-line>span::selection,.cm-s-vibrant-ink .CodeMirror-line>span>span::selection{background:rgba(53,73,60,.99)}.cm-s-vibrant-ink .CodeMirror-line::-moz-selection,.cm-s-vibrant-ink .CodeMirror-line>span::-moz-selection,.cm-s-vibrant-ink .CodeMirror-line>span>span::-moz-selection{background:rgba(53,73,60,.99)}.cm-s-vibrant-ink .CodeMirror-gutters{background:#002240;border-right:1px solid #aaa}.cm-s-vibrant-ink .CodeMirror-guttermarker{color:#fff}.cm-s-vibrant-ink .CodeMirror-guttermarker-subtle,.cm-s-vibrant-ink .CodeMirror-linenumber{color:#d0d0d0}.cm-s-vibrant-ink .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-vibrant-ink .cm-keyword{color:#cc7832}.cm-s-vibrant-ink .cm-atom{color:#fc0}.cm-s-vibrant-ink .cm-number{color:#ffee98}.cm-s-vibrant-ink .cm-def{color:#8da6ce}.cm-s-vibrant-ink span.cm-variable-2,.cm-s-vibrant-ink span.cm-variable-3,.cm-s-vibrant span.cm-def,.cm-s-vibrant span.cm-tag{color:#ffc66d}.cm-s-vibrant-ink .cm-operator{color:#888}.cm-s-vibrant-ink .cm-comment{color:gray;font-weight:700}.cm-s-vibrant-ink .cm-string{color:#a5c25c}.cm-s-vibrant-ink .cm-string-2{color:red}.cm-s-vibrant-ink .cm-meta{color:#d8fa3c}.cm-s-vibrant-ink .cm-attribute,.cm-s-vibrant-ink .cm-builtin,.cm-s-vibrant-ink .cm-tag{color:#8da6ce}.cm-s-vibrant-ink .cm-header{color:#ff6400}.cm-s-vibrant-ink .cm-hr{color:#aeaeae}.cm-s-vibrant-ink .cm-link{color:blue}.cm-s-vibrant-ink .cm-error{border-bottom:1px solid red}.cm-s-vibrant-ink .CodeMirror-activeline-background{background:#27282e}.cm-s-vibrant-ink .CodeMirror-matchingbracket{outline:1px solid grey;color:#fff!important}.cm-s-xq-dark.CodeMirror{background:#0a001f;color:#f8f8f8}.cm-s-xq-dark div.CodeMirror-selected{background:#27007a}.cm-s-xq-dark .CodeMirror-line::selection,.cm-s-xq-dark .CodeMirror-line>span::selection,.cm-s-xq-dark .CodeMirror-line>span>span::selection{background:rgba(39,0,122,.99)}.cm-s-xq-dark .CodeMirror-line::-moz-selection,.cm-s-xq-dark .CodeMirror-line>span::-moz-selection,.cm-s-xq-dark .CodeMirror-line>span>span::-moz-selection{background:rgba(39,0,122,.99)}.cm-s-xq-dark .CodeMirror-gutters{background:#0a001f;border-right:1px solid #aaa}.cm-s-xq-dark .CodeMirror-guttermarker{color:#ffbd40}.cm-s-xq-dark .CodeMirror-guttermarker-subtle,.cm-s-xq-dark .CodeMirror-linenumber{color:#f8f8f8}.cm-s-xq-dark .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-xq-dark span.cm-keyword{color:#ffbd40}.cm-s-xq-dark span.cm-atom{color:#6c8cd5}.cm-s-xq-dark span.cm-number{color:#164}.cm-s-xq-dark span.cm-def{color:#fff;text-decoration:underline}.cm-s-xq-dark span.cm-variable{color:#fff}.cm-s-xq-dark span.cm-variable-2{color:#eee}.cm-s-xq-dark span.cm-variable-3{color:#ddd}.cm-s-xq-dark span.cm-comment{color:gray}.cm-s-xq-dark span.cm-string{color:#9fee00}.cm-s-xq-dark span.cm-meta{color:#ff0}.cm-s-xq-dark span.cm-qualifier{color:#fff700}.cm-s-xq-dark span.cm-builtin{color:#30a}.cm-s-xq-dark span.cm-bracket{color:#cc7}.cm-s-xq-dark span.cm-tag{color:#ffbd40}.cm-s-xq-dark span.cm-attribute{color:#fff700}.cm-s-xq-dark span.cm-error{color:red}.cm-s-xq-dark .CodeMirror-activeline-background{background:#27282e}.cm-s-xq-dark .CodeMirror-matchingbracket{outline:1px solid grey;color:#fff!important}.cm-s-xq-light span.cm-keyword{line-height:1em;font-weight:700;color:#5a5cad}.cm-s-xq-light span.cm-atom{color:#6c8cd5}.cm-s-xq-light span.cm-number{color:#164}.cm-s-xq-light span.cm-def{text-decoration:underline}.cm-s-xq-light span.cm-variable,.cm-s-xq-light span.cm-variable-2,.cm-s-xq-light span.cm-variable-3{color:#000}.cm-s-xq-light span.cm-comment{color:#0080ff;font-style:italic}.cm-s-xq-light span.cm-string{color:red}.cm-s-xq-light span.cm-meta{color:#ff0}.cm-s-xq-light span.cm-qualifier{color:grey}.cm-s-xq-light span.cm-builtin{color:#7ea656}.cm-s-xq-light span.cm-bracket{color:#cc7}.cm-s-xq-light span.cm-tag{color:#3f7f7f}.cm-s-xq-light span.cm-attribute{color:#7f007f}.cm-s-xq-light span.cm-error{color:red}.cm-s-xq-light .CodeMirror-activeline-background{background:#e8f2ff}.cm-s-xq-light .CodeMirror-matchingbracket{outline:1px solid grey;color:#000!important;background:#ff0}.cm-s-yeti.CodeMirror{background-color:#eceae8!important;color:#d1c9c0!important;border:none}.cm-s-yeti .CodeMirror-gutters{color:#adaba6;background-color:#e5e1db;border:none}.cm-s-yeti .CodeMirror-cursor{border-left:thin solid #d1c9c0}.cm-s-yeti .CodeMirror-linenumber{color:#adaba6}.cm-s-yeti.CodeMirror-focused div.CodeMirror-selected{background:#dcd8d2}.cm-s-yeti .CodeMirror-line::selection,.cm-s-yeti .CodeMirror-line>span::selection,.cm-s-yeti .CodeMirror-line>span>span::selection{background:#dcd8d2}.cm-s-yeti .CodeMirror-line::-moz-selection,.cm-s-yeti .CodeMirror-line>span::-moz-selection,.cm-s-yeti .CodeMirror-line>span>span::-moz-selection{background:#dcd8d2}.cm-s-yeti span.cm-comment{color:#d4c8be}.cm-s-yeti span.cm-string,.cm-s-yeti span.cm-string-2{color:#96c0d8}.cm-s-yeti span.cm-number{color:#a074c4}.cm-s-yeti span.cm-variable{color:#55b5db}.cm-s-yeti span.cm-variable-2{color:#a074c4}.cm-s-yeti span.cm-def{color:#55b5db}.cm-s-yeti span.cm-keyword,.cm-s-yeti span.cm-operator{color:#9fb96e}.cm-s-yeti span.cm-atom{color:#a074c4}.cm-s-yeti span.cm-meta,.cm-s-yeti span.cm-tag{color:#96c0d8}.cm-s-yeti span.cm-attribute{color:#9fb96e}.cm-s-yeti span.cm-qualifier{color:#96c0d8}.cm-s-yeti span.cm-builtin,.cm-s-yeti span.cm-property{color:#a074c4}.cm-s-yeti span.cm-variable-3{color:#96c0d8}.cm-s-yeti .CodeMirror-activeline-background{background:#e7e4e0}.cm-s-yeti .CodeMirror-matchingbracket{text-decoration:underline}.cm-s-zenburn .CodeMirror-gutters{background:#3f3f3f!important}.cm-s-zenburn .CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{color:#999}.cm-s-zenburn .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-zenburn{background-color:#3f3f3f;color:#dcdccc}.cm-s-zenburn span.cm-builtin{color:#dcdccc;font-weight:700}.cm-s-zenburn span.cm-comment{color:#7f9f7f}.cm-s-zenburn span.cm-keyword{color:#f0dfaf;font-weight:700}.cm-s-zenburn span.cm-atom{color:#bfebbf}.cm-s-zenburn span.cm-def{color:#dcdccc}.cm-s-zenburn span.cm-variable{color:#dfaf8f}.cm-s-zenburn span.cm-variable-2{color:#dcdccc}.cm-s-zenburn span.cm-string,.cm-s-zenburn span.cm-string-2{color:#cc9393}.cm-s-zenburn span.cm-number{color:#dcdccc}.cm-s-zenburn span.cm-tag{color:#93e0e3}.cm-s-zenburn span.cm-attribute,.cm-s-zenburn span.cm-property{color:#dfaf8f}.cm-s-zenburn span.cm-qualifier{color:#7cb8bb}.cm-s-zenburn span.cm-meta{color:#f0dfaf}.cm-s-zenburn span.cm-header,.cm-s-zenburn span.cm-operator{color:#f0efd0}.cm-s-zenburn span.CodeMirror-matchingbracket{box-sizing:border-box;background:transparent;border-bottom:1px solid}.cm-s-zenburn span.CodeMirror-nonmatchingbracket{border-bottom:1px solid;background:none}.cm-s-zenburn .CodeMirror-activeline,.cm-s-zenburn .CodeMirror-activeline-background{background:#000}.cm-s-zenburn div.CodeMirror-selected{background:#545454}.cm-s-zenburn .CodeMirror-focused div.CodeMirror-selected{background:#4f4f4f}.CodeMirror{font:inherit}.CodeMirror-scroll{font-family:Menlo Regular,Consolas,Monaco,monospace;line-height:150%;position:relative}.CodeMirror-settings{color:#444;height:0;width:100%;z-index:9;text-shadow:none}.CodeMirror-settings__toggle{border-radius:3px;z-index:11;box-sizing:border-box;position:absolute;top:0;right:0;margin:6px;display:block;cursor:pointer}.CodeMirror-settings__toggle:after{content:"\f111";font-family:dashicons;line-height:1em;display:inline-block}.CodeMirror-settings__toggle:before{border:1px solid #ddd;border-radius:3px;z-index:-1;content:"";background-color:#fff;transition:.25s ease;transition-property:transform opacity;position:absolute;top:0;right:0;bottom:0;left:0}.CodeMirror-settings__wrapper{pointer-events:none;visibility:hidden}.CodeMirror-settings__body,.CodeMirror-settings__docked{pointer-events:auto;visibility:visible}.CodeMirror-settings__wrapper{position:absolute;width:calc(100% - 12px);max-height:calc(100% - 12px);top:0;margin:6px;box-sizing:border-box;z-index:9;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.CodeMirror-settings__docked{-ms-flex:0 0 auto;flex:0 0 auto;z-index:10;background-color:#fff;box-sizing:border-box}.CodeMirror-settings__header{border-top-left-radius:3px;border-top-right-radius:3px;border:1px solid #ddd;padding:4px;border-bottom-left-radius:3px;border-bottom-right-radius:3px}.CodeMirror-settings__body{-ms-flex:1 1 auto;flex:1 1 auto;box-sizing:border-box;padding:1px 12px;overflow-y:auto;background-color:hsla(0,0%,100%,.93);border-left:1px solid #ddd;border-right:1px solid #ddd}.CodeMirror-settings__footer{border-bottom-left-radius:3px;border-bottom-right-radius:3px;border:1px solid #ddd;padding:6px 12px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:baseline;align-items:baseline;-ms-flex-line-pack:center;align-content:center;-ms-flex-pack:justify;justify-content:space-between}td.CodeMirror-settings__heading{padding:0}.CodeMirror-settings__foot-content{margin:0}.CodeMirror-settings__body,.CodeMirror-settings__footer,.CodeMirror-settings__header,.CodeMirror-settings__toggle,.CodeMirror-settings__toggle-advanced,.CodeMirror-settings__wrapper{transition:.25s ease;transition-property:opacity,transform;transform-origin:top right}.CodeMirror-settings.closed .CodeMirror-settings__toggle-advanced:before{content:"more..."}.CodeMirror-settings.closed .CodeMirror-settings__toggle{opacity:.5}.CodeMirror-settings.closed .CodeMirror-settings__toggle:before,.CodeMirror-settings.closed .CodeMirror-settings__toggle:hover{opacity:1}.CodeMirror-settings.closed .CodeMirror-settings__wrapper{opacity:0;transform:scaleX(0)}.CodeMirror-settings.closed .CodeMirror-settings__body,.CodeMirror-settings.closed .CodeMirror-settings__footer{visibility:hidden;opacity:0;transform:translateY(-20px);transition:opacity .25s ease,transform .25s ease,visibility 1ms ease .25s}.CodeMirror-settings.open .CodeMirror-settings__toggle-advanced:before{content:"more..."}.CodeMirror-settings.open .CodeMirror-settings__toggle:after{content:"\f158"}.CodeMirror-settings.open .CodeMirror-settings__toggle:before{opacity:0}.CodeMirror-settings.open .CodeMirror-settings__wrapper{opacity:1;transform:scaleX(1)}.CodeMirror-settings.open .CodeMirror-settings__body,.CodeMirror-settings.open .CodeMirror-settings__footer{visibility:hidden;opacity:0;transform:translateY(-20px);transition:opacity .25s ease,transform .25s ease,visibility 1ms ease .25s}.CodeMirror-settings.open-advanced .CodeMirror-settings__toggle-advanced:before{content:"less"}.CodeMirror-settings.open-advanced .CodeMirror-settings__header{border-bottom-left-radius:0;border-bottom-right-radius:0}.CodeMirror-settings.open-advanced .CodeMirror-settings__body,.CodeMirror-settings.open-advanced .CodeMirror-settings__footer{visibility:visible;opacity:1;transform:translate(0);transition:visibility 1ms ease,opacity .25s ease 1ms,transform .25s ease 1ms}.CodeMirror-settings__button{position:relative}.CodeMirror-settings__button:active{transform:none!important}.CodeMirror-settings__button input,.CodeMirror-settings__button select{display:block;position:absolute;top:0;right:0;bottom:0;left:0;-webkit-appearance:none;margin:0;padding:0;border:none;height:auto;font-size:0;line-height:0;height:100%!important;width:100%!important;background:none;opacity:0}.CodeMirror-settings__button option{font-size:12px}.CodeMirror-settings__button--select:after{content:"\f140";font-family:dashicons;vertical-align:top;display:inline-block;margin:0 -5px -4px}.CodeMirror-settings__toggle-advanced{cursor:pointer;display:inline-block;line-height:25px;padding:0 4px;vertical-align:middle}.wp-editor-expand .CodeMirror{min-height:300px}.CodeMirror-mirrored{display:block!important;position:fixed!important;left:-9999px!important;top:-9999px!important;z-index:-999!important;opacity:0!important}#template .CodeMirror div{margin-right:0}#template .CodeMirror p{width:auto}.CodeMirror-vscrollbar{display:none!important}.CodeMirror-scroll{margin-right:-30px!important}.CodeMirror-settings__toggle{margin-right:6px!important}.heshFullscreen{z-index:99999;position:fixed!important;top:0;left:0;right:0;bottom:0;height:100%;background:#fff;padding:2% 2% 0}.heshFullscreen .CodeMirror{border:1px solid #ccc;border-radius:0 0 4px 4px;height:85%!important}.heshFullscreen #ed_toolbar{border:1px solid #ccc;border-bottom:0;border-radius:4px 4px 0 0}.heshFullscreen #cm_content_fullscreen:before{content:"\f506"}#cm_content_fullscreen{display:inline-block}.wp-editor-expand #cm_content_fullscreen{display:none}.hesh-content-resize-handle{position:absolute;right:0;bottom:0;width:12px;height:12px;z-index:8;margin:1px!important}#ed_toolbar{z-index:10}@media screen and (min-width:782px){.CodeMirror-settings__toggle{height:35px;width:35px}.CodeMirror-settings__toggle:after{font-size:20px;margin:7px}.CodeMirror-settings__docked{min-height:35px}.CodeMirror-settings__header{padding-right:35px}.CodeMirror-settings__button--select:after{font-size:16px;margin-top:0}#template .CodeMirror{margin-right:20px}}@media screen and (max-width:781px){.CodeMirror-settings__toggle{height:44px;width:44px}.CodeMirror-settings__toggle:after{font-size:28px;margin:8px}.CodeMirror-settings__docked{min-height:44px}.CodeMirror-settings__header{padding-right:44px}.CodeMirror-settings__button--select:after{font-size:20px;margin-top:-2px}#template .CodeMirror{margin-right:0}}@media screen and (max-height:550px){.heshFullscreen .CodeMirror{height:75%!important}}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}@keyframes a{50%{background-color:transparent}}
|
dist/hesh.min.js
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()}(this,function(){"use strict";function e(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function t(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function r(e,r){return t(e).appendChild(r)}function n(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function i(e,t,r,i){var o=n(e,t,r,i);return o.setAttribute("role","presentation"),o}function o(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function a(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function l(t,r){var n=t.className;e(r).test(n)||(t.className+=(n?" ":"")+r)}function s(t,r){for(var n=t.split(" "),i=0;i<n.length;i++)n[i]&&!e(n[i]).test(r)&&(r+=" "+n[i]);return r}function c(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function u(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function d(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/))==-1&&(t=e.length);for(var o=n||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}}function f(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function p(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);o==-1&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function h(e){for(;La.length<=e;)La.push(m(La)+" ");return La[e]}function m(e){return e[e.length-1]}function g(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function v(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}function y(){}function b(e,t){var r;return Object.create?r=Object.create(e):(y.prototype=e,r=new y),t&&u(t,r),r}function x(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ta.test(e))}function w(e,t){return t?!!(t.source.indexOf("\\w")>-1&&x(e))||t.test(e):x(e)}function _(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function k(e){return e.charCodeAt(0)>=768&&Ma.test(e)}function C(e,t,r){for(;(r<0?t>0:t<e.length)&&k(e.charAt(t));)t+=r;return t}function S(e,t,r){for(;;){if(Math.abs(t-r)<=1)return e(t)?t:r;var n=Math.floor((t+r)/2);e(n)?r=n:t=n}}function L(e,t,r){var o=this;this.input=r,o.scrollbarFiller=n("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=n("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=i("div",null,"CodeMirror-code"),o.selectionDiv=n("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=n("div",null,"CodeMirror-cursors"),o.measure=n("div",null,"CodeMirror-measure"),o.lineMeasure=n("div",null,"CodeMirror-measure"),o.lineSpace=i("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var a=i("div",[o.lineSpace],"CodeMirror-lines");o.mover=n("div",[a],null,"position: relative"),o.sizer=n("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=n("div",null,null,"position: absolute; height: "+wa+"px; width: 1px;"),o.gutters=n("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=n("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=n("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),Zo&&Qo<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),Jo||$o&&sa||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,r.init(o)}function T(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function M(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function z(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function A(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function O(e){if(null==e.parent)return null;for(var t=e.parent,r=f(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function N(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a],s=l.height;if(t<s)break;t-=s}return r+a}function E(e,t){return t>=e.first&&t<e.first+e.size}function W(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function I(e,t,r){if(void 0===r&&(r=null),!(this instanceof I))return new I(e,t,r);this.line=e,this.ch=t,this.sticky=r}function D(e,t){return e.line-t.line||e.ch-t.ch}function q(e,t){return e.sticky==t.sticky&&0==D(e,t)}function P(e){return I(e.line,e.ch)}function H(e,t){return D(e,t)<0?t:e}function F(e,t){return D(e,t)<0?e:t}function B(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function j(e,t){if(t.line<e.first)return I(e.first,0);var r=e.first+e.size-1;return t.line>r?I(r,T(e,r).text.length):R(t,T(e,t.line).text.length)}function R(e,t){var r=e.ch;return null==r||r>t?I(e.line,t):r<0?I(e.line,0):e}function U(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=j(e,t[n]);return r}function K(){za=!0}function V(){Aa=!0}function $(e,t,r){this.marker=e,this.from=t,this.to=r}function G(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function X(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Y(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Z(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new $(a,o.from,s?null:o.to))}}return n}function Q(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new $(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function J(e,t){if(t.full)return null;var r=E(e,t.from.line)&&T(e,t.from.line).markedSpans,n=E(e,t.to.line)&&T(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==D(t.from,t.to),l=Z(r,i,a),s=Q(n,o,a),c=1==t.text.length,u=m(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var p=G(s,f.marker);p?c&&(f.to=null==p.to?null:p.to+u):f.to=i}}if(s)for(var h=0;h<s.length;++h){var g=s[h];if(null!=g.to&&(g.to+=u),null==g.from){var v=G(l,g.marker);v||(g.from=u,c&&(l||(l=[])).push(g))}else g.from+=u,c&&(l||(l=[])).push(g)}l&&(l=ee(l)),s&&s!=l&&(s=ee(s));var y=[l];if(!c){var b,x=t.text.length-2;if(x>0&&l)for(var w=0;w<l.length;++w)null==l[w].to&&(b||(b=[])).push(new $(l[w].marker,null,null));for(var _=0;_<x;++_)y.push(b);y.push(s)}return y}function ee(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function te(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&f(n,r)!=-1||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(D(c.to,l.from)<0||D(c.from,l.to)>0)){var u=[s,1],d=D(c.from,l.from),p=D(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(p>0||!a.inclusiveRight&&!p)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-3}}return i}function re(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function ne(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function ie(e){return e.inclusiveLeft?-1:0}function oe(e){return e.inclusiveRight?1:0}function ae(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=D(n.from,i.from)||ie(e)-ie(t);if(o)return-o;var a=D(n.to,i.to)||oe(e)-oe(t);return a?a:t.id-e.id}function le(e,t){var r,n=Aa&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||ae(r,i.marker)<0)&&(r=i.marker);return r}function se(e){return le(e,!0)}function ce(e){return le(e,!1)}function ue(e,t,r,n,i){var o=T(e,t),a=Aa&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=D(c.from,r)||ie(s.marker)-ie(i),d=D(c.to,n)||oe(s.marker)-oe(i);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?D(c.to,r)>=0:D(c.to,r)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?D(c.from,n)<=0:D(c.from,n)<0)))return!0}}}function de(e){for(var t;t=se(e);)e=t.find(-1,!0).line;return e}function fe(e){for(var t;t=ce(e);)e=t.find(1,!0).line;return e}function pe(e){for(var t,r;t=ce(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function he(e,t){var r=T(e,t),n=de(r);return r==n?t:O(n)}function me(e,t){if(t>e.lastLine())return t;var r,n=T(e,t);if(!ge(e,n))return t;for(;r=ce(n);)n=r.find(1,!0).line;return O(n)+1}function ge(e,t){var r=Aa&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&ve(e,t,n))return!0}}function ve(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return ve(e,n.line,G(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&ve(e,t,i))return!0}function ye(e){e=de(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==r)break;t+=l.height}return t}function be(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=se(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=ce(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,n=o.to.line,r+=n.text.length-o.to.ch}return r}function xe(e){var t=e.display,r=e.doc;t.maxLine=T(r,r.first),t.maxLineLength=be(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=be(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function we(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function _e(e,t,r){var n;Oa=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:Oa=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:Oa=i)}return null!=n?n:Oa}function ke(e,t){var r=e.order;return null==r&&(r=e.order=Na(e.text,t)),r}function Ce(e,t,r){var n=C(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Se(e,t,r){var n=Ce(e,t.ch,r);return null==n?null:new I(t.line,n,r<0?"after":"before")}function Le(e,t,r,n,i){if(e){var o=ke(r,t.doc.direction);if(o){var a,l=i<0?m(o):o[0],s=i<0==(1==l.level),c=s?"after":"before";if(l.level>0){var u=Yt(t,r);a=i<0?r.text.length-1:0;var d=Zt(t,u,a).top;a=S(function(e){return Zt(t,u,e).top==d},i<0==(1==l.level)?l.from:l.to-1,a),"before"==c&&(a=Ce(r,a,1,!0))}else a=i<0?l.to:l.from;return new I(n,a,c)}}return new I(n,i<0?r.text.length:0,i<0?"before":"after")}function Te(e,t,r,n){var i=ke(t,e.doc.direction);if(!i)return Se(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=_e(i,r.ch,r.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(n>0?a.to>r.ch:a.from<r.ch))return Se(t,r,n);var l,s=function(e,r){return Ce(t,e instanceof I?e.ch:e,r)},c=function(r){return e.options.lineWrapping?(l=l||Yt(e,t),mr(e,t,l,r)):{begin:0,end:t.text.length}},u=c("before"==r.sticky?s(r,-1):r.ch);if("rtl"==e.doc.direction||1==a.level){var d=1==a.level==n<0,f=s(r,d?1:-1);if(null!=f&&(d?f<=a.to&&f<=u.end:f>=a.from&&f>=u.begin)){var p=d?"before":"after";return new I(r.line,f,p)}}var h=function(e,t,n){for(var o=function(e,t){return t?new I(r.line,s(e,1),"before"):new I(r.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],l=t>0==(1!=a.level),c=l?n.begin:s(n.end,-1);if(a.from<=c&&c<a.to)return o(c,l);if(c=l?a.from:s(a.to,-1),n.begin<=c&&c<n.end)return o(c,l)}},m=h(o+n,n,u);if(m)return m;var g=n>0?u.end:s(u.begin,-1);return null==g||n>0&&g==t.text.length||!(m=h(n>0?0:i.length-1,n,c(g)))?null:m}function Me(e,t){return e._handlers&&e._handlers[t]||Ea}function ze(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=f(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ae(e,t){var r=Me(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function Oe(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ae(e,r||t.type,e,t),qe(t)||t.codemirrorIgnore}function Ne(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)f(r,t[n])==-1&&r.push(t[n])}function Ee(e,t){return Me(e,t).length>0}function We(e){e.prototype.on=function(e,t){Wa(this,e,t)},e.prototype.off=function(e,t){ze(this,e,t)}}function Ie(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function De(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function qe(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Pe(e){Ie(e),De(e)}function He(e){return e.target||e.srcElement}function Fe(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),ca&&e.ctrlKey&&1==t&&(t=3),t}function Be(e){if(null==ba){var t=n("span","");r(e,n("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ba=t.offsetWidth<=1&&t.offsetHeight>2&&!(Zo&&Qo<8))}var i=ba?n("span",""):n("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function je(e){if(null!=xa)return xa;var n=r(e,document.createTextNode("AخA")),i=pa(n,0,1).getBoundingClientRect(),o=pa(n,1,2).getBoundingClientRect();return t(e),!(!i||i.left==i.right)&&(xa=o.right-i.right<3)}function Re(e){if(null!=Ha)return Ha;var t=r(e,n("span","x")),i=t.getBoundingClientRect(),o=pa(t,0,1).getBoundingClientRect();return Ha=Math.abs(i.left-o.left)>1}function Ue(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Fa[e]=t}function Ke(e,t){Ba[e]=t}function Ve(e){if("string"==typeof e&&Ba.hasOwnProperty(e))e=Ba[e];else if(e&&"string"==typeof e.name&&Ba.hasOwnProperty(e.name)){var t=Ba[e.name];"string"==typeof t&&(t={name:t}),e=b(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ve("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ve("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function $e(e,t){t=Ve(t);var r=Fa[t.name];if(!r)return $e(e,"text/plain");var n=r(e,t);if(ja.hasOwnProperty(t.name)){var i=ja[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)n[a]=t.modeProps[a];return n}function Ge(e,t){u(t,ja.hasOwnProperty(e)?ja[e]:ja[e]={})}function Xe(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ye(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Ze(e,t,r){return!e.startState||e.startState(t,r)}function Qe(e,t,r,n){var i=[e.state.modeGen],o={};at(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);for(var a=0;a<e.state.overlays.length;++a)!function(r){var n=e.state.overlays[r],a=1,l=0;at(e,t.text,n.mode,!0,function(e,t){for(var r=a;l<e;){var o=i[a];o>e&&i.splice(a,1,e,i[a+1],o),a+=2,l=Math.min(e,o)}if(t)if(n.opaque)i.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;r<a;r+=2){var s=i[r+1];i[r+1]=(s?s+" ":"")+"overlay "+t}},o)}(a);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Je(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=et(e,O(t)),i=Qe(e,t,t.text.length>e.options.maxHighlightLength?Xe(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function et(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=lt(e,t,r),a=o>n.first&&T(n,o-1).stateAfter;return a=a?Xe(n.mode,a):Ze(n.mode),n.iter(o,t,function(r){tt(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?Xe(n.mode,a):null,++o}),r&&(n.frontier=o),a}function tt(e,t,r,n){var i=e.doc.mode,o=new Ra(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&rt(i,r);!o.eol();)nt(i,o,r),o.start=o.pos}function rt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ye(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function nt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ye(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}function it(e,t,r,n){var i,o=function(e){return{start:d.start,end:d.pos,string:d.current(),type:i||null,state:e?Xe(a.mode,u):u}},a=e.doc,l=a.mode;t=j(a,t);var s,c=T(a,t.line),u=et(e,t.line,r),d=new Ra(c.text,e.options.tabSize);for(n&&(s=[]);(n||d.pos<t.ch)&&!d.eol();)d.start=d.pos,i=nt(l,d,u),n&&s.push(o(!0));return n?s:o()}function ot(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function at(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new Ra(t,e.options.tabSize),f=e.options.addModeClass&&[null];for(""==t&&ot(rt(r,n),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&tt(e,t,n,d.pos),d.pos=t.length,s=null):s=ot(nt(r,d,n,f),o),f){var p=f[0].name;p&&(s="m-"+(s?p+" "+s:p))}if(!l||u!=s){for(;c<d.start;)c=Math.min(d.start,c+5e3),i(c,u);u=s}d.start=d.pos}for(;c<d.pos;){var h=Math.min(d.pos,c+5e3);i(h,u),c=h}}function lt(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=T(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var c=d(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=l-1,n=c)}return i}function st(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),re(e),ne(e,r);var i=n?n(e):1;i!=e.height&&A(e,i)}function ct(e){e.parent=null,re(e)}function ut(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?$a:Va;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function dt(e,t){var r=i("span",null,null,Jo?"padding-right: .1px":null),n={pre:i("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(Zo||Jo)&&e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var a=o?t.rest[o-1]:t.line,l=void 0;n.pos=0,n.addToken=pt,je(e.display.measure)&&(l=ke(a,e.doc.direction))&&(n.addToken=mt(n.addToken,l)),n.map=[];vt(a,n,Je(e,a,t!=e.display.externalMeasured&&O(a))),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=s(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=s(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Be(e.display.measure))),0==o?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(Jo){var c=n.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Ae(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=s(n.pre.className,n.textClass||"")),n}function ft(e){var t=n("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function pt(e,t,r,i,o,a,l){if(t){var s,c=e.splitSpaces?ht(t,e.trailingSpace):t,u=e.cm.state.specialChars,d=!1;if(u.test(t)){s=document.createDocumentFragment();for(var f=0;;){u.lastIndex=f;var p=u.exec(t),m=p?p.index-f:t.length-f;if(m){var g=document.createTextNode(c.slice(f,f+m));Zo&&Qo<9?s.appendChild(n("span",[g])):s.appendChild(g),e.map.push(e.pos,e.pos+m,g),e.col+=m,e.pos+=m}if(!p)break;f+=m+1;var v=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;v=s.appendChild(n("span",h(b),"cm-tab")),v.setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?(v=s.appendChild(n("span","\r"==p[0]?"␍":"","cm-invalidchar")),v.setAttribute("cm-text",p[0]),e.col+=1):(v=e.cm.options.specialCharPlaceholder(p[0]),v.setAttribute("cm-text",p[0]),Zo&&Qo<9?s.appendChild(n("span",[v])):s.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,s=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,s),Zo&&Qo<9&&(d=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),r||i||o||d||l){var x=r||"";i&&(x+=i),o&&(x+=o);var w=n("span",[s],x,l);return a&&(w.title=a),e.content.appendChild(w)}e.content.appendChild(s)}}function ht(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}function mt(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var d=void 0,f=0;f<t.length&&(d=t[f],!(d.to>c&&d.from<=c));f++);if(d.to>=u)return e(r,n,i,o,a,l,s);e(r,n.slice(0,d.to-c),i,o,null,l,s),o=null,n=n.slice(d.to-c),c=d.to}}}function gt(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function vt(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,f,p=i.length,h=0,m=1,g="",v=0;;){if(v==h){s=c=u=d=l="",f=null,v=1/0;for(var y=[],b=void 0,x=0;x<n.length;++x){var w=n[x],_=w.marker;"bookmark"==_.type&&w.from==h&&_.widgetNode?y.push(_):w.from<=h&&(null==w.to||w.to>h||_.collapsed&&w.to==h&&w.from==h)?(null!=w.to&&w.to!=h&&v>w.to&&(v=w.to,c=""),_.className&&(s+=" "+_.className),_.css&&(l=(l?l+";":"")+_.css),_.startStyle&&w.from==h&&(u+=" "+_.startStyle),_.endStyle&&w.to==v&&(b||(b=[])).push(_.endStyle,w.to),_.title&&!d&&(d=_.title),_.collapsed&&(!f||ae(f.marker,_)<0)&&(f=w)):w.from>h&&v>w.from&&(v=w.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==v&&(c+=" "+b[k]);if(!f||f.from==h)for(var C=0;C<y.length;++C)gt(t,0,y[C]);if(f&&(f.from||0)==h){if(gt(t,(null==f.to?p+1:f.to)-h,f.marker,null==f.from),null==f.to)return;f.to==h&&(f=!1)}}if(h>=p)break;for(var S=Math.min(p,v);;){if(g){var L=h+g.length;if(!f){var T=L>S?g.slice(0,S-h):g;t.addToken(t,T,a?a+s:s,u,h+T.length==v?c:"",d,l)}if(L>=S){g=g.slice(S-h),h=S;break}h=L,u=""}g=i.slice(o,o=r[m++]),a=ut(r[m++],t.cm.options)}}else for(var M=1;M<r.length;M+=2)t.addToken(t,i.slice(o,o=r[M]),ut(r[M+1],t.cm.options))}function yt(e,t,r){this.line=t,this.rest=pe(t),this.size=this.rest?O(m(this.rest))-r+1:1,this.node=this.text=null,this.hidden=ge(e,t)}function bt(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new yt(e.doc,T(e.doc,o),o);n=o+a.size,i.push(a)}return i}function xt(e){Ga?Ga.ops.push(e):e.ownsGroup=Ga={ops:[e],delayedCallbacks:[]}}function wt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function _t(e,t){var r=e.ownsGroup;if(r)try{wt(r)}finally{Ga=null,t(r)}}function kt(e,t){var r=Me(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);Ga?n=Ga.delayedCallbacks:Xa?n=Xa:(n=Xa=[],setTimeout(Ct,0));for(var o=0;o<r.length;++o)!function(e){n.push(function(){return r[e].apply(null,i)})}(o)}}function Ct(){var e=Xa;Xa=null;for(var t=0;t<e.length;++t)e[t]()}function St(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?zt(e,t):"gutter"==o?Ot(e,t,r,n):"class"==o?At(e,t):"widget"==o&&Nt(e,t,n)}t.changes=null}function Lt(e){return e.node==e.text&&(e.node=n("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),Zo&&Qo<8&&(e.node.style.zIndex=2)),e.node}function Tt(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var i=Lt(t);t.background=i.insertBefore(n("div",null,r),i.firstChild),e.display.input.setUneditable(t.background)}}function Mt(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):dt(e,t)}function zt(e,t){var r=t.text.className,n=Mt(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,At(e,t)):r&&(t.text.className=r)}function At(e,t){Tt(e,t),t.line.wrapClass?Lt(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Ot(e,t,r,i){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var o=Lt(t);t.gutterBackground=n("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text)}var a=t.line.gutterMarkers;if(e.options.lineNumbers||a){var l=Lt(t),s=t.gutter=n("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||a&&a["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(n("div",W(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),a)for(var c=0;c<e.options.gutters.length;++c){var u=e.options.gutters[c],d=a.hasOwnProperty(u)&&a[u];d&&s.appendChild(n("div",[d],"CodeMirror-gutter-elt","left: "+i.gutterLeft[u]+"px; width: "+i.gutterWidth[u]+"px"))}}}function Nt(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n);Wt(e,t,r)}function Et(e,t,r,n){var i=Mt(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),At(e,t),Ot(e,t,r,n),Wt(e,t,n),t.node}function Wt(e,t,r){if(It(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)It(e,t.rest[n],t,r,!1)}function It(e,t,r,i,o){if(t.widgets)for(var a=Lt(r),l=0,s=t.widgets;l<s.length;++l){var c=s[l],u=n("div",[c.node],"CodeMirror-linewidget");c.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),Dt(c,u,r,i),e.display.input.setUneditable(u),o&&c.above?a.insertBefore(u,r.gutter||r.text):a.appendChild(u),kt(c,"redraw")}}function Dt(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function qt(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!o(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),r(t.display.measure,n("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Pt(e,t){for(var r=He(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Ht(e){return e.lineSpace.offsetTop}function Ft(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Bt(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=r(e.measure,n("pre","x")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,o={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return isNaN(o.left)||isNaN(o.right)||(e.cachedPaddingH=o),o}function jt(e){return wa-e.display.nativeBarWidth}function Rt(e){return e.display.scroller.clientWidth-jt(e)-e.display.barWidth}function Ut(e){return e.display.scroller.clientHeight-jt(e)-e.display.barHeight}function Kt(e,t,r){var n=e.options.lineWrapping,i=n&&Rt(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Vt(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(O(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function $t(e,t){t=de(t);var n=O(t),i=e.display.externalMeasured=new yt(e.doc,t,n);i.lineN=n;var o=i.built=dt(e,i);return i.text=o.pre,r(e.display.lineMeasure,o.pre),i}function Gt(e,t,r,n){return Zt(e,Yt(e,t),r,n)}function Xt(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Cr(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Yt(e,t){var r=O(t),n=Xt(e,r);n&&!n.text?n=null:n&&n.changes&&(St(e,n,r,br(e)),e.curOp.forceUpdate=!0),n||(n=$t(e,t));var i=Vt(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,
|
2 |
+
before:i.before,hasHeights:!1}}function Zt(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Kt(e,t.view,t.rect),t.hasHeights=!0),o=er(e,t,r,n),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function Qt(e,t,r){for(var n,i,o,a,l,s,c=0;c<e.length;c+=3)if(l=e[c],s=e[c+1],t<l?(i=0,o=1,a="left"):t<s?(i=t-l,o=i+1):(c==e.length-3||t==s&&e[c+3]>t)&&(o=s-l,i=o-1,t>=s&&(a="right")),null!=i){if(n=e[c+2],l==s&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],a="left";if("right"==r&&i==s-l)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[2+(c+=3)],a="right";break}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function Jt(e,t){var r=Ya;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function er(e,t,r,n){var i,o=Qt(t.map,r,n),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;l&&k(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&k(t.line.text.charAt(o.coverStart+s));)++s;if(i=Zo&&Qo<9&&0==l&&s==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():Jt(pa(a,l,s).getClientRects(),n),i.left||i.right||0==l)break;s=l,l-=1,c="right"}Zo&&Qo<11&&(i=tr(e.display.measure,i))}else{l>0&&(c=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(Zo&&Qo<9&&!l&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+yr(e.display),top:f.top,bottom:f.bottom}:Ya}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,v=0;v<g.length-1&&!(m<g[v]);v++);var y=v?g[v-1]:0,b=g[v],x={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:y,bottom:b};return i.left||i.right||(x.bogus=!0),e.options.singleCursorHeightPerLine||(x.rtop=p,x.rbottom=h),x}function tr(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Re(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function rr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function nr(e){e.display.externalMeasure=null,t(e.display.lineMeasure);for(var r=0;r<e.display.view.length;r++)rr(e.display.view[r])}function ir(e){nr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function or(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ar(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function lr(e,t,r,n,i){if(!i&&t.widgets)for(var o=0;o<t.widgets.length;++o)if(t.widgets[o].above){var a=qt(t.widgets[o]);r.top+=a,r.bottom+=a}if("line"==n)return r;n||(n="local");var l=ye(t);if("local"==n?l+=Ht(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:ar());var c=s.left+("window"==n?0:or());r.left+=c,r.right+=c}return r.top+=l,r.bottom+=l,r}function sr(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=or(),i-=ar();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function cr(e,t,r,n,i){return n||(n=T(e.doc,t.line)),lr(e,n,Gt(e,n,t.ch,i),r)}function ur(e,t,r,n,i,o){function a(t,a){var l=Zt(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,lr(e,n,l,r)}function l(e,t,r){var n=s[t],i=n.level%2!=0;return a(r?e-1:e,i!=r)}n=n||T(e.doc,t.line),i||(i=Yt(e,n));var s=ke(n,e.doc.direction),c=t.ch,u=t.sticky;if(c>=n.text.length?(c=n.text.length,u="before"):c<=0&&(c=0,u="after"),!s)return a("before"==u?c-1:c,"before"==u);var d=_e(s,c,u),f=Oa,p=l(c,d,"before"==u);return null!=f&&(p.other=l(c,f,"before"!=u)),p}function dr(e,t){var r=0;t=j(e.doc,t),e.options.lineWrapping||(r=yr(e.display)*t.ch);var n=T(e.doc,t.line),i=ye(n)+Ht(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function fr(e,t,r,n,i){var o=I(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function pr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return fr(n.first,0,null,!0,-1);var i=N(n,r),o=n.first+n.size-1;if(i>o)return fr(n.first+n.size-1,T(n,o).text.length,null,!0,1);t<0&&(t=0);for(var a=T(n,i);;){var l=gr(e,a,i,t,r),s=ce(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=O(a=c.to.line)}}function hr(e,t,r,n){var i=function(n){return lr(e,t,Zt(e,r,n),"line")},o=t.text.length,a=S(function(e){return i(e-1).bottom<=n},o,0);return o=S(function(e){return i(e).top>n},a,o),{begin:a,end:o}}function mr(e,t,r,n){return hr(e,t,r,lr(e,t,Zt(e,r,n),"line").top)}function gr(e,t,r,n,i){i-=ye(t);var o,a=0,l=t.text.length,s=Yt(e,t);if(ke(t,e.doc.direction)){if(e.options.lineWrapping){var c;c=hr(e,t,s,i),a=c.begin,l=c.end}o=new I(r,a);var u,d,f=ur(e,o,"line",t,s).left,p=f<n?1:-1,h=f-n;do{if(u=h,d=o,null==(o=Te(e,t,o,p))||o.ch<a||l<=("before"==o.sticky?o.ch-1:o.ch)){o=d;break}h=ur(e,o,"line",t,s).left-n}while(p<0!=h<0&&Math.abs(h)<=Math.abs(u));if(Math.abs(h)>Math.abs(u)){if(h<0==u<0)throw new Error("Broke out of infinite loop in coordsCharInner");o=d}}else{var m=S(function(r){var o=lr(e,t,Zt(e,s,r),"line");return o.top>i?(l=Math.min(r,l),!0):!(o.bottom<=i)&&(o.left>n||!(o.right<n)&&n-o.left<o.right-n)},a,l);m=C(t.text,m,1),o=new I(r,m,m==l?"before":"after")}var g=ur(e,o,"line",t,s);return(i<g.top||g.bottom<i)&&(o.outside=!0),o.xRel=n<g.left?-1:n>g.right?1:0,o}function vr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ka){Ka=n("pre");for(var i=0;i<49;++i)Ka.appendChild(document.createTextNode("x")),Ka.appendChild(n("br"));Ka.appendChild(document.createTextNode("x"))}r(e.measure,Ka);var o=Ka.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),t(e.measure),o||1}function yr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=n("span","xxxxxxxxxx"),i=n("pre",[t]);r(e.measure,i);var o=t.getBoundingClientRect(),a=(o.right-o.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function br(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)r[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[a]]=o.clientWidth;return{fixedPos:xr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function xr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function wr(e){var t=vr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/yr(e.display)-3);return function(i){if(ge(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function _r(e){var t=e.doc,r=wr(e);t.iter(function(e){var t=r(e);t!=e.height&&A(e,t)})}function kr(e,t,r,n){var i=e.display;if(!r&&"true"==He(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(e){return null}var s,c=pr(e,o,a);if(n&&1==c.xRel&&(s=T(e.doc,c.line).text).length==c.ch){var u=d(s,s.length,e.options.tabSize)-s.length;c=I(c.line,Math.max(0,Math.round((o-Bt(e.display).left)/yr(e.display))-u))}return c}function Cr(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function Sr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Lr(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t!==!1||a!=r.sel.primIndex){var l=r.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&Tr(e,l.head,i),s||Mr(e,l,o)}}return n}function Tr(e,t,r){var i=ur(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=r.appendChild(n("div"," ","CodeMirror-cursor"));if(o.style.left=i.left+"px",o.style.top=i.top+"px",o.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var a=r.appendChild(n("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="",a.style.left=i.other.left+"px",a.style.top=i.other.top+"px",a.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function Mr(e,t,r){function i(e,t,r,i){t<0&&(t=0),t=Math.round(t),i=Math.round(i),s.appendChild(n("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?d-e:r)+"px;\n height: "+(i-t)+"px"))}function o(t,r,n){function o(r,n){return cr(e,I(t,r),"div",c,n)}var a,s,c=T(l,t),f=c.text.length;return we(ke(c,l.direction),r||0,null==n?f:n,function(e,t,l){var c,p,h,m=o(e,"left");if(e==t)c=m,p=h=m.left;else{if(c=o(t-1,"right"),"rtl"==l){var g=m;m=c,c=g}p=m.left,h=c.right}null==r&&0==e&&(p=u),c.top-m.top>3&&(i(p,m.top,null,m.bottom),p=u,m.bottom<c.top&&i(p,m.bottom,null,c.top)),null==n&&t==f&&(h=d),(!a||m.top<a.top||m.top==a.top&&m.left<a.left)&&(a=m),(!s||c.bottom>s.bottom||c.bottom==s.bottom&&c.right>s.right)&&(s=c),p<u+1&&(p=u),i(p,c.top,h-p,c.bottom)}),{start:a,end:s}}var a=e.display,l=e.doc,s=document.createDocumentFragment(),c=Bt(e.display),u=c.left,d=Math.max(a.sizerWidth,Rt(e)-a.sizer.offsetLeft)-c.right,f=t.from(),p=t.to();if(f.line==p.line)o(f.line,f.ch,p.ch);else{var h=T(l,f.line),m=T(l,p.line),g=de(h)==de(m),v=o(f.line,f.ch,g?h.text.length+1:null).end,y=o(p.line,g?0:null,p.ch).start;g&&(v.top<y.top-2?(i(v.right,v.top,null,v.bottom),i(u,y.top,y.left,y.bottom)):i(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&i(u,v.bottom,null,y.top)}r.appendChild(s)}function zr(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ar(e){e.state.focused||(e.display.input.focus(),Nr(e))}function Or(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Er(e))},100)}function Nr(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ae(e,"focus",e,t),e.state.focused=!0,l(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),Jo&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),zr(e))}function Er(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ae(e,"blur",e,t),e.state.focused=!1,ga(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Wr(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=xr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&(r[a].gutter&&(r[a].gutter.style.left=o),r[a].gutterBackground&&(r[a].gutterBackground.style.left=o));var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function Ir(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=W(e.options,t.first+t.size-1),i=e.display;if(r.length!=i.lineNumChars){var o=i.measure.appendChild(n("div",[n("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),a=o.firstChild.offsetWidth,l=o.offsetWidth-a;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(a,i.lineGutter.offsetWidth-l)+1,i.lineNumWidth=i.lineNumInnerWidth+l,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Tn(e),!0}return!1}function Dr(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=void 0;if(!i.hidden){if(Zo&&Qo<8){var a=i.node.offsetTop+i.node.offsetHeight;o=a-r,r=a}else{var l=i.node.getBoundingClientRect();o=l.bottom-l.top}var s=i.line.height-o;if(o<2&&(o=vr(t)),(s>.001||s<-.001)&&(A(i.line,o),qr(i.line),i.rest))for(var c=0;c<i.rest.length;c++)qr(i.rest[c])}}}function qr(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.parentNode.offsetHeight}function Pr(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Ht(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=N(t,n),a=N(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;l<o?(o=l,a=N(t,ye(T(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=N(t,ye(T(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Hr(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,$o||Sn(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),$o&&Sn(e),xn(e,100))}function Fr(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,Wr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Br(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function jr(e){var t=Br(e);return t.x*=Qa,t.y*=Qa,t}function Rr(e,t){var r=Br(t),n=r.x,i=r.y,o=e.display,a=o.scroller,l=a.scrollWidth>a.clientWidth,s=a.scrollHeight>a.clientHeight;if(n&&l||i&&s){if(i&&ca&&Jo)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;d<u.length;d++)if(u[d].node==c){e.display.currentWheelTarget=c;break e}if(n&&!$o&&!ra&&null!=Qa)return i&&s&&Hr(e,Math.max(0,Math.min(a.scrollTop+i*Qa,a.scrollHeight-a.clientHeight))),Fr(e,Math.max(0,Math.min(a.scrollLeft+n*Qa,a.scrollWidth-a.clientWidth))),(!i||i&&s)&&Ie(t),void(o.wheelStartX=null);if(i&&null!=Qa){var f=i*Qa,p=e.doc.scrollTop,h=p+o.wrapper.clientHeight;f<0?p=Math.max(0,p+f-50):h=Math.min(e.doc.height,h+f+50),Sn(e,{top:p,bottom:h})}Za<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Qa=(Qa*Za+r)/(Za+1),++Za)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function Ur(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ft(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+jt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function Kr(e,t){t||(t=Ur(e));var r=e.display.barWidth,n=e.display.barHeight;Vr(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Dr(e),Vr(e,Ur(e)),r=e.display.barWidth,n=e.display.barHeight}function Vr(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function $r(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ga(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new tl[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Wa(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?Fr(e,t):Hr(e,t)},e),e.display.scrollbars.addClass&&l(e.display.wrapper,e.display.scrollbars.addClass)}function Gr(e,t){if(!Oe(e,"scrollCursorIntoView")){var r=e.display,i=r.sizer.getBoundingClientRect(),o=null;if(t.top+i.top<0?o=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!oa){var a=n("div","",null,"position: absolute;\n top: "+(t.top-r.viewOffset-Ht(e.display))+"px;\n height: "+(t.bottom-t.top+jt(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(o),e.display.lineSpace.removeChild(a)}}}function Xr(e,t,r,n){null==n&&(n=0);for(var i,o=0;o<5;o++){var a=!1,l=ur(e,t),s=r&&r!=t?ur(e,r):l;i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-n,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+n};var c=Zr(e,i),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(Hr(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&(Fr(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}function Yr(e,t){var r=Zr(e,t);null!=r.scrollTop&&Hr(e,r.scrollTop),null!=r.scrollLeft&&Fr(e,r.scrollLeft)}function Zr(e,t){var r=e.display,n=vr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Ut(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Ft(r),s=t.top<n,c=t.bottom>l-n;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?l:t.bottom)-o);u!=i&&(a.scrollTop=u)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,f=Rt(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),p=t.right-t.left>f;return p&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.left<d?a.scrollLeft=Math.max(0,t.left-(p?0:10)):t.right>f+d-3&&(a.scrollLeft=t.right+(p?0:10)-f),a}function Qr(e,t,r){null==t&&null==r||en(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Jr(e){en(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?I(t.line,t.ch-1):t,n=I(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin}}function en(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=dr(e,t.from),n=dr(e,t.to),i=Zr(e,{left:Math.min(r.left,n.left),top:Math.min(r.top,n.top)-t.margin,right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)+t.margin});e.scrollTo(i.scrollLeft,i.scrollTop)}}function tn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++rl},xt(e.curOp)}function rn(e){_t(e.curOp,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;nn(e)})}function nn(e){for(var t=e.ops,r=0;r<t.length;r++)on(t[r]);for(var n=0;n<t.length;n++)an(t[n]);for(var i=0;i<t.length;i++)ln(t[i]);for(var o=0;o<t.length;o++)sn(t[o]);for(var a=0;a<t.length;a++)cn(t[a])}function on(e){var t=e.cm,r=t.display;_n(t),e.updateMaxLine&&xe(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new nl(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function an(e){e.updatedDisplay=e.mustUpdate&&kn(e.cm,e.update)}function ln(e){var t=e.cm,r=t.display;e.updatedDisplay&&Dr(t),e.barMeasure=Ur(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Gt(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+jt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Rt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection(e.focus))}function sn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Fr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==a()&&(!document.hasFocus||document.hasFocus());e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Kr(t,e.barMeasure),e.updatedDisplay&&Mn(t,e.barMeasure),e.selectionChanged&&zr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Ar(e.cm)}function cn(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&Cn(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null==e.scrollTop||r.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(n.scrollTop=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,e.scrollTop)),r.scrollbars.setScrollTop(n.scrollTop),r.scroller.scrollTop=n.scrollTop),null==e.scrollLeft||r.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(n.scrollLeft=Math.max(0,Math.min(r.scroller.scrollWidth-r.scroller.clientWidth,e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,Wr(t)),e.scrollToPos){Gr(t,Xr(t,j(n,e.scrollToPos.from),j(n,e.scrollToPos.to),e.scrollToPos.margin))}var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||Ae(i[a],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&Ae(o[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ae(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function un(e,t){if(e.curOp)return t();tn(e);try{return t()}finally{rn(e)}}function dn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);tn(e);try{return t.apply(e,arguments)}finally{rn(e)}}}function fn(e){return function(){if(this.curOp)return e.apply(this,arguments);tn(this);try{return e.apply(this,arguments)}finally{rn(this)}}}function pn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);tn(t);try{return e.apply(this,arguments)}finally{rn(t)}}}function hn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Aa&&he(e.doc,t)<i.viewTo&&gn(e);else if(r<=i.viewFrom)Aa&&me(e.doc,r+n)>i.viewFrom?gn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)gn(e);else if(t<=i.viewFrom){var o=vn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):gn(e)}else if(r>=i.viewTo){var a=vn(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):gn(e)}else{var l=vn(e,t,t,-1),s=vn(e,r,r+n,1);l&&s?(i.view=i.view.slice(0,l.index).concat(bt(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):gn(e)}var c=i.externalMeasured;c&&(r<c.lineN?c.lineN+=n:t<c.lineN+c.size&&(i.externalMeasured=null))}function mn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Cr(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);f(a,r)==-1&&a.push(r)}}}function gn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function vn(e,t,r,n){var i,o=Cr(e,t),a=e.display.view;if(!Aa||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(n>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;he(e.doc,r)!=r;){if(o==(n<0?0:a.length-1))return null;r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function yn(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=bt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=bt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Cr(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(bt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Cr(e,r)))),n.viewTo=r}function bn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function xn(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,c(wn,e))}function wn(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Xe(t.mode,et(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength,s=Qe(e,o,l?Xe(t.mode,n):n,!0);o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!d&&f<a.length;++f)d=a[f]!=o.styles[f];d&&i.push(t.frontier),o.stateAfter=l?n:Xe(t.mode,n)}else o.text.length<=e.options.maxHighlightLength&&tt(e,o.text,n),o.stateAfter=t.frontier%5==0?Xe(t.mode,n):null;if(++t.frontier,+new Date>r)return xn(e,e.options.workDelay),!0}),i.length&&un(e,function(){for(var t=0;t<i.length;t++)mn(e,i[t],"text")})}}function _n(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=jt(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=jt(e)+"px",t.scrollbarsClipped=!0)}function kn(e,r){var n=e.display,i=e.doc;if(r.editorIsHidden)return gn(e),!1;if(!r.force&&r.visible.from>=n.viewFrom&&r.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==bn(e))return!1;Ir(e)&&(gn(e),r.dims=br(e));var o=i.first+i.size,l=Math.max(r.visible.from-e.options.viewportMargin,i.first),s=Math.min(o,r.visible.to+e.options.viewportMargin);n.viewFrom<l&&l-n.viewFrom<20&&(l=Math.max(i.first,n.viewFrom)),n.viewTo>s&&n.viewTo-s<20&&(s=Math.min(o,n.viewTo)),Aa&&(l=he(e.doc,l),s=me(e.doc,s));var c=l!=n.viewFrom||s!=n.viewTo||n.lastWrapHeight!=r.wrapperHeight||n.lastWrapWidth!=r.wrapperWidth;yn(e,l,s),n.viewOffset=ye(T(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var u=bn(e);if(!c&&0==u&&!r.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var d=a();return u>4&&(n.lineDiv.style.display="none"),Ln(e,n.updateLineNumbers,r.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,d&&a()!=d&&d.offsetHeight&&d.focus(),t(n.cursorDiv),t(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,c&&(n.lastWrapHeight=r.wrapperHeight,n.lastWrapWidth=r.wrapperWidth,xn(e,400)),n.updateLineNumbers=null,!0}function Cn(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Rt(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ft(e.display)-Ut(e),r.top)}),t.visible=Pr(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&kn(e,t);n=!1){Dr(e);var i=Ur(e);Sr(e),Kr(e,i),Mn(e,i)}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Sn(e,t){var r=new nl(e,t);if(kn(e,r)){Dr(e),Cn(e,r);var n=Ur(e);Sr(e),Kr(e,n),Mn(e,n),r.finish()}}function Ln(e,r,n){function i(t){var r=t.nextSibling;return Jo&&ca&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var o=e.display,a=e.options.lineNumbers,l=o.lineDiv,s=l.firstChild,c=o.view,u=o.viewFrom,d=0;d<c.length;d++){var p=c[d];if(p.hidden);else if(p.node&&p.node.parentNode==l){for(;s!=p.node;)s=i(s);var h=a&&null!=r&&r<=u&&p.lineNumber;p.changes&&(f(p.changes,"gutter")>-1&&(h=!1),St(e,p,u,n)),h&&(t(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(W(e.options,u)))),s=p.node.nextSibling}else{var m=Et(e,p,u,n);l.insertBefore(m,s)}u+=p.size}for(;s;)s=i(s)}function Tn(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function Mn(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+jt(e)+"px"}function zn(e){var r=e.display.gutters,i=e.options.gutters;t(r);for(var o=0;o<i.length;++o){var a=i[o],l=r.appendChild(n("div",null,"CodeMirror-gutter "+a));"CodeMirror-linenumbers"==a&&(e.display.lineGutter=l,l.style.width=(e.display.lineNumWidth||1)+"px")}r.style.display=o?"":"none",Tn(e)}function An(e){var t=f(e.gutters,"CodeMirror-linenumbers");t==-1&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function On(e,t){var r=e[t];e.sort(function(e,t){return D(e.from(),t.from())}),t=f(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(D(o.to(),i.from())>=0){var a=F(o.from(),i.from()),l=H(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new ol(s?l:a,s?a:l))}}return new il(e,t)}function Nn(e,t){return new il([new ol(e,t||e)],0)}function En(e){return e.text?I(e.from.line+e.text.length-1,m(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Wn(e,t){if(D(e,t.from)<0)return e;if(D(e,t.to)<=0)return En(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=En(t).ch-t.to.ch),I(r,n)}function In(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new ol(Wn(i.anchor,t),Wn(i.head,t)))}return On(r,e.sel.primIndex)}function Dn(e,t,r){return e.line==t.line?I(r.line,e.ch-t.ch+r.ch):I(r.line+(e.line-t.line),e.ch)}function qn(e,t,r){for(var n=[],i=I(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Dn(l.from,i,o),c=Dn(En(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=D(u.head,u.anchor)<0;n[a]=new ol(d?c:s,d?s:c)}else n[a]=new ol(s,s)}return new il(n,e.sel.primIndex)}function Pn(e){e.doc.mode=$e(e.options,e.doc.modeOption),Hn(e)}function Hn(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,xn(e,100),e.state.modeGen++,e.curOp&&hn(e)}function Fn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==m(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Bn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){st(e,r,i,n),kt(e,"change",e,t)}function a(e,t){for(var r=[],o=e;o<t;++o)r.push(new Ua(c[o],i(o),n));return r}var l=t.from,s=t.to,c=t.text,u=T(e,l.line),d=T(e,s.line),f=m(c),p=i(c.length-1),h=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Fn(e,t)){var g=a(0,c.length-1);o(d,d.text,p),h&&e.remove(l.line,h),g.length&&e.insert(l.line,g)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+f+u.text.slice(s.ch),p);else{
|
3 |
+
var v=a(1,c.length-1);v.push(new Ua(f+u.text.slice(s.ch),p,n)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,v)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,h);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,f+d.text.slice(s.ch),p);var y=a(1,c.length-1);h>1&&e.remove(l.line+1,h-1),e.insert(l.line+1,y)}kt(e,"change",e,t)}function jn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;r&&!s||(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function Rn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,_r(e),Pn(e),Un(e),e.options.lineWrapping||xe(e),e.options.mode=t.modeOption,hn(e)}function Un(e){("rtl"==e.doc.direction?l:ga)(e.display.lineDiv,"CodeMirror-rtl")}function Kn(e){un(e,function(){Un(e),hn(e)})}function Vn(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function $n(e,t){var r={from:P(t.from),to:En(t),text:M(e,t.from,t.to)};return ei(e,r,t.from.line,t.to.line+1),jn(e,function(e){return ei(e,r,t.from.line,t.to.line+1)},!0),r}function Gn(e){for(;e.length;){if(!m(e).ranges)break;e.pop()}}function Xn(e,t){return t?(Gn(e.done),m(e.done)):e.done.length&&!m(e.done).ranges?m(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),m(e.done)):void 0}function Yn(e,t,r,n){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>l-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=Xn(i,i.lastOp==n)))a=m(o.changes),0==D(t.from,t.to)&&0==D(t.from,a.to)?a.to=En(t):o.changes.push($n(e,t));else{var s=m(i.done);for(s&&s.ranges||Jn(e.sel,i.done),o={changes:[$n(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,a||Ae(e,"historyAdded")}function Zn(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Qn(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||Zn(e,o,m(i.done),t))?i.done[i.done.length-1]=t:Jn(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&Gn(i.undone)}function Jn(e,t){var r=m(t);r&&r.ranges&&r.equals(e)||t.push(e)}function ei(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function ti(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function ri(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(ti(r[i]));return n}function ni(e,t){var r=ri(e,t),n=J(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function ii(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?il.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];n.push({changes:l});for(var s=0;s<a.length;++s){var c=a[s],u=void 0;if(l.push({from:c.from,to:c.to,text:c.text}),t)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&f(t,Number(u[1]))>-1&&(m(l)[d]=c[d],delete c[d])}}}return n}function oi(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=D(r,i)<0;o!=D(n,i)<0?(i=r,r=n):o!=D(r,n)<0&&(r=n)}return new ol(i,r)}return new ol(n||r,r)}function ai(e,t,r,n){fi(e,new il([oi(e,e.sel.primary(),t,r)],0),n)}function li(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=oi(e,e.sel.ranges[i],t[i],null);fi(e,On(n,e.sel.primIndex),r)}function si(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,fi(e,On(i,e.sel.primIndex),n)}function ci(e,t,r,n){fi(e,Nn(t,r),n)}function ui(e,t,r){var n={ranges:t.ranges,update:function(t){var r=this;this.ranges=[];for(var n=0;n<t.length;n++)r.ranges[n]=new ol(j(e,t[n].anchor),j(e,t[n].head))},origin:r&&r.origin};return Ae(e,"beforeSelectionChange",e,n),e.cm&&Ae(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?On(n.ranges,n.ranges.length-1):t}function di(e,t,r){var n=e.history.done,i=m(n);i&&i.ranges?(n[n.length-1]=t,pi(e,t,r)):fi(e,t,r)}function fi(e,t,r){pi(e,t,r),Qn(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function pi(e,t,r){(Ee(e,"beforeSelectionChange")||e.cm&&Ee(e.cm,"beforeSelectionChange"))&&(t=ui(e,t,r)),hi(e,gi(e,t,r&&r.bias||(D(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),r&&r.scroll===!1||!e.cm||Jr(e.cm)}function hi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Ne(e.cm)),kt(e,"cursorActivity",e))}function mi(e){hi(e,gi(e,e.sel,null,!1),ka)}function gi(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=yi(e,a.anchor,l&&l.anchor,r,n),c=yi(e,a.head,l&&l.head,r,n);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new ol(s,c))}return i?On(i,t.primIndex):t}function vi(e,t,r,n,i){var o=T(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i&&(Ae(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var c=s.find(n<0?1:-1),u=void 0;if((n<0?s.inclusiveRight:s.inclusiveLeft)&&(c=bi(e,c,-n,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=D(c,r))&&(n<0?u<0:u>0))return vi(e,c,t,n,i)}var d=s.find(n<0?-1:1);return(n<0?s.inclusiveLeft:s.inclusiveRight)&&(d=bi(e,d,n,d.line==t.line?o:null)),d?vi(e,d,t,n,i):null}}return t}function yi(e,t,r,n,i){var o=n||1,a=vi(e,t,r,o,i)||!i&&vi(e,t,r,o,!0)||vi(e,t,r,-o,i)||!i&&vi(e,t,r,-o,!0);return a?a:(e.cantEdit=!0,I(e.first,0))}function bi(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?j(e,I(t.line-1)):null:r>0&&t.ch==(n||T(e,t.line)).text.length?t.line<e.first+e.size-1?I(t.line+1,0):null:new I(t.line,t.ch+r)}function xi(e){e.setSelection(I(e.firstLine(),0),I(e.lastLine()),ka)}function wi(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,o){t&&(n.from=j(e,t)),r&&(n.to=j(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),Ae(e,"beforeChange",e,n),e.cm&&Ae(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function _i(e,t,r){if(e.cm){if(!e.cm.curOp)return dn(e.cm,_i)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Ee(e,"beforeChange")||e.cm&&Ee(e.cm,"beforeChange"))||(t=wi(e,t,!0))){var n=za&&!r&&te(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)ki(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else ki(e,t)}}function ki(e,t){if(1!=t.text.length||""!=t.text[0]||0!=D(t.from,t.to)){var r=In(e,t);Yn(e,t,r,e.cm?e.cm.curOp.id:NaN),Li(e,t,r,J(e,t));var n=[];jn(e,function(e,r){r||f(n,e.history)!=-1||(Oi(e.history,t),n.push(e.history)),Li(e,t,null,J(e,t))})}}function Ci(e,t,r){if(!e.cm||!e.cm.state.suppressEdits||r){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s<a.length&&(n=a[s],r?!n.ranges||n.equals(e.sel):n.ranges);s++);if(s!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;n=a.pop(),n.ranges;){if(Jn(n,l),r&&!n.equals(e.sel))return void fi(e,n,{clearRedo:!1});o=n}var c=[];Jn(o,l),l.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=Ee(e,"beforeChange")||e.cm&&Ee(e.cm,"beforeChange"),d=n.changes.length-1;d>=0;--d){var p=function(r){var i=n.changes[r];if(i.origin=t,u&&!wi(e,i,!1))return a.length=0,{};c.push($n(e,i));var o=r?In(e,i):m(a);Li(e,i,o,ni(e,i)),!r&&e.cm&&e.cm.scrollIntoView({from:i.from,to:En(i)});var l=[];jn(e,function(e,t){t||f(l,e.history)!=-1||(Oi(e.history,i),l.push(e.history)),Li(e,i,null,ni(e,i))})}(d);if(p)return p.v}}}}function Si(e,t){if(0!=t&&(e.first+=t,e.sel=new il(g(e.sel.ranges,function(e){return new ol(I(e.anchor.line+t,e.anchor.ch),I(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){hn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)mn(e.cm,n,"gutter")}}function Li(e,t,r,n){if(e.cm&&!e.cm.curOp)return dn(e.cm,Li)(e,t,r,n);if(t.to.line<e.first)return void Si(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Si(e,i),t={from:I(e.first,0),to:I(t.to.line+i,t.to.ch),text:[m(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:I(o,T(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=M(e,t.from,t.to),r||(r=In(e,t)),e.cm?Ti(e.cm,t,n):Bn(e,t,n),pi(e,r,ka)}}function Ti(e,t,r){var n=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=O(de(T(n,o.line))),n.iter(s,a.line+1,function(e){if(e==i.maxLine)return l=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Ne(e),Bn(n,t,r,wr(e)),e.options.lineWrapping||(n.iter(s,o.line+t.text.length,function(e){var t=be(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,o.line),xn(e,400);var c=t.text.length-(a.line-o.line)-1;t.full?hn(e):o.line!=a.line||1!=t.text.length||Fn(e.doc,t)?hn(e,o.line,a.line+1,c):mn(e,o.line,"text");var u=Ee(e,"changes"),d=Ee(e,"change");if(d||u){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&kt(e,"change",e,f),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}function Mi(e,t,r,n,i){if(n||(n=r),D(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),_i(e,{from:r,to:n,text:t,origin:i})}function zi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Ai(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)zi(o.ranges[l].anchor,t,r,n),zi(o.ranges[l].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(r<c.from.line)c.from=I(c.from.line+n,c.from.ch),c.to=I(c.to.line+n,c.to.ch);else if(t<=c.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function Oi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;Ai(e.done,r,n,i),Ai(e.undone,r,n,i)}function Ni(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=T(e,B(e,t)):i=O(t),null==i?null:(n(o,i)&&e.cm&&mn(e.cm,i,r),o)}function Ei(e,t,r){ye(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Qr(e,null,r)}function Wi(e,t,r,n){var i=new sl(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Ni(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!ge(e,t)){var n=ye(t)<e.scrollTop;A(t,t.height+qt(i)),n&&Qr(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),kt(o,"lineWidgetAdded",o,i,"number"==typeof t?t:O(t)),i}function Ii(e,t,r,n,o){if(n&&n.shared)return Di(e,t,r,n,o);if(e.cm&&!e.cm.curOp)return dn(e.cm,Ii)(e,t,r,n,o);var a=new ul(e,o),l=D(t,r);if(n&&u(n,a,!1),l>0||0==l&&a.clearWhenEmpty!==!1)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=i("span",[a.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(ue(e,t.line,t,r,a)||t.line!=r.line&&ue(e,r.line,t,r,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");V()}a.addToHistory&&Yn(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,c=t.line,d=e.cm;if(e.iter(c,r.line+1,function(e){d&&a.collapsed&&!d.options.lineWrapping&&de(e)==d.display.maxLine&&(s=!0),a.collapsed&&c!=t.line&&A(e,0),Y(e,new $(a,c==t.line?t.ch:null,c==r.line?r.ch:null)),++c}),a.collapsed&&e.iter(t.line,r.line+1,function(t){ge(e,t)&&A(t,0)}),a.clearOnEnter&&Wa(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(K(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),a.collapsed&&(a.id=++cl,a.atomic=!0),d){if(s&&(d.curOp.updateMaxLine=!0),a.collapsed)hn(d,t.line,r.line+1);else if(a.className||a.title||a.startStyle||a.endStyle||a.css)for(var f=t.line;f<=r.line;f++)mn(d,f,"text");a.atomic&&mi(d.doc),kt(d,"markerAdded",d,a)}return a}function Di(e,t,r,n,i){n=u(n),n.shared=!1;var o=[Ii(e,t,r,n,i)],a=o[0],l=n.widgetNode;return jn(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(Ii(e,j(e,t),j(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=m(o)}),new dl(o,a)}function qi(e){return e.findMarks(I(e.first,0),e.clipPos(I(e.lastLine())),function(e){return e.parent})}function Pi(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(D(o,a)){var l=Ii(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function Hi(e){for(var t=0;t<e.length;t++)!function(t){var r=e[t],n=[r.primary.doc];jn(r.primary.doc,function(e){return n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];f(n,o.doc)==-1&&(o.parent=null,r.markers.splice(i--,1))}}(t)}function Fi(e){var t=this;if(Ri(t),!Oe(t,e)&&!Pt(t.display,e)){Ie(e),Zo&&(hl=+new Date);var r=kr(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=0;l<i;++l)!function(e,n){if(!t.options.allowDropFileTypes||f(t.options.allowDropFileTypes,e.type)!=-1){var l=new FileReader;l.onload=dn(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=j(t.doc,r);var s={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};_i(t.doc,s),di(t.doc,Nn(r,En(s)))}}),l.readAsText(e)}}(n[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var s=e.dataTransfer.getData("Text");if(s){var c;if(t.state.draggingText&&!t.state.draggingText.copy&&(c=t.listSelections()),pi(t.doc,Nn(r,r)),c)for(var u=0;u<c.length;++u)Mi(t.doc,"",c[u].anchor,c[u].head,"drag");t.replaceSelection(s,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Bi(e,t){if(Zo&&(!e.state.draggingText||+new Date-hl<100))return void Pe(t);if(!Oe(e,t)&&!Pt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!na)){var r=n("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",ra&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),ra&&r.parentNode.removeChild(r)}}function ji(e,t){var i=kr(e,t);if(i){var o=document.createDocumentFragment();Tr(e,i,o),e.display.dragCursor||(e.display.dragCursor=n("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),r(e.display.dragCursor,o)}}function Ri(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Ui(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}function Ki(){ml||(Vi(),ml=!0)}function Vi(){var e;Wa(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Ui($i)},100))}),Wa(window,"blur",function(){return Ui(Er)})}function $i(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Gi(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,i,o,a=0;a<t.length-1;a++){var l=t[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);i=!0}}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),o&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Xi(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=g(r.split(" "),Gi),o=0;o<i.length;o++){var a=void 0,l=void 0;o==i.length-1?(l=i.join(" "),a=n):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var c in t)e[c]=t[c];return e}function Yi(e,t,r,n){t=Ji(t);var i=t.call?t.call(e,n):t[e];if(i===!1)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Yi(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=Yi(e,t.fallthrough[o],r,n);if(a)return a}}}function Zi(e){var t="string"==typeof e?e:gl[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Qi(e,t){if(ra&&34==e.keyCode&&e.char)return!1;var r=gl[e.keyCode],n=r;return null!=n&&!e.altGraphKey&&(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(ha?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(ha?e.ctrlKey:e.metaKey)&&"Cmd"!=r&&(n="Cmd-"+n),!t&&e.shiftKey&&"Shift"!=r&&(n="Shift-"+n),n)}function Ji(e){return"string"==typeof e?xl[e]:e}function eo(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&D(o.from,m(n).to)<=0;){var a=n.pop();if(D(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}un(e,function(){for(var t=n.length-1;t>=0;t--)Mi(e.doc,"",n[t].from,n[t].to,"+delete");Jr(e)})}function to(e,t){var r=T(e.doc,t),n=de(r);return n!=r&&(t=O(n)),Le(!0,e,n,t,1)}function ro(e,t){var r=T(e.doc,t),n=fe(r);return n!=r&&(t=O(n)),Le(!0,e,r,t,-1)}function no(e,t){var r=to(e,t.line),n=T(e.doc,r.line),i=ke(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return I(r.line,a?0:o,r.sticky)}return r}function io(e,t,r){if("string"==typeof t&&!(t=kl[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=_a}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function oo(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Yi(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Yi(t,e.options.extraKeys,r,e)||Yi(t,e.options.keyMap,r,e)}function ao(e,t,r,n){var i=e.state.keySeq;if(i){if(Zi(t))return"handled";Cl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=oo(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&kt(e,"keyHandled",e,t,r),"handled"!=o&&"multi"!=o||(Ie(r),zr(e)),i&&!o&&/\'$/.test(t)?(Ie(r),!0):!!o}function lo(e,t){var r=Qi(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?ao(e,"Shift-"+r,t,function(t){return io(e,t,!0)})||ao(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return io(e,t)}):ao(e,r,t,function(t){return io(e,t)}))}function so(e,t,r){return ao(e,"'"+r+"'",t,function(t){return io(e,t,!0)})}function co(e){var t=this;if(t.curOp.focus=a(),!Oe(t,e)){Zo&&Qo<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=lo(t,e);ra&&(Sl=n?r:null,!n&&88==r&&!Pa&&(ca?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||uo(t)}}function uo(e){function t(e){18!=e.keyCode&&e.altKey||(ga(r,"CodeMirror-crosshair"),ze(document,"keyup",t),ze(document,"mouseover",t))}var r=e.display.lineDiv;l(r,"CodeMirror-crosshair"),Wa(document,"keyup",t),Wa(document,"mouseover",t)}function fo(e){16==e.keyCode&&(this.doc.sel.shift=!1),Oe(this,e)}function po(e){var t=this;if(!(Pt(t.display,e)||Oe(t,e)||e.ctrlKey&&!e.altKey||ca&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(ra&&r==Sl)return Sl=null,void Ie(e);if(!ra||e.which&&!(e.which<10)||!lo(t,e)){var i=String.fromCharCode(null==n?r:n);"\b"!=i&&(so(t,e,i)||t.display.input.onKeyPress(e))}}}function ho(e){var t=this,r=t.display;if(!(Oe(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.input.ensurePolled(),r.shift=e.shiftKey,Pt(r,e))return void(Jo||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100)));if(!bo(t,e)){var n=kr(t,e);switch(window.focus(),Fe(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?mo(t,e,n):He(e)==r.scroller&&Ie(e);break;case 2:Jo&&(t.state.lastMiddleDown=+new Date),n&&ai(t.doc,n),setTimeout(function(){return r.input.focus()},20),Ie(e);break;case 3:ma?xo(t,e):Or(t)}}}}function mo(e,t,r){Zo?setTimeout(c(Ar,e),0):e.curOp.focus=a();var n,i=+new Date;_l&&_l.time>i-400&&0==D(_l.pos,r)?n="triple":wl&&wl.time>i-400&&0==D(wl.pos,r)?(n="double",_l={time:i,pos:r}):(n="single",wl={time:i,pos:r});var o,l=e.doc.sel,s=ca?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ia&&!e.isReadOnly()&&"single"==n&&(o=l.contains(r))>-1&&(D((o=l.ranges[o]).from(),r)<0||r.xRel>0)&&(D(o.to(),r)>0||r.xRel<0)?go(e,t,r,s):vo(e,t,r,n,s)}function go(e,t,r,n){var i=e.display,o=+new Date,a=dn(e,function(l){Jo&&(i.scroller.draggable=!1),e.state.draggingText=!1,ze(document,"mouseup",a),ze(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(Ie(l),!n&&+new Date-200<o&&ai(e.doc,r),Jo||Zo&&9==Qo?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});Jo&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=ca?t.altKey:t.ctrlKey,i.scroller.dragDrop&&i.scroller.dragDrop(),Wa(document,"mouseup",a),Wa(i.scroller,"drop",a)}function vo(e,t,r,n,i){function o(t){if(0!=D(b,t))if(b=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=d(T(u,r.line).text,r.ch,o),l=d(T(u,t.line).text,t.ch,o),s=Math.min(a,l),c=Math.max(a,l),g=Math.min(r.line,t.line),v=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=v;g++){var y=T(u,g).text,x=p(y,s,o);s==c?i.push(new ol(I(g,x),I(g,x))):y.length>x&&i.push(new ol(I(g,x),I(g,p(y,c,o))))}i.length||i.push(new ol(r,r)),fi(u,On(m.ranges.slice(0,h).concat(i),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var w=f,_=w.anchor,k=t;if("single"!=n){var C;C="double"==n?e.findWordAt(t):new ol(I(t.line,0),j(u,I(t.line+1,0))),D(C.anchor,_)>0?(k=C.head,_=F(w.from(),C.anchor)):(k=C.anchor,_=H(w.to(),C.head))}var S=m.ranges.slice(0);S[h]=new ol(j(u,_),k),fi(u,On(S,h),Ca)}}function l(t){var r=++w,i=kr(e,t,!0,"rect"==n);if(i)if(0!=D(i,b)){e.curOp.focus=a(),o(i);var s=Pr(c,u);(i.line>=s.to||i.line<s.from)&&setTimeout(dn(e,function(){w==r&&l(t)}),150)}else{var d=t.clientY<x.top?-20:t.clientY>x.bottom?20:0;d&&setTimeout(dn(e,function(){w==r&&(c.scroller.scrollTop+=d,l(t))}),50)}}function s(t){e.state.selectingText=!1,w=1/0,Ie(t),c.input.focus(),ze(document,"mousemove",_),ze(document,"mouseup",k),u.history.lastSelOrigin=null}var c=e.display,u=e.doc;Ie(t);var f,h,m=u.sel,g=m.ranges;if(i&&!t.shiftKey?(h=u.sel.contains(r),f=h>-1?g[h]:new ol(r,r)):(f=u.sel.primary(),h=u.sel.primIndex),ua?t.shiftKey&&t.metaKey:t.altKey)n="rect",i||(f=new ol(r,r)),r=kr(e,t,!0,!0),h=-1;else if("double"==n){var v=e.findWordAt(r);f=e.display.shift||u.extend?oi(u,f,v.anchor,v.head):v}else if("triple"==n){var y=new ol(I(r.line,0),j(u,I(r.line+1,0)));f=e.display.shift||u.extend?oi(u,f,y.anchor,y.head):y}else f=oi(u,f,r);i?h==-1?(h=g.length,fi(u,On(g.concat([f]),h),{scroll:!1,origin:"*mouse"})):g.length>1&&g[h].empty()&&"single"==n&&!t.shiftKey?(fi(u,On(g.slice(0,h).concat(g.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):si(u,h,f,Ca):(h=0,fi(u,new il([f],0),Ca),m=u.sel);var b=r,x=c.wrapper.getBoundingClientRect(),w=0,_=dn(e,function(e){Fe(e)?l(e):s(e)}),k=dn(e,s);e.state.selectingText=k,Wa(document,"mousemove",_),Wa(document,"mouseup",k)}function yo(e,t,r,n){var i,o;try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Ie(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Ee(e,r))return qe(t);o-=l.top-a.viewOffset;for(var s=0;s<e.options.gutters.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i){return Ae(e,r,e,N(e.doc,o),e.options.gutters[s],t),qe(t)}}}function bo(e,t){return yo(e,t,"gutterClick",!0)}function xo(e,t){Pt(e.display,t)||wo(e,t)||Oe(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function wo(e,t){return!!Ee(e,"gutterContextMenu")&&yo(e,t,"gutterContextMenu",!1)}function _o(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ir(e)}function ko(e){zn(e),hn(e),Wr(e)}function Co(e,t,r){if(!t!=!(r&&r!=Ll)){var n=e.display.dragFunctions,i=t?Wa:ze;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function So(e){e.options.lineWrapping?(l(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(ga(e.display.wrapper,"CodeMirror-wrap"),xe(e)),_r(e),hn(e),ir(e),setTimeout(function(){return Kr(e)},100)}function Lo(e,t){var r=this;if(!(this instanceof Lo))return new Lo(e,t);this.options=t=t?u(t):{},u(Tl,t,!1),An(t);var n=t.value;"string"==typeof n&&(n=new pl(n,t.mode,null,t.lineSeparator,t.direction)),this.doc=n;var i=new Lo.inputStyles[t.inputStyle](this),o=this.display=new L(e,n,i);o.wrapper.CodeMirror=this,zn(this),_o(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),$r(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new ya,keySeq:null,specialChars:null},t.autofocus&&!sa&&o.input.focus(),Zo&&Qo<11&&setTimeout(function(){return r.display.input.reset(!0)},20),To(this),Ki(),tn(this),this.curOp.forceUpdate=!0,Rn(this,n),t.autofocus&&!sa||this.hasFocus()?setTimeout(c(Nr,this),20):Er(this);for(var a in Ml)Ml.hasOwnProperty(a)&&Ml[a](r,t[a],Ll);Ir(this),t.finishInit&&t.finishInit(this);for(var l=0;l<zl.length;++l)zl[l](r);rn(this),Jo&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function To(e){function t(){i.activeTouch&&(o=setTimeout(function(){return i.activeTouch=null},1e3),a=i.activeTouch,a.end=+new Date)}function r(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}var i=e.display;Wa(i.scroller,"mousedown",dn(e,ho)),Zo&&Qo<11?Wa(i.scroller,"dblclick",dn(e,function(t){if(!Oe(e,t)){var r=kr(e,t);if(r&&!bo(e,t)&&!Pt(e.display,t)){Ie(t);var n=e.findWordAt(r);ai(e.doc,n.anchor,n.head)}}})):Wa(i.scroller,"dblclick",function(t){return Oe(e,t)||Ie(t)}),ma||Wa(i.scroller,"contextmenu",function(t){return xo(e,t)});var o,a={end:0};Wa(i.scroller,"touchstart",function(t){if(!Oe(e,t)&&!r(t)){i.input.ensurePolled(),clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Wa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Wa(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Pt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new ol(l,l):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(l):new ol(I(l.line,0),j(e.doc,I(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Ie(r)}t()}),Wa(i.scroller,"touchcancel",t),Wa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Hr(e,i.scroller.scrollTop),Fr(e,i.scroller.scrollLeft,!0),Ae(e,"scroll",e))}),Wa(i.scroller,"mousewheel",function(t){return Rr(e,t)}),Wa(i.scroller,"DOMMouseScroll",function(t){return Rr(e,t)}),Wa(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Oe(e,t)||Pe(t)},over:function(t){Oe(e,t)||(ji(e,t),Pe(t))},start:function(t){return Bi(e,t)},drop:dn(e,Fi),leave:function(t){Oe(e,t)||Ri(e)}};var l=i.input.getField();Wa(l,"keyup",function(t){return fo.call(e,t)}),Wa(l,"keydown",dn(e,co)),Wa(l,"keypress",dn(e,po)),Wa(l,"focus",function(t){return Nr(e,t)}),Wa(l,"blur",function(t){return Er(e,t)})}function Mo(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=et(e,t):r="prev");var a=e.options.tabSize,l=T(o,t),s=d(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&((c=o.mode.indent(i,l.text.slice(u.length),l.text))==_a||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?d(T(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var f="",p=0;if(e.options.indentWithTabs)for(var m=Math.floor(c/a);m;--m)p+=a,f+="\t";if(p<c&&(f+=h(c-p)),f!=u)return Mi(o,f,I(t,0),I(t,u.length),"+input"),l.stateAfter=null,!0;for(var g=0;g<o.sel.ranges.length;g++){var v=o.sel.ranges[g];if(v.head.line==t&&v.head.ch<u.length){var y=I(t,u.length);si(o,g,new ol(y,y));break}}}function zo(e){Al=e}function Ao(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=e.state.pasteIncoming||"paste"==i,l=Da(t),s=null;if(a&&n.ranges.length>1)if(Al&&Al.text.join("\n")==t){if(n.ranges.length%Al.text.length==0){s=[];for(var c=0;c<Al.text.length;c++)s.push(o.splitLines(Al.text[c]))}}else l.length==n.ranges.length&&(s=g(l,function(e){return[e]}));for(var u,d=n.ranges.length-1;d>=0;d--){var f=n.ranges[d],p=f.from(),h=f.to();f.empty()&&(r&&r>0?p=I(p.line,p.ch-r):e.state.overwrite&&!a?h=I(h.line,Math.min(T(o,h.line).text.length,h.ch+m(l).length)):Al&&Al.lineWise&&Al.text.join("\n")==t&&(p=h=I(p.line,0))),u=e.curOp.updateInput;var v={from:p,to:h,text:s?s[d%s.length]:l,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};_i(e.doc,v),kt(e,"inputRead",e,v)}t&&!a&&No(e,t),Jr(e),e.curOp.updateInput=u,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Oo(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||un(t,function(){return Ao(t,r,0,null,"paste")}),!0}function No(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=Mo(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(T(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Mo(e,i.head.line,"smart"));a&&kt(e,"electricInput",e,i.head.line)}}}function Eo(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:I(i,0),head:I(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Wo(e,t){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck",!!t)}function Io(){var e=n("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=n("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return Jo?e.style.width="1000px":e.setAttribute("wrap","off"),aa&&(e.style.border="1px solid black"),Wo(e),t}function Do(e,t,r,n,i){function o(){var n=t.line+r;return!(n<e.first||n>=e.first+e.size)&&(t=new I(n,t.ch,t.sticky),
|
4 |
+
c=T(e,n))}function a(n){var a;if(null==(a=i?Te(e.cm,c,t,r):Se(c,t,r))){if(n||!o())return!1;t=Le(i,e.cm,c,t.line,r)}else t=a;return!0}var l=t,s=r,c=T(e,t.line);if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var u=null,d="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(r<0)||a(!p);p=!1){var h=c.text.charAt(t.ch)||"\n",m=w(h,f)?"w":d&&"\n"==h?"n":!d||/\s/.test(h)?null:"p";if(!d||p||m||(m="s"),u&&u!=m){r<0&&(r=1,a(),t.sticky="after");break}if(m&&(u=m),r>0&&!a(!p))break}var g=yi(e,t,l,s,!0);return q(l,g)&&(g.hitSide=!0),g}function qo(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=Math.max(l-.5*vr(e.display),3);i=(r>0?t.bottom:t.top)+r*s}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(var c;c=pr(e,a,i),c.outside;){if(r<0?i<=0:i>=o.height){c.hitSide=!0;break}i+=5*r}return c}function Po(e,t){var r=Xt(e,t.line);if(!r||r.hidden)return null;var n=T(e.doc,t.line),i=Vt(r,n,t.line),o=ke(n,e.doc.direction),a="left";if(o){a=_e(o,t.ch)%2?"right":"left"}var l=Qt(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function Ho(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Fo(e,t){return t&&(e.bad=!0),e}function Bo(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(){u&&(c+=d,u=!1)}function l(e){e&&(a(),c+=e)}function s(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return void l(r||t.textContent.replace(/\u200b/g,""));var c,f=t.getAttribute("cm-marker");if(f){var p=e.findMarks(I(n,0),I(i+1,0),o(+f));return void(p.length&&(c=p[0].find())&&l(M(e.doc,c.from,c.to).join(d)))}if("false"==t.getAttribute("contenteditable"))return;var h=/^(pre|div|p)$/i.test(t.nodeName);h&&a();for(var m=0;m<t.childNodes.length;m++)s(t.childNodes[m]);h&&(u=!0)}else 3==t.nodeType&&l(t.nodeValue)}for(var c="",u=!1,d=e.doc.lineSeparator();s(t),t!=r;)t=t.nextSibling;return c}function jo(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Fo(e.clipPos(I(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return Ro(o,t,r)}}function Ro(e,t,r){function n(t,r,n){for(var i=-1;i<(d?d.length:0);i++)for(var o=i<0?u.map:d[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var s=O(i<0?e.line:e.rest[i]),c=o[a]+n;return(n<0||l!=t)&&(c=o[a+(n?1:0)]),I(s,c)}}}var i=e.text.firstChild,a=!1;if(!t||!o(i,t))return Fo(I(O(e.line),0),!0);if(t==i&&(a=!0,t=i.childNodes[r],r=0,!t)){var l=e.rest?m(e.rest):e.line;return Fo(I(O(l),l.text.length),a)}var s=3==t.nodeType?t:null,c=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));c.parentNode!=i;)c=c.parentNode;var u=e.measure,d=u.maps,f=n(s,c,r);if(f)return Fo(f,a);for(var p=c.nextSibling,h=s?s.nodeValue.length-r:0;p;p=p.nextSibling){if(f=n(p,p.firstChild,0))return Fo(I(f.line,f.ch-h),a);h+=p.textContent.length}for(var g=c.previousSibling,v=r;g;g=g.previousSibling){if(f=n(g,g.firstChild,-1))return Fo(I(f.line,f.ch+v),a);v+=g.textContent.length}}function Uo(e,t){function r(){e.value=s.getValue()}if(t=t?u(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=a();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}var i;if(e.form&&(Wa(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}t.finishInit=function(t){t.save=r,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,r(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(ze(e.form,"submit",r),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var s=Lo(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return s}var Ko=navigator.userAgent,Vo=navigator.platform,$o=/gecko\/\d/i.test(Ko),Go=/MSIE \d/.test(Ko),Xo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ko),Yo=/Edge\/(\d+)/.exec(Ko),Zo=Go||Xo||Yo,Qo=Zo&&(Go?document.documentMode||6:+(Yo||Xo)[1]),Jo=!Yo&&/WebKit\//.test(Ko),ea=Jo&&/Qt\/\d+\.\d+/.test(Ko),ta=!Yo&&/Chrome\//.test(Ko),ra=/Opera\//.test(Ko),na=/Apple Computer/.test(navigator.vendor),ia=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Ko),oa=/PhantomJS/.test(Ko),aa=!Yo&&/AppleWebKit/.test(Ko)&&/Mobile\/\w+/.test(Ko),la=/Android/.test(Ko),sa=aa||la||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Ko),ca=aa||/Mac/.test(Vo),ua=/\bCrOS\b/.test(Ko),da=/win/i.test(Vo),fa=ra&&Ko.match(/Version\/(\d*\.\d*)/);fa&&(fa=Number(fa[1])),fa&&fa>=15&&(ra=!1,Jo=!0);var pa,ha=ca&&(ea||ra&&(null==fa||fa<12.11)),ma=$o||Zo&&Qo>=9,ga=function(t,r){var n=t.className,i=e(r).exec(n);if(i){var o=n.slice(i.index+i[0].length);t.className=n.slice(0,i.index)+(o?i[1]+o:"")}};pa=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var va=function(e){e.select()};aa?va=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:Zo&&(va=function(e){try{e.select()}catch(e){}});var ya=function(){this.id=null};ya.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var ba,xa,wa=30,_a={toString:function(){return"CodeMirror.Pass"}},ka={scroll:!1},Ca={origin:"*mouse"},Sa={origin:"+move"},La=[""],Ta=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ma=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,za=!1,Aa=!1,Oa=null,Na=function(){function e(e){return e<=247?r.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1785?n.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/;return function(r,n){var c="ltr"==n?"L":"R";if(0==r.length||"ltr"==n&&!i.test(r))return!1;for(var u=r.length,d=[],f=0;f<u;++f)d.push(e(r.charCodeAt(f)));for(var p=0,h=c;p<u;++p){var g=d[p];"m"==g?d[p]=h:h=g}for(var v=0,y=c;v<u;++v){var b=d[v];"1"==b&&"r"==y?d[v]="n":a.test(b)&&(y=b,"r"==b&&(d[v]="R"))}for(var x=1,w=d[0];x<u-1;++x){var _=d[x];"+"==_&&"1"==w&&"1"==d[x+1]?d[x]="1":","!=_||w!=d[x+1]||"1"!=w&&"n"!=w||(d[x]=w),w=_}for(var k=0;k<u;++k){var C=d[k];if(","==C)d[k]="N";else if("%"==C){var S=void 0;for(S=k+1;S<u&&"%"==d[S];++S);for(var L=k&&"!"==d[k-1]||S<u&&"1"==d[S]?"1":"N",T=k;T<S;++T)d[T]=L;k=S-1}}for(var M=0,z=c;M<u;++M){var A=d[M];"L"==z&&"1"==A?d[M]="L":a.test(A)&&(z=A)}for(var O=0;O<u;++O)if(o.test(d[O])){var N=void 0;for(N=O+1;N<u&&o.test(d[N]);++N);for(var E="L"==(O?d[O-1]:c),W="L"==(N<u?d[N]:c),I=E==W?E?"L":"R":c,D=O;D<N;++D)d[D]=I;O=N-1}for(var q,P=[],H=0;H<u;)if(l.test(d[H])){var F=H;for(++H;H<u&&l.test(d[H]);++H);P.push(new t(0,F,H))}else{var B=H,j=P.length;for(++H;H<u&&"L"!=d[H];++H);for(var R=B;R<H;)if(s.test(d[R])){B<R&&P.splice(j,0,new t(1,B,R));var U=R;for(++R;R<H&&s.test(d[R]);++R);P.splice(j,0,new t(2,U,R)),B=R}else++R;B<H&&P.splice(j,0,new t(1,B,H))}return 1==P[0].level&&(q=r.match(/^\s+/))&&(P[0].from=q[0].length,P.unshift(new t(0,0,q[0].length))),1==m(P).level&&(q=r.match(/\s+$/))&&(m(P).to-=q[0].length,P.push(new t(0,u-q[0].length,u))),"rtl"==n?P.reverse():P}}(),Ea=[],Wa=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Ea).concat(r)}},Ia=function(){if(Zo&&Qo<9)return!1;var e=n("div");return"draggable"in e||"dragDrop"in e}(),Da=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");a!=-1?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},qa=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Pa=function(){var e=n("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Ha=null,Fa={},Ba={},ja={},Ra=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Ra.prototype.eol=function(){return this.pos>=this.string.length},Ra.prototype.sol=function(){return this.pos==this.lineStart},Ra.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ra.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ra.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ra.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ra.prototype.eatSpace=function(){for(var e=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++e.pos;return this.pos>t},Ra.prototype.skipToEnd=function(){this.pos=this.string.length},Ra.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ra.prototype.backUp=function(e){this.pos-=e},Ra.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=d(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?d(this.string,this.lineStart,this.tabSize):0)},Ra.prototype.indentation=function(){return d(this.string,null,this.tabSize)-(this.lineStart?d(this.string,this.lineStart,this.tabSize):0)},Ra.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return t!==!1&&(this.pos+=e.length),!0},Ra.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ra.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}};var Ua=function(e,t,r){this.text=e,ne(this,t),this.height=r?r(this):1};Ua.prototype.lineNo=function(){return O(this)},We(Ua);var Ka,Va={},$a={},Ga=null,Xa=null,Ya={left:0,right:0,top:0,bottom:0},Za=0,Qa=null;Zo?Qa=-.53:$o?Qa=15:ta?Qa=-.7:na&&(Qa=-1/3);var Ja=function(e,t,r){this.cm=r;var i=this.vert=n("div",[n("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=n("div",[n("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(i),e(o),Wa(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Wa(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,Zo&&Qo<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ja.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Ja.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},Ja.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},Ja.prototype.zeroWidthHack=function(){var e=ca&&!ia?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ya,this.disableVert=new ya},Ja.prototype.enableZeroWidthBar=function(e,t){function r(){var n=e.getBoundingClientRect();document.elementFromPoint(n.left+1,n.bottom-1)!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},Ja.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var el=function(){};el.prototype.update=function(){return{bottom:0,right:0}},el.prototype.setScrollLeft=function(){},el.prototype.setScrollTop=function(){},el.prototype.clear=function(){};var tl={native:Ja,null:el},rl=0,nl=function(e,t,r){var n=e.display;this.viewport=t,this.visible=Pr(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Rt(e),this.force=r,this.dims=br(e),this.events=[]};nl.prototype.signal=function(e,t){Ee(e,t)&&this.events.push(arguments)},nl.prototype.finish=function(){for(var e=this,t=0;t<this.events.length;t++)Ae.apply(null,e.events[t])};var il=function(e,t){this.ranges=e,this.primIndex=t};il.prototype.primary=function(){return this.ranges[this.primIndex]},il.prototype.equals=function(e){var t=this;if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var r=0;r<this.ranges.length;r++){var n=t.ranges[r],i=e.ranges[r];if(!q(n.anchor,i.anchor)||!q(n.head,i.head))return!1}return!0},il.prototype.deepCopy=function(){for(var e=this,t=[],r=0;r<this.ranges.length;r++)t[r]=new ol(P(e.ranges[r].anchor),P(e.ranges[r].head));return new il(t,this.primIndex)},il.prototype.somethingSelected=function(){for(var e=this,t=0;t<this.ranges.length;t++)if(!e.ranges[t].empty())return!0;return!1},il.prototype.contains=function(e,t){var r=this;t||(t=e);for(var n=0;n<this.ranges.length;n++){var i=r.ranges[n];if(D(t,i.from())>=0&&D(e,i.to())<=0)return n}return-1};var ol=function(e,t){this.anchor=e,this.head=t};ol.prototype.from=function(){return F(this.anchor,this.head)},ol.prototype.to=function(){return H(this.anchor,this.head)},ol.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};var al=function(e){var t=this;this.lines=e,this.parent=null;for(var r=0,n=0;n<e.length;++n)e[n].parent=t,r+=e[n].height;this.height=r};al.prototype.chunkSize=function(){return this.lines.length},al.prototype.removeInner=function(e,t){for(var r=this,n=e,i=e+t;n<i;++n){var o=r.lines[n];r.height-=o.height,ct(o),kt(o,"delete")}this.lines.splice(e,t)},al.prototype.collapse=function(e){e.push.apply(e,this.lines)},al.prototype.insertInner=function(e,t,r){var n=this;this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=n},al.prototype.iterN=function(e,t,r){for(var n=this,i=e+t;e<i;++e)if(r(n.lines[e]))return!0};var ll=function(e){var t=this;this.children=e;for(var r=0,n=0,i=0;i<e.length;++i){var o=e[i];r+=o.chunkSize(),n+=o.height,o.parent=t}this.size=r,this.height=n,this.parent=null};ll.prototype.chunkSize=function(){return this.size},ll.prototype.removeInner=function(e,t){var r=this;this.size-=t;for(var n=0;n<this.children.length;++n){var i=r.children[n],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e),l=i.height;if(i.removeInner(e,a),r.height-=l-i.height,o==a&&(r.children.splice(n--,1),i.parent=null),0==(t-=a))break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof al))){var s=[];this.collapse(s),this.children=[new al(s)],this.children[0].parent=this}},ll.prototype.collapse=function(e){for(var t=this,r=0;r<this.children.length;++r)t.children[r].collapse(e)},ll.prototype.insertInner=function(e,t,r){var n=this;this.size+=t.length,this.height+=r;for(var i=0;i<this.children.length;++i){var o=n.children[i],a=o.chunkSize();if(e<=a){if(o.insertInner(e,t,r),o.lines&&o.lines.length>50){for(var l=o.lines.length%25+25,s=l;s<o.lines.length;){var c=new al(o.lines.slice(s,s+=25));o.height-=c.height,n.children.splice(++i,0,c),c.parent=n}o.lines=o.lines.slice(0,l),n.maybeSpill()}break}e-=a}},ll.prototype.maybeSpill=function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new ll(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=f(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new ll(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},ll.prototype.iterN=function(e,t,r){for(var n=this,i=0;i<this.children.length;++i){var o=n.children[i],a=o.chunkSize();if(e<a){var l=Math.min(t,a-e);if(o.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=a}};var sl=function(e,t,r){var n=this;if(r)for(var i in r)r.hasOwnProperty(i)&&(n[i]=r[i]);this.doc=e,this.node=t};sl.prototype.clear=function(){var e=this,t=this.doc.cm,r=this.line.widgets,n=this.line,i=O(n);if(null!=i&&r){for(var o=0;o<r.length;++o)r[o]==e&&r.splice(o--,1);r.length||(n.widgets=null);var a=qt(this);A(n,Math.max(0,n.height-a)),t&&(un(t,function(){Ei(t,n,-a),mn(t,i,"widget")}),kt(t,"lineWidgetCleared",t,this,i))}},sl.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=qt(this)-t;i&&(A(n,n.height+i),r&&un(r,function(){r.curOp.forceUpdate=!0,Ei(r,n,i),kt(r,"lineWidgetChanged",r,e,O(n))}))},We(sl);var cl=0,ul=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++cl};ul.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp;if(r&&tn(t),Ee(this,"clear")){var n=this.find();n&&kt(this,"clear",n.from,n.to)}for(var i=null,o=null,a=0;a<this.lines.length;++a){var l=e.lines[a],s=G(l.markedSpans,e);t&&!e.collapsed?mn(t,O(l),"text"):t&&(null!=s.to&&(o=O(l)),null!=s.from&&(i=O(l))),l.markedSpans=X(l.markedSpans,s),null==s.from&&e.collapsed&&!ge(e.doc,l)&&t&&A(l,vr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var u=de(e.lines[c]),d=be(u);d>t.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=d,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&hn(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&mi(t.doc)),t&&kt(t,"markerCleared",t,this,i,o),r&&rn(t),this.parent&&this.parent.clear()}},ul.prototype.find=function(e,t){var r=this;null==e&&"bookmark"==this.type&&(e=1);for(var n,i,o=0;o<this.lines.length;++o){var a=r.lines[o],l=G(a.markedSpans,r);if(null!=l.from&&(n=I(t?a:O(a),l.from),e==-1))return n;if(null!=l.to&&(i=I(t?a:O(a),l.to),1==e))return i}return n&&{from:n,to:i}},ul.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&un(n,function(){var i=t.line,o=O(t.line),a=Xt(n,o);if(a&&(rr(a),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!ge(r.doc,i)&&null!=r.height){var l=r.height;r.height=null;var s=qt(r)-l;s&&A(i,i.height+s)}kt(n,"markerChanged",n,e)})},ul.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&f(t.maybeHiddenMarkers,this)!=-1||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ul.prototype.detachLine=function(e){if(this.lines.splice(f(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},We(ul);var dl=function(e,t){var r=this;this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=r};dl.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)e.markers[t].clear();kt(this,"clear")}},dl.prototype.find=function(e,t){return this.primary.find(e,t)},We(dl);var fl=0,pl=function(e,t,r,n,i){if(!(this instanceof pl))return new pl(e,t,r,n,i);null==r&&(r=0),ll.call(this,[new al([new Ua("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var o=I(r,0);this.sel=Nn(o),this.history=new Vn(null),this.id=++fl,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Bn(this,{from:o,to:o,text:e}),fi(this,Nn(o),ka)};pl.prototype=b(ll.prototype,{constructor:pl,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=z(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:pn(function(e){var t=I(this.first,0),r=this.first+this.size-1;_i(this,{from:t,to:I(r,T(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),fi(this,Nn(t))}),replaceRange:function(e,t,r,n){t=j(this,t),r=r?j(this,r):t,Mi(this,e,t,r,n)},getRange:function(e,t,r){var n=M(this,j(this,e),j(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(E(this,e))return T(this,e)},getLineNumber:function(e){return O(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=T(this,e)),de(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return j(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||e===!1?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:pn(function(e,t,r){ci(this,j(this,"number"==typeof e?I(e,t||0):e),null,r)}),setSelection:pn(function(e,t,r){ci(this,j(this,e),j(this,t||e),r)}),extendSelection:pn(function(e,t,r){ai(this,j(this,e),t&&j(this,t),r)}),extendSelections:pn(function(e,t){li(this,U(this,e),t)}),extendSelectionsBy:pn(function(e,t){li(this,U(this,g(this.sel.ranges,e)),t)}),setSelections:pn(function(e,t,r){var n=this;if(e.length){for(var i=[],o=0;o<e.length;o++)i[o]=new ol(j(n,e[o].anchor),j(n,e[o].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),fi(this,On(i,t),r)}}),addSelection:pn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new ol(j(this,e),j(this,t||e))),fi(this,On(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this,n=this.sel.ranges,i=0;i<n.length;i++){var o=M(r,n[i].from(),n[i].to());t=t?t.concat(o):o}return e===!1?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=this,r=[],n=this.sel.ranges,i=0;i<n.length;i++){var o=M(t,n[i].from(),n[i].to());e!==!1&&(o=o.join(e||t.lineSeparator())),r[i]=o}return r},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:pn(function(e,t,r){for(var n=this,i=[],o=this.sel,a=0;a<o.ranges.length;a++){var l=o.ranges[a];i[a]={from:l.from(),to:l.to(),text:n.splitLines(e[a]),origin:r}}for(var s=t&&"end"!=t&&qn(this,i,t),c=i.length-1;c>=0;c--)_i(n,i[c]);s?di(this,s):this.cm&&Jr(this.cm)}),undo:pn(function(){Ci(this,"undo")}),redo:pn(function(){Ci(this,"redo")}),undoSelection:pn(function(){Ci(this,"undo",!0)}),redoSelection:pn(function(){Ci(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Vn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ii(this.history.done),undone:ii(this.history.undone)}},setHistory:function(e){var t=this.history=new Vn(this.history.maxGeneration);t.done=ii(e.done.slice(0),null,!0),t.undone=ii(e.undone.slice(0),null,!0)},setGutterMarker:pn(function(e,t,r){return Ni(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&_(n)&&(e.gutterMarkers=null),!0})}),clearGutter:pn(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&Ni(t,r,"gutter",function(){return r.gutterMarkers[e]=null,_(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!E(this,e))return null;if(t=e,!(e=T(this,e)))return null}else if(null==(t=O(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:pn(function(t,r,n){return Ni(this,t,"gutter"==r?"gutter":"class",function(t){var i="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass";if(t[i]){if(e(n).test(t[i]))return!1;t[i]+=" "+n}else t[i]=n;return!0})}),removeLineClass:pn(function(t,r,n){return Ni(this,t,"gutter"==r?"gutter":"class",function(t){var i="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass",o=t[i];if(!o)return!1;if(null==n)t[i]=null;else{var a=o.match(e(n));if(!a)return!1;var l=a.index+a[0].length;t[i]=o.slice(0,a.index)+(a.index&&l!=o.length?" ":"")+o.slice(l)||null}return!0})}),addLineWidget:pn(function(e,t,r){return Wi(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Ii(this,j(this,e),j(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=j(this,e),Ii(this,e,e,r,"bookmark")},findMarksAt:function(e){e=j(this,e);var t=[],r=T(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=j(this,e),t=j(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+n;if(o>e)return t=e,!0;e-=o,++r}),j(this,I(r,t))},indexFromPos:function(e){e=j(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new pl(z(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new pl(z(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Pi(n,qi(this)),n},unlinkDoc:function(e){var t=this;if(e instanceof Lo&&(e=e.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=t.linked[r];if(n.doc==e){t.linked.splice(r,1),e.unlinkDoc(t),Hi(qi(t));break}}if(e.history==this.history){var i=[e.id];jn(e,function(e){return i.push(e.id)},!0),e.history=new Vn(null),e.history.done=ii(this.history.done,i),e.history.undone=ii(this.history.undone,i)}},iterLinkedDocs:function(e){jn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Da(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:pn(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Kn(this.cm))})}),pl.prototype.eachLine=pl.prototype.iter;for(var hl=0,ml=!1,gl={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",
|
5 |
+
63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},vl=0;vl<10;vl++)gl[vl+48]=gl[vl+96]=String(vl);for(var yl=65;yl<=90;yl++)gl[yl]=String.fromCharCode(yl);for(var bl=1;bl<=12;bl++)gl[bl+111]=gl[bl+63235]="F"+bl;var xl={};xl.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},xl.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},xl.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},xl.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},xl.default=ca?xl.macDefault:xl.pcDefault;var wl,_l,kl={selectAll:xi,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ka)},killLine:function(e){return eo(e,function(t){if(t.empty()){var r=T(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:I(t.head.line+1,0)}:{from:t.head,to:I(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return eo(e,function(t){return{from:I(t.from().line,0),to:j(e.doc,I(t.to().line+1,0))}})},delLineLeft:function(e){return eo(e,function(e){return{from:I(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return eo(e,function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}})},delWrappedLineRight:function(e){return eo(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(I(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(I(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return to(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return no(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return ro(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Sa)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Sa)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?no(e,t.head):n},Sa)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=d(e.getLine(o.line),o.ch,n);t.push(h(n-a%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return un(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=T(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new I(i.line,i.ch-1)),i.ch>0)i=new I(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),I(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=T(e.doc,i.line-1).text;a&&(i=new I(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),I(i.line-1,a.length-1),i,"+transpose"))}r.push(new ol(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return un(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Jr(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}},Cl=new ya,Sl=null,Ll={toString:function(){return"CodeMirror.Init"}},Tl={},Ml={};Lo.defaults=Tl,Lo.optionHandlers=Ml;var zl=[];Lo.defineInitHook=function(e){return zl.push(e)};var Al=null,Ol=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ya,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ol.prototype.init=function(e){function t(e){if(!Oe(i,e)){if(i.somethingSelected())zo({lineWise:!1,text:i.getSelections()}),"cut"==e.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var t=Eo(i);zo({lineWise:!0,text:t.text}),"cut"==e.type&&i.operation(function(){i.setSelections(t.ranges,0,ka),i.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var r=Al.text.join("\n");if(e.clipboardData.setData("Text",r),e.clipboardData.getData("Text")==r)return void e.preventDefault()}var a=Io(),l=a.firstChild;i.display.lineSpace.insertBefore(a,i.display.lineSpace.firstChild),l.value=Al.text.join("\n");var s=document.activeElement;va(l),setTimeout(function(){i.display.lineSpace.removeChild(a),s.focus(),s==o&&n.showPrimarySelection()},50)}}var r=this,n=this,i=n.cm,o=n.div=e.lineDiv;Wo(o,i.options.spellcheck),Wa(o,"paste",function(e){Oe(i,e)||Oo(e,i)||Qo<=11&&setTimeout(dn(i,function(){return r.updateFromDOM()}),20)}),Wa(o,"compositionstart",function(e){r.composing={data:e.data,done:!1}}),Wa(o,"compositionupdate",function(e){r.composing||(r.composing={data:e.data,done:!1})}),Wa(o,"compositionend",function(e){r.composing&&(e.data!=r.composing.data&&r.readFromDOMSoon(),r.composing.done=!0)}),Wa(o,"touchstart",function(){return n.forceCompositionEnd()}),Wa(o,"input",function(){r.composing||r.readFromDOMSoon()}),Wa(o,"copy",t),Wa(o,"cut",t)},Ol.prototype.prepareSelection=function(){var e=Lr(this.cm,!1);return e.focus=this.cm.state.focused,e},Ol.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Ol.prototype.showPrimarySelection=function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=jo(this.cm,e.anchorNode,e.anchorOffset),n=jo(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=D(F(r,n),t.from())||0!=D(H(r,n),t.to())){var i=Po(this.cm,t.from()),o=Po(this.cm,t.to());if(!i&&!o)return void e.removeAllRanges();var a=this.cm.display.view,l=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var s=a[a.length-1].measure,c=s.maps?s.maps[s.maps.length-1]:s.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};var u;try{u=pa(i.node,i.offset,o.offset,o.node)}catch(e){}u&&(!$o&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||(e.removeAllRanges(),e.addRange(u))):(e.removeAllRanges(),e.addRange(u)),l&&null==e.anchorNode?e.addRange(l):$o&&this.startGracePeriod()),this.rememberSelection()}},Ol.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Ol.prototype.showMultipleSelections=function(e){r(this.cm.display.cursorDiv,e.cursors),r(this.cm.display.selectionDiv,e.selection)},Ol.prototype.rememberSelection=function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ol.prototype.selectionInEditor=function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return o(this.div,t)},Ol.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ol.prototype.blur=function(){this.div.blur()},Ol.prototype.getField=function(){return this.div},Ol.prototype.supportsTouch=function(){return!0},Ol.prototype.receivedFocus=function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():un(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},Ol.prototype.selectionChanged=function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ol.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;if(la&&ta&&this.cm.options.gutters.length&&Ho(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=jo(t,e.anchorNode,e.anchorOffset),n=jo(t,e.focusNode,e.focusOffset);r&&n&&un(t,function(){fi(t.doc,Nn(r,n),ka),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},Ol.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(0==n.ch&&n.line>e.firstLine()&&(n=I(n.line-1,T(e.doc,n.line-1).length)),i.ch==T(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=I(i.line+1,0)),n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o,a,l;n.line==t.viewFrom||0==(o=Cr(e,n.line))?(a=O(t.view[0].line),l=t.view[0].node):(a=O(t.view[o].line),l=t.view[o-1].node.nextSibling);var s,c,u=Cr(e,i.line);if(u==t.view.length-1?(s=t.viewTo-1,c=t.lineDiv.lastChild):(s=O(t.view[u+1].line)-1,c=t.view[u+1].node.previousSibling),!l)return!1;for(var d=e.doc.splitLines(Bo(e,l,c,a,s)),f=M(e.doc,I(a,0),I(s,T(e.doc,s).text.length));d.length>1&&f.length>1;)if(m(d)==m(f))d.pop(),f.pop(),s--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),a++}for(var p=0,h=0,g=d[0],v=f[0],y=Math.min(g.length,v.length);p<y&&g.charCodeAt(p)==v.charCodeAt(p);)++p;for(var b=m(d),x=m(f),w=Math.min(b.length-(1==d.length?p:0),x.length-(1==f.length?p:0));h<w&&b.charCodeAt(b.length-h-1)==x.charCodeAt(x.length-h-1);)++h;if(1==d.length&&1==f.length&&a==n.line)for(;p&&p>n.ch&&b.charCodeAt(b.length-h-1)==x.charCodeAt(x.length-h-1);)p--,h++;d[d.length-1]=b.slice(0,b.length-h).replace(/^\u200b+/,""),d[0]=d[0].slice(p).replace(/\u200b+$/,"");var _=I(a,p),k=I(s,f.length?m(f).length-h:0);return d.length>1||d[0]||D(_,k)?(Mi(e.doc,d,_,k,"+input"),!0):void 0},Ol.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ol.prototype.reset=function(){this.forceCompositionEnd()},Ol.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ol.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Ol.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||un(this.cm,function(){return hn(e.cm)})},Ol.prototype.setUneditable=function(e){e.contentEditable="false"},Ol.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||dn(this.cm,Ao)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Ol.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Ol.prototype.onContextMenu=function(){},Ol.prototype.resetPosition=function(){},Ol.prototype.needsContentAttribute=!0;var Nl=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ya,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null};Nl.prototype.init=function(e){function t(e){if(!Oe(i,e)){if(i.somethingSelected())zo({lineWise:!1,text:i.getSelections()}),n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,a.value=Al.text.join("\n"),va(a));else{if(!i.options.lineWiseCopyCut)return;var t=Eo(i);zo({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,ka):(n.prevInput="",a.value=t.text.join("\n"),va(a))}"cut"==e.type&&(i.state.cutIncoming=!0)}}var r=this,n=this,i=this.cm,o=this.wrapper=Io(),a=this.textarea=o.firstChild;e.wrapper.insertBefore(o,e.wrapper.firstChild),aa&&(a.style.width="0px"),Wa(a,"input",function(){Zo&&Qo>=9&&r.hasSelection&&(r.hasSelection=null),n.poll()}),Wa(a,"paste",function(e){Oe(i,e)||Oo(e,i)||(i.state.pasteIncoming=!0,n.fastPoll())}),Wa(a,"cut",t),Wa(a,"copy",t),Wa(e.scroller,"paste",function(t){Pt(e,t)||Oe(i,t)||(i.state.pasteIncoming=!0,n.focus())}),Wa(e.lineSpace,"selectstart",function(t){Pt(e,t)||Ie(t)}),Wa(a,"compositionstart",function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Wa(a,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Nl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Lr(e);if(e.options.moveInputWithCursor){var i=ur(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},Nl.prototype.showSelection=function(e){var t=this.cm,n=t.display;r(n.cursorDiv,e.cursors),r(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Nl.prototype.reset=function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=Pa&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var a=t?"-":r||n.getSelection();this.textarea.value=a,n.state.focused&&va(this.textarea),Zo&&Qo>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",Zo&&Qo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},Nl.prototype.getField=function(){return this.textarea},Nl.prototype.supportsTouch=function(){return!1},Nl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!sa||a()!=this.textarea))try{this.textarea.focus()}catch(e){}},Nl.prototype.blur=function(){this.textarea.blur()},Nl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Nl.prototype.receivedFocus=function(){this.slowPoll()},Nl.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Nl.prototype.fastPoll=function(){function e(){r.poll()||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},Nl.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||qa(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(Zo&&Qo>=9&&this.hasSelection===i||ca&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(n.length,i.length);a<l&&n.charCodeAt(a)==i.charCodeAt(a);)++a;return un(t,function(){Ao(t,i.slice(a),n.length-a,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Nl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Nl.prototype.onKeyPress=function(){Zo&&Qo>=9&&(this.hasSelection=null),this.fastPoll()},Nl.prototype.onContextMenu=function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t=""+(e?a.value:"");a.value="⇚",a.value=t,n.prevInput=e?"":"",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.cssText=u,a.style.cssText=c,Zo&&Qo<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!Zo||Zo&&Qo<9)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&""==n.prevInput?dn(i,xi)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,a=n.textarea,l=kr(i,e),s=o.scroller.scrollTop;if(l&&!ra){i.options.resetSelectionOnContextMenu&&i.doc.sel.contains(l)==-1&&dn(i,fi)(i.doc,Nn(l),ka);var c=a.style.cssText,u=n.wrapper.style.cssText;n.wrapper.style.cssText="position: absolute";var d=n.wrapper.getBoundingClientRect();a.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(Zo?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(Jo&&(f=window.scrollY),o.input.focus(),Jo&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),Zo&&Qo>=9&&t(),ma){Pe(e);var p=function(){ze(window,"mouseup",p),setTimeout(r,20)};Wa(window,"mouseup",p)}else setTimeout(r,50)}},Nl.prototype.readOnlyChanged=function(e){e||this.reset()},Nl.prototype.setUneditable=function(){},Nl.prototype.needsContentAttribute=!1,function(e){function t(t,n,i,o){e.defaults[t]=n,i&&(r[t]=o?function(e,t,r){r!=Ll&&i(e,t,r)}:i)}var r=e.optionHandlers;e.defineOption=t,e.Init=Ll,t("value","",function(e,t){return e.setValue(t)},!0),t("mode",null,function(e,t){e.doc.modeOption=t,Pn(e)},!0),t("indentUnit",2,Pn,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){Hn(e),ir(e),hn(e)},!0),t("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(o==-1)break;i=o+t.length,r.push(I(n,o))}n++});for(var i=r.length-1;i>=0;i--)Mi(e.doc,t,r[i],I(r[i].line,r[i].ch+t.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=Ll&&e.refresh()}),t("specialCharPlaceholder",ft,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",sa?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),t("rtlMoveVisually",!da),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){_o(e),ko(e)},!0),t("keyMap","default",function(e,t,r){var n=Ji(t),i=r!=Ll&&Ji(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),t("extraKeys",null),t("lineWrapping",!1,So,!0),t("gutters",[],function(e){An(e.options),ko(e)},!0),t("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?xr(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return Kr(e)},!0),t("scrollbarStyle","native",function(e){$r(e),Kr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e){An(e.options),ko(e)},!0),t("firstLineNumber",1,ko,!0),t("lineNumberFormatter",function(e){return e},ko,!0),t("showCursorWhenSelecting",!1,Sr,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("readOnly",!1,function(e,t){"nocursor"==t?(Er(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),t("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),t("dragDrop",!0,Co),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,Sr,!0),t("singleCursorHeightPerLine",!0,Sr,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,Hn,!0),t("addModeClass",!1,Hn,!0),t("pollInterval",100),t("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,Hn,!0),t("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),t("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),t("autofocus",null),t("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(Lo),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&dn(this,t[e])(this,r,i),Ae(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Ji(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:fn(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");v(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},function(e){return e.priority}),this.state.modeGen++,hn(this)}),removeOverlay:fn(function(e){for(var t=this,r=this.state.overlays,n=0;n<r.length;++n){var i=r[n].modeSpec;if(i==e||"string"==typeof e&&i.name==e)return r.splice(n,1),t.state.modeGen++,void hn(t)}}),indentLine:fn(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),E(this.doc,e)&&Mo(this,e,t,r)}),indentSelection:fn(function(e){for(var t=this,r=this.doc.sel.ranges,n=-1,i=0;i<r.length;i++){var o=r[i];if(o.empty())o.head.line>n&&(Mo(t,o.head.line,e,!0),n=o.head.line,i==t.doc.sel.primIndex&&Jr(t));else{var a=o.from(),l=o.to(),s=Math.max(n,a.line);n=Math.min(t.lastLine(),l.line-(l.ch?0:1))+1;for(var c=s;c<n;++c)Mo(t,c,e);var u=t.doc.sel.ranges;0==a.ch&&r.length==u.length&&u[i].from().ch>0&&si(t.doc,i,new ol(a,u[i].to()),ka)}}}),getTokenAt:function(e,t){return it(this,e,t)},getLineTokens:function(e,t){return it(this,I(e),t,!0)},getTokenTypeAt:function(e){e=j(this.doc,e);var t,r=Je(this,T(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]<o)){t=r[2*a+2];break}n=a+1}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=this,i=[];if(!r.hasOwnProperty(t))return i;var o=r[t],a=this.getModeAt(e);if("string"==typeof a[t])o[a[t]]&&i.push(o[a[t]]);else if(a[t])for(var l=0;l<a[t].length;l++){var s=o[a[t][l]];s&&i.push(s)}else a.helperType&&o[a.helperType]?i.push(o[a.helperType]):o[a.name]&&i.push(o[a.name]);for(var c=0;c<o._global.length;c++){var u=o._global[c];u.pred(a,n)&&f(i,u.val)==-1&&i.push(u.val)}return i},getStateAfter:function(e,t){var r=this.doc;return e=B(r,null==e?r.first+r.size-1:e),et(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?j(this.doc,e):e?n.from():n.to(),ur(this,r,t||"page")},charCoords:function(e,t){return cr(this,j(this.doc,e),t||"page")},coordsChar:function(e,t){return e=sr(this,e,t||"page"),pr(this,e.left,e.top)},lineAtHeight:function(e,t){return e=sr(this,{top:e,left:0},t||"page").top,N(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=T(this.doc,e)}else n=e;return lr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-ye(n):0)},defaultTextHeight:function(){return vr(this.display)},defaultCharWidth:function(){return yr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=ur(this,j(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&Yr(this,{left:l,top:a,right:l+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:fn(co),triggerOnKeyPress:fn(po),triggerOnKeyUp:fo,execCommand:function(e){if(kl.hasOwnProperty(e))return kl[e].call(null,this)},triggerElectric:fn(function(e){No(this,e)}),findPosH:function(e,t,r,n){var i=this,o=1;t<0&&(o=-1,t=-t);for(var a=j(this.doc,e),l=0;l<t&&(a=Do(i.doc,a,o,r,n),!a.hitSide);++l);return a},moveH:fn(function(e,t){var r=this;this.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Do(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},Sa)}),deleteH:fn(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):eo(this,function(r){var i=Do(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=this,o=1,a=n;t<0&&(o=-1,t=-t);for(var l=j(this.doc,e),s=0;s<t;++s){var c=ur(i,l,"div");if(null==a?a=c.left:c.left=a,l=qo(i,c,o,r),l.hitSide)break}return l},moveV:fn(function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return e<0?a.from():a.to();var l=ur(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=qo(r,l,e,t);return"page"==t&&a==n.sel.primary()&&Qr(r,null,cr(r,s,"div").top-l.top),s},Sa),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(e){var t=this.doc,r=T(t,e.line).text,n=e.ch,i=e.ch;if(r){var o=this.getHelper(e,"wordChars");"before"!=e.sticky&&i!=r.length||!n?++i:--n;for(var a=r.charAt(n),l=w(a,o)?function(e){return w(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!w(e)};n>0&&l(r.charAt(n-1));)--n;for(;i<r.length&&l(r.charAt(i));)++i}return new ol(I(e.line,n),I(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?l(this.display.cursorDiv,"CodeMirror-overwrite"):ga(this.display.cursorDiv,"CodeMirror-overwrite"),Ae(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==a()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:fn(function(e,t){null==e&&null==t||en(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-jt(this)-this.display.barHeight,width:e.scrollWidth-jt(this)-this.display.barWidth,clientHeight:Ut(this),clientWidth:Rt(this)}},scrollIntoView:fn(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:I(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)en(this),this.curOp.scrollToPos=e;else{var r=Zr(this,{left:Math.min(e.from.left,e.to.left),top:Math.min(e.from.top,e.to.top)-e.margin,right:Math.max(e.from.right,e.to.right),bottom:Math.max(e.from.bottom,e.to.bottom)+e.margin});this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:fn(function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&nr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){mn(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,Ae(this,"refresh",this)}),operation:function(e){return un(this,e)},refresh:fn(function(){var e=this.display.cachedTextHeight;hn(this),this.curOp.forceUpdate=!0,ir(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),Tn(this),(null==e||Math.abs(e-vr(this.display))>.5)&&_r(this),Ae(this,"refresh",this)}),
|
6 |
+
swapDoc:fn(function(e){var t=this.doc;return t.cm=null,Rn(this,e),ir(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,kt(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},We(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})}}(Lo);var El="iter insert remove copy getEditor constructor".split(" ");for(var Wl in pl.prototype)pl.prototype.hasOwnProperty(Wl)&&f(El,Wl)<0&&(Lo.prototype[Wl]=function(e){return function(){return e.apply(this.doc,arguments)}}(pl.prototype[Wl]));return We(pl),Lo.inputStyles={textarea:Nl,contenteditable:Ol},Lo.defineMode=function(e){Lo.defaults.mode||"null"==e||(Lo.defaults.mode=e),Ue.apply(this,arguments)},Lo.defineMIME=Ke,Lo.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Lo.defineMIME("text/plain","null"),Lo.defineExtension=function(e,t){Lo.prototype[e]=t},Lo.defineDocExtension=function(e,t){pl.prototype[e]=t},Lo.fromTextArea=Uo,function(e){e.off=ze,e.on=Wa,e.wheelEventPixels=jr,e.Doc=pl,e.splitLines=Da,e.countColumn=d,e.findColumn=p,e.isWordChar=x,e.Pass=_a,e.signal=Ae,e.Line=Ua,e.changeEnd=En,e.scrollbarModel=tl,e.Pos=I,e.cmpPos=D,e.modes=Fa,e.mimeModes=Ba,e.resolveMode=Ve,e.getMode=$e,e.modeExtensions=ja,e.extendMode=Ge,e.copyState=Xe,e.startState=Ze,e.innerMode=Ye,e.commands=kl,e.keyMap=xl,e.keyName=Qi,e.isModifierKey=Zi,e.lookupKey=Yi,e.normalizeKeyMap=Xi,e.StringStream=Ra,e.SharedTextMarker=dl,e.TextMarker=ul,e.LineWidget=sl,e.e_preventDefault=Ie,e.e_stopPropagation=De,e.e_stop=Pe,e.addClass=l,e.contains=o,e.rmClass=ga,e.keyNames=gl}(Lo),Lo.version="5.25.0",Lo}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(n,i){function o(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(s("atom","]]>")):null:e.match("--")?r(s("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=s("meta","?>"),"meta"):(L=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==n){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=o,L=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return L="equals",null;if("<"==r){t.tokenize=o,t.state=p,t.tagName=t.tagStart=null;var n=t.tokenize(e,t);return n?n+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=l(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function l(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function s(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){n.tokenize=o;break}r.next()}return e}}function c(e){return function(t,r){for(var n;null!=(n=t.next());){if("<"==n)return r.tokenize=c(e+1),r.tokenize(t,r);if(">"==n){if(1==e){r.tokenize=o;break}return r.tokenize=c(e-1),r.tokenize(t,r)}}return"meta"}}function u(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(k.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function d(e){e.context&&(e.context=e.context.prev)}function f(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!k.contextGrabbers.hasOwnProperty(r)||!k.contextGrabbers[r].hasOwnProperty(t))return;d(e)}}function p(e,t,r){return"openTag"==e?(r.tagStart=t.column(),h):"closeTag"==e?m:p}function h(e,t,r){return"word"==e?(r.tagName=t.current(),T="tag",y):(T="error",h)}function m(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&k.implicitlyClosed.hasOwnProperty(r.context.tagName)&&d(r),r.context&&r.context.tagName==n||k.matchClosing===!1?(T="tag",g):(T="tag error",v)}return T="error",v}function g(e,t,r){return"endTag"!=e?(T="error",g):(d(r),p)}function v(e,t,r){return T="error",g(e,t,r)}function y(e,t,r){if("word"==e)return T="attribute",b;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||k.autoSelfClosers.hasOwnProperty(n)?f(r,n):(f(r,n),r.context=new u(r,n,i==r.indented)),p}return T="error",y}function b(e,t,r){return"equals"==e?x:(k.allowMissing||(T="error"),y(e,t,r))}function x(e,t,r){return"string"==e?w:"word"==e&&k.allowUnquoted?(T="string",y):(T="error",y(e,t,r))}function w(e,t,r){return"string"==e?w:y(e,t,r)}var _=n.indentUnit,k={},C=i.htmlMode?t:r;for(var S in C)k[S]=C[S];for(var S in i)k[S]=i[S];var L,T;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:p,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;L=null;var r=t.tokenize(e,t);return(r||L)&&"comment"!=r&&(T=null,t.state=t.state(L||r,e,t),T&&(r="error"==T?r+" error":T)),r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+_;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return k.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+_*(k.multilineTagIndentFactor||1);if(k.alignCDATA&&/<!\[CDATA\[/.test(r))return 0;var l=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(l&&l[1])for(;i;){if(i.tagName==l[2]){i=i.prev;break}if(!k.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(l)for(;i;){var s=k.contextGrabbers[i.tagName];if(!s||!s.hasOwnProperty(l[2]))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+_:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:k.htmlMode?"html":"xml",helperType:k.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){return/^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}e.defineMode("javascript",function(r,n){function i(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function o(e,t,r){return Se=e,Le=r,t}function a(e,r){var n=e.next();if('"'==n||"'"==n)return r.tokenize=l(n),r.tokenize(e,r);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return o("number","number");if("."==n&&e.match(".."))return o("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return o(n);if("="==n&&e.eat(">"))return o("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),o("number","number");if("0"==n&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),o("number","number");if("0"==n&&e.eat(/b/i))return e.eatWhile(/[01]/i),o("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),o("number","number");if("/"==n)return e.eat("*")?(r.tokenize=s,s(e,r)):e.eat("/")?(e.skipToEnd(),o("comment","comment")):t(e,r,1)?(i(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),o("regexp","string-2")):(e.eatWhile(We),o("operator","operator",e.current()));if("`"==n)return r.tokenize=c,c(e,r);if("#"==n)return e.skipToEnd(),o("error","error");if(We.test(n))return">"==n&&r.lexical&&">"==r.lexical.type||e.eatWhile(We),o("operator","operator",e.current());if(Ne.test(n)){e.eatWhile(Ne);var a=e.current(),u=Ee.propertyIsEnumerable(a)&&Ee[a];return u&&"."!=r.lastType?o(u.type,u.style,a):o("variable","variable",a)}}function l(e){return function(t,r){var n,i=!1;if(ze&&"@"==t.peek()&&t.match(Ie))return r.tokenize=a,o("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.tokenize=a),o("string","string")}}function s(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=a;break}n="*"==r}return o("comment","comment")}function c(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=a;break}n=!n&&"\\"==r}return o("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if(Oe){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var i=0,o=!1,a=r-1;a>=0;--a){var l=e.string.charAt(a),s=De.indexOf(l);if(s>=0&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(s>=3&&s<6)++i;else if(Ne.test(l))o=!0;else{if(/["'\/]/.test(l))return;if(o&&!i){++a;break}}}o&&!i&&(t.fatArrowAt=a)}}function d(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function f(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function p(e,t,r,n,i){var o=e.cc;for(Pe.state=e,Pe.stream=i,Pe.marked=null,Pe.cc=o,Pe.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){if((o.length?o.pop():Ae?k:_)(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Pe.marked?Pe.marked:"variable"==r&&f(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Pe.cc.push(arguments[e])}function m(){return h.apply(null,arguments),!0}function g(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var r=Pe.state;if(Pe.marked="def",r.context){if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function v(){Pe.state.context={prev:Pe.state.context,vars:Pe.state.localVars},Pe.state.localVars=He}function y(){Pe.state.localVars=Pe.state.context.vars,Pe.state.context=Pe.state.context.prev}function b(e,t){var r=function(){var r=Pe.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new d(n,Pe.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function x(){var e=Pe.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function w(e){function t(r){return r==e?m():";"==e?h():m(t)}return t}function _(e,t){return"var"==e?m(b("vardef",t.length),Q,w(";"),x):"keyword a"==e?m(b("form"),S,_,x):"keyword b"==e?m(b("form"),_,x):"{"==e?m(b("}"),K,x):";"==e?m():"if"==e?("else"==Pe.state.lexical.info&&Pe.state.cc[Pe.state.cc.length-1]==x&&Pe.state.cc.pop()(),m(b("form"),S,_,x,ne)):"function"==e?m(ce):"for"==e?m(b("form"),ie,_,x):"variable"==e?m(b("stat"),P):"switch"==e?m(b("form"),S,b("}","switch"),w("{"),K,x,x):"case"==e?m(k,w(":")):"default"==e?m(w(":")):"catch"==e?m(b("form"),v,w("("),ue,w(")"),_,x,y):"class"==e?m(b("form"),fe,x):"export"==e?m(b("stat"),ge,x):"import"==e?m(b("stat"),ye,x):"module"==e?m(b("form"),J,b("}"),w("{"),K,x,x):"type"==e?m($,w("operator"),$,w(";")):"async"==e?m(_):h(b("stat"),k,w(";"),x)}function k(e){return L(e,!1)}function C(e){return L(e,!0)}function S(e){return"("!=e?h():m(b(")"),k,w(")"),x)}function L(e,t){if(Pe.state.fatArrowAt==Pe.stream.start){var r=t?W:E;if("("==e)return m(v,b(")"),R(J,")"),x,w("=>"),r,y);if("variable"==e)return h(v,J,w("=>"),r,y)}var n=t?A:z;return qe.hasOwnProperty(e)?m(n):"function"==e?m(ce,n):"class"==e?m(b("form"),de,x):"keyword c"==e||"async"==e?m(t?M:T):"("==e?m(b(")"),T,w(")"),x,n):"operator"==e||"spread"==e?m(t?C:k):"["==e?m(b("]"),ke,x,n):"{"==e?U(F,"}",null,n):"quasi"==e?h(O,n):"new"==e?m(I(t)):m()}function T(e){return e.match(/[;\}\)\],]/)?h():h(k)}function M(e){return e.match(/[;\}\)\],]/)?h():h(C)}function z(e,t){return","==e?m(k):A(e,t,!1)}function A(e,t,r){var n=0==r?z:A,i=0==r?k:C;return"=>"==e?m(v,r?W:E,y):"operator"==e?/\+\+|--/.test(t)?m(n):"?"==t?m(k,w(":"),i):m(i):"quasi"==e?h(O,n):";"!=e?"("==e?U(C,")","call",n):"."==e?m(H,n):"["==e?m(b("]"),T,w("]"),x,n):void 0:void 0}function O(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?m(O):m(k,N)}function N(e){if("}"==e)return Pe.marked="string-2",Pe.state.tokenize=c,m(O)}function E(e){return u(Pe.stream,Pe.state),h("{"==e?_:k)}function W(e){return u(Pe.stream,Pe.state),h("{"==e?_:C)}function I(e){return function(t){return"."==t?m(e?q:D):h(e?C:k)}}function D(e,t){if("target"==t)return Pe.marked="keyword",m(z)}function q(e,t){if("target"==t)return Pe.marked="keyword",m(A)}function P(e){return":"==e?m(x,_):h(z,w(";"),x)}function H(e){if("variable"==e)return Pe.marked="property",m()}function F(e,t){return"async"==e?(Pe.marked="property",m(F)):"variable"==e||"keyword"==Pe.style?(Pe.marked="property",m("get"==t||"set"==t?B:j)):"number"==e||"string"==e?(Pe.marked=ze?"property":Pe.style+" property",m(j)):"jsonld-keyword"==e?m(j):"modifier"==e?m(F):"["==e?m(k,w("]"),j):"spread"==e?m(k):":"==e?h(j):void 0}function B(e){return"variable"!=e?h(j):(Pe.marked="property",m(ce))}function j(e){return":"==e?m(C):"("==e?h(ce):void 0}function R(e,t,r){function n(i,o){if(r?r.indexOf(i)>-1:","==i){var a=Pe.state.lexical;return"call"==a.info&&(a.pos=(a.pos||0)+1),m(function(r,n){return r==t||n==t?h():h(e)},n)}return i==t||o==t?m():m(w(t))}return function(r,i){return r==t||i==t?m():h(e,n)}}function U(e,t,r){for(var n=3;n<arguments.length;n++)Pe.cc.push(arguments[n]);return m(b(t,r),R(e,t),x)}function K(e){return"}"==e?m():h(_,K)}function V(e,t){if(Oe){if(":"==e)return m($);if("?"==t)return m(V)}}function $(e){return"variable"==e?(Pe.marked="variable-3",m(Z)):"string"==e||"number"==e||"atom"==e?m(Z):"{"==e?m(b("}"),R(X,"}",",;"),x):"("==e?m(R(Y,")"),G):void 0}function G(e){if("=>"==e)return m($)}function X(e,t){return"variable"==e||"keyword"==Pe.style?(Pe.marked="property",m(X)):"?"==t?m(X):":"==e?m($):void 0}function Y(e){return"variable"==e?m(Y):":"==e?m($):void 0}function Z(e,t){return"<"==t?m(b(">"),R($,">"),x,Z):"|"==t||"."==e?m($):"["==e?m(w("]"),Z):void 0}function Q(){return h(J,V,te,re)}function J(e,t){return"modifier"==e?m(J):"variable"==e?(g(t),m()):"spread"==e?m(J):"["==e?U(J,"]"):"{"==e?U(ee,"}"):void 0}function ee(e,t){return"variable"!=e||Pe.stream.match(/^\s*:/,!1)?("variable"==e&&(Pe.marked="property"),"spread"==e?m(J):"}"==e?h():m(w(":"),J,te)):(g(t),m(te))}function te(e,t){if("="==t)return m(C)}function re(e){if(","==e)return m(Q)}function ne(e,t){if("keyword b"==e&&"else"==t)return m(b("form","else"),_,x)}function ie(e){if("("==e)return m(b(")"),oe,w(")"),x)}function oe(e){return"var"==e?m(Q,w(";"),le):";"==e?m(le):"variable"==e?m(ae):h(k,w(";"),le)}function ae(e,t){return"in"==t||"of"==t?(Pe.marked="keyword",m(k)):m(z,le)}function le(e,t){return";"==e?m(se):"in"==t||"of"==t?(Pe.marked="keyword",m(k)):h(k,w(";"),se)}function se(e){")"!=e&&m(k)}function ce(e,t){return"*"==t?(Pe.marked="keyword",m(ce)):"variable"==e?(g(t),m(ce)):"("==e?m(v,b(")"),R(ue,")"),x,V,_,y):void 0}function ue(e){return"spread"==e?m(ue):h(J,V,te)}function de(e,t){return"variable"==e?fe(e,t):pe(e,t)}function fe(e,t){if("variable"==e)return g(t),m(pe)}function pe(e,t){return"<"==t?m(b(">"),R($,">"),x,pe):"extends"==t||"implements"==t||Oe&&","==e?m(Oe?$:k,pe):"{"==e?m(b("}"),he,x):void 0}function he(e,t){return"variable"==e||"keyword"==Pe.style?("async"==t||"static"==t||"get"==t||"set"==t||Oe&&("public"==t||"private"==t||"protected"==t||"readonly"==t||"abstract"==t))&&Pe.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(Pe.marked="keyword",m(he)):(Pe.marked="property",m(Oe?me:ce,he)):"["==e?m(k,w("]"),Oe?me:ce,he):"*"==t?(Pe.marked="keyword",m(he)):";"==e?m(he):"}"==e?m():void 0}function me(e,t){return"?"==t?m(me):":"==e?m($,te):"="==t?m(C):h(ce)}function ge(e,t){return"*"==t?(Pe.marked="keyword",m(_e,w(";"))):"default"==t?(Pe.marked="keyword",m(k,w(";"))):"{"==e?m(R(ve,"}"),_e,w(";")):h(_)}function ve(e,t){return"as"==t?(Pe.marked="keyword",m(w("variable"))):"variable"==e?h(C,ve):void 0}function ye(e){return"string"==e?m():h(be,xe,_e)}function be(e,t){return"{"==e?U(be,"}"):("variable"==e&&g(t),"*"==t&&(Pe.marked="keyword"),m(we))}function xe(e){if(","==e)return m(be,xe)}function we(e,t){if("as"==t)return Pe.marked="keyword",m(be)}function _e(e,t){if("from"==t)return Pe.marked="keyword",m(k)}function ke(e){return"]"==e?m():h(R(C,"]"))}function Ce(e,t){return"operator"==e.lastType||","==e.lastType||We.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var Se,Le,Te=r.indentUnit,Me=n.statementIndent,ze=n.jsonld,Ae=n.json||ze,Oe=n.typescript,Ne=n.wordCharacters||/[\w$\xa1-\uffff]/,Ee=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:n,break:n,continue:n,new:e("new"),delete:n,throw:n,debugger:n,var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:i,typeof:i,instanceof:i,true:o,false:o,null:o,undefined:o,NaN:o,Infinity:o,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n,async:e("async")};if(Oe){var l={type:"variable",style:"variable-3"},s={interface:e("class"),implements:n,namespace:n,module:e("module"),enum:e("module"),type:e("type"),public:e("modifier"),private:e("modifier"),protected:e("modifier"),abstract:e("modifier"),as:i,string:l,number:l,boolean:l,any:l};for(var c in s)a[c]=s[c]}return a}(),We=/[+\-*&%=<>!?|~^]/,Ie=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,De="([{}])",qe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0},Pe={state:null,column:null,marked:null,cc:null},He={name:"this",next:{name:"arguments"}};return x.lex=!0,{startState:function(e){var t={tokenize:a,lastType:"sof",cc:[],lexical:new d((e||0)-Te,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=s&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==Se?r:(t.lastType="operator"!=Se||"++"!=Le&&"--"!=Le?Se:"incdec",p(t,r,Se,Le,e))},indent:function(t,r){if(t.tokenize==s)return e.Pass;if(t.tokenize!=a)return 0;var i,o=r&&r.charAt(0),l=t.lexical;if(!/^\s*else\b/.test(r))for(var c=t.cc.length-1;c>=0;--c){var u=t.cc[c];if(u==x)l=l.prev;else if(u!=ne)break}for(;("stat"==l.type||"form"==l.type)&&("}"==o||(i=t.cc[t.cc.length-1])&&(i==z||i==A)&&!/^[,\.=+\-*:?[\(]/.test(r));)l=l.prev;Me&&")"==l.type&&"stat"==l.prev.type&&(l=l.prev);var d=l.type,f=o==d;return"vardef"==d?l.indented+("operator"==t.lastType||","==t.lastType?l.info+1:0):"form"==d&&"{"==o?l.indented:"form"==d?l.indented+Te:"stat"==d?l.indented+(Ce(t,r)?Me||Te:0):"switch"!=l.info||f||0==n.doubleIndentSwitch?l.align?l.column+(f?0:1):l.indented+(f?0:Te):l.indented+(/^(?:case|default)\b/.test(r)?Te:2*Te)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ae?null:"/*",blockCommentEnd:Ae?null:"*/",lineComment:Ae?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ae?"json":"javascript",jsonldMode:ze,jsonMode:Ae,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=k&&t!=C||e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r<e.length;++r)t[e[r].toLowerCase()]=!0;return t}function r(e,t){for(var r,n=!1;null!=(r=e.next());){if(n&&"/"==r){t.tokenize=null;break}n="*"==r}return["comment","comment"]}e.defineMode("css",function(t,r){function n(e,t){return h=t,e}function i(e,t){var r=e.next();if(v[r]){var i=v[r](e,t);if(i!==!1)return i}return"@"==r?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?n(null,"compare"):'"'==r||"'"==r?(t.tokenize=o(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==r?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),n("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match(/rl(-prefix)?\(/)||"d"==r&&e.match("omain(")||"r"==r&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):e.match(/^\w+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),n(null,"(")}function l(e,t,r){this.type=e,this.indent=t,this.prev=r}function s(e,t,r,n){return e.context=new l(r,t.indentation()+(n===!1?0:g),e.context),r}function c(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function u(e,t,r){return O[r.context.type](e,t,r)}function d(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return u(e,t,r)}function f(e){var t=e.current().toLowerCase();m=T.hasOwnProperty(t)?"atom":L.hasOwnProperty(t)?"keyword":"variable"}var p=r.inline;r.propertyKeywords||(r=e.resolveMode("text/css"));var h,m,g=t.indentUnit,v=r.tokenHooks,y=r.documentTypes||{},b=r.mediaTypes||{},x=r.mediaFeatures||{},w=r.mediaValueKeywords||{},_=r.propertyKeywords||{},k=r.nonStandardPropertyKeywords||{},C=r.fontProperties||{},S=r.counterDescriptors||{},L=r.colorKeywords||{},T=r.valueKeywords||{},M=r.allowNested,z=r.lineComment,A=r.supportsAtComponent===!0,O={};return O.top=function(e,t,r){if("{"==e)return s(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(A&&/@component/.test(e))return s(r,t,"atComponentBlock");if(/^@(-moz-)?document$/.test(e))return s(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(e))return s(r,t,"atBlock");if(/^@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return s(r,t,"at");if("hash"==e)m="builtin";else if("word"==e)m="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(r,t,"interpolation");if(":"==e)return"pseudo";if(M&&"("==e)return s(r,t,"parens")}return r.context.type},O.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return _.hasOwnProperty(n)?(m="property","maybeprop"):k.hasOwnProperty(n)?(m="string-2","maybeprop"):M?(m=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(m+=" error","maybeprop")}return"meta"==e?"block":M||"hash"!=e&&"qualifier"!=e?O.top(e,t,r):(m="error","block")},O.maybeprop=function(e,t,r){return":"==e?s(r,t,"prop"):u(e,t,r)},O.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&M)return s(r,t,"propBlock");if("}"==e||"{"==e)return d(e,t,r);if("("==e)return s(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)f(t);else if("interpolation"==e)return s(r,t,"interpolation")}else m+=" error";return"prop"},O.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(m="property","maybeprop"):r.context.type},O.parens=function(e,t,r){return"{"==e||"}"==e?d(e,t,r):")"==e?c(r):"("==e?s(r,t,"parens"):"interpolation"==e?s(r,t,"interpolation"):("word"==e&&f(t),"parens")},O.pseudo=function(e,t,r){return"meta"==e?"pseudo":"word"==e?(m="variable-3",r.context.type):u(e,t,r)},O.documentTypes=function(e,t,r){return"word"==e&&y.hasOwnProperty(t.current())?(m="tag",r.context.type):O.atBlock(e,t,r)},O.atBlock=function(e,t,r){if("("==e)return s(r,t,"atBlock_parens");if("}"==e||";"==e)return d(e,t,r);if("{"==e)return c(r)&&s(r,t,M?"block":"top");if("interpolation"==e)return s(r,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();m="only"==n||"not"==n||"and"==n||"or"==n?"keyword":b.hasOwnProperty(n)?"attribute":x.hasOwnProperty(n)?"property":w.hasOwnProperty(n)?"keyword":_.hasOwnProperty(n)?"property":k.hasOwnProperty(n)?"string-2":T.hasOwnProperty(n)?"atom":L.hasOwnProperty(n)?"keyword":"error"}return r.context.type},O.atComponentBlock=function(e,t,r){return"}"==e?d(e,t,r):"{"==e?c(r)&&s(r,t,M?"block":"top",!1):("word"==e&&(m="error"),r.context.type)},O.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?d(e,t,r,2):O.atBlock(e,t,r)},O.restricted_atBlock_before=function(e,t,r){return"{"==e?s(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(m="variable","restricted_atBlock_before"):u(e,t,r)},O.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(m="@font-face"==r.stateArg&&!C.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!S.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},O.keyframes=function(e,t,r){return"word"==e?(m="variable","keyframes"):"{"==e?s(r,t,"top"):u(e,t,r)},O.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?d(e,t,r):("word"==e?m="tag":"hash"==e&&(m="builtin"),"at")},O.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?d(e,t,r):("word"==e?m="variable":"variable"!=e&&"("!=e&&")"!=e&&(m="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:p?"block":"top",stateArg:null,context:new l(p?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(h=r[1],r=r[0]),m=r,t.state=O[t.state](h,e,t),m},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=n&&")"!=n||(r=r.prev),r.prev&&("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"!=n||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"atBlock"!=r.type)||(i=Math.max(0,r.indent-g),r=r.prev):(r=r.prev,i=r.indent)),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:z,fold:"brace"}})
|
7 |
+
;var n=["domain","regexp","url","url-prefix"],i=t(n),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],a=t(o),l=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],s=t(l),c=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],u=t(c),d=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],f=t(d),p=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],h=t(p),m=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],g=t(m),v=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=t(v),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],x=t(b),w=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],_=t(w),k=n.concat(o).concat(l).concat(c).concat(d).concat(p).concat(b).concat(w);e.registerHelper("hintWords","css",k),e.defineMIME("text/css",{documentTypes:i,mediaTypes:a,mediaFeatures:s,mediaValueKeywords:u,propertyKeywords:f,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:x,valueKeywords:_,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=r,r(e,t))}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:a,mediaFeatures:s,mediaValueKeywords:u,propertyKeywords:f,nonStandardPropertyKeywords:h,colorKeywords:x,valueKeywords:_,fontProperties:g,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/)&&[null,"{"]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:a,mediaFeatures:s,mediaValueKeywords:u,propertyKeywords:f,nonStandardPropertyKeywords:h,colorKeywords:x,valueKeywords:_,fontProperties:g,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:i,mediaTypes:a,mediaFeatures:s,propertyKeywords:f,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:x,valueKeywords:_,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=r,r(e,t))}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){var n=e.current(),i=n.search(t);return i>-1?e.backUp(n.length-i):n.match(/<\/?$/)&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function r(e){var t=s[e];return t?t:s[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function n(e,t){var n=e.match(r(t));return n?/^\s*(.*?)\s*$/.exec(n[2])[1]:""}function i(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function o(e,t){for(var r in e)for(var n=t[r]||(t[r]=[]),i=e[r],o=i.length-1;o>=0;o--)n.unshift(i[o])}function a(e,t){for(var r=0;r<e.length;r++){var i=e[r];if(!i[0]||i[1].test(n(t,i[0])))return i[2]}}var l={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},s={};e.defineMode("htmlmixed",function(r,n){function s(n,o){var l,d=c.token(n,o.htmlState),f=/\btag\b/.test(d);if(f&&!/[<>\s\/]/.test(n.current())&&(l=o.htmlState.tagName&&o.htmlState.tagName.toLowerCase())&&u.hasOwnProperty(l))o.inTag=l+" ";else if(o.inTag&&f&&/>$/.test(n.current())){var p=/^([\S]+) (.*)/.exec(o.inTag);o.inTag=null;var h=">"==n.current()&&a(u[p[1]],p[2]),m=e.getMode(r,h),g=i(p[1],!0),v=i(p[1],!1);o.token=function(e,r){return e.match(g,!1)?(r.token=s,r.localState=r.localMode=null,null):t(e,v,r.localMode.token(e,r.localState))},o.localMode=m,o.localState=e.startState(m,c.indent(o.htmlState,""))}else o.inTag&&(o.inTag+=n.current(),n.eol()&&(o.inTag+=" "));return d}var c=e.getMode(r,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),u={},d=n&&n.tags,f=n&&n.scriptTypes;if(o(l,u),d&&o(d,u),f)for(var p=f.length-1;p>=0;p--)u.script.unshift(["type",f[p].matches,f[p].mode]);return{startState:function(){return{token:s,inTag:null,localMode:null,localState:null,htmlState:e.startState(c)}},copyState:function(t){var r;return t.localState&&(r=e.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:r,htmlState:e.copyState(c,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?c.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||c}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.info=n,this.align=i,this.prev=o}function r(e,r,n,i){var o=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=n&&(o=e.context.indented),e.context=new t(o,r,n,i,null,e.context)}function n(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function i(e,t,r){return"variable"==t.prevToken||"variable-3"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,r))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function o(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function a(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function l(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}function s(e,t){if(!t.startOfLine)return!1;for(var r,n=null;r=e.peek();){if("\\"==r&&e.match(/^.$/)){n=s;break}if("/"==r&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=n,"meta"}function c(e,t){return"variable-3"==t.prevToken&&"variable-3"}function u(e){return e.eatWhile(/[\w\.']/),"number"}function d(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var r=e.match(/"([^\s\\()]{0,16})\(/);return!!r&&(t.cpp11RawStringDelim=r[1],t.tokenize=h,h(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function f(e){var t=/(\w+)::(\w+)$/.exec(e);return t&&t[1]==t[2]}function p(e,t){for(var r;null!=(r=e.next());)if('"'==r&&!e.eat('"')){t.tokenize=null;break}return"string"}function h(e,t){var r=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+r+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function m(t,r){function n(e){if(e)for(var t in e)e.hasOwnProperty(t)&&i.push(t)}"string"==typeof t&&(t=[t]);var i=[];n(r.keywords),n(r.types),n(r.builtin),n(r.atoms),i.length&&(r.helperType=t[0],e.registerHelper("hintWords",t[0],i));for(var o=0;o<t.length;++o)e.defineMIME(t[o],r)}function g(e,t){for(var r=!1;!e.eol();){if(!r&&e.match('"""')){t.tokenize=null;break}r="\\"==e.next()&&!r}return"string"}function v(e){return function(t,r){for(var n,i=!1,o=!1;!t.eol();){if(!e&&!i&&t.match('"')){o=!0;break}if(e&&t.match('"""')){o=!0;break}n=t.next(),!i&&"$"==n&&t.match("{")&&t.skipTo("}"),i=!i&&"\\"==n&&!e}return!o&&e||(r.tokenize=null),"string"}}function y(e){return function(t,r){for(var n,i=!1,o=!1;!t.eol();){if(!i&&t.match('"')&&("single"==e||t.match('""'))){o=!0;break}if(!i&&t.match("``")){w=y(e),o=!0;break}n=t.next(),i="single"==e&&!i&&"\\"==n}return o&&(r.tokenize=null),"string"}}e.defineMode("clike",function(a,s){function c(e,t){var r=e.next();if(C[r]){var n=C[r](e,t);if(n!==!1)return n}if('"'==r||"'"==r)return t.tokenize=u(r),t.tokenize(e,t);if(z.test(r))return p=r,null;if(A.test(r)){if(e.backUp(1),e.match(O))return"number";e.next()}if("/"==r){if(e.eat("*"))return t.tokenize=d,d(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(N.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(N););return"operator"}if(e.eatWhile(/[\w\$_\xa1-\uffff]/),M)for(;e.match(M);)e.eatWhile(/[\w\$_\xa1-\uffff]/);var i=e.current();return l(y,i)?(l(w,i)&&(p="newstatement"),l(_,i)&&(h=!0),"keyword"):l(b,i)?"variable-3":l(x,i)?(l(w,i)&&(p="newstatement"),"builtin"):l(k,i)?"atom":"variable"}function u(e){return function(t,r){for(var n,i=!1,o=!1;null!=(n=t.next());){if(n==e&&!i){o=!0;break}i=!i&&"\\"==n}return(o||!i&&!S)&&(r.tokenize=null),"string"}}function d(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=null;break}n="*"==r}return"comment"}function f(e,t){s.typeFirstDefinitions&&e.eol()&&o(t.context)&&(t.typeAtEndOfLine=i(e,t,e.pos))}var p,h,m=a.indentUnit,g=s.statementIndentUnit||m,v=s.dontAlignCalls,y=s.keywords||{},b=s.types||{},x=s.builtin||{},w=s.blockKeywords||{},_=s.defKeywords||{},k=s.atoms||{},C=s.hooks||{},S=s.multiLineStrings,L=s.indentStatements!==!1,T=s.indentSwitch!==!1,M=s.namespaceSeparator,z=s.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,A=s.numberStart||/[\d\.]/,O=s.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,N=s.isOperatorChar||/[+\-*&%=<>!?|\/]/;return{startState:function(e){return{tokenize:null,context:new t((e||0)-m,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var a=t.context;if(e.sol()&&(null==a.align&&(a.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return f(e,t),null;p=h=null;var l=(t.tokenize||c)(e,t);if("comment"==l||"meta"==l)return l;if(null==a.align&&(a.align=!0),";"==p||":"==p||","==p&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)n(t);else if("{"==p)r(t,e.column(),"}");else if("["==p)r(t,e.column(),"]");else if("("==p)r(t,e.column(),")");else if("}"==p){for(;"statement"==a.type;)a=n(t);for("}"==a.type&&(a=n(t));"statement"==a.type;)a=n(t)}else p==a.type?n(t):L&&(("}"==a.type||"top"==a.type)&&";"!=p||"statement"==a.type&&"newstatement"==p)&&r(t,e.column(),"statement",e.current());if("variable"==l&&("def"==t.prevToken||s.typeFirstDefinitions&&i(e,t,e.start)&&o(t.context)&&e.match(/^\s*\(/,!1))&&(l="def"),C.token){var u=C.token(e,t,l);void 0!==u&&(l=u)}return"def"==l&&s.styleDefs===!1&&(l="variable"),t.startOfLine=!1,t.prevToken=h?"def":l||p,f(e,t),l},indent:function(t,r){if(t.tokenize!=c&&null!=t.tokenize||t.typeAtEndOfLine)return e.Pass;var n=t.context,i=r&&r.charAt(0);if("statement"==n.type&&"}"==i&&(n=n.prev),s.dontIndentStatements)for(;"statement"==n.type&&s.dontIndentStatements.test(n.info);)n=n.prev;if(C.indent){var o=C.indent(t,n,r);if("number"==typeof o)return o}var a=i==n.type,l=n.prev&&"switch"==n.prev.info;if(s.allmanIndentation&&/[{(]/.test(i)){for(;"top"!=n.type&&"}"!=n.type;)n=n.prev;return n.indented}return"statement"==n.type?n.indented+("{"==i?0:g):!n.align||v&&")"==n.type?")"!=n.type||a?n.indented+(a?0:m)+(a||!l||/^(?:case|default)\b/.test(r)?0:m):n.indented+g:n.column+(a?0:1)},electricInput:T?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var b="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",x="int long char short double float unsigned signed void size_t ptrdiff_t";m(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:a(b),types:a(x+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:a("case do else for if switch while struct"),defKeywords:a("struct"),typeFirstDefinitions:!0,atoms:a("null true false"),hooks:{"#":s,"*":c},modeProps:{fold:["brace","include"]}}),m(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:a(b+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:a(x+" bool wchar_t"),blockKeywords:a("catch class do else finally for if struct switch try while"),defKeywords:a("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:a("true false null"),dontIndentStatements:/^template$/,hooks:{"#":s,"*":c,u:d,U:d,L:d,R:d,0:u,1:u,2:u,3:u,4:u,5:u,6:u,7:u,8:u,9:u,token:function(e,t,r){if("variable"==r&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&f(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),m("text/x-java",{name:"clike",keywords:a("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:a("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:a("catch class do else finally for if switch try while"),defKeywords:a("class interface package enum @interface"),typeFirstDefinitions:!0,atoms:a("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match("interface",!1)&&(e.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),m("text/x-csharp",{name:"clike",keywords:a("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:a("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:a("catch class do else finally for foreach if struct switch try while"),defKeywords:a("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:a("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=p,p(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),m("text/x-scala",{name:"clike",keywords:a("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:a("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:a("catch class do else finally for forSome if match switch try while"),defKeywords:a("class def object package trait type val var"),atoms:a("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=g,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,r){var n=r.context
|
8 |
+
;return!("}"!=n.type||!n.align||!e.eat(">"))&&(r.context=new t(n.indented,n.column,n.type,n.info,null,n.prev),"operator")}},modeProps:{closeBrackets:{triples:'"'}}}),m("text/x-kotlin",{name:"clike",keywords:a("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend"),types:a("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:a("catch class do else finally for if where try while enum"),defKeywords:a("class val var object package interface fun"),atoms:a("true false null this"),hooks:{'"':function(e,t){return t.tokenize=v(e.match('""')),t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),m(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:a("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:a("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:a("for while do if else struct"),builtin:a("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:a("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":s},modeProps:{fold:["brace","include"]}}),m("text/x-nesc",{name:"clike",keywords:a(b+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:a(x),blockKeywords:a("case do else for if switch while struct"),atoms:a("null true false"),hooks:{"#":s},modeProps:{fold:["brace","include"]}}),m("text/x-objectivec",{name:"clike",keywords:a(b+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:a(x),atoms:a("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":s,indent:function(e,t,r){if("statement"==t.type&&/^@\w/.test(r))return t.indented}},modeProps:{fold:"brace"}}),m("text/x-squirrel",{name:"clike",keywords:a("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:a(x),blockKeywords:a("case catch class else for foreach if switch try while"),defKeywords:a("function local class"),typeFirstDefinitions:!0,atoms:a("true false null"),hooks:{"#":s},modeProps:{fold:["brace","include"]}});var w=null;m("text/x-ceylon",{name:"clike",keywords:a("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:a("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:a("class dynamic function interface module object package value"),builtin:a("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:a("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=y(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!w||!e.match("`"))&&(t.tokenize=w,w=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,r){if(("variable"==r||"variable-3"==r)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function r(e,t,i){return 0==e.length?n(t):function(o,a){for(var l=e[0],s=0;s<l.length;s++)if(o.match(l[s][0]))return a.tokenize=r(e.slice(1),t),l[s][1];return a.tokenize=n(t,i),"string"}}function n(e,t){return function(r,n){return i(r,n,e,t)}}function i(e,t,n,i){if(i!==!1&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(i!==!1&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=r([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],n,i)),e.match(/\-\>\w/,!1)&&(t.tokenize=r([[["->",null]],[[/[\w]+/,"variable"]]],n,i)),"variable-2";for(var o=!1;!e.eol()&&(o||i===!1||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!o&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}o="\\"==e.next()&&!o}return"string"}var o="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",a="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",l="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";e.registerHelper("hintWords","php",[o,a,l].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var s={name:"clike",helperType:"php",keywords:t(o),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(a),builtin:t(l),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var i=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var o=e.current().slice(r[0].length+(i?2:1));if(i&&e.eat(i),o)return(t.tokStack||(t.tokStack=[])).push(o,0),t.tokenize=n(o,"'"!=i),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=n('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=n(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,r){function n(t,r){var n=r.curMode==o;if(t.sol()&&r.pending&&'"'!=r.pending&&"'"!=r.pending&&(r.pending=null),n)return n&&null==r.php.tokenize&&t.match("?>")?(r.curMode=i,r.curState=r.html,r.php.context.prev||(r.php=null),"meta"):o.token(t,r.curState);if(t.match(/^<\?\w*/))return r.curMode=o,r.php||(r.php=e.startState(o,i.indent(r.html,""))),r.curState=r.php,"meta";if('"'==r.pending||"'"==r.pending){for(;!t.eol()&&t.next()!=r.pending;);var a="string"}else if(r.pending&&t.pos<r.pending.end){t.pos=r.pending.end;var a=r.pending.style}else var a=i.token(t,r.curState);r.pending&&(r.pending=null);var l,s=t.current(),c=s.search(/<\?/);return c!=-1&&("string"==a&&(l=s.match(/[\'\"]$/))&&!/\?>/.test(s)?r.pending=l[0]:r.pending={end:t.pos,style:a},t.backUp(s.length-c)),a}var i=e.getMode(t,"text/html"),o=e.getMode(t,s);return{startState:function(){var t=e.startState(i),n=r.startOpen?e.startState(o):null;return{html:t,php:n,curMode:r.startOpen?o:i,curState:r.startOpen?n:t,pending:null}},copyState:function(t){var r,n=t.html,a=e.copyState(i,n),l=t.php,s=l&&e.copyState(o,l);return r=t.curMode==i?a:s,{html:a,php:s,curMode:t.curMode,curState:r,pending:t.pending}},token:n,indent:function(e,t){return e.curMode!=o&&/^\s*<\//.test(t)||e.curMode==o&&/^\?>/.test(t)?i.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",s)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t={allowUnquoted:!0,allowMissing:!0,caseFold:!0};e.defineMode("shortcode",function(e,r){function n(e,t){return"["===e.next()?"["===e.peek()?(t.tokenize=i,"comment"):/\s/.test(e.peek())?null:(k=e.eat("/")?"closeTag":"openTag",t.tokenize=o,"tag bracket"):(e.eatWhile(/[^\[]/),null)}function i(e,t){var r=function(e,t){return e.next(),t.tokenize=n,"comment"};return r.isInEscape=!0,"]"===e.next()&&"]"===e.peek()&&(t.tokenize=r),e.eatWhile(/[^\]]/),null}function o(e,t){var r=e.next();if("]"===r||"/"===r&&e.eat("]"))return t.tokenize=n,k="endTag","tag bracket";if("="===r)return k="equals",null;if("["===r){t.tokenize=n,t.state=c,t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=a(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=\[\]\"\']*[^\s\u00a0=\[\]\"\'\/]/),"word")}function a(e){var t=function(t,r){var n=t.next();return n===e?(r.tokenize=o,"string"):/[\[\]]/.test(n)?"string error":(t.eatWhile(/[^\[\]\'\"]/),"string")};return t.isInAttribute=!0,t}function l(e,t,r){this.tagHistory=[t],e.context&&(this.tagHistory=this.tagHistory.concat(e.context.tagHistory)),this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r}function s(e){e.context&&(e.context=e.context.prev)}function c(e,t,r){return"openTag"===e?(r.tagStart=t.column(),u):"closeTag"===e?d:c}function u(e,t,r){if("word"===e){var n=t.current();return/[\[\]\/\'\"<>&]/.test(n)?C="error":(r.tagName=t.current(),C="tag"),h}return C="error",u}function d(e,t,r){if("word"===e){var n=t.current();if(r.context&&r.context.tagName===n||b.matchClosing===!1)return C="tag",f;if(r.context&&r.context.tagHistory.indexOf(n)>0){for(var i=r.context.tagHistory.indexOf(n),o=0;o<i;o++)s(r);return C="tag",f}return C="tag error",p}return C="error",p}function f(e,t,r){return"endTag"!==e?(C="error",f):(s(r),c)}function p(e,t,r){return C="error",f(e,t,r)}function h(e,t,r){if("word"===e)return C=/^[a-z0-9_\-]+$/i.test(t.current())?"attribute":"error",m;if("endTag"===e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,r.context=new l(r,n,i===r.indented),c}return C="error",h}function m(e,t,r){return"equals"===e?g:(b.allowMissing||(C="error"),h(e,t,r))}function g(e,t,r){return"string"===e?v:"word"===e&&b.allowUnquoted?(C="string",h):(C="error",h(e,t,r))}function v(e,t,r){return"string"===e?v:h(e,t,r)}var y=e.indentUnit,b={},x=t;for(var w in x)b[w]=x[w];for(var _ in r)b[_]=r[_];var k,C;return n.isInText=!0,i.isInEscape=!0,{startState:function(e){var t={tokenize:n,state:c,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;k=null;var r=t.tokenize(e,t);return(r||k)&&"comment"!==r&&(C=null,t.state=t.state(k||r,e,t),C&&(r="error"===C?r+" error":C)),r},indent:function(e,t,r){var i=e.context;if(e.tokenize.isInAttribute)return e.tagStart===e.indented?e.stringStartCol+1:e.indented+y;if(e.tokenize!==o&&e.tokenize!==n)return r?r.match(/^(\s*)/)[0].length:0;if(e.tagName)return b.multilineTagIndentPastTag!==!1?e.tagStart+e.tagName.length+2:e.tagStart+y*(b.multilineTagIndentFactor||1);var a=t&&/^\[(\/)?([\w_:\.-]*)/.exec(t);if(a&&a[1])for(;i;){if(i.tagName===a[2]){i=i.prev;break}break}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+y:e.baseIndent||0},skipAttribute:function(e){e.state===g&&(e.state=h)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("wordpresspost",function(t,r){function n(e,t){t.isInShortcode=!0;var r=l.token(e,t.shortcodeState),n=t.shortcodeState.tokenize.isInText,o=t.shortcodeState.tokenize.isInEscape;if(n)t.token=i;else if(o&&/\]/.test(e.current())){var a=e.current(),s=a.search(/\]/);e.backUp(a.length-s-1),"]"!==e.peek()&&(t.token=i)}return r}function i(e,t){t.isInShortcode=!1;var r=a.token(e,t.htmlmixedState),i=t.htmlmixedState.htmlState.tokenize.isInText;if(i&&/\[/.test(e.current())&&!t.htmlmixedState.localState&&null===r){var s=e.current(),c=s.search(/\[/);e.backUp(s.length-c),null==t.shortcodeState&&(t.shortcodeState=l.startState(a.indent(t.htmlmixedState,""))),t.token=n}else i&&/<!\-\-more|<!\-\-noteaser\-\->/.test(e.current())&&!t.htmlmixedState.localState&&"comment"===r&&(e.backUp(e.current().length),t.token=o);return r}function o(e,t){return e.match("<!--more")?"meta":e.match("-->")||e.match("<!--noteaser-->")?(t.token=i,"meta"):(e.eatWhile(/[^\-\/]/),"string")}var a=e.getMode(t,{name:"htmlmixed",multilineTagIndentFactor:r.multilineTagIndentFactor,multilineTagIndentPastTag:r.multilineTagIndentPastTag}),l=e.getMode(t,{name:"shortcode",multilineTagIndentFactor:r.multilineTagIndentFactor,multilineTagIndentPastTag:r.multilineTagIndentPastTag});return{startState:function(){return{token:i,isInShortcode:!1,shortcodeState:null,htmlmixedState:a.startState()}},copyState:function(t){var r;return t.shortcodeState&&(r=e.copyState(l,t.shortcodeState)),{token:t.token,shortcodeState:r,htmlmixedState:e.copyState(a,t.htmlmixedState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return t.isInShortcode?t.isInShortcode?l.indent(t.shortcodeState,r):e.Pass:a.indent(t.htmlmixedState,r)},innerMode:function(e){return e.isInShortcode?{state:e.shortcodeState,mode:l}:{state:e.htmlmixedState,mode:a}}}},"htmlmixed","shortcode")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a),e.removeLineClass(e.state.activeLines[t],"gutter",l)}function r(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function n(e,n){for(var i=[],s=0;s<n.length;s++){var c=n[s],u=e.getOption("styleActiveLine");if("object"==typeof u&&u.nonEmpty?c.anchor.line==c.head.line:c.empty()){var d=e.getLineHandleVisualStart(c.head.line);i[i.length-1]!=d&&i.push(d)}}r(e.state.activeLines,i)||e.operation(function(){t(e);for(var r=0;r<i.length;r++)e.addLineClass(i[r],"wrap",o),e.addLineClass(i[r],"background",a),e.addLineClass(i[r],"gutter",l);e.state.activeLines=i})}function i(e,t){n(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background",l="CodeMirror-activeline-gutter";e.defineOption("styleActiveLine",!1,function(r,o,a){var l=a!=e.Init&&a;o!=l&&(l&&(r.off("beforeSelectionChange",i),t(r),delete r.state.activeLines),o&&(r.state.activeLines=[],n(r,r.listSelections()),r.on("beforeSelectionChange",i)))})}),function(e,t,r,n,i){"use strict";function o(){te.theme=i.theme,te.lineNumbers=!!i.lineNumbers,te.tabSize=te.indentUnit=+i.tabSize,te.lineWrapping=!!i.lineWrapping}function a(e){var r=!1;return function(){var n=this,i=arguments;r||(e.apply(n,i),r=!0,t.requestAnimationFrame(function(){t.requestAnimationFrame(function(){r=!1})}))}}function l(){for(var e=0;e<K.children.length;e++){var t=K.children[e];t.style.position="",t.style.top="",t.style.left="",t.style.right="",t.style.width=""}}function s(){for(var t=$.getBoundingClientRect(),r=0;r<K.children.length;r++){var n=K.children[r];n.style.position="fixed",n.style.top=t.bottom+"px",n.style.right=e.documentElement.getBoundingClientRect().width-t.right+"px",n.id.match(/toggle/gi)||(n.style.left=t.left+"px",n.style.width="auto")}}function c(){for(var e=$.getBoundingClientRect(),t=R.getWrapperElement().getBoundingClientRect(),r=0;r<K.children.length;r++){var n=K.children[r];n.style.position="absolute",n.style.top=(t.top-e.bottom)*-1+"px",n.style.left="",n.style.right="",n.style.width=""}}function u(e){d();var t=ee.settingsPosition();if(t!==ee.previousSettingsPosition||e&&"resize"===e.type)switch(L(),t){case"top":l();break;case"middle":s();break;case"bottom":c();break;case"normal":case"none":}}function d(){if(V){var r=V.getBoundingClientRect().top,n=e.getElementById("post-status-info").getBoundingClientRect().top,i=n-r,o=t.innerHeight-r;V.style.maxHeight=Math.min(i,o)-6+"px",ne&&(V.style.height=V.style.maxHeight)}}function f(){V.style.maxHeight="",ne&&(V.style.height="")}function p(){J&&(J.addEventListener("change",h),h())}function h(){ee.isFullHeight()?(R.setOption("viewportMargin",1/0),R.on("change",L),t.addEventListener("scroll",re),t.addEventListener("resize",re),t.addEventListener("resize",ae),R.getWrapperElement().style.height="auto",u(),M(),t.setTimeout(function(){d(),L()},100)):(R.setOption("viewportMargin",te.viewportMargin),R.off("change",L),t.removeEventListener("scroll",re),t.removeEventListener("resize",re),t.removeEventListener("resize",ae),R.getWrapperElement().style.marginTop="",f(),l(),T())}function m(){R.getWrapperElement().appendChild(K),K.style.display="block",K.querySelector(".CodeMirror-settings__toggle").addEventListener("click",g),K.querySelector(".CodeMirror-settings__toggle-advanced").addEventListener("click",g);for(var e=K.querySelectorAll(".CodeMirror-settings__option"),t=0;t<e.length;t++){e[t].addEventListener("change",k)}K.querySelector("#theme").addEventListener("change",y),K.querySelector("#tabSize").addEventListener("change",y),K.querySelector("#lineWrapping").addEventListener("change",y),K.querySelector("#lineNumbers").addEventListener("change",y),K.querySelector("#fontSize").addEventListener("change",w),K.querySelector("#lineHeight").addEventListener("change",_)}function g(e){v(e.target.id.match(/advanced/gi)?K.classList.contains("open-advanced")?"open":"advanced":K.classList.contains("open")?"closed":"open")}function v(e){switch(e){case"open":K.classList.add("open"),K.classList.remove("open-advanced"),K.classList.remove("closed");break;case"advanced":K.classList.add("open"),K.classList.add("open-advanced"),K.classList.remove("closed");break;default:K.classList.remove("open"),K.classList.remove("open-advanced"),K.classList.add("closed")}}function y(e){var t=+e.target.value;t=isNaN(t)?e.target.value:t,null!=e.target.checked&&(t=e.target.checked),i[e.target.id]=t,R.setOption(e.target.id,t),"tabSize"===e.target.id&&R.setOption("indentUnit",t)}function b(){ee.currentCharWidth=R.defaultCharWidth()*(i.fontSize/13)}function x(e,t){U.style.fontSize=e+"px",i.fontSize=e,U.style.lineHeight=t+"em",i.lineHeight=t,b(),R.refresh()}function w(e){var t=e.target.value;i.fontSize=t,U.style.fontSize=t+"px",b(),R.refresh()}function _(e){var t=e.target.value;i.lineHeight=t,U.style.lineHeight=t+"em",R.refresh()}function k(){var e=n("#CodeMirror-settings__form").serializeArray();n.post(i.ajaxUrl,e,function(){})}function C(){$.insertAdjacentHTML("afterbegin",'<button type="button" id="cm_content_fullscreen" class="ed_button qt-dfw" title="Full Screen"></button>'),e.getElementById("cm_content_fullscreen").onclick=S}
|
9 |
+
function S(){ee.isFullHeight()?ie.classList.remove(oe):(ie.classList.toggle(oe),R.focus())}function L(){R.save(),R.getTextArea().style.height=R.getWrapperElement().getBoundingClientRect().height+"px"}function T(){R.getWrapperElement().style.height=R.getTextArea().style.height}function M(){R.getWrapperElement().style.marginTop=R.getTextArea().style.marginTop}function z(){e.getElementById("content-resize-handle").addEventListener("mousedown",function(){e.addEventListener("mousemove",T)}),e.addEventListener("mouseup",function(){e.removeEventListener("mousemove",T)})}function A(){function t(e){l=r+(e.pageY-o),R.getWrapperElement().style.height=Math.max(n,l)+"px"}var r=500,n=200;R.getWrapperElement().style.height=r+"px";var i=e.createElement("div");i.className="hesh-content-resize-handle",i.id="content-resize-handle",R.getWrapperElement().appendChild(i);var o,a=!1,l=r;e.getElementById("content-resize-handle").addEventListener("mousedown",function(r){o=r.pageY,a=!0,e.addEventListener("mousemove",t),r.preventDefault()}),e.addEventListener("mouseup",function(){a=!1,r=Math.max(n,l),e.removeEventListener("mousemove",t),R.refresh()})}function O(){var t=e.querySelector(".fileedit-sub .alignleft"),r=t.textContent.match(/\.[a-z\d]{2,}/gi),n=r[r.length-1].match(/[a-z]*/gi)[1],i={php:"php",css:"css",xml:"xml",html:"htmlmixed",js:"javascript",json:"javascript"};te.mode=i[n]}function N(t){var r="; "+e.cookie,n=r.split("; "+t+"=");if(2===n.length)return n.pop().split(";").shift()}function E(){var e=(N("hesh_plugin_selection_state")||"0,0,0,0,0,0,0").split(",");Q===e[0]&&(R.doc.setSelection({line:+e[1],ch:+e[2]},{line:+e[3],ch:+e[4]},{scroll:!1}),R.scrollTo(+e[5],+e[6]))}function W(){var t=R.doc.listSelections()[0],r=R.getScrollInfo();e.cookie="hesh_plugin_selection_state="+Q+","+t.anchor.line+","+t.anchor.ch+","+t.head.line+","+t.head.ch+","+r.left+","+r.top}function I(){var t=".CodeMirror pre > * { text-indent: 0px; }",n=e.head||e.getElementsByTagName("head")[0],i=e.createElement("style");i.type="text/css",i.styleSheet?i.styleSheet.cssText=t:i.appendChild(e.createTextNode(t)),n.appendChild(i);R.on("renderLine",function(e,t,n){var i=r.countColumn(t.text,null,e.getOption("tabSize"))*ee.currentCharWidth;n.style.textIndent="-"+i+"px",n.style.paddingLeft=4+i+"px"}),R.refresh()}function D(){var e,t,r,n=R.doc.listSelections()[0];e=t=r=0,R.doc.eachLine(function(i){r<=n.head.line-1&&(e+=i.text.length+1),r<=n.anchor.line-1&&(t+=i.text.length+1),r++}),e+=n.head.ch,t+=n.anchor.ch,R.getTextArea().setSelectionRange(Math.min(t,e),Math.max(t,e)),R.getTextArea().focus(),q()}function q(){var e=R.getTextArea().value.length,r=t.setInterval(function(){e!==R
|