CodeMirror plugin for PolyGerrit

Clone this repo:
  1. 3af12c5 Improve setting height of editor by Paladox none · 3 months ago master
  2. c5bda5b Merge branch 'stable-3.4' by Edwin Kempin · 11 months ago v3.5.0 v3.5.0-rc0 v3.5.0-rc1 v3.5.0-rc2 v3.5.0-rc3 v3.5.0-rc4 v3.5.0.1 v3.5.1 v3.5.2 v3.6.0 v3.6.0-rc0 v3.6.0-rc1 v3.6.0-rc2 v3.6.0-rc3 v3.6.0-rc4 v3.6.0-rc5 v3.6.1
  3. aa2edb4 Merge branch 'stable-3.3' by Edwin Kempin · 11 months ago stable-3.4 v3.4.1 v3.4.2 v3.4.3 v3.4.4 v3.4.5
  4. c621796 Stop propagation for all keys but exempt the save button by Paladox none · 11 months ago stable-3.3 v3.3.10 v3.3.11 v3.3.6 v3.3.7 v3.3.8 v3.3.9
  5. 26cc68d Stop propagation for all keys but exempt the save button by Paladox none · 11 months ago

CodeMirror Editor

A plugin that uses CodeMirror to provide a rich code editing experience in PolyGerrit.

UI plugin

This plugin is rewritten into Polymer 3 syntax. The gr-editor.js is the main entry for the plugin.

But to support the lazy load on the codemirror with supported languages, we still have the codemirror-element.html as an asset which still built separately as an html.

We may consider drop the selectively language support and in favor of all-in-one bundle in the future or change build rule to support bundle css in js to move off of the html completely.

UI tests

To run UI tests here will need install dependencies from both npm and bower.

npm run wct-test should take care both for you, read more in package.json.

You will need polymer-bridges which is a submodule you can clone from:

As polymer 3 no longer support Polymer.importHref anymore, this plugin still supports it through a custom implementation in gr-editor.js.

Test plugin on Gerrit

  1. Build the bundle locally with: bazel build :codemirror_editor
  2. Serve your generated ‘codemirror_editor.js’ somewhere, you can put it under gerrit/plugins/codemirror-editor/ folder and it will automatically served at http://localhost:8081/plugins_/codemirror-editor/
  3. Use FE dev helper,, inject the local served ‘codemirror_editor.js’ to the page

If your plugin is already enabled, then you can block it and then inject the compiled local verison.

See more about how to use dev helper extension to help you test here: