MCPcopy Create free account
hub / github.com/ZenNotes/zennotes /

Class

packages/app-core/src/lib/cm-heading-fold.ts:280–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278
279const 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 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected