docxkeun 0.1.2 → 0.2.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/CHANGELOG.md +55 -0
- package/README.md +139 -16
- package/dist/api/editor.d.ts +172 -5
- package/dist/api/editor.js +814 -24
- package/dist/api/headers.d.ts +51 -0
- package/dist/api/headers.js +133 -0
- package/dist/api/index.d.ts +5 -1
- package/dist/api/index.js +4 -1
- package/dist/api/lists.d.ts +37 -0
- package/dist/api/lists.js +132 -0
- package/dist/api/parts.js +1 -0
- package/dist/api/positions.js +1 -0
- package/dist/api/revisions.d.ts +61 -0
- package/dist/api/revisions.js +390 -0
- package/dist/api/selection.d.ts +57 -0
- package/dist/api/selection.js +91 -0
- package/dist/charts/color.d.ts +45 -0
- package/dist/charts/color.js +322 -0
- package/dist/charts/format.d.ts +12 -0
- package/dist/charts/format.js +459 -0
- package/dist/charts/index.d.ts +11 -0
- package/dist/charts/index.js +8 -0
- package/dist/charts/model.d.ts +225 -0
- package/dist/charts/model.js +758 -0
- package/dist/charts/outline.d.ts +17 -0
- package/dist/charts/outline.js +214 -0
- package/dist/charts/render.d.ts +20 -0
- package/dist/charts/render.js +1772 -0
- package/dist/drawing/arrows.d.ts +37 -0
- package/dist/drawing/arrows.js +99 -0
- package/dist/drawing/formula.d.ts +40 -0
- package/dist/drawing/formula.js +159 -0
- package/dist/drawing/geometry.d.ts +61 -0
- package/dist/drawing/geometry.js +286 -0
- package/dist/drawing/index.d.ts +12 -0
- package/dist/drawing/index.js +8 -0
- package/dist/drawing/presets.d.ts +72 -0
- package/dist/drawing/presets.js +2874 -0
- package/dist/fonts/shaping/apply.d.ts +94 -0
- package/dist/fonts/shaping/apply.js +349 -0
- package/dist/fonts/shaping/arabic.d.ts +28 -0
- package/dist/fonts/shaping/arabic.js +235 -0
- package/dist/fonts/shaping/buffer.d.ts +53 -0
- package/dist/fonts/shaping/buffer.js +95 -0
- package/dist/fonts/shaping/gdef.d.ts +30 -0
- package/dist/fonts/shaping/gdef.js +66 -0
- package/dist/fonts/shaping/gpos.d.ts +86 -0
- package/dist/fonts/shaping/gpos.js +428 -0
- package/dist/fonts/shaping/gsub.d.ts +65 -0
- package/dist/fonts/shaping/gsub.js +313 -0
- package/dist/fonts/shaping/index.d.ts +32 -0
- package/dist/fonts/shaping/index.js +402 -0
- package/dist/fonts/shaping/indic.d.ts +6 -0
- package/dist/fonts/shaping/indic.js +805 -0
- package/dist/fonts/shaping/layout-common.d.ts +124 -0
- package/dist/fonts/shaping/layout-common.js +349 -0
- package/dist/fonts/shaping/plan.d.ts +87 -0
- package/dist/fonts/shaping/plan.js +152 -0
- package/dist/fonts/shaping/scripts.d.ts +26 -0
- package/dist/fonts/shaping/scripts.js +160 -0
- package/dist/fonts/shaping/shaper.d.ts +23 -0
- package/dist/fonts/shaping/shaper.js +5 -0
- package/dist/fonts/shaping/unicode.d.ts +34 -0
- package/dist/fonts/shaping/unicode.js +138 -0
- package/dist/images/bmp.d.ts +9 -0
- package/dist/images/bmp.js +234 -0
- package/dist/images/gif.d.ts +9 -0
- package/dist/images/gif.js +215 -0
- package/dist/images/index.d.ts +18 -0
- package/dist/images/index.js +63 -0
- package/dist/images/png-encode.d.ts +4 -0
- package/dist/images/png-encode.js +73 -0
- package/dist/images/size.d.ts +10 -0
- package/dist/images/size.js +83 -0
- package/dist/images/tiff.d.ts +14 -0
- package/dist/images/tiff.js +407 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +5 -0
- package/dist/layout/bidi.d.ts +18 -0
- package/dist/layout/bidi.js +71 -0
- package/dist/layout/blocks.d.ts +20 -3
- package/dist/layout/blocks.js +88 -58
- package/dist/layout/cache.d.ts +31 -0
- package/dist/layout/cache.js +38 -0
- package/dist/layout/drawing.d.ts +30 -0
- package/dist/layout/drawing.js +120 -0
- package/dist/layout/engine.d.ts +3 -0
- package/dist/layout/engine.js +218 -11
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/lines.d.ts +63 -5
- package/dist/layout/lines.js +245 -20
- package/dist/layout/paint.d.ts +25 -3
- package/dist/layout/paint.js +26 -10
- package/dist/layout/shapes.d.ts +7 -0
- package/dist/layout/shapes.js +338 -0
- package/dist/layout/style.d.ts +4 -0
- package/dist/layout/style.js +2 -0
- package/dist/layout/types.d.ts +89 -2
- package/dist/math/boxes.d.ts +88 -0
- package/dist/math/boxes.js +166 -0
- package/dist/math/index.d.ts +29 -0
- package/dist/math/index.js +44 -0
- package/dist/math/layout.d.ts +13 -0
- package/dist/math/layout.js +771 -0
- package/dist/math/linear.d.ts +3 -0
- package/dist/math/linear.js +152 -0
- package/dist/math/omml.d.ts +15 -0
- package/dist/math/omml.js +57 -0
- package/dist/math/paths.d.ts +61 -0
- package/dist/math/paths.js +450 -0
- package/dist/math/symbols.d.ts +49 -0
- package/dist/math/symbols.js +269 -0
- package/dist/math/text.d.ts +53 -0
- package/dist/math/text.js +316 -0
- package/dist/metafile/canvas.d.ts +80 -0
- package/dist/metafile/canvas.js +515 -0
- package/dist/metafile/dib.d.ts +27 -0
- package/dist/metafile/dib.js +300 -0
- package/dist/metafile/emf.d.ts +31 -0
- package/dist/metafile/emf.js +591 -0
- package/dist/metafile/geometry.d.ts +49 -0
- package/dist/metafile/geometry.js +85 -0
- package/dist/metafile/index.d.ts +27 -0
- package/dist/metafile/index.js +34 -0
- package/dist/metafile/reader.d.ts +28 -0
- package/dist/metafile/reader.js +59 -0
- package/dist/metafile/state.d.ts +118 -0
- package/dist/metafile/state.js +172 -0
- package/dist/metafile/text.d.ts +17 -0
- package/dist/metafile/text.js +130 -0
- package/dist/metafile/wmf.d.ts +33 -0
- package/dist/metafile/wmf.js +395 -0
- package/dist/model/content.d.ts +92 -7
- package/dist/model/content.js +251 -17
- package/dist/model/document.d.ts +34 -1
- package/dist/model/document.js +80 -1
- package/dist/model/fields.d.ts +4 -0
- package/dist/model/fields.js +10 -0
- package/dist/model/numbering.d.ts +2 -0
- package/dist/model/numbering.js +22 -0
- package/dist/model/props.d.ts +2 -0
- package/dist/model/props.js +3 -0
- package/dist/opc/index.d.ts +1 -1
- package/dist/opc/package.d.ts +34 -0
- package/dist/opc/package.js +58 -4
- package/dist/pdf/export.js +97 -6
- package/dist/pdf/images.d.ts +7 -0
- package/dist/pdf/images.js +39 -2
- package/dist/render/activity.d.ts +138 -0
- package/dist/render/activity.js +794 -0
- package/dist/render/clipboard.d.ts +29 -0
- package/dist/render/clipboard.js +401 -0
- package/dist/render/comments.d.ts +166 -0
- package/dist/render/comments.js +779 -0
- package/dist/render/context-menu.d.ts +124 -0
- package/dist/render/context-menu.js +525 -0
- package/dist/render/editing.d.ts +146 -5
- package/dist/render/editing.js +678 -53
- package/dist/render/index.d.ts +12 -0
- package/dist/render/index.js +11 -0
- package/dist/render/navigation-panel.d.ts +76 -0
- package/dist/render/navigation-panel.js +431 -0
- package/dist/render/selection.js +5 -0
- package/dist/render/svg.d.ts +4 -6
- package/dist/render/svg.js +69 -7
- package/dist/render/toolbar.d.ts +83 -0
- package/dist/render/toolbar.js +505 -0
- package/dist/render/ui/comment-layout.d.ts +39 -0
- package/dist/render/ui/comment-layout.js +79 -0
- package/dist/render/ui/icons.d.ts +6 -0
- package/dist/render/ui/icons.js +38 -0
- package/dist/render/ui/menu.d.ts +38 -0
- package/dist/render/ui/menu.js +274 -0
- package/dist/render/ui/nav-model.d.ts +11 -0
- package/dist/render/ui/nav-model.js +34 -0
- package/dist/render/ui/overflow.d.ts +5 -0
- package/dist/render/ui/overflow.js +18 -0
- package/dist/render/ui/popover.d.ts +18 -0
- package/dist/render/ui/popover.js +109 -0
- package/dist/render/ui/theme.d.ts +2 -0
- package/dist/render/ui/theme.js +29 -0
- package/dist/render/undo.d.ts +76 -0
- package/dist/render/undo.js +144 -0
- package/dist/render/viewer.d.ts +100 -7
- package/dist/render/viewer.js +302 -92
- package/dist/security/policy.d.ts +3 -0
- package/dist/security/policy.js +6 -2
- package/dist/security/protection.d.ts +1 -0
- package/dist/security/protection.js +1 -1
- package/dist/text/bidi-data.d.ts +53 -0
- package/dist/text/bidi-data.js +318 -0
- package/dist/text/bidi.d.ts +37 -0
- package/dist/text/bidi.js +508 -0
- package/dist/xml/ns.d.ts +5 -0
- package/dist/xml/ns.js +7 -0
- package/package.json +9 -2
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One undo history for the viewer's editing: typing keeps a copy of the story's XML (cheap, one
|
|
3
|
+
* part), while actions that can touch other parts (comments, lists, headers) keep a whole-document
|
|
4
|
+
* checkpoint. No DOM here, so the history can be used and tested without a browser.
|
|
5
|
+
*/
|
|
6
|
+
import { EditError } from '../api/positions.js';
|
|
7
|
+
export class UndoHistory {
|
|
8
|
+
limit;
|
|
9
|
+
/**
|
|
10
|
+
* How long (ms) a transaction waits for the one ahead of it before it gives up with an
|
|
11
|
+
* `EditError`. A change started after an `await` inside a transaction's own `run` waits for
|
|
12
|
+
* that run, which may be waiting for it: this turns that hang into an error.
|
|
13
|
+
*/
|
|
14
|
+
static queueTimeout = 10_000;
|
|
15
|
+
undoStack = [];
|
|
16
|
+
redoStack = [];
|
|
17
|
+
tail = Promise.resolve();
|
|
18
|
+
pending = 0;
|
|
19
|
+
/** A transaction's `run` is executing synchronously (before its first `await` takes effect). */
|
|
20
|
+
joinDepth = 0;
|
|
21
|
+
constructor(limit = 200) {
|
|
22
|
+
this.limit = limit;
|
|
23
|
+
}
|
|
24
|
+
/** Record a new step; anything that could be redone is dropped. */
|
|
25
|
+
push(e) {
|
|
26
|
+
this.undoStack.push(e);
|
|
27
|
+
if (this.undoStack.length > this.limit)
|
|
28
|
+
this.undoStack.shift();
|
|
29
|
+
this.redoStack.length = 0;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Step back. `current` builds the entry for the state being left (of the same kind as the entry
|
|
33
|
+
* being restored); it goes on the redo stack. Returns the entry to restore.
|
|
34
|
+
*/
|
|
35
|
+
undo(current) {
|
|
36
|
+
if (this.pending)
|
|
37
|
+
return undefined;
|
|
38
|
+
const e = this.undoStack[this.undoStack.length - 1];
|
|
39
|
+
if (!e)
|
|
40
|
+
return undefined;
|
|
41
|
+
this.redoStack.push(current(e));
|
|
42
|
+
this.undoStack.pop();
|
|
43
|
+
return e;
|
|
44
|
+
}
|
|
45
|
+
redo(current) {
|
|
46
|
+
if (this.pending)
|
|
47
|
+
return undefined;
|
|
48
|
+
const e = this.redoStack[this.redoStack.length - 1];
|
|
49
|
+
if (!e)
|
|
50
|
+
return undefined;
|
|
51
|
+
this.undoStack.push(current(e));
|
|
52
|
+
this.redoStack.pop();
|
|
53
|
+
return e;
|
|
54
|
+
}
|
|
55
|
+
clear() {
|
|
56
|
+
this.undoStack.length = 0;
|
|
57
|
+
this.redoStack.length = 0;
|
|
58
|
+
}
|
|
59
|
+
/** A transaction is running or waiting; undo and redo do nothing meanwhile. */
|
|
60
|
+
get busy() {
|
|
61
|
+
return this.pending > 0;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A transaction's `run` is executing synchronously: a transaction started now is nested in it
|
|
65
|
+
* and joins it. Later in the run (after an `await`) this is false, as there is no telling a
|
|
66
|
+
* nested call from an unrelated one.
|
|
67
|
+
*/
|
|
68
|
+
get joinable() {
|
|
69
|
+
return this.joinDepth > 0;
|
|
70
|
+
}
|
|
71
|
+
get canUndo() {
|
|
72
|
+
return this.undoStack.length > 0;
|
|
73
|
+
}
|
|
74
|
+
get canRedo() {
|
|
75
|
+
return this.redoStack.length > 0;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Run a whole-document action as one undo step. A failure puts the document back as it was
|
|
79
|
+
* and records nothing.
|
|
80
|
+
*
|
|
81
|
+
* Transactions run one at a time: one requested while another is running waits for it, so it
|
|
82
|
+
* checkpoints a settled document and is an undo step of its own, and the other's failure does
|
|
83
|
+
* not touch it. If the wait passes `UndoHistory.queueTimeout`, it gives up with an `EditError`
|
|
84
|
+
* without running (nothing changed, nothing recorded).
|
|
85
|
+
*
|
|
86
|
+
* A transaction requested while another one's `run` is executing synchronously (a nested call
|
|
87
|
+
* before the run's first `await`) joins it: it runs at once as part of that step, with no
|
|
88
|
+
* checkpoint or entry of its own, and a failure goes to the outer `run` (which restores the
|
|
89
|
+
* document if it lets the error through). Later in the run, changes go through the run's own
|
|
90
|
+
* means (the editor it was given), since waiting for the outer step from inside it cannot end.
|
|
91
|
+
*/
|
|
92
|
+
async transaction(doc, label, run, where) {
|
|
93
|
+
if (this.joinDepth)
|
|
94
|
+
return await run();
|
|
95
|
+
const before = this.tail;
|
|
96
|
+
let release;
|
|
97
|
+
this.tail = new Promise((r) => (release = r));
|
|
98
|
+
this.pending++;
|
|
99
|
+
let started = false;
|
|
100
|
+
try {
|
|
101
|
+
await waitFor(before, UndoHistory.queueTimeout);
|
|
102
|
+
started = true;
|
|
103
|
+
const checkpoint = doc.checkpoint();
|
|
104
|
+
try {
|
|
105
|
+
let running;
|
|
106
|
+
this.joinDepth++;
|
|
107
|
+
try {
|
|
108
|
+
running = run();
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
this.joinDepth--;
|
|
112
|
+
}
|
|
113
|
+
const result = await running;
|
|
114
|
+
this.push({ kind: 'package', checkpoint, story: where.story, ...(where.container !== undefined ? { container: where.container } : {}), anchor: { ...where.anchor }, focus: { ...where.focus }, label });
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
doc.restore(checkpoint);
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
this.pending--;
|
|
124
|
+
// One that gave up keeps its place: the next one still waits for the one ahead of it.
|
|
125
|
+
if (started)
|
|
126
|
+
release();
|
|
127
|
+
else
|
|
128
|
+
void before.then(release);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** Wait for `turn`, or reject with an `EditError` after `ms`. */
|
|
133
|
+
async function waitFor(turn, ms) {
|
|
134
|
+
let timer;
|
|
135
|
+
const gaveUp = new Promise((_, reject) => {
|
|
136
|
+
timer = setTimeout(() => reject(new EditError('Another change is still running. Inside viewer.editing.transaction(), make changes through the editor it gives you.')), ms);
|
|
137
|
+
});
|
|
138
|
+
try {
|
|
139
|
+
await Promise.race([turn, gaveUp]);
|
|
140
|
+
}
|
|
141
|
+
finally {
|
|
142
|
+
clearTimeout(timer);
|
|
143
|
+
}
|
|
144
|
+
}
|
package/dist/render/viewer.d.ts
CHANGED
|
@@ -7,7 +7,13 @@ import { FontRegistry } from '../fonts/registry.js';
|
|
|
7
7
|
import type { LayoutResult, Page, PermArea } from '../layout/types.js';
|
|
8
8
|
import { DocxDocument, type OpenOptions } from '../model/document.js';
|
|
9
9
|
import type { LinkTarget } from '../model/fields.js';
|
|
10
|
-
import { InlineEditing, type EditingOptions } from './editing.js';
|
|
10
|
+
import { InlineEditing, type CaretFormat, type EditingOptions, type EditStory } from './editing.js';
|
|
11
|
+
import { type SelectionInfo } from '../api/selection.js';
|
|
12
|
+
import { ToolbarController, type ToolbarOptions } from './toolbar.js';
|
|
13
|
+
import { NavigationController, type NavigationOptions } from './navigation-panel.js';
|
|
14
|
+
import { ContextMenuController, type ContextMenuOptions } from './context-menu.js';
|
|
15
|
+
import { CommentsController, type CommentsOptions } from './comments.js';
|
|
16
|
+
import { AiActivity, type ActivityOptions } from './activity.js';
|
|
11
17
|
import { type DocLocation, type NavKind, type NavTarget, type NavTargets } from './navigation.js';
|
|
12
18
|
import { type InlinePosition } from './selection.js';
|
|
13
19
|
export interface ViewerOptions {
|
|
@@ -29,6 +35,19 @@ export interface ViewerOptions {
|
|
|
29
35
|
* what they may change; refused edits are reported through the `editerror` event.
|
|
30
36
|
*/
|
|
31
37
|
editable?: boolean | EditingOptions;
|
|
38
|
+
/**
|
|
39
|
+
* How an AI assistant's work shows (`viewer.activity`): `false` turns it off, or pass options
|
|
40
|
+
* (`animate: false` for highlights without motion, `marks: false` for no change bars).
|
|
41
|
+
*/
|
|
42
|
+
aiActivity?: false | ActivityOptions;
|
|
43
|
+
/** Show a formatting toolbar above the pages while editing (or put it in this element). */
|
|
44
|
+
toolbar?: boolean | HTMLElement | ToolbarOptions;
|
|
45
|
+
/** Show the navigation panel (outline, bookmarks, links) beside the pages. */
|
|
46
|
+
navigation?: boolean | NavigationOptions;
|
|
47
|
+
/** The comment column: `mode` (`auto` switches between cards and bubbles by width) and `showResolved`. `showComments: false` hides it. */
|
|
48
|
+
comments?: CommentsOptions;
|
|
49
|
+
/** Right-click menu (off by default). Shift + right-click still shows the browser's own menu. */
|
|
50
|
+
contextMenu?: boolean | ContextMenuOptions;
|
|
32
51
|
}
|
|
33
52
|
export interface ViewerEvents {
|
|
34
53
|
/** A link was clicked. Call `preventDefault()` to stop the viewer from following it. */
|
|
@@ -62,6 +81,24 @@ export interface ViewerEvents {
|
|
|
62
81
|
location: DocLocation;
|
|
63
82
|
target?: NavTarget;
|
|
64
83
|
};
|
|
84
|
+
/** What is selected (or where the caret is) changed: paragraph numbers, text and pages. */
|
|
85
|
+
selectioninfo: {
|
|
86
|
+
selection: SelectionInfo | undefined;
|
|
87
|
+
};
|
|
88
|
+
/** The caret moved into a header, footer, note or text box, or back to the body. */
|
|
89
|
+
storychange: {
|
|
90
|
+
story: EditStory;
|
|
91
|
+
};
|
|
92
|
+
/** The selection or caret moved, or the formatting at it changed (for toolbars). */
|
|
93
|
+
caretchange: {
|
|
94
|
+
format: CaretFormat | undefined;
|
|
95
|
+
};
|
|
96
|
+
/** A chrome part (toolbar, navigation panel, comment column, context menu) was shown, hidden or folded. */
|
|
97
|
+
chromechange: {
|
|
98
|
+
part: 'toolbar' | 'navigation' | 'comments' | 'contextMenu';
|
|
99
|
+
visible: boolean;
|
|
100
|
+
collapsed?: boolean;
|
|
101
|
+
};
|
|
65
102
|
}
|
|
66
103
|
type Listener<K extends keyof ViewerEvents> = (event: ViewerEvents[K]) => void;
|
|
67
104
|
/** Allow only links whose scheme is on the allow-list. */
|
|
@@ -78,19 +115,61 @@ export declare class DocxViewer {
|
|
|
78
115
|
private readonly rows;
|
|
79
116
|
private readonly mounted;
|
|
80
117
|
private observer;
|
|
81
|
-
private
|
|
118
|
+
private commentMap;
|
|
119
|
+
private threadCache;
|
|
82
120
|
private readonly listeners;
|
|
83
121
|
private unsubscribe;
|
|
84
122
|
private relayoutScheduled;
|
|
123
|
+
private layoutCache;
|
|
85
124
|
private zoomLevel;
|
|
86
|
-
private
|
|
125
|
+
private activeComments;
|
|
87
126
|
private editingLayer;
|
|
127
|
+
private toolbarCtl;
|
|
128
|
+
private navigationCtl;
|
|
129
|
+
private commentsCtl;
|
|
130
|
+
private contextMenuCtl;
|
|
131
|
+
private readonly containerEl;
|
|
88
132
|
private renderedShape;
|
|
89
133
|
private navTargets;
|
|
90
134
|
private navCursor;
|
|
91
135
|
private readonly past;
|
|
92
136
|
private readonly future;
|
|
93
137
|
constructor(container: HTMLElement, options?: ViewerOptions);
|
|
138
|
+
/** The threads of the document, in order: each root comment with its replies and anchor. */
|
|
139
|
+
private commentThreads;
|
|
140
|
+
/** What the comment column needs from this viewer. */
|
|
141
|
+
private commentsHost;
|
|
142
|
+
private frameParts;
|
|
143
|
+
/**
|
|
144
|
+
* The frame around the viewer, created on first call: `container > .docxkeun-frame >
|
|
145
|
+
* [.docxkeun-toolbar-slot, .docxkeun-body > root]`. Only chrome parts call it; without them
|
|
146
|
+
* the root stays a direct child of the container.
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
frame(): {
|
|
150
|
+
frame: HTMLDivElement;
|
|
151
|
+
toolbarSlot: HTMLDivElement;
|
|
152
|
+
body: HTMLDivElement;
|
|
153
|
+
};
|
|
154
|
+
private activityLayer;
|
|
155
|
+
/**
|
|
156
|
+
* An AI assistant's presence on the pages: `work([4, 5])` shimmers the paragraphs it is
|
|
157
|
+
* changing (with its caret), `reveal(before)` animates what changed. Created on first use.
|
|
158
|
+
*/
|
|
159
|
+
get activity(): AiActivity;
|
|
160
|
+
/** The formatting toolbar: `show()`, `hide()`, `collapsed`. Shown when the `toolbar` option is set. */
|
|
161
|
+
get toolbar(): ToolbarController;
|
|
162
|
+
/** The comment column: `show()`, `hide()`, `mode`, `open(id)`, `compose()`, `width`. */
|
|
163
|
+
get comments(): CommentsController;
|
|
164
|
+
/** The right-click menu: `enable()`, `disable()`, `open(x, y)`, `close()`. Enabled by the `contextMenu` option. */
|
|
165
|
+
get contextMenu(): ContextMenuController;
|
|
166
|
+
/** The element the viewer was created in (where chrome such as the menu is placed). @internal */
|
|
167
|
+
get container(): HTMLElement;
|
|
168
|
+
/** A picture as a blob a browser shows (for copying it). Undefined for external or unreadable images. @internal */
|
|
169
|
+
imageBlob(image: {
|
|
170
|
+
target: string | undefined;
|
|
171
|
+
external: boolean;
|
|
172
|
+
}): Promise<Blob | undefined>;
|
|
94
173
|
/** In-page editing (present when the viewer was created with `editable`). */
|
|
95
174
|
get editing(): InlineEditing | undefined;
|
|
96
175
|
/** Turn typing on the pages on or off. */
|
|
@@ -125,13 +204,17 @@ export declare class DocxViewer {
|
|
|
125
204
|
private linkElement;
|
|
126
205
|
/** Follow a link the way a click does: emit `linkclick`, then open it or jump to the bookmark. */
|
|
127
206
|
followLink(target: LinkTarget): void;
|
|
128
|
-
private renderComments;
|
|
129
|
-
private commentBody;
|
|
130
207
|
scrollToPage(index: number, y?: number): void;
|
|
131
208
|
/** Scroll to a bookmark. Returns false when the bookmark does not exist. */
|
|
132
209
|
scrollToAnchor(name: string): boolean;
|
|
133
|
-
/**
|
|
134
|
-
|
|
210
|
+
/**
|
|
211
|
+
* The navigation panel: `show()`, `hide()`, `collapsed`, `tab`. It also lists the headings,
|
|
212
|
+
* bookmarks and hyperlinks of the current layout (`headings`, `bookmarks`, `links`), each in
|
|
213
|
+
* document order.
|
|
214
|
+
*/
|
|
215
|
+
get navigation(): NavigationController;
|
|
216
|
+
/** The navigation targets of the current layout, collected once per layout. @internal */
|
|
217
|
+
collectedTargets(): NavTargets;
|
|
135
218
|
/** The location at the top of the viewport. */
|
|
136
219
|
get location(): DocLocation;
|
|
137
220
|
/**
|
|
@@ -165,6 +248,16 @@ export declare class DocxViewer {
|
|
|
165
248
|
end: InlinePosition;
|
|
166
249
|
} | undefined;
|
|
167
250
|
private onSelectionChange;
|
|
251
|
+
private selectionTimer;
|
|
252
|
+
private lastSelectionKey;
|
|
253
|
+
/** @internal The caret or the selection moved: tell `selectioninfo` listeners (batched, when it changed). */
|
|
254
|
+
selectionMoved(): void;
|
|
255
|
+
/**
|
|
256
|
+
* What the user has selected, or where the caret is: paragraph numbers (as docxkeun-mcp's
|
|
257
|
+
* read_document numbers them), offsets, pages and text. The editing caret when typing is on,
|
|
258
|
+
* otherwise the browser's text selection on the pages. `describeSelection` turns it into a prompt.
|
|
259
|
+
*/
|
|
260
|
+
selectionInfo(): SelectionInfo | undefined;
|
|
168
261
|
destroy(): void;
|
|
169
262
|
}
|
|
170
263
|
export {};
|