Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 This is the CodeMirror editor packaged for the Mozilla Project. CodeMirror
2 is a JavaScript component that provides a code editor in the browser. When
3 a mode is available for the language you are coding in, it will color your
4 code, and optionally help with indentation.
6 # Upgrade
8 Currently used version is 4.0.3. To upgrade, download a new version of
9 CodeMirror from the project's page [1] and replace all JavaScript and
10 CSS files inside the codemirror directory [2].
12 To confirm the functionality run mochitests for the following components:
14 * sourceeditor
15 * scratchpad
16 * debugger
17 * styleditor
18 * netmonitor
20 The sourceeditor component contains imported CodeMirror tests [3].
22 * Some tests were commented out because we don't use that functionality
23 within Firefox (for example Ruby editing mode). Be careful when updating
24 files test/codemirror.html and test/vimemacs.html; they were modified to
25 co-exist with Mozilla's testing infrastructure. Basically, vimemacs.html
26 is a copy of codemirror.html but only with VIM and Emacs mode tests
27 enabled.
28 * In cm_comment_test.js comment out fallbackToBlock and fallbackToLine
29 tests.
30 * The search addon (search.js) was slightly modified to make search
31 UI localizable (see patch below).
33 Other than that, we don't have any Mozilla-specific patches applied to
34 CodeMirror itself.
36 # Addons
38 To install a new CodeMirror addon add it to the codemirror directory,
39 jar.mn [4] file and editor.js [5]. Also, add it to the License section
40 below.
42 # License
44 The following files in this directory are licensed according to the contents
45 in the LICENSE file:
47 * codemirror.css
48 * codemirror.js
49 * comment.js
50 * activeline.js
51 * dialog/dialog.css
52 * dialog/dialog.js
53 * keymap/emacs.js
54 * keymap/sublime.js
55 * keymap/vim.js
56 * fold/foldcode.js
57 * fold/brace-fold.js
58 * fold/comment-fold.js
59 * fold/xml-fold.js
60 * fold/foldgutter.js
61 * xml.js
62 * css.js
63 * javascript.js
64 * clike.js
65 * htmlmixed.js
66 * matchbrackets.js
67 * closebrackets.js
68 * trailingspace.js
69 * search/match-highlighter.js
70 * search/search.js
71 * search/searchcursor.js
72 * test/codemirror.html
73 * test/cm_comment_test.js
74 * test/cm_doc_test.js
75 * test/cm_driver.js
76 * test/cm_mode_javascript_test.js
77 * test/cm_mode_test.css
78 * test/cm_mode_test.js
79 * test/cm_multi_test.js
80 * test/cm_search_test.js
81 * test/cm_test.js
82 * test/cm_sublime_test.js
83 * test/cm_vim_test.js
84 * test/cm_emacs_test.js
86 # Localization patches
88 diff --git a/browser/devtools/sourceeditor/codemirror/search/search.js b/browser/devtools/sourceeditor/codemirror/search/search.js
89 --- a/browser/devtools/sourceeditor/codemirror/search/search.js
90 +++ b/browser/devtools/sourceeditor/codemirror/search/search.js
91 @@ -62,19 +62,31 @@
92 if (isRE) {
93 query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i");
94 if (query.test("")) query = /x^/;
95 } else if (query == "") {
96 query = /x^/;
97 }
98 return query;
99 }
100 - var queryDialog =
101 - 'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
102 + var queryDialog;
103 function doSearch(cm, rev) {
104 + if (!queryDialog) {
105 + let doc = cm.getWrapperElement().ownerDocument;
106 + let inp = doc.createElement("input");
107 + let txt = doc.createTextNode(cm.l10n("findCmd.promptMessage"));
108 +
109 + inp.type = "text";
110 + inp.style.width = "10em";
111 + inp.style.MozMarginStart = "1em";
112 +
113 + queryDialog = doc.createElement("div");
114 + queryDialog.appendChild(txt);
115 + queryDialog.appendChild(inp);
116 + }
117 var state = getSearchState(cm);
118 if (state.query) return findNext(cm, rev);
119 dialog(cm, queryDialog, "Search for:", cm.getSelection(), function(query) {
120 cm.operation(function() {
121 if (!query || state.query) return;
122 state.query = parseQuery(query);
123 cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
124 state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
126 # Footnotes
128 [1] http://codemirror.net
129 [2] browser/devtools/sourceeditor/codemirror
130 [3] browser/devtools/sourceeditor/test/browser_codemirror.js
131 [4] browser/devtools/jar.mn
132 [5] browser/devtools/sourceeditor/editor.js