@codemirror/fold
Advanced tools
Comparing version 0.18.1 to 0.18.2
@@ -0,1 +1,7 @@ | ||
## 0.18.2 (2021-08-07) | ||
### New features | ||
The fold gutter now accepts a `markerDOM` option, which can be used to override the way gutter markers are rendered. Fix typo issue | ||
## 0.18.1 (2021-04-30) | ||
@@ -2,0 +8,0 @@ |
@@ -70,9 +70,15 @@ import * as _codemirror_state from '@codemirror/state'; | ||
/** | ||
Text used to indicate that a given line can be folded. Defaults | ||
to `"⌄"`. | ||
A function that creates the DOM element used to indicate a | ||
given line is folded or can be folded. | ||
When not given, the `openText`/`closeText` option will be used instead. | ||
*/ | ||
markerDOM?: ((open: boolean) => HTMLElement) | null; | ||
/** | ||
Text used to indicate that a given line can be folded. | ||
Defaults to `"⌄"`. | ||
*/ | ||
openText?: string; | ||
/** | ||
Text used to indicate that a given line is folded. Defaults to | ||
`"›"`. | ||
Text used to indicate that a given line is folded. | ||
Defaults to `"›"`. | ||
*/ | ||
@@ -79,0 +85,0 @@ closedText?: string; |
@@ -59,3 +59,3 @@ import { StateEffect, StateField, Facet, combineConfig } from '@codemirror/state'; | ||
}, | ||
provide: f => EditorView.decorations.compute([f], s => s.field(f)) | ||
provide: f => EditorView.decorations.from(f) | ||
}); | ||
@@ -200,3 +200,4 @@ /** | ||
openText: "⌄", | ||
closedText: "›" | ||
closedText: "›", | ||
markerDOM: null, | ||
}; | ||
@@ -211,2 +212,4 @@ class FoldMarker extends GutterMarker { | ||
toDOM(view) { | ||
if (this.config.markerDOM) | ||
return this.config.markerDOM(this.open); | ||
let span = document.createElement("span"); | ||
@@ -213,0 +216,0 @@ span.textContent = this.open ? this.config.openText : this.config.closedText; |
{ | ||
"name": "@codemirror/fold", | ||
"version": "0.18.1", | ||
"version": "0.18.2", | ||
"description": "Code folding for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
29975
677