1111 */
1212// Former goog.module ID: Blockly.MarkerManager
1313
14- import type {LineCursor} from './keyboard_nav/line_cursor.js';
14+ import {LineCursor} from './keyboard_nav/line_cursor.js';
1515import type {Marker} from './keyboard_nav/marker.js';
1616import type {WorkspaceSvg} from './workspace_svg.js';
1717
@@ -23,7 +23,7 @@ export class MarkerManager {
2323 static readonly LOCAL_MARKER = 'local_marker_1';
2424
2525 /** The cursor. */
26- private cursor: LineCursor | null = null ;
26+ private cursor: LineCursor;
2727
2828 /** The map of markers for the workspace. */
2929 private markers = new Map<string, Marker>();
@@ -32,7 +32,9 @@ export class MarkerManager {
3232 * @param workspace The workspace for the marker manager.
3333 * @internal
3434 */
35- constructor(private readonly workspace: WorkspaceSvg) {}
35+ constructor(private readonly workspace: WorkspaceSvg) {
36+ this.cursor = new LineCursor(this.workspace);
37+ }
3638
3739 /**
3840 * Register the marker by adding it to the map of markers.
@@ -72,7 +74,7 @@ export class MarkerManager {
7274 *
7375 * @returns The cursor for this workspace.
7476 */
75- getCursor(): LineCursor | null {
77+ getCursor(): LineCursor {
7678 return this.cursor;
7779 }
7880
@@ -109,9 +111,6 @@ export class MarkerManager {
109111 this.unregisterMarker(markerId);
110112 }
111113 this.markers.clear();
112- if (this.cursor) {
113- this.cursor.dispose();
114- this.cursor = null;
115- }
114+ this.cursor.dispose();
116115 }
117116}
0 commit comments