@p10node/office-engine 0.2.2 → 0.2.3
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 +11 -3
- package/dist/{DocViewer-Co7q5D2H.js → DocViewer-CT8VAa1L.js} +52 -6
- package/dist/DocViewer-CT8VAa1L.js.map +1 -0
- package/dist/{collab-BvjXvfJ9.js → collab-Dx00zqXR.js} +215 -175
- package/dist/collab-Dx00zqXR.js.map +1 -0
- package/dist/collab.js +1 -1
- package/dist/embed.js +1 -1
- package/dist/index.js +2 -2
- package/dist/office-engine.embed.js +26 -26
- package/dist/types/react/docx/DocxEditor.d.ts +6 -1
- package/dist/types/react/edit/input.d.ts +12 -0
- package/package.json +2 -1
- package/dist/DocViewer-Co7q5D2H.js.map +0 -1
- package/dist/collab-BvjXvfJ9.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Block, CanonStyle, Paragraph, ParaDirty, ParaStyle, RunSet, RunStyle, StyleInfo } from '../../core/docx/types';
|
|
2
2
|
import type { DocumentClient } from '../../core/worker/client';
|
|
3
3
|
import { RichInput, type ReplaceOpts, type RichHost } from '../edit/input';
|
|
4
|
-
import { type RRun, type Sel } from '../edit/rich';
|
|
4
|
+
import { type Pos, type RRun, type Sel } from '../edit/rich';
|
|
5
5
|
export interface DocState {
|
|
6
6
|
blocks: Block[];
|
|
7
7
|
heights: WeakMap<Block, number>;
|
|
@@ -81,6 +81,11 @@ export declare class DocxEditor implements RichHost<Paragraph> {
|
|
|
81
81
|
prev(pa: string): string | undefined;
|
|
82
82
|
next(pa: string): string | undefined;
|
|
83
83
|
cmp(a: string, b: string): number;
|
|
84
|
+
/** the whole document: from the first to the last editable top-level paragraph */
|
|
85
|
+
all(): Sel | null;
|
|
86
|
+
selectAll(): void;
|
|
87
|
+
/** Deletes a top-level range that spans tables: the end paragraphs are joined, everything between goes (section breaks stay). */
|
|
88
|
+
deleteAcross(s: Pos, e: Pos): Pos | null;
|
|
84
89
|
withRuns(p: Paragraph, runs: RRun[]): Paragraph;
|
|
85
90
|
private origOf;
|
|
86
91
|
defaultRun(p: Paragraph): Partial<RRun> | undefined;
|
|
@@ -40,6 +40,10 @@ export interface RichHost<P extends RichPara = RichPara> {
|
|
|
40
40
|
pendingStyle?(): Partial<RRun> | undefined;
|
|
41
41
|
clearPending?(): void;
|
|
42
42
|
onSelection?(sel: Sel | null): void;
|
|
43
|
+
/** the whole document (select all); null when there is nothing to select */
|
|
44
|
+
all?(): Sel | null;
|
|
45
|
+
/** deletes a range that spans other blocks (tables): applies the change and returns the caret, or null when unsupported */
|
|
46
|
+
deleteAcross?(s: Pos, e: Pos): Pos | null;
|
|
43
47
|
}
|
|
44
48
|
export declare function ordered(host: RichHost, s: Sel): [Pos, Pos];
|
|
45
49
|
export declare function opDelete(host: RichHost, sel: Sel, opts?: ReplaceOpts): void;
|
|
@@ -63,6 +67,8 @@ export declare class RichInput {
|
|
|
63
67
|
private justComposed;
|
|
64
68
|
private raf;
|
|
65
69
|
lastSel: Sel | null;
|
|
70
|
+
/** select all: the model selection covers every paragraph, the DOM one only what is rendered */
|
|
71
|
+
private override;
|
|
66
72
|
constructor(host: RichHost);
|
|
67
73
|
attach(root: HTMLElement): void;
|
|
68
74
|
detach(): void;
|
|
@@ -70,6 +76,12 @@ export declare class RichInput {
|
|
|
70
76
|
readSel(): Sel | null;
|
|
71
77
|
/** current selection, falling back to the last known one (e.g. after focusing a toolbar control) */
|
|
72
78
|
sel(): Sel | null;
|
|
79
|
+
/**
|
|
80
|
+
* Selects the whole document. The browser's own select-all is useless here: the editing host holds
|
|
81
|
+
* non-editable parts (headers, read-only paragraphs) and Chromium empties a selection that crosses them;
|
|
82
|
+
* pages are also virtualized, so the DOM only ever holds a part of the document.
|
|
83
|
+
*/
|
|
84
|
+
selectAll(): boolean;
|
|
73
85
|
/** Applies a model selection to the DOM; false when its paragraph isn't rendered. */
|
|
74
86
|
restore(sel: Sel | null, focus?: boolean): boolean;
|
|
75
87
|
private rangeSel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@p10node/office-engine",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Browser engine to view DOCX, XLSX, PPTX progressively (worker-based, range-loading, virtualized React views)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"collab": "bun scripts/collab-server.ts",
|
|
55
55
|
"clean": "rm -rf dist",
|
|
56
56
|
"screenshots": "bun scripts/screenshots.ts",
|
|
57
|
+
"gifs": "bun scripts/gifs.ts",
|
|
57
58
|
"build:site": "bun scripts/build-site.ts"
|
|
58
59
|
},
|
|
59
60
|
"peerDependencies": {
|