Compatibility fix for Polymer 2

Polymer 2 uses shadow dom. Before the fix all styles were loaded as a
document-level styles. To load styles inside correct element this fix
logically separates plugin in 2 parts: gr-editor and codemirror-element.
The codemirror-element is a wrapper for codemirror and it incapsulates all
styles and scripts inside the element. gr-editor connects codemirror-element
with gerrit - it dynamically loads codemirror-element, set correct
options and adds event listeners.
Also, codemirror doesn't work with shadydom correctly. Because of it,
there 2 versions of codemirror-element - one is for shadowdom and antoher one
is for shadydom.

Bug: Issue 11143
Change-Id: I304cc73df1ea9a5c59fe295fe50c817ed266ffc2
8 files changed
tree: 40c72f8a8792758c9622d9f6de9087f57cff8e53
  1. .gitignore
  2. .mailmap
  3. BUILD
  4. LICENSE
  5. README.md
  6. bower.json
  7. gr-editor/
  8. java/
  9. plugin.html
  10. test/
README.md

CodeMirror Editor

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

Testing

This plugin uses polymer-cli to test.

After bower install, running polymer test -l chrome will run all tests in Chrome, and running polymer serve and navigating to http://127.0.0.1:8081/components/codemirror-editor/gr-editor/gr-editor_test.html allows for manual debugging.