editate 0.6.12 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands.d.ts +1 -1
- package/lib/doc/types.d.ts +3 -6
- package/lib/dom/index.d.ts +3 -0
- package/lib/index.cjs +227 -199
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +336 -306
- package/lib/index.js.map +1 -1
- package/lib/keyboard.d.ts +1 -1
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/keymap.d.ts +1 -1
- package/lib/plugins/selectionRect.d.ts +5 -0
- package/package.json +2 -1
package/lib/commands.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function InsertNode<T extends DocNode>(editor: Editor<T>, node: I
|
|
|
16
16
|
/**
|
|
17
17
|
* Replace text in the selection or specified range.
|
|
18
18
|
*/
|
|
19
|
-
export declare function ReplaceText(editor: Editor, text: string): void;
|
|
19
|
+
export declare function ReplaceText(editor: Editor, text: string, range?: Range): void;
|
|
20
20
|
/**
|
|
21
21
|
* Replace document in the editor.
|
|
22
22
|
*/
|
package/lib/doc/types.d.ts
CHANGED
|
@@ -9,14 +9,11 @@ export interface BlockNode {
|
|
|
9
9
|
}
|
|
10
10
|
export type Node = BlockNode | InlineNode;
|
|
11
11
|
export interface DocNode {
|
|
12
|
-
readonly children: readonly BlockNode[];
|
|
12
|
+
readonly children: readonly BlockNode[] | readonly InlineNode[];
|
|
13
13
|
}
|
|
14
14
|
export type Fragment = DocNode["children"];
|
|
15
15
|
export type Path = readonly number[];
|
|
16
|
-
export type DomPosition = readonly [path: Path, offset: number];
|
|
17
16
|
export type Range = readonly [start: number, end: number];
|
|
18
17
|
export type Selection = readonly [anchor: number, focus: number];
|
|
19
|
-
export type
|
|
20
|
-
|
|
21
|
-
focus: DomPosition
|
|
22
|
-
];
|
|
18
|
+
export type DomPosition = readonly [path: Path, offset: number];
|
|
19
|
+
export type DomSelection = readonly [anchor: DomPosition, focus: DomPosition];
|
package/lib/dom/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { Parser } from './parser.js';
|
|
2
|
+
import { DomSelection } from '../doc/types.js';
|
|
1
3
|
export { createParser, TOKEN_TEXT, TOKEN_VOID, TOKEN_SOFT_BREAK, TOKEN_BLOCK, } from './parser.js';
|
|
2
4
|
export { defaultIsBlockNode } from './default.js';
|
|
5
|
+
export declare const selectionToRange: (root: Element, parse: Parser, [anchor, focus]: DomSelection, posDiff: number) => Range;
|