Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit b36b593

Browse files
committed
Update for new package name
BREAKING: Change the package name from `@codemirror/example-setup` to just `codemirror`. BREAKING: The package no longer exports `EditorState` (since that is no longer necessary to set up a basic editor). FEATURE: The new `minimalSetup` export provides a minimal set of editor extensions.
1 parent 011cb22 commit b36b593

4 files changed

Lines changed: 40 additions & 13 deletions

File tree

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# @codemirror/basic-setup [![NPM version](https://img.shields.io/npm/v/@codemirror/basic-setup.svg)](https://www.npmjs.org/package/@codemirror/basic-setup)
1+
# codemirror [![NPM version](https://img.shields.io/npm/v/codemirror)](https://www.npmjs.org/package/codemirror)
22

3-
[ [**WEBSITE**](https://codemirror.net/6/) | [**DOCS**](https://codemirror.net/6/docs/ref/#basic-setup) | [**ISSUES**](https://github.com/codemirror/codemirror.next/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/basic-setup/blob/main/CHANGELOG.md) ]
3+
[ [**WEBSITE**](https://codemirror.net/6/) | [**DOCS**](https://codemirror.net/6/docs/ref/#codemirror) | [**ISSUES**](https://github.com/codemirror/codemirror.next/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/basic-setup/blob/main/CHANGELOG.md) ]
44

5-
This package implements an example configuration for the
6-
[CodeMirror](https://codemirror.net/6/) code editor.
5+
This package provides an example configuration for the
6+
[CodeMirror](https://codemirror.net/6/) code editor. The actual editor
7+
is implemented in the various packages under the `@codemirror` scope,
8+
which this package depends on.
79

810
The [project page](https://codemirror.net/6/) has more information, a
911
number of [examples](https://codemirror.net/6/examples/) and the

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "@codemirror/basic-setup",
2+
"name": "codemirror",
33
"version": "0.20.0",
44
"description": "Example configuration for the CodeMirror code editor",
55
"scripts": {
66
"test": "cm-runtests",
7-
"prepare": "cm-buildhelper src/basic-setup.ts"
7+
"prepare": "cm-buildhelper src/codemirror.ts"
88
},
99
"keywords": [
1010
"editor",
@@ -39,6 +39,6 @@
3939
},
4040
"repository": {
4141
"type": "git",
42-
"url": "https://github.com/codemirror/basic-setup.git"
42+
"url": "https://github.com/codemirror/codemirror.git"
4343
}
4444
}

src/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This package depends on most of the core library packages and exports
2+
extension bundles to help set up a simple editor in a few lines of
3+
code.
4+
5+
@basicSetup
6+
7+
@minimalSetup
8+
9+
@EditorView

src/codemirror.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ import {lintKeymap} from "@codemirror/lint"
3939
/// (You'll probably want to add some language package to your setup
4040
/// too.)
4141
///
42-
/// This package does not allow customization. The idea is that, once
43-
/// you decide you want to configure your editor more precisely, you
44-
/// take this package's source (which is just a bunch of imports and
45-
/// an array literal), copy it into your own code, and adjust it as
46-
/// desired.
42+
/// This extension does not allow customization. The idea is that,
43+
/// once you decide you want to configure your editor more precisely,
44+
/// you take this package's source (which is just a bunch of imports
45+
/// and an array literal), copy it into your own code, and adjust it
46+
/// as desired.
4747
export const basicSetup: Extension = [
4848
lineNumbers(),
4949
highlightActiveLineGutter(),
@@ -73,5 +73,21 @@ export const basicSetup: Extension = [
7373
])
7474
]
7575

76+
/// A minimal set of extensions to create a functional editor. Only
77+
/// includes [the default keymap](#commands.defaultKeymap), [undo
78+
/// history](#commands.history), [special character
79+
/// highlighting](#view.highlightSpecialChars), [custom selection
80+
/// drawing](#view.drawSelection), and [default highlight
81+
/// style](#language.defaultHighlightStyle).
82+
export const minimalSetup: Extension = [
83+
highlightSpecialChars(),
84+
history(),
85+
drawSelection(),
86+
syntaxHighlighting(defaultHighlightStyle, {fallback: true}),
87+
keymap.of([
88+
...defaultKeymap,
89+
...historyKeymap,
90+
])
91+
]
92+
7693
export {EditorView} from "@codemirror/view"
77-
export {EditorState} from "@codemirror/state"

0 commit comments

Comments
 (0)