@betteroffice/docx 0.0.1 → 0.0.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 +19 -0
- package/dist/chunk-AEQOEQJ7.mjs +57 -0
- package/dist/chunk-AZ52IWB6.mjs +16 -0
- package/dist/{chunk-SINEY6ZF.mjs → chunk-B4IR6YP4.mjs} +1 -1
- package/dist/chunk-GGEGIQRK.mjs +1 -0
- package/dist/chunk-IFT6DUJX.mjs +1 -0
- package/dist/chunk-J7LNO6SM.mjs +1 -0
- package/dist/{chunk-H3JCIGWK.mjs → chunk-NJHOPXZW.mjs} +1 -1
- package/dist/{chunk-KXNZFTTK.mjs → chunk-WBH3SXI6.mjs} +1 -1
- package/dist/chunk-WON6K4FY.mjs +1 -0
- package/dist/chunk-Y7RUNRU2.mjs +1 -0
- package/dist/collaboration/index.d.mts +65 -0
- package/dist/collaboration/index.mjs +1 -0
- package/dist/{content-sSHuWw49.d.mts → content-MOZ6hKP4.d.mts} +357 -357
- package/dist/core.d.mts +148 -341
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-p-ijSzdh.d.mts → displayListQueries-BJlo7Jkz.d.mts} +24 -6
- package/dist/docx/index.d.mts +40 -520
- package/dist/docx/index.mjs +2 -2
- package/dist/editor/index.d.mts +36 -151
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-Bx6DK6-2.d.mts → fontLoader-aSewHMKF.d.mts} +65 -63
- package/dist/{formatting-DoL7KBSL.d.mts → formatting-D1EPSaJP.d.mts} +1 -1
- package/dist/{rustDisplayList-dqunvwxH.d.mts → frameDelta-D965X8yK.d.mts} +3 -274
- package/dist/generated/edit/docx_edit_bg.wasm +0 -0
- package/dist/generated/layout/docx_layout_bg.wasm +0 -0
- package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
- package/dist/generated/parse/docx_parse_bg.wasm +0 -0
- package/dist/index-Dx4Z3lkz.d.mts +1010 -0
- package/dist/layout/index.d.mts +19 -240
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +10 -58
- package/dist/layout/pagination/index.mjs +1 -1
- package/dist/layout/render/index.d.mts +11 -11
- package/dist/layout/render/index.mjs +1 -1
- package/dist/plugin-api/RenderedDomContext.d.mts +9 -9
- package/dist/plugin-api/index.d.mts +191 -6
- package/dist/plugin-api/resolveItemPositions.d.mts +4 -5
- package/dist/rustDisplayList-BRuZBqdL.d.mts +278 -0
- package/dist/rustMeasureSource-D1KsQvVC.d.mts +106 -0
- package/dist/selectiveSave-CVoajSKE.d.mts +56 -0
- package/dist/styles/index.d.mts +4 -39
- package/dist/styles/index.mjs +1 -1
- package/dist/{styles-VxNcXLdi.d.mts → styles-Dn_o3Vo5.d.mts} +2 -2
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +40 -14
- package/dist/{types-DNrYr6yQ.d.mts → types-BfqUl2h_.d.mts} +3 -71
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +110 -576
- package/dist/utils/index.mjs +1 -84
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/utils/units.d.mts +33 -2
- package/dist/wasm-DO3BUV7C.mjs +1 -0
- package/dist/wasm-NWXX4H5G.mjs +1 -0
- package/dist/wasm-edit.d.mts +14 -5
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.d.mts +10 -1
- package/dist/wasm-layout.mjs +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +6 -881
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +16 -139
- package/dist/Subscribable-DOz6Ohoo.d.mts +0 -33
- package/dist/agent/index.d.mts +0 -531
- package/dist/agent/index.mjs +0 -1
- package/dist/chunk-34K66SY4.mjs +0 -1
- package/dist/chunk-4RCISPPE.mjs +0 -1
- package/dist/chunk-52GB3Y42.mjs +0 -1
- package/dist/chunk-6NEKRDXF.mjs +0 -1
- package/dist/chunk-6PW4CWUG.mjs +0 -1
- package/dist/chunk-7DEIW7FL.mjs +0 -1
- package/dist/chunk-7PCO5I2O.mjs +0 -1
- package/dist/chunk-BI3B33LI.mjs +0 -1
- package/dist/chunk-BIQWVK5P.mjs +0 -2
- package/dist/chunk-CIRN3LZA.mjs +0 -1
- package/dist/chunk-DXKG3HQ5.mjs +0 -16
- package/dist/chunk-FPZBTOD6.mjs +0 -1
- package/dist/chunk-FZIA7OFY.mjs +0 -1
- package/dist/chunk-GWKJ2Y4Y.mjs +0 -1
- package/dist/chunk-HJGAQIU7.mjs +0 -2
- package/dist/chunk-I6KKMUUC.mjs +0 -1
- package/dist/chunk-IL5JZJT7.mjs +0 -1
- package/dist/chunk-JY6ILTNS.mjs +0 -1
- package/dist/chunk-KEE52TT5.mjs +0 -1
- package/dist/chunk-KVKLLTDP.mjs +0 -58
- package/dist/chunk-L5ISVQ3W.mjs +0 -1
- package/dist/chunk-LDUWIM7M.mjs +0 -1
- package/dist/chunk-N5Q3YN64.mjs +0 -1
- package/dist/chunk-NEWOMDTX.mjs +0 -1
- package/dist/chunk-O2QSE2I7.mjs +0 -1
- package/dist/chunk-OJOHXQNQ.mjs +0 -1
- package/dist/chunk-OMR3TWCD.mjs +0 -2
- package/dist/chunk-P3KDV4M2.mjs +0 -1
- package/dist/chunk-Q7PO7V73.mjs +0 -1
- package/dist/chunk-QOUFE3VX.mjs +0 -1
- package/dist/chunk-TYHI7RAD.mjs +0 -1
- package/dist/chunk-UIEJWORW.mjs +0 -1
- package/dist/chunk-VAOUFAUH.mjs +0 -1
- package/dist/chunk-VBOTMRXV.mjs +0 -1
- package/dist/chunk-VCER63GQ.mjs +0 -1
- package/dist/chunk-WAUF2UC7.mjs +0 -2
- package/dist/chunk-X4XDO3LZ.mjs +0 -1
- package/dist/chunk-XQBCCJBO.mjs +0 -9
- package/dist/chunk-XWUOLYRQ.mjs +0 -2
- package/dist/chunk-XYH6XWP3.mjs +0 -10
- package/dist/chunk-YBIM6UJV.mjs +0 -8
- package/dist/chunk-YCIH2Q3E.mjs +0 -1
- package/dist/chunk-ZOV5KL7C.mjs +0 -1
- package/dist/colorResolver-n0o7H7ep.d.mts +0 -290
- package/dist/core-plugins.d.mts +0 -37
- package/dist/core-plugins.mjs +0 -1
- package/dist/docx/parser.d.mts +0 -41
- package/dist/docx/parser.mjs +0 -1
- package/dist/docx/rezip.d.mts +0 -148
- package/dist/docx/rezip.mjs +0 -1
- package/dist/docx/serializer/index.d.mts +0 -42
- package/dist/docx/serializer/index.mjs +0 -1
- package/dist/editorTree-DO5PyDK8.d.mts +0 -37
- package/dist/executor-7O2RBJ2B.mjs +0 -1
- package/dist/headerFooterLayout-0zPT64Qc.d.mts +0 -316
- package/dist/headless.d.mts +0 -69
- package/dist/headless.mjs +0 -1
- package/dist/layout/flow/index.d.mts +0 -149
- package/dist/layout/flow/index.mjs +0 -1
- package/dist/layout/measure/index.d.mts +0 -324
- package/dist/layout/measure/index.mjs +0 -1
- package/dist/layout/pagination/types.d.mts +0 -4
- package/dist/layout/pagination/types.mjs +0 -1
- package/dist/managers/AutoSaveManager.d.mts +0 -81
- package/dist/managers/AutoSaveManager.mjs +0 -1
- package/dist/managers/TableSelectionManager.d.mts +0 -74
- package/dist/managers/TableSelectionManager.mjs +0 -1
- package/dist/managers/types.d.mts +0 -113
- package/dist/managers/types.mjs +0 -0
- package/dist/mcp-cli.mjs +0 -142
- package/dist/mcp.d.mts +0 -162
- package/dist/mcp.mjs +0 -16
- package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +0 -109
- package/dist/measuredBlock-DZwz8zhD.d.mts +0 -26
- package/dist/plugin-api/types.d.mts +0 -193
- package/dist/plugin-api/types.mjs +0 -0
- package/dist/processTemplate-HDUIZFJ5.mjs +0 -1
- package/dist/registry-DMM5VTdT.d.mts +0 -165
- package/dist/rustPagination-Bj2hq013.d.mts +0 -106
- package/dist/sectionConfigs-DW3J8q0X.d.mts +0 -55
- package/dist/selectionContext-Buc9BCU1.d.mts +0 -570
- package/dist/selectiveSave-oFBJ1n71.d.mts +0 -16
- package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +0 -23
- package/dist/settingsParser-CcGvtmCK.d.mts +0 -33
- package/dist/types/agentApi.d.mts +0 -456
- package/dist/types/agentApi.mjs +0 -1
- package/dist/types-dYdjUZMo.d.mts +0 -311
- package/dist/units-O5Y02RKQ.d.mts +0 -34
- package/dist/utils/headingCollector.d.mts +0 -28
- package/dist/utils/headingCollector.mjs +0 -1
- package/dist/utils/highlightColors.d.mts +0 -14
- package/dist/utils/highlightColors.mjs +0 -1
- package/dist/utils/textSelection.d.mts +0 -92
- package/dist/utils/textSelection.mjs +0 -1
- package/dist/variableDetector-Borj29SF.d.mts +0 -115
- package/dist/wasm-FZQ5XB2Y.mjs +0 -1
- package/dist/wasm-SA237OSP.mjs +0 -1
- package/dist/watermarkApi-DCxjutkg.d.mts +0 -38
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,155 +1,13 @@
|
|
|
1
|
-
export { TWIPS_PER_INCH, clamp, eighthsToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToTwips, pointsToHalfPoints, roundPixels, twipsToEmu, twipsToPixels } from './units.mjs';
|
|
2
|
-
export {
|
|
3
|
-
import { a as Theme, B as BorderSpec, P as ParagraphFormatting, S as ShadingProperties, T as TextFormatting } from '../formatting-DoL7KBSL.mjs';
|
|
4
|
-
export { G as ThemeMatrixCell, b as blendColors, d as darkenColor, H as generateThemeTintShadeMatrix, g as getContrastingColor, I as getThemeTintShadeHex, l as lightenColor, r as resolveColor, J as resolveColorToHex } from '../formatting-DoL7KBSL.mjs';
|
|
5
|
-
import { R as Run, P as Paragraph, C as Comment } from '../content-sSHuWw49.mjs';
|
|
1
|
+
export { PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels } from './units.mjs';
|
|
2
|
+
export { F as FONT_MAPPING, v as FontDefinition, c as canRenderFont, a as colorsEqual, b as createRgbColor, d as createThemeColor, e as ensureHexPrefix, w as extractFontsFromDocument, x as getGoogleFontEquivalent, g as getLoadedFonts, i as isBlack, f as isFontLoaded, j as isGoogleFontsEnabled, h as isLoading, k as isWhite, y as loadDocumentFonts, l as loadFont, z as loadFontDefinitions, m as loadFontFromBuffer, A as loadFontFromUrl, B as loadFontWithMapping, n as loadFonts, C as loadFontsWithMapping, D as onFontError, o as onFontsLoaded, p as parseColorString, q as preloadCommonFonts, r as resolveHighlightColor, s as resolveHighlightToCss, t as resolveShadingColor, u as setGoogleFontsEnabled } from '../fontLoader-aSewHMKF.mjs';
|
|
6
3
|
export { D as DocxInput, t as toArrayBuffer } from '../docxInput-DTbCa48g.mjs';
|
|
7
|
-
|
|
8
|
-
import { F as FontTable } from '../styles-VxNcXLdi.mjs';
|
|
4
|
+
import { F as FontTable } from '../styles-Dn_o3Vo5.mjs';
|
|
9
5
|
import { Document } from '../types/document.mjs';
|
|
10
6
|
import { FontOption } from './fontOptions.mjs';
|
|
11
|
-
export { HeadingInfo, collectHeadings } from './headingCollector.mjs';
|
|
12
|
-
export { WordSelectionResult, createDoubleClickWordSelector, createTripleClickParagraphSelector, expandSelectionToWordBoundaries, findWordAt, findWordBoundaries, getWordAt, handleClickForMultiClick, selectParagraphAtCursor, selectWordAtCursor, selectWordInTextNode } from './textSelection.mjs';
|
|
13
7
|
export { MIN_CARD_GAP, SIDEBAR_DOCUMENT_SHIFT, SIDEBAR_PAGE_GAP, SIDEBAR_WIDTH } from './sidebarConstants.mjs';
|
|
14
|
-
|
|
8
|
+
import { g as Comment } from '../content-MOZ6hKP4.mjs';
|
|
9
|
+
export { x as ThemeMatrixCell, y as blendColors, z as darkenColor, A as generateThemeTintShadeMatrix, D as getContrastingColor, G as getThemeTintShadeHex, H as lightenColor, I as resolveColor, J as resolveColorToHex } from '../formatting-D1EPSaJP.mjs';
|
|
15
10
|
import '../docx/wrapTypes.mjs';
|
|
16
|
-
import '../settingsParser-CcGvtmCK.mjs';
|
|
17
|
-
import '../editorTree-DO5PyDK8.mjs';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Clipboard utilities for copy/paste with formatting
|
|
21
|
-
*
|
|
22
|
-
* Handles:
|
|
23
|
-
* - Copy: puts formatted HTML and plain text on clipboard
|
|
24
|
-
* - Paste: reads HTML clipboard, converts to runs with formatting
|
|
25
|
-
* - Handles paste from Word (cleans up Word HTML)
|
|
26
|
-
* - Ctrl+C, Ctrl+V, Ctrl+X keyboard shortcuts
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Clipboard content format
|
|
31
|
-
*/
|
|
32
|
-
interface ClipboardContent {
|
|
33
|
-
/** Plain text representation */
|
|
34
|
-
plainText: string;
|
|
35
|
-
/** HTML representation */
|
|
36
|
-
html: string;
|
|
37
|
-
/** Internal format (JSON) for preserving full formatting */
|
|
38
|
-
internal?: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Parsed clipboard content
|
|
42
|
-
*/
|
|
43
|
-
interface ParsedClipboardContent {
|
|
44
|
-
/** Runs parsed from clipboard */
|
|
45
|
-
runs: Run[];
|
|
46
|
-
/** Whether content came from Word */
|
|
47
|
-
fromWord: boolean;
|
|
48
|
-
/** Whether content came from our editor */
|
|
49
|
-
fromEditor: boolean;
|
|
50
|
-
/** Original plain text */
|
|
51
|
-
plainText: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Options for clipboard operations
|
|
55
|
-
*/
|
|
56
|
-
interface ClipboardOptions {
|
|
57
|
-
/** Whether to include formatting in copy */
|
|
58
|
-
includeFormatting?: boolean;
|
|
59
|
-
/** Whether to clean Word-specific formatting */
|
|
60
|
-
cleanWordFormatting?: boolean;
|
|
61
|
-
/** Callback for handling errors */
|
|
62
|
-
onError?: (error: Error) => void;
|
|
63
|
-
/** Document theme — required to resolve themed text/shading colors in HTML. */
|
|
64
|
-
theme?: Theme | null;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Custom MIME type for internal clipboard format
|
|
68
|
-
*/
|
|
69
|
-
declare const INTERNAL_CLIPBOARD_TYPE = "application/x-docx-editor";
|
|
70
|
-
/**
|
|
71
|
-
* Standard clipboard MIME types
|
|
72
|
-
*/
|
|
73
|
-
declare const CLIPBOARD_TYPES: {
|
|
74
|
-
readonly HTML: "text/html";
|
|
75
|
-
readonly PLAIN: "text/plain";
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Extract image files from clipboard data (if present).
|
|
79
|
-
*/
|
|
80
|
-
declare function getClipboardImageFiles(clipboardData: DataTransfer | null): File[];
|
|
81
|
-
/**
|
|
82
|
-
* Copy runs to clipboard with formatting
|
|
83
|
-
*/
|
|
84
|
-
declare function copyRuns(runs: Run[], options?: ClipboardOptions): Promise<boolean>;
|
|
85
|
-
/**
|
|
86
|
-
* Copy paragraphs to clipboard with formatting
|
|
87
|
-
*/
|
|
88
|
-
declare function copyParagraphs(paragraphs: Paragraph[], options?: ClipboardOptions): Promise<boolean>;
|
|
89
|
-
/**
|
|
90
|
-
* Convert runs to clipboard content (HTML and plain text).
|
|
91
|
-
*
|
|
92
|
-
* @param theme - Optional document theme. Pass it so themed text color and
|
|
93
|
-
* shading resolve correctly in the HTML payload (matters when pasting into
|
|
94
|
-
* Gmail/Word/etc.). Omit for rgb-only content.
|
|
95
|
-
*/
|
|
96
|
-
declare function runsToClipboardContent(runs: Run[], includeFormatting?: boolean, theme?: Theme | null): ClipboardContent;
|
|
97
|
-
/**
|
|
98
|
-
* Convert paragraphs to clipboard content.
|
|
99
|
-
*
|
|
100
|
-
* @param theme - See {@link runsToClipboardContent}.
|
|
101
|
-
*/
|
|
102
|
-
declare function paragraphsToClipboardContent(paragraphs: Paragraph[], includeFormatting?: boolean, theme?: Theme | null): ClipboardContent;
|
|
103
|
-
/**
|
|
104
|
-
* Write content to clipboard
|
|
105
|
-
*/
|
|
106
|
-
declare function writeToClipboard(content: ClipboardContent): Promise<boolean>;
|
|
107
|
-
/**
|
|
108
|
-
* Read content from clipboard
|
|
109
|
-
*/
|
|
110
|
-
declare function readFromClipboard(options?: ClipboardOptions): Promise<ParsedClipboardContent | null>;
|
|
111
|
-
/**
|
|
112
|
-
* Handle paste event
|
|
113
|
-
*/
|
|
114
|
-
declare function handlePasteEvent(event: ClipboardEvent, options?: ClipboardOptions): ParsedClipboardContent | null;
|
|
115
|
-
/**
|
|
116
|
-
* Parse HTML from clipboard
|
|
117
|
-
*/
|
|
118
|
-
declare function parseClipboardHtml(html: string, plainText: string, cleanWordFormatting?: boolean): ParsedClipboardContent;
|
|
119
|
-
/**
|
|
120
|
-
* Check if HTML is from Microsoft Word
|
|
121
|
-
*/
|
|
122
|
-
declare function isWordHtml(html: string): boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Check if HTML is from our editor
|
|
125
|
-
*/
|
|
126
|
-
declare function isEditorHtml(html: string): boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Clean Microsoft Word HTML
|
|
129
|
-
*/
|
|
130
|
-
declare function cleanWordHtml(html: string): string;
|
|
131
|
-
/**
|
|
132
|
-
* Convert HTML to runs
|
|
133
|
-
*/
|
|
134
|
-
declare function htmlToRuns(html: string, plainTextFallback: string): Run[];
|
|
135
|
-
/**
|
|
136
|
-
* Create clipboard keyboard handlers for an editor
|
|
137
|
-
*/
|
|
138
|
-
declare function createClipboardHandlers(options: {
|
|
139
|
-
onCopy?: () => {
|
|
140
|
-
runs: Run[];
|
|
141
|
-
} | null;
|
|
142
|
-
onCut?: () => {
|
|
143
|
-
runs: Run[];
|
|
144
|
-
} | null;
|
|
145
|
-
onPaste?: (content: ParsedClipboardContent) => void;
|
|
146
|
-
clipboardOptions?: ClipboardOptions;
|
|
147
|
-
}): {
|
|
148
|
-
handleCopy: (event: ClipboardEvent) => Promise<void>;
|
|
149
|
-
handleCut: (event: ClipboardEvent) => Promise<void>;
|
|
150
|
-
handlePaste: (event: ClipboardEvent) => void;
|
|
151
|
-
handleKeyDown: (event: KeyboardEvent) => Promise<void>;
|
|
152
|
-
};
|
|
153
11
|
|
|
154
12
|
/**
|
|
155
13
|
* Embedded font de-obfuscation (ECMA-376 Part 4 §2.8.1, "Font Embedding").
|
|
@@ -293,450 +151,65 @@ declare function getRenderableDocumentFonts(doc: Document, options?: RenderableF
|
|
|
293
151
|
declare function excludeFontsByName(fonts: readonly FontOption[] | undefined, existingNames: Iterable<string>): FontOption[];
|
|
294
152
|
|
|
295
153
|
/**
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
* Converts OOXML formatting objects (TextFormatting, ParagraphFormatting)
|
|
299
|
-
* to React CSSProperties for rendering.
|
|
300
|
-
*
|
|
301
|
-
* Handles ALL formatting properties:
|
|
302
|
-
* - Font: family, size, weight, style
|
|
303
|
-
* - Text: color, background, decoration (underline, strike, double-strike)
|
|
304
|
-
* - Effects: superscript, subscript, small-caps, all-caps
|
|
305
|
-
* - Spacing: letter-spacing
|
|
306
|
-
* - Paragraph: alignment, line-height, margins, padding, borders, background
|
|
307
|
-
*/
|
|
308
|
-
/** Framework-agnostic CSS properties type (compatible with React.CSSProperties) */
|
|
309
|
-
type CSSProperties$1 = Record<string, any>;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Convert TextFormatting to CSS properties for a run/span
|
|
313
|
-
*
|
|
314
|
-
* @param formatting - Text formatting from OOXML
|
|
315
|
-
* @param theme - Theme for resolving colors and fonts
|
|
316
|
-
* @returns React CSSProperties
|
|
317
|
-
*/
|
|
318
|
-
declare function textToStyle(formatting: TextFormatting | undefined | null, theme?: Theme | null): CSSProperties$1;
|
|
319
|
-
/**
|
|
320
|
-
* Convert ParagraphFormatting to CSS properties
|
|
321
|
-
*
|
|
322
|
-
* @param formatting - Paragraph formatting from OOXML
|
|
323
|
-
* @param theme - Theme for resolving colors
|
|
324
|
-
* @returns React CSSProperties
|
|
325
|
-
*/
|
|
326
|
-
declare function paragraphToStyle(formatting: ParagraphFormatting | undefined | null, theme?: Theme | null): CSSProperties$1;
|
|
327
|
-
/**
|
|
328
|
-
* Convert a BorderSpec to CSS border properties
|
|
329
|
-
*
|
|
330
|
-
* @param border - Border specification
|
|
331
|
-
* @param side - 'Top' | 'Bottom' | 'Left' | 'Right' | '' for all
|
|
332
|
-
* @param theme - Theme for color resolution
|
|
333
|
-
* @returns Partial CSSProperties with border styles
|
|
334
|
-
*/
|
|
335
|
-
declare function borderToStyle(border: BorderSpec | undefined | null, side?: 'Top' | 'Bottom' | 'Left' | 'Right' | '', theme?: Theme | null): CSSProperties$1;
|
|
336
|
-
/**
|
|
337
|
-
* Convert ShadingProperties to background color
|
|
338
|
-
*
|
|
339
|
-
* @param shading - Shading properties
|
|
340
|
-
* @param theme - Theme for color resolution
|
|
341
|
-
* @returns CSS color string or empty string
|
|
342
|
-
*/
|
|
343
|
-
declare function resolveShadingFill(shading: ShadingProperties | undefined | null, theme?: Theme | null): string;
|
|
344
|
-
/**
|
|
345
|
-
* Merge multiple CSSProperties objects
|
|
346
|
-
*
|
|
347
|
-
* Later objects override earlier ones for conflicting properties.
|
|
348
|
-
*
|
|
349
|
-
* @param styles - Array of CSSProperties objects
|
|
350
|
-
* @returns Merged CSSProperties
|
|
351
|
-
*/
|
|
352
|
-
declare function mergeStyles(...styles: (CSSProperties$1 | undefined | null)[]): CSSProperties$1;
|
|
353
|
-
/**
|
|
354
|
-
* Get CSS for a table cell based on formatting
|
|
355
|
-
*
|
|
356
|
-
* @param formatting - Table cell formatting
|
|
357
|
-
* @param theme - Theme for color resolution
|
|
358
|
-
* @returns CSSProperties for the cell
|
|
154
|
+
* Structural mark contract consumed by the legacy tree-to-layout adapter.
|
|
155
|
+
* @public
|
|
359
156
|
*/
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
shading?: ShadingProperties;
|
|
364
|
-
borders?: {
|
|
365
|
-
top?: BorderSpec;
|
|
366
|
-
bottom?: BorderSpec;
|
|
367
|
-
left?: BorderSpec;
|
|
368
|
-
right?: BorderSpec;
|
|
369
|
-
};
|
|
370
|
-
margins?: {
|
|
371
|
-
top?: {
|
|
372
|
-
value: number;
|
|
373
|
-
type: string;
|
|
374
|
-
};
|
|
375
|
-
bottom?: {
|
|
376
|
-
value: number;
|
|
377
|
-
type: string;
|
|
378
|
-
};
|
|
379
|
-
left?: {
|
|
380
|
-
value: number;
|
|
381
|
-
type: string;
|
|
382
|
-
};
|
|
383
|
-
right?: {
|
|
384
|
-
value: number;
|
|
385
|
-
type: string;
|
|
386
|
-
};
|
|
157
|
+
interface EditorTreeMark {
|
|
158
|
+
readonly type: {
|
|
159
|
+
readonly name: string;
|
|
387
160
|
};
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Get CSS for page/section container
|
|
391
|
-
*
|
|
392
|
-
* @param sectionProps - Section properties
|
|
393
|
-
* @returns CSSProperties for the page container
|
|
394
|
-
*/
|
|
395
|
-
declare function sectionToStyle(sectionProps: {
|
|
396
|
-
pageWidth?: number;
|
|
397
|
-
pageHeight?: number;
|
|
398
|
-
marginTop?: number;
|
|
399
|
-
marginBottom?: number;
|
|
400
|
-
marginLeft?: number;
|
|
401
|
-
marginRight?: number;
|
|
402
|
-
background?: {
|
|
403
|
-
color?: {
|
|
404
|
-
rgb?: string;
|
|
405
|
-
themeColor?: string;
|
|
406
|
-
};
|
|
407
|
-
};
|
|
408
|
-
} | undefined | null, theme?: Theme | null): CSSProperties$1;
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Keyboard Navigation Utilities
|
|
412
|
-
*
|
|
413
|
-
* Provides enhanced keyboard navigation for the editor:
|
|
414
|
-
* - Ctrl+Left/Right: Move by word
|
|
415
|
-
* - Home/End: Move to start/end of line
|
|
416
|
-
* - Ctrl+Home/End: Move to start/end of document
|
|
417
|
-
* - Ctrl+Shift+Left/Right: Select by word
|
|
418
|
-
* - Shift+Home/End: Select to start/end of line
|
|
419
|
-
*/
|
|
420
|
-
/**
|
|
421
|
-
* Navigation direction
|
|
422
|
-
*/
|
|
423
|
-
type NavigationDirection = 'left' | 'right' | 'up' | 'down';
|
|
424
|
-
/**
|
|
425
|
-
* Navigation unit
|
|
426
|
-
*/
|
|
427
|
-
type NavigationUnit = 'character' | 'word' | 'line' | 'paragraph' | 'document';
|
|
428
|
-
/**
|
|
429
|
-
* Keyboard navigation action
|
|
430
|
-
*/
|
|
431
|
-
interface NavigationAction {
|
|
432
|
-
/** Direction to navigate */
|
|
433
|
-
direction: NavigationDirection;
|
|
434
|
-
/** Unit of movement */
|
|
435
|
-
unit: NavigationUnit;
|
|
436
|
-
/** Whether to extend selection */
|
|
437
|
-
extend: boolean;
|
|
161
|
+
readonly attrs: Record<string, any>;
|
|
438
162
|
}
|
|
439
163
|
/**
|
|
440
|
-
*
|
|
441
|
-
*/
|
|
442
|
-
interface KeyboardShortcut {
|
|
443
|
-
key: string;
|
|
444
|
-
ctrlKey?: boolean;
|
|
445
|
-
metaKey?: boolean;
|
|
446
|
-
shiftKey?: boolean;
|
|
447
|
-
altKey?: boolean;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Check if a character is a word character (letter, digit, or underscore)
|
|
451
|
-
*/
|
|
452
|
-
declare function isWordCharacter(char: string): boolean;
|
|
453
|
-
/**
|
|
454
|
-
* Check if a character is whitespace
|
|
455
|
-
*/
|
|
456
|
-
declare function isWhitespace(char: string): boolean;
|
|
457
|
-
/**
|
|
458
|
-
* Check if a character is a punctuation character
|
|
459
|
-
*/
|
|
460
|
-
declare function isPunctuation(char: string): boolean;
|
|
461
|
-
/**
|
|
462
|
-
* Find the start of the current or previous word
|
|
463
|
-
*/
|
|
464
|
-
declare function findWordStart(text: string, position: number): number;
|
|
465
|
-
/**
|
|
466
|
-
* Find the end of the current or next word
|
|
467
|
-
*/
|
|
468
|
-
declare function findWordEnd(text: string, position: number): number;
|
|
469
|
-
/**
|
|
470
|
-
* Find the next word start (for Ctrl+Right navigation)
|
|
471
|
-
*/
|
|
472
|
-
declare function findNextWordStart(text: string, position: number): number;
|
|
473
|
-
/**
|
|
474
|
-
* Find the previous word start (for Ctrl+Left navigation)
|
|
475
|
-
*/
|
|
476
|
-
declare function findPreviousWordStart(text: string, position: number): number;
|
|
477
|
-
/**
|
|
478
|
-
* Find the start of the current line in a text node
|
|
479
|
-
* Uses visual line detection based on bounding rectangles
|
|
480
|
-
*/
|
|
481
|
-
declare function findVisualLineStart(container: Node, offset: number): {
|
|
482
|
-
node: Node;
|
|
483
|
-
offset: number;
|
|
484
|
-
} | null;
|
|
485
|
-
/**
|
|
486
|
-
* Find the end of the current line in a text node
|
|
487
|
-
* Uses visual line detection based on bounding rectangles
|
|
488
|
-
*/
|
|
489
|
-
declare function findVisualLineEnd(container: Node, offset: number): {
|
|
490
|
-
node: Node;
|
|
491
|
-
offset: number;
|
|
492
|
-
} | null;
|
|
493
|
-
/**
|
|
494
|
-
* Get the current selection info
|
|
495
|
-
*/
|
|
496
|
-
declare function getSelectionInfo(): {
|
|
497
|
-
node: Node;
|
|
498
|
-
offset: number;
|
|
499
|
-
anchorNode: Node | null;
|
|
500
|
-
anchorOffset: number;
|
|
501
|
-
focusNode: Node | null;
|
|
502
|
-
focusOffset: number;
|
|
503
|
-
isCollapsed: boolean;
|
|
504
|
-
text: string;
|
|
505
|
-
} | null;
|
|
506
|
-
/**
|
|
507
|
-
* Set the selection to a specific position
|
|
508
|
-
*/
|
|
509
|
-
declare function setSelectionPosition(node: Node, offset: number): void;
|
|
510
|
-
/**
|
|
511
|
-
* Extend selection to a specific position
|
|
512
|
-
*/
|
|
513
|
-
declare function extendSelectionTo(node: Node, offset: number): void;
|
|
514
|
-
/**
|
|
515
|
-
* Move selection by word in a text node
|
|
516
|
-
*/
|
|
517
|
-
declare function moveByWord(direction: 'left' | 'right', extend?: boolean): boolean;
|
|
518
|
-
/**
|
|
519
|
-
* Move to start/end of line
|
|
520
|
-
*/
|
|
521
|
-
declare function moveToLineEdge(edge: 'start' | 'end', extend?: boolean): boolean;
|
|
522
|
-
/**
|
|
523
|
-
* Parse a keyboard event into a navigation action
|
|
524
|
-
*/
|
|
525
|
-
declare function parseNavigationAction(event: KeyboardEvent): NavigationAction | null;
|
|
526
|
-
/**
|
|
527
|
-
* Handle a keyboard navigation event
|
|
528
|
-
* Returns true if the event was handled
|
|
529
|
-
*/
|
|
530
|
-
declare function handleNavigationKey(event: KeyboardEvent, options?: {
|
|
531
|
-
onDocumentStart?: () => void;
|
|
532
|
-
onDocumentEnd?: () => void;
|
|
533
|
-
}): boolean;
|
|
534
|
-
/**
|
|
535
|
-
* Check if an event is a navigation key event
|
|
536
|
-
*/
|
|
537
|
-
declare function isNavigationKey(event: KeyboardEvent): boolean;
|
|
538
|
-
/**
|
|
539
|
-
* Expand selection to word boundaries
|
|
540
|
-
* Used for double-click word selection
|
|
541
|
-
*/
|
|
542
|
-
declare function expandSelectionToWord(): boolean;
|
|
543
|
-
/**
|
|
544
|
-
* Get the word at the current cursor position
|
|
545
|
-
*/
|
|
546
|
-
declare function getWordAtCursor(): string | null;
|
|
547
|
-
/**
|
|
548
|
-
* Check if a keyboard event matches a shortcut definition
|
|
549
|
-
*/
|
|
550
|
-
declare function matchesShortcut(event: KeyboardEvent, shortcut: KeyboardShortcut): boolean;
|
|
551
|
-
/**
|
|
552
|
-
* Common navigation shortcuts
|
|
553
|
-
*/
|
|
554
|
-
declare const NAVIGATION_SHORTCUTS: {
|
|
555
|
-
readonly wordLeft: KeyboardShortcut;
|
|
556
|
-
readonly wordRight: KeyboardShortcut;
|
|
557
|
-
readonly selectWordLeft: KeyboardShortcut;
|
|
558
|
-
readonly selectWordRight: KeyboardShortcut;
|
|
559
|
-
readonly lineStart: KeyboardShortcut;
|
|
560
|
-
readonly lineEnd: KeyboardShortcut;
|
|
561
|
-
readonly selectToLineStart: KeyboardShortcut;
|
|
562
|
-
readonly selectToLineEnd: KeyboardShortcut;
|
|
563
|
-
readonly documentStart: KeyboardShortcut;
|
|
564
|
-
readonly documentEnd: KeyboardShortcut;
|
|
565
|
-
readonly selectToDocumentStart: KeyboardShortcut;
|
|
566
|
-
readonly selectToDocumentEnd: KeyboardShortcut;
|
|
567
|
-
};
|
|
568
|
-
/**
|
|
569
|
-
* Get a human-readable description of a shortcut
|
|
570
|
-
*/
|
|
571
|
-
declare function describeShortcut(shortcut: KeyboardShortcut): string;
|
|
572
|
-
/**
|
|
573
|
-
* Get all navigation shortcuts with descriptions
|
|
574
|
-
*/
|
|
575
|
-
declare function getNavigationShortcutDescriptions(): Array<{
|
|
576
|
-
action: string;
|
|
577
|
-
shortcut: string;
|
|
578
|
-
}>;
|
|
579
|
-
|
|
580
|
-
/**
|
|
581
|
-
* Selection Highlight Utilities
|
|
582
|
-
*
|
|
583
|
-
* Provides visual highlighting for text selection across multiple runs.
|
|
584
|
-
* Browsers handle ::selection pseudo-element differently, especially when
|
|
585
|
-
* selection spans multiple elements with different backgrounds or styling.
|
|
164
|
+
* Structural node contract consumed by renderer-side tree walkers.
|
|
586
165
|
*
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
*
|
|
590
|
-
* - Visual feedback for selection across runs
|
|
591
|
-
*/
|
|
592
|
-
/** Framework-agnostic CSS properties type (compatible with React.CSSProperties) */
|
|
593
|
-
type CSSProperties = Record<string, any>;
|
|
594
|
-
/**
|
|
595
|
-
* Highlight rectangle representing a selected region
|
|
596
|
-
*/
|
|
597
|
-
interface HighlightRect {
|
|
598
|
-
/** Left position in pixels */
|
|
599
|
-
left: number;
|
|
600
|
-
/** Top position in pixels */
|
|
601
|
-
top: number;
|
|
602
|
-
/** Width in pixels */
|
|
603
|
-
width: number;
|
|
604
|
-
/** Height in pixels */
|
|
605
|
-
height: number;
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Selection highlight configuration
|
|
609
|
-
*/
|
|
610
|
-
interface SelectionHighlightConfig {
|
|
611
|
-
/** Background color for selection */
|
|
612
|
-
backgroundColor: string;
|
|
613
|
-
/** Optional border color for selection */
|
|
614
|
-
borderColor?: string;
|
|
615
|
-
/** Optional border radius */
|
|
616
|
-
borderRadius?: number;
|
|
617
|
-
/** Z-index for overlay */
|
|
618
|
-
zIndex?: number;
|
|
619
|
-
/** Opacity for highlight */
|
|
620
|
-
opacity?: number;
|
|
621
|
-
/** Mix blend mode */
|
|
622
|
-
mixBlendMode?: CSSProperties['mixBlendMode'];
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Selection range in document coordinates
|
|
166
|
+
* The contract deliberately describes only the immutable tree operations the
|
|
167
|
+
* renderer needs, so core does not depend on any editor implementation.
|
|
168
|
+
* @public
|
|
626
169
|
*/
|
|
627
|
-
interface
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
contentIndex: number;
|
|
632
|
-
offset: number;
|
|
170
|
+
interface EditorTreeNode {
|
|
171
|
+
readonly type: {
|
|
172
|
+
readonly name: string;
|
|
173
|
+
create(...args: any[]): EditorTreeNode;
|
|
633
174
|
};
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
175
|
+
readonly attrs: Record<string, any>;
|
|
176
|
+
readonly marks: readonly EditorTreeMark[];
|
|
177
|
+
readonly nodeSize: number;
|
|
178
|
+
readonly content: {
|
|
179
|
+
readonly size: number;
|
|
639
180
|
};
|
|
181
|
+
readonly isText: boolean;
|
|
182
|
+
readonly isTextblock: boolean;
|
|
183
|
+
readonly isInline: boolean;
|
|
184
|
+
readonly text?: string | null;
|
|
185
|
+
forEach(callback: (node: EditorTreeNode, offset: number, index: number) => void): void;
|
|
186
|
+
descendants(callback: (node: EditorTreeNode, pos: number) => boolean | void): void;
|
|
640
187
|
}
|
|
188
|
+
|
|
641
189
|
/**
|
|
642
|
-
*
|
|
643
|
-
|
|
644
|
-
declare const DEFAULT_SELECTION_STYLE: SelectionHighlightConfig;
|
|
645
|
-
/**
|
|
646
|
-
* High contrast selection style
|
|
647
|
-
*/
|
|
648
|
-
declare const HIGH_CONTRAST_SELECTION_STYLE: SelectionHighlightConfig;
|
|
649
|
-
/**
|
|
650
|
-
* Selection highlight CSS custom properties
|
|
651
|
-
*/
|
|
652
|
-
declare const SELECTION_CSS_VARS: {
|
|
653
|
-
readonly backgroundColor: "--docx-selection-bg";
|
|
654
|
-
readonly borderColor: "--docx-selection-border";
|
|
655
|
-
readonly textColor: "--docx-selection-text";
|
|
656
|
-
};
|
|
657
|
-
/**
|
|
658
|
-
* Get all selection rectangles from the current DOM selection
|
|
659
|
-
*
|
|
660
|
-
* Uses getClientRects() to get accurate rectangles even when
|
|
661
|
-
* selection spans multiple inline elements.
|
|
662
|
-
*/
|
|
663
|
-
declare function getSelectionRects(containerElement?: HTMLElement | null): HighlightRect[];
|
|
664
|
-
/**
|
|
665
|
-
* Merge adjacent or overlapping rectangles
|
|
666
|
-
*
|
|
667
|
-
* This reduces the number of highlight elements needed and creates
|
|
668
|
-
* a cleaner visual appearance.
|
|
669
|
-
*/
|
|
670
|
-
declare function mergeAdjacentRects(rects: HighlightRect[], tolerance?: number): HighlightRect[];
|
|
671
|
-
/**
|
|
672
|
-
* Get selection rectangles with merging applied
|
|
673
|
-
*/
|
|
674
|
-
declare function getMergedSelectionRects(containerElement?: HTMLElement | null): HighlightRect[];
|
|
675
|
-
/**
|
|
676
|
-
* Generate CSS styles for a highlight rectangle
|
|
677
|
-
*/
|
|
678
|
-
declare function getHighlightRectStyle(rect: HighlightRect, config?: SelectionHighlightConfig): CSSProperties;
|
|
679
|
-
/**
|
|
680
|
-
* Generate inline CSS for selection pseudo-elements
|
|
681
|
-
*
|
|
682
|
-
* This is used to inject consistent selection styling
|
|
683
|
-
* across all editable elements.
|
|
684
|
-
*/
|
|
685
|
-
declare function generateSelectionCSS(selector: string, config?: SelectionHighlightConfig): string;
|
|
686
|
-
/**
|
|
687
|
-
* Check if there is an active text selection (not collapsed)
|
|
688
|
-
*/
|
|
689
|
-
declare function hasActiveSelection(): boolean;
|
|
690
|
-
/**
|
|
691
|
-
* Get the selected text
|
|
692
|
-
*/
|
|
693
|
-
declare function getSelectedText(): string;
|
|
694
|
-
/**
|
|
695
|
-
* Check if selection is within a specific element
|
|
190
|
+
* @packageDocumentation
|
|
191
|
+
* @public
|
|
696
192
|
*/
|
|
697
|
-
|
|
193
|
+
|
|
698
194
|
/**
|
|
699
|
-
*
|
|
195
|
+
* Information about a heading found in the document.
|
|
700
196
|
*/
|
|
701
|
-
|
|
197
|
+
interface HeadingInfo {
|
|
198
|
+
/** The text content of the heading */
|
|
199
|
+
text: string;
|
|
200
|
+
/** Outline level (0 = Heading 1, 1 = Heading 2, etc.) */
|
|
201
|
+
level: number;
|
|
202
|
+
/** ProseMirror document position of the paragraph node */
|
|
203
|
+
pmPos: number;
|
|
204
|
+
}
|
|
702
205
|
/**
|
|
703
|
-
*
|
|
206
|
+
* Collect all headings from a ProseMirror document.
|
|
704
207
|
*
|
|
705
|
-
*
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* Select a text range programmatically
|
|
710
|
-
*/
|
|
711
|
-
declare function selectRange(range: Range): void;
|
|
712
|
-
/**
|
|
713
|
-
* Clear the current selection
|
|
714
|
-
*/
|
|
715
|
-
declare function clearSelection(): void;
|
|
716
|
-
/**
|
|
717
|
-
* Check if selection is backwards (focus before anchor)
|
|
718
|
-
*/
|
|
719
|
-
declare function isSelectionBackwards(): boolean;
|
|
720
|
-
/**
|
|
721
|
-
* Normalize selection to always be forward (start before end)
|
|
722
|
-
*/
|
|
723
|
-
declare function normalizeSelectionDirection(): void;
|
|
724
|
-
/**
|
|
725
|
-
* Inject selection highlight CSS into document
|
|
726
|
-
*/
|
|
727
|
-
declare function injectSelectionStyles(config?: SelectionHighlightConfig): void;
|
|
728
|
-
/**
|
|
729
|
-
* Remove injected selection styles
|
|
730
|
-
*/
|
|
731
|
-
declare function removeSelectionStyles(): void;
|
|
732
|
-
/**
|
|
733
|
-
* Check if selection styles are injected
|
|
208
|
+
* Detection logic:
|
|
209
|
+
* 1. Check `outlineLevel` attr (set by OOXML parsing or style resolution)
|
|
210
|
+
* 2. Fallback to `styleId` matching /^[Hh]eading(\d)$/
|
|
734
211
|
*/
|
|
735
|
-
declare function
|
|
736
|
-
/**
|
|
737
|
-
* Create a selection change handler that updates highlight rects
|
|
738
|
-
*/
|
|
739
|
-
declare function createSelectionChangeHandler(containerElement: HTMLElement | null, onRectsChange: (rects: HighlightRect[]) => void, merge?: boolean): () => void;
|
|
212
|
+
declare function collectHeadings(doc: EditorTreeNode): HeadingInfo[];
|
|
740
213
|
|
|
741
214
|
/**
|
|
742
215
|
* Option shapes for `scrollToParaId(paraId, { highlight })`.
|
|
@@ -875,6 +348,67 @@ declare function computeSplitDialogDefaults(rowspan: number, colspan: number): {
|
|
|
875
348
|
initialCols: number;
|
|
876
349
|
};
|
|
877
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Find word boundaries around a position in text
|
|
353
|
+
* Returns [startIndex, endIndex] inclusive start, exclusive end
|
|
354
|
+
*/
|
|
355
|
+
declare function findWordBoundaries(text: string, position: number): [number, number];
|
|
356
|
+
/**
|
|
357
|
+
* Get the word at a position in text
|
|
358
|
+
*/
|
|
359
|
+
declare function getWordAt(text: string, position: number): string;
|
|
360
|
+
/**
|
|
361
|
+
* Word selection result
|
|
362
|
+
*/
|
|
363
|
+
interface WordSelectionResult {
|
|
364
|
+
/** The selected word */
|
|
365
|
+
word: string;
|
|
366
|
+
/** Start index in the text (inclusive) */
|
|
367
|
+
startIndex: number;
|
|
368
|
+
/** End index in the text (exclusive) */
|
|
369
|
+
endIndex: number;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Find the word at a position and return detailed info
|
|
373
|
+
*/
|
|
374
|
+
declare function findWordAt(text: string, position: number): WordSelectionResult;
|
|
375
|
+
/**
|
|
376
|
+
* Select a word at the current cursor position using the browser's native APIs.
|
|
377
|
+
* This works reliably across different browsers and handles contentEditable well.
|
|
378
|
+
*/
|
|
379
|
+
declare function selectWordAtCursor(): boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Select a word in a specific text node at the given offset
|
|
382
|
+
*/
|
|
383
|
+
declare function selectWordInTextNode(textNode: Text, offset: number): boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Expand the current selection to word boundaries.
|
|
386
|
+
* If there's a collapsed selection (cursor), selects the word at cursor.
|
|
387
|
+
* If there's an existing selection, expands to include complete words.
|
|
388
|
+
*/
|
|
389
|
+
declare function expandSelectionToWordBoundaries(): boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Select the entire paragraph containing the current selection.
|
|
392
|
+
* Looks for the nearest element with [data-paragraph-index] attribute.
|
|
393
|
+
*/
|
|
394
|
+
declare function selectParagraphAtCursor(): boolean;
|
|
395
|
+
/**
|
|
396
|
+
* Handle click event for multi-click detection.
|
|
397
|
+
* Call this in your click handler.
|
|
398
|
+
* Returns the click count (1 = single, 2 = double, 3 = triple).
|
|
399
|
+
*/
|
|
400
|
+
declare function handleClickForMultiClick(event: MouseEvent): number;
|
|
401
|
+
/**
|
|
402
|
+
* Create a double-click handler that selects words.
|
|
403
|
+
* Returns a function that should be called on dblclick events.
|
|
404
|
+
*/
|
|
405
|
+
declare function createDoubleClickWordSelector(): (event: MouseEvent) => void;
|
|
406
|
+
/**
|
|
407
|
+
* Create a triple-click handler that selects paragraphs.
|
|
408
|
+
* This uses our custom click counting since browsers have inconsistent triple-click.
|
|
409
|
+
*/
|
|
410
|
+
declare function createTripleClickParagraphSelector(): (event: MouseEvent) => void;
|
|
411
|
+
|
|
878
412
|
/**
|
|
879
413
|
* Shared file-input → docx-buffer reader.
|
|
880
414
|
*
|
|
@@ -953,4 +487,4 @@ declare function createComment(allocator: CommentIdAllocator, text: string, auth
|
|
|
953
487
|
*/
|
|
954
488
|
declare function sanitizeHref(href: string | null | undefined): string | undefined;
|
|
955
489
|
|
|
956
|
-
export {
|
|
490
|
+
export { type CellAnchor, type ColorMode, type CommentIdAllocator, DEFAULT_PARAGRAPH_FLASH_COLOR, DEFAULT_PARAGRAPH_FLASH_DURATION_MS, type EmbeddedFontFace, type HeadingInfo, PARAGRAPH_FLASH_CLASS_NAME, PENDING_COMMENT_ID, type ParagraphHighlightOptions, type ReadDocxFileResult, type RenderableFontOptions, type ScrollToParaIdOptions, type SplitLayoutResult, type SplitTarget, type WordSelectionResult, buildAnchorMaps, collectHeadings, computeSplitDialogDefaults, computeSplitLayout, createComment, createCommentIdAllocator, createDoubleClickWordSelector, createTripleClickParagraphSelector, deobfuscateFont, excludeFontsByName, expandSelectionToWordBoundaries, extractEmbeddedFontFaces, findParagraphFragmentsByParaId, findWordAt, findWordBoundaries, flashParagraphElements, flashParagraphFragmentsByParaId, getEmbeddedFontFaces, getEmbeddedFontFamilies, getRenderableDocumentFonts, getWordAt, handleClickForMultiClick, isValidFontKey, loadEmbeddedFonts, prefersColorSchemeDark, readDocxFileFromInput, redistributeColumnWidths, resolveIsDark, sanitizeHref, selectParagraphAtCursor, selectRenderableFonts, selectWordAtCursor, selectWordInTextNode, subscribeSystemDark, sumColumnWidths };
|