This is the CodeMirror editor packaged for the Mozilla Project. CodeMirror
is a JavaScript component that provides a code editor in the browser. When
a mode is available for the language you are coding in, it will color your
code, and optionally help with indentation.
# CodeMirror 6
We're currently migrating to CodeMirror 6, which means we have bundle for version 6 _and_ 5,
until we successfully migrated all consumers to CodeMirror 6.
For version 6, we're generating a bundle (codemirror6/codemirror6.bundle.mjs) using rollup.
The entry point for the bundle is codemirror6/index.mjs, where we export all the classes and functions that the editor needs. When adding new exported item, the bundle needs to
be updated, which can be done by running:
> cd devtools/client/shared/sourceeditor
> npm install
> npm run build-cm6
This will produced a minified bundle, which might not be ideal if you're debugging an issue or profiling.
You can get an unminified bundle by running:
> npm run build-cm6-unminified
The generated bundle can be configurated in rollup.config.mjs.
# CodeMirror 5
## CodeMirror 5 Upgrade
Currently used version is 5.58.1. To upgrade: download a new version of
CodeMirror from the project's page [1] and replace all JavaScript and
CSS files inside the codemirror directory [2].
Then to recreate codemirror.bundle.js:
> cd devtools/client/shared/sourceeditor
> npm install
> npm run build
When investigating an issue in CodeMirror, you might want to have a non-minified bundle.
You can dothis by running `npm run build-unminified` instead of `npm run build`.
To confirm the functionality run mochitests for the following components:
The sourceeditor component contains imported CodeMirror tests [3].
* Some tests were commented out because we don't use that functionality
within Firefox (for example Ruby editing mode). Be careful when updating
files test/codemirror.html and test/vimemacs.html; they were modified to
co-exist with Mozilla's testing infrastructure. Basically, vimemacs.html
is a copy of codemirror.html but only with VIM and Emacs mode tests
enabled.
* In cm_comment_test.js comment out fallbackToBlock and fallbackToLine
tests.
* The search addon (search.js) was slightly modified to make search
UI localizable (see patch below).
Other than that, we don't have any Mozilla-specific patches applied to
CodeMirror itself.
## Addons
To install a new CodeMirror 5 addon add it to the codemirror directory,
jar.mn [4] file and editor.js [5]. Also, add it to the License section
below.
## License
The following files in this directory and devtools/client/shared/sourceeditor/test/codemirror/
are licensed according to the contents in the LICENSE file.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.