| 4 | * Measures the width of the gutter and stores it in the plugin instance. |
| 5 | */ |
| 6 | export const gutterWidthExtension = ViewPlugin.fromClass(class { |
| 7 | width: number = 0; |
| 8 | |
| 9 | constructor (view: EditorView) { |
| 10 | this.measureWidth(view); |
| 11 | } |
| 12 | |
| 13 | update = (update: ViewUpdate) => { |
| 14 | if (update.geometryChanged) { |
| 15 | this.measureWidth(update.view); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | measureWidth = (view: EditorView) => { |
| 20 | const gutter = view.scrollDOM.querySelector('.cm-gutters') as HTMLElement; |
| 21 | if (gutter) { |
| 22 | this.width = gutter.offsetWidth; |
| 23 | } |
| 24 | } |
| 25 | }); |
nothing calls this directly
no outgoing calls
no test coverage detected