Fix error on init

This commit is contained in:
Andras Schmelczer 2025-11-18 20:42:10 +00:00
commit 813de6e31d

View file

@ -33,7 +33,7 @@ export class RemoteCursorsPluginValue implements PluginValue {
isOutdated: boolean; isOutdated: boolean;
}[] = []; }[] = [];
private static app: App; private static app?: App;
public decorations: DecorationSet = RangeSet.of([]); public decorations: DecorationSet = RangeSet.of([]);
public static setCursors( public static setCursors(
@ -88,7 +88,7 @@ export class RemoteCursorsPluginValue implements PluginValue {
private static findFileForEditor( private static findFileForEditor(
editor: EditorView editor: EditorView
): RelativePath | undefined { ): RelativePath | undefined {
return RemoteCursorsPluginValue.app.workspace return RemoteCursorsPluginValue.app?.workspace
.getLeavesOfType("markdown") .getLeavesOfType("markdown")
.map((leaf) => leaf.view) .map((leaf) => leaf.view)
.filter((view) => view instanceof MarkdownView) .filter((view) => view instanceof MarkdownView)