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,33 @@
|
|
|
1
|
+
import { EditorState, EditorDocument } from '../model.js';
|
|
2
|
+
import { CommandRegistry } from '../commands/CommandRegistry.js';
|
|
3
|
+
import { OasisCommand, OasisEditor, OasisPlugin } from '../plugin.js';
|
|
4
|
+
|
|
5
|
+
export interface EditorOptions {
|
|
6
|
+
doc?: EditorDocument;
|
|
7
|
+
plugins?: OasisPlugin[];
|
|
8
|
+
keymaps?: Array<{
|
|
9
|
+
key: string;
|
|
10
|
+
command: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export declare class Editor implements OasisEditor {
|
|
14
|
+
private stateStore;
|
|
15
|
+
private setState;
|
|
16
|
+
private pluginCollection;
|
|
17
|
+
private listeners;
|
|
18
|
+
readonly commands: CommandRegistry;
|
|
19
|
+
constructor(options?: EditorOptions);
|
|
20
|
+
static create(options?: EditorOptions): Promise<Editor>;
|
|
21
|
+
private initializeState;
|
|
22
|
+
get state(): EditorState;
|
|
23
|
+
dispatch(updater: (state: EditorState) => EditorState): void;
|
|
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
|
+
destroy(): Promise<void>;
|
|
29
|
+
on(event: string, callback: (...args: unknown[]) => void): () => void;
|
|
30
|
+
once(event: string, callback: (...args: unknown[]) => void): () => void;
|
|
31
|
+
off(event: string, callback: (...args: unknown[]) => void): void;
|
|
32
|
+
private emit;
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorBlockNode, EditorFootnote, EditorFootnotes, EditorSection, EditorState } from '../model.js';
|
|
2
|
+
|
|
3
|
+
export declare function cloneBlock(block: EditorBlockNode): EditorBlockNode;
|
|
4
|
+
export declare const cloneDocumentBlock: typeof cloneBlock;
|
|
5
|
+
export declare function cloneSection(section: EditorSection): EditorSection;
|
|
6
|
+
export declare function cloneFootnote(footnote: EditorFootnote): EditorFootnote;
|
|
7
|
+
export declare function cloneFootnotes(footnotes: EditorFootnotes | undefined): EditorFootnotes | undefined;
|
|
8
|
+
export declare function cloneEditorState(source: EditorState): EditorState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CommandState, OasisEditor } from '../../../plugin.js';
|
|
2
|
+
import { CommandRef } from '../../CommandRef.js';
|
|
3
|
+
|
|
4
|
+
export interface CommandBus<TState = CommandState> {
|
|
5
|
+
execute(command: CommandRef, payloadOverride?: unknown): unknown;
|
|
6
|
+
canExecute(command: CommandRef, payloadOverride?: unknown): boolean;
|
|
7
|
+
state(command: CommandRef): TState;
|
|
8
|
+
}
|
|
9
|
+
export declare function createEditorCommandBus(editor: OasisEditor): CommandBus;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type CommandRef<Name extends string = string, Payload = unknown> = Name | {
|
|
2
|
+
name: Name;
|
|
3
|
+
payload?: Payload;
|
|
4
|
+
};
|
|
5
|
+
export interface ResolvedCommandRef {
|
|
6
|
+
name: string;
|
|
7
|
+
payload: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare function commandRefName(ref: CommandRef): string;
|
|
10
|
+
export declare function resolveCommandRef(ref: CommandRef, payloadOverride?: unknown): ResolvedCommandRef;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OasisCommand, OasisCommandRegistry } from '../../../plugin.js';
|
|
2
|
+
|
|
3
|
+
export declare class CommandRegistry implements OasisCommandRegistry {
|
|
4
|
+
private commands;
|
|
5
|
+
register<TPayload = unknown, TResult = unknown>(name: string, command: OasisCommand<TPayload, TResult>): void;
|
|
6
|
+
unregister(name: string): void;
|
|
7
|
+
get(name: string): OasisCommand | undefined;
|
|
8
|
+
has(name: string): boolean;
|
|
9
|
+
clear(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EditorParagraphStyle, EditorPosition, EditorState, EditorSection, EditorTabStop } from '../../../model.js';
|
|
2
|
+
import { ValueParagraphStyleKey } from '../../utils.js';
|
|
3
|
+
|
|
4
|
+
export declare function moveBlockToPosition(state: EditorState, blockId: string, targetPosition: EditorPosition): EditorState;
|
|
5
|
+
export declare function splitBlockAtSelection(state: EditorState): EditorState;
|
|
6
|
+
export declare function insertPageBreakAtSelection(state: EditorState): EditorState;
|
|
7
|
+
export declare function insertSectionBreakAtSelection(state: EditorState, breakType: "nextPage" | "continuous"): EditorState;
|
|
8
|
+
export declare function updateSectionSettings(state: EditorState, sectionIndex: number, settings: Partial<EditorSection>): EditorState;
|
|
9
|
+
export declare function setParagraphNamedStyle(state: EditorState, styleId: string | null): EditorState;
|
|
10
|
+
export declare function setParagraphStyle<K extends ValueParagraphStyleKey>(state: EditorState, key: K, value: EditorParagraphStyle[K] | null): EditorState;
|
|
11
|
+
export declare function setParagraphTabStops(state: EditorState, tabs: EditorTabStop[] | null): EditorState;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EditorParagraphListStyle, EditorParagraphStyle, EditorState, EditorTextStyle, EditorImageRunData } from '../../../model.js';
|
|
2
|
+
|
|
3
|
+
export interface EditorClipboardParagraphSpec {
|
|
4
|
+
runs: Array<{
|
|
5
|
+
text: string;
|
|
6
|
+
styles?: EditorTextStyle;
|
|
7
|
+
image?: EditorImageRunData;
|
|
8
|
+
}>;
|
|
9
|
+
style?: EditorParagraphStyle;
|
|
10
|
+
list?: EditorParagraphListStyle;
|
|
11
|
+
}
|
|
12
|
+
export declare function serializeEditorSelectionToHtml(state: EditorState): string;
|
|
13
|
+
export declare function insertClipboardParagraphsAtSelection(state: EditorState, paragraphsSpec: EditorClipboardParagraphSpec[]): EditorState;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EditorFootnote, EditorState } from '../../../model.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Insert a footnote at the current selection. The reference marker is placed
|
|
5
|
+
* inline (in the main flow) and a fresh body is created with a single empty
|
|
6
|
+
* paragraph. After insertion the active zone becomes `"footnote"` so the user
|
|
7
|
+
* can type the note text directly.
|
|
8
|
+
*/
|
|
9
|
+
export declare function insertFootnote(state: EditorState): EditorState;
|
|
10
|
+
/**
|
|
11
|
+
* Remove a footnote: deletes the inline reference run and the body. Other
|
|
12
|
+
* notes are renumbered.
|
|
13
|
+
*/
|
|
14
|
+
export declare function deleteFootnote(state: EditorState, footnoteId: string): EditorState;
|
|
15
|
+
/**
|
|
16
|
+
* Move the selection into the body of the given footnote, switching the
|
|
17
|
+
* active zone. Does nothing if the footnote does not exist or has no body.
|
|
18
|
+
*/
|
|
19
|
+
export declare function goToFootnoteBody(state: EditorState, footnoteId: string): EditorState;
|
|
20
|
+
/**
|
|
21
|
+
* Move the selection back to the inline reference of the given footnote.
|
|
22
|
+
*/
|
|
23
|
+
export declare function goToFootnoteReference(state: EditorState, footnoteId: string): EditorState;
|
|
24
|
+
/**
|
|
25
|
+
* Re-export helpers expected by callers.
|
|
26
|
+
*/
|
|
27
|
+
export type { EditorFootnote };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EditorState } from '../../../model.js';
|
|
2
|
+
|
|
3
|
+
export declare function toggleTrackChanges(state: EditorState): EditorState;
|
|
4
|
+
export declare function acceptRevision(state: EditorState, revisionId: string): EditorState;
|
|
5
|
+
export declare function rejectRevision(state: EditorState, revisionId: string): EditorState;
|
|
6
|
+
export declare function acceptRevisionsInSelection(state: EditorState): EditorState;
|
|
7
|
+
export declare function rejectRevisionsInSelection(state: EditorState): EditorState;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EditorParagraphNode, EditorPosition, EditorState, EditorTextRun, EditorImageRunData } from '../../../model.js';
|
|
2
|
+
|
|
3
|
+
export interface SelectedImageRun {
|
|
4
|
+
paragraph: EditorParagraphNode;
|
|
5
|
+
paragraphIndex: number;
|
|
6
|
+
run: EditorTextRun;
|
|
7
|
+
runIndex: number;
|
|
8
|
+
offset: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function getSelectedImageRun(state: EditorState): SelectedImageRun | null;
|
|
11
|
+
export declare function insertImageAtSelection(state: EditorState, image: EditorImageRunData): EditorState;
|
|
12
|
+
export declare function resizeSelectedImage(state: EditorState, width: number, height: number): EditorState;
|
|
13
|
+
export declare function getSelectedImageAlt(state: EditorState): string | null;
|
|
14
|
+
export declare function setSelectedImageAlt(state: EditorState, alt: string | null): EditorState;
|
|
15
|
+
export declare function moveSelectedImageToPosition(state: EditorState, targetPosition: EditorPosition): EditorState;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EditorParagraphListStyle, EditorState } from '../../../model.js';
|
|
2
|
+
import { ParagraphListKind } from '../../utils.js';
|
|
3
|
+
|
|
4
|
+
export declare function splitListItemAtSelection(state: EditorState): EditorState;
|
|
5
|
+
export declare function clearParagraphListAtSelection(state: EditorState): EditorState;
|
|
6
|
+
export declare function indentParagraphList(state: EditorState): EditorState;
|
|
7
|
+
export declare function outdentParagraphList(state: EditorState): EditorState;
|
|
8
|
+
export declare function toggleParagraphList(state: EditorState, kind: ParagraphListKind): EditorState;
|
|
9
|
+
export declare function setParagraphListFormat(state: EditorState, format: EditorParagraphListStyle["format"] | null): EditorState;
|
|
10
|
+
export declare function setParagraphListStartAt(state: EditorState, startAt: number | null): EditorState;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EditorSelection, EditorState } from '../../../model.js';
|
|
2
|
+
|
|
3
|
+
export declare function getSelectedText(state: EditorState): string;
|
|
4
|
+
export declare function setSelection(state: EditorState, selection: EditorSelection): EditorState;
|
|
5
|
+
export declare function moveSelectionLeft(state: EditorState): EditorState;
|
|
6
|
+
export declare function moveSelectionRight(state: EditorState): EditorState;
|
|
7
|
+
export declare function moveSelectionUp(state: EditorState): EditorState;
|
|
8
|
+
export declare function moveSelectionDown(state: EditorState): EditorState;
|
|
9
|
+
export declare function extendSelectionLeft(state: EditorState): EditorState;
|
|
10
|
+
export declare function extendSelectionRight(state: EditorState): EditorState;
|
|
11
|
+
export declare function extendSelectionUp(state: EditorState): EditorState;
|
|
12
|
+
export declare function extendSelectionDown(state: EditorState): EditorState;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EditorState, EditorTableCellStyle, EditorBorderStyle, EditorTableStyle } from '../../../model.js';
|
|
2
|
+
|
|
3
|
+
export declare function setTableCellStyleValue<K extends keyof EditorTableCellStyle>(state: EditorState, key: K, value: EditorTableCellStyle[K] | null): EditorState;
|
|
4
|
+
export declare function setTableStyleValue<K extends keyof EditorTableStyle>(state: EditorState, key: K, value: EditorTableStyle[K] | null): EditorState;
|
|
5
|
+
export declare function setTableCellWidth(state: EditorState, width: number | string | null): EditorState;
|
|
6
|
+
export declare function setTableRowHeight(state: EditorState, tableId: string, rowIndex: number, height: number | string | null): EditorState;
|
|
7
|
+
export declare function setTableColumnWidths(state: EditorState, tableId: string, columnWidths: Record<number, number | string>, // visualColumnIndex -> width
|
|
8
|
+
tableWidth?: number | string, tableIndentLeft?: number | string): EditorState;
|
|
9
|
+
export declare function setTableCellBorders(state: EditorState, border: EditorBorderStyle | null): EditorState;
|
|
10
|
+
export declare function insertTableAtSelection(state: EditorState, rows: number, cols: number): EditorState;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EditorPosition, EditorState, EditorTextStyle } from '../../../model.js';
|
|
2
|
+
import { ToggleableTextStyleKey, ValueTextStyleKey } from '../../utils.js';
|
|
3
|
+
|
|
4
|
+
export declare function moveOrCopySelectionToPosition(state: EditorState, targetPosition: EditorPosition, options?: {
|
|
5
|
+
copy?: boolean;
|
|
6
|
+
}): EditorState;
|
|
7
|
+
export declare function insertTextAtSelection(state: EditorState, text: string, styleOverride?: EditorTextStyle): EditorState;
|
|
8
|
+
export declare function insertPlainTextAtSelection(state: EditorState, text: string, styleOverride?: EditorTextStyle): EditorState;
|
|
9
|
+
export declare function deleteBackward(state: EditorState): EditorState;
|
|
10
|
+
export declare function deleteForward(state: EditorState): EditorState;
|
|
11
|
+
export declare function toggleTextStyle(state: EditorState, key: ToggleableTextStyleKey): EditorState;
|
|
12
|
+
export declare function setTextStyleValue<K extends ValueTextStyleKey>(state: EditorState, key: K, value: EditorTextStyle[K] | null): EditorState;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { EditorBlockNode, EditorDocument, EditorParagraphListStyle, EditorParagraphStyle, EditorParagraphNode, EditorPosition, EditorSelection, EditorState, EditorTextRun, EditorTextStyle, EditorImageRunData, EditorSection, EditorTableCellNode } from '../../../model.js';
|
|
2
|
+
import { normalizeSelection } from '../../../selection.js';
|
|
3
|
+
|
|
4
|
+
export type ToggleableTextStyleKey = "bold" | "italic" | "underline" | "strike" | "doubleStrike" | "superscript" | "subscript" | "smallCaps" | "allCaps" | "hidden" | "contextualAlternates";
|
|
5
|
+
export type ValueTextStyleKey = "fontFamily" | "fontSize" | "color" | "highlight" | "link" | "underlineStyle" | "underlineColor" | "characterScale" | "characterSpacing" | "baselineShift" | "kerningThreshold" | "ligatures" | "numberSpacing" | "numberForm" | "stylisticSet";
|
|
6
|
+
export type ValueParagraphStyleKey = "styleId" | "align" | "spacingBefore" | "spacingAfter" | "lineHeight" | "indentLeft" | "indentRight" | "indentFirstLine" | "indentHanging" | "shading" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "tabs" | "pageBreakBefore" | "keepWithNext";
|
|
7
|
+
export type ParagraphListKind = EditorParagraphListStyle["kind"];
|
|
8
|
+
export declare function cloneStyle(style?: EditorTextStyle): EditorTextStyle | undefined;
|
|
9
|
+
export declare function stylesEqual(left?: EditorTextStyle, right?: EditorTextStyle): boolean;
|
|
10
|
+
export declare function setBooleanStyle(style: EditorTextStyle | undefined, key: ToggleableTextStyleKey, enabled: boolean): EditorTextStyle | undefined;
|
|
11
|
+
export declare function setValueStyle<K extends ValueTextStyleKey>(style: EditorTextStyle | undefined, key: K, value: EditorTextStyle[K] | null): EditorTextStyle | undefined;
|
|
12
|
+
export declare function cloneRun(run: EditorTextRun): EditorTextRun;
|
|
13
|
+
export declare function cloneParagraph(paragraph: EditorParagraphNode): EditorParagraphNode;
|
|
14
|
+
export declare function cloneParagraphList(list?: EditorParagraphListStyle): EditorParagraphListStyle | undefined;
|
|
15
|
+
export declare function setParagraphStyleValue<K extends ValueParagraphStyleKey>(style: EditorParagraphStyle | undefined, key: K, value: EditorParagraphStyle[K] | null): EditorParagraphStyle | undefined;
|
|
16
|
+
export declare function cloneParagraphs(paragraphs: EditorParagraphNode[]): EditorParagraphNode[];
|
|
17
|
+
export declare function cloneBlocks(blocks: EditorBlockNode[]): EditorBlockNode[];
|
|
18
|
+
export declare function normalizeRuns(runs: EditorTextRun[], fallbackStyles?: EditorTextStyle): EditorTextRun[];
|
|
19
|
+
export declare function buildParagraphFromRuns(paragraph: EditorParagraphNode, runs: EditorTextRun[], fallbackStyles?: EditorTextStyle): EditorParagraphNode;
|
|
20
|
+
export declare function createParagraphFromRuns(textRuns: Array<{
|
|
21
|
+
text: string;
|
|
22
|
+
styles?: EditorTextStyle;
|
|
23
|
+
}>): EditorParagraphNode;
|
|
24
|
+
export declare function createParagraphFromRunsLike(paragraph: EditorParagraphNode, textRuns: Array<{
|
|
25
|
+
text: string;
|
|
26
|
+
styles?: EditorTextStyle;
|
|
27
|
+
}>): EditorParagraphNode;
|
|
28
|
+
export declare function cloneParagraphWithListLevel(paragraph: EditorParagraphNode, level: number): EditorParagraphNode;
|
|
29
|
+
export declare function clearParagraphList(paragraph: EditorParagraphNode): EditorParagraphNode;
|
|
30
|
+
export declare function blocksContainTables(nodes: EditorBlockNode[]): boolean;
|
|
31
|
+
export declare function replaceParagraphsInBlocks(blocks: EditorBlockNode[], newParagraphs: EditorParagraphNode[]): EditorBlockNode[];
|
|
32
|
+
export declare function replaceParagraphsInSection(section: EditorSection, paragraphs: EditorParagraphNode[], zone: "main" | "header" | "footer"): EditorSection;
|
|
33
|
+
export declare function cloneStateWithParagraphs(state: EditorState, paragraphs: EditorParagraphNode[], selection: EditorSelection): EditorState;
|
|
34
|
+
export declare function withSelection(position: EditorPosition): EditorSelection;
|
|
35
|
+
export declare function getFocusParagraph(state: EditorState): {
|
|
36
|
+
paragraph: EditorParagraphNode;
|
|
37
|
+
index: number;
|
|
38
|
+
offset: number;
|
|
39
|
+
};
|
|
40
|
+
export declare function getStyleAtOffset(paragraph: EditorParagraphNode, offset: number): EditorTextStyle | undefined;
|
|
41
|
+
export declare function getRunAtOffset(paragraph: EditorParagraphNode, offset: number): {
|
|
42
|
+
run: EditorTextRun;
|
|
43
|
+
startOffset: number;
|
|
44
|
+
endOffset: number;
|
|
45
|
+
} | null;
|
|
46
|
+
export declare function expandLinkRangeInParagraph(paragraph: EditorParagraphNode, offset: number): {
|
|
47
|
+
href: string;
|
|
48
|
+
startOffset: number;
|
|
49
|
+
endOffset: number;
|
|
50
|
+
} | null;
|
|
51
|
+
export declare function sliceRuns(paragraph: EditorParagraphNode, startOffset: number, endOffset: number): EditorTextRun[];
|
|
52
|
+
export declare function insertRunsAtOffset(paragraph: EditorParagraphNode, offset: number, textRuns: EditorTextRun[]): EditorParagraphNode;
|
|
53
|
+
export declare function deleteSelectionRange(state: EditorState): EditorState;
|
|
54
|
+
export declare function mapRunsInRange(paragraph: EditorParagraphNode, startOffset: number, endOffset: number, mapper: (run: EditorTextRun) => EditorTextRun): EditorParagraphNode;
|
|
55
|
+
export declare function preserveSelectionByParagraphOffsets(paragraphs: EditorParagraphNode[], normalized: ReturnType<typeof normalizeSelection>): EditorSelection;
|
|
56
|
+
export declare function collapseToBoundary(state: EditorState, direction: "start" | "end"): EditorState;
|
|
57
|
+
export declare function escapeHtml(text: string): string;
|
|
58
|
+
export declare function textRunStylesToCss(style?: EditorTextStyle): string;
|
|
59
|
+
export declare function paragraphStyleToCssText(style?: EditorParagraphStyle): string;
|
|
60
|
+
export declare function serializeImageRunToHtml(run: EditorTextRun, document?: Pick<EditorDocument, "assets">): string;
|
|
61
|
+
export declare function serializeTextRunToHtml(run: EditorTextRun, document?: Pick<EditorDocument, "assets">): string;
|
|
62
|
+
export declare function serializeParagraphRunsToHtml(runs: EditorTextRun[], document?: Pick<EditorDocument, "assets">): string;
|
|
63
|
+
export declare function parseInlineStyles(element: Element): EditorTextStyle | undefined;
|
|
64
|
+
export declare function parseInlineImage(element: Element): EditorImageRunData | undefined;
|
|
65
|
+
export declare function parseParagraphStyle(element: Element): EditorParagraphStyle | undefined;
|
|
66
|
+
export declare function updateTableCellsInBlocks(blocks: EditorBlockNode[], selectedParagraphIds: Set<string>, updateCell: (cell: EditorTableCellNode) => EditorTableCellNode): EditorBlockNode[];
|
|
67
|
+
export declare function moveVertical(state: EditorState, delta: -1 | 1): EditorState;
|
|
68
|
+
export declare function moveFocusHorizontally(state: EditorState, delta: -1 | 1): EditorState;
|
|
69
|
+
export declare function moveFocusVertical(state: EditorState, delta: -1 | 1): EditorState;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use imports from `src/core/commands/*` instead.
|
|
3
|
+
*/
|
|
4
|
+
export * from '../commands/image.js';
|
|
5
|
+
export * from '../commands/text.js';
|
|
6
|
+
export * from '../commands/block.js';
|
|
7
|
+
export * from '../commands/list.js';
|
|
8
|
+
export * from '../commands/table.js';
|
|
9
|
+
export * from '../commands/link.js';
|
|
10
|
+
export * from '../commands/history.js';
|
|
11
|
+
export * from '../commands/clipboard.js';
|
|
12
|
+
export * from '../commands/selection.js';
|
|
13
|
+
export * from '../commands/misc.js';
|
|
14
|
+
export * from '../commands/footnotes.js';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { EditorAsset, EditorBlockNode, EditorDocument, EditorFootnote, EditorPageSettings, EditorParagraphNode, EditorSection, EditorState, EditorTableCellNode, EditorTableNode, EditorTableRowNode, EditorTextRun, EditorTextStyle, EditorImageRunData, EditorNamedStyle } from '../model.js';
|
|
2
|
+
|
|
3
|
+
export declare function resetEditorIds(): void;
|
|
4
|
+
export declare function createEditorRun(text?: string): EditorTextRun;
|
|
5
|
+
export declare function createEditorStyledRun(text?: string, styles?: EditorTextStyle, image?: EditorImageRunData): EditorTextRun;
|
|
6
|
+
export declare function createEditorParagraph(text?: string): EditorParagraphNode;
|
|
7
|
+
export declare function createEditorParagraphFromRuns(runs: Array<{
|
|
8
|
+
text: string;
|
|
9
|
+
styles?: EditorTextStyle;
|
|
10
|
+
image?: EditorImageRunData;
|
|
11
|
+
}>): EditorParagraphNode;
|
|
12
|
+
export declare function createEditorTableCell(paragraphs: EditorParagraphNode[], colSpan?: number, options?: {
|
|
13
|
+
rowSpan?: number;
|
|
14
|
+
vMerge?: "restart" | "continue";
|
|
15
|
+
}): EditorTableCellNode;
|
|
16
|
+
export declare function createEditorTableRow(cells: EditorTableCellNode[], options?: {
|
|
17
|
+
isHeader?: boolean;
|
|
18
|
+
}): EditorTableRowNode;
|
|
19
|
+
export declare function createEditorTable(rows: EditorTableRowNode[], gridCols?: number[]): EditorTableNode;
|
|
20
|
+
export declare function createEditorFootnoteId(): string;
|
|
21
|
+
export declare function createEditorFootnote(blocks?: EditorBlockNode[]): EditorFootnote;
|
|
22
|
+
export declare function createFootnoteReferenceRun(footnoteId: string, marker: string, options?: {
|
|
23
|
+
customMark?: string;
|
|
24
|
+
styles?: EditorTextStyle;
|
|
25
|
+
}): EditorTextRun;
|
|
26
|
+
export declare const DEFAULT_EDITOR_STYLES: Record<string, EditorNamedStyle>;
|
|
27
|
+
export declare function createEditorDocument(blocks: EditorBlockNode[], pageSettings?: EditorPageSettings, sections?: EditorSection[], styles?: Record<string, EditorNamedStyle>, metadata?: {
|
|
28
|
+
title?: string;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}, assets?: Record<string, EditorAsset>): EditorDocument;
|
|
31
|
+
export declare function getDocumentCharacterCount(document: EditorDocument): number;
|
|
32
|
+
export declare function getDocumentWordCount(document: EditorDocument): number;
|
|
33
|
+
export declare function createEditorStateFromDocument(document: EditorDocument, selection?: {
|
|
34
|
+
paragraphIndex?: number;
|
|
35
|
+
offset?: number;
|
|
36
|
+
}): EditorState;
|
|
37
|
+
export declare function createSectionBoundaryParagraph(zone: "header" | "footer"): EditorParagraphNode;
|
|
38
|
+
export declare function createInitialEditorState(): EditorState;
|
|
39
|
+
export declare function createEditorStateFromTexts(texts: string[], selection?: {
|
|
40
|
+
anchor?: {
|
|
41
|
+
blockIndex: number;
|
|
42
|
+
offset: number;
|
|
43
|
+
};
|
|
44
|
+
focus?: {
|
|
45
|
+
blockIndex: number;
|
|
46
|
+
offset: number;
|
|
47
|
+
};
|
|
48
|
+
blockIndex?: number;
|
|
49
|
+
offset?: number;
|
|
50
|
+
}): EditorState;
|
|
51
|
+
export declare function createEditorStateFromParagraphRuns(paragraphsSpec: Array<Array<{
|
|
52
|
+
text: string;
|
|
53
|
+
styles?: EditorTextStyle;
|
|
54
|
+
image?: EditorImageRunData;
|
|
55
|
+
}>>, selection?: {
|
|
56
|
+
anchor?: {
|
|
57
|
+
blockIndex: number;
|
|
58
|
+
offset: number;
|
|
59
|
+
};
|
|
60
|
+
focus?: {
|
|
61
|
+
blockIndex: number;
|
|
62
|
+
offset: number;
|
|
63
|
+
};
|
|
64
|
+
blockIndex?: number;
|
|
65
|
+
offset?: number;
|
|
66
|
+
}): EditorState;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EditorLayoutLine, EditorLayoutFragment, EditorNamedStyle, EditorParagraphNode } from '../model.js';
|
|
2
|
+
|
|
3
|
+
export interface TextMeasureOptions {
|
|
4
|
+
paragraph: EditorParagraphNode;
|
|
5
|
+
fragments: EditorLayoutFragment[];
|
|
6
|
+
styles?: Record<string, EditorNamedStyle>;
|
|
7
|
+
contentWidth?: number;
|
|
8
|
+
layoutMode?: "fast" | "wordParity";
|
|
9
|
+
}
|
|
10
|
+
export interface ITextMeasurer {
|
|
11
|
+
composeMeasuredParagraphLines(options: TextMeasureOptions): EditorLayoutLine[];
|
|
12
|
+
resolveRenderedLineHeightPx(styles: any, lineHeightMultiple: number): number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { EditorBlockNode, EditorDocument, EditorFootnote, EditorFootnoteNumberFormat, EditorFootnotes, EditorParagraphNode, EditorTextRun } from '../model.js';
|
|
2
|
+
|
|
3
|
+
export declare function resetFootnoteIds(): void;
|
|
4
|
+
export declare function createFootnoteId(): string;
|
|
5
|
+
/**
|
|
6
|
+
* Iterate every paragraph in document order (sections + footnotes excluded),
|
|
7
|
+
* yielding each footnote reference run along with the owning paragraph. Order
|
|
8
|
+
* matches reading order, which is what numbering depends on.
|
|
9
|
+
*/
|
|
10
|
+
export declare function iterateFootnoteReferenceRuns(document: EditorDocument): Generator<{
|
|
11
|
+
paragraph: EditorParagraphNode;
|
|
12
|
+
run: EditorTextRun;
|
|
13
|
+
}, void, void>;
|
|
14
|
+
export declare function collectFootnoteReferences(document: EditorDocument): Array<{
|
|
15
|
+
paragraph: EditorParagraphNode;
|
|
16
|
+
run: EditorTextRun;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function getFootnoteDisplayMarker(oneBasedIndex: number, format?: EditorFootnoteNumberFormat | undefined): string;
|
|
19
|
+
export declare function getFootnotes(document: EditorDocument): EditorFootnotes | undefined;
|
|
20
|
+
export declare function getFootnoteBlocks(document: EditorDocument, footnoteId: string): EditorBlockNode[];
|
|
21
|
+
export declare function getFootnoteParagraphs(document: EditorDocument, footnoteId: string): EditorParagraphNode[];
|
|
22
|
+
export declare function findFootnoteByParagraphId(document: EditorDocument, paragraphId: string): {
|
|
23
|
+
footnoteId: string;
|
|
24
|
+
footnote: EditorFootnote;
|
|
25
|
+
} | null;
|
|
26
|
+
export declare function findFootnoteReference(document: EditorDocument, footnoteId: string): {
|
|
27
|
+
paragraph: EditorParagraphNode;
|
|
28
|
+
run: EditorTextRun;
|
|
29
|
+
} | null;
|
|
30
|
+
export interface FootnoteReferenceInfo {
|
|
31
|
+
footnoteId: string;
|
|
32
|
+
customMark?: string;
|
|
33
|
+
index: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function listReferencedFootnotes(document: EditorDocument): FootnoteReferenceInfo[];
|
|
36
|
+
/**
|
|
37
|
+
* Rewrite the text of footnote reference runs based on document order. Also
|
|
38
|
+
* removes footnote bodies that no longer have any reference in the document.
|
|
39
|
+
*
|
|
40
|
+
* Returns a new document only if anything actually changed.
|
|
41
|
+
*/
|
|
42
|
+
export declare function renumberFootnotes(document: EditorDocument): EditorDocument;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorParagraphNode, EditorPosition } from '../../../model.js';
|
|
2
|
+
|
|
3
|
+
export declare function getParagraphText(paragraph: EditorParagraphNode): string;
|
|
4
|
+
export declare function getParagraphLength(paragraph: EditorParagraphNode): number;
|
|
5
|
+
export declare function getRunIndex(paragraph: EditorParagraphNode, runId: string): number;
|
|
6
|
+
export declare function getRunStartOffset(paragraph: EditorParagraphNode, runId: string): number;
|
|
7
|
+
export declare function paragraphOffsetToPosition(paragraph: EditorParagraphNode, paragraphOffset: number): EditorPosition;
|
|
8
|
+
export declare function positionToParagraphOffset(paragraph: EditorParagraphNode, position: EditorPosition): number;
|