yks-element 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/07567125b93045706d81f17f7d04e262.js +120 -0
- package/lib/0d56a1f26e052a1bafd10a87782fc74b.js +3380 -0
- package/lib/27846e85433e54a3ec0ab34d62233dc5.js +186 -0
- package/lib/2f25a4dc442bc9aebc58cae30c50c3e2.js +192 -0
- package/lib/2f55cddc8eb85b63ee5b4ce0e5488230.js +67 -0
- package/lib/2fe2904fc024afaf81732563cb83e547.js +116 -0
- package/lib/3b02cca9e95276a74f3ed2bbc7a64ce6.js +409 -0
- package/lib/6e40b726d91e9138d9eaef6fd012c740.js +1332 -0
- package/lib/70efbabef77fb217f904f41dbf7fe8bf.js +380 -0
- package/lib/7cec85e554cfaf2464511da505025098.js +74 -0
- package/lib/852f0ecd7b17e3bfd700a821ff438f7e.js +330 -0
- package/lib/88730abfeb4a23e692ac7933882f12eb.js +255 -0
- package/lib/8b8336037f074d9dcbd20eab535b803f.js +227 -0
- package/lib/9979f39c4d2773e02151a6cf1558101b.js +768 -0
- package/lib/9ebb9ac2c9c875649c72722bc585d445.js +1381 -0
- package/lib/af6e31c060c273848b5fec9fdba8814d.js +3066 -0
- package/lib/babd8df6809ef43238f1b280c2cebfe3.js +265 -0
- package/lib/bb1365c0983ce5ad50060b24788b9630.js +459 -0
- package/lib/c0a8aa1d5e0611259e47c2008cb203ee.js +197 -0
- package/lib/c530988d2b1966fd10a4d99fa3877e1b.js +9 -0
- package/lib/c8acc93023012737a3bf8fb767b66838.js +1293 -0
- package/lib/d0415105402964718010284fcfa8b2ea.js +48 -0
- package/lib/d11ab4aa7dd9123fdecb075ff5c5a748.js +790 -0
- package/lib/d1907231dc06c32481fefd6d47da973b.js +344 -0
- package/lib/d429602e0ebf3c1ec040e070e9b05b9b.js +184 -0
- package/lib/e4fc956693373117f057fe9914e983fc.js +7090 -0
- package/lib/f15362a7feef894b2e7f706252e6c510.js +45 -0
- package/lib/f666b5647087bcfdf6623f8b14d56657.js +136 -0
- package/lib/fac0ce75e0690947a9e9e6f5b35c1ea8.js +1067 -0
- package/lib/fec23c6964d6cf25681d1f3e24b076a4.js +56 -0
- package/lib/yks.js +1 -1
- package/package.json +1 -1
- package/lib/6c6d192b6860b4508a14c2d04769a35e.js +0 -15404
- package/lib/c3832579be376308fa819b04e7b0c66f.js +0 -3788
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
ace.define("ace/ext/searchbox-css",["require","exports","module"], function(require, exports, module){module.exports = "\n\n/* ------------------------------------------------------------------------------------------\n * Editor Search Form\n * --------------------------------------------------------------------------------------- */\n.ace_search {\n background-color: #ddd;\n color: #666;\n border: 1px solid #cbcbcb;\n border-top: 0 none;\n overflow: hidden;\n margin: 0;\n padding: 4px 6px 0 4px;\n position: absolute;\n top: 0;\n z-index: 99;\n white-space: normal;\n}\n.ace_search.left {\n border-left: 0 none;\n border-radius: 0px 0px 5px 0px;\n left: 0;\n}\n.ace_search.right {\n border-radius: 0px 0px 0px 5px;\n border-right: 0 none;\n right: 0;\n}\n\n.ace_search_form, .ace_replace_form {\n margin: 0 20px 4px 0;\n overflow: hidden;\n line-height: 1.9;\n}\n.ace_replace_form {\n margin-right: 0;\n}\n.ace_search_form.ace_nomatch {\n outline: 1px solid red;\n}\n\n.ace_search_field {\n border-radius: 3px 0 0 3px;\n background-color: white;\n color: black;\n border: 1px solid #cbcbcb;\n border-right: 0 none;\n outline: 0;\n padding: 0;\n font-size: inherit;\n margin: 0;\n line-height: inherit;\n padding: 0 6px;\n min-width: 17em;\n vertical-align: top;\n min-height: 1.8em;\n box-sizing: content-box;\n}\n.ace_searchbtn {\n border: 1px solid #cbcbcb;\n line-height: inherit;\n display: inline-block;\n padding: 0 6px;\n background: #fff;\n border-right: 0 none;\n border-left: 1px solid #dcdcdc;\n cursor: pointer;\n margin: 0;\n position: relative;\n color: #666;\n}\n.ace_searchbtn:last-child {\n border-radius: 0 3px 3px 0;\n border-right: 1px solid #cbcbcb;\n}\n.ace_searchbtn:disabled {\n background: none;\n cursor: default;\n}\n.ace_searchbtn:hover {\n background-color: #eef1f6;\n}\n.ace_searchbtn.prev, .ace_searchbtn.next {\n padding: 0px 0.7em\n}\n.ace_searchbtn.prev:after, .ace_searchbtn.next:after {\n content: \"\";\n border: solid 2px #888;\n width: 0.5em;\n height: 0.5em;\n border-width: 2px 0 0 2px;\n display:inline-block;\n transform: rotate(-45deg);\n}\n.ace_searchbtn.next:after {\n border-width: 0 2px 2px 0 ;\n}\n.ace_searchbtn_close {\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\n border-radius: 50%;\n border: 0 none;\n color: #656565;\n cursor: pointer;\n font: 16px/16px Arial;\n padding: 0;\n height: 14px;\n width: 14px;\n top: 9px;\n right: 7px;\n position: absolute;\n}\n.ace_searchbtn_close:hover {\n background-color: #656565;\n background-position: 50% 100%;\n color: white;\n}\n\n.ace_button {\n margin-left: 2px;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -o-user-select: none;\n -ms-user-select: none;\n user-select: none;\n overflow: hidden;\n opacity: 0.7;\n border: 1px solid rgba(100,100,100,0.23);\n padding: 1px;\n box-sizing: border-box!important;\n color: black;\n}\n\n.ace_button:hover {\n background-color: #eee;\n opacity:1;\n}\n.ace_button:active {\n background-color: #ddd;\n}\n\n.ace_button.checked {\n border-color: #3399ff;\n opacity:1;\n}\n\n.ace_search_options{\n margin-bottom: 3px;\n text-align: right;\n -webkit-user-select: none;\n -moz-user-select: none;\n -o-user-select: none;\n -ms-user-select: none;\n user-select: none;\n clear: both;\n}\n\n.ace_search_counter {\n float: left;\n font-family: arial;\n padding: 0 8px;\n}";
|
|
2
|
+
|
|
3
|
+
});
|
|
4
|
+
|
|
5
|
+
ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/ext/searchbox-css","ace/keyboard/hash_handler","ace/lib/keys","ace/config"], function(require, exports, module){"use strict";
|
|
6
|
+
var dom = require("../lib/dom");
|
|
7
|
+
var lang = require("../lib/lang");
|
|
8
|
+
var event = require("../lib/event");
|
|
9
|
+
var searchboxCss = require("./searchbox-css");
|
|
10
|
+
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
|
11
|
+
var keyUtil = require("../lib/keys");
|
|
12
|
+
var nls = require("../config").nls;
|
|
13
|
+
var MAX_COUNT = 999;
|
|
14
|
+
dom.importCssString(searchboxCss, "ace_searchbox", false);
|
|
15
|
+
var SearchBox = /** @class */ (function () {
|
|
16
|
+
function SearchBox(editor, range, showReplaceForm) {
|
|
17
|
+
this.activeInput;
|
|
18
|
+
var div = dom.createElement("div");
|
|
19
|
+
dom.buildDom(["div", { class: "ace_search right" },
|
|
20
|
+
["span", { action: "hide", class: "ace_searchbtn_close" }],
|
|
21
|
+
["div", { class: "ace_search_form" },
|
|
22
|
+
["input", { class: "ace_search_field", placeholder: nls("search-box.find.placeholder", "Search for"), spellcheck: "false" }],
|
|
23
|
+
["span", { action: "findPrev", class: "ace_searchbtn prev" }, "\u200b"],
|
|
24
|
+
["span", { action: "findNext", class: "ace_searchbtn next" }, "\u200b"],
|
|
25
|
+
["span", { action: "findAll", class: "ace_searchbtn", title: "Alt-Enter" }, nls("search-box.find-all.text", "All")]
|
|
26
|
+
],
|
|
27
|
+
["div", { class: "ace_replace_form" },
|
|
28
|
+
["input", { class: "ace_search_field", placeholder: nls("search-box.replace.placeholder", "Replace with"), spellcheck: "false" }],
|
|
29
|
+
["span", { action: "replaceAndFindNext", class: "ace_searchbtn" }, nls("search-box.replace-next.text", "Replace")],
|
|
30
|
+
["span", { action: "replaceAll", class: "ace_searchbtn" }, nls("search-box.replace-all.text", "All")]
|
|
31
|
+
],
|
|
32
|
+
["div", { class: "ace_search_options" },
|
|
33
|
+
["span", { action: "toggleReplace", class: "ace_button", title: nls("search-box.toggle-replace.title", "Toggle Replace mode"),
|
|
34
|
+
style: "float:left;margin-top:-2px;padding:0 5px;" }, "+"],
|
|
35
|
+
["span", { class: "ace_search_counter" }],
|
|
36
|
+
["span", { action: "toggleRegexpMode", class: "ace_button", title: nls("search-box.toggle-regexp.title", "RegExp Search") }, ".*"],
|
|
37
|
+
["span", { action: "toggleCaseSensitive", class: "ace_button", title: nls("search-box.toggle-case.title", "CaseSensitive Search") }, "Aa"],
|
|
38
|
+
["span", { action: "toggleWholeWords", class: "ace_button", title: nls("search-box.toggle-whole-word.title", "Whole Word Search") }, "\\b"],
|
|
39
|
+
["span", { action: "searchInSelection", class: "ace_button", title: nls("search-box.toggle-in-selection.title", "Search In Selection") }, "S"]
|
|
40
|
+
]
|
|
41
|
+
], div);
|
|
42
|
+
this.element = div.firstChild;
|
|
43
|
+
this.setSession = this.setSession.bind(this);
|
|
44
|
+
this.$init();
|
|
45
|
+
this.setEditor(editor);
|
|
46
|
+
dom.importCssString(searchboxCss, "ace_searchbox", editor.container);
|
|
47
|
+
}
|
|
48
|
+
SearchBox.prototype.setEditor = function (editor) {
|
|
49
|
+
editor.searchBox = this;
|
|
50
|
+
editor.renderer.scroller.appendChild(this.element);
|
|
51
|
+
this.editor = editor;
|
|
52
|
+
};
|
|
53
|
+
SearchBox.prototype.setSession = function (e) {
|
|
54
|
+
this.searchRange = null;
|
|
55
|
+
this.$syncOptions(true);
|
|
56
|
+
};
|
|
57
|
+
SearchBox.prototype.$initElements = function (sb) {
|
|
58
|
+
this.searchBox = sb.querySelector(".ace_search_form");
|
|
59
|
+
this.replaceBox = sb.querySelector(".ace_replace_form");
|
|
60
|
+
this.searchOption = sb.querySelector("[action=searchInSelection]");
|
|
61
|
+
this.replaceOption = sb.querySelector("[action=toggleReplace]");
|
|
62
|
+
this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
|
|
63
|
+
this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
|
|
64
|
+
this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
|
|
65
|
+
this.searchInput = this.searchBox.querySelector(".ace_search_field");
|
|
66
|
+
this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
|
|
67
|
+
this.searchCounter = sb.querySelector(".ace_search_counter");
|
|
68
|
+
};
|
|
69
|
+
SearchBox.prototype.$init = function () {
|
|
70
|
+
var sb = this.element;
|
|
71
|
+
this.$initElements(sb);
|
|
72
|
+
var _this = this;
|
|
73
|
+
event.addListener(sb, "mousedown", function (e) {
|
|
74
|
+
setTimeout(function () {
|
|
75
|
+
_this.activeInput.focus();
|
|
76
|
+
}, 0);
|
|
77
|
+
event.stopPropagation(e);
|
|
78
|
+
});
|
|
79
|
+
event.addListener(sb, "click", function (e) {
|
|
80
|
+
var t = e.target || e.srcElement;
|
|
81
|
+
var action = t.getAttribute("action");
|
|
82
|
+
if (action && _this[action])
|
|
83
|
+
_this[action]();
|
|
84
|
+
else if (_this.$searchBarKb.commands[action])
|
|
85
|
+
_this.$searchBarKb.commands[action].exec(_this);
|
|
86
|
+
event.stopPropagation(e);
|
|
87
|
+
});
|
|
88
|
+
event.addCommandKeyListener(sb, function (e, hashId, keyCode) {
|
|
89
|
+
var keyString = keyUtil.keyCodeToString(keyCode);
|
|
90
|
+
var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
|
|
91
|
+
if (command && command.exec) {
|
|
92
|
+
command.exec(_this);
|
|
93
|
+
event.stopEvent(e);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
this.$onChange = lang.delayedCall(function () {
|
|
97
|
+
_this.find(false, false);
|
|
98
|
+
});
|
|
99
|
+
event.addListener(this.searchInput, "input", function () {
|
|
100
|
+
_this.$onChange.schedule(20);
|
|
101
|
+
});
|
|
102
|
+
event.addListener(this.searchInput, "focus", function () {
|
|
103
|
+
_this.activeInput = _this.searchInput;
|
|
104
|
+
_this.searchInput.value && _this.highlight();
|
|
105
|
+
});
|
|
106
|
+
event.addListener(this.replaceInput, "focus", function () {
|
|
107
|
+
_this.activeInput = _this.replaceInput;
|
|
108
|
+
_this.searchInput.value && _this.highlight();
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
SearchBox.prototype.setSearchRange = function (range) {
|
|
112
|
+
this.searchRange = range;
|
|
113
|
+
if (range) {
|
|
114
|
+
this.searchRangeMarker = this.editor.session.addMarker(range, "ace_active-line");
|
|
115
|
+
}
|
|
116
|
+
else if (this.searchRangeMarker) {
|
|
117
|
+
this.editor.session.removeMarker(this.searchRangeMarker);
|
|
118
|
+
this.searchRangeMarker = null;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
SearchBox.prototype.$syncOptions = function (preventScroll) {
|
|
122
|
+
dom.setCssClass(this.replaceOption, "checked", this.searchRange);
|
|
123
|
+
dom.setCssClass(this.searchOption, "checked", this.searchOption.checked);
|
|
124
|
+
this.replaceOption.textContent = this.replaceOption.checked ? "-" : "+";
|
|
125
|
+
dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
|
|
126
|
+
dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
|
|
127
|
+
dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
|
|
128
|
+
var readOnly = this.editor.getReadOnly();
|
|
129
|
+
this.replaceOption.style.display = readOnly ? "none" : "";
|
|
130
|
+
this.replaceBox.style.display = this.replaceOption.checked && !readOnly ? "" : "none";
|
|
131
|
+
this.find(false, false, preventScroll);
|
|
132
|
+
};
|
|
133
|
+
SearchBox.prototype.highlight = function (re) {
|
|
134
|
+
this.editor.session.highlight(re || this.editor.$search.$options.re);
|
|
135
|
+
this.editor.renderer.updateBackMarkers();
|
|
136
|
+
};
|
|
137
|
+
SearchBox.prototype.find = function (skipCurrent, backwards, preventScroll) {
|
|
138
|
+
var range = this.editor.find(this.searchInput.value, {
|
|
139
|
+
skipCurrent: skipCurrent,
|
|
140
|
+
backwards: backwards,
|
|
141
|
+
wrap: true,
|
|
142
|
+
regExp: this.regExpOption.checked,
|
|
143
|
+
caseSensitive: this.caseSensitiveOption.checked,
|
|
144
|
+
wholeWord: this.wholeWordOption.checked,
|
|
145
|
+
preventScroll: preventScroll,
|
|
146
|
+
range: this.searchRange
|
|
147
|
+
});
|
|
148
|
+
var noMatch = !range && this.searchInput.value;
|
|
149
|
+
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
|
150
|
+
this.editor._emit("findSearchBox", { match: !noMatch });
|
|
151
|
+
this.highlight();
|
|
152
|
+
this.updateCounter();
|
|
153
|
+
};
|
|
154
|
+
SearchBox.prototype.updateCounter = function () {
|
|
155
|
+
var editor = this.editor;
|
|
156
|
+
var regex = editor.$search.$options.re;
|
|
157
|
+
var supportsUnicodeFlag = regex.unicode;
|
|
158
|
+
var all = 0;
|
|
159
|
+
var before = 0;
|
|
160
|
+
if (regex) {
|
|
161
|
+
var value = this.searchRange
|
|
162
|
+
? editor.session.getTextRange(this.searchRange)
|
|
163
|
+
: editor.getValue();
|
|
164
|
+
var offset = editor.session.doc.positionToIndex(editor.selection.anchor);
|
|
165
|
+
if (this.searchRange)
|
|
166
|
+
offset -= editor.session.doc.positionToIndex(this.searchRange.start);
|
|
167
|
+
var last = regex.lastIndex = 0;
|
|
168
|
+
var m;
|
|
169
|
+
while ((m = regex.exec(value))) {
|
|
170
|
+
all++;
|
|
171
|
+
last = m.index;
|
|
172
|
+
if (last <= offset)
|
|
173
|
+
before++;
|
|
174
|
+
if (all > MAX_COUNT)
|
|
175
|
+
break;
|
|
176
|
+
if (!m[0]) {
|
|
177
|
+
regex.lastIndex = last += lang.skipEmptyMatch(value, last, supportsUnicodeFlag);
|
|
178
|
+
if (last >= value.length)
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
this.searchCounter.textContent = nls("search-box.search-counter", "$0 of $1", [before, (all > MAX_COUNT ? MAX_COUNT + "+" : all)]);
|
|
184
|
+
};
|
|
185
|
+
SearchBox.prototype.findNext = function () {
|
|
186
|
+
this.find(true, false);
|
|
187
|
+
};
|
|
188
|
+
SearchBox.prototype.findPrev = function () {
|
|
189
|
+
this.find(true, true);
|
|
190
|
+
};
|
|
191
|
+
SearchBox.prototype.findAll = function () {
|
|
192
|
+
var range = this.editor.findAll(this.searchInput.value, {
|
|
193
|
+
regExp: this.regExpOption.checked,
|
|
194
|
+
caseSensitive: this.caseSensitiveOption.checked,
|
|
195
|
+
wholeWord: this.wholeWordOption.checked
|
|
196
|
+
});
|
|
197
|
+
var noMatch = !range && this.searchInput.value;
|
|
198
|
+
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
|
199
|
+
this.editor._emit("findSearchBox", { match: !noMatch });
|
|
200
|
+
this.highlight();
|
|
201
|
+
this.hide();
|
|
202
|
+
};
|
|
203
|
+
SearchBox.prototype.replace = function () {
|
|
204
|
+
if (!this.editor.getReadOnly())
|
|
205
|
+
this.editor.replace(this.replaceInput.value);
|
|
206
|
+
};
|
|
207
|
+
SearchBox.prototype.replaceAndFindNext = function () {
|
|
208
|
+
if (!this.editor.getReadOnly()) {
|
|
209
|
+
this.editor.replace(this.replaceInput.value);
|
|
210
|
+
this.findNext();
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
SearchBox.prototype.replaceAll = function () {
|
|
214
|
+
if (!this.editor.getReadOnly())
|
|
215
|
+
this.editor.replaceAll(this.replaceInput.value);
|
|
216
|
+
};
|
|
217
|
+
SearchBox.prototype.hide = function () {
|
|
218
|
+
this.active = false;
|
|
219
|
+
this.setSearchRange(null);
|
|
220
|
+
this.editor.off("changeSession", this.setSession);
|
|
221
|
+
this.element.style.display = "none";
|
|
222
|
+
this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
|
|
223
|
+
this.editor.focus();
|
|
224
|
+
};
|
|
225
|
+
SearchBox.prototype.show = function (value, isReplace) {
|
|
226
|
+
this.active = true;
|
|
227
|
+
this.editor.on("changeSession", this.setSession);
|
|
228
|
+
this.element.style.display = "";
|
|
229
|
+
this.replaceOption.checked = isReplace;
|
|
230
|
+
if (value)
|
|
231
|
+
this.searchInput.value = value;
|
|
232
|
+
this.searchInput.focus();
|
|
233
|
+
this.searchInput.select();
|
|
234
|
+
this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
|
|
235
|
+
this.$syncOptions(true);
|
|
236
|
+
};
|
|
237
|
+
SearchBox.prototype.isFocused = function () {
|
|
238
|
+
var el = document.activeElement;
|
|
239
|
+
return el == this.searchInput || el == this.replaceInput;
|
|
240
|
+
};
|
|
241
|
+
return SearchBox;
|
|
242
|
+
}());
|
|
243
|
+
var $searchBarKb = new HashHandler();
|
|
244
|
+
$searchBarKb.bindKeys({
|
|
245
|
+
"Ctrl-f|Command-f": function (sb) {
|
|
246
|
+
var isReplace = sb.isReplace = !sb.isReplace;
|
|
247
|
+
sb.replaceBox.style.display = isReplace ? "" : "none";
|
|
248
|
+
sb.replaceOption.checked = false;
|
|
249
|
+
sb.$syncOptions();
|
|
250
|
+
sb.searchInput.focus();
|
|
251
|
+
},
|
|
252
|
+
"Ctrl-H|Command-Option-F": function (sb) {
|
|
253
|
+
if (sb.editor.getReadOnly())
|
|
254
|
+
return;
|
|
255
|
+
sb.replaceOption.checked = true;
|
|
256
|
+
sb.$syncOptions();
|
|
257
|
+
sb.replaceInput.focus();
|
|
258
|
+
},
|
|
259
|
+
"Ctrl-G|Command-G": function (sb) {
|
|
260
|
+
sb.findNext();
|
|
261
|
+
},
|
|
262
|
+
"Ctrl-Shift-G|Command-Shift-G": function (sb) {
|
|
263
|
+
sb.findPrev();
|
|
264
|
+
},
|
|
265
|
+
"esc": function (sb) {
|
|
266
|
+
setTimeout(function () { sb.hide(); });
|
|
267
|
+
},
|
|
268
|
+
"Return": function (sb) {
|
|
269
|
+
if (sb.activeInput == sb.replaceInput)
|
|
270
|
+
sb.replace();
|
|
271
|
+
sb.findNext();
|
|
272
|
+
},
|
|
273
|
+
"Shift-Return": function (sb) {
|
|
274
|
+
if (sb.activeInput == sb.replaceInput)
|
|
275
|
+
sb.replace();
|
|
276
|
+
sb.findPrev();
|
|
277
|
+
},
|
|
278
|
+
"Alt-Return": function (sb) {
|
|
279
|
+
if (sb.activeInput == sb.replaceInput)
|
|
280
|
+
sb.replaceAll();
|
|
281
|
+
sb.findAll();
|
|
282
|
+
},
|
|
283
|
+
"Tab": function (sb) {
|
|
284
|
+
(sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
$searchBarKb.addCommands([{
|
|
288
|
+
name: "toggleRegexpMode",
|
|
289
|
+
bindKey: { win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/" },
|
|
290
|
+
exec: function (sb) {
|
|
291
|
+
sb.regExpOption.checked = !sb.regExpOption.checked;
|
|
292
|
+
sb.$syncOptions();
|
|
293
|
+
}
|
|
294
|
+
}, {
|
|
295
|
+
name: "toggleCaseSensitive",
|
|
296
|
+
bindKey: { win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I" },
|
|
297
|
+
exec: function (sb) {
|
|
298
|
+
sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
|
|
299
|
+
sb.$syncOptions();
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
name: "toggleWholeWords",
|
|
303
|
+
bindKey: { win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W" },
|
|
304
|
+
exec: function (sb) {
|
|
305
|
+
sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
|
|
306
|
+
sb.$syncOptions();
|
|
307
|
+
}
|
|
308
|
+
}, {
|
|
309
|
+
name: "toggleReplace",
|
|
310
|
+
exec: function (sb) {
|
|
311
|
+
sb.replaceOption.checked = !sb.replaceOption.checked;
|
|
312
|
+
sb.$syncOptions();
|
|
313
|
+
}
|
|
314
|
+
}, {
|
|
315
|
+
name: "searchInSelection",
|
|
316
|
+
exec: function (sb) {
|
|
317
|
+
sb.searchOption.checked = !sb.searchRange;
|
|
318
|
+
sb.setSearchRange(sb.searchOption.checked && sb.editor.getSelectionRange());
|
|
319
|
+
sb.$syncOptions();
|
|
320
|
+
}
|
|
321
|
+
}]);
|
|
322
|
+
var $closeSearchBarKb = new HashHandler([{
|
|
323
|
+
bindKey: "Esc",
|
|
324
|
+
name: "closeSearchBar",
|
|
325
|
+
exec: function (editor) {
|
|
326
|
+
editor.searchBox.hide();
|
|
327
|
+
}
|
|
328
|
+
}]);
|
|
329
|
+
SearchBox.prototype.$searchBarKb = $searchBarKb;
|
|
330
|
+
SearchBox.prototype.$closeSearchBarKb = $closeSearchBarKb;
|
|
331
|
+
exports.SearchBox = SearchBox;
|
|
332
|
+
exports.Search = function (editor, isReplace) {
|
|
333
|
+
var sb = editor.searchBox || new SearchBox(editor);
|
|
334
|
+
sb.show(editor.session.getTextRange(), isReplace);
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
}); (function() {
|
|
338
|
+
ace.require(["ace/ext/searchbox"], function(m) {
|
|
339
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
|
340
|
+
module.exports = m;
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
})();
|
|
344
|
+
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
ace.define("ace/ext/static-css",["require","exports","module"], function(require, exports, module){module.exports = ".ace_static_highlight {\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Source Code Pro', 'source-code-pro', 'Droid Sans Mono', monospace;\n font-size: 12px;\n white-space: pre-wrap\n}\n\n.ace_static_highlight .ace_gutter {\n width: 2em;\n text-align: right;\n padding: 0 3px 0 0;\n margin-right: 3px;\n contain: none;\n}\n\n.ace_static_highlight.ace_show_gutter .ace_line {\n padding-left: 2.6em;\n}\n\n.ace_static_highlight .ace_line { position: relative; }\n\n.ace_static_highlight .ace_gutter-cell {\n -moz-user-select: -moz-none;\n -khtml-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n top: 0;\n bottom: 0;\n left: 0;\n position: absolute;\n}\n\n\n.ace_static_highlight .ace_gutter-cell:before {\n content: counter(ace_line, decimal);\n counter-increment: ace_line;\n}\n.ace_static_highlight {\n counter-reset: ace_line;\n}\n";
|
|
2
|
+
|
|
3
|
+
});
|
|
4
|
+
|
|
5
|
+
ace.define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text","ace/ext/static-css","ace/config","ace/lib/dom","ace/lib/lang"], function(require, exports, module){"use strict";
|
|
6
|
+
var EditSession = require("../edit_session").EditSession;
|
|
7
|
+
var TextLayer = require("../layer/text").Text;
|
|
8
|
+
var baseStyles = require("./static-css");
|
|
9
|
+
var config = require("../config");
|
|
10
|
+
var dom = require("../lib/dom");
|
|
11
|
+
var escapeHTML = require("../lib/lang").escapeHTML;
|
|
12
|
+
var Element = /** @class */ (function () {
|
|
13
|
+
function Element(type) { this.className;
|
|
14
|
+
this.type = type;
|
|
15
|
+
this.style = {};
|
|
16
|
+
this.textContent = "";
|
|
17
|
+
}
|
|
18
|
+
Element.prototype.cloneNode = function () {
|
|
19
|
+
return this;
|
|
20
|
+
};
|
|
21
|
+
Element.prototype.appendChild = function (child) {
|
|
22
|
+
this.textContent += child.toString();
|
|
23
|
+
};
|
|
24
|
+
Element.prototype.toString = function () {
|
|
25
|
+
var stringBuilder = [];
|
|
26
|
+
if (this.type != "fragment") {
|
|
27
|
+
stringBuilder.push("<", this.type);
|
|
28
|
+
if (this.className)
|
|
29
|
+
stringBuilder.push(" class='", this.className, "'");
|
|
30
|
+
var styleStr = [];
|
|
31
|
+
for (var key in this.style) {
|
|
32
|
+
styleStr.push(key, ":", this.style[key]);
|
|
33
|
+
}
|
|
34
|
+
if (styleStr.length)
|
|
35
|
+
stringBuilder.push(" style='", styleStr.join(""), "'");
|
|
36
|
+
stringBuilder.push(">");
|
|
37
|
+
}
|
|
38
|
+
if (this.textContent) {
|
|
39
|
+
stringBuilder.push(this.textContent);
|
|
40
|
+
}
|
|
41
|
+
if (this.type != "fragment") {
|
|
42
|
+
stringBuilder.push("</", this.type, ">");
|
|
43
|
+
}
|
|
44
|
+
return stringBuilder.join("");
|
|
45
|
+
};
|
|
46
|
+
return Element;
|
|
47
|
+
}());
|
|
48
|
+
var simpleDom = {
|
|
49
|
+
createTextNode: function (/** @type {string} */ textContent, /** @type {any} */ element) {
|
|
50
|
+
return escapeHTML(textContent);
|
|
51
|
+
},
|
|
52
|
+
createElement: function (/** @type {string} */ type) {
|
|
53
|
+
return new Element(type);
|
|
54
|
+
},
|
|
55
|
+
createFragment: function () {
|
|
56
|
+
return new Element("fragment");
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var SimpleTextLayer = function () {
|
|
60
|
+
this.config = {};
|
|
61
|
+
this.dom = simpleDom;
|
|
62
|
+
};
|
|
63
|
+
SimpleTextLayer.prototype = TextLayer.prototype;
|
|
64
|
+
var highlight = function (el, opts, callback) {
|
|
65
|
+
var m = el.className.match(/lang-(\w+)/);
|
|
66
|
+
var mode = opts.mode || m && ("ace/mode/" + m[1]);
|
|
67
|
+
if (!mode)
|
|
68
|
+
return false;
|
|
69
|
+
var theme = opts.theme || "ace/theme/textmate";
|
|
70
|
+
var data = "";
|
|
71
|
+
var nodes = [];
|
|
72
|
+
if (el.firstElementChild) {
|
|
73
|
+
var textLen = 0;
|
|
74
|
+
for (var i = 0; i < el.childNodes.length; i++) {
|
|
75
|
+
var ch = el.childNodes[i];
|
|
76
|
+
if (ch.nodeType == 3) {
|
|
77
|
+
textLen += ch.data.length;
|
|
78
|
+
data += ch.data;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
nodes.push(textLen, ch);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
data = el.textContent;
|
|
87
|
+
if (opts.trim)
|
|
88
|
+
data = data.trim();
|
|
89
|
+
}
|
|
90
|
+
highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) {
|
|
91
|
+
dom.importCssString(highlighted.css, "ace_highlight", true);
|
|
92
|
+
el.innerHTML = highlighted.html;
|
|
93
|
+
var container = el.firstChild.firstChild;
|
|
94
|
+
for (var i = 0; i < nodes.length; i += 2) {
|
|
95
|
+
var pos = highlighted.session.doc.indexToPosition(nodes[i]);
|
|
96
|
+
var node = nodes[i + 1];
|
|
97
|
+
var lineEl = container.children[pos.row];
|
|
98
|
+
lineEl && lineEl.appendChild(node);
|
|
99
|
+
}
|
|
100
|
+
callback && callback();
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
highlight.render = function (input, mode, theme, lineStart, disableGutter, callback) {
|
|
104
|
+
var waiting = 1;
|
|
105
|
+
var modeCache = EditSession.prototype.$modes;
|
|
106
|
+
if (typeof theme == "string") {
|
|
107
|
+
waiting++;
|
|
108
|
+
config.loadModule(['theme', theme], function (m) {
|
|
109
|
+
theme = m;
|
|
110
|
+
--waiting || done();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
var modeOptions;
|
|
114
|
+
if (mode && typeof mode === "object" && !mode.getTokenizer) {
|
|
115
|
+
modeOptions = mode;
|
|
116
|
+
mode = modeOptions.path;
|
|
117
|
+
}
|
|
118
|
+
if (typeof mode == "string") {
|
|
119
|
+
waiting++;
|
|
120
|
+
config.loadModule(['mode', mode], function (m) {
|
|
121
|
+
if (!modeCache[ /**@type{string}*/(mode)] || modeOptions)
|
|
122
|
+
modeCache[ /**@type{string}*/(mode)] = new m.Mode(modeOptions);
|
|
123
|
+
mode = modeCache[ /**@type{string}*/(mode)];
|
|
124
|
+
--waiting || done();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function done() {
|
|
128
|
+
var result = highlight.renderSync(input, mode, /**@type{Theme}*/ (theme), lineStart, disableGutter);
|
|
129
|
+
return callback ? callback(result) : result;
|
|
130
|
+
}
|
|
131
|
+
return --waiting || done();
|
|
132
|
+
};
|
|
133
|
+
highlight.renderSync = function (input, mode, theme, lineStart, disableGutter) {
|
|
134
|
+
lineStart = parseInt(lineStart || 1, 10);
|
|
135
|
+
var session = new EditSession("");
|
|
136
|
+
session.setUseWorker(false);
|
|
137
|
+
session.setMode(mode);
|
|
138
|
+
var textLayer = new SimpleTextLayer();
|
|
139
|
+
textLayer.setSession(session);
|
|
140
|
+
Object.keys(textLayer.$tabStrings).forEach(function (k) {
|
|
141
|
+
if (typeof textLayer.$tabStrings[k] == "string") {
|
|
142
|
+
var el = simpleDom.createFragment();
|
|
143
|
+
el.textContent = textLayer.$tabStrings[k];
|
|
144
|
+
textLayer.$tabStrings[k] = el;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
session.setValue(input);
|
|
148
|
+
var length = session.getLength();
|
|
149
|
+
var outerEl = simpleDom.createElement("div");
|
|
150
|
+
outerEl.className = theme.cssClass;
|
|
151
|
+
var innerEl = simpleDom.createElement("div");
|
|
152
|
+
innerEl.className = "ace_static_highlight" + (disableGutter ? "" : " ace_show_gutter");
|
|
153
|
+
innerEl.style["counter-reset"] = "ace_line " + (lineStart - 1);
|
|
154
|
+
for (var ix = 0; ix < length; ix++) {
|
|
155
|
+
var lineEl = simpleDom.createElement("div");
|
|
156
|
+
lineEl.className = "ace_line";
|
|
157
|
+
if (!disableGutter) {
|
|
158
|
+
var gutterEl = simpleDom.createElement("span");
|
|
159
|
+
gutterEl.className = "ace_gutter ace_gutter-cell";
|
|
160
|
+
gutterEl.textContent = "";
|
|
161
|
+
lineEl.appendChild(gutterEl);
|
|
162
|
+
}
|
|
163
|
+
textLayer.$renderLine(lineEl, ix, false);
|
|
164
|
+
lineEl.textContent += "\n";
|
|
165
|
+
innerEl.appendChild(lineEl);
|
|
166
|
+
}
|
|
167
|
+
outerEl.appendChild(innerEl);
|
|
168
|
+
return {
|
|
169
|
+
css: baseStyles + theme.cssText,
|
|
170
|
+
html: outerEl.toString(),
|
|
171
|
+
session: session
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
module.exports = highlight;
|
|
175
|
+
module.exports.highlight = highlight;
|
|
176
|
+
|
|
177
|
+
}); (function() {
|
|
178
|
+
ace.require(["ace/ext/static_highlight"], function(m) {
|
|
179
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
|
180
|
+
module.exports = m;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
})();
|
|
184
|
+
|