UNPKG

114 kBTypeScriptView Raw
1// Type definitions for slate 0.47
2// Project: https://github.com/ianstormtaylor/slate
3// Definitions by: Andy Kent <https://github.com/andykent>
4// Jamie Talbot <https://github.com/majelbstoat>
5// Jan Löbel <https://github.com/JanLoebel>
6// Brandon Shelton <https://github.com/YangusKhan>
7// Kalley Powell <https://github.com/kalley>
8// Francesco Agnoletto <https://github.com/Kornil>
9// Irwan Fario Subastian <https://github.com/isubasti>
10// Jack Allen <https://github.com/jackall3n>
11// Benjamin Evenson <https://github.com/benjiro>
12// Han Jeon <https://github.com/hanstar17>
13// Kay Delaney <https://github.com/kaydelaney>
14// Kamil Kamiński <https://github.com/0ctothorp>
15// Jay Chen <https://github.com/Jay0328>
16// Brian Ingles <https://github.com/bmingles>
17// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
18// TypeScript Version: 2.8
19import * as Immutable from "immutable";
20import { SyntheticEvent } from "react";
21
22export interface Data extends Immutable.Map<any, any> {}
23
24export namespace Data {
25 function create(properties: Immutable.Map<string, any> | { [key: string]: any }): Data;
26 function fromJSON(object: { [key: string]: any }): Data;
27 function fromJS(object: { [key: string]: any }): Data;
28}
29
30export interface RulesByNodeType {
31 [key: string]: Rules;
32}
33
34export interface ObjectAndType {
35 object?: string | undefined;
36 type?: string | undefined;
37}
38
39export interface Rules {
40 data?: {
41 [key: string]: (v: any) => boolean;
42 } | undefined;
43 first?: ObjectAndType | ObjectAndType[] | undefined;
44 isAtomic?: boolean | undefined;
45 isVoid?: boolean | undefined;
46 last?: ObjectAndType | ObjectAndType[] | undefined;
47 marks?: Array<{
48 type: string | ((type: string) => boolean)
49 }> | undefined;
50 next?: ObjectAndType | ObjectAndType[] | undefined;
51 nodes?: Array<{
52 min?: number | undefined;
53 max?: number | undefined;
54 match?: ObjectAndType | ObjectAndType[] | undefined;
55 }> | undefined;
56 normalize?: ((editor: Editor, error: SlateError) => void) | undefined;
57 parent?: ObjectAndType | ObjectAndType[] | undefined;
58 text?: RegExp | ((text: string) => boolean) | undefined;
59 previous?: ObjectAndType | ObjectAndType[] | undefined;
60}
61
62export interface SchemaProperties {
63 rules?: Array<{ match: ObjectAndType | ObjectAndType[] } & Rules> | undefined;
64 document?: Rules | undefined;
65 blocks?: RulesByNodeType | undefined;
66 inlines?: RulesByNodeType | undefined;
67 marks?: RulesByNodeType | undefined;
68 annotations?: RulesByNodeType | undefined;
69 decorations?: RulesByNodeType | undefined;
70}
71
72export type Path = Immutable.List<number> | number[] | string;
73export interface ValueProperties {
74 object?: "value" | undefined;
75 annotations?: Immutable.Map<string, Annotation> | { [key: string]: AnnotationJSON } | undefined;
76 data?: Data | { [key: string]: any } | undefined;
77 document?: Document | undefined;
78 selection?: Selection | undefined;
79}
80
81export interface ValueJSON {
82 object?: "value" | undefined;
83 annotations?: { [key: string]: AnnotationJSON } | undefined;
84 data?: { [key: string]: any } | undefined;
85 document?: DocumentJSON | undefined;
86 selection?: SelectionJSON | undefined;
87}
88
89export class Value extends Immutable.Record({}) {
90 object: "value";
91 annotations: Immutable.Map<string, Annotation>;
92 data: Data;
93 document: Document;
94 selection: Selection;
95
96 readonly startBlock: Block;
97 readonly endBlock: Block;
98 readonly anchorBlock: Block;
99 readonly focusBlock: Block;
100 readonly nextBlock: Block;
101 readonly previousBlock: Block;
102
103 readonly startInline: Inline;
104 readonly endInline: Inline;
105 readonly anchorInline: Inline;
106 readonly focusInline: Inline;
107 readonly nextInline: Inline;
108 readonly previousInline: Inline;
109
110 readonly startText: Text;
111 readonly endText: Text;
112 readonly anchorText: Text;
113 readonly focusText: Text;
114 readonly nextText: Text;
115 readonly previousText: Text;
116
117 readonly marks: Immutable.OrderedSet<Mark>;
118 readonly activeMarks: Immutable.OrderedSet<Mark>;
119 readonly blocks: Immutable.List<Block>;
120 readonly fragment: Document;
121 readonly inlines: Immutable.List<Inline>;
122 readonly texts: Immutable.List<Text>;
123
124 static create(properties?: ValueProperties | ValueJSON | Value): Value;
125 static createProperties(attrs: ValueProperties | ValueJSON | Value): ValueProperties;
126 static fromJSON(properties: ValueProperties | ValueJSON): Value;
127 static fromJS(properties: ValueProperties | ValueJSON): Value;
128 static isValue(maybeValue: any): maybeValue is Value;
129
130 toJSON(options?: {
131 preserveAnnotations?: boolean | undefined,
132 preserveData?: boolean | undefined,
133 preserveSelection?: boolean | undefined }
134 ): ValueJSON;
135 toJS(options?: {
136 preserveAnnotations?: boolean | undefined,
137 preserveData?: boolean | undefined,
138 preserveSelection?: boolean | undefined }
139 ): ValueJSON;
140 addAnnotation(annotation: Annotation | AnnotationProperties | AnnotationJSON): Value;
141 addMark(path: Path, mark: MarkProperties | MarkJSON | Mark | string): Value;
142 insertNode(path: Path, node: Node): Value;
143 insertText(
144 path: Path,
145 offset: number,
146 text: string,
147 ): Value;
148 mergeNode(path: Path): Value;
149 moveNode(path: Immutable.List<number>, newPath: Immutable.List<number>, newIndex?: number): Value;
150 removeAnnotation(annotation: Annotation | AnnotationProperties | AnnotationJSON): Value;
151 removeMark(path: Path, mark: MarkProperties | MarkJSON | Mark | string): Value;
152 removeNode(path: Path): Value;
153 removeText(path: Path, offset: number, text: string): Value;
154 setAnnotation(
155 properties: AnnotationProperties | AnnotationJSON | Annotation,
156 newProperties: AnnotationProperties | AnnotationJSON | Annotation
157 ): Value;
158 setNode(path: Path, properties: NodeProperties): Value;
159 setMark(
160 path: Path,
161 properties: MarkProperties,
162 newProperties: MarkProperties
163 ): Value;
164 setProperties(properties: ValueProperties): Value;
165 setSelection(properties:
166 | RangeTypeProperties
167 | RangeTypeJSON
168 | RangeType
169 | string
170 ): Value;
171 splitNode(
172 path: Path,
173 position: number,
174 properties: NodeProperties
175 ): Value;
176 mapRanges(iterator: (val: Selection | Annotation) => any): Value;
177 mapPoints(iterator: (point: Point) => Point): Value;
178}
179
180export interface DocumentProperties {
181 object?: "document" | undefined;
182 nodes?: Immutable.List<Node> | Node[] | undefined;
183 key?: string | undefined;
184 data?: Data | { [key: string]: any } | undefined;
185}
186
187export interface DocumentJSON {
188 object?: "document" | undefined;
189 nodes?: NodeJSON[] | undefined;
190 key?: string | undefined;
191 data?: { [key: string]: any } | undefined;
192}
193
194export class Document extends BaseNode {
195 object: "document";
196
197 static create(
198 properties:
199 | DocumentProperties
200 | DocumentJSON
201 | Document
202 | Array<NodeJSON | NodeProperties | Node>
203 | Immutable.List<NodeJSON | NodeProperties | Node>
204 ): Document;
205 static fromJSON(properties: DocumentJSON | DocumentProperties | Document): Document;
206 static fromJS(properties: DocumentJSON | DocumentProperties | Document): Document;
207 static isDocument(maybeDocument: any): maybeDocument is Document;
208
209 toJSON(): DocumentJSON;
210 toJS(): DocumentJSON;
211}
212
213export interface BlockProperties {
214 object?: "block" | undefined;
215 type: string;
216 key?: string | undefined;
217 nodes?: Immutable.List<Block | Text | Inline> | Array<Block | Text | Inline> | undefined;
218 data?: Data | { [key: string]: any } | undefined;
219}
220
221export interface BlockJSON {
222 object?: "block" | undefined;
223 type: string;
224 key?: string | undefined;
225 nodes?: Array<BlockJSON | InlineJSON | TextJSON> | undefined;
226 data?: { [key: string]: any } | undefined;
227}
228
229export class Block extends BaseNode {
230 object: "block";
231 nodes: Immutable.List<Block | Text | Inline>;
232
233 static create(properties:
234 | BlockProperties
235 | BlockJSON
236 | Block
237 | string
238 ): Block;
239 static createList(array?:
240 | Array<BlockProperties | BlockJSON | Block | string>
241 | Immutable.List<BlockProperties | BlockJSON | Block | string>
242 ): Immutable.List<Block>;
243 static fromJSON(properties: BlockJSON | BlockProperties | Block): Block;
244 static fromJS(properties: BlockJSON | BlockProperties | Block): Block;
245 static isBlock(maybeBlock: any): maybeBlock is Block;
246 static isBlockList(
247 maybeBlockList: any
248 ): maybeBlockList is Immutable.List<Block>;
249
250 toJSON(): BlockJSON;
251 toJS(): BlockJSON;
252}
253
254export interface InlineProperties {
255 object?: "inline" | undefined;
256 type: string;
257 key?: string | undefined;
258 nodes?: Immutable.List<Inline | Text> | Array<Inline | Text> | undefined;
259 data?: Data | { [key: string]: any } | undefined;
260}
261
262export interface InlineJSON {
263 object?: "inline" | undefined;
264 type: string;
265 key?: string | undefined;
266 nodes?: Array<InlineJSON | TextJSON> | undefined;
267 data?: { [key: string]: any } | undefined;
268}
269
270export class Inline extends BaseNode {
271 object: "inline";
272 nodes: Immutable.List<Inline | Text>;
273
274 static create(properties:
275 | InlineProperties
276 | InlineJSON
277 | Inline
278 | string
279 ): Inline;
280 static createList(
281 elements?:
282 | Immutable.List<InlineProperties | InlineJSON | Inline | string>
283 | Array<InlineProperties | InlineJSON | Inline | string>
284 ): Immutable.List<Inline>;
285 static fromJSON(properties:
286 | InlineProperties
287 | InlineJSON
288 | Inline
289 ): Inline;
290 static fromJS(properties:
291 | InlineProperties
292 | InlineJSON
293 | Inline
294 ): Inline;
295 static isInline(maybeInline: any): maybeInline is Inline;
296 static isInlineList(
297 maybeInlineList: any
298 ): maybeInlineList is Immutable.List<Inline>;
299
300 toJSON(): InlineJSON;
301 toJS(): InlineJSON;
302}
303
304export interface TextProperties {
305 object?: "text" | undefined;
306 key?: string | undefined;
307 text?: string | undefined;
308 marks?: Immutable.Set<Mark> | Mark[] | undefined;
309}
310
311export interface TextJSON {
312 object?: "text" | undefined;
313 key?: string | undefined;
314 text?: string | undefined;
315 marks?: MarkJSON[] | undefined;
316}
317
318export interface LeafAndOffset {
319 startOffset: number;
320 endOffset: number;
321 index: number;
322 leaf: Leaf;
323}
324
325export class Text extends Immutable.Record({}) {
326 object: "text";
327 key: string;
328
329 readonly text: string;
330 readonly marks: Immutable.Set<Mark> | null;
331
332 static create(properties?: TextProperties | TextJSON | Text | string): Text;
333 static createList(
334 elements?:
335 | Array<TextProperties | TextJSON | Text | string>
336 | Immutable.List<TextProperties | TextJSON | Text | string>
337 ): Immutable.List<Text>;
338 static fromJSON(properties: TextJSON | TextProperties | Text): Text;
339 static fromJS(properties: TextJSON | TextProperties | Text): Text;
340 static isText(maybeText: any): maybeText is Text;
341 static isTextList(maybeTextList: any): maybeTextList is Immutable.List<Text>;
342
343 toJSON(options?: { preserveKeys?: boolean | undefined }): TextJSON;
344 toJS(options?: { preserveKeys?: boolean | undefined }): TextJSON;
345
346 addMark(mark: MarkProperties | MarkJSON | Mark | string): Text;
347 addMarks(marks:
348 | Array<MarkProperties | MarkJSON | Mark | string>
349 | Immutable.Set<MarkProperties | MarkJSON | Mark | string>
350 ): Text;
351 getKeysToPathsTable(): { [key: string]: number[] };
352 getLeaves(
353 annotations: Immutable.Map<string, Annotation>,
354 decorations?: Decoration[] | Immutable.List<Decoration>
355 ): Immutable.List<Leaf>;
356 getFirstText(): Text | null;
357 getLastText(): Text | null;
358 getText(): string;
359 getNode(path: Path): Node | null;
360 getPath(key: Immutable.List<number> | string | Node): Immutable.List<number> | null;
361 hasNode(path: Path): boolean;
362 insertText(index: number, string: string): Text;
363 regenerateKey(): Text;
364 removeMark(mark: MarkProperties | MarkJSON | Mark | string): Text;
365 removeText(index: number, length: number): Text;
366 resolvePath(path: Path, index?: number): Immutable.List<number>;
367 setMark(
368 properties: MarkProperties | MarkJSON | Mark | string,
369 newProperties: MarkProperties
370 ): Text;
371 splitText(index: number): Text[];
372 mergeText(other: Text): Text;
373 normalize(editor: Editor): () => void | void;
374 validate(editor: Editor): Error | void;
375}
376
377export interface LeafProperties {
378 object?: "leaf" | undefined;
379 marks?: Immutable.Set<Mark> | Mark[] | undefined;
380 text?: string | undefined;
381}
382
383export interface LeafJSON {
384 object?: "leaf" | undefined;
385 marks?: MarkJSON[] | undefined;
386 text?: string | undefined;
387}
388
389export class Leaf extends Immutable.Record({}) {
390 object: "leaf";
391 marks: Immutable.Set<Mark> | null;
392 text: string;
393
394 static create(properties: LeafProperties | LeafJSON | Leaf): Leaf;
395 static createLeaves(leaves: Immutable.List<Leaf>): Immutable.List<Leaf>;
396 static splitLeaves(
397 leaves: Immutable.List<Leaf>,
398 offset: number
399 ): Array<Immutable.List<Leaf>>;
400 static createList(
401 attrs?:
402 | Array<LeafProperties | LeafJSON | Leaf>
403 | Immutable.List<LeafProperties | LeafJSON | Leaf>
404 ): Immutable.List<Leaf>;
405 static fromJSON(properties: LeafJSON | LeafProperties): Leaf;
406 static fromJS(properties: LeafJSON | LeafProperties): Leaf;
407 static isLeaf(maybeLeaf: any): maybeLeaf is Leaf;
408 static isLeafList(
409 maybeLeafList: any
410 ): maybeLeafList is Immutable.List<Leaf>;
411
412 updateMark(mark: Mark, newMark: Mark): Leaf;
413 addMarks(marks: Immutable.Set<Mark>): Leaf;
414 addMark(mark: Mark): Leaf;
415 removeMark(mark: Mark): Leaf;
416
417 insertText(offset: number, string: string): Leaf;
418
419 toJSON(): LeafJSON;
420 toJS(): LeafJSON;
421}
422
423interface IterableOptions {
424 direction?: string | undefined;
425 downward?: boolean | undefined;
426 upward?: boolean | undefined;
427 includeBlocks?: boolean | undefined;
428 includeDocument?: boolean | undefined;
429 includeInlines?: boolean | undefined;
430 includeRoot?: boolean | undefined;
431 includeTarget?: boolean | undefined;
432 includeTargetAncestors?: boolean | undefined;
433 includeTexts?: boolean | undefined;
434 match?: ((node: Node, path: Immutable.List<number>) => boolean | null) | undefined;
435 range?: RangeProperties | RangeJSON | Range | undefined;
436 path?: Path | undefined;
437}
438
439export namespace NodeFactory {
440 function create(attrs: Node | NodeJSON | NodeProperties): Node;
441 function createList(
442 elements?:
443 | Array<Node | NodeJSON | NodeProperties>
444 | Immutable.List<Node | NodeJSON | NodeProperties>
445 ): Immutable.List<Node>;
446 function createProperties(attrs?: Block | Inline | string | { type?: string | undefined, data?: object | undefined }): NodeProperties;
447 function fromJSON(value: { [key: string]: any }): NodeJSON;
448 function fromJS(value: { [key: string]: any }): NodeJSON;
449 function isNode(maybeNode: any): maybeNode is Node;
450 function isNodeList(maybeNodeList: any): maybeNodeList is Immutable.List<Node>;
451}
452
453export type Node = (Document | Block | Inline | Text);
454export type NodeJSON = DocumentJSON | BlockJSON | InlineJSON | TextJSON;
455export type NodeProperties =
456 | DocumentProperties
457 | BlockProperties
458 | InlineProperties
459 | TextProperties;
460
461declare class BaseNode extends Immutable.Record({}) {
462 data: Data;
463 type: string;
464 key: string;
465 object: "document" | "block" | "inline" | "text";
466 nodes: Immutable.List<Node>;
467
468 readonly text: string;
469
470 static isNode(maybeNode: any): maybeNode is Node;
471 static isNodeList(
472 maybeNodeList: any
473 ): maybeNodeList is Immutable.List<Node>;
474 static createProperties(
475 attrs: NodeProperties | string | Node
476 ): NodeProperties;
477 static fromJSON(value: NodeJSON | NodeProperties | Node): Node;
478 static fromJS(value: NodeJSON | NodeProperties | Node): Node;
479
480 addMark(path: Path, mark: Mark): Node;
481 ancestors(path: Path): Iterable<[Node, Immutable.List<number>]>;
482 blocks(options?: IterableOptions & {
483 onlyLeaves?: boolean | undefined;
484 onlyRoots?: boolean | undefined;
485 onlyTypes?: string[] | undefined}): Iterable<[Block, Immutable.List<number>]>;
486 createAnnotation(properties: AnnotationProperties | AnnotationJSON | Annotation): Annotation;
487 createDecoration(properties: DecorationProperties | DecorationJSON | Decoration): Decoration;
488 createIterable(options?: IterableOptions): Iterable<[Node, Immutable.List<number>]>;
489 createPoint(properties: PointProperties | PointJSON | Point): Point;
490 createRange(properties: RangeTypeProperties | RangeTypeJSON | RangeType): Range;
491 createSelection(properties: SelectionProperties | SelectionJSON | Selection | Range): Selection;
492 descendants(options?: IterableOptions): Iterable<[Node, Immutable.List<number>]>;
493 filterDescendants(predicate?: (node: Node, path: Immutable.List<number>) => boolean): Immutable.List<Node>;
494 findDescendant(predicate?: (node: Node, path: Immutable.List<number>) => boolean): Node | null;
495 forEachDescendant(predicate?: (node: Node, path: Immutable.List<number>) => boolean): void;
496 getActiveMarksAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Immutable.Set<Mark>;
497 getAncestors(path: Path): Immutable.List<Node> | null;
498 getBlocks(): Immutable.List<Block>;
499 getBlocksByType(type: string): Immutable.List<Block>;
500 getChild(path: Path): Node | null;
501 getClosest(path: Path, predicate: (node: Node, path: Immutable.List<number>) => boolean): Node | null;
502 getClosestBlock(path: Path): Block | null;
503 getClosestInline(path: Path): Inline | null;
504 getClosestVoid(path: Path, editor: Editor): Node | null;
505 getCommonAncestor(a: Path, b: Path): Node | null;
506 getDecorations(editor: Editor): Immutable.List<Decoration>;
507 getDepth(path: Path, startAt?: number): number | null;
508 getDescendant(path: Path): Node | null;
509 getDescendantsAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Immutable.List<Node>;
510 getFirstText(): Text | null;
511 getFragmentAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Document;
512 getFurthest(path: Path, predicate?: (node: Node, path: Immutable.List<number>) => boolean): Node | null;
513 getFurthestBlock(path: Path): Block | null;
514 getFurthestChild(path: Path): Node | null;
515 getFurthestInline(path: Path): Inline | null;
516 getInlines(): Immutable.List<Inline>;
517 getInlinesByType(type: string): Immutable.List<Inline>;
518 getInsertMarksAtPoint(point: PointProperties | PointJSON | Point): Immutable.Set<Mark>;
519 getInsertMarksAtRange(range: RangeProperties | RangeJSON | Range): Immutable.Set<Mark>;
520 getKeysToPathsTable(): { [key: string]: number[] };
521 getLastText(): Text | null;
522 getLeafBlocksAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Immutable.List<Block>;
523 getLeafInlinesAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Immutable.List<Inline>;
524 getNode(path: Path): Node | null;
525 getNodesToPathsMap(): Map<Node, Immutable.List<number>>;
526 getMarks(): Immutable.OrderedSet<Mark>;
527 getMarksAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Immutable.OrderedSet<Mark>;
528 getMarksByType(type: string): Immutable.OrderedSet<Mark>;
529 getNextBlock(path: Path): Block | null;
530 getNextNode(path: Path): Node | null;
531 getNextSibling(path: Path): Node | null;
532 getNextText(path: Path): Text | null;
533 getOffset(path: Path): number;
534 getOffsetAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): number;
535 getParent(path: Path): Node | null;
536 getPath(key: Immutable.List<number> | string | Node): Immutable.List<number> | null;
537 getPreviousBlock(path: Path): Block | null;
538 getPreviousNode(path: Path): Node | null;
539 getPreviousSibling(path: Path): Node | null;
540 getPreviousText(path: Path): Text | null;
541 getRootBlocksAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Immutable.List<Block>;
542 getRootInlinesAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Immutable.List<Inline>;
543 getText(): string;
544 getTextAtOffset(offset: number): Text | null;
545 getTextDirection(): string | null;
546 getTexts(): Immutable.List<Text>;
547 getTextsAtRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Immutable.List<Text>;
548 hasBlockChildren(): boolean;
549 hasChild(path: Path): boolean;
550 hasInlineChildren(): boolean;
551 hasDescendant(path: Path): boolean;
552 hasNode(path: Path): boolean;
553 hasVoidParent(path: Path, editor: Editor): boolean;
554 inlines(options?: IterableOptions & {
555 onlyLeaves?: boolean | undefined;
556 onlyRoots?: boolean | undefined;
557 onlyTypes?: string[] | undefined}): Iterable<[Inline, Immutable.List<number>]>;
558 insertNode(path: Path, node: Node): Node;
559 insertText(
560 path: Path,
561 offset: number,
562 text: string
563 ): Node;
564 isLeafBlock(): this is Block;
565 isLeafInline(): this is Inline;
566 isInRange(path: Path, range: RangeTypeProperties | RangeTypeJSON | RangeType): boolean;
567 mapChildren(predicate?: (node: Node, index: number, nodes: Immutable.List<Node>) => Node): Node;
568 mapDescendants(predicate?: (node: Node, index: number, nodes: Immutable.List<Node>) => Node): Node | void;
569 marks(options?: IterableOptions & { onlyTypes: string[] }): Iterable<[Mark, Node, Immutable.List<number>]>;
570 mergeNode(path: Path): Node;
571 moveNode(path: Path, newPath: Path, newIndex?: number): Node;
572 normalize(editor: Editor): () => void | void;
573 regenerateKey(): Node;
574 removeMark(path: Path, mark: Mark): Node;
575 removeNode(path: Path): Node;
576 removeText(path: Path, offset: number, text: string): Node;
577 replaceNode(path: Path, node: Node): Node;
578 resolveAnnotation(annotation: Annotation | AnnotationProperties | AnnotationJSON): Annotation;
579 resolveDecoration(decoration: RangeType | RangeTypeProperties | RangeTypeJSON): Decoration;
580 resolvePath(path: Path, index?: number): Immutable.List<number>;
581 resolvePoint(point: Point | PointProperties | PointJSON): Point;
582 resolveRange(range: RangeTypeProperties | RangeTypeJSON | RangeType): Range;
583 resolveSelection(selection: Selection | SelectionProperties | SelectionJSON | Range): Selection;
584 setNode(path: Path, properties: NodeProperties): Node;
585 setMark(
586 path: Path,
587 properties: MarkProperties,
588 newProperties: MarkProperties
589 ): Node;
590 siblings(path: Path, options?: IterableOptions): Iterable<[Node, Immutable.List<number>]>;
591 splitNode(path: Path, position: number, properties: NodeProperties): Node;
592 texts(options: IterableOptions): Iterable<[Text, Immutable.List<number>]>;
593 validate(editor: Editor): Error | void;
594
595 /**
596 * Deprecated.
597 */
598
599 getBlocksAtRange(range: RangeProperties | RangeJSON | Range): Immutable.List<Block>;
600 getBlocksAtRangeAsArray(range: RangeProperties | RangeJSON | Range): Block[];
601 getInlinesAtRange(range: RangeProperties | RangeJSON | Range): Immutable.List<Inline>;
602 getInlinesAtRangeAsArray(range: RangeProperties | RangeJSON | Range): Inline[];
603 getNextTextAndPath(path: Path): Text | null;
604 getNextDeepMatchingNodeAndPath(path: Immutable.List<number>, iterator?: () => boolean): null | [Node, Immutable.List<number>];
605 getPreviousTextAndPath(path: Path): Text | null;
606 findFirstDescendantAndPath(
607 iterator: (
608 node: Node,
609 path: Immutable.List<number>,
610 nodes: Immutable.List<Node>
611 ) => boolean,
612 pathToThisNode: Immutable.List<number>
613 ): [Node, Immutable.List<number>] | null;
614 getPreviousMatchingNodeAndPath(path: Immutable.List<number>, iterator?: (node: Node) => boolean): [Node, Immutable.List<number>] | null;
615 getPreviousDeepMatchingNodeAndPath(path: Immutable.List<number>, iterator?: (node: Node) => boolean): [Node, Immutable.List<number>] | null;
616 findLastDescendantAndPath(
617 iterator: (
618 node: Node,
619 path: Immutable.List<number>,
620 nodes: Immutable.List<Node>
621 ) => boolean,
622 pathToThisNode: Immutable.List<number>
623 ): [Node, Immutable.List<number>] | null;
624 findDescendantAndPath(
625 iterator: (
626 node: Node,
627 path: Immutable.List<number>,
628 nodes: Immutable.List<Node>
629 ) => boolean,
630 path?: Immutable.List<number>,
631 findLast?: boolean
632 ): [Node, Immutable.List<number>] | null;
633 forEachDescendantWithPath(
634 iterator: (
635 node: Node,
636 path: Immutable.List<number>,
637 nodes: Immutable.List<Node>
638 ) => boolean,
639 path?: Immutable.List<number>,
640 findLast?: boolean
641 ): boolean;
642 getNextMatchingNodeAndPath(path: Immutable.List<number>, iterator?: (node: Node) => boolean): [Node, Immutable.List<number>]| null;
643 getSelectionIndexes(range: RangeType, isSelected?: boolean): { start: number, end: number } | boolean | null;
644 getTextsBetweenPositionsAsArray(startPath: Path, endPath: Path): Array<Node | null>;
645 getOrderedMarksBetweenPositions(
646 startPath: Path,
647 startOffset: number,
648 endPath: Path,
649 endOffset: number
650 ): Immutable.OrderedSet<Mark>;
651 getTextsBetweenPathPositionsAsArray(
652 startPath: Immutable.List<number>,
653 endPath: Immutable.List<number>
654 ): Array<Node | null>;
655 getFurthestAncestor(path: Path): Node | null;
656 getLeafBlocksAtRangeAsArray(range: Range | RangeProperties | RangeJSON): Block[];
657 getLeafBlocksBetweenPathPositionsAsArray(startPath: Immutable.List<number>, endPath: Immutable.List<number>): Block[];
658 getBlocksAsArray(): Block[];
659 getBlocksByTypeAsArray(type: string): Block[];
660 getFurthestOnlyChildAncestor(path: Path): Node | null;
661 getInlinesAsArray(): Inline[];
662 getInlinesByTypeAsArray(type: string): Inline[];
663 getLeafInlinesAtRangeAsArray(range: Range | RangeProperties | RangeJSON): Inline[];
664 getOrderedMarks(): Immutable.OrderedSet<Mark>;
665 getOrderedMarksAtRange(range: RangeProperties | RangeJSON | Range): Immutable.OrderedSet<Mark>;
666 getOrderedMarksByType(type: string): Immutable.OrderedSet<Mark>;
667 getOrderedMarksByTypeAsArray(type: string): Mark[];
668 getMarksAsArray(): Mark[];
669 getRootInlinesAtRangeAsArray(range: RangeProperties | RangeJSON | Range): Inline[];
670 getTextsAsArray(): Text[];
671 getTextsAtRangeAsArray(range: RangeProperties | RangeJSON | Range): Text[];
672 getMarksAtPosition(path: Path, offset: number): Immutable.OrderedSet<Mark>;
673 getNodesAtRange(range: RangeProperties | RangeJSON | Range): boolean;
674 isNodeInRange(path: Path, range: RangeProperties | RangeJSON | Range): boolean;
675
676 /**
677 * Assertion variants.
678 */
679
680 assertChild(path: Path): Node;
681 assertDepth(path: Path, startAt?: number): number;
682 assertDescendant(path: Path): Node;
683 assertNode(path: Path): Node;
684 assertParent(path: Path): Node;
685 assertPath(key: Path): Immutable.List<number>;
686}
687
688export interface MarkProperties {
689 object?: "mark" | undefined;
690 type: string;
691 data?: Data | { [key: string]: any } | undefined;
692}
693
694export interface MarkJSON {
695 object?: "mark" | undefined;
696 type: string;
697 data?: { [key: string]: any } | undefined;
698}
699
700export class Mark extends Immutable.Record({}) {
701 object: "mark";
702 type: string;
703 data: Data;
704
705 static create(properties: MarkProperties | MarkJSON | Mark | string): Mark;
706 static createSet(
707 element?:
708 | Array<MarkProperties | MarkJSON | Mark | string>
709 | Immutable.Set<MarkProperties | MarkJSON | Mark | string>
710 ): Immutable.Set<Mark>;
711 static createProperties(attrs: Partial<MarkProperties | MarkJSON | Mark | string>): MarkProperties;
712 static fromJSON(properties: MarkProperties | MarkJSON | Mark): Mark;
713 static fromJS(properties: MarkProperties | MarkJSON | Mark): Mark;
714 static isMark(maybeMark: any): maybeMark is Mark;
715 static isMarkSet(maybeMarkSet: any): maybeMarkSet is Immutable.Set<Mark>;
716
717 toJSON(): MarkJSON;
718 toJS(): MarkJSON;
719}
720
721export interface SelectionProperties {
722 object?: "selection" | undefined;
723 anchor?: Point | undefined;
724 focus?: Point | undefined;
725 isFocused?: boolean | undefined;
726 marks?: Immutable.Set<Mark> | Mark[] | undefined;
727}
728
729export interface SelectionJSON {
730 object?: "selection" | undefined;
731 anchor?: PointJSON | undefined;
732 focus?: PointJSON | undefined;
733 isFocused?: boolean | undefined;
734 marks?: MarkJSON[] | undefined;
735}
736
737export class Selection extends BaseRange {
738 object: "selection";
739 anchor: Point;
740 focus: Point;
741 isFocused: boolean;
742 marks: Immutable.Set<Mark>;
743
744 readonly isBlurred: boolean;
745
746 static create(
747 properties:
748 | RangeTypeProperties
749 | RangeTypeJSON
750 | RangeType
751 ): Selection;
752 static createProperties(
753 attrs:
754 | RangeTypeProperties
755 | RangeTypeJSON
756 | RangeType
757 | string
758 ): SelectionProperties;
759 static fromJSON(properties:
760 | RangeTypeProperties
761 | RangeTypeJSON
762 ): Selection;
763 static fromJS(properties:
764 | RangeTypeProperties
765 | RangeTypeJSON
766 ): Selection;
767
768 toJSON(): SelectionJSON;
769 toJS(): SelectionJSON;
770
771 isSelection(maybeSelection: any): maybeSelection is Selection;
772 setIsFocused(value: boolean): Selection;
773 setMarks(marks: Immutable.Set<Mark>): Selection;
774 setProperties(properties:
775 | RangeTypeProperties
776 | RangeTypeJSON
777 | RangeType
778 | string
779 ): Selection;
780}
781
782export interface RangeProperties {
783 object?: "range" | undefined;
784 anchor?: Point | undefined;
785 focus?: Point | undefined;
786}
787
788export interface RangeJSON {
789 object?: "range" | undefined;
790 anchor?: PointJSON | undefined;
791 focus?: PointJSON | undefined;
792}
793
794export class Range extends BaseRange {
795 object: "range";
796 anchor: Point;
797 focus: Point;
798
799 static create(properties: RangeTypeProperties | RangeTypeJSON | RangeType): Range;
800 static createList(
801 elements?:
802 | Array<RangeTypeProperties | RangeTypeJSON | RangeType>
803 | Immutable.List<RangeTypeProperties | RangeTypeJSON | RangeType>
804 ): Immutable.List<Range>;
805 static createProperties(
806 attrs: RangeTypeProperties | RangeTypeJSON | RangeType
807 ): RangeProperties;
808 static fromJSON(properties: RangeTypeJSON): Range;
809 static fromJS(properties: RangeTypeJSON): Range;
810 static isRange(maybeRange: any): maybeRange is RangeType;
811
812 toJSON(options?: { preserveKeys?: boolean | undefined }): RangeJSON;
813 toJS(options?: { preserveKeys?: boolean | undefined }): RangeJSON;
814}
815
816export interface DecorationProperties {
817 object?: "decoration" | undefined;
818 anchor?: Point | undefined;
819 focus?: Point | undefined;
820 type?: string | undefined;
821 data?: Data | { [key: string]: any } | undefined;
822}
823
824export interface DecorationJSON {
825 object?: "decoration" | undefined;
826 anchor?: PointJSON | undefined;
827 focus?: PointJSON | undefined;
828 type?: string | undefined;
829 data?: { [key: string]: any } | undefined;
830}
831
832export class Decoration extends BaseRange {
833 object: "decoration";
834 anchor: Point;
835 focus: Point;
836 type: string;
837 data: Data;
838
839 static create(properties:
840 | RangeTypeProperties
841 | RangeTypeJSON
842 | RangeType
843 ): Decoration;
844 static createList(
845 elements?:
846 | Array<RangeTypeProperties | RangeTypeJSON | RangeType>
847 | Immutable.List<RangeTypeProperties | RangeTypeJSON | RangeType>
848 ): Immutable.List<Decoration>;
849 static createProperties(
850 attrs: RangeTypeProperties | RangeTypeJSON | RangeType
851 ): DecorationProperties;
852 static fromJSON(properties: DecorationJSON & { mark?: MarkJSON | undefined }): Decoration;
853 static fromJSON(properties: DecorationJSON & { mark?: MarkJSON | undefined }): Decoration;
854 static isDecoration(maybeDecoration: any): maybeDecoration is Decoration;
855
856 setProperties(properties: RangeTypeProperties | RangeTypeJSON | RangeType): Decoration;
857
858 toJSON(): DecorationJSON;
859 toJS(): DecorationJSON;
860}
861
862export interface AnnotationProperties {
863 object?: "annotation" | undefined;
864 key: string;
865 type: string;
866 data?: Data | { [key: string]: any } | undefined;
867 anchor?: Point | undefined;
868 focus?: Point | undefined;
869}
870
871export interface AnnotationJSON {
872 object?: "annotation" | undefined;
873 key: string;
874 type: string;
875 data?: { [key: string]: any } | undefined;
876 anchor?: PointJSON | undefined;
877 focus?: PointJSON | undefined;
878}
879
880export class Annotation extends BaseRange {
881 object: "annotation";
882 key: string;
883 type: string;
884 data: Data;
885 anchor: Point;
886 focus: Point;
887
888 static create(properties: Annotation | AnnotationProperties | AnnotationJSON): Annotation;
889 static createMap(
890 elements?:
891 | { [key: string]: Annotation | AnnotationProperties | AnnotationJSON }
892 | Immutable.Map<string, Annotation>
893 ): Immutable.Map<string, Annotation>;
894 static createProperties(
895 attrs: AnnotationProperties | AnnotationJSON | Annotation
896 ): AnnotationProperties;
897 static fromJSON(properties: AnnotationProperties | AnnotationJSON): Annotation;
898 static fromJS(properties: AnnotationProperties | AnnotationJSON): Annotation;
899 static isAnnotation(maybeAnnotation: any): maybeAnnotation is Annotation;
900
901 toJSON(): AnnotationJSON;
902 toJS(): AnnotationJSON;
903
904 setProperties(properties: AnnotationProperties | AnnotationJSON | Annotation): Annotation;
905}
906
907export type RangeTypeProperties =
908 | RangeProperties
909 | SelectionProperties
910 | DecorationProperties
911 | AnnotationProperties;
912
913export type RangeTypeJSON = RangeJSON | SelectionJSON | DecorationJSON | AnnotationJSON;
914export type RangeType = Range | Selection | Decoration | Annotation;
915
916declare class BaseRange extends Immutable.Record({}) {
917 readonly isCollapsed: boolean;
918 readonly isExpanded: boolean;
919 readonly isBackward: boolean;
920 readonly isForward: boolean;
921 readonly isUnset: boolean;
922 readonly isSet: boolean;
923 readonly start: Point;
924 readonly end: Point;
925
926 flip(): RangeType;
927 moveForward(n?: number): RangeType;
928 moveBackward(n?: number): RangeType;
929
930 moveAnchorBackward(n?: number): RangeType;
931 moveAnchorForward(n?: number): RangeType;
932 moveAnchorTo(path: string | number | Immutable.List<number>, offset?: number): RangeType;
933 moveAnchorToStartOfNode(node: Node): RangeType;
934 moveAnchorToEndOfNode(node: Node): RangeType;
935
936 moveEndBackward(n?: number): RangeType;
937 moveEndForward(n?: number): RangeType;
938 moveEndTo(path: string | number | Immutable.List<number>, offset?: number): RangeType;
939 moveEndToStartOfNode(node: Node): RangeType;
940 moveEndToEndOfNode(node: Node): RangeType;
941
942 moveFocusBackward(n?: number): RangeType;
943 moveFocusForward(n?: number): RangeType;
944 moveFocusTo(path: string | number | Immutable.List<number>, offset?: number): RangeType;
945 moveFocusToStartOfNode(node: Node): RangeType;
946 moveFocusToEndOfNode(node: Node): RangeType;
947
948 moveStartBackward(n?: number): RangeType;
949 moveStartForward(n?: number): RangeType;
950 moveStartTo(path: string | number | Immutable.List<number>, offset?: number): RangeType;
951 moveStartToStartOfNode(node: Node): RangeType;
952 moveStartToEndOfNode(node: Node): RangeType;
953
954 moveToAnchor(): RangeType;
955 moveToEnd(): RangeType;
956 moveToEndOfNode(node: Node): RangeType;
957 moveToFocus(): RangeType;
958 moveToRangeOfNode(start: Node, end?: Node): RangeType;
959 moveToStart(): RangeType;
960 moveToStartOfNode(node: Node): RangeType;
961
962 normalize(node: Node): RangeType;
963
964 setAnchor(anchor: Point): RangeType;
965 setEnd(point: Point): RangeType;
966 setFocus(focus: Point): RangeType;
967 setIsAtomic(value: boolean): RangeType;
968 setIsFocused(value: boolean): RangeType;
969 setMarks(marks: Immutable.Set<Mark>): RangeType;
970 setPoints(values: Point[]): RangeType;
971 updatePoints(updater: (point: Point) => Point): RangeType;
972 setStart(point: Point): RangeType;
973 setProperties(
974 properties: RangeTypeProperties | RangeTypeJSON | RangeType
975 ): RangeType;
976
977 toJSON(): RangeTypeJSON;
978 toJS(): RangeTypeJSON;
979 toRange(): RangeType;
980 unset(): RangeType;
981}
982
983export interface PointProperties {
984 object?: "point" | undefined;
985 key?: string | undefined;
986 offset?: number | undefined;
987 path?: Immutable.List<number> | undefined;
988}
989
990export interface PointJSON {
991 object?: "point" | undefined;
992 key?: string | undefined;
993 offset?: number | undefined;
994 path?: number[] | undefined;
995}
996
997export class Point extends Immutable.Record({}) {
998 object: "point";
999 key: string;
1000 offset: number;
1001 path: Immutable.List<number>;
1002
1003 static create(properties: PointProperties | PointJSON | Point): Point;
1004 static createProperties(properties: PointProperties | PointJSON | Point): Point;
1005 static fromJSON(properties: PointJSON | PointProperties): Point;
1006 static fromJS(properties: PointJSON | PointProperties): Point;
1007 static isPoint(maybePoint: any): maybePoint is Point;
1008
1009 readonly isSet: boolean;
1010 readonly isUnset: boolean;
1011
1012 isAfterPoint(point: Point): boolean;
1013 isAfterRange(range: RangeType): boolean;
1014 isAtEndofRange(range: RangeType): boolean;
1015 isAtStartOfRange(range: RangeType): boolean;
1016 isBeforePoint(point: Point): boolean;
1017 isBeforeRange(range: RangeType): boolean;
1018 isInRange(range: RangeType): boolean;
1019 isAtEndOfNode(node: Node): boolean;
1020 isAtStartOfNode(node: Node): boolean;
1021 isInNode(node: Node): boolean;
1022
1023 moveBackward(n?: number): this;
1024 moveForward(n?: number): this;
1025 moveTo(path: string | number | Immutable.List<number>, offset?: number): this;
1026 moveToStartOfNode(node: Node): this;
1027 moveToEndOfNode(node: Node): this;
1028 normalize(node: Node): this;
1029 setKey(key: string): this;
1030 setOffset(offset: number): this;
1031 setPath(path: Immutable.List<number> | number[]): this;
1032 toJSON(options?: { preserveKeys?: boolean | undefined }): PointJSON;
1033 toJS(options?: { preserveKeys?: boolean | undefined }): PointJSON;
1034 unset(): this;
1035}
1036
1037export type Operation =
1038 | InsertTextOperation
1039 | RemoveTextOperation
1040 | AddMarkOperation
1041 | RemoveMarkOperation
1042 | SetMarkOperation
1043 | AddAnnotationOperation
1044 | RemoveAnnotationOperation
1045 | SetAnnotationOperation
1046 | InsertNodeOperation
1047 | MergeNodeOperation
1048 | MoveNodeOperation
1049 | RemoveNodeOperation
1050 | SetNodeOperation
1051 | SplitNodeOperation
1052 | SetSelectionOperation
1053 | SetValueOperation;
1054
1055export interface OperationProperties {
1056 object?: "operation" | undefined;
1057 type: string;
1058 text?: string | undefined;
1059 target?: number | undefined;
1060 properties?:
1061 | NodeProperties
1062 | ValueProperties
1063 | SelectionProperties
1064 | AnnotationProperties | undefined;
1065 position?: number | undefined;
1066 path?: Immutable.List<number> | undefined;
1067 offset?: number | undefined;
1068 node?: Node | undefined;
1069 newProperties?:
1070 | NodeProperties
1071 | ValueProperties
1072 | SelectionProperties
1073 | MarkProperties
1074 | AnnotationProperties | undefined;
1075 newPath?: Immutable.List<number> | undefined;
1076 mark?: Mark | undefined;
1077 data?: Data | { [key: string]: any } | undefined;
1078 annotation?: Annotation | undefined;
1079}
1080
1081export interface OperationJSON {
1082 object?: "operation" | undefined;
1083 type: string;
1084 text?: string | undefined;
1085 target?: number | undefined;
1086 properties?:
1087 | NodeJSON
1088 | ValueJSON
1089 | SelectionJSON
1090 | AnnotationJSON | undefined;
1091 position?: number | undefined;
1092 path?: number[] | undefined;
1093 offset?: number | undefined;
1094 node?: Node | undefined;
1095 newProperties?:
1096 | NodeJSON
1097 | ValueJSON
1098 | SelectionJSON
1099 | MarkJSON
1100 | AnnotationJSON | undefined;
1101 newPath?: number[] | undefined;
1102 mark?: MarkJSON | undefined;
1103 data?: { [key: string]: any } | undefined;
1104 annotation?: AnnotationJSON | undefined;
1105}
1106
1107export class BaseOperation extends Immutable.Record({}) {
1108 object: "operation";
1109 type: string;
1110
1111 static create(attrs?: Operation | OperationProperties | OperationJSON): Operation;
1112 static createList():
1113 | Immutable.List<Operation | OperationProperties | OperationJSON>
1114 | Array<Operation | OperationProperties | OperationJSON>;
1115
1116 static fromJSON(object: OperationProperties | OperationJSON): Operation;
1117 static fromJS(object: OperationProperties | OperationJSON): Operation;
1118
1119 static isOperation(maybeOperation: any): maybeOperation is Operation;
1120 static isOperationList(maybeOperationList: any): maybeOperationList is Immutable.List<Operation>;
1121
1122 toJSON(): OperationJSON;
1123
1124 apply(value: Value): Value;
1125 invert(): this;
1126}
1127
1128export class InsertTextOperation extends BaseOperation {
1129 type: "insert_text";
1130 path: Immutable.List<number>;
1131 offset: number;
1132 text: string;
1133 data: Data;
1134}
1135
1136export class RemoveTextOperation extends BaseOperation {
1137 type: "remove_text";
1138 path: Immutable.List<number>;
1139 offset: number;
1140 text: string;
1141 data: Data;
1142}
1143
1144export class AddMarkOperation extends BaseOperation {
1145 type: "add_mark";
1146 path: Immutable.List<number>;
1147 mark: Mark;
1148 data: Data;
1149}
1150
1151export class RemoveMarkOperation extends BaseOperation {
1152 type: "remove_mark";
1153 path: Immutable.List<number>;
1154 mark: Mark;
1155 data: Data;
1156}
1157
1158export class SetMarkOperation extends BaseOperation {
1159 type: "set_mark";
1160 path: Immutable.List<number>;
1161 properties: MarkProperties;
1162 newProperties: MarkProperties;
1163 data: Data;
1164}
1165
1166export class AddAnnotationOperation extends BaseOperation {
1167 type: "add_annotation";
1168 annotation: Annotation;
1169 data: Data;
1170}
1171
1172export class RemoveAnnotationOperation extends BaseOperation {
1173 type: "remove_annotation";
1174 annotation: Annotation;
1175 data: Data;
1176}
1177
1178export class SetAnnotationOperation extends BaseOperation {
1179 type: "set_annotation";
1180 properties: AnnotationProperties;
1181 newProperties: AnnotationProperties;
1182 data: Data;
1183}
1184
1185export class InsertNodeOperation extends BaseOperation {
1186 type: "insert_node";
1187 path: Immutable.List<number>;
1188 node: Node;
1189 data: Data;
1190}
1191
1192export class MergeNodeOperation extends BaseOperation {
1193 type: "merge_node";
1194 path: Immutable.List<number>;
1195 position: number;
1196 properties: NodeProperties;
1197 data: Data;
1198}
1199
1200export class MoveNodeOperation extends BaseOperation {
1201 type: "move_node";
1202 path: Immutable.List<number>;
1203 newPath: Immutable.List<number>;
1204 data: Data;
1205}
1206
1207export class RemoveNodeOperation extends BaseOperation {
1208 type: "remove_node";
1209 path: Immutable.List<number>;
1210 node: Node;
1211 data: Data;
1212}
1213
1214export class SetNodeOperation extends BaseOperation {
1215 type: "set_node";
1216 path: Immutable.List<number>;
1217 properties: NodeProperties;
1218 newProperties: NodeProperties;
1219 data: Data;
1220}
1221
1222export class SplitNodeOperation extends BaseOperation {
1223 type: "split_node";
1224 path: Immutable.List<number>;
1225 position: number;
1226 target: number;
1227 properties: NodeProperties;
1228 data: Data;
1229}
1230
1231export class SetSelectionOperation extends BaseOperation {
1232 type: "set_selection";
1233 properties: SelectionProperties;
1234 newProperties: SelectionProperties;
1235 data: Data;
1236}
1237
1238export class SetValueOperation extends BaseOperation {
1239 type: "set_value";
1240 properties: ValueProperties;
1241 newProperties: ValueProperties;
1242 data: Data;
1243}
1244
1245export type ErrorCode =
1246 | "child_max_invalid"
1247 | "child_min_invalid"
1248 | "child_object_invalid"
1249 | "child_required"
1250 | "child_type_invalid"
1251 | "child_unknown"
1252 | "first_child_object_invalid"
1253 | "first_child_type_invalid"
1254 | "last_child_object_invalid"
1255 | "last_child_type_invalid"
1256 | "next_sibling_object_invalid"
1257 | "next_sibling_type_invalid"
1258 | "node_data_invalid"
1259 | "node_is_void_invalid"
1260 | "node_mark_invalid"
1261 | "node_object_invalid"
1262 | "node_text_invalid"
1263 | "node_type_invalid"
1264 | "parent_object_invalid"
1265 | "parent_type_invalid"
1266 | "previous_sibling_object_invalid"
1267 | "previous_sibling_type_invalid";
1268
1269export class SlateError extends Error {
1270 code: ErrorCode;
1271 [key: string]: any;
1272}
1273
1274export namespace KeyUtils {
1275 function create(key?: string): string;
1276 function setGenerator(func: () => any): void;
1277 function resetGenerator(): void;
1278}
1279
1280export type useMemoization = (enabled: boolean) => void;
1281export type resetMemoization = () => void;
1282
1283export namespace PathUtils {
1284 /**
1285 * Compare paths `path` and `target` to see which is before or after.
1286 */
1287 function compare(
1288 path: Immutable.List<number>,
1289 target: Immutable.List<number>
1290 ): number | null;
1291
1292 /**
1293 * Create a path from `attrs`.
1294 */
1295 function create(
1296 attrs: Immutable.List<number> | number[]
1297 ): Immutable.List<number>;
1298
1299 /**
1300 * Crop paths `a` and `b` to an equal size, defaulting to the shortest.
1301 */
1302 function crop(
1303 a: Immutable.List<number>,
1304 b: Immutable.List<number>,
1305 size?: number
1306 ): Array<Immutable.List<number>>;
1307
1308 /**
1309 * Decrement a `path` by `n` at `index`, defaulting to the last index.
1310 */
1311 function decrement(
1312 path: Immutable.List<number>,
1313 n?: number,
1314 index?: number
1315 ): Immutable.List<number>;
1316
1317 /**
1318 * Get all ancestor paths of the given path.
1319 */
1320 function getAncestors(
1321 path: Immutable.List<number>
1322 ): Immutable.List<number>;
1323
1324 /**
1325 * Increment a `path` by `n` at `index`, defaulting to the last index.
1326 */
1327 function increment(
1328 path: Immutable.List<number>,
1329 n?: number,
1330 index?: number
1331 ): Immutable.List<number>;
1332
1333 /**
1334 * Is a `path` above another `target` path?
1335 */
1336 function isAbove(
1337 path: Immutable.List<number>,
1338 target: Immutable.List<number>
1339 ): boolean;
1340
1341 /**
1342 * Is a `path` after another `target` path in a document?
1343 */
1344 function isAfter(
1345 path: Immutable.List<number>,
1346 target: Immutable.List<number>
1347 ): boolean;
1348
1349 /**
1350 * Is a `path` before another `target` path in a document?
1351 */
1352 function isBefore(
1353 path: Immutable.List<number>,
1354 target: Immutable.List<number>
1355 ): boolean;
1356
1357 /**
1358 * Is a `path` equal to another `target` path in a document?
1359 */
1360 function isEqual(
1361 path: Immutable.List<number>,
1362 target: Immutable.List<number>
1363 ): boolean;
1364
1365 /**
1366 * Is a `path` older than a `target` path? Meaning that it ends as an older
1367 * sibling of one of the indexes in the target.
1368 */
1369 function isOlder(
1370 path: Immutable.List<number>,
1371 target: Immutable.List<number>
1372 ): boolean;
1373
1374 /**
1375 * Is an `any` object a path?
1376 */
1377 function isPath(
1378 maybePath: any
1379 ): maybePath is (Immutable.List<number> | number[]);
1380
1381 /**
1382 * Is a `path` a sibling of a `target` path?
1383 */
1384 function isSibling(
1385 path: Immutable.List<number>,
1386 target: Immutable.List<number>
1387 ): boolean;
1388
1389 /**
1390 * Is a `path` younger than a `target` path? Meaning that it ends as a younger
1391 * sibling of one of the indexes in the target.
1392 */
1393 function isYounger(
1394 path: Immutable.List<number>,
1395 target: Immutable.List<number>
1396 ): boolean;
1397
1398 /**
1399 * Lift a `path` to refer to its `n`th ancestor.
1400 */
1401 function lift(
1402 path: Immutable.List<number>,
1403 n?: number
1404 ): Immutable.List<number>;
1405
1406 /**
1407 * Drop a `path`, returning a relative path from a depth of `n`.
1408 */
1409 function drop(
1410 path: Immutable.List<number>,
1411 n?: number
1412 ): Immutable.List<number>;
1413
1414 /**
1415 * Get the maximum length of paths `a` and `b`.
1416 */
1417 function max(
1418 a: Immutable.List<number>,
1419 b: Immutable.List<number>
1420 ): number;
1421
1422 /**
1423 * Get the minimum length of paths `a` and `b`.
1424 */
1425 function min(
1426 a: Immutable.List<number>,
1427 b: Immutable.List<number>
1428 ): number;
1429
1430 /**
1431 * Get the common ancestor path of path `a` and path `b`.
1432 */
1433 function relate(
1434 a: Immutable.List<number>,
1435 b: Immutable.List<number>
1436 ): Immutable.List<number>;
1437
1438 /**
1439 * Transform a `path` by an `operation`, adjusting it to stay current.
1440 */
1441 function transform(
1442 path: Immutable.List<number>,
1443 operation: Operation | OperationJSON | OperationProperties
1444 ): Immutable.List<Immutable.List<number>>;
1445}
1446
1447export interface Command {
1448 type: string;
1449 args: any[];
1450}
1451
1452export interface Query {
1453 type: string;
1454 args: any[];
1455}
1456
1457export type CommandFunc<T extends Controller = Controller> = (editor: T, ...args: any[]) => T;
1458export type QueryFunc<T extends Controller = Controller> = (editor: T, ...args: any[]) => any;
1459
1460export interface Plugin<T extends Controller = Controller> {
1461 normalizeNode?: ((node: Node, editor: T, next: () => void) => ((editor: T) => void) | void) | undefined;
1462 onChange?: ((editor: T, next: () => void) => void) | undefined;
1463 onCommand?: ((command: Command, editor: T, next: () => void) => void) | undefined;
1464 onConstruct?: ((editor: T, next: () => void) => void) | undefined;
1465 onQuery?: ((query: Query, editor: T, next: () => void) => void) | undefined;
1466 validateNode?: ((node: Node, editor: T, next: () => void) => SlateError | void) | undefined;
1467
1468 commands?: {[name: string]: CommandFunc<T>} | undefined;
1469 queries?: {[name: string]: QueryFunc<T>} | undefined;
1470 schema?: SchemaProperties | undefined;
1471}
1472
1473export interface Plugins<T extends Controller = Controller> extends Array<Plugin<T> | Plugins<T>> {}
1474
1475export interface EditorProperties<T extends Controller = Controller> {
1476 object?: "editor" | undefined;
1477 onChange?: ((change: { operations: Immutable.List<Operation>; value: Value }) => void) | undefined;
1478 plugins?: Plugins<T> | undefined;
1479 readOnly?: boolean | undefined;
1480 value?: Value | undefined;
1481}
1482
1483export interface EditorOptions {
1484 controller?: Controller | undefined;
1485 construct?: boolean | undefined;
1486 normalize?: boolean | undefined;
1487}
1488
1489export class Editor implements Controller {
1490 object: "editor";
1491 controller: Controller;
1492 middleware: object;
1493 onChange: (change: { operations: Immutable.List<Operation>, value: Value }) => void;
1494 operations: Immutable.List<Operation>;
1495 plugins: Array<Plugin<Editor>>;
1496 readOnly: boolean;
1497 value: Value;
1498
1499 constructor(attributes: EditorProperties<Editor>, options?: EditorOptions);
1500
1501 /**
1502 * Synchronously flush the current changes to editor, calling onChange.
1503 * In normal operation you never need to use this method! Reserved for testing.
1504 */
1505 flush(): Editor;
1506
1507 setReadOnly(readOnly: boolean): Editor;
1508
1509 /**
1510 * Set the editor's value state.
1511 * You can optionally provide a normalize option to either for the editor to completely re-normalize the new value based on its schema or not.
1512 * By default, the editor will re-normalize only if the value is not equal to its previously seen value (which it knows was normalized).
1513 */
1514 setValue(value: Value, options?: { normalize: boolean }): Editor;
1515
1516 isEditor(maybeEditor: any): maybeEditor is Editor;
1517
1518 addMark(mark: string | MarkProperties | MarkJSON | Mark): Editor;
1519 addMarks(mark: Set<string | MarkProperties | MarkJSON | Mark> | Array<string | MarkProperties | MarkJSON | Mark>): Editor;
1520 delete(): Editor;
1521 deleteBackward(n?: number): Editor;
1522 deleteForward(n?: number): Editor;
1523 insertBlock(block: string | Block | BlockProperties | BlockJSON): Editor;
1524 insertFragment(fragment: Document): Editor;
1525 insertInline(inline: string | Inline | InlineProperties | InlineJSON): Editor;
1526 insertText(text: string, marks?: Immutable.Set<string | MarkProperties | MarkJSON | Mark> | Array<string | MarkProperties | MarkJSON | Mark>): Editor;
1527 setBlocks(properties: string | Block | BlockProperties | BlockJSON): Editor;
1528 setInlines(properties: string | Inline | InlineProperties): Editor;
1529 splitBlock(depth?: number): Editor;
1530 splitInline(depth: number): Editor;
1531 removeMark(mark: string | MarkProperties | MarkJSON | Mark): Editor;
1532 replaceMark(mark: string | MarkProperties | MarkJSON | Mark, newMark: string | MarkProperties | MarkJSON | Mark): Editor;
1533 toggleMark(mark: string | MarkProperties | MarkJSON | Mark): Editor;
1534 unwrapBlock(properties: string | Block | BlockProperties | BlockJSON): Editor;
1535 unwrapInline(properties: string | Inline | InlineProperties | InlineJSON): Editor;
1536 wrapBlock(properties: string | Block | BlockProperties | BlockJSON): Editor;
1537 wrapInline(properties: string | Inline | InlineProperties | InlineJSON): Editor;
1538 wrapText(prefix: string, suffix?: string): Editor;
1539 blur(): Editor;
1540 deselect(): Editor;
1541 flip(): Editor;
1542 focus(): Editor;
1543 moveAnchorBackward(n?: number): Editor;
1544 moveAnchorWordBackward(): Editor;
1545 moveAnchorForward(n?: number): Editor;
1546 moveAnchorWordForward(): Editor;
1547 moveAnchorTo(path: string | number | Immutable.List<number>, offset?: number): Editor;
1548 moveAnchorToEndOfBlock(): Editor;
1549 moveAnchorToEndOfInline(): Editor;
1550 moveAnchorToEndOfDocument(): Editor;
1551 moveAnchorToEndOfNextBlock(): Editor;
1552 moveAnchorToEndOfNextInline(): Editor;
1553 moveAnchorToEndOfNextText(): Editor;
1554 moveAnchorToEndOfNode(node: Block | Document | Inline | Text): Editor;
1555 moveAnchorToEndOfPreviousBlock(): Editor;
1556 moveAnchorToEndOfPreviousInline(): Editor;
1557 moveAnchorToEndOfPreviousText(): Editor;
1558 moveAnchorToEndOfText(): Editor;
1559 moveAnchorToStartOfBlock(): Editor;
1560 moveAnchorToStartOfDocument(): Editor;
1561 moveAnchorToStartOfInline(): Editor;
1562 moveAnchorToStartOfNextBlock(): Editor;
1563 moveAnchorToStartOfNextInline(): Editor;
1564 moveAnchorToStartOfNextText(): Editor;
1565 moveAnchorToStartOfNode(node: Block | Document | Inline | Text): Editor;
1566 moveAnchorToStartOfPreviousBlock(): Editor;
1567 moveAnchorToStartOfPreviousInline(): Editor;
1568 moveAnchorToStartOfPreviousText(): Editor;
1569 moveAnchorToStartOfText(): Editor;
1570 moveEndBackward(n?: number): Editor;
1571 moveEndForward(n?: number): Editor;
1572 moveEndTo(path: string | number | Immutable.List<number>, offset?: number): Editor;
1573 moveEndToEndOfBlock(): Editor;
1574 moveEndToEndOfDocument(): Editor;
1575 moveEndToEndOfInline(): Editor;
1576 moveEndToEndOfNextBlock(): Editor;
1577 moveEndToEndOfNextInline(): Editor;
1578 moveEndToEndOfNextText(): Editor;
1579 moveEndToEndOfNode(node: Block | Document | Inline | Text): Editor;
1580 moveEndToEndOfPreviousBlock(): Editor;
1581 moveEndToEndOfPreviousInline(): Editor;
1582 moveEndToEndOfPreviousText(): Editor;
1583 moveEndToEndOfText(): Editor;
1584 moveEndToStartOfBlock(): Editor;
1585 moveEndToStartOfDocument(): Editor;
1586 moveEndToStartOfInline(): Editor;
1587 moveEndToStartOfNextBlock(): Editor;
1588 moveEndToStartOfNextInline(): Editor;
1589 moveEndToStartOfNextText(): Editor;
1590 moveEndToStartOfNode(node: Block | Document | Inline | Text): Editor;
1591 moveEndToStartOfPreviousBlock(): Editor;
1592 moveEndToStartOfPreviousInline(): Editor;
1593 moveEndToStartOfPreviousText(): Editor;
1594 moveEndToStartOfText(): Editor;
1595 moveEndWordBackward(): Editor;
1596 moveEndWordForward(): Editor;
1597 moveFocusBackward(n?: number): Editor;
1598 moveFocusForward(n?: number): Editor;
1599 moveFocusTo(path: string | number | Immutable.List<number>, offset?: number): Editor;
1600 moveFocusToEndOfBlock(): Editor;
1601 moveFocusToEndOfDocument(): Editor;
1602 moveFocusToEndOfInline(): Editor;
1603 moveFocusToEndOfNextBlock(): Editor;
1604 moveFocusToEndOfNextInline(): Editor;
1605 moveFocusToEndOfNextText(): Editor;
1606 moveFocusToEndOfNode(node: Block | Document | Inline | Text): Editor;
1607 moveFocusToEndOfPreviousBlock(): Editor;
1608 moveFocusToEndOfPreviousInline(): Editor;
1609 moveFocusToEndOfPreviousText(): Editor;
1610 moveFocusToEndOfText(): Editor;
1611 moveFocusToStartOfBlock(): Editor;
1612 moveFocusToStartOfDocument(): Editor;
1613 moveFocusToStartOfInline(): Editor;
1614 moveFocusToStartOfNextBlock(): Editor;
1615 moveFocusToStartOfNextInline(): Editor;
1616 moveFocusToStartOfNextText(): Editor;
1617 moveFocusToStartOfNode(node: Block | Document | Inline | Text): Editor;
1618 moveFocusToStartOfPreviousBlock(): Editor;
1619 moveFocusToStartOfPreviousInline(): Editor;
1620 moveFocusToStartOfPreviousText(): Editor;
1621 moveFocusToStartOfText(): Editor;
1622 moveFocusWordBackward(): Editor;
1623 moveFocusWordForward(): Editor;
1624 moveStartForward(n?: number): Editor;
1625 moveStartBackward(n?: number): Editor;
1626 moveStartTo(path: string | number | Immutable.List<number>, n?: number): Editor;
1627 moveStartToEndOfBlock(): Editor;
1628 moveStartToEndOfDocument(): Editor;
1629 moveStartToEndOfInline(): Editor;
1630 moveStartToEndOfNextBlock(): Editor;
1631 moveStartToEndOfNextInline(): Editor;
1632 moveStartToEndOfNextText(): Editor;
1633 moveStartToEndOfNode(node: Block | Document | Inline | Text): Editor;
1634 moveStartToEndOfPreviousBlock(): Editor;
1635 moveStartToEndOfPreviousInline(): Editor;
1636 moveStartToEndOfPreviousText(): Editor;
1637 moveStartToEndOfText(): Editor;
1638 moveStartToStartOfBlock(): Editor;
1639 moveStartToStartOfDocument(): Editor;
1640 moveStartToStartOfInline(): Editor;
1641 moveStartToStartOfNextBlock(): Editor;
1642 moveStartToStartOfNextInline(): Editor;
1643 moveStartToStartOfNextText(): Editor;
1644 moveStartToStartOfNode(node: Block | Document | Inline | Text): Editor;
1645 moveStartToStartOfPreviousBlock(): Editor;
1646 moveStartToStartOfPreviousInline(): Editor;
1647 moveStartToStartOfPreviousText(): Editor;
1648 moveStartToStartOfText(): Editor;
1649 moveStartWordForward(): Editor;
1650 moveStartWordBackward(): Editor;
1651 moveBackward(n?: number): Editor;
1652 moveForward(n?: number): Editor;
1653 moveTo(path: string | number | Immutable.List<number>, offset?: number): Editor;
1654 moveToAnchor(): Editor;
1655 moveToFocus(): Editor;
1656 moveToStart(): Editor;
1657 moveToEnd(): Editor;
1658 moveToEndOfBlock(): Editor;
1659 moveToEndOfDocument(): Editor;
1660 moveToEndOfInline(): Editor;
1661 moveToEndOfNextBlock(): Editor;
1662 moveToEndOfNextInline(): Editor;
1663 moveToEndOfNextText(): Editor;
1664 moveToEndOfNode(node: Block | Document | Inline | Text): Editor;
1665 moveToEndOfPreviousBlock(): Editor;
1666 moveToEndOfPreviousInline(): Editor;
1667 moveToEndOfPreviousText(): Editor;
1668 moveToEndOfText(): Editor;
1669 moveToStartOfBlock(): Editor;
1670 moveToStartOfDocument(): Editor;
1671 moveToStartOfInline(): Editor;
1672 moveToStartOfNextBlock(): Editor;
1673 moveToStartOfNextInline(): Editor;
1674 moveToStartOfNextText(): Editor;
1675 moveToStartOfNode(node: Block | Document | Inline | Text): Editor;
1676 moveToStartOfPreviousBlock(): Editor;
1677 moveToStartOfPreviousInline(): Editor;
1678 moveToStartOfPreviousText(): Editor;
1679 moveToStartOfText(): Editor;
1680 moveWordBackward(): Editor;
1681 moveWordForward(): Editor;
1682 moveToRangeOfDocument(): Editor;
1683 moveToRangeOfNode(node: Block | Document | Inline | Text): Editor;
1684 select(
1685 properties: string | RangeTypeProperties| RangeTypeJSON | RangeType,
1686 options?: { snapshot?: boolean | undefined }
1687 ): Editor;
1688 setAnchor(point: Point): void;
1689 setEnd(point: Point): void;
1690 setFocus(point: Point): void;
1691 setStart(point: Point): void;
1692 addMarkAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, mark: string | MarkProperties | Mark): Editor;
1693 addMarksAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, marks: Array<string | MarkProperties | MarkJSON | Mark> | Immutable.Set<string | MarkProperties | MarkJSON | Mark>): Editor;
1694 deleteAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType): Editor;
1695 deleteCharBackward(): Editor;
1696 deleteCharBackwardAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType): Editor;
1697 deleteLineBackward(): Editor;
1698 deleteLineBackwardAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType): Editor;
1699 deleteWordBackward(): Editor;
1700 deleteWordBackwardAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType): Editor;
1701 deleteBackwardAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, n?: number): Editor;
1702 deleteCharForward(): Editor;
1703 deleteCharForwardAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType): Editor;
1704 deleteLineForward(): Editor;
1705 deleteLineForwardAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType): Editor;
1706 deleteWordForwardAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType): Editor;
1707 deleteWordForward(): Editor;
1708 deleteForwardAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, n?: number): Editor;
1709 insertBlockAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, block: string | Block | BlockProperties | BlockJSON): Editor;
1710 insertFragmentAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, fragment: Document): Editor;
1711 insertInlineAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, inline: Inline | InlineProperties | InlineJSON): Editor;
1712 insertTextAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, text: string): Editor;
1713 setBlocksAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, properties: string | Block | BlockProperties | BlockJSON): Editor;
1714 setInlinesAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, properties: string | Inline | InlineProperties | InlineJSON): Editor;
1715 splitBlockAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, height?: number): Editor;
1716 splitInlineAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, height?: number): Editor;
1717 removeMarkAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, mark: string | MarkProperties | MarkJSON | Mark): Editor;
1718 toggleMarkAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, mark: string | MarkProperties | MarkJSON | Mark): Editor;
1719 unwrapBlockAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, properties: string | Block | BlockProperties | BlockJSON): Editor;
1720 unwrapInlineAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, properties: string | Inline | InlineProperties | InlineJSON): Editor;
1721 wrapBlockAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, properties: string | Block | BlockProperties | BlockJSON): Editor;
1722 wrapInlineAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, properties: string | Inline | InlineProperties | InlineJSON): Editor;
1723 wrapTextAtRange(range: RangeTypeProperties| RangeTypeJSON | RangeType, prefix: string, suffix?: string): Editor;
1724 addMarkByKey(key: string, offset: number, length: number, mark: string | MarkProperties | MarkJSON | Mark): Editor;
1725 addMarkByPath(path: Immutable.List<number>, offset: number, length: number, mark: string | MarkProperties | MarkJSON | Mark): Editor;
1726 addMarksByPath(
1727 path: Immutable.List<number>,
1728 offset: number, length: number,
1729 marks:
1730 | Array<string | MarkProperties | MarkJSON | Mark>
1731 | Immutable.Set<string | MarkProperties | MarkJSON | Mark>
1732 ): Editor;
1733 insertNodeByKey(key: string, index: number, node: Block | Document | Inline | Text): Editor;
1734 insertNodeByPath(path: Immutable.List<number>, index: number, node: Block | Document | Inline | Text): Editor;
1735 insertFragmentByKey(key: string, index: number, fragment: Document): Editor;
1736 insertFragmentByPath(path: Immutable.List<number>, index: number, fragment: Document): Editor;
1737 insertTextByKey(
1738 key: string,
1739 offset: number,
1740 text: string,
1741 marks?:
1742 | Array<string | MarkProperties | MarkJSON | Mark>
1743 | Immutable.Set<string | MarkProperties | MarkJSON | Mark>
1744 ): Editor;
1745 insertTextByPath(
1746 path: Immutable.List<number>,
1747 offset: number,
1748 text: string,
1749 marks?:
1750 | Array<string | MarkProperties | MarkJSON | Mark>
1751 | Immutable.Set<string | MarkProperties | MarkJSON | Mark>
1752 ): Editor;
1753 mergeNodeByKey(key: string): Editor;
1754 mergeNodeByPath(path: Immutable.List<number>): Editor;
1755 moveNodeByKey(key: string, newKey: string, newIndex: number): Editor;
1756 moveNodeByPath(path: Immutable.List<number>, newPath: Immutable.List<number>, newIndex: number): Editor;
1757 removeMarkByKey(key: string, offset: number, length: number, mark: string | MarkProperties | MarkJSON | Mark): Editor;
1758 removeMarkByPath(path: Immutable.List<number>, offset: number, length: number, mark: string | MarkProperties | MarkJSON | Mark): Editor;
1759 removeAllMarksByKey(key: string): Editor;
1760 removeAllMarksByPath(path: Immutable.List<number>): Editor;
1761 removeMarksByPath(
1762 path: Immutable.List<number>,
1763 offset: number,
1764 length: number,
1765 marks:
1766 | Array<string | MarkProperties | MarkJSON | Mark>
1767 | Immutable.Set<string | MarkProperties | MarkJSON | Mark>
1768 ): Editor;
1769 removeNodeByKey(key: string): Editor;
1770 removeNodeByPath(path: Immutable.List<number>): Editor;
1771 replaceNodeByKey(key: string, node: Block | Document | Inline | Text): Editor;
1772 replaceNodeByPath(path: Immutable.List<number>, newNode: Block | Document | Inline | Text): Editor;
1773 removeTextByKey(key: string, offset: number, length: number): Editor;
1774 removeTextByPath(path: Immutable.List<number>, offset: number, length: number): Editor;
1775 replaceTextByKey(key: string, node: Block | Document | Inline | Text): Editor;
1776 replaceTextByPath(
1777 path: Immutable.List<number>,
1778 offset: number,
1779 length: number,
1780 text: string,
1781 marks?: Immutable.Set<Mark> | Mark[]
1782 ): Editor;
1783 setMarkByKey(
1784 key: string,
1785 offset: number,
1786 length: number,
1787 properties: string | MarkProperties | MarkJSON | Mark,
1788 newProperties: string | Partial<MarkProperties> | Partial<MarkJSON> | Partial<Mark>
1789 ): Editor;
1790 setMarkByPath(
1791 path: Immutable.List<number>,
1792 offset: number,
1793 length: number,
1794 properties: string | MarkProperties | MarkJSON | Mark,
1795 newProperties: string | Partial<MarkProperties> | Partial<MarkJSON> | Partial<Mark>
1796 ): Editor;
1797 setNodeByKey(key: string, properties: string | Partial<BlockProperties> | Partial<InlineProperties>): Editor;
1798 setNodeByPath(path: Immutable.List<number>, newProperties: string | NodeProperties): Editor;
1799 setTextByKey(key: string, text: string, marks: Immutable.Set<Mark>): Editor;
1800 setTextByPath(path: Immutable.List<number>, text: string, marks: Immutable.Set<Mark>): Editor;
1801 splitDescendantsByKey(key: string, textKey: string, textOffset: number): Editor;
1802 splitDescendantsByPath(path: Immutable.List<number>, textPath: Immutable.List<number>, textOffset: number): Editor;
1803 splitNodeByKey(key: string, offset: number): Editor;
1804 splitNodeByPath(path: Immutable.List<number>, position: number, options?: { target?: number | undefined }): Editor;
1805 unwrapInlineByKey(key: string, properties: string | InlineProperties): Editor;
1806 unwrapInlineByPath(path: Path, properties: string | InlineProperties): Editor;
1807 unwrapBlockByKey(key: string, properties: string | BlockProperties): Editor;
1808 unwrapBlockByPath(path: Path, properties: string | BlockProperties): Editor;
1809 unwrapChildrenByKey(key: string): Editor;
1810 unwrapChildrenByPath(path: Immutable.List<number> | number[]): Editor;
1811 unwrapNodeByKey(key: string): Editor;
1812 unwrapNodeByPath(path: Immutable.List<number>): Editor;
1813 wrapInlineByKey(key: string, properties: string | InlineProperties): Editor;
1814 wrapInlineByPath(path: Path, properties: string | InlineProperties): Editor;
1815 wrapBlockByKey(key: string, properties: string | BlockProperties): Editor;
1816 wrapBlockByPath(path: Immutable.List<number>, block: string | Block): Editor;
1817 wrapNodeByKey(key: string, parent: Block | Document | Inline | Text): Editor;
1818 wrapNodeByPath(path: Immutable.List<number>, parent: Block | Document | Inline | Text): Editor;
1819 normalize(): Editor;
1820 withoutNormalizing(fn: () => void): Editor;
1821 withoutSaving(fn: () => void): Editor;
1822 withoutMerging(fn: () => void): Editor;
1823 redo(): Editor;
1824 undo(): Editor;
1825 save(operation: Operation): void;
1826 snapshotSelection(): Editor;
1827 command(type: string | ((...args: any[]) => any), ...args: any[]): Editor;
1828 hasCommand(type: string): boolean;
1829 hasQuery(type: string): boolean;
1830 query(query: string | ((...args: any[]) => any), ...args: any[]): any;
1831 registerCommand(command: string): Editor;
1832 registerQuery(query: string): Editor;
1833 applyOperation(operation: Operation | OperationJSON | OperationProperties): Editor;
1834 run(key: string, ...args: any[]): Editor;
1835 setData(data: Data): Editor;
1836 addAnnotation(annotation: AnnotationProperties | AnnotationJSON | Annotation): Editor;
1837 removeAnnotation(annotation: AnnotationProperties | AnnotationJSON | Annotation): Editor;
1838 setAnnotation(annotation: Annotation, newProperties: AnnotationProperties | AnnotationJSON | Annotation): Editor;
1839}
1840
1841export interface Controller {
1842 // Current Selection Commands //
1843 /**
1844 * Add a mark to the characters in the current selection
1845 */
1846 addMark(mark: MarkProperties | MarkJSON | Mark | string): Controller;
1847 addMarks(mark:
1848 | Set<MarkProperties | MarkJSON | Mark | string>
1849 | Array<MarkProperties | MarkJSON | Mark | string>
1850 ): Controller;
1851 /**
1852 * Delete everything in the current selection.
1853 */
1854 delete(): Controller;
1855
1856 /**
1857 * Delete backward n characters at the current cursor.
1858 * If the selection is expanded, behaviour is equivalent to delete()
1859 */
1860 deleteBackward(n?: number): Controller;
1861
1862 /**
1863 * Delete backward n characters at the current cursor.
1864 * If the selection is expanded, behaviour is equivalent to delete()
1865 */
1866 deleteForward(n?: number): Controller;
1867
1868 /**
1869 * Insert a new block at the same level as the current block, splitting the current block to make room if it is non-empty.
1870 * If the selection is expanded, it will be deleted first.
1871 */
1872 insertBlock(block: Block | BlockProperties | BlockJSON | string): Controller;
1873
1874 /**
1875 * Insert a document fragment at the current selection. If the selection is expanded, it will be deleted first.
1876 */
1877 insertFragment(fragment: Document): Controller;
1878
1879 /**
1880 * Insert a new inline at the current cursor position, splitting the text to make room if it is non-empty.
1881 * If the selection is expanded, it will be deleted first.
1882 */
1883 insertInline(inline: Inline | InlineProperties | InlineJSON | string): Controller;
1884
1885 /**
1886 * Insert a string of text at the current selection. If the selection is expanded, it will be deleted first
1887 */
1888 insertText(text: string): Controller;
1889
1890 /**
1891 * Set the properties of the Blocks in the current selection.
1892 * Passing a string will set the blocks' type only.
1893 */
1894 setBlocks(properties: Block | BlockProperties | BlockJSON | string): Controller;
1895
1896 /**
1897 * Set the properties of the Inlines nodes in the current selection.
1898 * Passing a string will set the nodes' type only.
1899 */
1900 setInlines(properties: Inline | InlineProperties | InlineProperties | string): Controller;
1901
1902 /**
1903 * Split the Block in the current selection by depth levels.
1904 * If the selection is expanded, it will be deleted first.
1905 */
1906 splitBlock(depth?: number): Controller;
1907
1908 /**
1909 * Split the Inline node in the current selection by depth levels.
1910 * If the selection is expanded, it will be deleted first
1911 */
1912 splitInline(depth: number): Controller;
1913
1914 /**
1915 * Remove a mark from the characters in the current selection.
1916 * Passing a string will implicitly create a Mark of that type for removal.
1917 */
1918 removeMark(mark: Mark | MarkProperties | MarkJSON | string): Controller;
1919
1920 /**
1921 * Remove a mark from the characters in the current selection.
1922 * Passing a string will implicitly create a Mark of that type.
1923 */
1924 replaceMark(
1925 mark: MarkProperties | MarkJSON | Mark | string,
1926 newMark: MarkProperties | MarkJSON | Mark | string
1927 ): Controller;
1928
1929 /**
1930 * Add or remove a mark from the characters in the current selection, depending on it already exists on any or not.
1931 * Passing a string will implicitly create a Mark of that type to toggle.
1932 */
1933 toggleMark(mark: MarkProperties | MarkJSON | Mark | string): Controller;
1934
1935 /**
1936 * Unwrap all Block nodes in the current selection that match a type and/or data
1937 */
1938 unwrapBlock(properties: BlockProperties | BlockJSON | Block | string): Controller;
1939
1940 /**
1941 * Unwrap all Inline nodes in the current selection that match a type and/or data
1942 */
1943 unwrapInline(properties: InlineProperties | InlineJSON | Inline | string): Controller;
1944
1945 /**
1946 * Wrap the Block nodes in the current selection with a new Block
1947 */
1948 wrapBlock(properties: BlockProperties | BlockJSON | Block | string): Controller;
1949
1950 /**
1951 * Wrap the Block nodes in the current selection with a new Inline
1952 */
1953 wrapInline(properties: InlineProperties | InlineJSON | Inline | string): Controller;
1954
1955 /**
1956 * Surround the text in the current selection with prefix and suffix strings.
1957 * If the suffix is ommitted, the prefix will be used instead.
1958 */
1959 wrapText(prefix: string, suffix?: string): Controller;
1960
1961 // Selection Commands //
1962 /**
1963 * Blur the current selection
1964 */
1965 blur(): Controller;
1966
1967 /**
1968 * Unset the selection
1969 */
1970 deselect(): Controller;
1971
1972 /**
1973 * Flip the selection
1974 */
1975 flip(): Controller;
1976
1977 /**
1978 * Focus the current selection
1979 */
1980 focus(): Controller;
1981
1982 /**
1983 * Move the anchor of the current selection backward n characters
1984 */
1985 moveAnchorBackward(n?: number): Controller;
1986 moveAnchorWordBackward(): Controller;
1987 /**
1988 * Move the anchor of the current selection forward n characters
1989 */
1990 moveAnchorForward(n?: number): Controller;
1991 moveAnchorWordForward(): Controller;
1992 /**
1993 * Move the anchor of the current selection to a new path and offset
1994 */
1995 moveAnchorTo(path: string | number | Immutable.List<number>, offset?: number): Controller;
1996 /**
1997 * Move the anchor of the current selection to the end of the closest block parent.
1998 */
1999 moveAnchorToEndOfBlock(): Controller;
2000 /**
2001 * Move the anchor of the current selection to the end of the closest inline parent.
2002 */
2003 moveAnchorToEndOfInline(): Controller;
2004 /**
2005 * Move the anchor of the current selection to the end of the document.
2006 */
2007 moveAnchorToEndOfDocument(): Controller;
2008 /**
2009 * Move the anchor of the current selection to the end of the next block.
2010 */
2011 moveAnchorToEndOfNextBlock(): Controller;
2012 /**
2013 * Move the anchor of the current selection to the end of the next inline.
2014 */
2015 moveAnchorToEndOfNextInline(): Controller;
2016 /**
2017 * Move the anchor of the current selection to the end of the next text.
2018 */
2019 moveAnchorToEndOfNextText(): Controller;
2020 /**
2021 * Move the anchor of the current selection to the end of the provided node.
2022 */
2023 moveAnchorToEndOfNode(node: Node): Controller;
2024 /**
2025 * Move the anchor of the current selection to the end of the previous block.
2026 */
2027 moveAnchorToEndOfPreviousBlock(): Controller;
2028 /**
2029 * Move the anchor of the current selection to the end of the previous inline.
2030 */
2031 moveAnchorToEndOfPreviousInline(): Controller;
2032 /**
2033 * Move the anchor of the current selection to the end of the previous text.
2034 */
2035 moveAnchorToEndOfPreviousText(): Controller;
2036 /**
2037 * Move the anchor of the current selection to the end of the current text node.
2038 */
2039 moveAnchorToEndOfText(): Controller;
2040 /**
2041 * Move the anchor of the current selection to the start of the closest block parent.
2042 */
2043 moveAnchorToStartOfBlock(): Controller;
2044 /**
2045 * Move the anchor of the current selection to the start of the document.
2046 */
2047 moveAnchorToStartOfDocument(): Controller;
2048 /**
2049 * Move the anchor of the current selection to the start of the closest inline parent.
2050 */
2051 moveAnchorToStartOfInline(): Controller;
2052 /**
2053 * Move the anchor of the current selection to the start of the next block.
2054 */
2055 moveAnchorToStartOfNextBlock(): Controller;
2056 /**
2057 * Move the anchor of the current selection to the start of the next inline.
2058 */
2059 moveAnchorToStartOfNextInline(): Controller;
2060 /**
2061 * Move the anchor of the current selection to the start of the next text node.
2062 */
2063 moveAnchorToStartOfNextText(): Controller;
2064 /**
2065 * Move the anchor of the current selection to the start of the provided node.
2066 */
2067 moveAnchorToStartOfNode(node: Node): Controller;
2068 /**
2069 * Move the anchor of the current selection to the start of the previous block.
2070 */
2071 moveAnchorToStartOfPreviousBlock(): Controller;
2072 /**
2073 * Move the anchor of the current selection to the start of the previous inline.
2074 */
2075 moveAnchorToStartOfPreviousInline(): Controller;
2076 /**
2077 * Move the anchor of the current selection to the start of the previous text node.
2078 */
2079 moveAnchorToStartOfPreviousText(): Controller;
2080 /**
2081 * Move the anchor of the current selection to the start of the current text node.
2082 */
2083 moveAnchorToStartOfText(): Controller;
2084
2085 /**
2086 * Move the end of the selection backward n characters
2087 */
2088 moveEndBackward(n?: number): Controller;
2089 /**
2090 * Move the end of the selection foward n characters
2091 */
2092 moveEndForward(n?: number): Controller;
2093
2094 /**
2095 * Move the end of the selection to a new path and offset
2096 */
2097 moveEndTo(path: string | number | Immutable.List<number>, offset?: number): Controller;
2098 /**
2099 * Move the end of the current selection to the end of the closest block parent.
2100 */
2101 moveEndToEndOfBlock(): Controller;
2102 /**
2103 * Move the end of the current selection to the end of the document.
2104 */
2105 moveEndToEndOfDocument(): Controller;
2106 /**
2107 * Move the end of the current selection to the end of the closest inline parent.
2108 */
2109 moveEndToEndOfInline(): Controller;
2110 /**
2111 * Move the anchor of the current selection to the end of the next block.
2112 */
2113 moveEndToEndOfNextBlock(): Controller;
2114 /**
2115 * Move the end of the current selection to the end of the next inline.
2116 */
2117 moveEndToEndOfNextInline(): Controller;
2118 /**
2119 * Move the end of the current selection to the end of the next text.
2120 */
2121 moveEndToEndOfNextText(): Controller;
2122 /**
2123 * Move the end of the current selection to the end of the provided node.
2124 */
2125 moveEndToEndOfNode(node: Node): Controller;
2126 /**
2127 * Move the end of the current selection to the end of the previous block.
2128 */
2129 moveEndToEndOfPreviousBlock(): Controller;
2130 /**
2131 * Move the end of the current selection to the end of the previous inline.
2132 */
2133 moveEndToEndOfPreviousInline(): Controller;
2134 /**
2135 * Move the commandable of the current selection to the end of the previous text.
2136 */
2137 moveEndToEndOfPreviousText(): Controller;
2138 /**
2139 * Move the end of the current selection to the end of the current text node.
2140 */
2141 moveEndToEndOfText(): Controller;
2142 /**
2143 * Move the end of the current selection to the start of the closest block parent.
2144 */
2145 moveEndToStartOfBlock(): Controller;
2146 /**
2147 * Move the end of the current selection to the start of the document.
2148 */
2149 moveEndToStartOfDocument(): Controller;
2150 /**
2151 * Move the end of the current selection to the start of the closest inline parent.
2152 */
2153 moveEndToStartOfInline(): Controller;
2154 /**
2155 * Move the end of the current selection to the start of the next block.
2156 */
2157 moveEndToStartOfNextBlock(): Controller;
2158 /**
2159 * Move the end of the current selection to the start of the next inline.
2160 */
2161 moveEndToStartOfNextInline(): Controller;
2162 /**
2163 * Move the end of the current selection to the start of the next text node.
2164 */
2165 moveEndToStartOfNextText(): Controller;
2166 /**
2167 * Move the end of the current selection to the start of the provided node.
2168 */
2169 moveEndToStartOfNode(node: Node): Controller;
2170 /**
2171 * Move the end of the current selection to the start of the previous block.
2172 */
2173 moveEndToStartOfPreviousBlock(): Controller;
2174 /**
2175 * Move the end of the current selection to the start of the previous inline.
2176 */
2177 moveEndToStartOfPreviousInline(): Controller;
2178 /**
2179 * Move the end of the current selection to the start of the previous text node.
2180 */
2181 moveEndToStartOfPreviousText(): Controller;
2182 /**
2183 * Move the end of the current selection to the start of the current text node.
2184 */
2185 moveEndToStartOfText(): Controller;
2186 moveEndWordBackward(): Controller;
2187 moveEndWordForward(): Controller;
2188 /**
2189 * Move the focus of the current selection backward n characters
2190 */
2191 moveFocusBackward(n?: number): Controller;
2192 /**
2193 * Move the focus of the current selection forward n characters
2194 */
2195 moveFocusForward(n?: number): Controller;
2196 /**
2197 * Move the focus of the current selection to a new path and offset
2198 */
2199 moveFocusTo(path: string | number | Immutable.List<number>, offset?: number): Controller;
2200 /**
2201 * Move the focus of the current selection to the end of the closest block parent.
2202 */
2203 moveFocusToEndOfBlock(): Controller;
2204 /**
2205 * Move the focus of the current selection to the end of the document.
2206 */
2207 moveFocusToEndOfDocument(): Controller;
2208 /**
2209 * Move the focus of the current selection to the end of the closest inline parent.
2210 */
2211 moveFocusToEndOfInline(): Controller;
2212 /**
2213 * Move the focus of the current selection to the end of the next block.
2214 */
2215 moveFocusToEndOfNextBlock(): Controller;
2216 /**
2217 * Move the focus of the current selection to the end of the next inline.
2218 */
2219 moveFocusToEndOfNextInline(): Controller;
2220 /**
2221 * Move the focus of the current selection to the end of the next text.
2222 */
2223 moveFocusToEndOfNextText(): Controller;
2224 /**
2225 * Move the focus of the current selection to the end of the provided node.
2226 */
2227 moveFocusToEndOfNode(node: Node): Controller;
2228 /**
2229 * Move the focus of the current selection to the end of the previous block.
2230 */
2231 moveFocusToEndOfPreviousBlock(): Controller;
2232 /**
2233 * Move the focus of the current selection to the end of the previous inline.
2234 */
2235 moveFocusToEndOfPreviousInline(): Controller;
2236 /**
2237 * Move the focus of the current selection to the end of the previous text.
2238 */
2239 moveFocusToEndOfPreviousText(): Controller;
2240 /**
2241 * Move the focus of the current selection to the end of the current text node.
2242 */
2243 moveFocusToEndOfText(): Controller;
2244 /**
2245 * Move the focus of the current selection to the start of the closest block parent.
2246 */
2247 moveFocusToStartOfBlock(): Controller;
2248 /**
2249 * Move the focus of the current selection to the start of the document.
2250 */
2251 moveFocusToStartOfDocument(): Controller;
2252 /**
2253 * Move the focus of the current selection to the start of the closest inline parent.
2254 */
2255 moveFocusToStartOfInline(): Controller;
2256 /**
2257 * Move the focus of the current selection to the start of the next block.
2258 */
2259 moveFocusToStartOfNextBlock(): Controller;
2260 /**
2261 * Move the focus of the current selection to the start of the next inline.
2262 */
2263 moveFocusToStartOfNextInline(): Controller;
2264 /**
2265 * Move the focus of the current selection to the start of the next text node.
2266 */
2267 moveFocusToStartOfNextText(): Controller;
2268 /**
2269 * Move the focus of the current selection to the start of the provided node.
2270 */
2271 moveFocusToStartOfNode(node: Node): Controller;
2272 /**
2273 * Move the focus of the current selection to the start of the previous block.
2274 */
2275 moveFocusToStartOfPreviousBlock(): Controller;
2276 /**
2277 * Move the focus of the current selection to the start of the previous inline.
2278 */
2279 moveFocusToStartOfPreviousInline(): Controller;
2280 /**
2281 * Move the focus of the current selection to the start of the previous text node.
2282 */
2283 moveFocusToStartOfPreviousText(): Controller;
2284 /**
2285 * Move the focus of the current selection to the start of the current text node.
2286 */
2287 moveFocusToStartOfText(): Controller;
2288 moveFocusWordBackward(): Controller;
2289 moveFocusWordForward(): Controller;
2290 /**
2291 * Move the start of the current selection backward n characters
2292 */
2293 moveStartForward(n?: number): Controller;
2294 /**
2295 * Move the start of the current selection forward n characters
2296 */
2297 moveStartBackward(n?: number): Controller;
2298 /**
2299 * Move the start of the current selection to a new path and offset
2300 */
2301 moveStartTo(path: string | number | Immutable.List<number>, n?: number): Controller;
2302 /**
2303 * Move the start of the current selection to the end of the closest block parent.
2304 */
2305 moveStartToEndOfBlock(): Controller;
2306 /**
2307 * Move the start of the current selection to the end of the document.
2308 */
2309 moveStartToEndOfDocument(): Controller;
2310 /**
2311 * Move the start of the current selection to the end of the closest inline parent.
2312 */
2313 moveStartToEndOfInline(): Controller;
2314 /**
2315 * Move the start of the current selection to the end of the next block.
2316 */
2317 moveStartToEndOfNextBlock(): Controller;
2318 /**
2319 * Move the start of the current selection to the end of the next inline.
2320 */
2321 moveStartToEndOfNextInline(): Controller;
2322 /**
2323 * Move the start of the current selection to the end of the next text.
2324 */
2325 moveStartToEndOfNextText(): Controller;
2326 /**
2327 * Move the start of the current selection to the end of the provided node.
2328 */
2329 moveStartToEndOfNode(node: Node): Controller;
2330 /**
2331 * Move the start of the current selection to the end of the previous block.
2332 */
2333 moveStartToEndOfPreviousBlock(): Controller;
2334 /**
2335 * Move the start of the current selection to the end of the previous inline.
2336 */
2337 moveStartToEndOfPreviousInline(): Controller;
2338 /**
2339 * Move the start of the current selection to the end of the previous text.
2340 */
2341 moveStartToEndOfPreviousText(): Controller;
2342 /**
2343 * Move the start of the current selection to the end of the current text node.
2344 */
2345 moveStartToEndOfText(): Controller;
2346 /**
2347 * Move the start of the current selection to the start of the closest block parent.
2348 */
2349 moveStartToStartOfBlock(): Controller;
2350 /**
2351 * Move the start of the current selection to the start of the document.
2352 */
2353 moveStartToStartOfDocument(): Controller;
2354 /**
2355 * Move the start of the current selection to the start of the closest inline parent.
2356 */
2357 moveStartToStartOfInline(): Controller;
2358 /**
2359 * Move the start of the current selection to the start of the next block.
2360 */
2361 moveStartToStartOfNextBlock(): Controller;
2362 /**
2363 * Move the start of the current selection to the start of the next inline.
2364 */
2365 moveStartToStartOfNextInline(): Controller;
2366 /**
2367 * Move the start of the current selection to the start of the next text node.
2368 */
2369 moveStartToStartOfNextText(): Controller;
2370 /**
2371 * Move the start of the current selection to the start of the provided node.
2372 */
2373 moveStartToStartOfNode(node: Node): Controller;
2374 /**
2375 * Move the start of the current selection to the start of the previous block.
2376 */
2377 moveStartToStartOfPreviousBlock(): Controller;
2378 /**
2379 * Move the start of the current selection to the start of the previous inline.
2380 */
2381 moveStartToStartOfPreviousInline(): Controller;
2382 /**
2383 * Move the start of the current selection to the start of the previous text node.
2384 */
2385 moveStartToStartOfPreviousText(): Controller;
2386 /**
2387 * Move the start of the current selection to the start of the current text node.
2388 */
2389 moveStartToStartOfText(): Controller;
2390 moveStartWordForward(): Controller;
2391 moveStartWordBackward(): Controller;
2392 /**
2393 * Move the anchor and focus of the selection backward n characters.
2394 */
2395 moveBackward(n?: number): Controller;
2396 /**
2397 * Move the anchor and focus of the selection forward n characters.
2398 */
2399 moveForward(n?: number): Controller;
2400 /**
2401 * Collapse the current selection at the provided new path and offset.
2402 */
2403 moveTo(path: string | number | Immutable.List<number>, offset?: number): Controller;
2404 /**
2405 * Collapse the current selection at the anchor.
2406 */
2407 moveToAnchor(): Controller;
2408 /**
2409 * Collapse the current selection at the focus.
2410 */
2411 moveToFocus(): Controller;
2412 /**
2413 * Collapse the current selection at the start.
2414 */
2415 moveToStart(): Controller;
2416 /**
2417 * Collapse the current selection at the end.
2418 */
2419 moveToEnd(): Controller;
2420 /**
2421 * Collapse the current selection at the end of the closest block parent.
2422 */
2423 moveToEndOfBlock(): Controller;
2424 /**
2425 * Collapse the current selection at the end of the document.
2426 */
2427 moveToEndOfDocument(): Controller;
2428 /**
2429 * Collapse the current selection at the end of the closest inline parent.
2430 */
2431 moveToEndOfInline(): Controller;
2432 /**
2433 * Collapse the current selection at the end of the next block.
2434 */
2435 moveToEndOfNextBlock(): Controller;
2436 /**
2437 * Collapse the current selection at the end of the inline.
2438 */
2439 moveToEndOfNextInline(): Controller;
2440 /**
2441 * Collapse the current selection at the end of the next text node.
2442 */
2443 moveToEndOfNextText(): Controller;
2444 /**
2445 * Collapse the current selection at the end of the provided node.
2446 */
2447 moveToEndOfNode(node: Node): Controller;
2448 /**
2449 * Collapse the current selection at the end of the previous block.
2450 */
2451 moveToEndOfPreviousBlock(): Controller;
2452 /**
2453 * Collapse the current selection at the end of the previous inline.
2454 */
2455 moveToEndOfPreviousInline(): Controller;
2456 /**
2457 * Collapse the current selection at the end of the previous text node.
2458 */
2459 moveToEndOfPreviousText(): Controller;
2460 /**
2461 * Collapse the current selection at the end of the current text node.
2462 */
2463 moveToEndOfText(): Controller;
2464 /**
2465 * Collapse the current selection at the start of the nearest block parent.
2466 */
2467 moveToStartOfBlock(): Controller;
2468 /**
2469 * Collapse the current selection at the start of the document.
2470 */
2471 moveToStartOfDocument(): Controller;
2472 /**
2473 * Collapse the current selection at the start of the nearest inline parent.
2474 */
2475 moveToStartOfInline(): Controller;
2476 /**
2477 * Collapse the current selection at the start of the next block.
2478 */
2479 moveToStartOfNextBlock(): Controller;
2480 /**
2481 * Collapse the current selection at the start of the next inline.
2482 */
2483 moveToStartOfNextInline(): Controller;
2484 /**
2485 * Collapse the current selection at the start of the next text node.
2486 */
2487 moveToStartOfNextText(): Controller;
2488 /**
2489 * Collapse the current selection at the start of the provided node.
2490 */
2491 moveToStartOfNode(node: Node): Controller;
2492 /**
2493 * Collapse the current selection at the start of the previous block.
2494 */
2495 moveToStartOfPreviousBlock(): Controller;
2496 /**
2497 * Collapse the current selection at the start of the previous inline.
2498 */
2499 moveToStartOfPreviousInline(): Controller;
2500 /**
2501 * Collapse the current selection at the start of the previous text node.
2502 */
2503 moveToStartOfPreviousText(): Controller;
2504 /**
2505 * Collapse the current selection at the start of the current text node.
2506 */
2507 moveToStartOfText(): Controller;
2508 moveWordBackward(): Controller;
2509 moveWordForward(): Controller;
2510 /**
2511 * Move the current selection's anchor to the start of the document and its focus to the end of it, selecting everything.
2512 */
2513 moveToRangeOfDocument(): Controller;
2514 /**
2515 * Move the current selection's anchor to the start of the provided node and its focus to the end of it.
2516 */
2517 moveToRangeOfNode(node: Node): Controller;
2518 /**
2519 * Merge the current selection with the provided properties
2520 */
2521 select(
2522 properties:
2523 | RangeTypeProperties
2524 | RangeTypeJSON
2525 | RangeType
2526 | string,
2527 options?: { snapshot?: boolean | undefined }
2528 ): Controller;
2529 setAnchor(point: Point): void;
2530 setEnd(point: Point): void;
2531 setFocus(point: Point): void;
2532 setStart(point: Point): void;
2533
2534 // Document Range Commands //
2535
2536 /**
2537 * Add a mark to the characters in the range.
2538 * Passing a string as `mark` will implicitly create a mark with that `type`
2539 */
2540 addMarkAtRange(
2541 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2542 mark: Mark | MarkProperties | string): Controller;
2543 addMarksAtRange(
2544 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2545 marks:
2546 | Array<MarkProperties | MarkJSON | Mark | string>
2547 | Immutable.Set<MarkProperties | MarkJSON | Mark | string>
2548 ): Controller;
2549 /**
2550 * Delete everything in the range
2551 */
2552 deleteAtRange(range: RangeType | RangeTypeProperties | RangeTypeJSON): Controller;
2553 /**
2554 * Delete backward one character
2555 */
2556 deleteCharBackward(): Controller;
2557 /**
2558 * Delete backward until the char boundary at a range
2559 */
2560 deleteCharBackwardAtRange(range: RangeType | RangeTypeProperties | RangeTypeJSON): Controller;
2561 /**
2562 * Delete backward one line
2563 */
2564 deleteLineBackward(): Controller;
2565 /**
2566 * Delete backward until the line boundary at a range
2567 */
2568 deleteLineBackwardAtRange(range: RangeType | RangeTypeProperties | RangeTypeJSON): Controller;
2569 /**
2570 * Delete backward one word.
2571 */
2572 deleteWordBackward(): Controller;
2573 /**
2574 * Delete backward until the word boundary at a range
2575 */
2576 deleteWordBackwardAtRange(range: RangeType | RangeTypeProperties | RangeTypeJSON): Controller;
2577 /**
2578 * Delete backward n characters at a range
2579 */
2580 deleteBackwardAtRange(range: RangeType | RangeTypeProperties | RangeTypeJSON, n?: number): Controller;
2581 /**
2582 * Delete forward one character
2583 */
2584 deleteCharForward(): Controller;
2585 /**
2586 * Delete forward until the char boundary at a range
2587 */
2588 deleteCharForwardAtRange(range: RangeType | RangeTypeProperties | RangeTypeJSON): Controller;
2589 /**
2590 * Delete forward one line
2591 */
2592 deleteLineForward(): Controller;
2593 /**
2594 * Delete forward until the line boundary at a range
2595 */
2596 deleteLineForwardAtRange(range: RangeType | RangeTypeProperties | RangeTypeJSON): Controller;
2597 /**
2598 * Delete forward until the word boundary at a range
2599 */
2600 deleteWordForwardAtRange(range: RangeType | RangeTypeProperties | RangeTypeJSON): Controller;
2601 /**
2602 * Delete forward one word
2603 */
2604 deleteWordForward(): Controller;
2605 /**
2606 * Delete forward n characters at a range
2607 */
2608 deleteForwardAtRange(range: RangeType | RangeTypeProperties | RangeTypeJSON, n?: number): Controller;
2609 /**
2610 * Insert a block node at range, splitting text to make room if it is non-empty.
2611 * If the range is expanded, it will be deleted first.
2612 */
2613 insertBlockAtRange(
2614 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2615 block: Block | BlockProperties | BlockJSON | string
2616 ): Controller;
2617 /**
2618 * Insert a document fragment at a range, if the range is expanded, it will be deleted first.
2619 */
2620 insertFragmentAtRange(
2621 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2622 fragment: Document
2623 ): Controller;
2624 /**
2625 * Insert a new inline at range, splitting text to make room if it is non-empty.
2626 * If the range is expanded, it will be deleted first.
2627 */
2628 insertInlineAtRange(
2629 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2630 inline: Inline | InlineJSON | InlineProperties
2631 ): Controller;
2632 /**
2633 * Insert text at range. If the range is expanded it will be deleted first
2634 */
2635 insertTextAtRange(
2636 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2637 text: string
2638 ): Controller;
2639 /**
2640 * Set the properties of the block nodes in a range.
2641 * Passing a string will set the nodes' type only
2642 */
2643 setBlocksAtRange(
2644 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2645 properties: Block | BlockJSON | BlockProperties | string
2646 ): Controller;
2647 /**
2648 * Set the properties of the inline nodes in a range.
2649 * Passing a string will set the nodes' type only
2650 */
2651 setInlinesAtRange(
2652 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2653 properties: InlineProperties | InlineJSON | Inline | string
2654 ): Controller;
2655 /**
2656 * Split the block nodes at a `range`, to optional `height`.
2657 */
2658 splitBlockAtRange(
2659 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2660 height?: number
2661 ): Controller;
2662 /**
2663 * Split the inline nodes at a `range`, to optional `height`.
2664 */
2665 splitInlineAtRange(
2666 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2667 height?: number
2668 ): Controller;
2669 /**
2670 * Remove a mark from characters in the range. Passing a string will
2671 * implicitly create a mark of that type for deletion.
2672 */
2673 removeMarkAtRange(
2674 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2675 mark: Mark | MarkProperties | MarkJSON | string
2676 ): Controller;
2677 /**
2678 * Add or remove a mark from characters in the range. Passing a string will
2679 * implicitly create a mark of that type for deletion.
2680 */
2681 toggleMarkAtRange(
2682 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2683 mark: Mark | MarkProperties | MarkJSON | string
2684 ): Controller;
2685 /**
2686 * Unwrap all block nodes in a range that match properties
2687 */
2688 unwrapBlockAtRange(
2689 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2690 properties: BlockProperties | BlockJSON | Block | string
2691 ): Controller;
2692 /**
2693 * Unwrap all inline nodes in a range that match properties
2694 */
2695 unwrapInlineAtRange(
2696 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2697 properties: InlineProperties | InlineJSON | Inline | string
2698 ): Controller;
2699 /**
2700 * wrap all block nodes in a range with a new block node with the provided properties
2701 */
2702 wrapBlockAtRange(
2703 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2704 properties: BlockProperties | BlockJSON | Block | string
2705 ): Controller;
2706 /**
2707 * wrap all inline nodes in a range with a new inline node with the provided properties
2708 */
2709 wrapInlineAtRange(
2710 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2711 properties: InlineProperties | InlineJSON | Inline | string
2712 ): Controller;
2713 /**
2714 * Surround the text in a range with a prefix and suffix. If the suffix is ommitted,
2715 * the prefix will be used instead.
2716 */
2717 wrapTextAtRange(
2718 range: RangeType | RangeTypeProperties | RangeTypeJSON,
2719 prefix: string,
2720 suffix?: string
2721 ): Controller;
2722
2723 // Node commands //
2724 /**
2725 * Add a mark to length characters starting at an offset in a node by key
2726 */
2727 addMarkByKey(
2728 key: string,
2729 offset: number,
2730 length: number,
2731 mark: MarkProperties | MarkJSON | Mark | string
2732 ): Controller;
2733 /**
2734 * Add a mark to length characters starting at an offset in a node by path
2735 */
2736 addMarkByPath(
2737 path: Immutable.List<number>,
2738 offset: number,
2739 length: number,
2740 mark: MarkProperties | MarkJSON | Mark | string
2741 ): Controller;
2742 addMarksByPath(
2743 path: Immutable.List<number>,
2744 offset: number,
2745 length: number,
2746 marks:
2747 | Array<MarkProperties | MarkJSON | Mark | string>
2748 | Immutable.Set<MarkProperties | MarkJSON | Mark | string>
2749 ): Controller;
2750 /**
2751 * Insert a node at index inside a parent node by key
2752 */
2753 insertNodeByKey(key: string, index: number, node: Node): Controller;
2754 /**
2755 * Insert a node at index inside a parent node by apth
2756 */
2757 insertNodeByPath(path: Immutable.List<number>, index: number, node: Node): Controller;
2758 /**
2759 * Insert a document fragment at index inside a parent node by key
2760 */
2761 insertFragmentByKey(key: string, index: number, fragment: Document): Controller;
2762 /**
2763 * Insert a document fragment at index inside a parent node by path
2764 */
2765 insertFragmentByPath(path: Immutable.List<number>, index: number, fragment: Document): Controller;
2766 /**
2767 * Insert text at an offset in a text node by its key with optional marks
2768 */
2769 insertTextByKey(
2770 key: string,
2771 offset: number,
2772 text: string,
2773 marks?:
2774 | Array<MarkProperties | MarkJSON | Mark | string>
2775 | Immutable.Set<MarkProperties | MarkJSON | Mark | string>
2776 ): Controller;
2777 /**
2778 * Insert text at an offset in a text node by its path with optional marks
2779 */
2780 insertTextByPath(
2781 path: Immutable.List<number>,
2782 offset: number,
2783 text: string,
2784 marks?:
2785 | Array<MarkProperties | MarkJSON | Mark | string>
2786 | Immutable.Set<MarkProperties | MarkJSON | Mark | string>
2787 ): Controller;
2788 /**
2789 * Merge a node by its key with its previous sibling
2790 */
2791 mergeNodeByKey(key: string): Controller;
2792 /**
2793 * Merge a node by its path with its previous sibling
2794 */
2795 mergeNodeByPath(path: Immutable.List<number>): Controller;
2796 /**
2797 * Move a node by its key to a new parent node with with newkey at newindex
2798 */
2799 moveNodeByKey(key: string, newKey: string, newIndex: number): Controller;
2800 /**
2801 * Move a node by its path to a new parent node with with newpath at newindex
2802 */
2803 moveNodeByPath(
2804 path: Immutable.List<number>,
2805 newPath: Immutable.List<number>,
2806 newIndex: number
2807 ): Controller;
2808 /**
2809 * Remove a mark from length characters starting at an offset in a node by key
2810 */
2811 removeMarkByKey(
2812 key: string,
2813 offset: number,
2814 length: number,
2815 mark: MarkProperties | MarkJSON | Mark | string
2816 ): Controller;
2817 /**
2818 * Remove a mark from length characters starting at an offset in a node by path
2819 */
2820 removeMarkByPath(
2821 path: Immutable.List<number>,
2822 offset: number,
2823 length: number,
2824 mark: MarkProperties | MarkJSON | Mark | string
2825 ): Controller;
2826 /**
2827 * Remove all `marks` from node by `key`.
2828 */
2829 removeAllMarksByKey(key: string): Controller;
2830 /**
2831 * Remove all `marks` from node by `path`.
2832 */
2833 removeAllMarksByPath(path: Immutable.List<number>): Controller;
2834 removeMarksByPath(
2835 path: Immutable.List<number>,
2836 offset: number,
2837 length: number,
2838 marks:
2839 | Array<MarkProperties | MarkJSON | Mark | string>
2840 | Immutable.Set<MarkProperties | MarkJSON | Mark | string>
2841 ): Controller;
2842 /**
2843 * Remove a node from the document by its key
2844 */
2845 removeNodeByKey(key: string): Controller;
2846 /**
2847 * Remove a node from the document by its path
2848 */
2849 removeNodeByPath(path: Immutable.List<number>): Controller;
2850 /**
2851 * Replace a node in the document with a new node by key
2852 */
2853 replaceNodeByKey(key: string, node: Node): Controller;
2854 /**
2855 * Replace a node in the document with a new node by path
2856 */
2857 replaceNodeByPath(path: Immutable.List<number>, newNode: Node): Controller;
2858 /**
2859 * Remove length characters of text starting at an offset in a node by key
2860 */
2861 removeTextByKey(key: string, offset: number, length: number): Controller;
2862 /**
2863 * Remove length characters of text starting at an offset in a node by path
2864 */
2865 removeTextByPath(path: Immutable.List<number>, offset: number, length: number): Controller;
2866 /**
2867 * Set a dictionary of newProperties on a mark by its key.
2868 */
2869 /**
2870 * Replace a length of text at offset with new text and optional marks by key
2871 */
2872 replaceTextByKey(key: string, node: Node): Controller;
2873 /**
2874 * Replace a length of text at offset with new text and optional marks by path
2875 */
2876 replaceTextByPath(
2877 path: Immutable.List<number>,
2878 offset: number,
2879 length: number,
2880 text: string,
2881 marks?: Immutable.Set<Mark> | Mark[]
2882 ): Controller;
2883 /**
2884 * Remove length characters of text starting at an offset in a node by key
2885 */
2886 setMarkByKey(
2887 key: string,
2888 offset: number,
2889 length: number,
2890 properties: MarkProperties | MarkJSON | Mark | string,
2891 newProperties: Partial<MarkProperties | MarkJSON | Mark | string>
2892 ): Controller;
2893 /**
2894 * Set a dictionary of newProperties on a mark by its path.
2895 */
2896 setMarkByPath(
2897 path: Immutable.List<number>,
2898 offset: number,
2899 length: number,
2900 properties: MarkProperties | MarkJSON | Mark | string,
2901 newProperties: Partial<MarkProperties | MarkJSON | Mark | string>,
2902 ): Controller;
2903 /**
2904 * Set a dictionary of properties on a node by its key.
2905 */
2906 setNodeByKey(key: string, properties: BlockProperties | InlineProperties | string): Controller;
2907 /**
2908 * Set a dictionary of properties on a node by its key.
2909 */
2910 setNodeByPath(path: Immutable.List<number>, newProperties: NodeProperties | InlineProperties | string): Controller;
2911 /**
2912 * Insert `text` at `offset` in node by `key`.
2913 */
2914 setTextByKey(key: string, text: string, marks: Immutable.Set<Mark>): Controller;
2915 /**
2916 * Insert `text` at `offset` in node by `path`.
2917 */
2918 setTextByPath(path: Immutable.List<number>, text: string, marks: Immutable.Set<Mark>): Controller;
2919 /**
2920 * Split a node deeply down the tree by `key`, `textKey` and `textOffset`.
2921 */
2922 splitDescendantsByKey(key: string, textKey: string, textOffset: number): Controller;
2923 /**
2924 * Split a node deeply down the tree by `path`, `textPath` and `textOffset`.
2925 */
2926 splitDescendantsByPath(path: Immutable.List<number>, textPath: Immutable.List<number>, textOffset: number): Controller;
2927
2928 /**
2929 * Split a node by its key at an offset
2930 */
2931 splitNodeByKey(key: string, offset: number): Controller;
2932 /**
2933 * Split a node by its path at an offset
2934 */
2935 splitNodeByPath(path: Immutable.List<number>, position: number, options?: { target?: number | undefined }): Controller;
2936 /**
2937 * Unwrap all inner content of an inline node by its key that match properties
2938 */
2939 unwrapInlineByKey(key: string, properties: InlineProperties | string): Controller;
2940 /**
2941 * Unwrap all inner content of an inline node by its path that match properties
2942 */
2943 unwrapInlineByPath(path: Path, properties: InlineProperties | string): Controller;
2944 /**
2945 * Unwrap all inner content of a block node by its key that match properties
2946 */
2947 unwrapBlockByKey(key: string, properties: BlockProperties | string): Controller;
2948 /**
2949 * Unwrap all inner content of a block node by its path that match properties
2950 */
2951 unwrapBlockByPath(path: Path, properties: BlockProperties | string): Controller;
2952 /**
2953 * Unwrap all of the children of a node by its key.
2954 */
2955 unwrapChildrenByKey(key: string): Controller;
2956 /**
2957 * Unwrap all of the children of a node, by removing the node and replacing it
2958 * with the children in the tree.
2959 */
2960 unwrapChildrenByPath(path: Immutable.List<number> | number[]): Controller;
2961 /**
2962 * Unwrap a single node from its parent. if the node is surrounded with siblings the parent will be split.
2963 * If the node is an only child, it will replace the parent
2964 */
2965 unwrapNodeByKey(key: string): Controller;
2966 /**
2967 * Unwrap a single node from its parent. if the node is surrounded with siblings the parent will be split.
2968 * If the node is an only child, it will replace the parent
2969 */
2970 unwrapNodeByPath(path: Immutable.List<number>): Controller;
2971 /**
2972 * Wrap the given node by key in an Inline node that matches properties.
2973 */
2974 wrapInlineByKey(key: string, properties: InlineProperties | string): Controller;
2975 /**
2976 * Wrap the given node by path in an Inline node that matches properties.
2977 */
2978 wrapInlineByPath(path: Path, properties: InlineProperties | string): Controller;
2979 /**
2980 * Wrap the given node by key in a block node that matches properties.
2981 */
2982 wrapBlockByKey(key: string, properties: BlockProperties | string): Controller;
2983 /**
2984 * Wrap the given node by path in a block node that matches properties.
2985 */
2986 wrapBlockByPath(path: Immutable.List<number>, block: Block | string): Controller;
2987 /**
2988 * Wrap the node with the specified key with the parent node, this will clear all children of the parent.
2989 */
2990 wrapNodeByKey(key: string, parent: Node): Controller;
2991 /**
2992 * Wrap the node with the specified key with the parent node, this will clear all children of the parent.
2993 */
2994 wrapNodeByPath(path: Immutable.List<number>, parent: Node): Controller;
2995
2996 // Miscellaneous Commands //
2997 /**
2998 * Normalizes the document with the value's schema. Run automatically unless manually disabled.
2999 * Use it sparingly and strategically, as it can be very expensive.
3000 */
3001 normalize(): Controller;
3002 /**
3003 * Calls the provided function with the current commandable as the first argument.
3004 * Normalization does not occur while the function is executing and is deferred to execute immediately after completion.
3005 *
3006 * This allows for sequence change operations to not be interrupted by normalization
3007 */
3008 withoutNormalizing(fn: () => void): Controller;
3009 /**
3010 * By default all operations are saved to the commandable's history. If you have
3011 * changes that you don't want to show up in history, use this function.
3012 */
3013 withoutSaving(fn: () => void): void;
3014 /**
3015 * Usually all command operations are merged into a single save point in history,
3016 * if more control is desired, create single save points using this function.
3017 */
3018 withoutMerging(fn: () => void): void;
3019
3020 // History Commands //
3021 /**
3022 * Move forward one step in the history
3023 */
3024 redo(): Controller;
3025 /**
3026 * Move backward one step in the history
3027 */
3028 undo(): Controller;
3029 /**
3030 * Save an `operation` into the history.
3031 */
3032 save(operation: Operation): void;
3033 /**
3034 * Snapshot the current selection for undo purposes.
3035 */
3036 snapshotSelection(): Controller;
3037 command(type: string | ((...args: any[]) => any), ...args: any[]): Controller;
3038 /**
3039 * Check if a command by type has been registered.
3040 */
3041 hasCommand(type: string): boolean;
3042 /**
3043 * Check if a query by type has been registered.
3044 */
3045 hasQuery(type: string): boolean;
3046 query(query: string | ((...args: any[]) => any), ...args: any[]): any;
3047 /**
3048 * Add a new command by type to the controller. This will make the command available as a top-level method on the controller
3049 */
3050 registerCommand(command: string): Controller;
3051 /**
3052 * Add a new query by type to the controller. This will make the query available as a top-level method on the controller.
3053 */
3054 registerQuery(query: string): Controller;
3055 /**
3056 * Apply an `operation` to the controller, updating its value.
3057 */
3058 applyOperation(operation: Operation | OperationJSON | OperationProperties): Controller;
3059 /**
3060 * Run the middleware stack by key with args, returning its result.
3061 * In normal operation you never need to use this method! Reserved for testing.
3062 */
3063 run(key: string, ...args: any[]): Controller;
3064 /**
3065 * Set data
3066 */
3067 setData(data: Data): Controller;
3068 /**
3069 * Add annotation
3070 */
3071 addAnnotation(annotation: Annotation | AnnotationProperties | AnnotationJSON): Controller;
3072 /**
3073 * Remove annotation
3074 */
3075 removeAnnotation(annotation: Annotation | AnnotationProperties | AnnotationJSON): Controller;
3076 /**
3077 * Set annotation
3078 */
3079 setAnnotation(annotation: Annotation, newProperties: AnnotationProperties | AnnotationJSON | Annotation): Controller;
3080}
3081
3082export {};
3083
\No newline at end of file