@sobree/core 0.1.34 → 0.1.35

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,30 @@
1
+ import { Block } from '../../doc/types';
2
+ import { EditorContext } from '../context';
3
+ /** Clipboard MIME for a Sobree block payload. The `+json` suffix and the
4
+ * `web ` prefix browsers add for custom types both round-trip our reader. */
5
+ export declare const BLOCKS_MIME = "application/x-sobree-blocks+json";
6
+ /** Serialise blocks for the clipboard. */
7
+ export declare function serializeBlocks(blocks: readonly Block[]): string;
8
+ /** Parse a clipboard payload back to blocks, or `null` when the data isn't
9
+ * ours / is malformed (caller then falls back to plain-text paste). */
10
+ export declare function parseBlocks(data: string | undefined | null): Block[] | null;
11
+ /**
12
+ * The whole blocks a selection covers, or `null` when the selection isn't
13
+ * block-level (a caret, or a partial selection inside one block).
14
+ */
15
+ export declare function selectedWholeBlocks(ctx: EditorContext): Block[] | null;
16
+ /** `copy` handler: write the covered whole blocks, or let the browser run
17
+ * its default plain-text copy when none are covered. */
18
+ export declare function onCopy(ctx: EditorContext, e: ClipboardEvent): void;
19
+ /** `cut` handler: copy the covered whole blocks AND remove them (in
20
+ * track-changes mode `deleteBlock` marks them instead). A partial in-block
21
+ * selection falls through to the browser's default text cut. */
22
+ export declare function onCut(ctx: EditorContext, e: ClipboardEvent): void;
23
+ /**
24
+ * Paste handler hook for a structured block payload. Returns `true` when it
25
+ * consumed the event (block paste), `false` to let the normal text/image
26
+ * paste run. Inserts the pasted blocks after the caret's block, in order.
27
+ */
28
+ export declare function tryPasteBlocks(ctx: EditorContext, e: ClipboardEvent): boolean;
29
+ /** Insert `blocks` (deep-cloned, fresh ids) after the caret's block. */
30
+ export declare function pasteBlocksAfterCaret(ctx: EditorContext, blocks: readonly Block[]): void;