@sobree/core 0.1.34 → 0.1.36
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/dist/editor/ops/clipboard.d.ts +30 -0
- package/dist/editor/view/docRenderer/sectionFlow.d.ts +24 -1
- package/dist/index.js +1742 -1637
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -12,10 +12,33 @@ import { SectionProperties } from '../../../doc/types';
|
|
|
12
12
|
* - `data-col-count` — column count (every multi-column wrapper)
|
|
13
13
|
* - `data-pag-cid` — stable section id, so the flow pass can
|
|
14
14
|
* re-consolidate a section's per-page wrappers
|
|
15
|
+
* - `data-col-fill`="1" — fill column 0 to the page bottom, then column
|
|
16
|
+
* 1 (newspaper) instead of balancing the last
|
|
17
|
+
* page; see `columnsFillNotBalance`
|
|
15
18
|
* - unequal: `data-col-widths-mm` + `data-col-gaps-mm` (explicit)
|
|
16
19
|
* - equal: `data-col-gap-mm` (tracks sized by the flow pass)
|
|
20
|
+
*
|
|
21
|
+
* `nextSection` is the section that BEGINS immediately after this one; its
|
|
22
|
+
* break type is what TERMINATES this one, and so decides balance vs fill.
|
|
23
|
+
*/
|
|
24
|
+
export declare function openColumnContainerIfNeeded(host: HTMLElement, section: SectionProperties | undefined, sectionIndex?: number, nextSection?: SectionProperties | undefined): HTMLElement;
|
|
25
|
+
/**
|
|
26
|
+
* Whether a multi-column section should FILL column-first (column 0 to the
|
|
27
|
+
* page bottom, then column 1) rather than balance its last page.
|
|
28
|
+
*
|
|
29
|
+
* Word balances a multi-column section's columns only when the section ends
|
|
30
|
+
* at a CONTINUOUS section break (or the document end); a section terminated
|
|
31
|
+
* by a hard page break (`nextPage` / `evenPage` / `oddPage`) fills column by
|
|
32
|
+
* column instead, leaving the second column short when the text runs out.
|
|
33
|
+
* `nextSection` is the section that begins right after — its break `type` is
|
|
34
|
+
* this section's terminator. No next section ⇒ document end ⇒ balance.
|
|
35
|
+
* (OOXML's `<w:type>` default is `nextPage`, so an unset type fills.)
|
|
17
36
|
*/
|
|
18
|
-
export declare function
|
|
37
|
+
export declare function columnsFillNotBalance(nextSection: SectionProperties | undefined): boolean;
|
|
38
|
+
/** Whether `section` begins on a fresh page — its break `type` is a hard
|
|
39
|
+
* page break (`nextPage` / `evenPage` / `oddPage`). A continuous (or unset)
|
|
40
|
+
* section continues on the running page. */
|
|
41
|
+
export declare function sectionStartsOnFreshPage(section: SectionProperties | undefined): boolean;
|
|
19
42
|
/**
|
|
20
43
|
* If `container` is a column-flow container, move any trailing
|
|
21
44
|
* visually-empty paragraphs out of it and append them to `host`. Keeps
|