@@ -4,6 +4,7 @@ import type {Anchor} from '../rga/constants';
44import type { AbstractRga } from '../../../json-crdt/nodes/rga' ;
55import type { ITimestampStruct } from '../../../json-crdt-patch/clock' ;
66import type { MarkerSlice } from '../slice/MarkerSlice' ;
7+ import { printTree } from 'sonic-forest/lib/print/printTree' ;
78
89export class MarkerOverlayPoint extends OverlayPoint {
910 /**
@@ -23,21 +24,23 @@ export class MarkerOverlayPoint extends OverlayPoint {
2324 return this . marker ? this . marker . hash : 0 ;
2425 }
2526
26- public tag ( ) : SliceType | 0 {
27- if ( ! this . marker ) return 0 ;
28- return this . marker . type ;
27+ public type ( ) : SliceType {
28+ return this . marker && this . marker . type ;
2929 }
3030
3131 public data ( ) : unknown {
32- if ( ! this . marker ) return undefined ;
33- return this . marker . data ( ) ;
32+ return this . marker && this . marker . data ( ) ;
3433 }
3534
3635 // ---------------------------------------------------------------- Printable
3736
3837 public toStringName ( tab : string , lite ?: boolean ) : string {
3938 const hash = lite ? '' : `#${ this . textHash . toString ( 36 ) . slice ( - 4 ) } ` ;
40- const tag = lite ? '' : `, ${ JSON . stringify ( ( this . tag ( ) as any ) [ 1 ] ) } ` ;
39+ const tag = lite ? '' : `, type = ${ JSON . stringify ( ( this . type ( ) as any ) ) } ` ;
4140 return `${ super . toStringName ( tab , lite ) } ${ lite ? '' : ' ' } ${ hash } ${ tag } ` ;
4241 }
42+
43+ public toString ( tab : string = '' , lite ?: boolean ) : string {
44+ return super . toString ( tab , lite ) + ( lite ? '' : printTree ( tab , [ tab => this . marker . toString ( tab ) ] ) ) ;
45+ }
4346}
0 commit comments