| 278 | |
| 279 | const headingArrowPlugin = ViewPlugin.fromClass( |
| 280 | class { |
| 281 | private readonly view: EditorView |
| 282 | decorations: DecorationSet |
| 283 | |
| 284 | private cursorFixFrame = 0 |
| 285 | |
| 286 | constructor(view: EditorView) { |
| 287 | this.view = view |
| 288 | this.decorations = buildDecorations(view) |
| 289 | this.cursorFixFrame = requestAnimationFrame(() => fixFatCursorHeight(this.view)) |
| 290 | } |
| 291 | |
| 292 | update(update: ViewUpdate): void { |
| 293 | if ( |
| 294 | update.docChanged || |
| 295 | update.viewportChanged || |
| 296 | update.selectionSet || |
| 297 | update.transactions.some((tr) => |
| 298 | tr.effects.some((e) => e.is(foldEffect) || e.is(unfoldEffect)) |
| 299 | ) |
| 300 | ) { |
| 301 | this.decorations = buildDecorations(update.view) |
| 302 | } |
| 303 | if (update.selectionSet || update.geometryChanged || update.docChanged || update.viewportChanged) { |
| 304 | cancelAnimationFrame(this.cursorFixFrame) |
| 305 | this.cursorFixFrame = requestAnimationFrame(() => fixFatCursorHeight(this.view)) |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | destroy(): void { |
| 310 | cancelAnimationFrame(this.cursorFixFrame) |
| 311 | } |
| 312 | }, |
| 313 | { |
| 314 | decorations: (plugin) => plugin.decorations |
| 315 | } |
nothing calls this directly
no outgoing calls
no test coverage detected