oasis-editor 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/__tests__/app/PersistenceService.test.d.ts +1 -0
- package/dist/__tests__/app/footnoteUiCommands.test.d.ts +1 -0
- package/dist/__tests__/commands/text.test.d.ts +1 -0
- package/dist/__tests__/core/editorPluginIntegration.test.d.ts +1 -0
- package/dist/__tests__/core/editorState.test.d.ts +1 -0
- package/dist/__tests__/core/footnotes.test.d.ts +1 -0
- package/dist/__tests__/core/model.test.d.ts +1 -0
- package/dist/__tests__/core/pluginCollection.test.d.ts +1 -0
- package/dist/__tests__/core/tableCommands.test.d.ts +1 -0
- package/dist/__tests__/export/docxExport.test.d.ts +1 -0
- package/dist/__tests__/export/footnotesExport.test.d.ts +1 -0
- package/dist/__tests__/export/pdfWriter.test.d.ts +1 -0
- package/dist/__tests__/export/underlineStyle.test.d.ts +1 -0
- package/dist/__tests__/import/docxComplexSmoke.test.d.ts +1 -0
- package/dist/__tests__/import/docxImport.test.d.ts +1 -0
- package/dist/__tests__/import/footnotesImport.test.d.ts +1 -0
- package/dist/__tests__/integration/documentFlow.test.d.ts +1 -0
- package/dist/__tests__/ui/CanvasTableLayout.test.d.ts +1 -0
- package/dist/__tests__/ui/canvasHitTestService.test.d.ts +1 -0
- package/dist/__tests__/ui/canvasLayoutSnapshot.test.d.ts +1 -0
- package/dist/__tests__/ui/canvasSelectionGeometry.test.d.ts +1 -0
- package/dist/__tests__/ui/canvasTextRendering.test.d.ts +1 -0
- package/dist/__tests__/ui/composeMeasuredParagraphLines.test.d.ts +1 -0
- package/dist/__tests__/ui/dialog.test.d.ts +1 -0
- package/dist/__tests__/ui/fontDialog.test.d.ts +1 -0
- package/dist/__tests__/ui/footnotesLayout.test.d.ts +1 -0
- package/dist/__tests__/ui/layoutIdentity.test.d.ts +1 -0
- package/dist/__tests__/ui/layoutProjection.test.d.ts +1 -0
- package/dist/__tests__/ui/registry.test.d.ts +1 -0
- package/dist/__tests__/ui/tabs.test.d.ts +1 -0
- package/dist/__tests__/ui/textMeasurementAlignment.test.d.ts +1 -0
- package/dist/__tests__/word-parity/fixtures/corpus.d.ts +10 -0
- package/dist/__tests__/word-parity/fixtures/loremFixtures.d.ts +8 -0
- package/dist/__tests__/word-parity/wordLayout.word-parity.d.ts +1 -0
- package/dist/app/bootstrap/createOasisEditorApp.d.ts +6 -0
- package/dist/app/bootstrap/createOasisEditorContainer.d.ts +6 -0
- package/dist/app/clipboard/htmlClipboardParser.d.ts +3 -0
- package/dist/app/controllers/EditorCommandRegistry.d.ts +23 -0
- package/dist/app/controllers/EditorCommandsController.d.ts +53 -0
- package/dist/app/controllers/documentIO/DocumentExporter.d.ts +11 -0
- package/dist/app/controllers/documentIO/DocumentImporter.d.ts +17 -0
- package/dist/app/controllers/documentIO/ImageInsertionService.d.ts +14 -0
- package/dist/app/controllers/documentIO/downloadBlob.d.ts +1 -0
- package/dist/app/controllers/tableOpsCellSpanCommands.d.ts +21 -0
- package/dist/app/controllers/tableOpsGuards.d.ts +19 -0
- package/dist/app/controllers/tableOpsMutationCommands.d.ts +4 -0
- package/dist/app/controllers/tableOpsRowColumnCommands.d.ts +12 -0
- package/dist/app/controllers/tableOpsSelectionAwareCommands.d.ts +20 -0
- package/dist/app/controllers/tableOpsSelectionNavigation.d.ts +7 -0
- package/dist/app/controllers/tableOpsSelectionRanges.d.ts +34 -0
- package/dist/app/controllers/useEditorClipboard.d.ts +28 -0
- package/dist/app/controllers/useEditorDocumentIO.d.ts +31 -0
- package/dist/app/controllers/useEditorFindReplace.d.ts +28 -0
- package/dist/app/controllers/useEditorHistoryActions.d.ts +21 -0
- package/dist/app/controllers/useEditorImageOperations.d.ts +72 -0
- package/dist/app/controllers/useEditorKeyboard.d.ts +50 -0
- package/dist/app/controllers/useEditorLayout.d.ts +42 -0
- package/dist/app/controllers/useEditorNavigation.d.ts +22 -0
- package/dist/app/controllers/useEditorPersistence.d.ts +16 -0
- package/dist/app/controllers/useEditorRevision.d.ts +12 -0
- package/dist/app/controllers/useEditorStyle.d.ts +23 -0
- package/dist/app/controllers/useEditorSurfaceEvents.d.ts +44 -0
- package/dist/app/controllers/useEditorTableDrag.d.ts +29 -0
- package/dist/app/controllers/useEditorTableOperations.d.ts +45 -0
- package/dist/app/controllers/useEditorTableResize.d.ts +32 -0
- package/dist/app/controllers/useEditorTextDrag.d.ts +38 -0
- package/dist/app/controllers/useEditorTextInput.d.ts +27 -0
- package/dist/app/services/FindReplaceService.d.ts +12 -0
- package/dist/app/services/PersistenceService.d.ts +11 -0
- package/dist/assets/Arimo-Bold.ttf +0 -0
- package/dist/assets/Arimo-BoldItalic.ttf +0 -0
- package/dist/assets/Arimo-Italic.ttf +0 -0
- package/dist/assets/Arimo-Regular.ttf +0 -0
- package/dist/assets/Carlito-Bold.ttf +0 -0
- package/dist/assets/Carlito-BoldItalic.ttf +0 -0
- package/dist/assets/Carlito-Italic.ttf +0 -0
- package/dist/assets/Carlito-Regular.ttf +0 -0
- package/dist/assets/Roboto-Italic.ttf +0 -0
- package/dist/assets/Roboto-Medium.ttf +0 -0
- package/dist/assets/Roboto-MediumItalic.ttf +0 -0
- package/dist/assets/Roboto-Regular.ttf +0 -0
- package/dist/assets/Tinos-Bold.ttf +0 -0
- package/dist/assets/Tinos-BoldItalic.ttf +0 -0
- package/dist/assets/Tinos-Italic.ttf +0 -0
- package/dist/assets/Tinos-Regular.ttf +0 -0
- package/dist/assets/importDocxWorker-DIQ28Lka.js +12 -0
- package/dist/core/Editor.d.ts +33 -0
- package/dist/core/cloneState.d.ts +8 -0
- package/dist/core/commands/CommandBus.d.ts +9 -0
- package/dist/core/commands/CommandRef.d.ts +10 -0
- package/dist/core/commands/CommandRegistry.d.ts +10 -0
- package/dist/core/commands/block.d.ts +11 -0
- package/dist/core/commands/clipboard.d.ts +13 -0
- package/dist/core/commands/footnotes.d.ts +27 -0
- package/dist/core/commands/history.d.ts +7 -0
- package/dist/core/commands/image.d.ts +15 -0
- package/dist/core/commands/link.d.ts +4 -0
- package/dist/core/commands/list.d.ts +10 -0
- package/dist/core/commands/misc.d.ts +3 -0
- package/dist/core/commands/selection.d.ts +12 -0
- package/dist/core/commands/table.d.ts +10 -0
- package/dist/core/commands/text.d.ts +12 -0
- package/dist/core/commands/utils.d.ts +69 -0
- package/dist/core/editorCommands.d.ts +14 -0
- package/dist/core/editorState.d.ts +66 -0
- package/dist/core/engine.d.ts +13 -0
- package/dist/core/footnotes.d.ts +42 -0
- package/dist/core/headings.d.ts +9 -0
- package/dist/core/model/queries.d.ts +8 -0
- package/dist/core/model.d.ts +447 -0
- package/dist/core/plugin.d.ts +64 -0
- package/dist/core/plugins/PluginCollection.d.ts +16 -0
- package/dist/core/selection.d.ts +19 -0
- package/dist/core/tableLayout.d.ts +13 -0
- package/dist/core/textStyleMappings.d.ts +8 -0
- package/dist/core/wordBoundaries.d.ts +7 -0
- package/dist/demo/OasisSiteApp.d.ts +1 -0
- package/dist/export/docx/docxTypes.d.ts +66 -0
- package/dist/export/docx/exportEditorDocumentToDocx.d.ts +4 -0
- package/dist/export/docx/footnotesXml.d.ts +40 -0
- package/dist/export/docx/tableXml.d.ts +4 -0
- package/dist/export/docx/textXml.d.ts +6 -0
- package/dist/export/docx/xmlUtils.d.ts +10 -0
- package/dist/export/pdf/OasisPdfWriter.d.ts +93 -0
- package/dist/export/pdf/draw/drawBlockList.d.ts +5 -0
- package/dist/export/pdf/draw/drawFragment.d.ts +7 -0
- package/dist/export/pdf/draw/drawPageBackground.d.ts +3 -0
- package/dist/export/pdf/draw/drawParagraph.d.ts +5 -0
- package/dist/export/pdf/draw/drawTable.d.ts +5 -0
- package/dist/export/pdf/draw/fragmentGeometry.d.ts +12 -0
- package/dist/export/pdf/draw/lists.d.ts +6 -0
- package/dist/export/pdf/exportEditorDocumentToPdf.d.ts +4 -0
- package/dist/export/pdf/fonts/PdfFontRegistry.d.ts +28 -0
- package/dist/export/pdf/fonts/collectPdfFontFamilies.d.ts +3 -0
- package/dist/export/pdf/images.d.ts +4 -0
- package/dist/export/pdf/layout/PdfTextMeasurer.d.ts +24 -0
- package/dist/export/pdf/layout/layoutParagraph.d.ts +37 -0
- package/dist/export/pdf/units.d.ts +6 -0
- package/dist/i18n/index.d.ts +7 -0
- package/dist/i18n/locales/en.d.ts +251 -0
- package/dist/i18n/locales/pt-BR.d.ts +251 -0
- package/dist/import/docx/assetRegistry.d.ts +18 -0
- package/dist/import/docx/footnotes.d.ts +17 -0
- package/dist/import/docx/headerFooter.d.ts +7 -0
- package/dist/import/docx/importDocxInWorker.d.ts +8 -0
- package/dist/import/docx/importDocxToEditorDocument.d.ts +7 -0
- package/dist/import/docx/importDocxWorker.d.ts +1 -0
- package/dist/import/docx/numbering.d.ts +9 -0
- package/dist/import/docx/paragraphs.d.ts +12 -0
- package/dist/import/docx/relationships.d.ts +4 -0
- package/dist/import/docx/runs.d.ts +41 -0
- package/dist/import/docx/sectionProperties.d.ts +16 -0
- package/dist/import/docx/settings.d.ts +4 -0
- package/dist/import/docx/styles.d.ts +24 -0
- package/dist/import/docx/tables.d.ts +8 -0
- package/dist/import/docx/themeFonts.d.ts +12 -0
- package/dist/import/docx/units.d.ts +9 -0
- package/dist/import/docx/xmlHelpers.d.ts +15 -0
- package/dist/index.d.ts +43 -0
- package/dist/layoutProjection/blockHeights.d.ts +1 -0
- package/dist/layoutProjection/blocksPagination.d.ts +18 -0
- package/dist/layoutProjection/constants.d.ts +1 -0
- package/dist/layoutProjection/documentLayout.d.ts +7 -0
- package/dist/layoutProjection/footnotePagination.d.ts +21 -0
- package/dist/layoutProjection/headerFooterFootnotes.d.ts +4 -0
- package/dist/layoutProjection/headerFooterProjection.d.ts +14 -0
- package/dist/layoutProjection/index.d.ts +7 -0
- package/dist/layoutProjection/paragraphPagination.d.ts +20 -0
- package/dist/layoutProjection/paragraphProjection.d.ts +1 -0
- package/dist/layoutProjection/sectionPagination.d.ts +35 -0
- package/dist/layoutProjection/tablePagination.d.ts +14 -0
- package/dist/layoutProjection/tableProjection.d.ts +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/oasis-editor.css +1 -0
- package/dist/oasis-editor.js +80464 -0
- package/dist/oasis-editor.umd.cjs +24 -0
- package/dist/plugins/internal/createEssentialsPlugin.d.ts +135 -0
- package/dist/plugins/internal/essentialsCommandBuilders.d.ts +10 -0
- package/dist/plugins/internal/essentialsCommandGroups.d.ts +39 -0
- package/dist/testing/wordLayoutParity.d.ts +62 -0
- package/dist/ui/OasisEditorApp.d.ts +4 -0
- package/dist/ui/OasisEditorAppProps.d.ts +49 -0
- package/dist/ui/OasisEditorContainer.d.ts +6 -0
- package/dist/ui/OasisEditorEditor.d.ts +103 -0
- package/dist/ui/app/EditorDialogsLayer.d.ts +26 -0
- package/dist/ui/app/EditorDragLayers.d.ts +20 -0
- package/dist/ui/app/EditorWorkspace.d.ts +37 -0
- package/dist/ui/app/buildEditorViewProps.d.ts +59 -0
- package/dist/ui/app/createEditorEssentialsPlugin.d.ts +42 -0
- package/dist/ui/app/createRuntimeCommandHost.d.ts +29 -0
- package/dist/ui/app/fontOptions.d.ts +5 -0
- package/dist/ui/app/shouldShowCaret.d.ts +9 -0
- package/dist/ui/app/useCanvasSurfaceHitResolver.d.ts +16 -0
- package/dist/ui/app/useEditorAppState.d.ts +11 -0
- package/dist/ui/app/useEditorContextMenuClipboard.d.ts +33 -0
- package/dist/ui/app/useEditorDialogs.d.ts +38 -0
- package/dist/ui/app/useEditorFocus.d.ts +11 -0
- package/dist/ui/app/useEditorFontOptions.d.ts +17 -0
- package/dist/ui/app/useEditorInteractionWiring.d.ts +64 -0
- package/dist/ui/app/useEditorRuntimeBootstrap.d.ts +33 -0
- package/dist/ui/app/useEditorRuntimePlugins.d.ts +14 -0
- package/dist/ui/app/useEditorTransactions.d.ts +20 -0
- package/dist/ui/app/useEditorUiOptions.d.ts +24 -0
- package/dist/ui/app/useFontDialogBridge.d.ts +31 -0
- package/dist/ui/canvas/CanvasDebug.d.ts +125 -0
- package/dist/ui/canvas/CanvasGeometry.d.ts +35 -0
- package/dist/ui/canvas/CanvasHitTestService.d.ts +37 -0
- package/dist/ui/canvas/CanvasLayoutSnapshot.d.ts +93 -0
- package/dist/ui/canvas/CanvasSelectionGeometry.d.ts +20 -0
- package/dist/ui/canvas/CanvasTableLayout.d.ts +65 -0
- package/dist/ui/canvas/canvasBlockPainter.d.ts +4 -0
- package/dist/ui/canvas/canvasImageCache.d.ts +1 -0
- package/dist/ui/canvas/canvasPageRenderer.d.ts +18 -0
- package/dist/ui/canvas/canvasParagraphPainter.d.ts +12 -0
- package/dist/ui/canvas/canvasTablePainter.d.ts +3 -0
- package/dist/ui/canvas/listNumbering.d.ts +3 -0
- package/dist/ui/caretGeometry.d.ts +30 -0
- package/dist/ui/clipboardImage.d.ts +2 -0
- package/dist/ui/components/CanvasEditorSurface.d.ts +5 -0
- package/dist/ui/components/CaretOverlay.d.ts +9 -0
- package/dist/ui/components/ContextMenu/ContextMenu.d.ts +19 -0
- package/dist/ui/components/Dialogs/Dialog.d.ts +17 -0
- package/dist/ui/components/Dialogs/FontDialog.d.ts +67 -0
- package/dist/ui/components/Dialogs/FontDialogModel.d.ts +15 -0
- package/dist/ui/components/Dialogs/ImageAltDialog.d.ts +8 -0
- package/dist/ui/components/Dialogs/LineSpacingDialog.d.ts +17 -0
- package/dist/ui/components/Dialogs/LinkDialog.d.ts +8 -0
- package/dist/ui/components/DropCaret.d.ts +16 -0
- package/dist/ui/components/FindReplace/FindReplaceDialog.d.ts +7 -0
- package/dist/ui/components/FloatingToolbar/FloatingTableToolbar.d.ts +11 -0
- package/dist/ui/components/Menubar/Menubar.d.ts +7 -0
- package/dist/ui/components/Menubar/defaultMenuItems.d.ts +3 -0
- package/dist/ui/components/Menubar/menuRegistry.d.ts +28 -0
- package/dist/ui/components/Outline/OutlinePanel.d.ts +10 -0
- package/dist/ui/components/PageBreak.d.ts +4 -0
- package/dist/ui/components/RevisionOverlay.d.ts +6 -0
- package/dist/ui/components/SelectionOverlay.d.ts +11 -0
- package/dist/ui/components/Tabs/Tabs.d.ts +18 -0
- package/dist/ui/components/TitleBar/TitleBar.d.ts +6 -0
- package/dist/ui/components/Toolbar/LineSpacingButton.d.ts +6 -0
- package/dist/ui/components/Toolbar/Toolbar.d.ts +15 -0
- package/dist/ui/components/Toolbar/ToolbarOverflowManager.d.ts +13 -0
- package/dist/ui/components/Toolbar/controls/ListOptionsControl.d.ts +7 -0
- package/dist/ui/components/Toolbar/controls/UnderlineControl.d.ts +10 -0
- package/dist/ui/components/Toolbar/groups/MetricGroup.d.ts +6 -0
- package/dist/ui/components/Toolbar/groups/SectionGroup.d.ts +6 -0
- package/dist/ui/components/Toolbar/groups/TableGroup.d.ts +6 -0
- package/dist/ui/components/Toolbar/presets/defaultPalette.d.ts +4 -0
- package/dist/ui/components/Toolbar/presets/defaultToolbar.d.ts +9 -0
- package/dist/ui/components/Toolbar/primitives/Button.d.ts +11 -0
- package/dist/ui/components/Toolbar/primitives/ColorPicker.d.ts +22 -0
- package/dist/ui/components/Toolbar/primitives/GridPicker.d.ts +12 -0
- package/dist/ui/components/Toolbar/primitives/Menu.d.ts +20 -0
- package/dist/ui/components/Toolbar/primitives/Popover.d.ts +34 -0
- package/dist/ui/components/Toolbar/primitives/Select.d.ts +12 -0
- package/dist/ui/components/Toolbar/primitives/Separator.d.ts +6 -0
- package/dist/ui/components/Toolbar/primitives/SplitButton.d.ts +30 -0
- package/dist/ui/components/Toolbar/primitives/useDismiss.d.ts +15 -0
- package/dist/ui/components/Toolbar/primitives/usePopoverPosition.d.ts +31 -0
- package/dist/ui/components/Toolbar/registry/ToolbarRegistry.d.ts +23 -0
- package/dist/ui/components/Toolbar/renderers/ToolbarItemRenderer.d.ts +13 -0
- package/dist/ui/components/Toolbar/renderers/renderers.d.ts +14 -0
- package/dist/ui/components/Toolbar/schema/items.d.ts +136 -0
- package/dist/ui/components/Toolbar/schema/palette.d.ts +15 -0
- package/dist/ui/components/Toolbar/state/bindItem.d.ts +28 -0
- package/dist/ui/components/Toolbar/state/createToolbarApi.d.ts +14 -0
- package/dist/ui/components/Toolbar/underlineStyles.d.ts +16 -0
- package/dist/ui/editorHistory.d.ts +25 -0
- package/dist/ui/editorUiTypes.d.ts +65 -0
- package/dist/ui/imageGeometry.d.ts +15 -0
- package/dist/ui/layoutIdentity.d.ts +23 -0
- package/dist/ui/layoutInvalidation.d.ts +9 -0
- package/dist/ui/mount.d.ts +10 -0
- package/dist/ui/shells/BalloonShell.d.ts +3 -0
- package/dist/ui/shells/DocumentShell.d.ts +29 -0
- package/dist/ui/shells/InlineShell.d.ts +3 -0
- package/dist/ui/tableGeometry.d.ts +16 -0
- package/dist/ui/tableUiUtils.d.ts +5 -0
- package/dist/ui/textMeasurement.d.ts +14 -0
- package/dist/ui/toolbarStyleState.d.ts +46 -0
- package/dist/ui/utils/IconManager.d.ts +2 -0
- package/dist/utils/indexeddb.d.ts +12 -0
- package/dist/utils/logger.d.ts +22 -0
- package/dist/utils/performanceMetrics.d.ts +58 -0
- package/dist/utils/throttle.d.ts +4 -0
- package/package.json +65 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
export type EditorUnderlineStyle = "single" | "double" | "thick" | "dotted" | "dottedHeavy" | "dash" | "dashedHeavy" | "dashLong" | "dashLongHeavy" | "dotDash" | "dashDotHeavy" | "dotDotDash" | "dashDotDotHeavy" | "wave" | "wavyHeavy" | "wavyDouble" | "words";
|
|
2
|
+
export type EditorLigatures = "none" | "standard" | "contextual" | "historical" | "standardContextual";
|
|
3
|
+
export type EditorNumberSpacing = "default" | "proportional" | "tabular";
|
|
4
|
+
export type EditorNumberForm = "default" | "lining" | "oldStyle";
|
|
5
|
+
export interface EditorTextStyle {
|
|
6
|
+
styleId?: string;
|
|
7
|
+
bold?: boolean;
|
|
8
|
+
italic?: boolean;
|
|
9
|
+
underline?: boolean;
|
|
10
|
+
underlineStyle?: EditorUnderlineStyle | null;
|
|
11
|
+
underlineColor?: string | null;
|
|
12
|
+
strike?: boolean;
|
|
13
|
+
doubleStrike?: boolean;
|
|
14
|
+
superscript?: boolean;
|
|
15
|
+
subscript?: boolean;
|
|
16
|
+
smallCaps?: boolean;
|
|
17
|
+
allCaps?: boolean;
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
characterScale?: number | null;
|
|
20
|
+
characterSpacing?: number | null;
|
|
21
|
+
baselineShift?: number | null;
|
|
22
|
+
kerningThreshold?: number | null;
|
|
23
|
+
ligatures?: EditorLigatures | null;
|
|
24
|
+
numberSpacing?: EditorNumberSpacing | null;
|
|
25
|
+
numberForm?: EditorNumberForm | null;
|
|
26
|
+
stylisticSet?: number | null;
|
|
27
|
+
contextualAlternates?: boolean;
|
|
28
|
+
fontFamily?: string | null;
|
|
29
|
+
fontSize?: number | null;
|
|
30
|
+
color?: string | null;
|
|
31
|
+
highlight?: string | null;
|
|
32
|
+
link?: string | null;
|
|
33
|
+
}
|
|
34
|
+
export interface EditorTabStop {
|
|
35
|
+
position: number;
|
|
36
|
+
type: "left" | "center" | "right" | "decimal" | "bar" | "clear";
|
|
37
|
+
leader?: "none" | "dot" | "hyphen" | "underscore" | "heavy" | "middleDot";
|
|
38
|
+
}
|
|
39
|
+
export interface EditorParagraphStyle {
|
|
40
|
+
styleId?: string;
|
|
41
|
+
align?: "left" | "center" | "right" | "justify";
|
|
42
|
+
spacingBefore?: number | null;
|
|
43
|
+
spacingAfter?: number | null;
|
|
44
|
+
lineHeight?: number | null;
|
|
45
|
+
lineGridPitch?: number | null;
|
|
46
|
+
lineGridType?: "lines" | "linesAndChars" | "snapToChars" | "implicit" | null;
|
|
47
|
+
snapToGrid?: boolean;
|
|
48
|
+
indentLeft?: number | null;
|
|
49
|
+
indentRight?: number | null;
|
|
50
|
+
indentFirstLine?: number | null;
|
|
51
|
+
indentHanging?: number | null;
|
|
52
|
+
shading?: string | null;
|
|
53
|
+
borderTop?: EditorBorderStyle | null;
|
|
54
|
+
borderRight?: EditorBorderStyle | null;
|
|
55
|
+
borderBottom?: EditorBorderStyle | null;
|
|
56
|
+
borderLeft?: EditorBorderStyle | null;
|
|
57
|
+
tabs?: EditorTabStop[] | null;
|
|
58
|
+
pageBreakBefore?: boolean;
|
|
59
|
+
keepWithNext?: boolean;
|
|
60
|
+
keepLinesTogether?: boolean;
|
|
61
|
+
widowControl?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface EditorNamedStyle {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
type: "paragraph" | "character" | "table";
|
|
67
|
+
basedOn?: string;
|
|
68
|
+
nextStyle?: string;
|
|
69
|
+
paragraphStyle?: EditorParagraphStyle;
|
|
70
|
+
textStyle?: EditorTextStyle;
|
|
71
|
+
tableStyle?: EditorTableStyle;
|
|
72
|
+
}
|
|
73
|
+
export interface EditorParagraphListStyle {
|
|
74
|
+
kind: "bullet" | "ordered";
|
|
75
|
+
level?: number;
|
|
76
|
+
format?: "decimal" | "lowerLetter" | "upperLetter" | "lowerRoman" | "upperRoman" | "bullet";
|
|
77
|
+
startAt?: number;
|
|
78
|
+
}
|
|
79
|
+
export interface EditorImageRunData {
|
|
80
|
+
src: string;
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
alt?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface EditorFieldData {
|
|
86
|
+
type: "PAGE" | "NUMPAGES";
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Inline reference to a footnote body stored in `EditorDocument.footnotes`.
|
|
90
|
+
* The `run.text` carries the materialized marker (e.g. "1", "2", "*") so
|
|
91
|
+
* layout, hit-testing and export can treat the run as ordinary text.
|
|
92
|
+
*
|
|
93
|
+
* Renumbering rewrites `run.text` to keep markers in sync with document
|
|
94
|
+
* order. `customMark` (mapped from DOCX `w:customMarkFollows`) signals a
|
|
95
|
+
* user-provided marker that should not be auto-numbered.
|
|
96
|
+
*/
|
|
97
|
+
export interface EditorFootnoteReferenceData {
|
|
98
|
+
footnoteId: string;
|
|
99
|
+
customMark?: string;
|
|
100
|
+
}
|
|
101
|
+
export interface EditorRevision {
|
|
102
|
+
id: string;
|
|
103
|
+
type: "insert" | "delete";
|
|
104
|
+
author: string;
|
|
105
|
+
date: number;
|
|
106
|
+
}
|
|
107
|
+
export interface EditorTextRun {
|
|
108
|
+
id: string;
|
|
109
|
+
text: string;
|
|
110
|
+
styles?: EditorTextStyle;
|
|
111
|
+
image?: EditorImageRunData;
|
|
112
|
+
field?: EditorFieldData;
|
|
113
|
+
revision?: EditorRevision;
|
|
114
|
+
/**
|
|
115
|
+
* When set, this run is the inline marker of a footnote whose body lives in
|
|
116
|
+
* `EditorDocument.footnotes.items[footnoteReference.footnoteId]`. The run
|
|
117
|
+
* should be treated as atomic for selection/editing purposes.
|
|
118
|
+
*/
|
|
119
|
+
footnoteReference?: EditorFootnoteReferenceData;
|
|
120
|
+
}
|
|
121
|
+
export interface EditorParagraphNode {
|
|
122
|
+
id: string;
|
|
123
|
+
type: "paragraph";
|
|
124
|
+
runs: EditorTextRun[];
|
|
125
|
+
style?: EditorParagraphStyle;
|
|
126
|
+
list?: EditorParagraphListStyle;
|
|
127
|
+
}
|
|
128
|
+
export interface EditorBorderStyle {
|
|
129
|
+
width: number;
|
|
130
|
+
type: "solid" | "dashed" | "dotted" | "none";
|
|
131
|
+
color: string;
|
|
132
|
+
}
|
|
133
|
+
export interface EditorTableCellStyle {
|
|
134
|
+
shading?: string;
|
|
135
|
+
width?: number | string;
|
|
136
|
+
borderTop?: EditorBorderStyle;
|
|
137
|
+
borderRight?: EditorBorderStyle;
|
|
138
|
+
borderBottom?: EditorBorderStyle;
|
|
139
|
+
borderLeft?: EditorBorderStyle;
|
|
140
|
+
padding?: number;
|
|
141
|
+
paddingTop?: number;
|
|
142
|
+
paddingRight?: number;
|
|
143
|
+
paddingBottom?: number;
|
|
144
|
+
paddingLeft?: number;
|
|
145
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
146
|
+
horizontalAlign?: "left" | "center" | "right" | "justify";
|
|
147
|
+
}
|
|
148
|
+
export interface EditorTableCellNode {
|
|
149
|
+
id: string;
|
|
150
|
+
blocks: EditorParagraphNode[];
|
|
151
|
+
colSpan?: number;
|
|
152
|
+
rowSpan?: number;
|
|
153
|
+
vMerge?: "restart" | "continue";
|
|
154
|
+
style?: EditorTableCellStyle;
|
|
155
|
+
}
|
|
156
|
+
export interface EditorTableRowStyle {
|
|
157
|
+
height?: number | string;
|
|
158
|
+
}
|
|
159
|
+
export interface EditorTableRowNode {
|
|
160
|
+
id: string;
|
|
161
|
+
cells: EditorTableCellNode[];
|
|
162
|
+
isHeader?: boolean;
|
|
163
|
+
style?: EditorTableRowStyle;
|
|
164
|
+
}
|
|
165
|
+
export interface EditorTableStyle {
|
|
166
|
+
styleId?: string;
|
|
167
|
+
width?: number | string;
|
|
168
|
+
align?: "left" | "center" | "right";
|
|
169
|
+
indentLeft?: number;
|
|
170
|
+
pageBreakBefore?: boolean;
|
|
171
|
+
}
|
|
172
|
+
export interface EditorTableNode {
|
|
173
|
+
id: string;
|
|
174
|
+
type: "table";
|
|
175
|
+
rows: EditorTableRowNode[];
|
|
176
|
+
gridCols?: number[];
|
|
177
|
+
style?: EditorTableStyle;
|
|
178
|
+
}
|
|
179
|
+
export type EditorBlockNode = EditorParagraphNode | EditorTableNode;
|
|
180
|
+
export interface EditorPageMargins {
|
|
181
|
+
top: number;
|
|
182
|
+
right: number;
|
|
183
|
+
bottom: number;
|
|
184
|
+
left: number;
|
|
185
|
+
header: number;
|
|
186
|
+
footer: number;
|
|
187
|
+
gutter: number;
|
|
188
|
+
}
|
|
189
|
+
export interface EditorPageSettings {
|
|
190
|
+
width: number;
|
|
191
|
+
height: number;
|
|
192
|
+
orientation?: "portrait" | "landscape";
|
|
193
|
+
margins: EditorPageMargins;
|
|
194
|
+
}
|
|
195
|
+
export interface EditorSection {
|
|
196
|
+
id: string;
|
|
197
|
+
blocks: EditorBlockNode[];
|
|
198
|
+
pageSettings: EditorPageSettings;
|
|
199
|
+
header?: EditorBlockNode[];
|
|
200
|
+
firstPageHeader?: EditorBlockNode[];
|
|
201
|
+
evenPageHeader?: EditorBlockNode[];
|
|
202
|
+
footer?: EditorBlockNode[];
|
|
203
|
+
firstPageFooter?: EditorBlockNode[];
|
|
204
|
+
evenPageFooter?: EditorBlockNode[];
|
|
205
|
+
breakType?: "nextPage" | "continuous";
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* An out-of-band asset bundled with the document (e.g. an embedded image).
|
|
209
|
+
* Heavy binary data (data URLs) lives here exactly once; runs reference it
|
|
210
|
+
* via `image.src = "asset:<id>"`. Keeping payloads off the per-paragraph
|
|
211
|
+
* state lets equality checks, signatures and clones stay cheap on every
|
|
212
|
+
* keystroke even when a document embeds large images.
|
|
213
|
+
*/
|
|
214
|
+
export interface EditorAsset {
|
|
215
|
+
id: string;
|
|
216
|
+
/** Full data URL (e.g. `data:image/png;base64,...`) or remote URL. */
|
|
217
|
+
url: string;
|
|
218
|
+
}
|
|
219
|
+
export declare const EDITOR_ASSET_REF_PREFIX = "asset:";
|
|
220
|
+
export type EditorFootnoteNumberFormat = "decimal" | "lowerRoman" | "upperRoman" | "lowerLetter" | "upperLetter" | "symbol";
|
|
221
|
+
export type EditorFootnoteRestart = "continuous" | "eachSection";
|
|
222
|
+
/**
|
|
223
|
+
* Body of a single footnote. `blocks` is fully editable, mirroring the
|
|
224
|
+
* shape of a section's main content. The DOCX `<w:footnoteRef/>` marker
|
|
225
|
+
* inside the body is NOT stored here — render/export reinjects it.
|
|
226
|
+
*/
|
|
227
|
+
export interface EditorFootnote {
|
|
228
|
+
id: string;
|
|
229
|
+
blocks: EditorBlockNode[];
|
|
230
|
+
/** Original DOCX `w:id`, kept for round-trip diagnostics only. */
|
|
231
|
+
docxId?: number;
|
|
232
|
+
}
|
|
233
|
+
export interface EditorFootnoteSettings {
|
|
234
|
+
numberFormat?: EditorFootnoteNumberFormat;
|
|
235
|
+
restart?: EditorFootnoteRestart;
|
|
236
|
+
startAt?: number;
|
|
237
|
+
}
|
|
238
|
+
export interface EditorFootnotes {
|
|
239
|
+
items: Record<string, EditorFootnote>;
|
|
240
|
+
settings?: EditorFootnoteSettings;
|
|
241
|
+
/** Optional imported separator part (Fase futura: render/export). */
|
|
242
|
+
separator?: EditorBlockNode[];
|
|
243
|
+
/** Optional imported continuation separator part (Fase futura). */
|
|
244
|
+
continuationSeparator?: EditorBlockNode[];
|
|
245
|
+
}
|
|
246
|
+
export interface EditorDocument {
|
|
247
|
+
id: string;
|
|
248
|
+
pageSettings?: EditorPageSettings;
|
|
249
|
+
sections?: EditorSection[];
|
|
250
|
+
styles?: Record<string, EditorNamedStyle>;
|
|
251
|
+
/**
|
|
252
|
+
* Out-of-band asset registry. Image runs reference entries here using
|
|
253
|
+
* `src = "asset:<id>"`. The map itself is treated as append-only and is
|
|
254
|
+
* deliberately excluded from per-keystroke equality checks/signatures.
|
|
255
|
+
*/
|
|
256
|
+
assets?: Record<string, EditorAsset>;
|
|
257
|
+
/**
|
|
258
|
+
* Footnote bodies keyed by id. Inline references live in
|
|
259
|
+
* `EditorTextRun.footnoteReference` and point here. May be undefined when
|
|
260
|
+
* the document has no notes.
|
|
261
|
+
*/
|
|
262
|
+
footnotes?: EditorFootnotes;
|
|
263
|
+
metadata?: {
|
|
264
|
+
title?: string;
|
|
265
|
+
[key: string]: any;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
export { getParagraphLength, getParagraphText, getRunIndex, getRunStartOffset, paragraphOffsetToPosition, positionToParagraphOffset, } from '../model/queries.js';
|
|
269
|
+
/**
|
|
270
|
+
* Resolve an `asset:<id>` reference (or pass through any other src) to the
|
|
271
|
+
* actual URL using the document's asset registry.
|
|
272
|
+
*/
|
|
273
|
+
export declare function resolveImageSrc(document: Pick<EditorDocument, "assets"> | undefined, src: string | undefined): string;
|
|
274
|
+
export declare const EFFECTIVE_TEXT_STYLE_DEFAULTS: Required<EditorTextStyle>;
|
|
275
|
+
export declare const EFFECTIVE_PARAGRAPH_STYLE_DEFAULTS: Required<EditorParagraphStyle>;
|
|
276
|
+
export declare function resolveNamedTextStyle(styleId: string | undefined, styles: Record<string, EditorNamedStyle> | undefined): EditorTextStyle;
|
|
277
|
+
export declare function resolveNamedParagraphStyle(styleId: string | undefined, styles: Record<string, EditorNamedStyle> | undefined): EditorParagraphStyle;
|
|
278
|
+
/**
|
|
279
|
+
* Resolve the effective text style for a run:
|
|
280
|
+
* 1. Resolve named style via styleId + basedOn chain
|
|
281
|
+
* 2. Apply local overrides (undefined → inherit, null → keep as null for reset)
|
|
282
|
+
* 3. Fill in system defaults for any remaining undefined values
|
|
283
|
+
*/
|
|
284
|
+
export declare function resolveEffectiveTextStyle(style: EditorTextStyle | undefined, styles: Record<string, EditorNamedStyle> | undefined): Required<EditorTextStyle>;
|
|
285
|
+
/**
|
|
286
|
+
* Resolve the effective text style for a run, inheriting textStyle from the
|
|
287
|
+
* paragraph named style when the run does not override it locally.
|
|
288
|
+
*/
|
|
289
|
+
export declare function resolveEffectiveTextStyleForParagraph(style: EditorTextStyle | undefined, paragraphStyleId: string | undefined, styles: Record<string, EditorNamedStyle> | undefined): Required<EditorTextStyle>;
|
|
290
|
+
/**
|
|
291
|
+
* Resolve the effective paragraph style:
|
|
292
|
+
* 1. Resolve named style via styleId + basedOn chain
|
|
293
|
+
* 2. Apply local overrides (undefined → inherit, null → keep as null for reset)
|
|
294
|
+
* 3. Fill in system defaults for any remaining undefined values
|
|
295
|
+
*/
|
|
296
|
+
export declare function resolveEffectiveParagraphStyle(style: EditorParagraphStyle | undefined, styles: Record<string, EditorNamedStyle> | undefined): Required<EditorParagraphStyle>;
|
|
297
|
+
export interface EditorPosition {
|
|
298
|
+
paragraphId: string;
|
|
299
|
+
runId: string;
|
|
300
|
+
offset: number;
|
|
301
|
+
}
|
|
302
|
+
export interface EditorSelection {
|
|
303
|
+
anchor: EditorPosition;
|
|
304
|
+
focus: EditorPosition;
|
|
305
|
+
}
|
|
306
|
+
export type EditorEditingZone = "main" | "header" | "footer" | "footnote";
|
|
307
|
+
export interface EditorState {
|
|
308
|
+
document: EditorDocument;
|
|
309
|
+
selection: EditorSelection;
|
|
310
|
+
activeSectionIndex?: number;
|
|
311
|
+
activeZone?: EditorEditingZone;
|
|
312
|
+
/**
|
|
313
|
+
* Identifies the footnote currently being edited when `activeZone === "footnote"`.
|
|
314
|
+
* Ignored for other zones.
|
|
315
|
+
*/
|
|
316
|
+
activeFootnoteId?: string;
|
|
317
|
+
trackChangesEnabled?: boolean;
|
|
318
|
+
showMargins?: boolean;
|
|
319
|
+
showParagraphMarks?: boolean;
|
|
320
|
+
}
|
|
321
|
+
export interface EditorCaretSlot {
|
|
322
|
+
paragraphId: string;
|
|
323
|
+
offset: number;
|
|
324
|
+
left: number;
|
|
325
|
+
top: number;
|
|
326
|
+
height: number;
|
|
327
|
+
}
|
|
328
|
+
export interface EditorLayoutFragmentChar {
|
|
329
|
+
char: string;
|
|
330
|
+
paragraphOffset: number;
|
|
331
|
+
runOffset: number;
|
|
332
|
+
}
|
|
333
|
+
export interface EditorLayoutFragment {
|
|
334
|
+
paragraphId: string;
|
|
335
|
+
runId: string;
|
|
336
|
+
startOffset: number;
|
|
337
|
+
endOffset: number;
|
|
338
|
+
text: string;
|
|
339
|
+
styles?: EditorTextStyle;
|
|
340
|
+
image?: EditorImageRunData;
|
|
341
|
+
revision?: EditorRevision;
|
|
342
|
+
chars: EditorLayoutFragmentChar[];
|
|
343
|
+
}
|
|
344
|
+
export interface EditorLayoutLine {
|
|
345
|
+
paragraphId: string;
|
|
346
|
+
index: number;
|
|
347
|
+
startOffset: number;
|
|
348
|
+
endOffset: number;
|
|
349
|
+
top: number;
|
|
350
|
+
height: number;
|
|
351
|
+
slots: EditorCaretSlot[];
|
|
352
|
+
fragments: EditorLayoutFragment[];
|
|
353
|
+
}
|
|
354
|
+
export interface EditorLayoutParagraph {
|
|
355
|
+
paragraphId: string;
|
|
356
|
+
text: string;
|
|
357
|
+
fragments: EditorLayoutFragment[];
|
|
358
|
+
lines: EditorLayoutLine[];
|
|
359
|
+
startOffset?: number;
|
|
360
|
+
endOffset?: number;
|
|
361
|
+
contentWidth?: number;
|
|
362
|
+
}
|
|
363
|
+
export interface EditorLayoutBlock {
|
|
364
|
+
blockId: string;
|
|
365
|
+
blockType: EditorBlockNode["type"];
|
|
366
|
+
paragraphId?: string;
|
|
367
|
+
globalIndex: number;
|
|
368
|
+
estimatedHeight: number;
|
|
369
|
+
layout?: EditorLayoutParagraph;
|
|
370
|
+
tableSegment?: {
|
|
371
|
+
startRowIndex: number;
|
|
372
|
+
endRowIndex: number;
|
|
373
|
+
repeatedHeaderRowCount: number;
|
|
374
|
+
};
|
|
375
|
+
sourceBlockId?: string;
|
|
376
|
+
sourceBlock: EditorBlockNode;
|
|
377
|
+
}
|
|
378
|
+
export interface EditorLayoutPage {
|
|
379
|
+
id: string;
|
|
380
|
+
index: number;
|
|
381
|
+
height: number;
|
|
382
|
+
maxHeight: number;
|
|
383
|
+
blocks: EditorLayoutBlock[];
|
|
384
|
+
pageSettings: EditorPageSettings;
|
|
385
|
+
headerBlocks?: EditorLayoutBlock[];
|
|
386
|
+
footerBlocks?: EditorLayoutBlock[];
|
|
387
|
+
footnoteBlocks?: EditorLayoutBlock[];
|
|
388
|
+
footnoteReferenceIds?: string[];
|
|
389
|
+
bodyTop?: number;
|
|
390
|
+
bodyBottom?: number;
|
|
391
|
+
headerTop?: number;
|
|
392
|
+
footerTop?: number;
|
|
393
|
+
footnoteTop?: number;
|
|
394
|
+
footnoteSeparatorTop?: number;
|
|
395
|
+
}
|
|
396
|
+
export interface EditorLayoutDocument {
|
|
397
|
+
pages: EditorLayoutPage[];
|
|
398
|
+
}
|
|
399
|
+
export declare const DEFAULT_EDITOR_PAGE_SETTINGS: EditorPageSettings;
|
|
400
|
+
export declare function normalizePageSettings(pageSettings: EditorPageSettings): EditorPageSettings;
|
|
401
|
+
export declare function getDocumentPageSettings(document: EditorDocument): EditorPageSettings;
|
|
402
|
+
export declare function getPageContentWidth(pageSettings: EditorPageSettings): number;
|
|
403
|
+
export declare function getPageHeaderZoneTop(pageSettings: EditorPageSettings): number;
|
|
404
|
+
export declare function getPageBodyTop(pageSettings: EditorPageSettings): number;
|
|
405
|
+
export declare function getPageFooterReferenceTop(pageSettings: EditorPageSettings): number;
|
|
406
|
+
export declare function getPageBodyBottom(pageSettings: EditorPageSettings): number;
|
|
407
|
+
export declare function getPageHeaderZoneHeight(pageSettings: EditorPageSettings): number;
|
|
408
|
+
export declare function getPageFooterZoneTop(pageSettings: EditorPageSettings): number;
|
|
409
|
+
export declare function getPageFooterZoneHeight(pageSettings: EditorPageSettings): number;
|
|
410
|
+
export declare function getPageContentHeight(pageSettings: EditorPageSettings): number;
|
|
411
|
+
export declare function getDocumentSectionsCanonical(document: EditorDocument): EditorSection[];
|
|
412
|
+
export declare function getDocumentSections(document: EditorDocument): EditorSection[];
|
|
413
|
+
export declare function getEditableBlocksForZone(state: EditorState, zone: EditorEditingZone): EditorBlockNode[];
|
|
414
|
+
export declare function getActiveSectionBlocks(state: EditorState): EditorBlockNode[];
|
|
415
|
+
export declare function getBlockParagraphs(block: EditorBlockNode): EditorParagraphNode[];
|
|
416
|
+
export declare function getDocumentParagraphsCanonical(document: EditorDocument): EditorParagraphNode[];
|
|
417
|
+
export declare function getDocumentParagraphs(document: EditorDocument): EditorParagraphNode[];
|
|
418
|
+
export declare function getParagraphs(state: EditorState): EditorParagraphNode[];
|
|
419
|
+
export declare function getActiveSectionIndex(state: EditorState): number;
|
|
420
|
+
export declare function getActiveZone(state: EditorState): EditorEditingZone;
|
|
421
|
+
export interface EditorParagraphLocation {
|
|
422
|
+
sectionIndex: number;
|
|
423
|
+
zone: EditorEditingZone;
|
|
424
|
+
paragraphIndexInSection: number;
|
|
425
|
+
/** When `zone === "footnote"`, identifies which footnote owns the paragraph. */
|
|
426
|
+
footnoteId?: string;
|
|
427
|
+
}
|
|
428
|
+
export interface DocumentParagraphIndexEntry {
|
|
429
|
+
paragraph: EditorParagraphNode;
|
|
430
|
+
location: EditorParagraphLocation;
|
|
431
|
+
tableLocation: {
|
|
432
|
+
blockIndex: number;
|
|
433
|
+
rowIndex: number;
|
|
434
|
+
cellIndex: number;
|
|
435
|
+
paragraphIndex: number;
|
|
436
|
+
} | null;
|
|
437
|
+
}
|
|
438
|
+
export declare function getDocumentParagraphIndex(document: EditorDocument): Map<string, DocumentParagraphIndexEntry>;
|
|
439
|
+
export declare function getParagraphById(document: EditorDocument, paragraphId: string): EditorParagraphNode | undefined;
|
|
440
|
+
export declare function findParagraphLocation(document: EditorDocument, paragraphId: string): EditorParagraphLocation | null;
|
|
441
|
+
export declare function findParagraphTableLocation(document: EditorDocument, paragraphId: string, activeSectionIndex?: number): {
|
|
442
|
+
blockIndex: number;
|
|
443
|
+
rowIndex: number;
|
|
444
|
+
cellIndex: number;
|
|
445
|
+
paragraphIndex: number;
|
|
446
|
+
zone: EditorEditingZone;
|
|
447
|
+
} | null;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { EditorState } from '../model.js';
|
|
2
|
+
import { Editor } from '../Editor.js';
|
|
3
|
+
import { CommandRef } from '../commands/CommandRef.js';
|
|
4
|
+
|
|
5
|
+
export type Unsubscribe = () => void;
|
|
6
|
+
export interface OasisCommand<TPayload = unknown, TResult = unknown> {
|
|
7
|
+
execute: (payload?: TPayload) => TResult;
|
|
8
|
+
refresh?: (payload?: TPayload) => CommandState;
|
|
9
|
+
}
|
|
10
|
+
export interface OasisCommandRegistry {
|
|
11
|
+
register: <TPayload = unknown, TResult = unknown>(name: string, command: OasisCommand<TPayload, TResult>) => void;
|
|
12
|
+
unregister: (name: string) => void;
|
|
13
|
+
get: (name: string) => OasisCommand | undefined;
|
|
14
|
+
has: (name: string) => boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface CommandState {
|
|
17
|
+
isEnabled: boolean;
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
value?: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface OasisEditor {
|
|
22
|
+
readonly state: EditorState;
|
|
23
|
+
readonly commands: OasisCommandRegistry;
|
|
24
|
+
registerCommand: <TPayload = unknown, TResult = unknown>(name: string, command: OasisCommand<TPayload, TResult>) => void;
|
|
25
|
+
unregisterCommand: (name: string) => void;
|
|
26
|
+
execute: <TPayload = unknown, TResult = unknown>(name: string, payload?: TPayload) => TResult;
|
|
27
|
+
canExecute: (name: string, payload?: unknown) => boolean;
|
|
28
|
+
on: (event: string, callback: (...args: unknown[]) => void) => Unsubscribe;
|
|
29
|
+
once: (event: string, callback: (...args: unknown[]) => void) => Unsubscribe;
|
|
30
|
+
off: (event: string, callback: (...args: unknown[]) => void) => void;
|
|
31
|
+
}
|
|
32
|
+
export type PluginReference = string | OasisPlugin;
|
|
33
|
+
export interface PluginAction {
|
|
34
|
+
id: string;
|
|
35
|
+
command: CommandRef;
|
|
36
|
+
icon?: string;
|
|
37
|
+
group?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PluginMenuItem extends PluginAction {
|
|
40
|
+
path: string;
|
|
41
|
+
shortcut?: string;
|
|
42
|
+
separator?: boolean;
|
|
43
|
+
labelKey?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface OasisPlugin {
|
|
46
|
+
name: string;
|
|
47
|
+
requires?: PluginReference[];
|
|
48
|
+
schema?: {
|
|
49
|
+
nodes?: Record<string, unknown>;
|
|
50
|
+
marks?: Record<string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
commands?: Record<string, OasisCommand>;
|
|
53
|
+
keymaps?: Array<{
|
|
54
|
+
key: string;
|
|
55
|
+
command: string;
|
|
56
|
+
}>;
|
|
57
|
+
toolbar?: PluginAction[];
|
|
58
|
+
menubar?: PluginMenuItem[];
|
|
59
|
+
init?: (editor: OasisEditor) => void | Promise<void>;
|
|
60
|
+
afterInit?: (editor: OasisEditor) => void | Promise<void>;
|
|
61
|
+
destroy?: (editor: OasisEditor) => void | Promise<void>;
|
|
62
|
+
install?: (editor: OasisEditor) => void | Unsubscribe;
|
|
63
|
+
}
|
|
64
|
+
export type OasisEditorRuntime = Editor;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OasisEditor, OasisPlugin } from '../../../plugin.js';
|
|
2
|
+
|
|
3
|
+
export declare class PluginCollection {
|
|
4
|
+
private editorInstance;
|
|
5
|
+
private plugins;
|
|
6
|
+
private cleanups;
|
|
7
|
+
private initialized;
|
|
8
|
+
private isInitialized;
|
|
9
|
+
constructor(editorInstance: OasisEditor, plugins?: OasisPlugin[]);
|
|
10
|
+
private resolvePlugins;
|
|
11
|
+
initializeAll(): Promise<void>;
|
|
12
|
+
private initializePlugin;
|
|
13
|
+
private registerPluginCommands;
|
|
14
|
+
destroy(): Promise<void>;
|
|
15
|
+
getPlugins(): OasisPlugin[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EditorParagraphNode, EditorPosition, EditorSelection, EditorState } from '../model.js';
|
|
2
|
+
|
|
3
|
+
export interface NormalizedEditorSelection {
|
|
4
|
+
start: EditorPosition;
|
|
5
|
+
end: EditorPosition;
|
|
6
|
+
startIndex: number;
|
|
7
|
+
endIndex: number;
|
|
8
|
+
startParagraphOffset: number;
|
|
9
|
+
endParagraphOffset: number;
|
|
10
|
+
isCollapsed: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function findParagraphIndex(paragraphs: EditorParagraphNode[], paragraphId: string): number;
|
|
13
|
+
export declare function findParagraphById(paragraphs: EditorParagraphNode[], paragraphId: string): EditorParagraphNode;
|
|
14
|
+
export declare function clampOffset(offset: number, paragraph: EditorParagraphNode): number;
|
|
15
|
+
export declare function clampPosition(state: EditorState, position: EditorPosition): EditorPosition;
|
|
16
|
+
export declare function comparePositions(paragraphs: EditorParagraphNode[], left: EditorPosition, right: EditorPosition): number;
|
|
17
|
+
export declare function createCollapsedSelection(position: EditorPosition): EditorSelection;
|
|
18
|
+
export declare function isSelectionCollapsed(selection: EditorSelection): boolean;
|
|
19
|
+
export declare function normalizeSelection(state: EditorState, providedParagraphs?: EditorParagraphNode[]): NormalizedEditorSelection;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EditorLayoutBlock, EditorTableCellNode, EditorTableNode } from '../model.js';
|
|
2
|
+
|
|
3
|
+
export interface TableCellLayoutEntry {
|
|
4
|
+
rowIndex: number;
|
|
5
|
+
cellIndex: number;
|
|
6
|
+
visualRowIndex: number;
|
|
7
|
+
visualColumnIndex: number;
|
|
8
|
+
rowSpan: number;
|
|
9
|
+
colSpan: number;
|
|
10
|
+
cell: EditorTableCellNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function buildTableCellLayout(table: EditorTableNode): TableCellLayoutEntry[];
|
|
13
|
+
export declare function buildSegmentTable(table: EditorTableNode, segment: NonNullable<EditorLayoutBlock["tableSegment"]>): EditorTableNode;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorTextStyle } from '../model.js';
|
|
2
|
+
|
|
3
|
+
export type UnderlineStyle = EditorTextStyle["underlineStyle"];
|
|
4
|
+
export declare function underlineStyleToCssDecorationStyle(underlineStyle: UnderlineStyle): string | null;
|
|
5
|
+
export declare function isDoubleUnderlineStyle(underlineStyle: UnderlineStyle): boolean;
|
|
6
|
+
export declare function isWavyUnderlineStyle(underlineStyle: UnderlineStyle): boolean;
|
|
7
|
+
export declare function underlineStyleLineWidthPx(underlineStyle: UnderlineStyle): number;
|
|
8
|
+
export declare function underlineStyleDashArray(underlineStyle: UnderlineStyle): number[] | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function isWordCharacter(char: string): boolean;
|
|
2
|
+
export declare function resolveWordSelection(text: string, offset: number): {
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function findPreviousWordBoundary(text: string, offset: number): number;
|
|
7
|
+
export declare function findNextWordBoundary(text: string, offset: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function OasisSiteApp(): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { EditorBlockNode, EditorParagraphListStyle } from '../../../../core/model.js';
|
|
2
|
+
|
|
3
|
+
export interface DocContext {
|
|
4
|
+
numberingInfo: Map<string, {
|
|
5
|
+
numId: number;
|
|
6
|
+
level: number;
|
|
7
|
+
}>;
|
|
8
|
+
definitions: Array<{
|
|
9
|
+
kind: EditorParagraphListStyle["kind"];
|
|
10
|
+
level: number;
|
|
11
|
+
abstractNumId: number;
|
|
12
|
+
numId: number;
|
|
13
|
+
}>;
|
|
14
|
+
images: Array<{
|
|
15
|
+
rId: string;
|
|
16
|
+
target: string;
|
|
17
|
+
base64: string;
|
|
18
|
+
runId: string;
|
|
19
|
+
cx: number;
|
|
20
|
+
cy: number;
|
|
21
|
+
alt?: string;
|
|
22
|
+
}>;
|
|
23
|
+
imageMap: Map<string, string>;
|
|
24
|
+
hyperlinks: Array<{
|
|
25
|
+
rId: string;
|
|
26
|
+
href: string;
|
|
27
|
+
}>;
|
|
28
|
+
hyperlinkMap: Map<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Maps `EditorFootnote.id` to the numeric `w:id` value used when emitting
|
|
31
|
+
* `<w:footnoteReference w:id="N"/>` in the document body. Empty when the
|
|
32
|
+
* document has no footnotes.
|
|
33
|
+
*/
|
|
34
|
+
footnoteIdMap?: Map<string, number>;
|
|
35
|
+
}
|
|
36
|
+
export interface NumberingContext {
|
|
37
|
+
numberingInfo: Map<string, {
|
|
38
|
+
numId: number;
|
|
39
|
+
level: number;
|
|
40
|
+
}>;
|
|
41
|
+
definitions: Array<{
|
|
42
|
+
kind: EditorParagraphListStyle["kind"];
|
|
43
|
+
level: number;
|
|
44
|
+
abstractNumId: number;
|
|
45
|
+
numId: number;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
export interface ExportBuildState {
|
|
49
|
+
nextImageId: number;
|
|
50
|
+
}
|
|
51
|
+
export interface PartDefinition {
|
|
52
|
+
kind: "header" | "footer";
|
|
53
|
+
type: "default" | "first" | "even";
|
|
54
|
+
path: string;
|
|
55
|
+
relId: string;
|
|
56
|
+
blocks: EditorBlockNode[];
|
|
57
|
+
context: DocContext;
|
|
58
|
+
}
|
|
59
|
+
export interface SectionReferenceDefinition {
|
|
60
|
+
header?: Partial<Record<"default" | "first" | "even", {
|
|
61
|
+
relId: string;
|
|
62
|
+
}>>;
|
|
63
|
+
footer?: Partial<Record<"default" | "first" | "even", {
|
|
64
|
+
relId: string;
|
|
65
|
+
}>>;
|
|
66
|
+
}
|