@a3s-lab/office 0.1.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/LICENSE +21 -0
- package/README.md +470 -0
- package/THIRD_PARTY_NOTICES.md +33 -0
- package/dist/0~1403.js +245 -0
- package/dist/0~152.js +94 -0
- package/dist/0~3539.js +1856 -0
- package/dist/0~3557.js +179 -0
- package/dist/0~3635.js +302 -0
- package/dist/0~4595.js +1162 -0
- package/dist/0~5050.js +308 -0
- package/dist/0~6552.js +787 -0
- package/dist/0~7048.js +2110 -0
- package/dist/0~7614.js +1037 -0
- package/dist/0~8155.js +299 -0
- package/dist/0~9445.js +283 -0
- package/dist/0~9512.js +743 -0
- package/dist/0~document-editor.js +10967 -0
- package/dist/0~markdown-editor.js +2260 -0
- package/dist/0~pdf-viewer.js +2156 -0
- package/dist/0~presentation-editor.js +8359 -0
- package/dist/0~rslib-runtime.js +27 -0
- package/dist/0~spreadsheet-editor.js +10388 -0
- package/dist/0~use-office-draft.js +46 -0
- package/dist/0~work-document-extensions.js +2470 -0
- package/dist/0~work-document-links.js +14 -0
- package/dist/0~work-document-model-codec.js +42 -0
- package/dist/0~work-document-page-color.js +11 -0
- package/dist/0~work-document-paragraph-formatting.js +425 -0
- package/dist/0~work-docx-bibliography.js +347 -0
- package/dist/0~work-docx-export.js +1151 -0
- package/dist/0~work-docx-import.js +3116 -0
- package/dist/0~work-docx-page-color.js +42 -0
- package/dist/0~work-office-diagnostics.js +1377 -0
- package/dist/0~work-pptx-export.js +1009 -0
- package/dist/0~work-pptx-import.js +1138 -0
- package/dist/0~work-presentation-charts.js +442 -0
- package/dist/0~work-presentation-transition.js +38 -0
- package/dist/0~work-presentation-visual-scale.js +38 -0
- package/dist/0~work-spreadsheet-formula-support.js +9 -0
- package/dist/1134.js +445 -0
- package/dist/4104.js +5786 -0
- package/dist/432.js +211 -0
- package/dist/4704.js +1364 -0
- package/dist/6489.js +182 -0
- package/dist/8715.js +3959 -0
- package/dist/8728.js +723 -0
- package/dist/9356.js +10 -0
- package/dist/core.d.ts +15 -0
- package/dist/core.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/internal/design-system/primitives/button/button.d.ts +9 -0
- package/dist/internal/design-system/primitives/button/icon-button.d.ts +7 -0
- package/dist/internal/design-system/primitives/dialog/dialog.d.ts +12 -0
- package/dist/internal/design-system/primitives/feedback/collection-state.d.ts +9 -0
- package/dist/internal/design-system/primitives/feedback/inline-notice.d.ts +10 -0
- package/dist/internal/design-system/primitives/feedback/state-view.d.ts +13 -0
- package/dist/internal/design-system/primitives/form/field.d.ts +19 -0
- package/dist/internal/design-system/primitives/index.d.ts +14 -0
- package/dist/internal/design-system/primitives/layout/split-handle.d.ts +17 -0
- package/dist/internal/design-system/primitives/navigation/segmented-control.d.ts +19 -0
- package/dist/internal/design-system/primitives/navigation/tab-navigation.d.ts +13 -0
- package/dist/internal/design-system/primitives/navigation/tabs.d.ts +21 -0
- package/dist/internal/design-system/primitives/overlay/dialog-focus-scope.d.ts +17 -0
- package/dist/internal/design-system/primitives/overlay/popover.d.ts +34 -0
- package/dist/internal/design-system/primitives/overlay/portal-root.d.ts +1 -0
- package/dist/internal/design-system/primitives/status/status-badge.d.ts +6 -0
- package/dist/internal/features/work/components/work-document-pages.d.ts +4 -0
- package/dist/internal/features/work/components/work-editor-agent-menus.d.ts +12 -0
- package/dist/internal/features/work/components/work-editor-loading-state.d.ts +3 -0
- package/dist/internal/features/work/editors/document-changes-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/document-citation-source-form.d.ts +33 -0
- package/dist/internal/features/work/editors/document-citations-panel.d.ts +8 -0
- package/dist/internal/features/work/editors/document-columns-panel.d.ts +5 -0
- package/dist/internal/features/work/editors/document-comment-composer.d.ts +13 -0
- package/dist/internal/features/work/editors/document-comments-panel.d.ts +17 -0
- package/dist/internal/features/work/editors/document-editor-focus.d.ts +1 -0
- package/dist/internal/features/work/editors/document-editor-pagination.d.ts +3 -0
- package/dist/internal/features/work/editors/document-editor-support.d.ts +34 -0
- package/dist/internal/features/work/editors/document-editor.d.ts +20 -0
- package/dist/internal/features/work/editors/document-find-highlight.d.ts +8 -0
- package/dist/internal/features/work/editors/document-find-replace-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/document-formatting-options.d.ts +113 -0
- package/dist/internal/features/work/editors/document-home-ribbon.d.ts +9 -0
- package/dist/internal/features/work/editors/document-layout-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/document-list-gallery.d.ts +4 -0
- package/dist/internal/features/work/editors/document-navigation-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/document-page-chrome-editor.d.ts +39 -0
- package/dist/internal/features/work/editors/document-page-chrome-panel.d.ts +5 -0
- package/dist/internal/features/work/editors/document-page-chrome-ribbon.d.ts +10 -0
- package/dist/internal/features/work/editors/document-page-navigation.d.ts +14 -0
- package/dist/internal/features/work/editors/document-page-stack.d.ts +8 -0
- package/dist/internal/features/work/editors/document-pagination-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-paragraph-spacing-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-picture-ribbon.d.ts +4 -0
- package/dist/internal/features/work/editors/document-ruler-tab-stops.d.ts +12 -0
- package/dist/internal/features/work/editors/document-ruler.d.ts +15 -0
- package/dist/internal/features/work/editors/document-selection-context-menu.d.ts +22 -0
- package/dist/internal/features/work/editors/document-selection-toolbar.d.ts +8 -0
- package/dist/internal/features/work/editors/document-status-bar.d.ts +19 -0
- package/dist/internal/features/work/editors/document-style-gallery.d.ts +4 -0
- package/dist/internal/features/work/editors/document-table-insert-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-table-ribbon.d.ts +7 -0
- package/dist/internal/features/work/editors/document-task-pane.d.ts +11 -0
- package/dist/internal/features/work/editors/document-toolbar.d.ts +100 -0
- package/dist/internal/features/work/editors/document-vertical-ruler.d.ts +6 -0
- package/dist/internal/features/work/editors/markdown-editor-focus.d.ts +2 -0
- package/dist/internal/features/work/editors/markdown-editor.d.ts +16 -0
- package/dist/internal/features/work/editors/markdown-insert-dialog.d.ts +19 -0
- package/dist/internal/features/work/editors/markdown-selection-context-menu.d.ts +14 -0
- package/dist/internal/features/work/editors/markdown-source-commands.d.ts +41 -0
- package/dist/internal/features/work/editors/markdown-status.d.ts +7 -0
- package/dist/internal/features/work/editors/markdown-toolbar.d.ts +22 -0
- package/dist/internal/features/work/editors/markdown-workspace.d.ts +26 -0
- package/dist/internal/features/work/editors/office-checkbox.d.ts +9 -0
- package/dist/internal/features/work/editors/office-color-picker.d.ts +11 -0
- package/dist/internal/features/work/editors/office-controls.d.ts +7 -0
- package/dist/internal/features/work/editors/office-dialog.d.ts +35 -0
- package/dist/internal/features/work/editors/office-editor-extension.d.ts +86 -0
- package/dist/internal/features/work/editors/office-file-data.d.ts +1 -0
- package/dist/internal/features/work/editors/office-font-families.d.ts +187 -0
- package/dist/internal/features/work/editors/office-menu-keyboard.d.ts +2 -0
- package/dist/internal/features/work/editors/office-number-field.d.ts +21 -0
- package/dist/internal/features/work/editors/office-number-normalization.d.ts +9 -0
- package/dist/internal/features/work/editors/office-select.d.ts +19 -0
- package/dist/internal/features/work/editors/office-shortcuts.d.ts +1 -0
- package/dist/internal/features/work/editors/office-slider.d.ts +10 -0
- package/dist/internal/features/work/editors/office-table-dimensions.d.ts +4 -0
- package/dist/internal/features/work/editors/office-table-insert-popover.d.ts +7 -0
- package/dist/internal/features/work/editors/office-task-pane.d.ts +7 -0
- package/dist/internal/features/work/editors/office-text-field.d.ts +20 -0
- package/dist/internal/features/work/editors/office-tiptap-extensions.d.ts +2 -0
- package/dist/internal/features/work/editors/pdf-annotation-controller.d.ts +23 -0
- package/dist/internal/features/work/editors/pdf-editor-extensions.d.ts +36 -0
- package/dist/internal/features/work/editors/pdf-thumbnail-rail.d.ts +26 -0
- package/dist/internal/features/work/editors/pdf-toolbar.d.ts +23 -0
- package/dist/internal/features/work/editors/pdf-viewer-controller.d.ts +48 -0
- package/dist/internal/features/work/editors/pdf-viewer.d.ts +11 -0
- package/dist/internal/features/work/editors/presentation-arrangement-controller.d.ts +19 -0
- package/dist/internal/features/work/editors/presentation-chart-analysis-canvas.d.ts +21 -0
- package/dist/internal/features/work/editors/presentation-chart-axis-canvas.d.ts +33 -0
- package/dist/internal/features/work/editors/presentation-chart-axis-editor.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-canvas.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-cartesian-canvas.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-chart-data-label-editor.d.ts +6 -0
- package/dist/internal/features/work/editors/presentation-chart-data-labels.d.ts +26 -0
- package/dist/internal/features/work/editors/presentation-chart-layout-editor.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-legend-canvas.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-chart-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/presentation-chart-series-analysis-editor.d.ts +6 -0
- package/dist/internal/features/work/editors/presentation-chart-series-canvas.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-command-controller.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-command-types.d.ts +206 -0
- package/dist/internal/features/work/editors/presentation-comments-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/presentation-context-menu.d.ts +11 -0
- package/dist/internal/features/work/editors/presentation-design-panel.d.ts +13 -0
- package/dist/internal/features/work/editors/presentation-editor-focus.d.ts +12 -0
- package/dist/internal/features/work/editors/presentation-editor-operations.d.ts +10 -0
- package/dist/internal/features/work/editors/presentation-editor-types.d.ts +22 -0
- package/dist/internal/features/work/editors/presentation-editor.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-keyboard-extension.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-player.d.ts +7 -0
- package/dist/internal/features/work/editors/presentation-presenter-view.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-selection.d.ts +21 -0
- package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +26 -0
- package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +18 -0
- package/dist/internal/features/work/editors/presentation-status-bar.d.ts +10 -0
- package/dist/internal/features/work/editors/presentation-text-editor.d.ts +22 -0
- package/dist/internal/features/work/editors/presentation-text-formatting.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +20 -0
- package/dist/internal/features/work/editors/presentation-toolbar.d.ts +19 -0
- package/dist/internal/features/work/editors/presentation-transition-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/presentation-workspace.d.ts +38 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-model.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +32 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-axis-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-draft.d.ts +17 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-layout-editor.d.ts +13 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-series-style-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-clipboard-shortcuts.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +121 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-comparison-fields.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-format-model.d.ts +72 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-format-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-threshold-fields.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-context-menu.d.ts +36 -0
- package/dist/internal/features/work/editors/spreadsheet-data-label-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +46 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +31 -0
- package/dist/internal/features/work/editors/spreadsheet-editor.d.ts +16 -0
- package/dist/internal/features/work/editors/spreadsheet-error-bar-editor.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-find-bar.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-find.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-formula-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-header-footer-fields.d.ts +5 -0
- package/dist/internal/features/work/editors/spreadsheet-keyboard-navigation.d.ts +18 -0
- package/dist/internal/features/work/editors/spreadsheet-number-format.d.ts +11 -0
- package/dist/internal/features/work/editors/spreadsheet-pivot-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-print-settings-panel.d.ts +6 -0
- package/dist/internal/features/work/editors/spreadsheet-protection-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-sheet-bar.d.ts +17 -0
- package/dist/internal/features/work/editors/spreadsheet-sheet-model.d.ts +13 -0
- package/dist/internal/features/work/editors/spreadsheet-trendline-editor.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-workbook-panel.d.ts +16 -0
- package/dist/internal/features/work/editors/use-document-comments.d.ts +26 -0
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +19 -0
- package/dist/internal/features/work/editors/use-document-layout-fonts.d.ts +2 -0
- package/dist/internal/features/work/editors/use-document-page-chrome.d.ts +33 -0
- package/dist/internal/features/work/editors/use-document-pagination.d.ts +46 -0
- package/dist/internal/features/work/editors/use-markdown-source-history.d.ts +16 -0
- package/dist/internal/features/work/editors/use-office-draft.d.ts +10 -0
- package/dist/internal/features/work/editors/use-office-editor-keyboard-shortcuts.d.ts +9 -0
- package/dist/internal/features/work/editors/use-office-editor-runtime.d.ts +6 -0
- package/dist/internal/features/work/editors/use-office-editor-wheel-zoom.d.ts +19 -0
- package/dist/internal/features/work/editors/use-office-history.d.ts +10 -0
- package/dist/internal/features/work/editors/use-presentation-clipboard.d.ts +22 -0
- package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +33 -0
- package/dist/internal/features/work/editors/use-presentation-element-commands.d.ts +29 -0
- package/dist/internal/features/work/editors/use-presentation-geometry.d.ts +17 -0
- package/dist/internal/features/work/editors/use-presentation-history.d.ts +12 -0
- package/dist/internal/features/work/editors/use-presentation-review-commands.d.ts +22 -0
- package/dist/internal/features/work/editors/use-presentation-selection.d.ts +11 -0
- package/dist/internal/features/work/editors/use-presentation-slide-commands.d.ts +18 -0
- package/dist/internal/features/work/editors/use-presentation-thumbnail-visibility.d.ts +4 -0
- package/dist/internal/features/work/editors/use-presentation-thumbnail-window.d.ts +17 -0
- package/dist/internal/features/work/editors/use-presentation-transform.d.ts +53 -0
- package/dist/internal/features/work/editors/use-spreadsheet-calculation.d.ts +17 -0
- package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +10 -0
- package/dist/internal/features/work/editors/work-office-chrome.d.ts +61 -0
- package/dist/internal/features/work/editors/work-office-ribbon-overflow.d.ts +18 -0
- package/dist/internal/features/work/work-agent-proposal-apply.d.ts +8 -0
- package/dist/internal/features/work/work-agent-proposal.d.ts +55 -0
- package/dist/internal/features/work/work-agent-request.d.ts +6 -0
- package/dist/internal/features/work/work-chart-series-analysis-context.d.ts +3 -0
- package/dist/internal/features/work/work-document-caption-nodes.d.ts +13 -0
- package/dist/internal/features/work/work-document-captions.d.ts +14 -0
- package/dist/internal/features/work/work-document-changes.d.ts +35 -0
- package/dist/internal/features/work/work-document-character-formatting.d.ts +13 -0
- package/dist/internal/features/work/work-document-citation-nodes.d.ts +25 -0
- package/dist/internal/features/work/work-document-citations.d.ts +21 -0
- package/dist/internal/features/work/work-document-columns.d.ts +15 -0
- package/dist/internal/features/work/work-document-comments.d.ts +48 -0
- package/dist/internal/features/work/work-document-extensions.d.ts +11 -0
- package/dist/internal/features/work/work-document-field-node.d.ts +12 -0
- package/dist/internal/features/work/work-document-fields.d.ts +15 -0
- package/dist/internal/features/work/work-document-file-io.d.ts +4 -0
- package/dist/internal/features/work/work-document-fonts.d.ts +16 -0
- package/dist/internal/features/work/work-document-image-layout.d.ts +29 -0
- package/dist/internal/features/work/work-document-incremental-layout.d.ts +17 -0
- package/dist/internal/features/work/work-document-layout.d.ts +5 -0
- package/dist/internal/features/work/work-document-line-measurement.d.ts +24 -0
- package/dist/internal/features/work/work-document-links.d.ts +2 -0
- package/dist/internal/features/work/work-document-lists.d.ts +25 -0
- package/dist/internal/features/work/work-document-model-codec.d.ts +3 -0
- package/dist/internal/features/work/work-document-model.d.ts +12 -0
- package/dist/internal/features/work/work-document-note-nodes.d.ts +11 -0
- package/dist/internal/features/work/work-document-notes.d.ts +18 -0
- package/dist/internal/features/work/work-document-outline.d.ts +14 -0
- package/dist/internal/features/work/work-document-page-break.d.ts +2 -0
- package/dist/internal/features/work/work-document-page-chrome-commands.d.ts +15 -0
- package/dist/internal/features/work/work-document-page-chrome.d.ts +19 -0
- package/dist/internal/features/work/work-document-page-color.d.ts +3 -0
- package/dist/internal/features/work/work-document-pages.d.ts +19 -0
- package/dist/internal/features/work/work-document-pagination-decorations.d.ts +3 -0
- package/dist/internal/features/work/work-document-pagination-dom.d.ts +35 -0
- package/dist/internal/features/work/work-document-pagination-measurement.d.ts +9 -0
- package/dist/internal/features/work/work-document-pagination-types.d.ts +88 -0
- package/dist/internal/features/work/work-document-pagination.d.ts +17 -0
- package/dist/internal/features/work/work-document-paragraph-formatting.d.ts +61 -0
- package/dist/internal/features/work/work-document-search.d.ts +11 -0
- package/dist/internal/features/work/work-document-section-editor.d.ts +20 -0
- package/dist/internal/features/work/work-document-section-node.d.ts +13 -0
- package/dist/internal/features/work/work-document-section.d.ts +34 -0
- package/dist/internal/features/work/work-document-selection-menu.d.ts +54 -0
- package/dist/internal/features/work/work-document-tab-node.d.ts +6 -0
- package/dist/internal/features/work/work-document-tab-stops.d.ts +29 -0
- package/dist/internal/features/work/work-document-table-cell-formatting.d.ts +46 -0
- package/dist/internal/features/work/work-document-table-commands.d.ts +17 -0
- package/dist/internal/features/work/work-document-table-pagination.d.ts +5 -0
- package/dist/internal/features/work/work-document-table-row.d.ts +37 -0
- package/dist/internal/features/work/work-document-table-sizing.d.ts +27 -0
- package/dist/internal/features/work/work-document-text-layout.d.ts +14 -0
- package/dist/internal/features/work/work-docx-bibliography.d.ts +12 -0
- package/dist/internal/features/work/work-docx-caption-diagnostics.d.ts +6 -0
- package/dist/internal/features/work/work-docx-caption-export.d.ts +4 -0
- package/dist/internal/features/work/work-docx-caption-fields.d.ts +5 -0
- package/dist/internal/features/work/work-docx-caption-import.d.ts +20 -0
- package/dist/internal/features/work/work-docx-change-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-citation-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-citation-export.d.ts +3 -0
- package/dist/internal/features/work/work-docx-citation-import.d.ts +23 -0
- package/dist/internal/features/work/work-docx-column-export.d.ts +14 -0
- package/dist/internal/features/work/work-docx-column-import.d.ts +2 -0
- package/dist/internal/features/work/work-docx-comment-import.d.ts +14 -0
- package/dist/internal/features/work/work-docx-export-formatting.d.ts +30 -0
- package/dist/internal/features/work/work-docx-export-image.d.ts +2 -0
- package/dist/internal/features/work/work-docx-export.d.ts +2 -0
- package/dist/internal/features/work/work-docx-field-export.d.ts +2 -0
- package/dist/internal/features/work/work-docx-field-import.d.ts +16 -0
- package/dist/internal/features/work/work-docx-field-instructions.d.ts +8 -0
- package/dist/internal/features/work/work-docx-image-layout-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-import.d.ts +50 -0
- package/dist/internal/features/work/work-docx-list-import.d.ts +14 -0
- package/dist/internal/features/work/work-docx-note-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-note-import.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-chrome-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-chrome-import.d.ts +11 -0
- package/dist/internal/features/work/work-docx-page-color.d.ts +2 -0
- package/dist/internal/features/work/work-docx-paragraph-alignment-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-direction-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-indent-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-pagination-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-spacing-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-styles.d.ts +18 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +19 -0
- package/dist/internal/features/work/work-docx-tab-stop-import.d.ts +13 -0
- package/dist/internal/features/work/work-docx-table-cell-export.d.ts +4 -0
- package/dist/internal/features/work/work-docx-table-cell-import.d.ts +16 -0
- package/dist/internal/features/work/work-docx-table-row-import.d.ts +13 -0
- package/dist/internal/features/work/work-docx-table-sizing-export.d.ts +8 -0
- package/dist/internal/features/work/work-docx-table-sizing-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-theme.d.ts +9 -0
- package/dist/internal/features/work/work-file-data.d.ts +1 -0
- package/dist/internal/features/work/work-file-download.d.ts +3 -0
- package/dist/internal/features/work/work-file-io.d.ts +8 -0
- package/dist/internal/features/work/work-markdown-extensions.d.ts +19 -0
- package/dist/internal/features/work/work-markdown-file-io.d.ts +3 -0
- package/dist/internal/features/work/work-markdown-selection-menu.d.ts +57 -0
- package/dist/internal/features/work/work-office-diagnostics.d.ts +9 -0
- package/dist/internal/features/work/work-ooxml-package.d.ts +28 -0
- package/dist/internal/features/work/work-pdf-export.d.ts +23 -0
- package/dist/internal/features/work/work-pptx-chart-axes.d.ts +3 -0
- package/dist/internal/features/work/work-pptx-chart-axis-diagnostics.d.ts +5 -0
- package/dist/internal/features/work/work-pptx-chart-data-labels.d.ts +12 -0
- package/dist/internal/features/work/work-pptx-chart-import.d.ts +11 -0
- package/dist/internal/features/work/work-pptx-chart-layout-style.d.ts +15 -0
- package/dist/internal/features/work/work-pptx-chart-series-analysis.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-chart-xy.d.ts +3 -0
- package/dist/internal/features/work/work-pptx-comments.d.ts +17 -0
- package/dist/internal/features/work/work-pptx-export.d.ts +4 -0
- package/dist/internal/features/work/work-pptx-groups.d.ts +19 -0
- package/dist/internal/features/work/work-pptx-import.d.ts +6 -0
- package/dist/internal/features/work/work-pptx-layout-export.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-layout-import.d.ts +30 -0
- package/dist/internal/features/work/work-pptx-style.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-transition.d.ts +13 -0
- package/dist/internal/features/work/work-presentation-agent-context.d.ts +6 -0
- package/dist/internal/features/work/work-presentation-chart-axes.d.ts +14 -0
- package/dist/internal/features/work/work-presentation-charts.d.ts +37 -0
- package/dist/internal/features/work/work-presentation-clipboard.d.ts +26 -0
- package/dist/internal/features/work/work-presentation-file-io.d.ts +15 -0
- package/dist/internal/features/work/work-presentation-groups.d.ts +17 -0
- package/dist/internal/features/work/work-presentation-layouts.d.ts +13 -0
- package/dist/internal/features/work/work-presentation-transition.d.ts +4 -0
- package/dist/internal/features/work/work-presentation-visual-scale.d.ts +2 -0
- package/dist/internal/features/work/work-repository.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-agent-context.d.ts +15 -0
- package/dist/internal/features/work/work-spreadsheet-chart-axis.d.ts +42 -0
- package/dist/internal/features/work/work-spreadsheet-chart-layout.d.ts +29 -0
- package/dist/internal/features/work/work-spreadsheet-chart-legend-svg.d.ts +18 -0
- package/dist/internal/features/work/work-spreadsheet-chart-series-layout.d.ts +24 -0
- package/dist/internal/features/work/work-spreadsheet-chart-series-style.d.ts +29 -0
- package/dist/internal/features/work/work-spreadsheet-chart-svg-utils.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-chart-svg.d.ts +3 -0
- package/dist/internal/features/work/work-spreadsheet-chart-types.d.ts +147 -0
- package/dist/internal/features/work/work-spreadsheet-chart-validation.d.ts +2 -0
- package/dist/internal/features/work/work-spreadsheet-charts.d.ts +17 -0
- package/dist/internal/features/work/work-spreadsheet-combination-chart-svg.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-comments.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-canvas.d.ts +5 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-colors.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-comparisons.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-data-bar.d.ts +8 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-format.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-icons.d.ts +107 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-values.d.ts +19 -0
- package/dist/internal/features/work/work-spreadsheet-data-label-svg.d.ts +27 -0
- package/dist/internal/features/work/work-spreadsheet-error-bar-svg.d.ts +5 -0
- package/dist/internal/features/work/work-spreadsheet-error-bars.d.ts +8 -0
- package/dist/internal/features/work/work-spreadsheet-formula-analysis.d.ts +30 -0
- package/dist/internal/features/work/work-spreadsheet-formula-support.d.ts +1 -0
- package/dist/internal/features/work/work-spreadsheet-formulas.d.ts +19 -0
- package/dist/internal/features/work/work-spreadsheet-header-footer.d.ts +14 -0
- package/dist/internal/features/work/work-spreadsheet-line-chart-svg.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-page-breaks.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-page-setup.d.ts +26 -0
- package/dist/internal/features/work/work-spreadsheet-pivot-engine.d.ts +21 -0
- package/dist/internal/features/work/work-spreadsheet-pivot-values.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-pivots.d.ts +27 -0
- package/dist/internal/features/work/work-spreadsheet-protection.d.ts +55 -0
- package/dist/internal/features/work/work-spreadsheet-ranges.d.ts +25 -0
- package/dist/internal/features/work/work-spreadsheet-trendline-svg.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-trendlines.d.ts +11 -0
- package/dist/internal/features/work/work-spreadsheet-xy-chart-axes-svg.d.ts +10 -0
- package/dist/internal/features/work/work-templates.d.ts +4 -0
- package/dist/internal/features/work/work-types.d.ts +513 -0
- package/dist/internal/features/work/work-xlsx-chart-axes.d.ts +4 -0
- package/dist/internal/features/work/work-xlsx-chart-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-chart-layout.d.ts +16 -0
- package/dist/internal/features/work/work-xlsx-chart-series-style.d.ts +6 -0
- package/dist/internal/features/work/work-xlsx-chart-values.d.ts +10 -0
- package/dist/internal/features/work/work-xlsx-charts.d.ts +32 -0
- package/dist/internal/features/work/work-xlsx-conditional-format-diagnostics.d.ts +6 -0
- package/dist/internal/features/work/work-xlsx-conditional-format-write.d.ts +11 -0
- package/dist/internal/features/work/work-xlsx-conditional-format.d.ts +29 -0
- package/dist/internal/features/work/work-xlsx-defined-names.d.ts +4 -0
- package/dist/internal/features/work/work-xlsx-drawing-geometry.d.ts +27 -0
- package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-formulas.d.ts +40 -0
- package/dist/internal/features/work/work-xlsx-header-footer.d.ts +12 -0
- package/dist/internal/features/work/work-xlsx-images.d.ts +17 -0
- package/dist/internal/features/work/work-xlsx-interop.d.ts +39 -0
- package/dist/internal/features/work/work-xlsx-page-breaks.d.ts +7 -0
- package/dist/internal/features/work/work-xlsx-page-setup-diagnostics.d.ts +2 -0
- package/dist/internal/features/work/work-xlsx-page-setup.d.ts +5 -0
- package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-pivot-xml.d.ts +9 -0
- package/dist/internal/features/work/work-xlsx-pivots.d.ts +32 -0
- package/dist/internal/features/work/work-xlsx-protection.d.ts +24 -0
- package/dist/internal/features/workspace/components/workspace-context-menu.d.ts +29 -0
- package/dist/internal/features/workspace/components/workspace-text-control-selection.d.ts +7 -0
- package/dist/internal/kernel/office-kernel-client-types.d.ts +40 -0
- package/dist/internal/kernel/office-kernel-client.d.ts +4 -0
- package/dist/internal/kernel/office-kernel-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-presentation-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-protocol.d.ts +229 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-formula.d.ts +3 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-validation.d.ts +5 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-value.d.ts +6 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-protocol.d.ts +112 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-session-fallback.d.ts +8 -0
- package/dist/internal/kernel/office-kernel-text-fallback.d.ts +10 -0
- package/dist/internal/kernel/office-kernel-version.d.ts +1 -0
- package/dist/internal/kernel/office-kernel.worker.d.ts +1 -0
- package/dist/internal/keyboard-shortcuts.d.ts +2 -0
- package/dist/internal/state/app-state.d.ts +8 -0
- package/dist/noto-naskh-arabic-regular.ttf +0 -0
- package/dist/noto-naskh-arabic.LICENSE.txt +94 -0
- package/dist/noto-sans-hans-regular.otf +0 -0
- package/dist/noto-sans-hans.LICENSE.txt +94 -0
- package/dist/noto-sans-hebrew-regular.ttf +0 -0
- package/dist/noto-sans-hebrew.LICENSE.txt +94 -0
- package/dist/noto-sans-regular.ttf +0 -0
- package/dist/noto-sans.LICENSE.txt +94 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/office-kernel.worker.js +14605 -0
- package/dist/office-surface.d.ts +10 -0
- package/dist/pdfium.LICENSE.txt +196 -0
- package/dist/pdfium.wasm +0 -0
- package/dist/pptxgen.LICENSE.txt +21 -0
- package/dist/pptxgen.bundle.js +11244 -0
- package/dist/react.d.ts +51 -0
- package/dist/react.js +1 -0
- package/dist/styles.css +17435 -0
- package/dist/styles.js +0 -0
- package/dist/vue.d.ts +282 -0
- package/dist/vue.js +231 -0
- package/dist/web-component.d.ts +98 -0
- package/dist/web-component.js +335 -0
- package/docs/browser-editor-architecture.md +947 -0
- package/package.json +165 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const DOCUMENT_LINK_VALIDATION_MESSAGE = '请输入完整的 http、https、mailto 或 # 文档内地址。';
|
|
2
|
+
function normalizeDocumentHref(value) {
|
|
3
|
+
const href = value.trim();
|
|
4
|
+
if (/^#[^\s#]+$/u.test(href)) return href;
|
|
5
|
+
if (/^mailto:[^\s@]+@[^\s@]+$/iu.test(href)) return href;
|
|
6
|
+
if (!/^https?:/iu.test(href)) return null;
|
|
7
|
+
try {
|
|
8
|
+
const url = new URL(href);
|
|
9
|
+
return url.hostname && ('http:' === url.protocol || 'https:' === url.protocol) ? href : null;
|
|
10
|
+
} catch {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export { DOCUMENT_LINK_VALIDATION_MESSAGE, normalizeDocumentHref };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { generateHTML, getSchema } from "@tiptap/core";
|
|
2
|
+
import { DOMParser as model_DOMParser } from "@tiptap/pm/model";
|
|
3
|
+
import { createWorkDocumentModel, syncDocumentContentFromHtml, documentModelForContent, documentHtmlFingerprint } from "./4704.js";
|
|
4
|
+
import { createWorkDocumentExtensions } from "./0~work-document-extensions.js";
|
|
5
|
+
let schema = null;
|
|
6
|
+
let extensions = null;
|
|
7
|
+
function createWorkDocumentModelFromContent(content) {
|
|
8
|
+
const previous = content.model;
|
|
9
|
+
const synchronized = syncDocumentContentFromHtml(content, content.html);
|
|
10
|
+
const document = new DOMParser().parseFromString(synchronized.html, 'text/html');
|
|
11
|
+
schema ??= getSchema(documentExtensions());
|
|
12
|
+
const root = model_DOMParser.fromSchema(schema).parse(document.body).toJSON();
|
|
13
|
+
return {
|
|
14
|
+
...synchronized,
|
|
15
|
+
model: createWorkDocumentModel(synchronized.html, root, previous)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function materializeWorkDocumentContent(content) {
|
|
19
|
+
const model = documentModelForContent(content);
|
|
20
|
+
if (!model) return content;
|
|
21
|
+
let html;
|
|
22
|
+
try {
|
|
23
|
+
html = generateHTML(model.root, documentExtensions());
|
|
24
|
+
} catch (error) {
|
|
25
|
+
throw new Error('The structured document model cannot be serialized by this Office schema.', {
|
|
26
|
+
cause: error
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const synchronized = syncDocumentContentFromHtml(content, html);
|
|
30
|
+
return {
|
|
31
|
+
...synchronized,
|
|
32
|
+
model: {
|
|
33
|
+
...model,
|
|
34
|
+
htmlFingerprint: documentHtmlFingerprint(synchronized.html)
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function documentExtensions() {
|
|
39
|
+
extensions ??= createWorkDocumentExtensions();
|
|
40
|
+
return extensions;
|
|
41
|
+
}
|
|
42
|
+
export { createWorkDocumentModelFromContent, materializeWorkDocumentContent };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const DEFAULT_DOCUMENT_PAGE_COLOR = '#ffffff';
|
|
2
|
+
function normalizeDocumentPageColor(value) {
|
|
3
|
+
const trimmed = value?.trim();
|
|
4
|
+
if (!trimmed) return;
|
|
5
|
+
if (/^#[0-9a-f]{3}$/i.test(trimmed)) return `#${trimmed.slice(1).split('').map((part)=>`${part}${part}`).join('')}`.toLowerCase();
|
|
6
|
+
return /^#[0-9a-f]{6}$/i.test(trimmed) ? trimmed.toLowerCase() : void 0;
|
|
7
|
+
}
|
|
8
|
+
function documentPageColor(value) {
|
|
9
|
+
return normalizeDocumentPageColor(value) ?? DEFAULT_DOCUMENT_PAGE_COLOR;
|
|
10
|
+
}
|
|
11
|
+
export { DEFAULT_DOCUMENT_PAGE_COLOR, documentPageColor, normalizeDocumentPageColor };
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
const DOCUMENT_INDENT_STEP_PX = 24;
|
|
3
|
+
const MAX_DOCUMENT_INDENT_LEVEL = 8;
|
|
4
|
+
const MAX_DOCUMENT_INDENT_PX = DOCUMENT_INDENT_STEP_PX * MAX_DOCUMENT_INDENT_LEVEL;
|
|
5
|
+
const DocumentParagraphFormatting = Extension.create({
|
|
6
|
+
name: 'documentParagraphFormatting',
|
|
7
|
+
addGlobalAttributes () {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
types: [
|
|
11
|
+
'paragraph',
|
|
12
|
+
'heading'
|
|
13
|
+
],
|
|
14
|
+
attributes: {
|
|
15
|
+
lineHeight: {
|
|
16
|
+
default: null,
|
|
17
|
+
parseHTML: (element)=>normalizedLineHeight(element.style.lineHeight),
|
|
18
|
+
renderHTML: (attributes)=>{
|
|
19
|
+
const lineHeight = normalizedLineHeight(attributes.lineHeight);
|
|
20
|
+
return lineHeight ? {
|
|
21
|
+
style: `line-height: ${lineHeight}`
|
|
22
|
+
} : {};
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
lineRule: {
|
|
26
|
+
default: null,
|
|
27
|
+
parseHTML: (element)=>normalizedLineRule(element.dataset.officeLineRule),
|
|
28
|
+
renderHTML: (attributes)=>{
|
|
29
|
+
const lineRule = normalizedLineRule(attributes.lineRule);
|
|
30
|
+
return lineRule ? {
|
|
31
|
+
'data-office-line-rule': lineRule
|
|
32
|
+
} : {};
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
spaceBefore: pointSpacingAttribute('spaceBefore', 'officeSpaceBefore', 'data-office-space-before', 'margin-top'),
|
|
36
|
+
spaceAfter: pointSpacingAttribute('spaceAfter', 'officeSpaceAfter', 'data-office-space-after', 'margin-bottom'),
|
|
37
|
+
indentLevel: {
|
|
38
|
+
default: 0,
|
|
39
|
+
parseHTML: (element)=>parsedIndentLevel(element.dataset.officeIndentLevel, element.style.marginLeft),
|
|
40
|
+
renderHTML: (attributes)=>{
|
|
41
|
+
const indentLevel = normalizedIndentLevel(attributes.indentLevel);
|
|
42
|
+
return indentLevel ? {
|
|
43
|
+
'data-office-indent-level': String(indentLevel),
|
|
44
|
+
style: `margin-left: ${indentLevel * DOCUMENT_INDENT_STEP_PX}px`
|
|
45
|
+
} : {};
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
rightIndent: {
|
|
49
|
+
default: 0,
|
|
50
|
+
parseHTML: (element)=>parsedIndentPixels(element.dataset.officeIndentRight, element.style.marginRight),
|
|
51
|
+
renderHTML: (attributes)=>{
|
|
52
|
+
const rightIndent = normalizedIndentPixels(attributes.rightIndent);
|
|
53
|
+
return rightIndent ? {
|
|
54
|
+
'data-office-indent-right': formatPixelValue(rightIndent),
|
|
55
|
+
style: `margin-right: ${rightIndent}px`
|
|
56
|
+
} : {};
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
firstLineIndent: {
|
|
60
|
+
default: 0,
|
|
61
|
+
parseHTML: (element)=>{
|
|
62
|
+
const left = parsedIndentLevel(element.dataset.officeIndentLevel, element.style.marginLeft);
|
|
63
|
+
return normalizedFirstLineIndent(parsedSignedIndentPixels(element.dataset.officeIndentFirstLine, element.style.textIndent), left * DOCUMENT_INDENT_STEP_PX);
|
|
64
|
+
},
|
|
65
|
+
renderHTML: (attributes)=>{
|
|
66
|
+
const left = normalizedIndentLevel(attributes.indentLevel) * DOCUMENT_INDENT_STEP_PX;
|
|
67
|
+
const firstLineIndent = normalizedFirstLineIndent(attributes.firstLineIndent, left);
|
|
68
|
+
return firstLineIndent ? {
|
|
69
|
+
'data-office-indent-first-line': formatPixelValue(firstLineIndent),
|
|
70
|
+
style: `text-indent: ${firstLineIndent}px`
|
|
71
|
+
} : {};
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
keepLines: directBooleanAttribute('keepLines', 'officeKeepLines', 'data-office-keep-lines'),
|
|
75
|
+
keepWithNext: directBooleanAttribute('keepWithNext', 'officeKeepWithNext', 'data-office-keep-with-next'),
|
|
76
|
+
pageBreakBefore: directBooleanAttribute('pageBreakBefore', 'officePageBreakBefore', 'data-office-page-break-before'),
|
|
77
|
+
widowControl: directBooleanAttribute('widowControl', 'officeWidowControl', 'data-office-widow-control')
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
types: [
|
|
82
|
+
'paragraph',
|
|
83
|
+
'heading',
|
|
84
|
+
'listItem'
|
|
85
|
+
],
|
|
86
|
+
attributes: {
|
|
87
|
+
paragraphDirection: paragraphDirectionAttribute()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
},
|
|
92
|
+
addCommands () {
|
|
93
|
+
return {
|
|
94
|
+
changeDocumentIndent: (direction)=>(props)=>changeDocumentIndentCommand(props, direction),
|
|
95
|
+
clearDocumentParagraphPagination: (options = {})=>(props)=>clearDocumentParagraphPaginationCommand(props, options),
|
|
96
|
+
clearDocumentFormatting: ()=>(props)=>clearDocumentFormattingCommand(props),
|
|
97
|
+
setDocumentIndentLevel: (indentLevel, options = {})=>(props)=>setDocumentIndentLevelCommand(props, indentLevel, options),
|
|
98
|
+
setDocumentLineHeight: (lineHeight)=>(props)=>setDocumentLineHeightCommand(props, lineHeight),
|
|
99
|
+
setDocumentParagraphDirection: (direction, options = {})=>(props)=>setDocumentParagraphDirectionCommand(props, direction, options),
|
|
100
|
+
setDocumentParagraphIndent: (indent, options = {})=>(props)=>setDocumentParagraphIndentCommand(props, indent, options),
|
|
101
|
+
setDocumentParagraphPagination: (pagination, options = {})=>(props)=>setDocumentParagraphPaginationCommand(props, pagination, options),
|
|
102
|
+
setDocumentParagraphSpacing: (spacing, options = {})=>(props)=>setDocumentParagraphSpacingCommand(props, spacing, options)
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
function canChangeDocumentIndent(editor, direction) {
|
|
107
|
+
if (editor.isActive('listItem')) {
|
|
108
|
+
const canChangeListLevel = direction > 0 ? editor.can().chain().focus().sinkListItem('listItem').run() : editor.can().chain().focus().liftListItem('listItem').run();
|
|
109
|
+
if (canChangeListLevel) return true;
|
|
110
|
+
}
|
|
111
|
+
const current = documentIndentLevel(editor);
|
|
112
|
+
return direction > 0 ? current < MAX_DOCUMENT_INDENT_LEVEL : current > 0;
|
|
113
|
+
}
|
|
114
|
+
function documentIndentLevel(editor) {
|
|
115
|
+
return documentParagraphIndent(editor).left / DOCUMENT_INDENT_STEP_PX;
|
|
116
|
+
}
|
|
117
|
+
function documentParagraphIndent(editor) {
|
|
118
|
+
const attributes = editor.isActive('heading') ? editor.getAttributes('heading') : editor.getAttributes('paragraph');
|
|
119
|
+
return normalizeDocumentParagraphIndent({
|
|
120
|
+
left: normalizedIndentLevel(attributes.indentLevel) * DOCUMENT_INDENT_STEP_PX,
|
|
121
|
+
right: normalizedIndentPixels(attributes.rightIndent),
|
|
122
|
+
firstLine: normalizedSignedIndentPixels(attributes.firstLineIndent)
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function documentParagraphPagination(editor) {
|
|
126
|
+
const attributes = activeParagraphAttributes(editor);
|
|
127
|
+
return {
|
|
128
|
+
keepLines: directBoolean(attributes.keepLines) ?? false,
|
|
129
|
+
keepWithNext: directBoolean(attributes.keepWithNext) ?? editor.isActive('heading'),
|
|
130
|
+
pageBreakBefore: directBoolean(attributes.pageBreakBefore) ?? false,
|
|
131
|
+
widowControl: directBoolean(attributes.widowControl) ?? true
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function documentParagraphDirection(editor) {
|
|
135
|
+
const attributes = editor.isActive('listItem') ? editor.getAttributes('listItem') : activeParagraphAttributes(editor);
|
|
136
|
+
return normalizeDocumentParagraphDirection(attributes.paragraphDirection) ?? 'ltr';
|
|
137
|
+
}
|
|
138
|
+
function documentParagraphSpacing(editor) {
|
|
139
|
+
const attributes = activeParagraphAttributes(editor);
|
|
140
|
+
return {
|
|
141
|
+
before: normalizedPointSpacing(attributes.spaceBefore),
|
|
142
|
+
after: normalizedPointSpacing(attributes.spaceAfter),
|
|
143
|
+
lineHeight: normalizedLineHeight(attributes.lineHeight),
|
|
144
|
+
lineRule: normalizedLineRule(attributes.lineRule)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function normalizeDocumentParagraphIndent(indent) {
|
|
148
|
+
const left = normalizedIndentLevel(indent.left / DOCUMENT_INDENT_STEP_PX) * DOCUMENT_INDENT_STEP_PX;
|
|
149
|
+
return {
|
|
150
|
+
left,
|
|
151
|
+
right: normalizedIndentPixels(indent.right),
|
|
152
|
+
firstLine: normalizedFirstLineIndent(indent.firstLine, left)
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function normalizeDocumentParagraphDirection(value) {
|
|
156
|
+
if ('string' != typeof value) return null;
|
|
157
|
+
const normalized = value.trim().toLowerCase();
|
|
158
|
+
return 'ltr' === normalized || 'rtl' === normalized ? normalized : null;
|
|
159
|
+
}
|
|
160
|
+
function setDocumentLineHeightCommand({ chain }, lineHeight) {
|
|
161
|
+
const value = normalizedLineHeight(lineHeight);
|
|
162
|
+
const attributes = {
|
|
163
|
+
lineHeight: value,
|
|
164
|
+
lineRule: value ? lineRuleForLineHeight(value) : null
|
|
165
|
+
};
|
|
166
|
+
return chain().focus().updateAttributes('paragraph', attributes).updateAttributes('heading', attributes).run();
|
|
167
|
+
}
|
|
168
|
+
function changeDocumentIndentCommand(props, direction) {
|
|
169
|
+
const { can, chain, editor } = props;
|
|
170
|
+
if (editor.isActive('listItem')) {
|
|
171
|
+
const canChangeListLevel = direction > 0 ? can().chain().focus().sinkListItem('listItem').run() : can().chain().focus().liftListItem('listItem').run();
|
|
172
|
+
if (canChangeListLevel) return direction > 0 ? chain().focus().sinkListItem('listItem').run() : chain().focus().liftListItem('listItem').run();
|
|
173
|
+
}
|
|
174
|
+
const current = documentIndentLevel(editor);
|
|
175
|
+
const next = normalizedIndentLevel(current + direction);
|
|
176
|
+
if (next === current) return false;
|
|
177
|
+
return setDocumentIndentLevelCommand(props, next, {});
|
|
178
|
+
}
|
|
179
|
+
function setDocumentIndentLevelCommand(props, indentLevel, options) {
|
|
180
|
+
const current = documentParagraphIndent(props.editor);
|
|
181
|
+
return setDocumentParagraphIndentCommand(props, {
|
|
182
|
+
...current,
|
|
183
|
+
left: normalizedIndentLevel(indentLevel) * DOCUMENT_INDENT_STEP_PX
|
|
184
|
+
}, options);
|
|
185
|
+
}
|
|
186
|
+
function setDocumentParagraphIndentCommand({ chain, editor }, indent, options) {
|
|
187
|
+
const nodeTypes = activeParagraphNodeTypes(editor);
|
|
188
|
+
if (!nodeTypes.length) return false;
|
|
189
|
+
const normalized = normalizeDocumentParagraphIndent(indent);
|
|
190
|
+
const attributes = {
|
|
191
|
+
indentLevel: normalized.left / DOCUMENT_INDENT_STEP_PX,
|
|
192
|
+
rightIndent: normalized.right,
|
|
193
|
+
firstLineIndent: normalized.firstLine
|
|
194
|
+
};
|
|
195
|
+
let commandChain = chain();
|
|
196
|
+
if (false !== options.restoreFocus) commandChain = commandChain.focus();
|
|
197
|
+
for (const nodeType of nodeTypes)commandChain = commandChain.updateAttributes(nodeType, attributes);
|
|
198
|
+
return commandChain.run();
|
|
199
|
+
}
|
|
200
|
+
function setDocumentParagraphDirectionCommand({ chain, editor }, direction, options) {
|
|
201
|
+
const nodeTypes = activeParagraphDirectionNodeTypes(editor);
|
|
202
|
+
const value = normalizeDocumentParagraphDirection(direction);
|
|
203
|
+
if (!nodeTypes.length || !value) return false;
|
|
204
|
+
let commandChain = chain();
|
|
205
|
+
if (false !== options.restoreFocus) commandChain = commandChain.focus();
|
|
206
|
+
for (const nodeType of nodeTypes)commandChain = commandChain.updateAttributes(nodeType, {
|
|
207
|
+
paragraphDirection: value
|
|
208
|
+
});
|
|
209
|
+
return commandChain.run();
|
|
210
|
+
}
|
|
211
|
+
function setDocumentParagraphPaginationCommand({ chain, editor }, pagination, options) {
|
|
212
|
+
const nodeTypes = activeParagraphNodeTypes(editor);
|
|
213
|
+
if (!nodeTypes.length) return false;
|
|
214
|
+
const attributes = {};
|
|
215
|
+
for (const key of documentParagraphPaginationKeys)if (Object.hasOwn(pagination, key)) attributes[key] = Boolean(pagination[key]);
|
|
216
|
+
if (!Object.keys(attributes).length) return false;
|
|
217
|
+
let commandChain = chain();
|
|
218
|
+
if (false !== options.restoreFocus) commandChain = commandChain.focus();
|
|
219
|
+
for (const nodeType of nodeTypes)commandChain = commandChain.updateAttributes(nodeType, attributes);
|
|
220
|
+
return commandChain.run();
|
|
221
|
+
}
|
|
222
|
+
function clearDocumentParagraphPaginationCommand({ chain, editor }, options) {
|
|
223
|
+
const nodeTypes = activeParagraphNodeTypes(editor);
|
|
224
|
+
if (!nodeTypes.length) return false;
|
|
225
|
+
const attributes = {
|
|
226
|
+
keepLines: null,
|
|
227
|
+
keepWithNext: null,
|
|
228
|
+
pageBreakBefore: null,
|
|
229
|
+
widowControl: null
|
|
230
|
+
};
|
|
231
|
+
let commandChain = chain();
|
|
232
|
+
if (false !== options.restoreFocus) commandChain = commandChain.focus();
|
|
233
|
+
for (const nodeType of nodeTypes)commandChain = commandChain.updateAttributes(nodeType, attributes);
|
|
234
|
+
return commandChain.run();
|
|
235
|
+
}
|
|
236
|
+
function setDocumentParagraphSpacingCommand({ chain, editor }, spacing, options) {
|
|
237
|
+
const nodeTypes = activeParagraphNodeTypes(editor);
|
|
238
|
+
if (!nodeTypes.length) return false;
|
|
239
|
+
const lineHeight = normalizedLineHeight(spacing.lineHeight);
|
|
240
|
+
const attributes = {
|
|
241
|
+
spaceBefore: normalizedPointSpacing(spacing.before),
|
|
242
|
+
spaceAfter: normalizedPointSpacing(spacing.after),
|
|
243
|
+
lineHeight,
|
|
244
|
+
lineRule: normalizedLineRule(spacing.lineRule) ?? (lineHeight ? lineRuleForLineHeight(lineHeight) : null)
|
|
245
|
+
};
|
|
246
|
+
let commandChain = chain();
|
|
247
|
+
if (false !== options.restoreFocus) commandChain = commandChain.focus();
|
|
248
|
+
for (const nodeType of nodeTypes)commandChain = commandChain.updateAttributes(nodeType, attributes);
|
|
249
|
+
return commandChain.run();
|
|
250
|
+
}
|
|
251
|
+
function clearDocumentFormattingCommand({ chain, editor }) {
|
|
252
|
+
let commandChain = chain().focus().unsetAllMarks();
|
|
253
|
+
if (!editor.isActive('listItem')) commandChain = commandChain.setParagraph();
|
|
254
|
+
return commandChain.unsetTextAlign().updateAttributes('paragraph', {
|
|
255
|
+
indentLevel: 0,
|
|
256
|
+
rightIndent: 0,
|
|
257
|
+
firstLineIndent: 0,
|
|
258
|
+
lineHeight: null,
|
|
259
|
+
lineRule: null,
|
|
260
|
+
paragraphDirection: null,
|
|
261
|
+
spaceBefore: null,
|
|
262
|
+
spaceAfter: null,
|
|
263
|
+
keepLines: null,
|
|
264
|
+
keepWithNext: null,
|
|
265
|
+
pageBreakBefore: null,
|
|
266
|
+
widowControl: null,
|
|
267
|
+
tabStops: null
|
|
268
|
+
}).updateAttributes('listItem', {
|
|
269
|
+
paragraphDirection: null
|
|
270
|
+
}).run();
|
|
271
|
+
}
|
|
272
|
+
function parsedIndentLevel(dataValue, marginLeft) {
|
|
273
|
+
if (dataValue) return normalizedIndentLevel(dataValue);
|
|
274
|
+
const pixels = cssPixels(marginLeft);
|
|
275
|
+
return normalizedIndentLevel(pixels ? Math.round(pixels / DOCUMENT_INDENT_STEP_PX) : 0);
|
|
276
|
+
}
|
|
277
|
+
function normalizedIndentLevel(value) {
|
|
278
|
+
const number = Number(value);
|
|
279
|
+
if (!Number.isFinite(number)) return 0;
|
|
280
|
+
return Math.min(MAX_DOCUMENT_INDENT_LEVEL, Math.max(0, Math.round(4 * number) / 4));
|
|
281
|
+
}
|
|
282
|
+
function normalizedLineHeight(value) {
|
|
283
|
+
if ('string' != typeof value) return null;
|
|
284
|
+
const normalized = value.trim();
|
|
285
|
+
if (!normalized || 'normal' === normalized) return null;
|
|
286
|
+
return /^(?:\d+(?:\.\d+)?|\d+(?:\.\d+)?(?:px|pt|%))$/i.test(normalized) ? normalized : null;
|
|
287
|
+
}
|
|
288
|
+
function normalizedLineRule(value) {
|
|
289
|
+
if ('auto' === value || 'exact' === value || 'atLeast' === value) return value;
|
|
290
|
+
if ('exactly' === value) return 'exact';
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
function lineRuleForLineHeight(value) {
|
|
294
|
+
return /(?:px|pt)$/i.test(value) ? 'exact' : 'auto';
|
|
295
|
+
}
|
|
296
|
+
function pointSpacingAttribute(modelKey, datasetKey, htmlName, cssProperty) {
|
|
297
|
+
return {
|
|
298
|
+
default: null,
|
|
299
|
+
parseHTML: (element)=>parsedPointSpacing(element.dataset[datasetKey], 'margin-top' === cssProperty ? element.style.marginTop : element.style.marginBottom),
|
|
300
|
+
renderHTML: (attributes)=>{
|
|
301
|
+
const value = normalizedPointSpacing(attributes[modelKey]);
|
|
302
|
+
if (null === value) return {};
|
|
303
|
+
const formatted = formatPointValue(value);
|
|
304
|
+
return {
|
|
305
|
+
[htmlName]: formatted,
|
|
306
|
+
style: `${cssProperty}: ${formatted}pt`
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function parsedPointSpacing(dataValue, cssValue) {
|
|
312
|
+
if (void 0 !== dataValue) return normalizedPointSpacing(dataValue);
|
|
313
|
+
const match = /^(-?\d+(?:\.\d+)?)(px|pt|mm|cm|in)?$/i.exec(cssValue.trim());
|
|
314
|
+
if (!match) return null;
|
|
315
|
+
const amount = Number(match[1]);
|
|
316
|
+
if (!Number.isFinite(amount)) return null;
|
|
317
|
+
const unit = match[2]?.toLowerCase() ?? 'px';
|
|
318
|
+
const points = 'pt' === unit ? amount : 'mm' === unit ? 72 * amount / 25.4 : 'cm' === unit ? 72 * amount / 2.54 : 'in' === unit ? 72 * amount : 0.75 * amount;
|
|
319
|
+
return normalizedPointSpacing(points);
|
|
320
|
+
}
|
|
321
|
+
function normalizedPointSpacing(value) {
|
|
322
|
+
if (null == value || '' === value) return null;
|
|
323
|
+
const number = Number(value);
|
|
324
|
+
if (!Number.isFinite(number)) return null;
|
|
325
|
+
return Math.min(720, Math.max(0, Math.round(4 * number) / 4));
|
|
326
|
+
}
|
|
327
|
+
function formatPointValue(value) {
|
|
328
|
+
return Number(value.toFixed(2)).toString();
|
|
329
|
+
}
|
|
330
|
+
function cssPixels(value) {
|
|
331
|
+
const match = /^(-?\d+(?:\.\d+)?)(px|pt)?$/i.exec(value.trim());
|
|
332
|
+
if (!match) return 0;
|
|
333
|
+
const amount = Number(match[1]);
|
|
334
|
+
if (!Number.isFinite(amount)) return 0;
|
|
335
|
+
return match[2]?.toLowerCase() === 'pt' ? amount / 0.75 : amount;
|
|
336
|
+
}
|
|
337
|
+
function parsedIndentPixels(dataValue, cssValue) {
|
|
338
|
+
return normalizedIndentPixels(void 0 === dataValue ? cssPixels(cssValue) : dataValue);
|
|
339
|
+
}
|
|
340
|
+
function parsedSignedIndentPixels(dataValue, cssValue) {
|
|
341
|
+
return normalizedSignedIndentPixels(void 0 === dataValue ? cssPixels(cssValue) : dataValue);
|
|
342
|
+
}
|
|
343
|
+
function normalizedIndentPixels(value) {
|
|
344
|
+
const number = Number(value);
|
|
345
|
+
if (!Number.isFinite(number)) return 0;
|
|
346
|
+
return Math.min(MAX_DOCUMENT_INDENT_PX, Math.max(0, Math.round(number)));
|
|
347
|
+
}
|
|
348
|
+
function normalizedSignedIndentPixels(value) {
|
|
349
|
+
const number = Number(value);
|
|
350
|
+
if (!Number.isFinite(number)) return 0;
|
|
351
|
+
return Math.min(MAX_DOCUMENT_INDENT_PX, Math.max(-MAX_DOCUMENT_INDENT_PX, Math.round(number)));
|
|
352
|
+
}
|
|
353
|
+
function normalizedFirstLineIndent(value, leftIndent) {
|
|
354
|
+
return Math.max(-leftIndent, Math.min(MAX_DOCUMENT_INDENT_PX, normalizedSignedIndentPixels(value)));
|
|
355
|
+
}
|
|
356
|
+
function formatPixelValue(value) {
|
|
357
|
+
return Number(value.toFixed(2)).toString();
|
|
358
|
+
}
|
|
359
|
+
function activeParagraphAttributes(editor) {
|
|
360
|
+
return editor.isActive('heading') ? editor.getAttributes('heading') : editor.getAttributes('paragraph');
|
|
361
|
+
}
|
|
362
|
+
function paragraphDirectionAttribute() {
|
|
363
|
+
return {
|
|
364
|
+
default: null,
|
|
365
|
+
parseHTML: (element)=>normalizeDocumentParagraphDirection(element.getAttribute('dir') ?? element.style.direction),
|
|
366
|
+
renderHTML: (attributes)=>{
|
|
367
|
+
const direction = normalizeDocumentParagraphDirection(attributes.paragraphDirection);
|
|
368
|
+
return direction ? {
|
|
369
|
+
dir: direction
|
|
370
|
+
} : {};
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function directBooleanAttribute(modelKey, datasetKey, htmlName) {
|
|
375
|
+
return {
|
|
376
|
+
default: null,
|
|
377
|
+
parseHTML: (element)=>directBoolean(element.dataset[datasetKey]),
|
|
378
|
+
renderHTML: (attributes)=>{
|
|
379
|
+
const value = directBoolean(attributes[modelKey]);
|
|
380
|
+
return null === value ? {} : {
|
|
381
|
+
[htmlName]: String(value)
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
const documentParagraphPaginationKeys = [
|
|
387
|
+
'keepLines',
|
|
388
|
+
'keepWithNext',
|
|
389
|
+
'pageBreakBefore',
|
|
390
|
+
'widowControl'
|
|
391
|
+
];
|
|
392
|
+
function directBoolean(value) {
|
|
393
|
+
if (true === value || 'true' === value || '1' === value) return true;
|
|
394
|
+
if (false === value || 'false' === value || '0' === value) return false;
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
function activeParagraphNodeTypes(editor) {
|
|
398
|
+
const nodeTypes = new Set();
|
|
399
|
+
if (editor.isActive('paragraph')) nodeTypes.add('paragraph');
|
|
400
|
+
if (editor.isActive('heading')) nodeTypes.add('heading');
|
|
401
|
+
const { from, to } = editor.state.selection;
|
|
402
|
+
if (from !== to) editor.state.doc.nodesBetween(from, to, (node)=>{
|
|
403
|
+
if ('paragraph' === node.type.name) nodeTypes.add('paragraph');
|
|
404
|
+
if ('heading' === node.type.name) nodeTypes.add('heading');
|
|
405
|
+
});
|
|
406
|
+
return [
|
|
407
|
+
...nodeTypes
|
|
408
|
+
];
|
|
409
|
+
}
|
|
410
|
+
function activeParagraphDirectionNodeTypes(editor) {
|
|
411
|
+
const { from, to } = editor.state.selection;
|
|
412
|
+
if (from === to) return editor.isActive('listItem') ? [
|
|
413
|
+
'listItem'
|
|
414
|
+
] : activeParagraphNodeTypes(editor);
|
|
415
|
+
const nodeTypes = new Set();
|
|
416
|
+
editor.state.doc.nodesBetween(from, to, (node, _position, parent)=>{
|
|
417
|
+
if ('listItem' === node.type.name) nodeTypes.add('listItem');
|
|
418
|
+
if ('paragraph' === node.type.name && parent?.type.name !== 'listItem') nodeTypes.add('paragraph');
|
|
419
|
+
if ('heading' === node.type.name) nodeTypes.add('heading');
|
|
420
|
+
});
|
|
421
|
+
return [
|
|
422
|
+
...nodeTypes
|
|
423
|
+
];
|
|
424
|
+
}
|
|
425
|
+
export { DocumentParagraphFormatting, canChangeDocumentIndent, documentParagraphDirection, documentParagraphIndent, documentParagraphPagination, documentParagraphSpacing, normalizeDocumentParagraphIndent };
|