formagic 0.3.9 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/formagic.coffee +5 -2
- data/app/assets/javascripts/formagic/form.coffee +4 -1
- data/app/assets/javascripts/formagic/inputs/ace-css.coffee +25 -0
- data/app/assets/javascripts/formagic/inputs/ace-html.coffee +25 -0
- data/app/assets/javascripts/formagic/inputs/ace-js.coffee +25 -0
- data/app/assets/javascripts/formagic/inputs/ace-markdown.coffee +51 -0
- data/app/assets/javascripts/formagic/inputs/{markdown_toolbar.coffee → ace-markdown_toolbar.coffee} +27 -7
- data/app/assets/javascripts/formagic/inputs/{html.coffee → ace.coffee} +27 -29
- data/app/assets/javascripts/formagic/inputs/documents_reorder.coffee +3 -0
- data/app/assets/javascripts/formagic/inputs/list_reorder.coffee +2 -0
- data/app/assets/javascripts/formagic/inputs/url.coffee +1 -1
- data/app/assets/javascripts/vendor/ace.js +264 -123
- data/app/assets/javascripts/vendor/mode-css.js +1008 -0
- data/app/assets/javascripts/vendor/mode-html.js +488 -129
- data/app/assets/javascripts/vendor/mode-javascript.js +1154 -0
- data/app/assets/javascripts/vendor/mode-markdown.js +489 -129
- data/app/assets/javascripts/vendor/slip.js +792 -0
- data/app/assets/stylesheets/formagic.scss +9 -1
- data/app/assets/stylesheets/formagic/{nested-form.scss → documents.scss} +0 -0
- data/app/assets/stylesheets/formagic/markdown.scss +4 -1
- data/app/assets/stylesheets/formagic/switch.scss +1 -1
- data/lib/formagic/version.rb +1 -1
- metadata +12 -6
- data/app/assets/javascripts/formagic/inputs/markdown.coffee +0 -94
@@ -0,0 +1,1008 @@
|
|
1
|
+
define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var oop = require("../lib/oop");
|
5
|
+
var lang = require("../lib/lang");
|
6
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
7
|
+
var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|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|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|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-after|cue-before|cue|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|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|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|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
|
8
|
+
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
|
9
|
+
var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
|
10
|
+
var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
|
11
|
+
var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
|
12
|
+
|
13
|
+
var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
14
|
+
var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
15
|
+
var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
16
|
+
|
17
|
+
var CssHighlightRules = function() {
|
18
|
+
|
19
|
+
var keywordMapper = this.createKeywordMapper({
|
20
|
+
"support.function": supportFunction,
|
21
|
+
"support.constant": supportConstant,
|
22
|
+
"support.type": supportType,
|
23
|
+
"support.constant.color": supportConstantColor,
|
24
|
+
"support.constant.fonts": supportConstantFonts
|
25
|
+
}, "text", true);
|
26
|
+
|
27
|
+
this.$rules = {
|
28
|
+
"start" : [{
|
29
|
+
token : "comment", // multi line comment
|
30
|
+
regex : "\\/\\*",
|
31
|
+
push : "comment"
|
32
|
+
}, {
|
33
|
+
token: "paren.lparen",
|
34
|
+
regex: "\\{",
|
35
|
+
push: "ruleset"
|
36
|
+
}, {
|
37
|
+
token: "string",
|
38
|
+
regex: "@.*?{",
|
39
|
+
push: "media"
|
40
|
+
}, {
|
41
|
+
token: "keyword",
|
42
|
+
regex: "#[a-z0-9-_]+"
|
43
|
+
}, {
|
44
|
+
token: "variable",
|
45
|
+
regex: "\\.[a-z0-9-_]+"
|
46
|
+
}, {
|
47
|
+
token: "string",
|
48
|
+
regex: ":[a-z0-9-_]+"
|
49
|
+
}, {
|
50
|
+
token: "constant",
|
51
|
+
regex: "[a-z0-9-_]+"
|
52
|
+
}, {
|
53
|
+
caseInsensitive: true
|
54
|
+
}],
|
55
|
+
|
56
|
+
"media" : [{
|
57
|
+
token : "comment", // multi line comment
|
58
|
+
regex : "\\/\\*",
|
59
|
+
push : "comment"
|
60
|
+
}, {
|
61
|
+
token: "paren.lparen",
|
62
|
+
regex: "\\{",
|
63
|
+
push: "ruleset"
|
64
|
+
}, {
|
65
|
+
token: "string",
|
66
|
+
regex: "\\}",
|
67
|
+
next: "pop"
|
68
|
+
}, {
|
69
|
+
token: "keyword",
|
70
|
+
regex: "#[a-z0-9-_]+"
|
71
|
+
}, {
|
72
|
+
token: "variable",
|
73
|
+
regex: "\\.[a-z0-9-_]+"
|
74
|
+
}, {
|
75
|
+
token: "string",
|
76
|
+
regex: ":[a-z0-9-_]+"
|
77
|
+
}, {
|
78
|
+
token: "constant",
|
79
|
+
regex: "[a-z0-9-_]+"
|
80
|
+
}, {
|
81
|
+
caseInsensitive: true
|
82
|
+
}],
|
83
|
+
|
84
|
+
"comment" : [{
|
85
|
+
token : "comment",
|
86
|
+
regex : "\\*\\/",
|
87
|
+
next : "pop"
|
88
|
+
}, {
|
89
|
+
defaultToken : "comment"
|
90
|
+
}],
|
91
|
+
|
92
|
+
"ruleset" : [
|
93
|
+
{
|
94
|
+
token : "paren.rparen",
|
95
|
+
regex : "\\}",
|
96
|
+
next: "pop"
|
97
|
+
}, {
|
98
|
+
token : "comment", // multi line comment
|
99
|
+
regex : "\\/\\*",
|
100
|
+
push : "comment"
|
101
|
+
}, {
|
102
|
+
token : "string", // single line
|
103
|
+
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
104
|
+
}, {
|
105
|
+
token : "string", // single line
|
106
|
+
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
107
|
+
}, {
|
108
|
+
token : ["constant.numeric", "keyword"],
|
109
|
+
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
110
|
+
}, {
|
111
|
+
token : "constant.numeric",
|
112
|
+
regex : numRe
|
113
|
+
}, {
|
114
|
+
token : "constant.numeric", // hex6 color
|
115
|
+
regex : "#[a-f0-9]{6}"
|
116
|
+
}, {
|
117
|
+
token : "constant.numeric", // hex3 color
|
118
|
+
regex : "#[a-f0-9]{3}"
|
119
|
+
}, {
|
120
|
+
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
121
|
+
regex : pseudoElements
|
122
|
+
}, {
|
123
|
+
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
124
|
+
regex : pseudoClasses
|
125
|
+
}, {
|
126
|
+
token : ["support.function", "string", "support.function"],
|
127
|
+
regex : "(url\\()(.*)(\\))"
|
128
|
+
}, {
|
129
|
+
token : keywordMapper,
|
130
|
+
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
131
|
+
}, {
|
132
|
+
caseInsensitive: true
|
133
|
+
}]
|
134
|
+
};
|
135
|
+
|
136
|
+
this.normalizeRules();
|
137
|
+
};
|
138
|
+
|
139
|
+
oop.inherits(CssHighlightRules, TextHighlightRules);
|
140
|
+
|
141
|
+
exports.CssHighlightRules = CssHighlightRules;
|
142
|
+
|
143
|
+
});
|
144
|
+
|
145
|
+
define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
|
146
|
+
"use strict";
|
147
|
+
|
148
|
+
var Range = require("../range").Range;
|
149
|
+
|
150
|
+
var MatchingBraceOutdent = function() {};
|
151
|
+
|
152
|
+
(function() {
|
153
|
+
|
154
|
+
this.checkOutdent = function(line, input) {
|
155
|
+
if (! /^\s+$/.test(line))
|
156
|
+
return false;
|
157
|
+
|
158
|
+
return /^\s*\}/.test(input);
|
159
|
+
};
|
160
|
+
|
161
|
+
this.autoOutdent = function(doc, row) {
|
162
|
+
var line = doc.getLine(row);
|
163
|
+
var match = line.match(/^(\s*\})/);
|
164
|
+
|
165
|
+
if (!match) return 0;
|
166
|
+
|
167
|
+
var column = match[1].length;
|
168
|
+
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
169
|
+
|
170
|
+
if (!openBracePos || openBracePos.row == row) return 0;
|
171
|
+
|
172
|
+
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
173
|
+
doc.replace(new Range(row, 0, row, column-1), indent);
|
174
|
+
};
|
175
|
+
|
176
|
+
this.$getIndent = function(line) {
|
177
|
+
return line.match(/^\s*/)[0];
|
178
|
+
};
|
179
|
+
|
180
|
+
}).call(MatchingBraceOutdent.prototype);
|
181
|
+
|
182
|
+
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
183
|
+
});
|
184
|
+
|
185
|
+
define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
|
186
|
+
"use strict";
|
187
|
+
|
188
|
+
var propertyMap = {
|
189
|
+
"background": {"#$0": 1},
|
190
|
+
"background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
|
191
|
+
"background-image": {"url('/$0')": 1},
|
192
|
+
"background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
|
193
|
+
"background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2,},
|
194
|
+
"background-attachment": {"scroll": 1, "fixed": 1},
|
195
|
+
"background-size": {"cover": 1, "contain": 1},
|
196
|
+
"background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
|
197
|
+
"background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
|
198
|
+
"border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
|
199
|
+
"border-color": {"#$0": 1},
|
200
|
+
"border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2,},
|
201
|
+
"border-collapse": {"collapse": 1, "separate": 1},
|
202
|
+
"bottom": {"px": 1, "em": 1, "%": 1},
|
203
|
+
"clear": {"left": 1, "right": 1, "both": 1, "none": 1},
|
204
|
+
"color": {"#$0": 1, "rgb(#$00,0,0)": 1},
|
205
|
+
"cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
|
206
|
+
"display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
|
207
|
+
"empty-cells": {"show": 1, "hide": 1},
|
208
|
+
"float": {"left": 1, "right": 1, "none": 1},
|
209
|
+
"font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
|
210
|
+
"font-size": {"px": 1, "em": 1, "%": 1},
|
211
|
+
"font-weight": {"bold": 1, "normal": 1},
|
212
|
+
"font-style": {"italic": 1, "normal": 1},
|
213
|
+
"font-variant": {"normal": 1, "small-caps": 1},
|
214
|
+
"height": {"px": 1, "em": 1, "%": 1},
|
215
|
+
"left": {"px": 1, "em": 1, "%": 1},
|
216
|
+
"letter-spacing": {"normal": 1},
|
217
|
+
"line-height": {"normal": 1},
|
218
|
+
"list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
|
219
|
+
"margin": {"px": 1, "em": 1, "%": 1},
|
220
|
+
"margin-right": {"px": 1, "em": 1, "%": 1},
|
221
|
+
"margin-left": {"px": 1, "em": 1, "%": 1},
|
222
|
+
"margin-top": {"px": 1, "em": 1, "%": 1},
|
223
|
+
"margin-bottom": {"px": 1, "em": 1, "%": 1},
|
224
|
+
"max-height": {"px": 1, "em": 1, "%": 1},
|
225
|
+
"max-width": {"px": 1, "em": 1, "%": 1},
|
226
|
+
"min-height": {"px": 1, "em": 1, "%": 1},
|
227
|
+
"min-width": {"px": 1, "em": 1, "%": 1},
|
228
|
+
"overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
|
229
|
+
"overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
|
230
|
+
"overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
|
231
|
+
"padding": {"px": 1, "em": 1, "%": 1},
|
232
|
+
"padding-top": {"px": 1, "em": 1, "%": 1},
|
233
|
+
"padding-right": {"px": 1, "em": 1, "%": 1},
|
234
|
+
"padding-bottom": {"px": 1, "em": 1, "%": 1},
|
235
|
+
"padding-left": {"px": 1, "em": 1, "%": 1},
|
236
|
+
"page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
|
237
|
+
"page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
|
238
|
+
"position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
|
239
|
+
"right": {"px": 1, "em": 1, "%": 1},
|
240
|
+
"table-layout": {"fixed": 1, "auto": 1},
|
241
|
+
"text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
|
242
|
+
"text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
|
243
|
+
"text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
|
244
|
+
"top": {"px": 1, "em": 1, "%": 1},
|
245
|
+
"vertical-align": {"top": 1, "bottom": 1},
|
246
|
+
"visibility": {"hidden": 1, "visible": 1},
|
247
|
+
"white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
|
248
|
+
"width": {"px": 1, "em": 1, "%": 1},
|
249
|
+
"word-spacing": {"normal": 1},
|
250
|
+
"filter": {"alpha(opacity=$0100)": 1},
|
251
|
+
|
252
|
+
"text-shadow": {"$02px 2px 2px #777": 1},
|
253
|
+
"text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
|
254
|
+
"-moz-border-radius": 1,
|
255
|
+
"-moz-border-radius-topright": 1,
|
256
|
+
"-moz-border-radius-bottomright": 1,
|
257
|
+
"-moz-border-radius-topleft": 1,
|
258
|
+
"-moz-border-radius-bottomleft": 1,
|
259
|
+
"-webkit-border-radius": 1,
|
260
|
+
"-webkit-border-top-right-radius": 1,
|
261
|
+
"-webkit-border-top-left-radius": 1,
|
262
|
+
"-webkit-border-bottom-right-radius": 1,
|
263
|
+
"-webkit-border-bottom-left-radius": 1,
|
264
|
+
"-moz-box-shadow": 1,
|
265
|
+
"-webkit-box-shadow": 1,
|
266
|
+
"transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
|
267
|
+
"-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
|
268
|
+
"-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
|
269
|
+
};
|
270
|
+
|
271
|
+
var CssCompletions = function() {
|
272
|
+
|
273
|
+
};
|
274
|
+
|
275
|
+
(function() {
|
276
|
+
|
277
|
+
this.completionsDefined = false;
|
278
|
+
|
279
|
+
this.defineCompletions = function() {
|
280
|
+
if (document) {
|
281
|
+
var style = document.createElement('c').style;
|
282
|
+
|
283
|
+
for (var i in style) {
|
284
|
+
if (typeof style[i] !== 'string')
|
285
|
+
continue;
|
286
|
+
|
287
|
+
var name = i.replace(/[A-Z]/g, function(x) {
|
288
|
+
return '-' + x.toLowerCase();
|
289
|
+
});
|
290
|
+
|
291
|
+
if (!propertyMap.hasOwnProperty(name))
|
292
|
+
propertyMap[name] = 1;
|
293
|
+
}
|
294
|
+
}
|
295
|
+
|
296
|
+
this.completionsDefined = true;
|
297
|
+
}
|
298
|
+
|
299
|
+
this.getCompletions = function(state, session, pos, prefix) {
|
300
|
+
if (!this.completionsDefined) {
|
301
|
+
this.defineCompletions();
|
302
|
+
}
|
303
|
+
|
304
|
+
var token = session.getTokenAt(pos.row, pos.column);
|
305
|
+
|
306
|
+
if (!token)
|
307
|
+
return [];
|
308
|
+
if (state==='ruleset'){
|
309
|
+
var line = session.getLine(pos.row).substr(0, pos.column);
|
310
|
+
if (/:[^;]+$/.test(line)) {
|
311
|
+
/([\w\-]+):[^:]*$/.test(line);
|
312
|
+
|
313
|
+
return this.getPropertyValueCompletions(state, session, pos, prefix);
|
314
|
+
} else {
|
315
|
+
return this.getPropertyCompletions(state, session, pos, prefix);
|
316
|
+
}
|
317
|
+
}
|
318
|
+
|
319
|
+
return [];
|
320
|
+
};
|
321
|
+
|
322
|
+
this.getPropertyCompletions = function(state, session, pos, prefix) {
|
323
|
+
var properties = Object.keys(propertyMap);
|
324
|
+
return properties.map(function(property){
|
325
|
+
return {
|
326
|
+
caption: property,
|
327
|
+
snippet: property + ': $0',
|
328
|
+
meta: "property",
|
329
|
+
score: Number.MAX_VALUE
|
330
|
+
};
|
331
|
+
});
|
332
|
+
};
|
333
|
+
|
334
|
+
this.getPropertyValueCompletions = function(state, session, pos, prefix) {
|
335
|
+
var line = session.getLine(pos.row).substr(0, pos.column);
|
336
|
+
var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
|
337
|
+
|
338
|
+
if (!property)
|
339
|
+
return [];
|
340
|
+
var values = [];
|
341
|
+
if (property in propertyMap && typeof propertyMap[property] === "object") {
|
342
|
+
values = Object.keys(propertyMap[property]);
|
343
|
+
}
|
344
|
+
return values.map(function(value){
|
345
|
+
return {
|
346
|
+
caption: value,
|
347
|
+
snippet: value,
|
348
|
+
meta: "property value",
|
349
|
+
score: Number.MAX_VALUE
|
350
|
+
};
|
351
|
+
});
|
352
|
+
};
|
353
|
+
|
354
|
+
}).call(CssCompletions.prototype);
|
355
|
+
|
356
|
+
exports.CssCompletions = CssCompletions;
|
357
|
+
});
|
358
|
+
|
359
|
+
define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
|
360
|
+
"use strict";
|
361
|
+
|
362
|
+
var oop = require("../../lib/oop");
|
363
|
+
var Behaviour = require("../behaviour").Behaviour;
|
364
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
365
|
+
var lang = require("../../lib/lang");
|
366
|
+
|
367
|
+
var SAFE_INSERT_IN_TOKENS =
|
368
|
+
["text", "paren.rparen", "punctuation.operator"];
|
369
|
+
var SAFE_INSERT_BEFORE_TOKENS =
|
370
|
+
["text", "paren.rparen", "punctuation.operator", "comment"];
|
371
|
+
|
372
|
+
var context;
|
373
|
+
var contextCache = {};
|
374
|
+
var initContext = function(editor) {
|
375
|
+
var id = -1;
|
376
|
+
if (editor.multiSelect) {
|
377
|
+
id = editor.selection.index;
|
378
|
+
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
379
|
+
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
380
|
+
}
|
381
|
+
if (contextCache[id])
|
382
|
+
return context = contextCache[id];
|
383
|
+
context = contextCache[id] = {
|
384
|
+
autoInsertedBrackets: 0,
|
385
|
+
autoInsertedRow: -1,
|
386
|
+
autoInsertedLineEnd: "",
|
387
|
+
maybeInsertedBrackets: 0,
|
388
|
+
maybeInsertedRow: -1,
|
389
|
+
maybeInsertedLineStart: "",
|
390
|
+
maybeInsertedLineEnd: ""
|
391
|
+
};
|
392
|
+
};
|
393
|
+
|
394
|
+
var getWrapped = function(selection, selected, opening, closing) {
|
395
|
+
var rowDiff = selection.end.row - selection.start.row;
|
396
|
+
return {
|
397
|
+
text: opening + selected + closing,
|
398
|
+
selection: [
|
399
|
+
0,
|
400
|
+
selection.start.column + 1,
|
401
|
+
rowDiff,
|
402
|
+
selection.end.column + (rowDiff ? 0 : 1)
|
403
|
+
]
|
404
|
+
};
|
405
|
+
};
|
406
|
+
|
407
|
+
var CstyleBehaviour = function() {
|
408
|
+
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
409
|
+
var cursor = editor.getCursorPosition();
|
410
|
+
var line = session.doc.getLine(cursor.row);
|
411
|
+
if (text == '{') {
|
412
|
+
initContext(editor);
|
413
|
+
var selection = editor.getSelectionRange();
|
414
|
+
var selected = session.doc.getTextRange(selection);
|
415
|
+
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
416
|
+
return getWrapped(selection, selected, '{', '}');
|
417
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
418
|
+
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
419
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
420
|
+
return {
|
421
|
+
text: '{}',
|
422
|
+
selection: [1, 1]
|
423
|
+
};
|
424
|
+
} else {
|
425
|
+
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
426
|
+
return {
|
427
|
+
text: '{',
|
428
|
+
selection: [1, 1]
|
429
|
+
};
|
430
|
+
}
|
431
|
+
}
|
432
|
+
} else if (text == '}') {
|
433
|
+
initContext(editor);
|
434
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
435
|
+
if (rightChar == '}') {
|
436
|
+
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
437
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
438
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
439
|
+
return {
|
440
|
+
text: '',
|
441
|
+
selection: [1, 1]
|
442
|
+
};
|
443
|
+
}
|
444
|
+
}
|
445
|
+
} else if (text == "\n" || text == "\r\n") {
|
446
|
+
initContext(editor);
|
447
|
+
var closing = "";
|
448
|
+
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
449
|
+
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
|
450
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
451
|
+
}
|
452
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
453
|
+
if (rightChar === '}') {
|
454
|
+
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
455
|
+
if (!openBracePos)
|
456
|
+
return null;
|
457
|
+
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
458
|
+
} else if (closing) {
|
459
|
+
var next_indent = this.$getIndent(line);
|
460
|
+
} else {
|
461
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
462
|
+
return;
|
463
|
+
}
|
464
|
+
var indent = next_indent + session.getTabString();
|
465
|
+
|
466
|
+
return {
|
467
|
+
text: '\n' + indent + '\n' + next_indent + closing,
|
468
|
+
selection: [1, indent.length, 1, indent.length]
|
469
|
+
};
|
470
|
+
} else {
|
471
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
472
|
+
}
|
473
|
+
});
|
474
|
+
|
475
|
+
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
476
|
+
var selected = session.doc.getTextRange(range);
|
477
|
+
if (!range.isMultiLine() && selected == '{') {
|
478
|
+
initContext(editor);
|
479
|
+
var line = session.doc.getLine(range.start.row);
|
480
|
+
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
481
|
+
if (rightChar == '}') {
|
482
|
+
range.end.column++;
|
483
|
+
return range;
|
484
|
+
} else {
|
485
|
+
context.maybeInsertedBrackets--;
|
486
|
+
}
|
487
|
+
}
|
488
|
+
});
|
489
|
+
|
490
|
+
this.add("parens", "insertion", function(state, action, editor, session, text) {
|
491
|
+
if (text == '(') {
|
492
|
+
initContext(editor);
|
493
|
+
var selection = editor.getSelectionRange();
|
494
|
+
var selected = session.doc.getTextRange(selection);
|
495
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
496
|
+
return getWrapped(selection, selected, '(', ')');
|
497
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
498
|
+
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
499
|
+
return {
|
500
|
+
text: '()',
|
501
|
+
selection: [1, 1]
|
502
|
+
};
|
503
|
+
}
|
504
|
+
} else if (text == ')') {
|
505
|
+
initContext(editor);
|
506
|
+
var cursor = editor.getCursorPosition();
|
507
|
+
var line = session.doc.getLine(cursor.row);
|
508
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
509
|
+
if (rightChar == ')') {
|
510
|
+
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
511
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
512
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
513
|
+
return {
|
514
|
+
text: '',
|
515
|
+
selection: [1, 1]
|
516
|
+
};
|
517
|
+
}
|
518
|
+
}
|
519
|
+
}
|
520
|
+
});
|
521
|
+
|
522
|
+
this.add("parens", "deletion", function(state, action, editor, session, range) {
|
523
|
+
var selected = session.doc.getTextRange(range);
|
524
|
+
if (!range.isMultiLine() && selected == '(') {
|
525
|
+
initContext(editor);
|
526
|
+
var line = session.doc.getLine(range.start.row);
|
527
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
528
|
+
if (rightChar == ')') {
|
529
|
+
range.end.column++;
|
530
|
+
return range;
|
531
|
+
}
|
532
|
+
}
|
533
|
+
});
|
534
|
+
|
535
|
+
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
536
|
+
if (text == '[') {
|
537
|
+
initContext(editor);
|
538
|
+
var selection = editor.getSelectionRange();
|
539
|
+
var selected = session.doc.getTextRange(selection);
|
540
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
541
|
+
return getWrapped(selection, selected, '[', ']');
|
542
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
543
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
544
|
+
return {
|
545
|
+
text: '[]',
|
546
|
+
selection: [1, 1]
|
547
|
+
};
|
548
|
+
}
|
549
|
+
} else if (text == ']') {
|
550
|
+
initContext(editor);
|
551
|
+
var cursor = editor.getCursorPosition();
|
552
|
+
var line = session.doc.getLine(cursor.row);
|
553
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
554
|
+
if (rightChar == ']') {
|
555
|
+
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
556
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
557
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
558
|
+
return {
|
559
|
+
text: '',
|
560
|
+
selection: [1, 1]
|
561
|
+
};
|
562
|
+
}
|
563
|
+
}
|
564
|
+
}
|
565
|
+
});
|
566
|
+
|
567
|
+
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
568
|
+
var selected = session.doc.getTextRange(range);
|
569
|
+
if (!range.isMultiLine() && selected == '[') {
|
570
|
+
initContext(editor);
|
571
|
+
var line = session.doc.getLine(range.start.row);
|
572
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
573
|
+
if (rightChar == ']') {
|
574
|
+
range.end.column++;
|
575
|
+
return range;
|
576
|
+
}
|
577
|
+
}
|
578
|
+
});
|
579
|
+
|
580
|
+
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
|
581
|
+
if (text == '"' || text == "'") {
|
582
|
+
initContext(editor);
|
583
|
+
var quote = text;
|
584
|
+
var selection = editor.getSelectionRange();
|
585
|
+
var selected = session.doc.getTextRange(selection);
|
586
|
+
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
587
|
+
return getWrapped(selection, selected, quote, quote);
|
588
|
+
} else if (!selected) {
|
589
|
+
var cursor = editor.getCursorPosition();
|
590
|
+
var line = session.doc.getLine(cursor.row);
|
591
|
+
var leftChar = line.substring(cursor.column-1, cursor.column);
|
592
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
593
|
+
|
594
|
+
var token = session.getTokenAt(cursor.row, cursor.column);
|
595
|
+
var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
|
596
|
+
if (leftChar == "\\" && token && /escape/.test(token.type))
|
597
|
+
return null;
|
598
|
+
|
599
|
+
var stringBefore = token && /string|escape/.test(token.type);
|
600
|
+
var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
|
601
|
+
|
602
|
+
var pair;
|
603
|
+
if (rightChar == quote) {
|
604
|
+
pair = stringBefore !== stringAfter;
|
605
|
+
} else {
|
606
|
+
if (stringBefore && !stringAfter)
|
607
|
+
return null; // wrap string with different quote
|
608
|
+
if (stringBefore && stringAfter)
|
609
|
+
return null; // do not pair quotes inside strings
|
610
|
+
var wordRe = session.$mode.tokenRe;
|
611
|
+
wordRe.lastIndex = 0;
|
612
|
+
var isWordBefore = wordRe.test(leftChar);
|
613
|
+
wordRe.lastIndex = 0;
|
614
|
+
var isWordAfter = wordRe.test(leftChar);
|
615
|
+
if (isWordBefore || isWordAfter)
|
616
|
+
return null; // before or after alphanumeric
|
617
|
+
if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
|
618
|
+
return null; // there is rightChar and it isn't closing
|
619
|
+
pair = true;
|
620
|
+
}
|
621
|
+
return {
|
622
|
+
text: pair ? quote + quote : "",
|
623
|
+
selection: [1,1]
|
624
|
+
};
|
625
|
+
}
|
626
|
+
}
|
627
|
+
});
|
628
|
+
|
629
|
+
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
|
630
|
+
var selected = session.doc.getTextRange(range);
|
631
|
+
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
632
|
+
initContext(editor);
|
633
|
+
var line = session.doc.getLine(range.start.row);
|
634
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
635
|
+
if (rightChar == selected) {
|
636
|
+
range.end.column++;
|
637
|
+
return range;
|
638
|
+
}
|
639
|
+
}
|
640
|
+
});
|
641
|
+
|
642
|
+
};
|
643
|
+
|
644
|
+
|
645
|
+
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
646
|
+
var cursor = editor.getCursorPosition();
|
647
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
648
|
+
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
649
|
+
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
650
|
+
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
651
|
+
return false;
|
652
|
+
}
|
653
|
+
iterator.stepForward();
|
654
|
+
return iterator.getCurrentTokenRow() !== cursor.row ||
|
655
|
+
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
656
|
+
};
|
657
|
+
|
658
|
+
CstyleBehaviour.$matchTokenType = function(token, types) {
|
659
|
+
return types.indexOf(token.type || token) > -1;
|
660
|
+
};
|
661
|
+
|
662
|
+
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
663
|
+
var cursor = editor.getCursorPosition();
|
664
|
+
var line = session.doc.getLine(cursor.row);
|
665
|
+
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
666
|
+
context.autoInsertedBrackets = 0;
|
667
|
+
context.autoInsertedRow = cursor.row;
|
668
|
+
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
669
|
+
context.autoInsertedBrackets++;
|
670
|
+
};
|
671
|
+
|
672
|
+
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
673
|
+
var cursor = editor.getCursorPosition();
|
674
|
+
var line = session.doc.getLine(cursor.row);
|
675
|
+
if (!this.isMaybeInsertedClosing(cursor, line))
|
676
|
+
context.maybeInsertedBrackets = 0;
|
677
|
+
context.maybeInsertedRow = cursor.row;
|
678
|
+
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
679
|
+
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
680
|
+
context.maybeInsertedBrackets++;
|
681
|
+
};
|
682
|
+
|
683
|
+
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
684
|
+
return context.autoInsertedBrackets > 0 &&
|
685
|
+
cursor.row === context.autoInsertedRow &&
|
686
|
+
bracket === context.autoInsertedLineEnd[0] &&
|
687
|
+
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
688
|
+
};
|
689
|
+
|
690
|
+
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
691
|
+
return context.maybeInsertedBrackets > 0 &&
|
692
|
+
cursor.row === context.maybeInsertedRow &&
|
693
|
+
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
694
|
+
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
695
|
+
};
|
696
|
+
|
697
|
+
CstyleBehaviour.popAutoInsertedClosing = function() {
|
698
|
+
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
699
|
+
context.autoInsertedBrackets--;
|
700
|
+
};
|
701
|
+
|
702
|
+
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
703
|
+
if (context) {
|
704
|
+
context.maybeInsertedBrackets = 0;
|
705
|
+
context.maybeInsertedRow = -1;
|
706
|
+
}
|
707
|
+
};
|
708
|
+
|
709
|
+
|
710
|
+
|
711
|
+
oop.inherits(CstyleBehaviour, Behaviour);
|
712
|
+
|
713
|
+
exports.CstyleBehaviour = CstyleBehaviour;
|
714
|
+
});
|
715
|
+
|
716
|
+
define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
|
717
|
+
"use strict";
|
718
|
+
|
719
|
+
var oop = require("../../lib/oop");
|
720
|
+
var Behaviour = require("../behaviour").Behaviour;
|
721
|
+
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
722
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
723
|
+
|
724
|
+
var CssBehaviour = function () {
|
725
|
+
|
726
|
+
this.inherit(CstyleBehaviour);
|
727
|
+
|
728
|
+
this.add("colon", "insertion", function (state, action, editor, session, text) {
|
729
|
+
if (text === ':') {
|
730
|
+
var cursor = editor.getCursorPosition();
|
731
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
732
|
+
var token = iterator.getCurrentToken();
|
733
|
+
if (token && token.value.match(/\s+/)) {
|
734
|
+
token = iterator.stepBackward();
|
735
|
+
}
|
736
|
+
if (token && token.type === 'support.type') {
|
737
|
+
var line = session.doc.getLine(cursor.row);
|
738
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
739
|
+
if (rightChar === ':') {
|
740
|
+
return {
|
741
|
+
text: '',
|
742
|
+
selection: [1, 1]
|
743
|
+
}
|
744
|
+
}
|
745
|
+
if (!line.substring(cursor.column).match(/^\s*;/)) {
|
746
|
+
return {
|
747
|
+
text: ':;',
|
748
|
+
selection: [1, 1]
|
749
|
+
}
|
750
|
+
}
|
751
|
+
}
|
752
|
+
}
|
753
|
+
});
|
754
|
+
|
755
|
+
this.add("colon", "deletion", function (state, action, editor, session, range) {
|
756
|
+
var selected = session.doc.getTextRange(range);
|
757
|
+
if (!range.isMultiLine() && selected === ':') {
|
758
|
+
var cursor = editor.getCursorPosition();
|
759
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
760
|
+
var token = iterator.getCurrentToken();
|
761
|
+
if (token && token.value.match(/\s+/)) {
|
762
|
+
token = iterator.stepBackward();
|
763
|
+
}
|
764
|
+
if (token && token.type === 'support.type') {
|
765
|
+
var line = session.doc.getLine(range.start.row);
|
766
|
+
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
767
|
+
if (rightChar === ';') {
|
768
|
+
range.end.column ++;
|
769
|
+
return range;
|
770
|
+
}
|
771
|
+
}
|
772
|
+
}
|
773
|
+
});
|
774
|
+
|
775
|
+
this.add("semicolon", "insertion", function (state, action, editor, session, text) {
|
776
|
+
if (text === ';') {
|
777
|
+
var cursor = editor.getCursorPosition();
|
778
|
+
var line = session.doc.getLine(cursor.row);
|
779
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
780
|
+
if (rightChar === ';') {
|
781
|
+
return {
|
782
|
+
text: '',
|
783
|
+
selection: [1, 1]
|
784
|
+
}
|
785
|
+
}
|
786
|
+
}
|
787
|
+
});
|
788
|
+
|
789
|
+
}
|
790
|
+
oop.inherits(CssBehaviour, CstyleBehaviour);
|
791
|
+
|
792
|
+
exports.CssBehaviour = CssBehaviour;
|
793
|
+
});
|
794
|
+
|
795
|
+
define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
796
|
+
"use strict";
|
797
|
+
|
798
|
+
var oop = require("../../lib/oop");
|
799
|
+
var Range = require("../../range").Range;
|
800
|
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
801
|
+
|
802
|
+
var FoldMode = exports.FoldMode = function(commentRegex) {
|
803
|
+
if (commentRegex) {
|
804
|
+
this.foldingStartMarker = new RegExp(
|
805
|
+
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
806
|
+
);
|
807
|
+
this.foldingStopMarker = new RegExp(
|
808
|
+
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
809
|
+
);
|
810
|
+
}
|
811
|
+
};
|
812
|
+
oop.inherits(FoldMode, BaseFoldMode);
|
813
|
+
|
814
|
+
(function() {
|
815
|
+
|
816
|
+
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
817
|
+
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
818
|
+
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
819
|
+
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
820
|
+
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
821
|
+
this._getFoldWidgetBase = this.getFoldWidget;
|
822
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
823
|
+
var line = session.getLine(row);
|
824
|
+
|
825
|
+
if (this.singleLineBlockCommentRe.test(line)) {
|
826
|
+
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
827
|
+
return "";
|
828
|
+
}
|
829
|
+
|
830
|
+
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
831
|
+
|
832
|
+
if (!fw && this.startRegionRe.test(line))
|
833
|
+
return "start"; // lineCommentRegionStart
|
834
|
+
|
835
|
+
return fw;
|
836
|
+
};
|
837
|
+
|
838
|
+
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
839
|
+
var line = session.getLine(row);
|
840
|
+
|
841
|
+
if (this.startRegionRe.test(line))
|
842
|
+
return this.getCommentRegionBlock(session, line, row);
|
843
|
+
|
844
|
+
var match = line.match(this.foldingStartMarker);
|
845
|
+
if (match) {
|
846
|
+
var i = match.index;
|
847
|
+
|
848
|
+
if (match[1])
|
849
|
+
return this.openingBracketBlock(session, match[1], row, i);
|
850
|
+
|
851
|
+
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
852
|
+
|
853
|
+
if (range && !range.isMultiLine()) {
|
854
|
+
if (forceMultiline) {
|
855
|
+
range = this.getSectionRange(session, row);
|
856
|
+
} else if (foldStyle != "all")
|
857
|
+
range = null;
|
858
|
+
}
|
859
|
+
|
860
|
+
return range;
|
861
|
+
}
|
862
|
+
|
863
|
+
if (foldStyle === "markbegin")
|
864
|
+
return;
|
865
|
+
|
866
|
+
var match = line.match(this.foldingStopMarker);
|
867
|
+
if (match) {
|
868
|
+
var i = match.index + match[0].length;
|
869
|
+
|
870
|
+
if (match[1])
|
871
|
+
return this.closingBracketBlock(session, match[1], row, i);
|
872
|
+
|
873
|
+
return session.getCommentFoldRange(row, i, -1);
|
874
|
+
}
|
875
|
+
};
|
876
|
+
|
877
|
+
this.getSectionRange = function(session, row) {
|
878
|
+
var line = session.getLine(row);
|
879
|
+
var startIndent = line.search(/\S/);
|
880
|
+
var startRow = row;
|
881
|
+
var startColumn = line.length;
|
882
|
+
row = row + 1;
|
883
|
+
var endRow = row;
|
884
|
+
var maxRow = session.getLength();
|
885
|
+
while (++row < maxRow) {
|
886
|
+
line = session.getLine(row);
|
887
|
+
var indent = line.search(/\S/);
|
888
|
+
if (indent === -1)
|
889
|
+
continue;
|
890
|
+
if (startIndent > indent)
|
891
|
+
break;
|
892
|
+
var subRange = this.getFoldWidgetRange(session, "all", row);
|
893
|
+
|
894
|
+
if (subRange) {
|
895
|
+
if (subRange.start.row <= startRow) {
|
896
|
+
break;
|
897
|
+
} else if (subRange.isMultiLine()) {
|
898
|
+
row = subRange.end.row;
|
899
|
+
} else if (startIndent == indent) {
|
900
|
+
break;
|
901
|
+
}
|
902
|
+
}
|
903
|
+
endRow = row;
|
904
|
+
}
|
905
|
+
|
906
|
+
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
907
|
+
};
|
908
|
+
this.getCommentRegionBlock = function(session, line, row) {
|
909
|
+
var startColumn = line.search(/\s*$/);
|
910
|
+
var maxRow = session.getLength();
|
911
|
+
var startRow = row;
|
912
|
+
|
913
|
+
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
914
|
+
var depth = 1;
|
915
|
+
while (++row < maxRow) {
|
916
|
+
line = session.getLine(row);
|
917
|
+
var m = re.exec(line);
|
918
|
+
if (!m) continue;
|
919
|
+
if (m[1]) depth--;
|
920
|
+
else depth++;
|
921
|
+
|
922
|
+
if (!depth) break;
|
923
|
+
}
|
924
|
+
|
925
|
+
var endRow = row;
|
926
|
+
if (endRow > startRow) {
|
927
|
+
return new Range(startRow, startColumn, endRow, line.length);
|
928
|
+
}
|
929
|
+
};
|
930
|
+
|
931
|
+
}).call(FoldMode.prototype);
|
932
|
+
|
933
|
+
});
|
934
|
+
|
935
|
+
define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
|
936
|
+
"use strict";
|
937
|
+
|
938
|
+
var oop = require("../lib/oop");
|
939
|
+
var TextMode = require("./text").Mode;
|
940
|
+
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
941
|
+
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
942
|
+
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
943
|
+
var CssCompletions = require("./css_completions").CssCompletions;
|
944
|
+
var CssBehaviour = require("./behaviour/css").CssBehaviour;
|
945
|
+
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
946
|
+
|
947
|
+
var Mode = function() {
|
948
|
+
this.HighlightRules = CssHighlightRules;
|
949
|
+
this.$outdent = new MatchingBraceOutdent();
|
950
|
+
this.$behaviour = new CssBehaviour();
|
951
|
+
this.$completer = new CssCompletions();
|
952
|
+
this.foldingRules = new CStyleFoldMode();
|
953
|
+
};
|
954
|
+
oop.inherits(Mode, TextMode);
|
955
|
+
|
956
|
+
(function() {
|
957
|
+
|
958
|
+
this.foldingRules = "cStyle";
|
959
|
+
this.blockComment = {start: "/*", end: "*/"};
|
960
|
+
|
961
|
+
this.getNextLineIndent = function(state, line, tab) {
|
962
|
+
var indent = this.$getIndent(line);
|
963
|
+
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
|
964
|
+
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
965
|
+
return indent;
|
966
|
+
}
|
967
|
+
|
968
|
+
var match = line.match(/^.*\{\s*$/);
|
969
|
+
if (match) {
|
970
|
+
indent += tab;
|
971
|
+
}
|
972
|
+
|
973
|
+
return indent;
|
974
|
+
};
|
975
|
+
|
976
|
+
this.checkOutdent = function(state, line, input) {
|
977
|
+
return this.$outdent.checkOutdent(line, input);
|
978
|
+
};
|
979
|
+
|
980
|
+
this.autoOutdent = function(state, doc, row) {
|
981
|
+
this.$outdent.autoOutdent(doc, row);
|
982
|
+
};
|
983
|
+
|
984
|
+
this.getCompletions = function(state, session, pos, prefix) {
|
985
|
+
return this.$completer.getCompletions(state, session, pos, prefix);
|
986
|
+
};
|
987
|
+
|
988
|
+
this.createWorker = function(session) {
|
989
|
+
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
|
990
|
+
worker.attachToDocument(session.getDocument());
|
991
|
+
|
992
|
+
worker.on("annotate", function(e) {
|
993
|
+
session.setAnnotations(e.data);
|
994
|
+
});
|
995
|
+
|
996
|
+
worker.on("terminate", function() {
|
997
|
+
session.clearAnnotations();
|
998
|
+
});
|
999
|
+
|
1000
|
+
return worker;
|
1001
|
+
};
|
1002
|
+
|
1003
|
+
this.$id = "ace/mode/css";
|
1004
|
+
}).call(Mode.prototype);
|
1005
|
+
|
1006
|
+
exports.Mode = Mode;
|
1007
|
+
|
1008
|
+
});
|