michael@0: This is the CodeMirror editor packaged for the Mozilla Project. CodeMirror michael@0: is a JavaScript component that provides a code editor in the browser. When michael@0: a mode is available for the language you are coding in, it will color your michael@0: code, and optionally help with indentation. michael@0: michael@0: # Upgrade michael@0: michael@0: Currently used version is 4.0.3. To upgrade, download a new version of michael@0: CodeMirror from the project's page [1] and replace all JavaScript and michael@0: CSS files inside the codemirror directory [2]. michael@0: michael@0: To confirm the functionality run mochitests for the following components: michael@0: michael@0: * sourceeditor michael@0: * scratchpad michael@0: * debugger michael@0: * styleditor michael@0: * netmonitor michael@0: michael@0: The sourceeditor component contains imported CodeMirror tests [3]. michael@0: michael@0: * Some tests were commented out because we don't use that functionality michael@0: within Firefox (for example Ruby editing mode). Be careful when updating michael@0: files test/codemirror.html and test/vimemacs.html; they were modified to michael@0: co-exist with Mozilla's testing infrastructure. Basically, vimemacs.html michael@0: is a copy of codemirror.html but only with VIM and Emacs mode tests michael@0: enabled. michael@0: * In cm_comment_test.js comment out fallbackToBlock and fallbackToLine michael@0: tests. michael@0: * The search addon (search.js) was slightly modified to make search michael@0: UI localizable (see patch below). michael@0: michael@0: Other than that, we don't have any Mozilla-specific patches applied to michael@0: CodeMirror itself. michael@0: michael@0: # Addons michael@0: michael@0: To install a new CodeMirror addon add it to the codemirror directory, michael@0: jar.mn [4] file and editor.js [5]. Also, add it to the License section michael@0: below. michael@0: michael@0: # License michael@0: michael@0: The following files in this directory are licensed according to the contents michael@0: in the LICENSE file: michael@0: michael@0: * codemirror.css michael@0: * codemirror.js michael@0: * comment.js michael@0: * activeline.js michael@0: * dialog/dialog.css michael@0: * dialog/dialog.js michael@0: * keymap/emacs.js michael@0: * keymap/sublime.js michael@0: * keymap/vim.js michael@0: * fold/foldcode.js michael@0: * fold/brace-fold.js michael@0: * fold/comment-fold.js michael@0: * fold/xml-fold.js michael@0: * fold/foldgutter.js michael@0: * xml.js michael@0: * css.js michael@0: * javascript.js michael@0: * clike.js michael@0: * htmlmixed.js michael@0: * matchbrackets.js michael@0: * closebrackets.js michael@0: * trailingspace.js michael@0: * search/match-highlighter.js michael@0: * search/search.js michael@0: * search/searchcursor.js michael@0: * test/codemirror.html michael@0: * test/cm_comment_test.js michael@0: * test/cm_doc_test.js michael@0: * test/cm_driver.js michael@0: * test/cm_mode_javascript_test.js michael@0: * test/cm_mode_test.css michael@0: * test/cm_mode_test.js michael@0: * test/cm_multi_test.js michael@0: * test/cm_search_test.js michael@0: * test/cm_test.js michael@0: * test/cm_sublime_test.js michael@0: * test/cm_vim_test.js michael@0: * test/cm_emacs_test.js michael@0: michael@0: # Localization patches michael@0: michael@0: diff --git a/browser/devtools/sourceeditor/codemirror/search/search.js b/browser/devtools/sourceeditor/codemirror/search/search.js michael@0: --- a/browser/devtools/sourceeditor/codemirror/search/search.js michael@0: +++ b/browser/devtools/sourceeditor/codemirror/search/search.js michael@0: @@ -62,19 +62,31 @@ michael@0: if (isRE) { michael@0: query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); michael@0: if (query.test("")) query = /x^/; michael@0: } else if (query == "") { michael@0: query = /x^/; michael@0: } michael@0: return query; michael@0: } michael@0: - var queryDialog = michael@0: - 'Search: (Use /re/ syntax for regexp search)'; michael@0: + var queryDialog; michael@0: function doSearch(cm, rev) { michael@0: + if (!queryDialog) { michael@0: + let doc = cm.getWrapperElement().ownerDocument; michael@0: + let inp = doc.createElement("input"); michael@0: + let txt = doc.createTextNode(cm.l10n("findCmd.promptMessage")); michael@0: + michael@0: + inp.type = "text"; michael@0: + inp.style.width = "10em"; michael@0: + inp.style.MozMarginStart = "1em"; michael@0: + michael@0: + queryDialog = doc.createElement("div"); michael@0: + queryDialog.appendChild(txt); michael@0: + queryDialog.appendChild(inp); michael@0: + } michael@0: var state = getSearchState(cm); michael@0: if (state.query) return findNext(cm, rev); michael@0: dialog(cm, queryDialog, "Search for:", cm.getSelection(), function(query) { michael@0: cm.operation(function() { michael@0: if (!query || state.query) return; michael@0: state.query = parseQuery(query); michael@0: cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query)); michael@0: state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query)); michael@0: michael@0: # Footnotes michael@0: michael@0: [1] http://codemirror.net michael@0: [2] browser/devtools/sourceeditor/codemirror michael@0: [3] browser/devtools/sourceeditor/test/browser_codemirror.js michael@0: [4] browser/devtools/jar.mn michael@0: [5] browser/devtools/sourceeditor/editor.js