stackprofiler 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/README.md +1 -1
- data/config.ru +3 -2
- data/lib/stackprofiler.rb +0 -1
- data/lib/stackprofiler/filters/build_tree.rb +3 -4
- data/lib/stackprofiler/filters/gem_removal.rb +3 -0
- data/lib/stackprofiler/web_ui.rb +34 -11
- data/lib/stackprofiler/web_ui/public/css/stackprofiler.css +77 -0
- data/lib/stackprofiler/web_ui/public/js/stackprofiler.js +129 -58
- data/lib/stackprofiler/web_ui/public/vendor/ace/ace.js +18298 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-beautify.js +334 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-chromevox.js +541 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-elastic_tabstops_lite.js +275 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-emmet.js +1190 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-error_marker.js +6 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-keybinding_menu.js +170 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-language_tools.js +1934 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-linking.js +52 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-modelist.js +187 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-old_ie.js +494 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-searchbox.js +409 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-settings_menu.js +637 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-spellcheck.js +71 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-split.js +246 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-static_highlight.js +154 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-statusbar.js +51 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-textarea.js +632 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-themelist.js +58 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/ext-whitespace.js +181 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/keybinding-emacs.js +1182 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/keybinding-vim.js +5320 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/mode-haml.js +525 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/mode-html.js +2427 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/mode-html_ruby.js +2955 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/mode-javascript.js +1025 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/mode-json.js +668 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/mode-ruby.js +839 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/mode-xml.js +637 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/mode-yaml.js +256 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/theme-xcode.js +89 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/worker-coffee.js +7599 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/worker-css.js +8682 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/worker-html.js +11527 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/worker-javascript.js +10429 -0
- data/lib/stackprofiler/web_ui/public/vendor/ace/worker-json.js +2319 -0
- data/lib/stackprofiler/web_ui/views/index.erb +1 -1
- data/lib/stackprofiler/web_ui/views/layout.erb +2 -55
- data/stackprofiler.gemspec +2 -4
- metadata +42 -19
- data/lib/stackprofiler/web_ui/views/code.erb +0 -17
@@ -0,0 +1,409 @@
|
|
1
|
+
ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var dom = require("../lib/dom");
|
5
|
+
var lang = require("../lib/lang");
|
6
|
+
var event = require("../lib/event");
|
7
|
+
var searchboxCss = "\
|
8
|
+
.ace_search {\
|
9
|
+
background-color: #ddd;\
|
10
|
+
border: 1px solid #cbcbcb;\
|
11
|
+
border-top: 0 none;\
|
12
|
+
max-width: 325px;\
|
13
|
+
overflow: hidden;\
|
14
|
+
margin: 0;\
|
15
|
+
padding: 4px;\
|
16
|
+
padding-right: 6px;\
|
17
|
+
padding-bottom: 0;\
|
18
|
+
position: absolute;\
|
19
|
+
top: 0px;\
|
20
|
+
z-index: 99;\
|
21
|
+
white-space: normal;\
|
22
|
+
}\
|
23
|
+
.ace_search.left {\
|
24
|
+
border-left: 0 none;\
|
25
|
+
border-radius: 0px 0px 5px 0px;\
|
26
|
+
left: 0;\
|
27
|
+
}\
|
28
|
+
.ace_search.right {\
|
29
|
+
border-radius: 0px 0px 0px 5px;\
|
30
|
+
border-right: 0 none;\
|
31
|
+
right: 0;\
|
32
|
+
}\
|
33
|
+
.ace_search_form, .ace_replace_form {\
|
34
|
+
border-radius: 3px;\
|
35
|
+
border: 1px solid #cbcbcb;\
|
36
|
+
float: left;\
|
37
|
+
margin-bottom: 4px;\
|
38
|
+
overflow: hidden;\
|
39
|
+
}\
|
40
|
+
.ace_search_form.ace_nomatch {\
|
41
|
+
outline: 1px solid red;\
|
42
|
+
}\
|
43
|
+
.ace_search_field {\
|
44
|
+
background-color: white;\
|
45
|
+
border-right: 1px solid #cbcbcb;\
|
46
|
+
border: 0 none;\
|
47
|
+
-webkit-box-sizing: border-box;\
|
48
|
+
-moz-box-sizing: border-box;\
|
49
|
+
box-sizing: border-box;\
|
50
|
+
float: left;\
|
51
|
+
height: 22px;\
|
52
|
+
outline: 0;\
|
53
|
+
padding: 0 7px;\
|
54
|
+
width: 214px;\
|
55
|
+
margin: 0;\
|
56
|
+
}\
|
57
|
+
.ace_searchbtn,\
|
58
|
+
.ace_replacebtn {\
|
59
|
+
background: #fff;\
|
60
|
+
border: 0 none;\
|
61
|
+
border-left: 1px solid #dcdcdc;\
|
62
|
+
cursor: pointer;\
|
63
|
+
float: left;\
|
64
|
+
height: 22px;\
|
65
|
+
margin: 0;\
|
66
|
+
padding: 0;\
|
67
|
+
position: relative;\
|
68
|
+
}\
|
69
|
+
.ace_searchbtn:last-child,\
|
70
|
+
.ace_replacebtn:last-child {\
|
71
|
+
border-top-right-radius: 3px;\
|
72
|
+
border-bottom-right-radius: 3px;\
|
73
|
+
}\
|
74
|
+
.ace_searchbtn:disabled {\
|
75
|
+
background: none;\
|
76
|
+
cursor: default;\
|
77
|
+
}\
|
78
|
+
.ace_searchbtn {\
|
79
|
+
background-position: 50% 50%;\
|
80
|
+
background-repeat: no-repeat;\
|
81
|
+
width: 27px;\
|
82
|
+
}\
|
83
|
+
.ace_searchbtn.prev {\
|
84
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); \
|
85
|
+
}\
|
86
|
+
.ace_searchbtn.next {\
|
87
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); \
|
88
|
+
}\
|
89
|
+
.ace_searchbtn_close {\
|
90
|
+
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\
|
91
|
+
border-radius: 50%;\
|
92
|
+
border: 0 none;\
|
93
|
+
color: #656565;\
|
94
|
+
cursor: pointer;\
|
95
|
+
float: right;\
|
96
|
+
font: 16px/16px Arial;\
|
97
|
+
height: 14px;\
|
98
|
+
margin: 5px 1px 9px 5px;\
|
99
|
+
padding: 0;\
|
100
|
+
text-align: center;\
|
101
|
+
width: 14px;\
|
102
|
+
}\
|
103
|
+
.ace_searchbtn_close:hover {\
|
104
|
+
background-color: #656565;\
|
105
|
+
background-position: 50% 100%;\
|
106
|
+
color: white;\
|
107
|
+
}\
|
108
|
+
.ace_replacebtn.prev {\
|
109
|
+
width: 54px\
|
110
|
+
}\
|
111
|
+
.ace_replacebtn.next {\
|
112
|
+
width: 27px\
|
113
|
+
}\
|
114
|
+
.ace_button {\
|
115
|
+
margin-left: 2px;\
|
116
|
+
cursor: pointer;\
|
117
|
+
-webkit-user-select: none;\
|
118
|
+
-moz-user-select: none;\
|
119
|
+
-o-user-select: none;\
|
120
|
+
-ms-user-select: none;\
|
121
|
+
user-select: none;\
|
122
|
+
overflow: hidden;\
|
123
|
+
opacity: 0.7;\
|
124
|
+
border: 1px solid rgba(100,100,100,0.23);\
|
125
|
+
padding: 1px;\
|
126
|
+
-moz-box-sizing: border-box;\
|
127
|
+
box-sizing: border-box;\
|
128
|
+
color: black;\
|
129
|
+
}\
|
130
|
+
.ace_button:hover {\
|
131
|
+
background-color: #eee;\
|
132
|
+
opacity:1;\
|
133
|
+
}\
|
134
|
+
.ace_button:active {\
|
135
|
+
background-color: #ddd;\
|
136
|
+
}\
|
137
|
+
.ace_button.checked {\
|
138
|
+
border-color: #3399ff;\
|
139
|
+
opacity:1;\
|
140
|
+
}\
|
141
|
+
.ace_search_options{\
|
142
|
+
margin-bottom: 3px;\
|
143
|
+
text-align: right;\
|
144
|
+
-webkit-user-select: none;\
|
145
|
+
-moz-user-select: none;\
|
146
|
+
-o-user-select: none;\
|
147
|
+
-ms-user-select: none;\
|
148
|
+
user-select: none;\
|
149
|
+
}";
|
150
|
+
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
151
|
+
var keyUtil = require("../lib/keys");
|
152
|
+
|
153
|
+
dom.importCssString(searchboxCss, "ace_searchbox");
|
154
|
+
|
155
|
+
var html = '<div class="ace_search right">\
|
156
|
+
<button type="button" action="hide" class="ace_searchbtn_close"></button>\
|
157
|
+
<div class="ace_search_form">\
|
158
|
+
<input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
|
159
|
+
<button type="button" action="findNext" class="ace_searchbtn next"></button>\
|
160
|
+
<button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
|
161
|
+
<button type="button" action="findAll" class="ace_searchbtn" title="Alt-Enter">All</button>\
|
162
|
+
</div>\
|
163
|
+
<div class="ace_replace_form">\
|
164
|
+
<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
|
165
|
+
<button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\
|
166
|
+
<button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
|
167
|
+
</div>\
|
168
|
+
<div class="ace_search_options">\
|
169
|
+
<span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>\
|
170
|
+
<span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>\
|
171
|
+
<span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>\
|
172
|
+
</div>\
|
173
|
+
</div>'.replace(/>\s+/g, ">");
|
174
|
+
|
175
|
+
var SearchBox = function(editor, range, showReplaceForm) {
|
176
|
+
var div = dom.createElement("div");
|
177
|
+
div.innerHTML = html;
|
178
|
+
this.element = div.firstChild;
|
179
|
+
|
180
|
+
this.$init();
|
181
|
+
this.setEditor(editor);
|
182
|
+
};
|
183
|
+
|
184
|
+
(function() {
|
185
|
+
this.setEditor = function(editor) {
|
186
|
+
editor.searchBox = this;
|
187
|
+
editor.container.appendChild(this.element);
|
188
|
+
this.editor = editor;
|
189
|
+
};
|
190
|
+
|
191
|
+
this.$initElements = function(sb) {
|
192
|
+
this.searchBox = sb.querySelector(".ace_search_form");
|
193
|
+
this.replaceBox = sb.querySelector(".ace_replace_form");
|
194
|
+
this.searchOptions = sb.querySelector(".ace_search_options");
|
195
|
+
this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
|
196
|
+
this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
|
197
|
+
this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
|
198
|
+
this.searchInput = this.searchBox.querySelector(".ace_search_field");
|
199
|
+
this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
|
200
|
+
};
|
201
|
+
|
202
|
+
this.$init = function() {
|
203
|
+
var sb = this.element;
|
204
|
+
|
205
|
+
this.$initElements(sb);
|
206
|
+
|
207
|
+
var _this = this;
|
208
|
+
event.addListener(sb, "mousedown", function(e) {
|
209
|
+
setTimeout(function(){
|
210
|
+
_this.activeInput.focus();
|
211
|
+
}, 0);
|
212
|
+
event.stopPropagation(e);
|
213
|
+
});
|
214
|
+
event.addListener(sb, "click", function(e) {
|
215
|
+
var t = e.target || e.srcElement;
|
216
|
+
var action = t.getAttribute("action");
|
217
|
+
if (action && _this[action])
|
218
|
+
_this[action]();
|
219
|
+
else if (_this.$searchBarKb.commands[action])
|
220
|
+
_this.$searchBarKb.commands[action].exec(_this);
|
221
|
+
event.stopPropagation(e);
|
222
|
+
});
|
223
|
+
|
224
|
+
event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
|
225
|
+
var keyString = keyUtil.keyCodeToString(keyCode);
|
226
|
+
var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
|
227
|
+
if (command && command.exec) {
|
228
|
+
command.exec(_this);
|
229
|
+
event.stopEvent(e);
|
230
|
+
}
|
231
|
+
});
|
232
|
+
|
233
|
+
this.$onChange = lang.delayedCall(function() {
|
234
|
+
_this.find(false, false);
|
235
|
+
});
|
236
|
+
|
237
|
+
event.addListener(this.searchInput, "input", function() {
|
238
|
+
_this.$onChange.schedule(20);
|
239
|
+
});
|
240
|
+
event.addListener(this.searchInput, "focus", function() {
|
241
|
+
_this.activeInput = _this.searchInput;
|
242
|
+
_this.searchInput.value && _this.highlight();
|
243
|
+
});
|
244
|
+
event.addListener(this.replaceInput, "focus", function() {
|
245
|
+
_this.activeInput = _this.replaceInput;
|
246
|
+
_this.searchInput.value && _this.highlight();
|
247
|
+
});
|
248
|
+
};
|
249
|
+
this.$closeSearchBarKb = new HashHandler([{
|
250
|
+
bindKey: "Esc",
|
251
|
+
name: "closeSearchBar",
|
252
|
+
exec: function(editor) {
|
253
|
+
editor.searchBox.hide();
|
254
|
+
}
|
255
|
+
}]);
|
256
|
+
this.$searchBarKb = new HashHandler();
|
257
|
+
this.$searchBarKb.bindKeys({
|
258
|
+
"Ctrl-f|Command-f|Ctrl-H|Command-Option-F": function(sb) {
|
259
|
+
var isReplace = sb.isReplace = !sb.isReplace;
|
260
|
+
sb.replaceBox.style.display = isReplace ? "" : "none";
|
261
|
+
sb[isReplace ? "replaceInput" : "searchInput"].focus();
|
262
|
+
},
|
263
|
+
"Ctrl-G|Command-G": function(sb) {
|
264
|
+
sb.findNext();
|
265
|
+
},
|
266
|
+
"Ctrl-Shift-G|Command-Shift-G": function(sb) {
|
267
|
+
sb.findPrev();
|
268
|
+
},
|
269
|
+
"esc": function(sb) {
|
270
|
+
setTimeout(function() { sb.hide();});
|
271
|
+
},
|
272
|
+
"Return": function(sb) {
|
273
|
+
if (sb.activeInput == sb.replaceInput)
|
274
|
+
sb.replace();
|
275
|
+
sb.findNext();
|
276
|
+
},
|
277
|
+
"Shift-Return": function(sb) {
|
278
|
+
if (sb.activeInput == sb.replaceInput)
|
279
|
+
sb.replace();
|
280
|
+
sb.findPrev();
|
281
|
+
},
|
282
|
+
"Alt-Return": function(sb) {
|
283
|
+
if (sb.activeInput == sb.replaceInput)
|
284
|
+
sb.replaceAll();
|
285
|
+
sb.findAll();
|
286
|
+
},
|
287
|
+
"Tab": function(sb) {
|
288
|
+
(sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
|
289
|
+
}
|
290
|
+
});
|
291
|
+
|
292
|
+
this.$searchBarKb.addCommands([{
|
293
|
+
name: "toggleRegexpMode",
|
294
|
+
bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
|
295
|
+
exec: function(sb) {
|
296
|
+
sb.regExpOption.checked = !sb.regExpOption.checked;
|
297
|
+
sb.$syncOptions();
|
298
|
+
}
|
299
|
+
}, {
|
300
|
+
name: "toggleCaseSensitive",
|
301
|
+
bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
|
302
|
+
exec: function(sb) {
|
303
|
+
sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
|
304
|
+
sb.$syncOptions();
|
305
|
+
}
|
306
|
+
}, {
|
307
|
+
name: "toggleWholeWords",
|
308
|
+
bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
|
309
|
+
exec: function(sb) {
|
310
|
+
sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
|
311
|
+
sb.$syncOptions();
|
312
|
+
}
|
313
|
+
}]);
|
314
|
+
|
315
|
+
this.$syncOptions = function() {
|
316
|
+
dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
|
317
|
+
dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
|
318
|
+
dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
|
319
|
+
this.find(false, false);
|
320
|
+
};
|
321
|
+
|
322
|
+
this.highlight = function(re) {
|
323
|
+
this.editor.session.highlight(re || this.editor.$search.$options.re);
|
324
|
+
this.editor.renderer.updateBackMarkers()
|
325
|
+
};
|
326
|
+
this.find = function(skipCurrent, backwards) {
|
327
|
+
var range = this.editor.find(this.searchInput.value, {
|
328
|
+
skipCurrent: skipCurrent,
|
329
|
+
backwards: backwards,
|
330
|
+
wrap: true,
|
331
|
+
regExp: this.regExpOption.checked,
|
332
|
+
caseSensitive: this.caseSensitiveOption.checked,
|
333
|
+
wholeWord: this.wholeWordOption.checked
|
334
|
+
});
|
335
|
+
var noMatch = !range && this.searchInput.value;
|
336
|
+
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
337
|
+
this.editor._emit("findSearchBox", { match: !noMatch });
|
338
|
+
this.highlight();
|
339
|
+
};
|
340
|
+
this.findNext = function() {
|
341
|
+
this.find(true, false);
|
342
|
+
};
|
343
|
+
this.findPrev = function() {
|
344
|
+
this.find(true, true);
|
345
|
+
};
|
346
|
+
this.findAll = function(){
|
347
|
+
var range = this.editor.findAll(this.searchInput.value, {
|
348
|
+
regExp: this.regExpOption.checked,
|
349
|
+
caseSensitive: this.caseSensitiveOption.checked,
|
350
|
+
wholeWord: this.wholeWordOption.checked
|
351
|
+
});
|
352
|
+
var noMatch = !range && this.searchInput.value;
|
353
|
+
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
354
|
+
this.editor._emit("findSearchBox", { match: !noMatch });
|
355
|
+
this.highlight();
|
356
|
+
this.hide();
|
357
|
+
};
|
358
|
+
this.replace = function() {
|
359
|
+
if (!this.editor.getReadOnly())
|
360
|
+
this.editor.replace(this.replaceInput.value);
|
361
|
+
};
|
362
|
+
this.replaceAndFindNext = function() {
|
363
|
+
if (!this.editor.getReadOnly()) {
|
364
|
+
this.editor.replace(this.replaceInput.value);
|
365
|
+
this.findNext()
|
366
|
+
}
|
367
|
+
};
|
368
|
+
this.replaceAll = function() {
|
369
|
+
if (!this.editor.getReadOnly())
|
370
|
+
this.editor.replaceAll(this.replaceInput.value);
|
371
|
+
};
|
372
|
+
|
373
|
+
this.hide = function() {
|
374
|
+
this.element.style.display = "none";
|
375
|
+
this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
|
376
|
+
this.editor.focus();
|
377
|
+
};
|
378
|
+
this.show = function(value, isReplace) {
|
379
|
+
this.element.style.display = "";
|
380
|
+
this.replaceBox.style.display = isReplace ? "" : "none";
|
381
|
+
|
382
|
+
this.isReplace = isReplace;
|
383
|
+
|
384
|
+
if (value)
|
385
|
+
this.searchInput.value = value;
|
386
|
+
this.searchInput.focus();
|
387
|
+
this.searchInput.select();
|
388
|
+
|
389
|
+
this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
|
390
|
+
};
|
391
|
+
|
392
|
+
this.isFocused = function() {
|
393
|
+
var el = document.activeElement;
|
394
|
+
return el == this.searchInput || el == this.replaceInput;
|
395
|
+
}
|
396
|
+
}).call(SearchBox.prototype);
|
397
|
+
|
398
|
+
exports.SearchBox = SearchBox;
|
399
|
+
|
400
|
+
exports.Search = function(editor, isReplace) {
|
401
|
+
var sb = editor.searchBox || new SearchBox(editor);
|
402
|
+
sb.show(editor.session.getTextRange(), isReplace);
|
403
|
+
};
|
404
|
+
|
405
|
+
});
|
406
|
+
(function() {
|
407
|
+
ace.require(["ace/ext/searchbox"], function() {});
|
408
|
+
})();
|
409
|
+
|
@@ -0,0 +1,637 @@
|
|
1
|
+
ace.define("ace/ext/menu_tools/element_generator",["require","exports","module"], function(require, exports, module) {
|
2
|
+
'use strict';
|
3
|
+
module.exports.createOption = function createOption (obj) {
|
4
|
+
var attribute;
|
5
|
+
var el = document.createElement('option');
|
6
|
+
for(attribute in obj) {
|
7
|
+
if(obj.hasOwnProperty(attribute)) {
|
8
|
+
if(attribute === 'selected') {
|
9
|
+
el.setAttribute(attribute, obj[attribute]);
|
10
|
+
} else {
|
11
|
+
el[attribute] = obj[attribute];
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
return el;
|
16
|
+
};
|
17
|
+
module.exports.createCheckbox = function createCheckbox (id, checked, clss) {
|
18
|
+
var el = document.createElement('input');
|
19
|
+
el.setAttribute('type', 'checkbox');
|
20
|
+
el.setAttribute('id', id);
|
21
|
+
el.setAttribute('name', id);
|
22
|
+
el.setAttribute('value', checked);
|
23
|
+
el.setAttribute('class', clss);
|
24
|
+
if(checked) {
|
25
|
+
el.setAttribute('checked', 'checked');
|
26
|
+
}
|
27
|
+
return el;
|
28
|
+
};
|
29
|
+
module.exports.createInput = function createInput (id, value, clss) {
|
30
|
+
var el = document.createElement('input');
|
31
|
+
el.setAttribute('type', 'text');
|
32
|
+
el.setAttribute('id', id);
|
33
|
+
el.setAttribute('name', id);
|
34
|
+
el.setAttribute('value', value);
|
35
|
+
el.setAttribute('class', clss);
|
36
|
+
return el;
|
37
|
+
};
|
38
|
+
module.exports.createLabel = function createLabel (text, labelFor) {
|
39
|
+
var el = document.createElement('label');
|
40
|
+
el.setAttribute('for', labelFor);
|
41
|
+
el.textContent = text;
|
42
|
+
return el;
|
43
|
+
};
|
44
|
+
module.exports.createSelection = function createSelection (id, values, clss) {
|
45
|
+
var el = document.createElement('select');
|
46
|
+
el.setAttribute('id', id);
|
47
|
+
el.setAttribute('name', id);
|
48
|
+
el.setAttribute('class', clss);
|
49
|
+
values.forEach(function(item) {
|
50
|
+
el.appendChild(module.exports.createOption(item));
|
51
|
+
});
|
52
|
+
return el;
|
53
|
+
};
|
54
|
+
|
55
|
+
});
|
56
|
+
|
57
|
+
ace.define("ace/ext/modelist",["require","exports","module"], function(require, exports, module) {
|
58
|
+
"use strict";
|
59
|
+
|
60
|
+
var modes = [];
|
61
|
+
function getModeForPath(path) {
|
62
|
+
var mode = modesByName.text;
|
63
|
+
var fileName = path.split(/[\/\\]/).pop();
|
64
|
+
for (var i = 0; i < modes.length; i++) {
|
65
|
+
if (modes[i].supportsFile(fileName)) {
|
66
|
+
mode = modes[i];
|
67
|
+
break;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return mode;
|
71
|
+
}
|
72
|
+
|
73
|
+
var Mode = function(name, caption, extensions) {
|
74
|
+
this.name = name;
|
75
|
+
this.caption = caption;
|
76
|
+
this.mode = "ace/mode/" + name;
|
77
|
+
this.extensions = extensions;
|
78
|
+
if (/\^/.test(extensions)) {
|
79
|
+
var re = extensions.replace(/\|(\^)?/g, function(a, b){
|
80
|
+
return "$|" + (b ? "^" : "^.*\\.");
|
81
|
+
}) + "$";
|
82
|
+
} else {
|
83
|
+
var re = "^.*\\.(" + extensions + ")$";
|
84
|
+
}
|
85
|
+
|
86
|
+
this.extRe = new RegExp(re, "gi");
|
87
|
+
};
|
88
|
+
|
89
|
+
Mode.prototype.supportsFile = function(filename) {
|
90
|
+
return filename.match(this.extRe);
|
91
|
+
};
|
92
|
+
var supportedModes = {
|
93
|
+
ABAP: ["abap"],
|
94
|
+
ActionScript:["as"],
|
95
|
+
ADA: ["ada|adb"],
|
96
|
+
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
|
97
|
+
AsciiDoc: ["asciidoc"],
|
98
|
+
Assembly_x86:["asm"],
|
99
|
+
AutoHotKey: ["ahk"],
|
100
|
+
BatchFile: ["bat|cmd"],
|
101
|
+
C9Search: ["c9search_results"],
|
102
|
+
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
|
103
|
+
Cirru: ["cirru|cr"],
|
104
|
+
Clojure: ["clj|cljs"],
|
105
|
+
Cobol: ["CBL|COB"],
|
106
|
+
coffee: ["coffee|cf|cson|^Cakefile"],
|
107
|
+
ColdFusion: ["cfm"],
|
108
|
+
CSharp: ["cs"],
|
109
|
+
CSS: ["css"],
|
110
|
+
Curly: ["curly"],
|
111
|
+
D: ["d|di"],
|
112
|
+
Dart: ["dart"],
|
113
|
+
Diff: ["diff|patch"],
|
114
|
+
Dockerfile: ["^Dockerfile"],
|
115
|
+
Dot: ["dot"],
|
116
|
+
Dummy: ["dummy"],
|
117
|
+
DummySyntax: ["dummy"],
|
118
|
+
Eiffel: ["e"],
|
119
|
+
EJS: ["ejs"],
|
120
|
+
Elixir: ["ex|exs"],
|
121
|
+
Elm: ["elm"],
|
122
|
+
Erlang: ["erl|hrl"],
|
123
|
+
Forth: ["frt|fs|ldr"],
|
124
|
+
FTL: ["ftl"],
|
125
|
+
Gcode: ["gcode"],
|
126
|
+
Gherkin: ["feature"],
|
127
|
+
Gitignore: ["^.gitignore"],
|
128
|
+
Glsl: ["glsl|frag|vert"],
|
129
|
+
golang: ["go"],
|
130
|
+
Groovy: ["groovy"],
|
131
|
+
HAML: ["haml"],
|
132
|
+
Handlebars: ["hbs|handlebars|tpl|mustache"],
|
133
|
+
Haskell: ["hs"],
|
134
|
+
haXe: ["hx"],
|
135
|
+
HTML: ["html|htm|xhtml"],
|
136
|
+
HTML_Ruby: ["erb|rhtml|html.erb"],
|
137
|
+
INI: ["ini|conf|cfg|prefs"],
|
138
|
+
Io: ["io"],
|
139
|
+
Jack: ["jack"],
|
140
|
+
Jade: ["jade"],
|
141
|
+
Java: ["java"],
|
142
|
+
JavaScript: ["js|jsm"],
|
143
|
+
JSON: ["json"],
|
144
|
+
JSONiq: ["jq"],
|
145
|
+
JSP: ["jsp"],
|
146
|
+
JSX: ["jsx"],
|
147
|
+
Julia: ["jl"],
|
148
|
+
LaTeX: ["tex|latex|ltx|bib"],
|
149
|
+
LESS: ["less"],
|
150
|
+
Liquid: ["liquid"],
|
151
|
+
Lisp: ["lisp"],
|
152
|
+
LiveScript: ["ls"],
|
153
|
+
LogiQL: ["logic|lql"],
|
154
|
+
LSL: ["lsl"],
|
155
|
+
Lua: ["lua"],
|
156
|
+
LuaPage: ["lp"],
|
157
|
+
Lucene: ["lucene"],
|
158
|
+
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
|
159
|
+
Markdown: ["md|markdown"],
|
160
|
+
Mask: ["mask"],
|
161
|
+
MATLAB: ["matlab"],
|
162
|
+
MEL: ["mel"],
|
163
|
+
MUSHCode: ["mc|mush"],
|
164
|
+
MySQL: ["mysql"],
|
165
|
+
Nix: ["nix"],
|
166
|
+
ObjectiveC: ["m|mm"],
|
167
|
+
OCaml: ["ml|mli"],
|
168
|
+
Pascal: ["pas|p"],
|
169
|
+
Perl: ["pl|pm"],
|
170
|
+
pgSQL: ["pgsql"],
|
171
|
+
PHP: ["php|phtml"],
|
172
|
+
Powershell: ["ps1"],
|
173
|
+
Praat: ["praat|praatscript|psc|proc"],
|
174
|
+
Prolog: ["plg|prolog"],
|
175
|
+
Properties: ["properties"],
|
176
|
+
Protobuf: ["proto"],
|
177
|
+
Python: ["py"],
|
178
|
+
R: ["r"],
|
179
|
+
RDoc: ["Rd"],
|
180
|
+
RHTML: ["Rhtml"],
|
181
|
+
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
|
182
|
+
Rust: ["rs"],
|
183
|
+
SASS: ["sass"],
|
184
|
+
SCAD: ["scad"],
|
185
|
+
Scala: ["scala"],
|
186
|
+
Scheme: ["scm|rkt"],
|
187
|
+
SCSS: ["scss"],
|
188
|
+
SH: ["sh|bash|^.bashrc"],
|
189
|
+
SJS: ["sjs"],
|
190
|
+
Smarty: ["smarty|tpl"],
|
191
|
+
snippets: ["snippets"],
|
192
|
+
Soy_Template:["soy"],
|
193
|
+
Space: ["space"],
|
194
|
+
SQL: ["sql"],
|
195
|
+
Stylus: ["styl|stylus"],
|
196
|
+
SVG: ["svg"],
|
197
|
+
Tcl: ["tcl"],
|
198
|
+
Tex: ["tex"],
|
199
|
+
Text: ["txt"],
|
200
|
+
Textile: ["textile"],
|
201
|
+
Toml: ["toml"],
|
202
|
+
Twig: ["twig"],
|
203
|
+
Typescript: ["ts|typescript|str"],
|
204
|
+
Vala: ["vala"],
|
205
|
+
VBScript: ["vbs|vb"],
|
206
|
+
Velocity: ["vm"],
|
207
|
+
Verilog: ["v|vh|sv|svh"],
|
208
|
+
VHDL: ["vhd|vhdl"],
|
209
|
+
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
210
|
+
XQuery: ["xq"],
|
211
|
+
YAML: ["yaml|yml"]
|
212
|
+
};
|
213
|
+
|
214
|
+
var nameOverrides = {
|
215
|
+
ObjectiveC: "Objective-C",
|
216
|
+
CSharp: "C#",
|
217
|
+
golang: "Go",
|
218
|
+
C_Cpp: "C and C++",
|
219
|
+
coffee: "CoffeeScript",
|
220
|
+
HTML_Ruby: "HTML (Ruby)",
|
221
|
+
FTL: "FreeMarker"
|
222
|
+
};
|
223
|
+
var modesByName = {};
|
224
|
+
for (var name in supportedModes) {
|
225
|
+
var data = supportedModes[name];
|
226
|
+
var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
|
227
|
+
var filename = name.toLowerCase();
|
228
|
+
var mode = new Mode(filename, displayName, data[0]);
|
229
|
+
modesByName[filename] = mode;
|
230
|
+
modes.push(mode);
|
231
|
+
}
|
232
|
+
|
233
|
+
module.exports = {
|
234
|
+
getModeForPath: getModeForPath,
|
235
|
+
modes: modes,
|
236
|
+
modesByName: modesByName
|
237
|
+
};
|
238
|
+
|
239
|
+
});
|
240
|
+
|
241
|
+
ace.define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"], function(require, exports, module) {
|
242
|
+
"use strict";
|
243
|
+
require("ace/lib/fixoldbrowsers");
|
244
|
+
|
245
|
+
var themeData = [
|
246
|
+
["Chrome" ],
|
247
|
+
["Clouds" ],
|
248
|
+
["Crimson Editor" ],
|
249
|
+
["Dawn" ],
|
250
|
+
["Dreamweaver" ],
|
251
|
+
["Eclipse" ],
|
252
|
+
["GitHub" ],
|
253
|
+
["Solarized Light"],
|
254
|
+
["TextMate" ],
|
255
|
+
["Tomorrow" ],
|
256
|
+
["XCode" ],
|
257
|
+
["Kuroir"],
|
258
|
+
["KatzenMilch"],
|
259
|
+
["Ambiance" ,"ambiance" , "dark"],
|
260
|
+
["Chaos" ,"chaos" , "dark"],
|
261
|
+
["Clouds Midnight" ,"clouds_midnight" , "dark"],
|
262
|
+
["Cobalt" ,"cobalt" , "dark"],
|
263
|
+
["idle Fingers" ,"idle_fingers" , "dark"],
|
264
|
+
["krTheme" ,"kr_theme" , "dark"],
|
265
|
+
["Merbivore" ,"merbivore" , "dark"],
|
266
|
+
["Merbivore Soft" ,"merbivore_soft" , "dark"],
|
267
|
+
["Mono Industrial" ,"mono_industrial" , "dark"],
|
268
|
+
["Monokai" ,"monokai" , "dark"],
|
269
|
+
["Pastel on dark" ,"pastel_on_dark" , "dark"],
|
270
|
+
["Solarized Dark" ,"solarized_dark" , "dark"],
|
271
|
+
["Terminal" ,"terminal" , "dark"],
|
272
|
+
["Tomorrow Night" ,"tomorrow_night" , "dark"],
|
273
|
+
["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"],
|
274
|
+
["Tomorrow Night Bright","tomorrow_night_bright" , "dark"],
|
275
|
+
["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
|
276
|
+
["Twilight" ,"twilight" , "dark"],
|
277
|
+
["Vibrant Ink" ,"vibrant_ink" , "dark"]
|
278
|
+
];
|
279
|
+
|
280
|
+
|
281
|
+
exports.themesByName = {};
|
282
|
+
exports.themes = themeData.map(function(data) {
|
283
|
+
var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
|
284
|
+
var theme = {
|
285
|
+
caption: data[0],
|
286
|
+
theme: "ace/theme/" + name,
|
287
|
+
isDark: data[2] == "dark",
|
288
|
+
name: name
|
289
|
+
};
|
290
|
+
exports.themesByName[name] = theme;
|
291
|
+
return theme;
|
292
|
+
});
|
293
|
+
|
294
|
+
});
|
295
|
+
|
296
|
+
ace.define("ace/ext/menu_tools/add_editor_menu_options",["require","exports","module","ace/ext/modelist","ace/ext/themelist"], function(require, exports, module) {
|
297
|
+
'use strict';
|
298
|
+
module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) {
|
299
|
+
var modelist = require('../modelist');
|
300
|
+
var themelist = require('../themelist');
|
301
|
+
editor.menuOptions = {
|
302
|
+
setNewLineMode: [{
|
303
|
+
textContent: "unix",
|
304
|
+
value: "unix"
|
305
|
+
}, {
|
306
|
+
textContent: "windows",
|
307
|
+
value: "windows"
|
308
|
+
}, {
|
309
|
+
textContent: "auto",
|
310
|
+
value: "auto"
|
311
|
+
}],
|
312
|
+
setTheme: [],
|
313
|
+
setMode: [],
|
314
|
+
setKeyboardHandler: [{
|
315
|
+
textContent: "ace",
|
316
|
+
value: ""
|
317
|
+
}, {
|
318
|
+
textContent: "vim",
|
319
|
+
value: "ace/keyboard/vim"
|
320
|
+
}, {
|
321
|
+
textContent: "emacs",
|
322
|
+
value: "ace/keyboard/emacs"
|
323
|
+
}, {
|
324
|
+
textContent: "textarea",
|
325
|
+
value: "ace/keyboard/textarea"
|
326
|
+
}, {
|
327
|
+
textContent: "sublime",
|
328
|
+
value: "ace/keyboard/sublime"
|
329
|
+
}]
|
330
|
+
};
|
331
|
+
|
332
|
+
editor.menuOptions.setTheme = themelist.themes.map(function(theme) {
|
333
|
+
return {
|
334
|
+
textContent: theme.caption,
|
335
|
+
value: theme.theme
|
336
|
+
};
|
337
|
+
});
|
338
|
+
|
339
|
+
editor.menuOptions.setMode = modelist.modes.map(function(mode) {
|
340
|
+
return {
|
341
|
+
textContent: mode.name,
|
342
|
+
value: mode.mode
|
343
|
+
};
|
344
|
+
});
|
345
|
+
};
|
346
|
+
|
347
|
+
|
348
|
+
});
|
349
|
+
|
350
|
+
ace.define("ace/ext/menu_tools/get_set_functions",["require","exports","module"], function(require, exports, module) {
|
351
|
+
'use strict';
|
352
|
+
module.exports.getSetFunctions = function getSetFunctions (editor) {
|
353
|
+
var out = [];
|
354
|
+
var my = {
|
355
|
+
'editor' : editor,
|
356
|
+
'session' : editor.session,
|
357
|
+
'renderer' : editor.renderer
|
358
|
+
};
|
359
|
+
var opts = [];
|
360
|
+
var skip = [
|
361
|
+
'setOption',
|
362
|
+
'setUndoManager',
|
363
|
+
'setDocument',
|
364
|
+
'setValue',
|
365
|
+
'setBreakpoints',
|
366
|
+
'setScrollTop',
|
367
|
+
'setScrollLeft',
|
368
|
+
'setSelectionStyle',
|
369
|
+
'setWrapLimitRange'
|
370
|
+
];
|
371
|
+
['renderer', 'session', 'editor'].forEach(function(esra) {
|
372
|
+
var esr = my[esra];
|
373
|
+
var clss = esra;
|
374
|
+
for(var fn in esr) {
|
375
|
+
if(skip.indexOf(fn) === -1) {
|
376
|
+
if(/^set/.test(fn) && opts.indexOf(fn) === -1) {
|
377
|
+
opts.push(fn);
|
378
|
+
out.push({
|
379
|
+
'functionName' : fn,
|
380
|
+
'parentObj' : esr,
|
381
|
+
'parentName' : clss
|
382
|
+
});
|
383
|
+
}
|
384
|
+
}
|
385
|
+
}
|
386
|
+
});
|
387
|
+
return out;
|
388
|
+
};
|
389
|
+
|
390
|
+
});
|
391
|
+
|
392
|
+
ace.define("ace/ext/menu_tools/generate_settings_menu",["require","exports","module","ace/ext/menu_tools/element_generator","ace/ext/menu_tools/add_editor_menu_options","ace/ext/menu_tools/get_set_functions"], function(require, exports, module) {
|
393
|
+
'use strict';
|
394
|
+
var egen = require('./element_generator');
|
395
|
+
var addEditorMenuOptions = require('./add_editor_menu_options').addEditorMenuOptions;
|
396
|
+
var getSetFunctions = require('./get_set_functions').getSetFunctions;
|
397
|
+
module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
|
398
|
+
var elements = [];
|
399
|
+
function cleanupElementsList() {
|
400
|
+
elements.sort(function(a, b) {
|
401
|
+
var x = a.getAttribute('contains');
|
402
|
+
var y = b.getAttribute('contains');
|
403
|
+
return x.localeCompare(y);
|
404
|
+
});
|
405
|
+
}
|
406
|
+
function wrapElements() {
|
407
|
+
var topmenu = document.createElement('div');
|
408
|
+
topmenu.setAttribute('id', 'ace_settingsmenu');
|
409
|
+
elements.forEach(function(element) {
|
410
|
+
topmenu.appendChild(element);
|
411
|
+
});
|
412
|
+
|
413
|
+
var el = topmenu.appendChild(document.createElement('div'));
|
414
|
+
var version = "1.1.8";
|
415
|
+
el.style.padding = "1em";
|
416
|
+
el.textContent = "Ace version " + version;
|
417
|
+
|
418
|
+
return topmenu;
|
419
|
+
}
|
420
|
+
function createNewEntry(obj, clss, item, val) {
|
421
|
+
var el;
|
422
|
+
var div = document.createElement('div');
|
423
|
+
div.setAttribute('contains', item);
|
424
|
+
div.setAttribute('class', 'ace_optionsMenuEntry');
|
425
|
+
div.setAttribute('style', 'clear: both;');
|
426
|
+
|
427
|
+
div.appendChild(egen.createLabel(
|
428
|
+
item.replace(/^set/, '').replace(/([A-Z])/g, ' $1').trim(),
|
429
|
+
item
|
430
|
+
));
|
431
|
+
|
432
|
+
if (Array.isArray(val)) {
|
433
|
+
el = egen.createSelection(item, val, clss);
|
434
|
+
el.addEventListener('change', function(e) {
|
435
|
+
try{
|
436
|
+
editor.menuOptions[e.target.id].forEach(function(x) {
|
437
|
+
if(x.textContent !== e.target.textContent) {
|
438
|
+
delete x.selected;
|
439
|
+
}
|
440
|
+
});
|
441
|
+
obj[e.target.id](e.target.value);
|
442
|
+
} catch (err) {
|
443
|
+
throw new Error(err);
|
444
|
+
}
|
445
|
+
});
|
446
|
+
} else if(typeof val === 'boolean') {
|
447
|
+
el = egen.createCheckbox(item, val, clss);
|
448
|
+
el.addEventListener('change', function(e) {
|
449
|
+
try{
|
450
|
+
obj[e.target.id](!!e.target.checked);
|
451
|
+
} catch (err) {
|
452
|
+
throw new Error(err);
|
453
|
+
}
|
454
|
+
});
|
455
|
+
} else {
|
456
|
+
el = egen.createInput(item, val, clss);
|
457
|
+
el.addEventListener('change', function(e) {
|
458
|
+
try{
|
459
|
+
if(e.target.value === 'true') {
|
460
|
+
obj[e.target.id](true);
|
461
|
+
} else if(e.target.value === 'false') {
|
462
|
+
obj[e.target.id](false);
|
463
|
+
} else {
|
464
|
+
obj[e.target.id](e.target.value);
|
465
|
+
}
|
466
|
+
} catch (err) {
|
467
|
+
throw new Error(err);
|
468
|
+
}
|
469
|
+
});
|
470
|
+
}
|
471
|
+
el.style.cssText = 'float:right;';
|
472
|
+
div.appendChild(el);
|
473
|
+
return div;
|
474
|
+
}
|
475
|
+
function makeDropdown(item, esr, clss, fn) {
|
476
|
+
var val = editor.menuOptions[item];
|
477
|
+
var currentVal = esr[fn]();
|
478
|
+
if (typeof currentVal == 'object')
|
479
|
+
currentVal = currentVal.$id;
|
480
|
+
val.forEach(function(valuex) {
|
481
|
+
if (valuex.value === currentVal)
|
482
|
+
valuex.selected = 'selected';
|
483
|
+
});
|
484
|
+
return createNewEntry(esr, clss, item, val);
|
485
|
+
}
|
486
|
+
function handleSet(setObj) {
|
487
|
+
var item = setObj.functionName;
|
488
|
+
var esr = setObj.parentObj;
|
489
|
+
var clss = setObj.parentName;
|
490
|
+
var val;
|
491
|
+
var fn = item.replace(/^set/, 'get');
|
492
|
+
if(editor.menuOptions[item] !== undefined) {
|
493
|
+
elements.push(makeDropdown(item, esr, clss, fn));
|
494
|
+
} else if(typeof esr[fn] === 'function') {
|
495
|
+
try {
|
496
|
+
val = esr[fn]();
|
497
|
+
if(typeof val === 'object') {
|
498
|
+
val = val.$id;
|
499
|
+
}
|
500
|
+
elements.push(
|
501
|
+
createNewEntry(esr, clss, item, val)
|
502
|
+
);
|
503
|
+
} catch (e) {
|
504
|
+
}
|
505
|
+
}
|
506
|
+
}
|
507
|
+
addEditorMenuOptions(editor);
|
508
|
+
getSetFunctions(editor).forEach(function(setObj) {
|
509
|
+
handleSet(setObj);
|
510
|
+
});
|
511
|
+
cleanupElementsList();
|
512
|
+
return wrapElements();
|
513
|
+
};
|
514
|
+
|
515
|
+
});
|
516
|
+
|
517
|
+
ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
|
518
|
+
'use strict';
|
519
|
+
var dom = require("../../lib/dom");
|
520
|
+
var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
|
521
|
+
background-color: #F7F7F7;\
|
522
|
+
color: black;\
|
523
|
+
box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
|
524
|
+
padding: 1em 0.5em 2em 1em;\
|
525
|
+
overflow: auto;\
|
526
|
+
position: absolute;\
|
527
|
+
margin: 0;\
|
528
|
+
bottom: 0;\
|
529
|
+
right: 0;\
|
530
|
+
top: 0;\
|
531
|
+
z-index: 9991;\
|
532
|
+
cursor: default;\
|
533
|
+
}\
|
534
|
+
.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
|
535
|
+
box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
|
536
|
+
background-color: rgba(255, 255, 255, 0.6);\
|
537
|
+
color: black;\
|
538
|
+
}\
|
539
|
+
.ace_optionsMenuEntry:hover {\
|
540
|
+
background-color: rgba(100, 100, 100, 0.1);\
|
541
|
+
-webkit-transition: all 0.5s;\
|
542
|
+
transition: all 0.3s\
|
543
|
+
}\
|
544
|
+
.ace_closeButton {\
|
545
|
+
background: rgba(245, 146, 146, 0.5);\
|
546
|
+
border: 1px solid #F48A8A;\
|
547
|
+
border-radius: 50%;\
|
548
|
+
padding: 7px;\
|
549
|
+
position: absolute;\
|
550
|
+
right: -8px;\
|
551
|
+
top: -8px;\
|
552
|
+
z-index: 1000;\
|
553
|
+
}\
|
554
|
+
.ace_closeButton{\
|
555
|
+
background: rgba(245, 146, 146, 0.9);\
|
556
|
+
}\
|
557
|
+
.ace_optionsMenuKey {\
|
558
|
+
color: darkslateblue;\
|
559
|
+
font-weight: bold;\
|
560
|
+
}\
|
561
|
+
.ace_optionsMenuCommand {\
|
562
|
+
color: darkcyan;\
|
563
|
+
font-weight: normal;\
|
564
|
+
}";
|
565
|
+
dom.importCssString(cssText);
|
566
|
+
module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
|
567
|
+
top = top ? 'top: ' + top + ';' : '';
|
568
|
+
bottom = bottom ? 'bottom: ' + bottom + ';' : '';
|
569
|
+
right = right ? 'right: ' + right + ';' : '';
|
570
|
+
left = left ? 'left: ' + left + ';' : '';
|
571
|
+
|
572
|
+
var closer = document.createElement('div');
|
573
|
+
var contentContainer = document.createElement('div');
|
574
|
+
|
575
|
+
function documentEscListener(e) {
|
576
|
+
if (e.keyCode === 27) {
|
577
|
+
closer.click();
|
578
|
+
}
|
579
|
+
}
|
580
|
+
|
581
|
+
closer.style.cssText = 'margin: 0; padding: 0; ' +
|
582
|
+
'position: fixed; top:0; bottom:0; left:0; right:0;' +
|
583
|
+
'z-index: 9990; ' +
|
584
|
+
'background-color: rgba(0, 0, 0, 0.3);';
|
585
|
+
closer.addEventListener('click', function() {
|
586
|
+
document.removeEventListener('keydown', documentEscListener);
|
587
|
+
closer.parentNode.removeChild(closer);
|
588
|
+
editor.focus();
|
589
|
+
closer = null;
|
590
|
+
});
|
591
|
+
document.addEventListener('keydown', documentEscListener);
|
592
|
+
|
593
|
+
contentContainer.style.cssText = top + right + bottom + left;
|
594
|
+
contentContainer.addEventListener('click', function(e) {
|
595
|
+
e.stopPropagation();
|
596
|
+
});
|
597
|
+
|
598
|
+
var wrapper = dom.createElement("div");
|
599
|
+
wrapper.style.position = "relative";
|
600
|
+
|
601
|
+
var closeButton = dom.createElement("div");
|
602
|
+
closeButton.className = "ace_closeButton";
|
603
|
+
closeButton.addEventListener('click', function() {
|
604
|
+
closer.click();
|
605
|
+
});
|
606
|
+
|
607
|
+
wrapper.appendChild(closeButton);
|
608
|
+
contentContainer.appendChild(wrapper);
|
609
|
+
|
610
|
+
contentContainer.appendChild(contentElement);
|
611
|
+
closer.appendChild(contentContainer);
|
612
|
+
document.body.appendChild(closer);
|
613
|
+
editor.blur();
|
614
|
+
};
|
615
|
+
|
616
|
+
});
|
617
|
+
|
618
|
+
ace.define("ace/ext/settings_menu",["require","exports","module","ace/ext/menu_tools/generate_settings_menu","ace/ext/menu_tools/overlay_page","ace/editor"], function(require, exports, module) {
|
619
|
+
"use strict";
|
620
|
+
var generateSettingsMenu = require('./menu_tools/generate_settings_menu').generateSettingsMenu;
|
621
|
+
var overlayPage = require('./menu_tools/overlay_page').overlayPage;
|
622
|
+
function showSettingsMenu(editor) {
|
623
|
+
var sm = document.getElementById('ace_settingsmenu');
|
624
|
+
if (!sm)
|
625
|
+
overlayPage(editor, generateSettingsMenu(editor), '0', '0', '0');
|
626
|
+
}
|
627
|
+
module.exports.init = function(editor) {
|
628
|
+
var Editor = require("ace/editor").Editor;
|
629
|
+
Editor.prototype.showSettingsMenu = function() {
|
630
|
+
showSettingsMenu(this);
|
631
|
+
};
|
632
|
+
};
|
633
|
+
});
|
634
|
+
(function() {
|
635
|
+
ace.require(["ace/ext/settings_menu"], function() {});
|
636
|
+
})();
|
637
|
+
|