browser/devtools/sourceeditor/codemirror/README

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial