@@ -9,6 +9,8 @@ import type {SchemaToJsonNode} from '../../../json-crdt/schema/types';
9
9
10
10
export type TagType = SliceTypeCon | number | string ;
11
11
12
+ const sliceCustomData = new WeakMap < SliceRegistryEntry < any , any , any > , Record < string , unknown > > ( ) ;
13
+
12
14
export class SliceRegistryEntry <
13
15
Behavior extends SliceBehavior = SliceBehavior ,
14
16
Tag extends TagType = TagType ,
@@ -18,6 +20,14 @@ export class SliceRegistryEntry<
18
20
return this . behavior !== SliceBehavior . Marker ;
19
21
}
20
22
23
+ public data ( ) : Record < string , unknown > {
24
+ const data = sliceCustomData . get ( this ) ;
25
+ if ( data ) return data ;
26
+ const newData = { } ;
27
+ sliceCustomData . set ( this , newData ) ;
28
+ return newData ;
29
+ }
30
+
21
31
constructor (
22
32
/**
23
33
* Specifies whether the slice is an inline or block element. And if it is
@@ -125,6 +135,10 @@ export class SliceRegistry {
125
135
if ( tagStr && typeof tagStr === 'string' ) _fromHtml . set ( tagStr , [ [ entry , ( ) => [ tag , null ] ] ] ) ;
126
136
}
127
137
138
+ public get ( tag : TagType ) : SliceRegistryEntry | undefined {
139
+ return this . map . get ( tag ) ;
140
+ }
141
+
128
142
public isContainer ( tag : TagType ) : boolean {
129
143
const entry = this . map . get ( tag ) ;
130
144
return entry ?. container ?? false ;
0 commit comments