editate 0.6.18 → 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 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
  */
@@ -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
1
  import { InferInlineNode, InferVoidNode } from './types-infer.js';
2
- import { BlockNode, DocNode, InlineNode, Node, Path, DomPosition } from './types.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 iterChilds<T extends Node>(node: T, start: number, end: number): Generator<[node: Node, offset: number], void, void>;
9
- export declare function iterLeafs<T extends Node>(node: T, start: number, end: number): Generator<[node: InferInlineNode<T>, 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;