Skip to content

Commit 4b5ba3c

Browse files
jeclrsgGordonSmith
authored andcommitted
feat(codemirror): expose codemirror line class methods
exposes codemirror's addLineClass and removeLineClass methods Signed-off-by: Jeremy Clements <[email protected]>
1 parent fd4ab00 commit 4b5ba3c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/codemirror/src/Editor.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@ export class Editor extends HTMLWidget {
124124
return this;
125125
}
126126

127+
addLineClass(options: { lineNum: number, where?: "text" | "background" | "gutter", cssClass: string }): this {
128+
this._codemirror.addLineClass(this._codemirror.getLineHandle(options.lineNum), options.where ?? "background", options.cssClass);
129+
return this;
130+
}
131+
132+
removeLineClass(options: { lineNum: number, where?: "text" | "background" | "gutter", cssClass: string }): this {
133+
this._codemirror.removeLineClass(this._codemirror.getLineHandle(options.lineNum), options.where ?? "background", options.cssClass);
134+
return this;
135+
}
136+
127137
removeAllHighlight(): this {
128138
for (const marked of this._markedText) {
129139
marked.clear();

0 commit comments

Comments
 (0)