Use `update.state.sliceDoc()` rather than `update.state.doc.toJSON()` `update.state.sliceDoc()` seems to work with EditorState.lineSeparator. Which is better then using `update.state.doc.toJSON()` and hacking it to apply our set line editor. In a future change we should add a button to be able to switch between \r\n and \n and vice versa. Also fix the ability to run tests and fix tests. Bug: Issue 393149327 Change-Id: I8ccfbe714c347694f80dede48462bb3a0e2655fa
A plugin that uses CodeMirror to provide a rich code editing experience in PolyGerrit.
The plugins hooks into the editor endpoint and registers gr-editor for it.
The codemirror-element using CodeMirror is loaded lazily from another js bundle, because it is fairly large, and we don't want to load the large bundle, if the user is not editing anything.
We are using the generic test target in the plugins/ folder. See plugins/BUILD for how to enable the tests and then run bazel run plugins:web-test-runner.
For testing you can use FE dev helper (https://gerrit.googlesource.com/gerrit-fe-dev-helper/). It allows you to redirect to (symlinks to) your locally built files. You can use npm run start to serve files and put the locally built files (or symlinks) in the polygerrit-ui/app/ folder.