editate 0.5.0 → 0.6.0
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/README.md +16 -10
- package/lib/doc/edit.d.ts +4 -16
- package/lib/editor.d.ts +22 -26
- package/lib/index.cjs +559 -504
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.js +594 -532
- package/lib/index.js.map +1 -1
- package/lib/keyboard.d.ts +6 -0
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/keymap.d.ts +3 -0
- package/lib/plugins/singleline.d.ts +3 -0
- package/lib/plugins/transfer/fileTransfer.d.ts +6 -0
- package/lib/plugins/transfer/htmlTransfer.d.ts +9 -0
- package/lib/plugins/transfer/index.d.ts +4 -0
- package/lib/plugins/transfer/internalTransfer.d.ts +5 -0
- package/lib/plugins/transfer/plainTransfer.d.ts +8 -0
- package/package.json +1 -1
- package/lib/hooks/copy/html.d.ts +0 -5
- package/lib/hooks/copy/index.d.ts +0 -4
- package/lib/hooks/copy/internal.d.ts +0 -7
- package/lib/hooks/copy/plain.d.ts +0 -6
- package/lib/hooks/copy/types.d.ts +0 -2
- package/lib/hooks/index.d.ts +0 -3
- package/lib/hooks/keyboard.d.ts +0 -14
- package/lib/hooks/paste/file.d.ts +0 -6
- package/lib/hooks/paste/html.d.ts +0 -6
- package/lib/hooks/paste/index.d.ts +0 -5
- package/lib/hooks/paste/internal.d.ts +0 -7
- package/lib/hooks/paste/plain.d.ts +0 -5
- package/lib/hooks/paste/types.d.ts +0 -3
- package/lib/hooks/utils.d.ts +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Editor } from "../../editor.js";
|
|
2
|
+
import type { DocNode, InferInlineNode, TextNode } from "../../doc/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A plugin to handle copying / pasting HTML
|
|
5
|
+
*/
|
|
6
|
+
export declare function htmlTransferPlugin<T extends DocNode>(editor: Editor<T>, options: {
|
|
7
|
+
serializeText: (t: string) => Extract<InferInlineNode<T>, TextNode>;
|
|
8
|
+
serializers?: ((node: HTMLElement) => Exclude<InferInlineNode<T>, TextNode> | void)[];
|
|
9
|
+
}): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DocNode, InferInlineNode } from "../../doc/types.js";
|
|
2
|
+
import type { Editor } from "../../editor.js";
|
|
3
|
+
/**
|
|
4
|
+
* A plugin to handle copying / pasting plain text.
|
|
5
|
+
*/
|
|
6
|
+
export declare function plainTransferPlugin<T extends DocNode>(editor: Editor<T>, options?: {
|
|
7
|
+
serializer?: (node: InferInlineNode<T>) => string;
|
|
8
|
+
}): void;
|
package/package.json
CHANGED
package/lib/hooks/copy/html.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DocNode, InferInlineNode } from "../../doc/types.js";
|
|
2
|
-
import type { CopyHook } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* An extension to handle copying to plain text.
|
|
5
|
-
*/
|
|
6
|
-
export declare const plainCopy: <T extends DocNode>(serializer?: (node: InferInlineNode<T>) => string) => CopyHook;
|
package/lib/hooks/index.d.ts
DELETED
package/lib/hooks/keyboard.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Functions to handle keyboard events.
|
|
3
|
-
*
|
|
4
|
-
* Return `true` if you want to stop propagation.
|
|
5
|
-
*/
|
|
6
|
-
export type KeyboardHook = (keyboard: KeyboardEvent) => boolean | void;
|
|
7
|
-
/**
|
|
8
|
-
* TODO
|
|
9
|
-
*/
|
|
10
|
-
export declare const hotkey: (key: string, cb: (e: KeyboardEvent) => void, { mod, shift, alt, }?: {
|
|
11
|
-
mod?: boolean;
|
|
12
|
-
shift?: boolean;
|
|
13
|
-
alt?: boolean;
|
|
14
|
-
}) => KeyboardHook;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { InlineNode } from "../../doc/types.js";
|
|
2
|
-
import type { PasteHook } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* An extension to handle pasting / dropping from File.
|
|
5
|
-
*/
|
|
6
|
-
export declare const filePaste: (handlerByMime: Record<string, (file: File) => InlineNode>) => PasteHook;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DocNode, InferInlineNode, TextNode } from "../../doc/types.js";
|
|
2
|
-
import type { PasteHook } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* An extension to handle pasting / dropping from HTML.
|
|
5
|
-
*/
|
|
6
|
-
export declare const htmlPaste: <T extends DocNode>(serializeText: (t: string) => Extract<InferInlineNode<T>, TextNode>, serializers?: ((node: HTMLElement) => Exclude<InferInlineNode<T>, TextNode> | void)[]) => PasteHook;
|
package/lib/hooks/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|