editate 0.6.17 → 0.6.19
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 +7 -3
- package/lib/doc/node.d.ts +5 -6
- package/lib/dom/index.d.ts +2 -2
- package/lib/index.cjs +570 -562
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +636 -626
- package/lib/index.js.map +1 -1
- package/lib/plugins/selectionRect.d.ts +1 -1
- package/lib/queries.d.ts +7 -0
- package/package.json +1 -1
package/lib/commands.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Editor } from './editor.js';
|
|
2
2
|
import { DocNode, Range } from './doc/types.js';
|
|
3
|
-
import { ExtractAttrValue, InferBlockNode, InferTextNode, InferVoidNode } from './doc/types-infer.js';
|
|
3
|
+
import { ExtractAttrValue, InferBlockNode, InferInlineNode, InferTextNode, InferVoidNode } from './doc/types-infer.js';
|
|
4
4
|
/**
|
|
5
5
|
* Delete content in the selection or specified range.
|
|
6
6
|
*/
|
|
@@ -8,11 +8,11 @@ export declare function Delete(editor: Editor, range?: Range): void;
|
|
|
8
8
|
/**
|
|
9
9
|
* Insert text at the caret or specified position.
|
|
10
10
|
*/
|
|
11
|
-
export declare function InsertText(editor: Editor, text: string,
|
|
11
|
+
export declare function InsertText(editor: Editor, text: string, at?: number): void;
|
|
12
12
|
/**
|
|
13
13
|
* Insert node at the caret or specified position.
|
|
14
14
|
*/
|
|
15
|
-
export declare function InsertNode<T extends DocNode>(editor: Editor<T>, node: InferVoidNode<T>,
|
|
15
|
+
export declare function InsertNode<T extends DocNode>(editor: Editor<T>, node: InferVoidNode<T>, at?: number): void;
|
|
16
16
|
/**
|
|
17
17
|
* Replace text in the selection or specified range.
|
|
18
18
|
*/
|
|
@@ -40,4 +40,8 @@ export declare function SetBlockAttr<T extends DocNode, N extends InferBlockNode
|
|
|
40
40
|
* Toggle attr of block node at the caret or specified position.
|
|
41
41
|
*/
|
|
42
42
|
export declare function ToggleBlockAttr<T extends DocNode, N extends InferBlockNode<T>, K extends string>(editor: Editor<T>, key: K, onValue: ExtractAttrValue<N, K>, offValue: ExtractAttrValue<N, K>, offset?: number): void;
|
|
43
|
+
/**
|
|
44
|
+
* Set attr to a void node at the caret or specified position.
|
|
45
|
+
*/
|
|
46
|
+
export declare function SetVoidAttr<T extends DocNode, N extends InferInlineNode<T>, K extends string>(editor: Editor<T>, key: K, value: ExtractAttrValue<N, K>, offset?: number): void;
|
|
43
47
|
export {};
|
package/lib/doc/node.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { InferVoidNode } from './types-infer.js';
|
|
2
|
-
import { BlockNode, DocNode, InlineNode, Node, Path, DomPosition } from './types.js';
|
|
1
|
+
import { InferInlineNode, InferVoidNode } from './types-infer.js';
|
|
2
|
+
import { BlockNode, DocNode, InlineNode, Node, Path, DomPosition, Range } from './types.js';
|
|
3
3
|
export declare const getNodeSize: (node: Node) => number;
|
|
4
|
-
export declare const getChildAt: <T extends BlockNode>({ children }: T, offset: number) => [node: T["children"][number], offset: number, index: number] | null;
|
|
4
|
+
export declare const getChildAt: <T extends BlockNode>({ children }: T, offset: number, isBackwardAffinity?: boolean) => [node: T["children"][number], offset: number, index: number] | null;
|
|
5
5
|
export declare const getBlockAt: (node: DocNode | BlockNode, offset: number) => [node: BlockNode, offset: number, path: Path];
|
|
6
|
-
export declare const getLeafAt: (node: DocNode | BlockNode, offset: number) => [node: InlineNode, offset: number] | null;
|
|
6
|
+
export declare const getLeafAt: (node: DocNode | BlockNode, offset: number, isBackwardAffinity?: boolean) => [node: InlineNode, offset: number, path: Path] | null;
|
|
7
7
|
export declare const offsetToPosition: (node: DocNode | BlockNode, offset: number) => DomPosition;
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function iterLeafs<T extends Node>(node: T, start: number, end: number): Generator<[node: InlineNode, offset: number], void, void>;
|
|
8
|
+
export declare function iterLeaves<T extends Node>(node: T, range: Range): Generator<[node: InferInlineNode<T>, offset: number], void, void>;
|
|
10
9
|
export declare const sliceText: <T extends Node>(node: T, start?: number, end?: number, voidToString?: (node: InferVoidNode<T>) => string) => string;
|
package/lib/dom/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Parser } from './parser.js';
|
|
2
|
-
import {
|
|
2
|
+
import { DocNode, Selection as JsSelection } from '../doc/types.js';
|
|
3
3
|
export { createParser, TOKEN_TEXT, TOKEN_VOID, TOKEN_SOFT_BREAK, TOKEN_BLOCK, } from './parser.js';
|
|
4
4
|
export { defaultIsBlockNode } from './default.js';
|
|
5
|
-
export declare const selectionToRange: (root: Element, parse: Parser,
|
|
5
|
+
export declare const selectionToRange: (root: Element, parse: Parser, doc: DocNode, sel: JsSelection) => Range;
|