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.
@@ -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,4 @@
1
+ export { fileTransferPlugin } from "./fileTransfer.js";
2
+ export { plainTransferPlugin } from "./plainTransfer.js";
3
+ export { htmlTransferPlugin } from "./htmlTransfer.js";
4
+ export { internalTranferPlugin } from "./internalTransfer.js";
@@ -0,0 +1,5 @@
1
+ import type { Editor } from "../../editor.js";
2
+ /**
3
+ * A plugin to handle copying / pasting between editor instances
4
+ */
5
+ export declare function internalTranferPlugin(editor: Editor): 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editate",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "An experimental, type-safe, framework agnostic and small (5kB+) contenteditable state manager.",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",
@@ -1,5 +0,0 @@
1
- import type { CopyHook } from "./types.js";
2
- /**
3
- * An extension to handle copying to HTML.
4
- */
5
- export declare const htmlCopy: () => CopyHook;
@@ -1,4 +0,0 @@
1
- export { plainCopy } from "./plain.js";
2
- export { htmlCopy } from "./html.js";
3
- export { internalCopy } from "./internal.js";
4
- export type { CopyHook } from "./types.js";
@@ -1,7 +0,0 @@
1
- import type { CopyHook } from "./types.js";
2
- /**
3
- * An extension to handle copying to editor instance.
4
- */
5
- export declare const internalCopy: ({ key, }?: {
6
- key?: string;
7
- }) => CopyHook;
@@ -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;
@@ -1,2 +0,0 @@
1
- import type { Fragment } from "../../doc/types.js";
2
- export type CopyHook = (dataTransfer: DataTransfer, doc: Fragment, element: Element) => void;
@@ -1,3 +0,0 @@
1
- export * from "./copy/index.js";
2
- export * from "./paste/index.js";
3
- export * from "./keyboard.js";
@@ -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;
@@ -1,5 +0,0 @@
1
- export { filePaste } from "./file.js";
2
- export { plainPaste } from "./plain.js";
3
- export { htmlPaste } from "./html.js";
4
- export { internalPaste } from "./internal.js";
5
- export type { PasteHook } from "./types.js";
@@ -1,7 +0,0 @@
1
- import type { PasteHook } from "./types.js";
2
- /**
3
- * An extension to handle pasting / dropping from editor instance.
4
- */
5
- export declare const internalPaste: ({ key, }?: {
6
- key?: string;
7
- }) => PasteHook;
@@ -1,5 +0,0 @@
1
- import type { PasteHook } from "./types.js";
2
- /**
3
- * An extension to handle pasting / dropping from plain text.
4
- */
5
- export declare const plainPaste: () => PasteHook;
@@ -1,3 +0,0 @@
1
- import type { Fragment } from "../../doc/types.js";
2
- import type { Parser } from "../../dom/parser.js";
3
- export type PasteHook = (dataTransfer: DataTransfer, parser: Parser) => string | Fragment | null;
@@ -1 +0,0 @@
1
- export {};