browser/devtools/sourceeditor/codemirror/README

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/sourceeditor/codemirror/README	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,132 @@
     1.4 +This is the CodeMirror editor packaged for the Mozilla Project. CodeMirror
     1.5 +is a JavaScript component that provides a code editor in the browser. When
     1.6 +a mode is available for the language you are coding in, it will color your
     1.7 +code, and optionally help with indentation.
     1.8 +
     1.9 +# Upgrade
    1.10 +
    1.11 +Currently used version is 4.0.3. To upgrade, download a new version of
    1.12 +CodeMirror from the project's page [1] and replace all JavaScript and
    1.13 +CSS files inside the codemirror directory [2].
    1.14 +
    1.15 +To confirm the functionality run mochitests for the following components:
    1.16 +
    1.17 + * sourceeditor
    1.18 + * scratchpad
    1.19 + * debugger
    1.20 + * styleditor
    1.21 + * netmonitor
    1.22 +
    1.23 +The sourceeditor component contains imported CodeMirror tests [3].
    1.24 +
    1.25 + * Some tests were commented out because we don't use that functionality
    1.26 +   within Firefox (for example Ruby editing mode). Be careful when updating
    1.27 +   files test/codemirror.html and test/vimemacs.html; they were modified to
    1.28 +   co-exist with Mozilla's testing infrastructure. Basically, vimemacs.html
    1.29 +   is a copy of codemirror.html but only with VIM and Emacs mode tests
    1.30 +   enabled.
    1.31 + * In cm_comment_test.js comment out fallbackToBlock and fallbackToLine
    1.32 +   tests.
    1.33 + * The search addon (search.js) was slightly modified to make search
    1.34 +   UI localizable (see patch below).
    1.35 +
    1.36 +Other than that, we don't have any Mozilla-specific patches applied to
    1.37 +CodeMirror itself.
    1.38 +
    1.39 +# Addons
    1.40 +
    1.41 +To install a new CodeMirror addon add it to the codemirror directory,
    1.42 +jar.mn [4] file and editor.js [5]. Also, add it to the License section
    1.43 +below.
    1.44 +
    1.45 +# License
    1.46 +
    1.47 +The following files in this directory are licensed according to the contents
    1.48 +in the LICENSE file:
    1.49 +
    1.50 + * codemirror.css
    1.51 + * codemirror.js
    1.52 + * comment.js
    1.53 + * activeline.js
    1.54 + * dialog/dialog.css
    1.55 + * dialog/dialog.js
    1.56 + * keymap/emacs.js
    1.57 + * keymap/sublime.js
    1.58 + * keymap/vim.js
    1.59 + * fold/foldcode.js
    1.60 + * fold/brace-fold.js
    1.61 + * fold/comment-fold.js
    1.62 + * fold/xml-fold.js
    1.63 + * fold/foldgutter.js
    1.64 + * xml.js
    1.65 + * css.js
    1.66 + * javascript.js
    1.67 + * clike.js
    1.68 + * htmlmixed.js
    1.69 + * matchbrackets.js
    1.70 + * closebrackets.js
    1.71 + * trailingspace.js
    1.72 + * search/match-highlighter.js
    1.73 + * search/search.js
    1.74 + * search/searchcursor.js
    1.75 + * test/codemirror.html
    1.76 + * test/cm_comment_test.js
    1.77 + * test/cm_doc_test.js
    1.78 + * test/cm_driver.js
    1.79 + * test/cm_mode_javascript_test.js
    1.80 + * test/cm_mode_test.css
    1.81 + * test/cm_mode_test.js
    1.82 + * test/cm_multi_test.js
    1.83 + * test/cm_search_test.js
    1.84 + * test/cm_test.js
    1.85 + * test/cm_sublime_test.js
    1.86 + * test/cm_vim_test.js
    1.87 + * test/cm_emacs_test.js
    1.88 +
    1.89 +# Localization patches
    1.90 +
    1.91 +diff --git a/browser/devtools/sourceeditor/codemirror/search/search.js b/browser/devtools/sourceeditor/codemirror/search/search.js
    1.92 +--- a/browser/devtools/sourceeditor/codemirror/search/search.js
    1.93 ++++ b/browser/devtools/sourceeditor/codemirror/search/search.js
    1.94 +@@ -62,19 +62,31 @@
    1.95 +     if (isRE) {
    1.96 +       query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i");
    1.97 +       if (query.test("")) query = /x^/;
    1.98 +     } else if (query == "") {
    1.99 +       query = /x^/;
   1.100 +     }
   1.101 +     return query;
   1.102 +   }
   1.103 +-  var queryDialog =
   1.104 +-    'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
   1.105 ++  var queryDialog;
   1.106 +   function doSearch(cm, rev) {
   1.107 ++    if (!queryDialog) {
   1.108 ++      let doc = cm.getWrapperElement().ownerDocument;
   1.109 ++      let inp = doc.createElement("input");
   1.110 ++      let txt = doc.createTextNode(cm.l10n("findCmd.promptMessage"));
   1.111 ++
   1.112 ++      inp.type = "text";
   1.113 ++      inp.style.width = "10em";
   1.114 ++      inp.style.MozMarginStart = "1em";
   1.115 ++
   1.116 ++      queryDialog = doc.createElement("div");
   1.117 ++      queryDialog.appendChild(txt);
   1.118 ++      queryDialog.appendChild(inp);
   1.119 ++    }
   1.120 +     var state = getSearchState(cm);
   1.121 +     if (state.query) return findNext(cm, rev);
   1.122 +     dialog(cm, queryDialog, "Search for:", cm.getSelection(), function(query) {
   1.123 +       cm.operation(function() {
   1.124 +         if (!query || state.query) return;
   1.125 +         state.query = parseQuery(query);
   1.126 +         cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
   1.127 +         state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
   1.128 +
   1.129 +# Footnotes
   1.130 +
   1.131 +[1] http://codemirror.net
   1.132 +[2] browser/devtools/sourceeditor/codemirror
   1.133 +[3] browser/devtools/sourceeditor/test/browser_codemirror.js
   1.134 +[4] browser/devtools/jar.mn
   1.135 +[5] browser/devtools/sourceeditor/editor.js

mercurial