/
select.d.ts
96 lines (81 loc) · 2.52 KB
/
select.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module types
*/
import type { CanUndef, HTMLTagNames, IDictionary, Nullable } from './types';
import type { IStyle, IStyleOptions } from './style';
export interface MarkerInfo {
startId: string;
endId?: string;
collapsed: boolean;
startMarker: string;
endMarker?: string;
}
export type WindowSelection = Selection;
export interface ISelect {
readonly sel: WindowSelection | null;
readonly range: Range;
readonly isInsideArea: boolean;
readonly html: string;
createRange(select?: boolean): Range;
clear(): void;
current(checkChild?: boolean): Nullable<Node>;
focus(options?: FocusOptions): boolean;
isFocused(): boolean;
remove(): void;
removeNode(node: Node): void;
fakes(): [] | [Node] | [Node, Node];
restoreFakes(fakes: [] | [Node] | [Node, Node]): void;
save(silent?: boolean): MarkerInfo[];
restore(): void;
readonly hasMarkers: boolean;
readonly markers: HTMLElement[];
removeMarkers(): void;
marker(atStart?: boolean, range?: Range): HTMLSpanElement;
insertNode(
node: Node,
insertCursorAfter?: boolean,
fireChange?: boolean
): void;
insertHTML(html: number | string | Node, insertCursorAfter?: boolean): void;
insertImage(
url: string | HTMLImageElement,
styles?: Nullable<IDictionary<string>>,
defaultWidth?: Nullable<number | string>
): void;
isCollapsed(): boolean;
cursorInTheEdge(
start: boolean,
parentBlock: HTMLElement,
fake?: Node | null
): Nullable<boolean>;
cursorOnTheLeft(
parentBlock: HTMLElement,
fake?: Node | null
): Nullable<boolean>;
cursorOnTheRight(
parentBlock: HTMLElement,
fake?: Node | null
): Nullable<boolean>;
expandSelection(): ISelect;
insertCursorAtPoint(x: number, y: number): boolean;
setCursorAfter(node: Node): Nullable<Text>;
setCursorBefore(node: Node): Nullable<Text>;
setCursorIn(node: Node, inStart?: boolean): Node;
selectRange(range: Range, focus?: boolean): ISelect;
select(
node: Node | HTMLElement | HTMLTableElement | HTMLTableCellElement,
inward?: boolean
): ISelect;
wrapInTagGen(fakes?: Node[]): Generator<HTMLElement, undefined>;
wrapInTag(
tagOrCallback: HTMLTagNames | ((font: HTMLElement) => any)
): HTMLElement[];
commitStyle(options: IStyleOptions): void;
eachSelection(callback: (current: Node) => void): void;
splitSelection(currentBox: HTMLElement, edge?: Node): Nullable<Element>;
}