codemirror-rails 3.02 → 3.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/codemirror-rails.gemspec +1 -0
- data/doc/CodeMirror-LICENSE +5 -1
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror/{utils → addons/dialog}/dialog.js +4 -0
- data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +54 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +54 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/closetag.js +9 -8
- data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/continuecomment.js +12 -4
- data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +25 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/matchbrackets.js +30 -11
- data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +31 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +32 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +11 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +64 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +582 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/javascript-hint.js +15 -11
- data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/pig-hint.js +19 -19
- data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/python-hint.js +2 -2
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +180 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/xml-hint.js +5 -18
- data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +127 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +14 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +197 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/loadmode.js +0 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/multiplex.js +2 -2
- data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/overlay.js +2 -2
- data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/colorize.js +0 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/runmode-standalone.js +2 -3
- data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/runmode.js +0 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +89 -0
- data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +60 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/search}/search.js +5 -5
- data/vendor/assets/javascripts/codemirror/{utils → addons/search}/searchcursor.js +37 -30
- data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +39 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +34 -0
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +721 -188
- data/vendor/assets/javascripts/codemirror/modes/asterisk.js +6 -6
- data/vendor/assets/javascripts/codemirror/modes/clike.js +14 -14
- data/vendor/assets/javascripts/codemirror/modes/clojure.js +23 -7
- data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/css.js +337 -235
- data/vendor/assets/javascripts/codemirror/modes/ecl.js +12 -12
- data/vendor/assets/javascripts/codemirror/modes/erlang.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/gas.js +326 -0
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/haskell.js +26 -26
- data/vendor/assets/javascripts/codemirror/modes/haxe.js +17 -17
- data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +6 -6
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +43 -23
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +78 -33
- data/vendor/assets/javascripts/codemirror/modes/jinja2.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/less.js +38 -38
- data/vendor/assets/javascripts/codemirror/modes/livescript.js +267 -0
- data/vendor/assets/javascripts/codemirror/modes/lua.js +7 -7
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +108 -57
- data/vendor/assets/javascripts/codemirror/modes/mirc.js +177 -0
- data/vendor/assets/javascripts/codemirror/modes/ntriples.js +22 -22
- data/vendor/assets/javascripts/codemirror/modes/ocaml.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/perl.js +791 -791
- data/vendor/assets/javascripts/codemirror/modes/php.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/pig.js +163 -163
- data/vendor/assets/javascripts/codemirror/modes/python.js +31 -31
- data/vendor/assets/javascripts/codemirror/modes/q.js +124 -0
- data/vendor/assets/javascripts/codemirror/modes/rst.js +486 -250
- data/vendor/assets/javascripts/codemirror/modes/sass.js +3 -3
- data/vendor/assets/javascripts/codemirror/modes/scss_test.js +80 -0
- data/vendor/assets/javascripts/codemirror/modes/shell.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/sieve.js +10 -10
- data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +129 -129
- data/vendor/assets/javascripts/codemirror/modes/smarty.js +3 -3
- data/vendor/assets/javascripts/codemirror/modes/sparql.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/sql.js +23 -23
- data/vendor/assets/javascripts/codemirror/modes/stex.js +192 -121
- data/vendor/assets/javascripts/codemirror/modes/tcl.js +131 -0
- data/vendor/assets/javascripts/codemirror/modes/test.js +64 -0
- data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +345 -345
- data/vendor/assets/javascripts/codemirror/modes/tiki.js +297 -298
- data/vendor/assets/javascripts/codemirror/modes/turtle.js +145 -0
- data/vendor/assets/javascripts/codemirror/modes/vb.js +31 -32
- data/vendor/assets/javascripts/codemirror/modes/vbscript.js +4 -4
- data/vendor/assets/javascripts/codemirror/modes/xml.js +10 -6
- data/vendor/assets/javascripts/codemirror/modes/xquery.js +55 -55
- data/vendor/assets/javascripts/codemirror/modes/yaml.js +90 -90
- data/vendor/assets/javascripts/codemirror/modes/z80.js +82 -110
- data/vendor/assets/javascripts/codemirror.js +1914 -1115
- data/vendor/assets/stylesheets/codemirror/{utils → addons/dialog}/dialog.css +0 -0
- data/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css +38 -0
- data/vendor/assets/stylesheets/codemirror/addons/lint/lint.css +96 -0
- data/vendor/assets/stylesheets/codemirror/modes/tiki.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/ambiance-mobile.css +0 -1
- data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +0 -1
- data/vendor/assets/stylesheets/codemirror/themes/eclipse.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css +5 -5
- data/vendor/assets/stylesheets/codemirror/themes/midnight.css +52 -0
- data/vendor/assets/stylesheets/codemirror/themes/xq-light.css +43 -0
- data/vendor/assets/stylesheets/codemirror.css +16 -10
- metadata +60 -52
- data/vendor/assets/javascripts/codemirror/modes/mysql.js +0 -203
- data/vendor/assets/javascripts/codemirror/modes/plsql.js +0 -216
- data/vendor/assets/javascripts/codemirror/utils/collapserange.js +0 -68
- data/vendor/assets/javascripts/codemirror/utils/continuelist.js +0 -28
- data/vendor/assets/javascripts/codemirror/utils/foldcode.js +0 -183
- data/vendor/assets/javascripts/codemirror/utils/formatting.js +0 -114
- data/vendor/assets/javascripts/codemirror/utils/match-highlighter.js +0 -46
- data/vendor/assets/javascripts/codemirror/utils/simple-hint.js +0 -102
- data/vendor/assets/stylesheets/codemirror/utils/simple-hint.css +0 -16
@@ -0,0 +1,582 @@
|
|
1
|
+
(function () {
|
2
|
+
function htmlHint(editor, htmlStructure, getToken) {
|
3
|
+
var cur = editor.getCursor();
|
4
|
+
var token = getToken(editor, cur);
|
5
|
+
var keywords = [];
|
6
|
+
var i = 0;
|
7
|
+
var j = 0;
|
8
|
+
var k = 0;
|
9
|
+
var from = {line: cur.line, ch: cur.ch};
|
10
|
+
var to = {line: cur.line, ch: cur.ch};
|
11
|
+
var flagClean = true;
|
12
|
+
|
13
|
+
var text = editor.getRange({line: 0, ch: 0}, cur);
|
14
|
+
|
15
|
+
var open = text.lastIndexOf('<');
|
16
|
+
var close = text.lastIndexOf('>');
|
17
|
+
var tokenString = token.string.replace("<","");
|
18
|
+
|
19
|
+
if(open > close) {
|
20
|
+
var last = editor.getRange({line: cur.line, ch: cur.ch - 1}, cur);
|
21
|
+
if(last == "<") {
|
22
|
+
for(i = 0; i < htmlStructure.length; i++) {
|
23
|
+
keywords.push(htmlStructure[i].tag);
|
24
|
+
}
|
25
|
+
from.ch = token.start + 1;
|
26
|
+
} else {
|
27
|
+
var counter = 0;
|
28
|
+
var found = function(token, type, position) {
|
29
|
+
counter++;
|
30
|
+
if(counter > 50) return;
|
31
|
+
if(token.type == type) {
|
32
|
+
return token;
|
33
|
+
} else {
|
34
|
+
position.ch = token.start;
|
35
|
+
var newToken = editor.getTokenAt(position);
|
36
|
+
return found(newToken, type, position);
|
37
|
+
}
|
38
|
+
};
|
39
|
+
|
40
|
+
var nodeToken = found(token, "tag", {line: cur.line, ch: cur.ch});
|
41
|
+
var node = nodeToken.string.substring(1);
|
42
|
+
|
43
|
+
if(token.type === null && token.string.trim() === "") {
|
44
|
+
for(i = 0; i < htmlStructure.length; i++) {
|
45
|
+
if(htmlStructure[i].tag == node) {
|
46
|
+
for(j = 0; j < htmlStructure[i].attr.length; j++) {
|
47
|
+
keywords.push(htmlStructure[i].attr[j].key + "=\"\" ");
|
48
|
+
}
|
49
|
+
|
50
|
+
for(k = 0; k < globalAttributes.length; k++) {
|
51
|
+
keywords.push(globalAttributes[k].key + "=\"\" ");
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
} else if(token.type == "string") {
|
56
|
+
tokenString = tokenString.substring(1, tokenString.length - 1);
|
57
|
+
var attributeToken = found(token, "attribute", {line: cur.line, ch: cur.ch});
|
58
|
+
var attribute = attributeToken.string;
|
59
|
+
|
60
|
+
for(i = 0; i < htmlStructure.length; i++) {
|
61
|
+
if(htmlStructure[i].tag == node) {
|
62
|
+
for(j = 0; j < htmlStructure[i].attr.length; j++) {
|
63
|
+
if(htmlStructure[i].attr[j].key == attribute) {
|
64
|
+
for(k = 0; k < htmlStructure[i].attr[j].values.length; k++) {
|
65
|
+
keywords.push(htmlStructure[i].attr[j].values[k]);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
for(j = 0; j < globalAttributes.length; j++) {
|
71
|
+
if(globalAttributes[j].key == attribute) {
|
72
|
+
for(k = 0; k < globalAttributes[j].values.length; k++) {
|
73
|
+
keywords.push(globalAttributes[j].values[k]);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
from.ch = token.start + 1;
|
80
|
+
} else if(token.type == "attribute") {
|
81
|
+
for(i = 0; i < htmlStructure.length; i++) {
|
82
|
+
if(htmlStructure[i].tag == node) {
|
83
|
+
for(j = 0; j < htmlStructure[i].attr.length; j++) {
|
84
|
+
keywords.push(htmlStructure[i].attr[j].key + "=\"\" ");
|
85
|
+
}
|
86
|
+
|
87
|
+
for(k = 0; k < globalAttributes.length; k++) {
|
88
|
+
keywords.push(globalAttributes[k].key + "=\"\" ");
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
from.ch = token.start;
|
93
|
+
} else if(token.type == "tag") {
|
94
|
+
for(i = 0; i < htmlStructure.length; i++) {
|
95
|
+
keywords.push(htmlStructure[i].tag);
|
96
|
+
}
|
97
|
+
|
98
|
+
from.ch = token.start + 1;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
} else {
|
102
|
+
for(i = 0; i < htmlStructure.length; i++) {
|
103
|
+
keywords.push("<" + htmlStructure[i].tag);
|
104
|
+
}
|
105
|
+
|
106
|
+
tokenString = ("<" + tokenString).trim();
|
107
|
+
from.ch = token.start;
|
108
|
+
}
|
109
|
+
|
110
|
+
if(flagClean === true && tokenString.trim() === "") {
|
111
|
+
flagClean = false;
|
112
|
+
}
|
113
|
+
|
114
|
+
if(flagClean) {
|
115
|
+
keywords = cleanResults(tokenString, keywords);
|
116
|
+
}
|
117
|
+
|
118
|
+
return {list: keywords, from: from, to: to};
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
var cleanResults = function(text, keywords) {
|
123
|
+
var results = [];
|
124
|
+
var i = 0;
|
125
|
+
|
126
|
+
for(i = 0; i < keywords.length; i++) {
|
127
|
+
if(keywords[i].substring(0, text.length) == text) {
|
128
|
+
results.push(keywords[i]);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
return results;
|
133
|
+
};
|
134
|
+
|
135
|
+
var htmlStructure = [
|
136
|
+
{tag: '!DOCTYPE', attr: []},
|
137
|
+
{tag: 'a', attr: [
|
138
|
+
{key: 'href', values: ["#"]},
|
139
|
+
{key: 'target', values: ["_blank","_self","_top","_parent"]},
|
140
|
+
{key: 'ping', values: [""]},
|
141
|
+
{key: 'media', values: ["#"]},
|
142
|
+
{key: 'hreflang', values: ["en","es"]},
|
143
|
+
{key: 'type', values: []}
|
144
|
+
]},
|
145
|
+
{tag: 'abbr', attr: []},
|
146
|
+
{tag: 'acronym', attr: []},
|
147
|
+
{tag: 'address', attr: []},
|
148
|
+
{tag: 'applet', attr: []},
|
149
|
+
{tag: 'area', attr: [
|
150
|
+
{key: 'alt', values: [""]},
|
151
|
+
{key: 'coords', values: ["rect: left, top, right, bottom","circle: center-x, center-y, radius","poly: x1, y1, x2, y2, ..."]},
|
152
|
+
{key: 'shape', values: ["default","rect","circle","poly"]},
|
153
|
+
{key: 'href', values: ["#"]},
|
154
|
+
{key: 'target', values: ["#"]},
|
155
|
+
{key: 'ping', values: []},
|
156
|
+
{key: 'media', values: []},
|
157
|
+
{key: 'hreflang', values: []},
|
158
|
+
{key: 'type', values: []}
|
159
|
+
|
160
|
+
]},
|
161
|
+
{tag: 'article', attr: []},
|
162
|
+
{tag: 'aside', attr: []},
|
163
|
+
{tag: 'audio', attr: [
|
164
|
+
{key: 'src', values: []},
|
165
|
+
{key: 'crossorigin', values: ["anonymous","use-credentials"]},
|
166
|
+
{key: 'preload', values: ["none","metadata","auto"]},
|
167
|
+
{key: 'autoplay', values: ["","autoplay"]},
|
168
|
+
{key: 'mediagroup', values: []},
|
169
|
+
{key: 'loop', values: ["","loop"]},
|
170
|
+
{key: 'controls', values: ["","controls"]}
|
171
|
+
]},
|
172
|
+
{tag: 'b', attr: []},
|
173
|
+
{tag: 'base', attr: [
|
174
|
+
{key: 'href', values: ["#"]},
|
175
|
+
{key: 'target', values: ["_blank","_self","_top","_parent"]}
|
176
|
+
]},
|
177
|
+
{tag: 'basefont', attr: []},
|
178
|
+
{tag: 'bdi', attr: []},
|
179
|
+
{tag: 'bdo', attr: []},
|
180
|
+
{tag: 'big', attr: []},
|
181
|
+
{tag: 'blockquote', attr: [
|
182
|
+
{key: 'cite', values: ["http://"]}
|
183
|
+
]},
|
184
|
+
{tag: 'body', attr: []},
|
185
|
+
{tag: 'br', attr: []},
|
186
|
+
{tag: 'button', attr: [
|
187
|
+
{key: 'autofocus', values: ["","autofocus"]},
|
188
|
+
{key: 'disabled', values: ["","disabled"]},
|
189
|
+
{key: 'form', values: []},
|
190
|
+
{key: 'formaction', values: []},
|
191
|
+
{key: 'formenctype', values: ["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},
|
192
|
+
{key: 'formmethod', values: ["get","post","put","delete"]},
|
193
|
+
{key: 'formnovalidate', values: ["","novalidate"]},
|
194
|
+
{key: 'formtarget', values: ["_blank","_self","_top","_parent"]},
|
195
|
+
{key: 'name', values: []},
|
196
|
+
{key: 'type', values: ["submit","reset","button"]},
|
197
|
+
{key: 'value', values: []}
|
198
|
+
]},
|
199
|
+
{tag: 'canvas', attr: [
|
200
|
+
{key: 'width', values: []},
|
201
|
+
{key: 'height', values: []}
|
202
|
+
]},
|
203
|
+
{tag: 'caption', attr: []},
|
204
|
+
{tag: 'center', attr: []},
|
205
|
+
{tag: 'cite', attr: []},
|
206
|
+
{tag: 'code', attr: []},
|
207
|
+
{tag: 'col', attr: [
|
208
|
+
{key: 'span', values: []}
|
209
|
+
]},
|
210
|
+
{tag: 'colgroup', attr: [
|
211
|
+
{key: 'span', values: []}
|
212
|
+
]},
|
213
|
+
{tag: 'command', attr: [
|
214
|
+
{key: 'type', values: ["command","checkbox","radio"]},
|
215
|
+
{key: 'label', values: []},
|
216
|
+
{key: 'icon', values: []},
|
217
|
+
{key: 'disabled', values: ["","disabled"]},
|
218
|
+
{key: 'checked', values: ["","checked"]},
|
219
|
+
{key: 'radiogroup', values: []},
|
220
|
+
{key: 'command', values: []},
|
221
|
+
{key: 'title', values: []}
|
222
|
+
]},
|
223
|
+
{tag: 'data', attr: [
|
224
|
+
{key: 'value', values: []}
|
225
|
+
]},
|
226
|
+
{tag: 'datagrid', attr: [
|
227
|
+
{key: 'disabled', values: ["","disabled"]},
|
228
|
+
{key: 'multiple', values: ["","multiple"]}
|
229
|
+
]},
|
230
|
+
{tag: 'datalist', attr: [
|
231
|
+
{key: 'data', values: []}
|
232
|
+
]},
|
233
|
+
{tag: 'dd', attr: []},
|
234
|
+
{tag: 'del', attr: [
|
235
|
+
{key: 'cite', values: []},
|
236
|
+
{key: 'datetime', values: []}
|
237
|
+
]},
|
238
|
+
{tag: 'details', attr: [
|
239
|
+
{key: 'open', values: ["","open"]}
|
240
|
+
]},
|
241
|
+
{tag: 'dfn', attr: []},
|
242
|
+
{tag: 'dir', attr: []},
|
243
|
+
{tag: 'div', attr: [
|
244
|
+
{key: 'id', values: []},
|
245
|
+
{key: 'class', values: []},
|
246
|
+
{key: 'style', values: []}
|
247
|
+
]},
|
248
|
+
{tag: 'dl', attr: []},
|
249
|
+
{tag: 'dt', attr: []},
|
250
|
+
{tag: 'em', attr: []},
|
251
|
+
{tag: 'embed', attr: [
|
252
|
+
{key: 'src', values: []},
|
253
|
+
{key: 'type', values: []},
|
254
|
+
{key: 'width', values: []},
|
255
|
+
{key: 'height', values: []}
|
256
|
+
]},
|
257
|
+
{tag: 'eventsource', attr: [
|
258
|
+
{key: 'src', values: []}
|
259
|
+
]},
|
260
|
+
{tag: 'fieldset', attr: [
|
261
|
+
{key: 'disabled', values: ["","disabled"]},
|
262
|
+
{key: 'form', values: []},
|
263
|
+
{key: 'name', values: []}
|
264
|
+
]},
|
265
|
+
{tag: 'figcaption', attr: []},
|
266
|
+
{tag: 'figure', attr: []},
|
267
|
+
{tag: 'font', attr: []},
|
268
|
+
{tag: 'footer', attr: []},
|
269
|
+
{tag: 'form', attr: [
|
270
|
+
{key: 'accept-charset', values: ["UNKNOWN","utf-8"]},
|
271
|
+
{key: 'action', values: []},
|
272
|
+
{key: 'autocomplete', values: ["on","off"]},
|
273
|
+
{key: 'enctype', values: ["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},
|
274
|
+
{key: 'method', values: ["get","post","put","delete","dialog"]},
|
275
|
+
{key: 'name', values: []},
|
276
|
+
{key: 'novalidate', values: ["","novalidate"]},
|
277
|
+
{key: 'target', values: ["_blank","_self","_top","_parent"]}
|
278
|
+
]},
|
279
|
+
{tag: 'frame', attr: []},
|
280
|
+
{tag: 'frameset', attr: []},
|
281
|
+
{tag: 'h1', attr: []},
|
282
|
+
{tag: 'h2', attr: []},
|
283
|
+
{tag: 'h3', attr: []},
|
284
|
+
{tag: 'h4', attr: []},
|
285
|
+
{tag: 'h5', attr: []},
|
286
|
+
{tag: 'h6', attr: []},
|
287
|
+
{tag: 'head', attr: []},
|
288
|
+
{tag: 'header', attr: []},
|
289
|
+
{tag: 'hgroup', attr: []},
|
290
|
+
{tag: 'hr', attr: []},
|
291
|
+
{tag: 'html', attr: [
|
292
|
+
{key: 'manifest', values: []}
|
293
|
+
]},
|
294
|
+
{tag: 'i', attr: []},
|
295
|
+
{tag: 'iframe', attr: [
|
296
|
+
{key: 'src', values: []},
|
297
|
+
{key: 'srcdoc', values: []},
|
298
|
+
{key: 'name', values: []},
|
299
|
+
{key: 'sandbox', values: ["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"]},
|
300
|
+
{key: 'seamless', values: ["","seamless"]},
|
301
|
+
{key: 'width', values: []},
|
302
|
+
{key: 'height', values: []}
|
303
|
+
]},
|
304
|
+
{tag: 'img', attr: [
|
305
|
+
{key: 'alt', values: []},
|
306
|
+
{key: 'src', values: []},
|
307
|
+
{key: 'crossorigin', values: ["anonymous","use-credentials"]},
|
308
|
+
{key: 'ismap', values: []},
|
309
|
+
{key: 'usemap', values: []},
|
310
|
+
{key: 'width', values: []},
|
311
|
+
{key: 'height', values: []}
|
312
|
+
]},
|
313
|
+
{tag: 'input', attr: [
|
314
|
+
{key: 'accept', values: ["audio/*","video/*","image/*"]},
|
315
|
+
{key: 'alt', values: []},
|
316
|
+
{key: 'autocomplete', values: ["on","off"]},
|
317
|
+
{key: 'autofocus', values: ["","autofocus"]},
|
318
|
+
{key: 'checked', values: ["","checked"]},
|
319
|
+
{key: 'disabled', values: ["","disabled"]},
|
320
|
+
{key: 'dirname', values: []},
|
321
|
+
{key: 'form', values: []},
|
322
|
+
{key: 'formaction', values: []},
|
323
|
+
{key: 'formenctype', values: ["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},
|
324
|
+
{key: 'formmethod', values: ["get","post","put","delete"]},
|
325
|
+
{key: 'formnovalidate', values: ["","novalidate"]},
|
326
|
+
{key: 'formtarget', values: ["_blank","_self","_top","_parent"]},
|
327
|
+
{key: 'height', values: []},
|
328
|
+
{key: 'list', values: []},
|
329
|
+
{key: 'max', values: []},
|
330
|
+
{key: 'maxlength', values: []},
|
331
|
+
{key: 'min', values: []},
|
332
|
+
{key: 'multiple', values: ["","multiple"]},
|
333
|
+
{key: 'name', values: []},
|
334
|
+
{key: 'pattern', values: []},
|
335
|
+
{key: 'placeholder', values: []},
|
336
|
+
{key: 'readonly', values: ["","readonly"]},
|
337
|
+
{key: 'required', values: ["","required"]},
|
338
|
+
{key: 'size', values: []},
|
339
|
+
{key: 'src', values: []},
|
340
|
+
{key: 'step', values: []},
|
341
|
+
{key: 'type', values: [
|
342
|
+
"hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local",
|
343
|
+
"number","range","color","checkbox","radio","file","submit","image","reset","button"
|
344
|
+
]},
|
345
|
+
{key: 'value', values: []},
|
346
|
+
{key: 'width', values: []}
|
347
|
+
]},
|
348
|
+
{tag: 'ins', attr: [
|
349
|
+
{key: 'cite', values: []},
|
350
|
+
{key: 'datetime', values: []}
|
351
|
+
]},
|
352
|
+
{tag: 'kbd', attr: []},
|
353
|
+
{tag: 'keygen', attr: [
|
354
|
+
{key: 'autofocus', values: ["","autofocus"]},
|
355
|
+
{key: 'challenge', values: []},
|
356
|
+
{key: 'disabled', values: ["","disabled"]},
|
357
|
+
{key: 'form', values: []},
|
358
|
+
{key: 'keytype', values: ["RSA"]},
|
359
|
+
{key: 'name', values: []}
|
360
|
+
]},
|
361
|
+
{tag: 'label', attr: [
|
362
|
+
{key: 'for', values: []},
|
363
|
+
{key: 'form', values: []}
|
364
|
+
]},
|
365
|
+
{tag: 'legend', attr: []},
|
366
|
+
{tag: 'li', attr: [
|
367
|
+
{key: 'value', values: []}
|
368
|
+
]},
|
369
|
+
{tag: 'link', attr: [
|
370
|
+
{key: 'href', values: []},
|
371
|
+
{key: 'hreflang', values: ["en","es"]},
|
372
|
+
{key: 'media', values: [
|
373
|
+
"all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses",
|
374
|
+
"resolution [>][<][=] [X]dpi","resolution [>][<][=] [X]dpcm","device-aspect-ratio: 16/9","device-aspect-ratio: 4/3",
|
375
|
+
"device-aspect-ratio: 32/18","device-aspect-ratio: 1280/720","device-aspect-ratio: 2560/1440","orientation:portrait",
|
376
|
+
"orientation:landscape","device-height: [X]px","device-width: [X]px","-webkit-min-device-pixel-ratio: 2"
|
377
|
+
]},
|
378
|
+
{key: 'type', values: []},
|
379
|
+
{key: 'sizes', values: ["all","16x16","16x16 32x32","16x16 32x32 64x64"]}
|
380
|
+
]},
|
381
|
+
{tag: 'map', attr: [
|
382
|
+
{key: 'name', values: []}
|
383
|
+
]},
|
384
|
+
{tag: 'mark', attr: []},
|
385
|
+
{tag: 'menu', attr: [
|
386
|
+
{key: 'type', values: ["list","context","toolbar"]},
|
387
|
+
{key: 'label', values: []}
|
388
|
+
]},
|
389
|
+
{tag: 'meta', attr: [
|
390
|
+
{key: 'charset', attr: ["utf-8"]},
|
391
|
+
{key: 'name', attr: ["viewport","application-name","author","description","generator","keywords"]},
|
392
|
+
{key: 'content', attr: ["","width=device-width","initial-scale=1, maximum-scale=1, minimun-scale=1, user-scale=no"]},
|
393
|
+
{key: 'http-equiv', attr: ["content-language","content-type","default-style","refresh"]}
|
394
|
+
]},
|
395
|
+
{tag: 'meter', attr: [
|
396
|
+
{key: 'value', values: []},
|
397
|
+
{key: 'min', values: []},
|
398
|
+
{key: 'low', values: []},
|
399
|
+
{key: 'high', values: []},
|
400
|
+
{key: 'max', values: []},
|
401
|
+
{key: 'optimum', values: []}
|
402
|
+
]},
|
403
|
+
{tag: 'nav', attr: []},
|
404
|
+
{tag: 'noframes', attr: []},
|
405
|
+
{tag: 'noscript', attr: []},
|
406
|
+
{tag: 'object', attr: [
|
407
|
+
{key: 'data', values: []},
|
408
|
+
{key: 'type', values: []},
|
409
|
+
{key: 'typemustmatch', values: ["","typemustmatch"]},
|
410
|
+
{key: 'name', values: []},
|
411
|
+
{key: 'usemap', values: []},
|
412
|
+
{key: 'form', values: []},
|
413
|
+
{key: 'width', values: []},
|
414
|
+
{key: 'height', values: []}
|
415
|
+
]},
|
416
|
+
{tag: 'ol', attr: [
|
417
|
+
{key: 'reversed', values: ["", "reversed"]},
|
418
|
+
{key: 'start', values: []},
|
419
|
+
{key: 'type', values: ["1","a","A","i","I"]}
|
420
|
+
]},
|
421
|
+
{tag: 'optgroup', attr: [
|
422
|
+
{key: 'disabled', values: ["","disabled"]},
|
423
|
+
{key: 'label', values: []}
|
424
|
+
]},
|
425
|
+
{tag: 'option', attr: [
|
426
|
+
{key: 'disabled', values: ["", "disabled"]},
|
427
|
+
{key: 'label', values: []},
|
428
|
+
{key: 'selected', values: ["", "selected"]},
|
429
|
+
{key: 'value', values: []}
|
430
|
+
]},
|
431
|
+
{tag: 'output', attr: [
|
432
|
+
{key: 'for', values: []},
|
433
|
+
{key: 'form', values: []},
|
434
|
+
{key: 'name', values: []}
|
435
|
+
]},
|
436
|
+
{tag: 'p', attr: []},
|
437
|
+
{tag: 'param', attr: [
|
438
|
+
{key: 'name', values: []},
|
439
|
+
{key: 'value', values: []}
|
440
|
+
]},
|
441
|
+
{tag: 'pre', attr: []},
|
442
|
+
{tag: 'progress', attr: [
|
443
|
+
{key: 'value', values: []},
|
444
|
+
{key: 'max', values: []}
|
445
|
+
]},
|
446
|
+
{tag: 'q', attr: [
|
447
|
+
{key: 'cite', values: []}
|
448
|
+
]},
|
449
|
+
{tag: 'rp', attr: []},
|
450
|
+
{tag: 'rt', attr: []},
|
451
|
+
{tag: 'ruby', attr: []},
|
452
|
+
{tag: 's', attr: []},
|
453
|
+
{tag: 'samp', attr: []},
|
454
|
+
{tag: 'script', attr: [
|
455
|
+
{key: 'type', values: ["text/javascript"]},
|
456
|
+
{key: 'src', values: []},
|
457
|
+
{key: 'async', values: ["","async"]},
|
458
|
+
{key: 'defer', values: ["","defer"]},
|
459
|
+
{key: 'charset', values: ["utf-8"]}
|
460
|
+
]},
|
461
|
+
{tag: 'section', attr: []},
|
462
|
+
{tag: 'select', attr: [
|
463
|
+
{key: 'autofocus', values: ["", "autofocus"]},
|
464
|
+
{key: 'disabled', values: ["", "disabled"]},
|
465
|
+
{key: 'form', values: []},
|
466
|
+
{key: 'multiple', values: ["", "multiple"]},
|
467
|
+
{key: 'name', values: []},
|
468
|
+
{key: 'size', values: []}
|
469
|
+
]},
|
470
|
+
{tag: 'small', attr: []},
|
471
|
+
{tag: 'source', attr: [
|
472
|
+
{key: 'src', values: []},
|
473
|
+
{key: 'type', values: []},
|
474
|
+
{key: 'media', values: []}
|
475
|
+
]},
|
476
|
+
{tag: 'span', attr: []},
|
477
|
+
{tag: 'strike', attr: []},
|
478
|
+
{tag: 'strong', attr: []},
|
479
|
+
{tag: 'style', attr: [
|
480
|
+
{key: 'type', values: ["text/css"]},
|
481
|
+
{key: 'media', values: ["all","braille","print","projection","screen","speech"]},
|
482
|
+
{key: 'scoped', values: []}
|
483
|
+
]},
|
484
|
+
{tag: 'sub', attr: []},
|
485
|
+
{tag: 'summary', attr: []},
|
486
|
+
{tag: 'sup', attr: []},
|
487
|
+
{tag: 'table', attr: [
|
488
|
+
{key: 'border', values: []}
|
489
|
+
]},
|
490
|
+
{tag: 'tbody', attr: []},
|
491
|
+
{tag: 'td', attr: [
|
492
|
+
{key: 'colspan', values: []},
|
493
|
+
{key: 'rowspan', values: []},
|
494
|
+
{key: 'headers', values: []}
|
495
|
+
]},
|
496
|
+
{tag: 'textarea', attr: [
|
497
|
+
{key: 'autofocus', values: ["","autofocus"]},
|
498
|
+
{key: 'disabled', values: ["","disabled"]},
|
499
|
+
{key: 'dirname', values: []},
|
500
|
+
{key: 'form', values: []},
|
501
|
+
{key: 'maxlength', values: []},
|
502
|
+
{key: 'name', values: []},
|
503
|
+
{key: 'placeholder', values: []},
|
504
|
+
{key: 'readonly', values: ["","readonly"]},
|
505
|
+
{key: 'required', values: ["","required"]},
|
506
|
+
{key: 'rows', values: []},
|
507
|
+
{key: 'cols', values: []},
|
508
|
+
{key: 'wrap', values: ["soft","hard"]}
|
509
|
+
]},
|
510
|
+
{tag: 'tfoot', attr: []},
|
511
|
+
{tag: 'th', attr: [
|
512
|
+
{key: 'colspan', values: []},
|
513
|
+
{key: 'rowspan', values: []},
|
514
|
+
{key: 'headers', values: []},
|
515
|
+
{key: 'scope', values: ["row","col","rowgroup","colgroup"]}
|
516
|
+
]},
|
517
|
+
{tag: 'thead', attr: []},
|
518
|
+
{tag: 'time', attr: [
|
519
|
+
{key: 'datetime', values: []}
|
520
|
+
]},
|
521
|
+
{tag: 'title', attr: []},
|
522
|
+
{tag: 'tr', attr: []},
|
523
|
+
{tag: 'track', attr: [
|
524
|
+
{key: 'kind', values: ["subtitles","captions","descriptions","chapters","metadata"]},
|
525
|
+
{key: 'src', values: []},
|
526
|
+
{key: 'srclang', values: ["en","es"]},
|
527
|
+
{key: 'label', values: []},
|
528
|
+
{key: 'default', values: []}
|
529
|
+
]},
|
530
|
+
{tag: 'tt', attr: []},
|
531
|
+
{tag: 'u', attr: []},
|
532
|
+
{tag: 'ul', attr: []},
|
533
|
+
{tag: 'var', attr: []},
|
534
|
+
{tag: 'video', attr: [
|
535
|
+
{key: "src", values: []},
|
536
|
+
{key: "crossorigin", values: ["anonymous","use-credentials"]},
|
537
|
+
{key: "poster", values: []},
|
538
|
+
{key: "preload", values: ["auto","metadata","none"]},
|
539
|
+
{key: "autoplay", values: ["","autoplay"]},
|
540
|
+
{key: "mediagroup", values: ["movie"]},
|
541
|
+
{key: "loop", values: ["","loop"]},
|
542
|
+
{key: "muted", values: ["","muted"]},
|
543
|
+
{key: "controls", values: ["","controls"]},
|
544
|
+
{key: "width", values: []},
|
545
|
+
{key: "height", values: []}
|
546
|
+
]},
|
547
|
+
{tag: 'wbr', attr: []}
|
548
|
+
];
|
549
|
+
|
550
|
+
var globalAttributes = [
|
551
|
+
{key: "accesskey", values: ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"]},
|
552
|
+
{key: "class", values: []},
|
553
|
+
{key: "contenteditable", values: ["true", "false"]},
|
554
|
+
{key: "contextmenu", values: []},
|
555
|
+
{key: "dir", values: ["ltr","rtl","auto"]},
|
556
|
+
{key: "draggable", values: ["true","false","auto"]},
|
557
|
+
{key: "dropzone", values: ["copy","move","link","string:","file:"]},
|
558
|
+
{key: "hidden", values: ["hidden"]},
|
559
|
+
{key: "id", values: []},
|
560
|
+
{key: "inert", values: ["inert"]},
|
561
|
+
{key: "itemid", values: []},
|
562
|
+
{key: "itemprop", values: []},
|
563
|
+
{key: "itemref", values: []},
|
564
|
+
{key: "itemscope", values: ["itemscope"]},
|
565
|
+
{key: "itemtype", values: []},
|
566
|
+
{key: "lang", values: ["en","es"]},
|
567
|
+
{key: "spellcheck", values: ["true","false"]},
|
568
|
+
{key: "style", values: []},
|
569
|
+
{key: "tabindex", values: ["1","2","3","4","5","6","7","8","9"]},
|
570
|
+
{key: "title", values: []},
|
571
|
+
{key: "translate", values: ["yes","no"]},
|
572
|
+
{key: "onclick", values: []},
|
573
|
+
{key: 'rel', values: ["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]}
|
574
|
+
];
|
575
|
+
|
576
|
+
CodeMirror.htmlHint = function(editor) {
|
577
|
+
if(String.prototype.trim == undefined) {
|
578
|
+
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');};
|
579
|
+
}
|
580
|
+
return htmlHint(editor, htmlStructure, function (e, cur) { return e.getTokenAt(cur); });
|
581
|
+
};
|
582
|
+
})();
|
@@ -1,8 +1,10 @@
|
|
1
1
|
(function () {
|
2
|
+
var Pos = CodeMirror.Pos;
|
3
|
+
|
2
4
|
function forEach(arr, f) {
|
3
5
|
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
4
6
|
}
|
5
|
-
|
7
|
+
|
6
8
|
function arrayContains(arr, item) {
|
7
9
|
if (!Array.prototype.indexOf) {
|
8
10
|
var i = arr.length;
|
@@ -19,37 +21,39 @@
|
|
19
21
|
function scriptHint(editor, keywords, getToken, options) {
|
20
22
|
// Find the token at the cursor
|
21
23
|
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
|
24
|
+
token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
|
25
|
+
|
22
26
|
// If it's not a 'word-style' token, ignore the token.
|
23
|
-
|
27
|
+
if (!/^[\w$_]*$/.test(token.string)) {
|
24
28
|
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
25
29
|
type: token.string == "." ? "property" : null};
|
26
30
|
}
|
27
31
|
// If it is a property, find out what it is a property of.
|
28
32
|
while (tprop.type == "property") {
|
29
|
-
tprop = getToken(editor,
|
33
|
+
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
30
34
|
if (tprop.string != ".") return;
|
31
|
-
tprop = getToken(editor,
|
35
|
+
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
32
36
|
if (tprop.string == ')') {
|
33
37
|
var level = 1;
|
34
38
|
do {
|
35
|
-
tprop = getToken(editor,
|
39
|
+
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
36
40
|
switch (tprop.string) {
|
37
41
|
case ')': level++; break;
|
38
42
|
case '(': level--; break;
|
39
43
|
default: break;
|
40
44
|
}
|
41
45
|
} while (level > 0);
|
42
|
-
tprop = getToken(editor,
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
+
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
47
|
+
if (tprop.type.indexOf("variable") === 0)
|
48
|
+
tprop.type = "function";
|
49
|
+
else return; // no clue
|
46
50
|
}
|
47
51
|
if (!context) var context = [];
|
48
52
|
context.push(tprop);
|
49
53
|
}
|
50
54
|
return {list: getCompletions(token, context, keywords, options),
|
51
|
-
from:
|
52
|
-
to:
|
55
|
+
from: Pos(cur.line, token.start),
|
56
|
+
to: Pos(cur.line, token.end)};
|
53
57
|
}
|
54
58
|
|
55
59
|
CodeMirror.javascriptHint = function(editor, options) {
|