mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 02:37:41 -05:00
Update to Codemirror 6 (py-repl) (#814)
* Upgrade to codemirror v6 * Increase indentation to 4 spaces by default
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { basicSetup, EditorState, EditorView } from '@codemirror/basic-setup';
|
||||
import { basicSetup, EditorView } from 'codemirror';
|
||||
import { python } from '@codemirror/lang-python';
|
||||
import { indentUnit } from '@codemirror/language'
|
||||
import { Compartment, StateCommand } from '@codemirror/state';
|
||||
import { keymap } from '@codemirror/view';
|
||||
import { defaultKeymap } from '@codemirror/commands';
|
||||
@@ -45,6 +46,7 @@ export class PyRepl extends BaseEvalElement {
|
||||
const languageConf = new Compartment();
|
||||
|
||||
const extensions = [
|
||||
indentUnit.of(" "),
|
||||
basicSetup,
|
||||
languageConf.of(python()),
|
||||
keymap.of([
|
||||
@@ -59,10 +61,8 @@ export class PyRepl extends BaseEvalElement {
|
||||
}
|
||||
|
||||
this.editor = new EditorView({
|
||||
state: EditorState.create({
|
||||
doc: this.code.trim(),
|
||||
extensions,
|
||||
}),
|
||||
doc: this.code.trim(),
|
||||
extensions,
|
||||
parent: this.editorNode,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user