-
Notifications
You must be signed in to change notification settings - Fork 147
/
CachePluginState.ts
61 lines (53 loc) · 1.65 KB
/
CachePluginState.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import type { TextMutationObserver } from '../context/TextMutationObserver';
import type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';
import type { DomIndexer } from '../context/DomIndexer';
import type {
DOMInsertPoint,
ImageSelection,
SelectionBase,
TableSelection,
} from '../selection/DOMSelection';
/**
* Represents a range selection used for cache. We store the start and end insert point here instead of range itself
* to prevent range got automatically modified by browser
*/
export interface RangeSelectionForCache extends SelectionBase<'range'> {
/**
* Start insert point
*/
start: DOMInsertPoint;
/**
* End inset point
*/
end: DOMInsertPoint;
/**
* Whether the selection was from left to right (in document order) or
* right to left (reverse of document order)
*/
isReverted: boolean;
}
/**
* Represents a selection used for cache
*/
export type CacheSelection = RangeSelectionForCache | ImageSelection | TableSelection;
/**
* Plugin state for CacheEditPlugin
*/
export interface CachePluginState {
/**
* Cached selection
*/
cachedSelection?: CacheSelection | undefined;
/**
* When reuse Content Model is allowed, we cache the Content Model object here after created
*/
cachedModel?: ContentModelDocument;
/**
* @optional Indexer for CachePlugin, to help build backward relationship from DOM node to Content Model
*/
domIndexer?: DomIndexer;
/**
* @optional A wrapper of MutationObserver to help detect text changes in editor
*/
textMutationObserver?: TextMutationObserver;
}