@postnzt/docx-js-editor 0.0.33
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/ClipboardManager-C0rTRkVQ.d.ts +464 -0
- package/dist/ClipboardManager-CgpKW2At.d.mts +464 -0
- package/dist/DocumentAgent-BqA9EJ3F.d.mts +442 -0
- package/dist/DocumentAgent-CRCXiBT7.d.ts +442 -0
- package/dist/FindReplaceDialog-KNJETYJX.js +1 -0
- package/dist/FindReplaceDialog-YW3R4FHM.mjs +1 -0
- package/dist/FootnotePropertiesDialog-452A4UT5.js +1 -0
- package/dist/FootnotePropertiesDialog-H24AC5XK.mjs +1 -0
- package/dist/HyperlinkDialog-GBAYMTUE.js +1 -0
- package/dist/HyperlinkDialog-HNYTXDCB.mjs +1 -0
- package/dist/ImagePositionDialog-B4RLP2W5.mjs +1 -0
- package/dist/ImagePositionDialog-M65BYQQE.js +1 -0
- package/dist/ImagePropertiesDialog-JOGW3WDU.mjs +1 -0
- package/dist/ImagePropertiesDialog-O4WQSF5M.js +1 -0
- package/dist/PageSetupDialog-2GIBTKMJ.js +1 -0
- package/dist/PageSetupDialog-Q7SHEZIJ.mjs +1 -0
- package/dist/TablePropertiesDialog-LMXWX3FI.mjs +1 -0
- package/dist/TablePropertiesDialog-WOZ4ES3H.js +1 -0
- package/dist/agentApi-BVHzyk2l.d.mts +2239 -0
- package/dist/agentApi-BVHzyk2l.d.ts +2239 -0
- package/dist/chunk-2HDYCD2Q.mjs +1 -0
- package/dist/chunk-377ZVTSE.js +2 -0
- package/dist/chunk-37SLIJPH.mjs +58 -0
- package/dist/chunk-4VUZBV2S.js +1 -0
- package/dist/chunk-6WPRCJ5A.mjs +1 -0
- package/dist/chunk-7MGFEP2R.mjs +26 -0
- package/dist/chunk-7QTNB64A.mjs +9 -0
- package/dist/chunk-AARNCPWR.js +1 -0
- package/dist/chunk-AU5NVRHP.js +2 -0
- package/dist/chunk-BP3V2HDD.js +261 -0
- package/dist/chunk-BUEMG4NW.js +1 -0
- package/dist/chunk-DC65PJYE.js +4 -0
- package/dist/chunk-DLVLK5FT.mjs +24 -0
- package/dist/chunk-EV3CM6TU.js +1 -0
- package/dist/chunk-FVUGBRDD.js +1 -0
- package/dist/chunk-GZOCOWWB.mjs +2 -0
- package/dist/chunk-H5NTJZO4.js +1 -0
- package/dist/chunk-IFPN3NT3.js +3 -0
- package/dist/chunk-KCOGY3V2.js +10 -0
- package/dist/chunk-KUL2SDYC.js +26 -0
- package/dist/chunk-LFZXSNOF.mjs +261 -0
- package/dist/chunk-LYBG4YI7.mjs +1 -0
- package/dist/chunk-M5F4SK3W.mjs +1 -0
- package/dist/chunk-P7WEP4JU.js +9 -0
- package/dist/chunk-PB7VMDDP.js +24 -0
- package/dist/chunk-QAZ4233N.mjs +1 -0
- package/dist/chunk-QSUPYUOP.js +2 -0
- package/dist/chunk-QTSXJRP6.mjs +1 -0
- package/dist/chunk-QVPR2W5S.js +1 -0
- package/dist/chunk-RTFUE3KK.mjs +10 -0
- package/dist/chunk-SCYTWBF5.mjs +111 -0
- package/dist/chunk-SE5EN2QL.js +1 -0
- package/dist/chunk-T6X4C2QO.js +111 -0
- package/dist/chunk-TAUMSKRE.mjs +1 -0
- package/dist/chunk-W53SI3XW.mjs +1 -0
- package/dist/chunk-WOHFANC5.mjs +3 -0
- package/dist/chunk-X5A54T6S.mjs +4 -0
- package/dist/chunk-YKBSKEBS.mjs +2 -0
- package/dist/chunk-Z26WOH6R.mjs +2 -0
- package/dist/chunk-ZJNGMDRE.js +58 -0
- package/dist/clipboard-Cu80iVDh.d.ts +1181 -0
- package/dist/clipboard-dFROLI95.d.mts +1181 -0
- package/dist/colorResolver-BwI_Uxp3.d.mts +662 -0
- package/dist/colorResolver-Dlmk3itT.d.ts +662 -0
- package/dist/core-plugins-reexport.d.mts +31 -0
- package/dist/core-plugins-reexport.d.ts +31 -0
- package/dist/core-plugins-reexport.js +1 -0
- package/dist/core-plugins-reexport.mjs +1 -0
- package/dist/core-reexport.d.mts +309 -0
- package/dist/core-reexport.d.ts +309 -0
- package/dist/core-reexport.js +1 -0
- package/dist/core-reexport.mjs +1 -0
- package/dist/executor-L2MVKMXO.js +1 -0
- package/dist/executor-XKBCCVNY.mjs +1 -0
- package/dist/fontLoader-BI9ZoACv.d.ts +176 -0
- package/dist/fontLoader-DicgJidU.d.mts +176 -0
- package/dist/headless-reexport.d.mts +195 -0
- package/dist/headless-reexport.d.ts +195 -0
- package/dist/headless-reexport.js +4 -0
- package/dist/headless-reexport.mjs +4 -0
- package/dist/index.css +1 -0
- package/dist/index.d.mts +480 -0
- package/dist/index.d.ts +480 -0
- package/dist/index.js +112 -0
- package/dist/index.mjs +112 -0
- package/dist/lib-BCT2DRYI.mjs +1 -0
- package/dist/lib-U35UU4OU.js +1 -0
- package/dist/mcp-reexport.d.mts +156 -0
- package/dist/mcp-reexport.d.ts +156 -0
- package/dist/mcp-reexport.js +16 -0
- package/dist/mcp-reexport.mjs +16 -0
- package/dist/processTemplate-5ZST2Q5L.js +1 -0
- package/dist/processTemplate-LRHXOWMZ.mjs +1 -0
- package/dist/react-Cl2n0F5S.d.ts +1091 -0
- package/dist/react-DZlAKNXg.d.mts +1091 -0
- package/dist/react.css +1 -0
- package/dist/react.d.mts +10 -0
- package/dist/react.d.ts +10 -0
- package/dist/react.js +1 -0
- package/dist/react.mjs +1 -0
- package/dist/registry-D4FQ9aKX.d.mts +165 -0
- package/dist/registry-DrYyUXQr.d.ts +165 -0
- package/dist/selectionRects-DEX5THEG.js +1 -0
- package/dist/selectionRects-SQTAHMCH.mjs +1 -0
- package/dist/styles.css +1 -0
- package/dist/types-B3LkfO0u.d.mts +310 -0
- package/dist/types-igZ1x_e4.d.ts +310 -0
- package/dist/ui.d.mts +2005 -0
- package/dist/ui.d.ts +2005 -0
- package/dist/ui.js +1 -0
- package/dist/ui.mjs +1 -0
- package/dist/variableDetector-CIqTek7A.d.mts +204 -0
- package/dist/variableDetector-CkYvLv62.d.ts +204 -0
- package/i18n/de.json +745 -0
- package/i18n/en.json +745 -0
- package/i18n/pl.json +745 -0
- package/package.json +127 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
import { R as ReactEditorPlugin } from './react-DZlAKNXg.mjs';
|
|
2
|
+
export { D as DEFAULT_SELECTION_STYLE, a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, E as EditorMode, e as EditorPlugin, f as ErrorBoundary, g as ErrorBoundaryProps, h as ErrorContextValue, i as ErrorProvider, H as HIGH_CONTRAST_SELECTION_STYLE, j as HighlightRect, P as PLUGIN_HOST_STYLES, k as ParseErrorDisplay, l as ParseErrorDisplayProps, m as PluginContext, n as PluginHost, o as PluginHostProps, p as PluginHostRef, q as ReactSidebarItem, r as RenderAsyncOptions, S as SELECTION_CSS_VARS, s as SelectionHighlightConfig, t as SelectionOverlayProps, u as SelectionRange, v as SidebarItemRenderProps, T as TableSelectionState, U as UnsupportedFeatureWarning, w as UnsupportedFeatureWarningProps, x as UseAutoSaveOptions, y as UseAutoSaveReturn, z as UseClipboardOptions, A as UseClipboardReturn, B as UseSelectionHighlightOptions, C as UseSelectionHighlightReturn, F as UseTableSelectionOptions, G as UseTableSelectionReturn, I as UseWheelZoomOptions, J as UseWheelZoomReturn, Z as ZOOM_PRESETS, K as areSelectionStylesInjected, L as clampZoom, M as clearSelection, N as createSelectionChangeHandler, O as findNearestZoomPreset, Q as formatZoom, V as generateOverlayElements, W as generateSelectionCSS, X as getHighlightRectStyle, Y as getMergedSelectionRects, _ as getNextZoomPreset, $ as getPreviousZoomPreset, a0 as getSelectedText, a1 as getSelectionBoundingRect, a2 as getSelectionRects, a3 as getUserFriendlyMessage, a4 as getZoomPresets, a5 as hasActiveSelection, a6 as highlightTextRange, a7 as injectSelectionStyles, a8 as isParseError, a9 as isSelectionBackwards, aa as isSelectionWithin, ab as isZoomPreset, ac as mergeAdjacentRects, ad as normalizeSelectionDirection, ae as parseZoom, af as removeSelectionStyles, ag as renderAsync, ah as selectRange, ai as useAutoSave, aj as useClipboard, ak as useErrorNotifications, al as useSelectionHighlight, am as useTableSelection, an as useWheelZoom } from './react-DZlAKNXg.mjs';
|
|
3
|
+
export { D as DocumentAgent, g as DocxInput, t as toArrayBuffer } from './DocumentAgent-BqA9EJ3F.mjs';
|
|
4
|
+
export { A as AgentContextOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, P as ProcessTemplateOptions, a as ProcessTemplateResult, b as SelectionContextOptions, c as blendColors, d as buildExtendedSelectionContext, e as buildSelectionContext, g as colorsEqual, h as createDocumentWithText, i as createEmptyDocument, j as createRgbColor, l as createThemeColor, m as darkenColor, n as emuToPixels, o as emuToTwips, p as executeCommand, q as executeCommands, r as formatPx, s as getAgentContext, t as getContrastingColor, u as getDocumentSummary, x as getTemplateTags, y as halfPointsToPixels, z as isBlack, B as isWhite, D as lightenColor, G as parseColorString, H as parseDocx, I as pixelsToEmu, J as pixelsToTwips, K as pointsToPixels, M as processTemplate, O as processTemplateAsBlob, Q as processTemplateDetailed, R as resolveColor, U as resolveHighlightColor, V as resolveShadingColor, W as serializeDocumentBody, X as serializeDocx, Y as serializeSectionProperties, Z as twipsToEmu, _ as twipsToPixels, $ as validateTemplate } from './colorResolver-BwI_Uxp3.mjs';
|
|
5
|
+
export { I as InsertPosition, c as canRenderFont, a as countPageBreaks, b as createColumnBreak, d as createHorizontalRule, e as createLineBreak, f as createPageBreak, g as createPageBreakParagraph, h as createPageBreakRun, i as findPageBreaks, j as getLoadedFonts, k as hasPageBreakBefore, l as insertHorizontalRule, m as insertPageBreak, n as isBreakContent, o as isColumnBreak, p as isFontLoaded, q as isFontsLoading, r as isLineBreak, s as isPageBreak, t as loadFont, u as loadFontFromBuffer, v as loadFonts, w as onFontsLoaded, x as preloadCommonFonts, y as removePageBreak } from './fontLoader-DicgJidU.mjs';
|
|
6
|
+
import { ToolbarProps } from './ui.mjs';
|
|
7
|
+
export { AdvancedColorPicker, AlignmentButtons, AlignmentButtonsProps, ColorOption, ColorPicker, ColorPickerProps, ContextMenu, ContextMenuProps, DialogKeyboardShortcut, FindMatch, FindOptions, FindReplaceDialog, FindReplaceDialogProps, FindReplaceOptions, FindReplaceState, FindResult, FontOption, FontPicker, FontPickerProps, FontSizePicker, FontSizePickerProps, HighlightOptions, HorizontalRuler, HorizontalRulerProps, HyperlinkData, HyperlinkDialog, HyperlinkDialogProps, ImageData, IndicatorPosition, IndicatorVariant, InsertImageDialog, InsertImageDialogProps, InsertSymbolDialog, InsertSymbolDialogProps, InsertTableDialog, InsertTableDialogProps, KeyboardShortcutsDialog, KeyboardShortcutsDialogProps, LineSpacingOption, LineSpacingPicker, LineSpacingPickerProps, ListButtons, ListButtonsProps, ListState, LoadingIndicator, LoadingIndicatorProps, LoadingOperation, LoadingSize, LoadingVariant, PasteOption, PasteSpecialDialog, PasteSpecialDialogProps, ResponsePreview, ResponsePreviewProps, ResponsePreviewState, ResponsiveToolbar, ResponsiveToolbarGroup, ResponsiveToolbarGroupProps, ResponsiveToolbarProps, SYMBOL_CATEGORIES, ShortcutCategory, StyleOption, StylePicker, StylePickerProps, SymbolCategory, TableBorderColorPicker, TableBorderColorPickerProps, TableBorderPicker, TableBorderPickerProps, TableBorderWidthPicker, TableBorderWidthPickerProps, TableCellFillPicker, TableCellFillPickerProps, TableConfig, TableInsertButtons, TableInsertButtonsProps, TableMergeButton, TableMergeButtonProps, TableMoreDropdown, TableMoreDropdownProps, TextContextAction, TextContextMenu, TextContextMenuItem, TextContextMenuProps, Toolbar, ToolbarButton, ToolbarGroup, ToolbarItem, ToolbarItemPriority, ToolbarSeparator, UnsavedIndicator, UnsavedIndicatorProps, UseFindReplaceReturn, UseKeyboardShortcutsDialogOptions, UseKeyboardShortcutsDialogReturn, UseLoadingOptions, UseLoadingReturn, UsePasteSpecialOptions, UsePasteSpecialReturn, UseResponsiveToolbarOptions, UseResponsiveToolbarReturn, UseTextContextMenuOptions, UseTextContextMenuReturn, UseUnsavedChangesOptions, UseUnsavedChangesReturn, ZoomControl, ZoomControlProps, calculateFitDimensions, clampTableConfig, createChangeTracker, createDefaultFindOptions, createDefaultListState, createDefaultTableConfig, createErrorResponse, createMockResponse, createSearchPattern, createToolbarItem, createToolbarItems, dataUrlToBlob, delay, escapeRegexString, findAllMatches, findInDocument, findInParagraph, formatFileSize, formatShortcutKeys, formatTableDimensions, getActionShortcut, getAllActions, getAllCategories, getAllIndicatorPositions, getAllIndicatorVariants, getAllLoadingSizes, getAllLoadingVariants, getAllPasteOptions, getCategoryLabel, getCommonShortcuts, getDefaultActions, getDefaultHighlightOptions, getDefaultPasteOption, getDefaultShortcuts, getDefaultTextContextMenuItems, getImageAcceptString, getImageDimensions, getLoadingVariantLabel, getMarginInUnits, getMatchCountText, getPasteOption, getRecommendedPriority, getRulerDimensions, getShortcutsByCategory, getSupportedImageExtensions, getSymbolCategories, getSymbolUnicodeInfo, getSymbolsByCategory, getTablePresets, getTextActionLabel, getTextActionShortcut, getVariantLabel, isActionAvailable, isEmptySearch, isPasteSpecialShortcut, isTextActionAvailable, isValidImageFile, isValidTableConfig, parseMarginFromUnits, positionToMargin, replaceAllInContent, replaceFirstInContent, scrollToMatch, searchSymbols, symbolFromCodePoint, useContextMenu, useFindReplace, useHyperlinkDialog, useInsertImageDialog, useInsertSymbolDialog, useInsertTableDialog, useKeyboardShortcutsDialog, useLoading, useLoadingOperations, usePasteSpecial, useResponsePreview, useResponsiveToolbar, useTextContextMenu, useUnsavedChanges } from './ui.mjs';
|
|
8
|
+
import { ReactNode } from 'react';
|
|
9
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
10
|
+
import { T as Translations, a as TranslationKey } from './clipboard-dFROLI95.mjs';
|
|
11
|
+
export { C as CLIPBOARD_TYPES, b as ClipboardContent, c as ClipboardOptions, I as INTERNAL_CLIPBOARD_TYPE, L as LocaleStrings, P as ParsedClipboardContent, d as PartialLocaleStrings, e as PrintButton, f as PrintButtonProps, g as PrintOptions, h as PrintStyles, i as TableAction, j as TableContext, k as TableSelection, l as TableToolbar, m as TableToolbarProps, n as addColumn, o as addRow, p as cleanWordHtml, q as copyParagraphs, r as copyRuns, s as createClipboardHandlers, t as createTableContext, u as deleteColumn, v as deleteRow, w as formatPrintPageRange, x as getCellAt, y as getColumnCount, z as getDefaultPrintOptions, A as handlePasteEvent, B as htmlToRuns, D as isEditorHtml, E as isPrintSupported, F as isWordHtml, G as mergeCells, H as openPrintWindow, J as paragraphsToClipboardContent, K as parseClipboardHtml, M as parsePageRange, N as readFromClipboard, O as runsToClipboardContent, Q as splitCell, R as triggerPrint, S as writeToClipboard } from './clipboard-dFROLI95.mjs';
|
|
12
|
+
export { f as AIAction, g as AIActionRequest, A as AgentCommand, h as AgentContext, i as AgentResponse, j as ApplyStyleCommand, l as BlockContent, ad as BookmarkEnd, ae as BookmarkStart, C as Comment, p as DeleteTextCommand, D as Document, d as DocumentBody, r as DocxPackage, E as Endnote, af as Field, ag as FooterReference, F as Footnote, t as FormatTextCommand, ah as HeaderFooter, ai as HeaderReference, H as Hyperlink, I as Image, u as InsertHyperlinkCommand, v as InsertImageCommand, w as InsertTableCommand, x as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, a as Paragraph, J as ParagraphContext, K as ParagraphFormatting, P as Position, R as Range, Q as Relationship, S as ReplaceTextCommand, b as Run, c as RunContent, V as SectionProperties, W as SelectionContext, X as SetVariableCommand, aj as Shape, Y as Style, Z as StyleDefinitions, $ as SuggestedAction, e as Table, a0 as TableCell, a1 as TableRow, ak as TextBox, a2 as TextContent, T as TextFormatting, a3 as Theme, al as ThemeColorScheme, am as ThemeFont, an as ThemeFontScheme } from './agentApi-BVHzyk2l.mjs';
|
|
13
|
+
import * as prosemirror_state from 'prosemirror-state';
|
|
14
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
15
|
+
import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
16
|
+
export { C as CorePlugin, e as McpSession, M as McpToolDefinition, i as McpToolHandler, j as McpToolResult } from './types-B3LkfO0u.mjs';
|
|
17
|
+
export { P as PluginRegistry, p as pluginRegistry, r as registerPlugins } from './registry-D4FQ9aKX.mjs';
|
|
18
|
+
export { docxtemplaterPlugin } from './core-plugins-reexport.mjs';
|
|
19
|
+
export { d as AutoSaveStatus, e as ClipboardSelection, h as ErrorNotification, i as ErrorSeverity, j as PanelConfig, k as PluginPanelProps, l as PositionCoordinates, R as RenderedDomContext, m as SavedDocumentData, F as SidebarItem, G as SidebarItemContext, T as TABLE_DATA_ATTRIBUTES, p as createSelectionFromDOM, t as formatLastSaveTime, u as formatStorageSize, v as getAutoSaveStatusLabel, w as getAutoSaveStorageSize, x as getSelectionRuns, z as isAutoSaveSupported } from './ClipboardManager-CgpKW2At.mjs';
|
|
20
|
+
import 'prosemirror-model';
|
|
21
|
+
|
|
22
|
+
interface LocaleProviderProps {
|
|
23
|
+
i18n?: Translations;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
declare function LocaleProvider({ i18n, children }: LocaleProviderProps): react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare function useTranslation(): {
|
|
28
|
+
t: (key: TranslationKey, vars?: Record<string, string | number>) => string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Props for the EditorToolbar compound component.
|
|
33
|
+
* Extends ToolbarProps with title bar-specific fields.
|
|
34
|
+
*/
|
|
35
|
+
interface EditorToolbarProps extends ToolbarProps {
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface LogoProps {
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
declare function Logo({ children }: LogoProps): react_jsx_runtime.JSX.Element;
|
|
42
|
+
interface DocumentNameProps {
|
|
43
|
+
value: string;
|
|
44
|
+
onChange?: (value: string) => void;
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
editable?: boolean;
|
|
47
|
+
}
|
|
48
|
+
declare function DocumentName({ value, onChange, placeholder, editable }: DocumentNameProps): react_jsx_runtime.JSX.Element;
|
|
49
|
+
interface TitleBarRightProps {
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
}
|
|
52
|
+
declare function TitleBarRight({ children }: TitleBarRightProps): react_jsx_runtime.JSX.Element;
|
|
53
|
+
declare function MenuBar(): react_jsx_runtime.JSX.Element;
|
|
54
|
+
interface TitleBarProps {
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* TitleBar layout (Google Docs style):
|
|
59
|
+
*
|
|
60
|
+
* ┌──────────┬────────────────────────────┬──────────────────┐
|
|
61
|
+
* │ │ Document Name │ │
|
|
62
|
+
* │ Logo │ │ Right Actions │
|
|
63
|
+
* │ │ File Format Insert │ │
|
|
64
|
+
* └──────────┴────────────────────────────┴──────────────────┘
|
|
65
|
+
*
|
|
66
|
+
* Logo and TitleBarRight span full height. DocumentName + MenuBar
|
|
67
|
+
* stack vertically in the center column.
|
|
68
|
+
*/
|
|
69
|
+
declare function TitleBar({ children }: TitleBarProps): react_jsx_runtime.JSX.Element;
|
|
70
|
+
|
|
71
|
+
interface FormattingBarProps extends ToolbarProps {
|
|
72
|
+
/** Custom toolbar items to render at the end */
|
|
73
|
+
children?: ReactNode;
|
|
74
|
+
/** When true, renders with display:contents so children flow in parent flex container */
|
|
75
|
+
inline?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Icon-based formatting toolbar — undo/redo, zoom, styles, fonts,
|
|
79
|
+
* bold/italic/underline, colors, alignment, lists, table/image context, clear formatting.
|
|
80
|
+
*/
|
|
81
|
+
declare function FormattingBar(explicitProps: FormattingBarProps): react_jsx_runtime.JSX.Element;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* EditorToolbar — Google Docs-style 2-level compound component.
|
|
85
|
+
*
|
|
86
|
+
* Usage:
|
|
87
|
+
* <EditorToolbar {...toolbarProps}>
|
|
88
|
+
* <EditorToolbar.TitleBar>
|
|
89
|
+
* <EditorToolbar.Logo><MyIcon /></EditorToolbar.Logo>
|
|
90
|
+
* <EditorToolbar.DocumentName value={name} onChange={setName} />
|
|
91
|
+
* <EditorToolbar.MenuBar />
|
|
92
|
+
* <EditorToolbar.TitleBarRight>
|
|
93
|
+
* <button>Save</button>
|
|
94
|
+
* </EditorToolbar.TitleBarRight>
|
|
95
|
+
* </EditorToolbar.TitleBar>
|
|
96
|
+
* <EditorToolbar.FormattingBar />
|
|
97
|
+
* </EditorToolbar>
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
interface EditorToolbarComponent {
|
|
101
|
+
(props: EditorToolbarProps & {
|
|
102
|
+
children: ReactNode;
|
|
103
|
+
}): React.JSX.Element;
|
|
104
|
+
TitleBar: typeof TitleBar;
|
|
105
|
+
Logo: typeof Logo;
|
|
106
|
+
DocumentName: typeof DocumentName;
|
|
107
|
+
MenuBar: typeof MenuBar;
|
|
108
|
+
TitleBarRight: typeof TitleBarRight;
|
|
109
|
+
FormattingBar: typeof FormattingBar;
|
|
110
|
+
}
|
|
111
|
+
declare const EditorToolbar: EditorToolbarComponent;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Text Selection Utilities
|
|
115
|
+
*
|
|
116
|
+
* Utilities for word-level and paragraph-level text selection.
|
|
117
|
+
* Used for double-click (word) and triple-click (paragraph) selection.
|
|
118
|
+
*/
|
|
119
|
+
/**
|
|
120
|
+
* Check if a character is a word character
|
|
121
|
+
*/
|
|
122
|
+
declare function isWordCharacter$1(char: string): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Check if a character is whitespace
|
|
125
|
+
*/
|
|
126
|
+
declare function isWhitespace$1(char: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Find word boundaries around a position in text
|
|
129
|
+
* Returns [startIndex, endIndex] inclusive start, exclusive end
|
|
130
|
+
*/
|
|
131
|
+
declare function findWordBoundaries(text: string, position: number): [number, number];
|
|
132
|
+
/**
|
|
133
|
+
* Get the word at a position in text
|
|
134
|
+
*/
|
|
135
|
+
declare function getWordAt(text: string, position: number): string;
|
|
136
|
+
/**
|
|
137
|
+
* Word selection result
|
|
138
|
+
*/
|
|
139
|
+
interface WordSelectionResult {
|
|
140
|
+
/** The selected word */
|
|
141
|
+
word: string;
|
|
142
|
+
/** Start index in the text (inclusive) */
|
|
143
|
+
startIndex: number;
|
|
144
|
+
/** End index in the text (exclusive) */
|
|
145
|
+
endIndex: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Find the word at a position and return detailed info
|
|
149
|
+
*/
|
|
150
|
+
declare function findWordAt(text: string, position: number): WordSelectionResult;
|
|
151
|
+
/**
|
|
152
|
+
* Select a word at the current cursor position using the browser's native APIs.
|
|
153
|
+
* This works reliably across different browsers and handles contentEditable well.
|
|
154
|
+
*/
|
|
155
|
+
declare function selectWordAtCursor(): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Select a word in a specific text node at the given offset
|
|
158
|
+
*/
|
|
159
|
+
declare function selectWordInTextNode(textNode: Text, offset: number): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Expand the current selection to word boundaries.
|
|
162
|
+
* If there's a collapsed selection (cursor), selects the word at cursor.
|
|
163
|
+
* If there's an existing selection, expands to include complete words.
|
|
164
|
+
*/
|
|
165
|
+
declare function expandSelectionToWordBoundaries(): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Select the entire paragraph containing the current selection.
|
|
168
|
+
* Looks for the nearest element with [data-paragraph-index] attribute.
|
|
169
|
+
*/
|
|
170
|
+
declare function selectParagraphAtCursor(): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Handle click event for multi-click detection.
|
|
173
|
+
* Call this in your click handler.
|
|
174
|
+
* Returns the click count (1 = single, 2 = double, 3 = triple).
|
|
175
|
+
*/
|
|
176
|
+
declare function handleClickForMultiClick(event: MouseEvent): number;
|
|
177
|
+
/**
|
|
178
|
+
* Create a double-click handler that selects words.
|
|
179
|
+
* Returns a function that should be called on dblclick events.
|
|
180
|
+
*/
|
|
181
|
+
declare function createDoubleClickWordSelector(): (event: MouseEvent) => void;
|
|
182
|
+
/**
|
|
183
|
+
* Create a triple-click handler that selects paragraphs.
|
|
184
|
+
* This uses our custom click counting since browsers have inconsistent triple-click.
|
|
185
|
+
*/
|
|
186
|
+
declare function createTripleClickParagraphSelector(): (event: MouseEvent) => void;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Keyboard Navigation Utilities
|
|
190
|
+
*
|
|
191
|
+
* Provides enhanced keyboard navigation for the editor:
|
|
192
|
+
* - Ctrl+Left/Right: Move by word
|
|
193
|
+
* - Home/End: Move to start/end of line
|
|
194
|
+
* - Ctrl+Home/End: Move to start/end of document
|
|
195
|
+
* - Ctrl+Shift+Left/Right: Select by word
|
|
196
|
+
* - Shift+Home/End: Select to start/end of line
|
|
197
|
+
*/
|
|
198
|
+
/**
|
|
199
|
+
* Navigation direction
|
|
200
|
+
*/
|
|
201
|
+
type NavigationDirection = 'left' | 'right' | 'up' | 'down';
|
|
202
|
+
/**
|
|
203
|
+
* Navigation unit
|
|
204
|
+
*/
|
|
205
|
+
type NavigationUnit = 'character' | 'word' | 'line' | 'paragraph' | 'document';
|
|
206
|
+
/**
|
|
207
|
+
* Keyboard navigation action
|
|
208
|
+
*/
|
|
209
|
+
interface NavigationAction {
|
|
210
|
+
/** Direction to navigate */
|
|
211
|
+
direction: NavigationDirection;
|
|
212
|
+
/** Unit of movement */
|
|
213
|
+
unit: NavigationUnit;
|
|
214
|
+
/** Whether to extend selection */
|
|
215
|
+
extend: boolean;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Keyboard shortcut definition
|
|
219
|
+
*/
|
|
220
|
+
interface KeyboardShortcut {
|
|
221
|
+
key: string;
|
|
222
|
+
ctrlKey?: boolean;
|
|
223
|
+
metaKey?: boolean;
|
|
224
|
+
shiftKey?: boolean;
|
|
225
|
+
altKey?: boolean;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Check if a character is a word character (letter, digit, or underscore)
|
|
229
|
+
*/
|
|
230
|
+
declare function isWordCharacter(char: string): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Check if a character is whitespace
|
|
233
|
+
*/
|
|
234
|
+
declare function isWhitespace(char: string): boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Check if a character is a punctuation character
|
|
237
|
+
*/
|
|
238
|
+
declare function isPunctuation(char: string): boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Find the start of the current or previous word
|
|
241
|
+
*/
|
|
242
|
+
declare function findWordStart(text: string, position: number): number;
|
|
243
|
+
/**
|
|
244
|
+
* Find the end of the current or next word
|
|
245
|
+
*/
|
|
246
|
+
declare function findWordEnd(text: string, position: number): number;
|
|
247
|
+
/**
|
|
248
|
+
* Find the next word start (for Ctrl+Right navigation)
|
|
249
|
+
*/
|
|
250
|
+
declare function findNextWordStart(text: string, position: number): number;
|
|
251
|
+
/**
|
|
252
|
+
* Find the previous word start (for Ctrl+Left navigation)
|
|
253
|
+
*/
|
|
254
|
+
declare function findPreviousWordStart(text: string, position: number): number;
|
|
255
|
+
/**
|
|
256
|
+
* Find the start of the current line in a text node
|
|
257
|
+
* Uses visual line detection based on bounding rectangles
|
|
258
|
+
*/
|
|
259
|
+
declare function findVisualLineStart(container: Node, offset: number): {
|
|
260
|
+
node: Node;
|
|
261
|
+
offset: number;
|
|
262
|
+
} | null;
|
|
263
|
+
/**
|
|
264
|
+
* Find the end of the current line in a text node
|
|
265
|
+
* Uses visual line detection based on bounding rectangles
|
|
266
|
+
*/
|
|
267
|
+
declare function findVisualLineEnd(container: Node, offset: number): {
|
|
268
|
+
node: Node;
|
|
269
|
+
offset: number;
|
|
270
|
+
} | null;
|
|
271
|
+
/**
|
|
272
|
+
* Get the current selection info
|
|
273
|
+
*/
|
|
274
|
+
declare function getSelectionInfo(): {
|
|
275
|
+
node: Node;
|
|
276
|
+
offset: number;
|
|
277
|
+
anchorNode: Node | null;
|
|
278
|
+
anchorOffset: number;
|
|
279
|
+
focusNode: Node | null;
|
|
280
|
+
focusOffset: number;
|
|
281
|
+
isCollapsed: boolean;
|
|
282
|
+
text: string;
|
|
283
|
+
} | null;
|
|
284
|
+
/**
|
|
285
|
+
* Set the selection to a specific position
|
|
286
|
+
*/
|
|
287
|
+
declare function setSelectionPosition(node: Node, offset: number): void;
|
|
288
|
+
/**
|
|
289
|
+
* Extend selection to a specific position
|
|
290
|
+
*/
|
|
291
|
+
declare function extendSelectionTo(node: Node, offset: number): void;
|
|
292
|
+
/**
|
|
293
|
+
* Move selection by word in a text node
|
|
294
|
+
*/
|
|
295
|
+
declare function moveByWord(direction: 'left' | 'right', extend?: boolean): boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Move to start/end of line
|
|
298
|
+
*/
|
|
299
|
+
declare function moveToLineEdge(edge: 'start' | 'end', extend?: boolean): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Parse a keyboard event into a navigation action
|
|
302
|
+
*/
|
|
303
|
+
declare function parseNavigationAction(event: KeyboardEvent): NavigationAction | null;
|
|
304
|
+
/**
|
|
305
|
+
* Handle a keyboard navigation event
|
|
306
|
+
* Returns true if the event was handled
|
|
307
|
+
*/
|
|
308
|
+
declare function handleNavigationKey(event: KeyboardEvent, options?: {
|
|
309
|
+
onDocumentStart?: () => void;
|
|
310
|
+
onDocumentEnd?: () => void;
|
|
311
|
+
}): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Check if an event is a navigation key event
|
|
314
|
+
*/
|
|
315
|
+
declare function isNavigationKey(event: KeyboardEvent): boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Expand selection to word boundaries
|
|
318
|
+
* Used for double-click word selection
|
|
319
|
+
*/
|
|
320
|
+
declare function expandSelectionToWord(): boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Get the word at the current cursor position
|
|
323
|
+
*/
|
|
324
|
+
declare function getWordAtCursor(): string | null;
|
|
325
|
+
/**
|
|
326
|
+
* Check if a keyboard event matches a shortcut definition
|
|
327
|
+
*/
|
|
328
|
+
declare function matchesShortcut(event: KeyboardEvent, shortcut: KeyboardShortcut): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Common navigation shortcuts
|
|
331
|
+
*/
|
|
332
|
+
declare const NAVIGATION_SHORTCUTS: {
|
|
333
|
+
readonly wordLeft: KeyboardShortcut;
|
|
334
|
+
readonly wordRight: KeyboardShortcut;
|
|
335
|
+
readonly selectWordLeft: KeyboardShortcut;
|
|
336
|
+
readonly selectWordRight: KeyboardShortcut;
|
|
337
|
+
readonly lineStart: KeyboardShortcut;
|
|
338
|
+
readonly lineEnd: KeyboardShortcut;
|
|
339
|
+
readonly selectToLineStart: KeyboardShortcut;
|
|
340
|
+
readonly selectToLineEnd: KeyboardShortcut;
|
|
341
|
+
readonly documentStart: KeyboardShortcut;
|
|
342
|
+
readonly documentEnd: KeyboardShortcut;
|
|
343
|
+
readonly selectToDocumentStart: KeyboardShortcut;
|
|
344
|
+
readonly selectToDocumentEnd: KeyboardShortcut;
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* Get a human-readable description of a shortcut
|
|
348
|
+
*/
|
|
349
|
+
declare function describeShortcut(shortcut: KeyboardShortcut): string;
|
|
350
|
+
/**
|
|
351
|
+
* Get all navigation shortcuts with descriptions
|
|
352
|
+
*/
|
|
353
|
+
declare function getNavigationShortcutDescriptions(): Array<{
|
|
354
|
+
action: string;
|
|
355
|
+
shortcut: string;
|
|
356
|
+
}>;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Template tag types
|
|
360
|
+
*/
|
|
361
|
+
type TagType = 'variable' | 'sectionStart' | 'sectionEnd' | 'invertedStart' | 'raw';
|
|
362
|
+
/**
|
|
363
|
+
* A found template tag
|
|
364
|
+
*/
|
|
365
|
+
interface TemplateTag {
|
|
366
|
+
id: string;
|
|
367
|
+
type: TagType;
|
|
368
|
+
name: string;
|
|
369
|
+
rawTag: string;
|
|
370
|
+
from: number;
|
|
371
|
+
to: number;
|
|
372
|
+
/** For sections: nested variable names */
|
|
373
|
+
nestedVars?: string[];
|
|
374
|
+
/** True if this variable is inside a section (shown in section's nested vars) */
|
|
375
|
+
insideSection?: boolean;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Plugin state
|
|
379
|
+
*/
|
|
380
|
+
interface TemplatePluginState$1 {
|
|
381
|
+
tags: TemplateTag[];
|
|
382
|
+
decorations: DecorationSet;
|
|
383
|
+
hoveredId?: string;
|
|
384
|
+
selectedId?: string;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Plugin key
|
|
388
|
+
*/
|
|
389
|
+
declare const templatePluginKey: PluginKey<TemplatePluginState$1>;
|
|
390
|
+
/**
|
|
391
|
+
* Create the template plugin
|
|
392
|
+
*/
|
|
393
|
+
declare function createTemplatePlugin(): Plugin<TemplatePluginState$1>;
|
|
394
|
+
/**
|
|
395
|
+
* Get tags from editor state
|
|
396
|
+
*/
|
|
397
|
+
declare function getTemplateTags(state: prosemirror_state.EditorState): TemplateTag[];
|
|
398
|
+
/**
|
|
399
|
+
* Set hovered tag
|
|
400
|
+
*/
|
|
401
|
+
declare function setHoveredElement(view: EditorView, id: string | undefined): void;
|
|
402
|
+
/**
|
|
403
|
+
* Set selected tag
|
|
404
|
+
*/
|
|
405
|
+
declare function setSelectedElement(view: EditorView, id: string | undefined): void;
|
|
406
|
+
/**
|
|
407
|
+
* CSS styles for template decorations
|
|
408
|
+
*/
|
|
409
|
+
declare const TEMPLATE_DECORATION_STYLES = "\n.docx-template-tag {\n cursor: pointer;\n transition: background-color 0.1s;\n}\n\n.docx-template-tag:hover,\n.docx-template-tag.hovered {\n filter: brightness(0.95);\n}\n\n.docx-template-tag.selected {\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);\n}\n";
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Template Plugin
|
|
413
|
+
*
|
|
414
|
+
* Docxtemplater template support as a plugin for the DOCX Editor.
|
|
415
|
+
*
|
|
416
|
+
* Features:
|
|
417
|
+
* - Full docxtemplater syntax detection (variables, loops, conditionals)
|
|
418
|
+
* - Sidebar annotation chips showing template structure (via getSidebarItems)
|
|
419
|
+
* - Differentiated visual highlighting by element type
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```tsx
|
|
423
|
+
* import { PluginHost } from '@docx-editor/plugin-api';
|
|
424
|
+
* import { templatePlugin } from '@docx-editor/plugins/template';
|
|
425
|
+
*
|
|
426
|
+
* function MyEditor() {
|
|
427
|
+
* return (
|
|
428
|
+
* <PluginHost plugins={[templatePlugin]}>
|
|
429
|
+
* <DocxEditor document={doc} onChange={handleChange} />
|
|
430
|
+
* </PluginHost>
|
|
431
|
+
* );
|
|
432
|
+
* }
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
|
|
436
|
+
interface TemplatePluginState {
|
|
437
|
+
tags: TemplateTag[];
|
|
438
|
+
hoveredId?: string;
|
|
439
|
+
selectedId?: string;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Create the template plugin instance.
|
|
443
|
+
*/
|
|
444
|
+
declare function createPlugin(_options?: {
|
|
445
|
+
/** @deprecated — panel is no longer used; template chips render in the unified sidebar */
|
|
446
|
+
defaultCollapsed?: boolean;
|
|
447
|
+
/** @deprecated */
|
|
448
|
+
panelPosition?: 'left' | 'right';
|
|
449
|
+
/** @deprecated */
|
|
450
|
+
panelWidth?: number;
|
|
451
|
+
}): ReactEditorPlugin<TemplatePluginState>;
|
|
452
|
+
/**
|
|
453
|
+
* Default template plugin instance.
|
|
454
|
+
*/
|
|
455
|
+
declare const templatePlugin: ReactEditorPlugin<TemplatePluginState>;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* @postnzt/docx-js-editor
|
|
459
|
+
*
|
|
460
|
+
* A complete WYSIWYG DOCX editor with full Microsoft Word fidelity.
|
|
461
|
+
*
|
|
462
|
+
* Features:
|
|
463
|
+
* - Full text and paragraph formatting
|
|
464
|
+
* - Tables, images, shapes, text boxes
|
|
465
|
+
* - Hyperlinks, bookmarks, fields
|
|
466
|
+
* - Footnotes, lists, headers/footers
|
|
467
|
+
* - Page layout with margins and columns
|
|
468
|
+
* - DocumentAgent API for programmatic editing
|
|
469
|
+
* - Template variable substitution
|
|
470
|
+
* - AI-powered context menu
|
|
471
|
+
*
|
|
472
|
+
* CSS Styles:
|
|
473
|
+
* For optimal cursor visibility and selection highlighting, import the editor styles:
|
|
474
|
+
* ```
|
|
475
|
+
* import '@postnzt/docx-js-editor/styles/editor.css';
|
|
476
|
+
* ```
|
|
477
|
+
*/
|
|
478
|
+
declare const VERSION = "0.0.2";
|
|
479
|
+
|
|
480
|
+
export { type DocumentNameProps, EditorToolbar, type EditorToolbarProps, FormattingBar, type FormattingBarProps, type KeyboardShortcut, LocaleProvider, type LocaleProviderProps, type LogoProps, NAVIGATION_SHORTCUTS, type NavigationAction, type NavigationDirection, type NavigationUnit, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, type TitleBarProps, type TitleBarRightProps, ToolbarProps, TranslationKey, Translations, VERSION, type WordSelectionResult, createDoubleClickWordSelector, createPlugin as createTemplatePlugin, createTemplatePlugin as createTemplateProseMirrorPlugin, createTripleClickParagraphSelector, describeShortcut, expandSelectionToWord, expandSelectionToWordBoundaries, extendSelectionTo, findNextWordStart, findPreviousWordStart, findVisualLineEnd, findVisualLineStart, findWordAt, findWordBoundaries, findWordEnd, findWordStart, getNavigationShortcutDescriptions, getSelectionInfo, getTemplateTags as getTemplatePluginTags, getWordAt, getWordAtCursor, handleClickForMultiClick, handleNavigationKey, isNavigationKey, isPunctuation, isWhitespace$1 as isWhitespace, isWhitespace as isWhitespaceChar, isWordCharacter as isWordChar, isWordCharacter$1 as isWordCharacter, matchesShortcut, moveByWord, moveToLineEdge, parseNavigationAction, selectParagraphAtCursor, selectWordAtCursor, selectWordInTextNode, setHoveredElement, setSelectedElement, setSelectionPosition, templatePlugin, templatePluginKey, useTranslation };
|