@gdquest/codemirror-console
v0.1.2
Published
Setups a Codemirror view to look and behave like a log console.
Downloads
7
Readme
@gdquest/codemirror-console
console()
extension
Purpose
This extension setup a Codemirror view to look and behave like a log console.
- applies codemirror
minimalSetup
- makes the view read-only;
- automatically snap to the bottom of the feed (unless scrolled);
- line wraps content.
Usage
import { EditorView } from "@codemirror/view";
import { console } from "@gdquest/codemirror-console";
new EditorView({
extensions: [console()],
});
consoleErrorLine()
helper
Purpose
This function highlights a line by adding the .cm-console-error
class to the line. This is customizable with a theme, but the base color is red.
Usage
import { EditorView } from "@codemirror/view";
import { consoleErrorLine } from "@gdquest/codemirror-console";
const view = new EditorView({
doc: "Good line\nError line\nGood line",
});
consoleErrorLine(view, 2);