@@ -46,6 +46,11 @@ export interface BaseEditor {
46
46
operations : Operation [ ]
47
47
marks : EditorMarks | null
48
48
49
+ /**
50
+ * @internal Caches for internal use.
51
+ */
52
+ _caches : EditorCaches
53
+
49
54
// Overrideable core methods.
50
55
51
56
apply : ( operation : Operation ) => void
@@ -122,6 +127,7 @@ export interface BaseEditor {
122
127
edges : OmitFirstArg < typeof Editor . edges >
123
128
elementReadOnly : OmitFirstArg < typeof Editor . elementReadOnly >
124
129
end : OmitFirstArg < typeof Editor . end >
130
+ findPath : OmitFirstArg < typeof Editor . findPath >
125
131
first : OmitFirstArg < typeof Editor . first >
126
132
fragment : OmitFirstArg < typeof Editor . fragment >
127
133
getMarks : OmitFirstArg < typeof Editor . marks >
@@ -180,6 +186,13 @@ export type Selection = ExtendedType<'Selection', BaseSelection>
180
186
181
187
export type EditorMarks = Omit < Text , 'text' >
182
188
189
+ export interface EditorCaches {
190
+ /**
191
+ * Editor children snapshot after the last flush.
192
+ */
193
+ nodeToParent : WeakMap < Descendant , Ancestor > | undefined
194
+ }
195
+
183
196
export interface EditorAboveOptions < T extends Ancestor > {
184
197
at ?: Location
185
198
match ?: NodeMatch < T >
@@ -389,6 +402,11 @@ export interface EditorInterface {
389
402
*/
390
403
first : ( editor : Editor , at : Location ) => NodeEntry
391
404
405
+ /**
406
+ * Find the path of Slate node.
407
+ */
408
+ findPath : ( editor : Editor , node : Node ) => Path
409
+
392
410
/**
393
411
* Get the fragment at a location.
394
412
*/
@@ -767,6 +785,10 @@ export const Editor: EditorInterface = {
767
785
return editor . end ( at )
768
786
} ,
769
787
788
+ findPath ( editor , node ) {
789
+ return editor . findPath ( node )
790
+ } ,
791
+
770
792
first ( editor , at ) {
771
793
return editor . first ( at )
772
794
} ,
0 commit comments