@univerjs-pro/pdfs-ui 1.0.0-alpha.8
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 +46 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/locale/ar-SA.js +1 -0
- package/lib/cjs/locale/ca-ES.js +1 -0
- package/lib/cjs/locale/de-DE.js +1 -0
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/es-ES.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/fr-FR.js +1 -0
- package/lib/cjs/locale/id-ID.js +1 -0
- package/lib/cjs/locale/it-IT.js +1 -0
- package/lib/cjs/locale/ja-JP.js +1 -0
- package/lib/cjs/locale/ko-KR.js +1 -0
- package/lib/cjs/locale/pl-PL.js +1 -0
- package/lib/cjs/locale/pt-BR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/sk-SK.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-HK.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/index.js +1 -0
- package/lib/es/locale/ar-SA.js +1 -0
- package/lib/es/locale/ca-ES.js +1 -0
- package/lib/es/locale/de-DE.js +1 -0
- package/lib/es/locale/en-US.js +1 -0
- package/lib/es/locale/es-ES.js +1 -0
- package/lib/es/locale/fa-IR.js +1 -0
- package/lib/es/locale/fr-FR.js +1 -0
- package/lib/es/locale/id-ID.js +1 -0
- package/lib/es/locale/it-IT.js +1 -0
- package/lib/es/locale/ja-JP.js +1 -0
- package/lib/es/locale/ko-KR.js +1 -0
- package/lib/es/locale/pl-PL.js +1 -0
- package/lib/es/locale/pt-BR.js +1 -0
- package/lib/es/locale/ru-RU.js +1 -0
- package/lib/es/locale/sk-SK.js +1 -0
- package/lib/es/locale/vi-VN.js +1 -0
- package/lib/es/locale/zh-CN.js +1 -0
- package/lib/es/locale/zh-HK.js +1 -0
- package/lib/es/locale/zh-TW.js +1 -0
- package/lib/index.css +520 -0
- package/lib/index.js +1 -0
- package/lib/locale/ar-SA.js +1 -0
- package/lib/locale/ca-ES.js +1 -0
- package/lib/locale/de-DE.js +1 -0
- package/lib/locale/en-US.js +1 -0
- package/lib/locale/es-ES.js +1 -0
- package/lib/locale/fa-IR.js +1 -0
- package/lib/locale/fr-FR.js +1 -0
- package/lib/locale/id-ID.js +1 -0
- package/lib/locale/it-IT.js +1 -0
- package/lib/locale/ja-JP.js +1 -0
- package/lib/locale/ko-KR.js +1 -0
- package/lib/locale/pl-PL.js +1 -0
- package/lib/locale/pt-BR.js +1 -0
- package/lib/locale/ru-RU.js +1 -0
- package/lib/locale/sk-SK.js +1 -0
- package/lib/locale/vi-VN.js +1 -0
- package/lib/locale/zh-CN.js +1 -0
- package/lib/locale/zh-HK.js +1 -0
- package/lib/locale/zh-TW.js +1 -0
- package/lib/types/commands/command-ids.d.ts +1 -0
- package/lib/types/commands/mutations/pdf-history.mutation.d.ts +9 -0
- package/lib/types/commands/operations/pdf-editor.operation.d.ts +22 -0
- package/lib/types/commands/operations/pdf-insert.operation.d.ts +17 -0
- package/lib/types/commands/operations/pdf-page-thumbnail.operation.d.ts +7 -0
- package/lib/types/config/config.d.ts +13 -0
- package/lib/types/context-menu/pdf-context-menu-position.d.ts +5 -0
- package/lib/types/controllers/components.controller.d.ts +9 -0
- package/lib/types/controllers/pdf-editor-unit.controller.d.ts +15 -0
- package/lib/types/controllers/pdf-inspector.controller.d.ts +12 -0
- package/lib/types/controllers/pdf-page-thumbnail-contextmenu.controller.d.ts +8 -0
- package/lib/types/controllers/pdf-ribbon.controller.d.ts +6 -0
- package/lib/types/controllers/pdf-ui.controller.d.ts +9 -0
- package/lib/types/editor/TextColorPicker.d.ts +11 -0
- package/lib/types/editor/canvas-text-edit-bridge.d.ts +23 -0
- package/lib/types/editor/canvas-text-editor.d.ts +69 -0
- package/lib/types/editor/chrome-model.d.ts +61 -0
- package/lib/types/editor/context-menu-model.d.ts +17 -0
- package/lib/types/editor/form-field-targets.d.ts +8 -0
- package/lib/types/editor/form-field-values.d.ts +16 -0
- package/lib/types/editor/geometry.d.ts +18 -0
- package/lib/types/editor/inspector-geometry.d.ts +13 -0
- package/lib/types/editor/inspector-model.d.ts +75 -0
- package/lib/types/editor/keyboard-controller.d.ts +32 -0
- package/lib/types/editor/list-layout.d.ts +21 -0
- package/lib/types/editor/managed-image-insert.d.ts +41 -0
- package/lib/types/editor/native-targets.d.ts +32 -0
- package/lib/types/editor/native-text-edit.d.ts +9 -0
- package/lib/types/editor/overlay-renderer.d.ts +63 -0
- package/lib/types/editor/paragraph-autofit.d.ts +31 -0
- package/lib/types/editor/pointer-controller.d.ts +76 -0
- package/lib/types/editor/pointer-frame-coalescer.d.ts +11 -0
- package/lib/types/editor/story-layout.d.ts +100 -0
- package/lib/types/editor/table-insertion.d.ts +17 -0
- package/lib/types/editor/table-layout.d.ts +32 -0
- package/lib/types/editor/table-renderer.d.ts +6 -0
- package/lib/types/editor/text-layout.d.ts +74 -0
- package/lib/types/index.d.ts +15 -0
- package/lib/types/locale/ar-SA.d.ts +3 -0
- package/lib/types/locale/ca-ES.d.ts +3 -0
- package/lib/types/locale/de-DE.d.ts +3 -0
- package/lib/types/locale/en-US.d.ts +212 -0
- package/lib/types/locale/es-ES.d.ts +3 -0
- package/lib/types/locale/fa-IR.d.ts +3 -0
- package/lib/types/locale/fr-FR.d.ts +3 -0
- package/lib/types/locale/id-ID.d.ts +3 -0
- package/lib/types/locale/it-IT.d.ts +3 -0
- package/lib/types/locale/ja-JP.d.ts +3 -0
- package/lib/types/locale/ko-KR.d.ts +3 -0
- package/lib/types/locale/pl-PL.d.ts +3 -0
- package/lib/types/locale/pt-BR.d.ts +3 -0
- package/lib/types/locale/ru-RU.d.ts +3 -0
- package/lib/types/locale/sk-SK.d.ts +3 -0
- package/lib/types/locale/types.d.ts +3 -0
- package/lib/types/locale/vi-VN.d.ts +3 -0
- package/lib/types/locale/zh-CN.d.ts +3 -0
- package/lib/types/locale/zh-HK.d.ts +3 -0
- package/lib/types/locale/zh-TW.d.ts +3 -0
- package/lib/types/menu/pdf-canvas-contextmenu.menu.d.ts +9 -0
- package/lib/types/menu/pdf-page-thumbnail.menu.d.ts +7 -0
- package/lib/types/menu/pdf-ribbon.menu.d.ts +27 -0
- package/lib/types/menu/schema.d.ts +4 -0
- package/lib/types/plugin.d.ts +19 -0
- package/lib/types/render/canvas-backend.d.ts +29 -0
- package/lib/types/render/canvas-group-compositor.d.ts +54 -0
- package/lib/types/render/canvas-renderer.d.ts +29 -0
- package/lib/types/render/canvas-shading.d.ts +12 -0
- package/lib/types/render/canvas-text.d.ts +15 -0
- package/lib/types/render/canvas-types.d.ts +3 -0
- package/lib/types/render/decode-manifest.d.ts +210 -0
- package/lib/types/render/document-json.d.ts +3 -0
- package/lib/types/render/document-object-renderer.d.ts +21 -0
- package/lib/types/render/font-outline.d.ts +27 -0
- package/lib/types/render/font-render-report.d.ts +71 -0
- package/lib/types/render/image-resolver.d.ts +30 -0
- package/lib/types/render/pdf-canvas-render-session.d.ts +34 -0
- package/lib/types/render/pdf-page-thumbnail-renderer.d.ts +49 -0
- package/lib/types/render/pdf-page-thumbnail-worker-client.d.ts +44 -0
- package/lib/types/render/pdf-page-thumbnail.worker.d.ts +9 -0
- package/lib/types/render/source-eraser.d.ts +18 -0
- package/lib/types/render/source-suppression.d.ts +10 -0
- package/lib/types/render/viewport.d.ts +21 -0
- package/lib/types/services/pdf-editor-command.service.d.ts +59 -0
- package/lib/types/services/pdf-editor-runtime.service.d.ts +62 -0
- package/lib/types/services/pdf-insert.service.d.ts +58 -0
- package/lib/types/services/pdf-managed-image-runtime.adapter.d.ts +37 -0
- package/lib/types/services/pdf-page-region-index.service.d.ts +48 -0
- package/lib/types/services/pdf-page-thumbnail-action.service.d.ts +15 -0
- package/lib/types/services/pdf-page-thumbnail-context.service.d.ts +36 -0
- package/lib/types/services/pdf-page-thumbnail-unit-action.service.d.ts +18 -0
- package/lib/types/services/pdf-render-resource-resolvers.d.ts +6 -0
- package/lib/types/views/PdfCanvasView.d.ts +2 -0
- package/lib/types/views/PdfFooter.d.ts +2 -0
- package/lib/types/views/PdfInsertTableMenu.d.ts +2 -0
- package/lib/types/views/PdfInspectorPanel.d.ts +3 -0
- package/lib/types/views/PdfPageThumbnailBar.d.ts +2 -0
- package/lib/types/views/PdfTableThemeGallery.d.ts +8 -0
- package/lib/types/views/PdfToolbar.d.ts +2 -0
- package/lib/types/views/pdf-canvas-pixel-alignment.d.ts +1 -0
- package/lib/types/views/pdf-canvas-text-edit-state.d.ts +34 -0
- package/lib/types/views/pdf-thumbnail-virtualizer.d.ts +22 -0
- package/lib/types/views/pdf-workbench-state.d.ts +8 -0
- package/lib/umd/index.js +1 -0
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -0
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/es-ES.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -0
- package/lib/umd/locale/ko-KR.js +1 -0
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/sk-SK.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ICommand } from '@univerjs/core';
|
|
2
|
+
export declare const PdfMovePageUpOperation: ICommand<object, boolean>;
|
|
3
|
+
export declare const PdfMovePageDownOperation: ICommand<object, boolean>;
|
|
4
|
+
export declare const PdfCopyPageOperation: ICommand<object, boolean>;
|
|
5
|
+
export declare const PdfRotatePageClockwiseOperation: ICommand<object, boolean>;
|
|
6
|
+
export declare const PdfDeletePageOperation: ICommand<object, boolean>;
|
|
7
|
+
export declare const PDF_PAGE_THUMBNAIL_OPERATIONS: ICommand[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Configuration for the formal PDF UI plugin. */
|
|
2
|
+
export interface IUniverPdfsUIConfig {
|
|
3
|
+
editor: {
|
|
4
|
+
/** Creates local editor runtime state and editing controllers. */
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
};
|
|
7
|
+
/** Module worker entry used for OffscreenCanvas page-thumbnail rendering. */
|
|
8
|
+
thumbnailWorkerURL?: string | URL | Worker;
|
|
9
|
+
}
|
|
10
|
+
export declare const PDFS_UI_PLUGIN_CONFIG_KEY = "pdfs-ui.config";
|
|
11
|
+
export declare const configSymbol: unique symbol;
|
|
12
|
+
export declare const defaultPluginConfig: IUniverPdfsUIConfig;
|
|
13
|
+
export declare const defaultPdfsUIPluginConfig: IUniverPdfsUIConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { ComponentManager, IconManager } from '@univerjs/ui';
|
|
3
|
+
export declare class ComponentsController extends Disposable {
|
|
4
|
+
private readonly _componentManager;
|
|
5
|
+
private readonly _iconManager;
|
|
6
|
+
constructor(_componentManager: ComponentManager, _iconManager: IconManager);
|
|
7
|
+
private _registerComponents;
|
|
8
|
+
private _registerIcons;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ICommandService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { IPdfEditorRuntimeService } from '../services/pdf-editor-runtime.service';
|
|
3
|
+
import { IPdfPageRegionIndexService } from '../services/pdf-page-region-index.service';
|
|
4
|
+
/**
|
|
5
|
+
* Binds client-only PDF editor runtime state to the formal PDF Unit lifecycle.
|
|
6
|
+
* Unit disposal is the sole owner of runtime cleanup at this boundary.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PdfEditorUnitController extends RxDisposable {
|
|
9
|
+
private readonly _instanceService;
|
|
10
|
+
private readonly _runtimeService;
|
|
11
|
+
private readonly _pageRegionService;
|
|
12
|
+
private readonly _commandService;
|
|
13
|
+
constructor(_instanceService: IUniverInstanceService, _runtimeService: IPdfEditorRuntimeService, _pageRegionService: IPdfPageRegionIndexService, _commandService: ICommandService);
|
|
14
|
+
private _init;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
2
|
+
import { ISidebarService } from '@univerjs/ui';
|
|
3
|
+
/** Keeps the standard Univer right sidebar attached to the active PDF Unit. */
|
|
4
|
+
export declare class PdfInspectorController extends Disposable {
|
|
5
|
+
private readonly _sidebarService;
|
|
6
|
+
private readonly _localeService;
|
|
7
|
+
private _panel;
|
|
8
|
+
private _unitId;
|
|
9
|
+
constructor(instanceService: IUniverInstanceService, _sidebarService: ISidebarService, _localeService: LocaleService);
|
|
10
|
+
dispose(): void;
|
|
11
|
+
private _setUnit;
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Disposable, ICommandService } from '@univerjs/core';
|
|
2
|
+
import { IMenuManagerService } from '@univerjs/ui';
|
|
3
|
+
/** Registers the PDF page-rail menu and its operations in one UI scope. */
|
|
4
|
+
export declare class PdfPageThumbnailContextMenuController extends Disposable {
|
|
5
|
+
private readonly _menuManagerService;
|
|
6
|
+
private readonly _commandService;
|
|
7
|
+
constructor(_menuManagerService: IMenuManagerService, _commandService: ICommandService);
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { IMenuManagerService } from '@univerjs/ui';
|
|
3
|
+
/** Adds PDF actions to the standard Univer ribbon. */
|
|
4
|
+
export declare class PdfRibbonController extends Disposable {
|
|
5
|
+
constructor(menuManagerService: IMenuManagerService);
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Disposable, Injector } from '@univerjs/core';
|
|
2
|
+
import { IUIPartsService } from '@univerjs/ui';
|
|
3
|
+
/** Registers PDF views in the standard Univer workbench. */
|
|
4
|
+
export declare class PdfUIController extends Disposable {
|
|
5
|
+
private readonly _injector;
|
|
6
|
+
private readonly _uiPartsService;
|
|
7
|
+
constructor(_injector: Injector, _uiPartsService: IUIPartsService);
|
|
8
|
+
private _registerWorkbenchParts;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IPdfEditorTextColorPickerProps {
|
|
2
|
+
value: string;
|
|
3
|
+
ariaLabel: string;
|
|
4
|
+
onChange: (color: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface IPdfEditorTextColorPickerHost {
|
|
7
|
+
dispose(): void;
|
|
8
|
+
}
|
|
9
|
+
/** Mounts the shared Univer color picker into a non-React inspector host. */
|
|
10
|
+
export declare function renderPdfEditorTextColorPicker(container: HTMLElement, props: IPdfEditorTextColorPickerProps): IPdfEditorTextColorPickerHost;
|
|
11
|
+
export declare function PdfEditorTextColorPicker({ value, ariaLabel, onChange }: IPdfEditorTextColorPickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfEditorCommandResult, IPdfEditorSession, PdfPoint } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfCanvasViewport } from '../render/viewport';
|
|
3
|
+
import type { IPdfCanvasTextEditController, IPdfCanvasTextEditKeyInput, IPdfCanvasTextEditStartInput, IPdfCanvasTextEditState } from './canvas-text-editor';
|
|
4
|
+
export interface IPdfCanvasTextEditPointInput {
|
|
5
|
+
session: IPdfEditorSession;
|
|
6
|
+
state: IPdfCanvasTextEditState;
|
|
7
|
+
cssPoint: PdfPoint;
|
|
8
|
+
viewport: Pick<IPdfCanvasViewport, 'zoom'>;
|
|
9
|
+
measureText: (text: string, font: string) => number;
|
|
10
|
+
document?: IPdfDocument;
|
|
11
|
+
}
|
|
12
|
+
export interface IPdfCanvasTextEditTarget extends IPdfCanvasTextEditStartInput {
|
|
13
|
+
offset: number;
|
|
14
|
+
}
|
|
15
|
+
export interface IPdfCanvasSemanticTextEditResult {
|
|
16
|
+
handled: boolean;
|
|
17
|
+
state?: IPdfCanvasTextEditState;
|
|
18
|
+
commandResults: IPdfEditorCommandResult[];
|
|
19
|
+
}
|
|
20
|
+
/** Resolve the same table/story/simple-text geometry used by the Canvas renderer. */
|
|
21
|
+
export declare function resolvePdfCanvasTextEditTargetAtPoint(input: IPdfCanvasTextEditPointInput): IPdfCanvasTextEditTarget | undefined;
|
|
22
|
+
/** Route only keys that change table/list/paragraph structure through the semantic controller. */
|
|
23
|
+
export declare function handlePdfCanvasSemanticTextEditKeyDown(controller: IPdfCanvasTextEditController, getSession: () => IPdfEditorSession, input: IPdfCanvasTextEditKeyInput): IPdfCanvasSemanticTextEditResult;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { IPdfEditorSession, IPdfEditorTextRange, PdfEditorGeneratedIdPrefix, PdfEmu, PdfId, PdfObjectId, PdfPageId, PdfRect, PdfTextListId, PdfTextRunId, PdfTextStoryId } from '@univerjs-pro/pdfs';
|
|
2
|
+
export interface IPdfCanvasTextEditControllerOptions {
|
|
3
|
+
actorId: string;
|
|
4
|
+
clientId?: string;
|
|
5
|
+
getSession: () => IPdfEditorSession;
|
|
6
|
+
setSession?: (session: IPdfEditorSession) => void;
|
|
7
|
+
now?: () => number;
|
|
8
|
+
createId?: (prefix: PdfEditorGeneratedIdPrefix) => string;
|
|
9
|
+
resolveParagraphCommitLayout?: (state: IPdfCanvasTextEditState, session: IPdfEditorSession, intent: IPdfCanvasParagraphCommitIntent) => IPdfCanvasParagraphCommitLayout | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface IPdfCanvasParagraphCommitIntent {
|
|
12
|
+
kind: 'edit' | 'split' | 'merge';
|
|
13
|
+
/** True when `session` already contains the structural preview. */
|
|
14
|
+
structurePreviewApplied: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface IPdfCanvasParagraphCommitLayout {
|
|
17
|
+
previousBbox: PdfRect;
|
|
18
|
+
nextBbox: PdfRect;
|
|
19
|
+
pageBottom: PdfEmu;
|
|
20
|
+
}
|
|
21
|
+
export interface IPdfCanvasTextEditStartInput {
|
|
22
|
+
pageId?: PdfPageId;
|
|
23
|
+
objectId: PdfObjectId;
|
|
24
|
+
cellId?: PdfId;
|
|
25
|
+
storyId?: PdfTextStoryId;
|
|
26
|
+
blockId?: PdfId;
|
|
27
|
+
runId?: PdfTextRunId;
|
|
28
|
+
range?: IPdfEditorTextRange;
|
|
29
|
+
}
|
|
30
|
+
export interface IPdfCanvasTextEditKeyInput {
|
|
31
|
+
key: string;
|
|
32
|
+
shiftKey?: boolean;
|
|
33
|
+
ctrlKey?: boolean;
|
|
34
|
+
metaKey?: boolean;
|
|
35
|
+
altKey?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface IPdfCanvasTextEditState {
|
|
38
|
+
pageId: PdfPageId;
|
|
39
|
+
objectId: PdfObjectId;
|
|
40
|
+
cellId?: PdfId;
|
|
41
|
+
originalText: string;
|
|
42
|
+
text: string;
|
|
43
|
+
selection: IPdfEditorTextRange;
|
|
44
|
+
/** Fixed endpoint used to preserve selection direction during Shift+Arrow. */
|
|
45
|
+
selectionAnchor?: number;
|
|
46
|
+
/** Moving endpoint used to preserve selection direction during Shift+Arrow. */
|
|
47
|
+
selectionFocus?: number;
|
|
48
|
+
storyId?: PdfTextStoryId;
|
|
49
|
+
blockId?: PdfId;
|
|
50
|
+
runId?: PdfTextRunId;
|
|
51
|
+
listId?: PdfTextListId;
|
|
52
|
+
listLevel?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface IPdfCanvasTextEditController {
|
|
55
|
+
startObjectEdit(input: IPdfCanvasTextEditStartInput): IPdfCanvasTextEditState | undefined;
|
|
56
|
+
getState(): IPdfCanvasTextEditState | undefined;
|
|
57
|
+
setSelection(range: IPdfEditorTextRange): IPdfCanvasTextEditState | undefined;
|
|
58
|
+
beginSelection(offset: number): IPdfCanvasTextEditState | undefined;
|
|
59
|
+
extendSelection(offset: number): IPdfCanvasTextEditState | undefined;
|
|
60
|
+
insertText(text: string): IPdfCanvasTextEditState | undefined;
|
|
61
|
+
replaceText(text: string, range: IPdfEditorTextRange): IPdfCanvasTextEditState | undefined;
|
|
62
|
+
handleKeyDown(input: IPdfCanvasTextEditKeyInput): {
|
|
63
|
+
handled: boolean;
|
|
64
|
+
state?: IPdfCanvasTextEditState;
|
|
65
|
+
};
|
|
66
|
+
commit(): IPdfEditorSession;
|
|
67
|
+
cancel(): void;
|
|
68
|
+
}
|
|
69
|
+
export declare function createPdfCanvasTextEditController(options: IPdfCanvasTextEditControllerOptions): IPdfCanvasTextEditController;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { LocaleService } from '@univerjs/core';
|
|
2
|
+
export declare enum PdfEditorRibbonTabId {
|
|
3
|
+
START = "pdf.ribbon.start",
|
|
4
|
+
INSERT = "pdf.ribbon.insert",
|
|
5
|
+
VIEW = "pdf.ribbon.view"
|
|
6
|
+
}
|
|
7
|
+
export declare enum PdfEditorRibbonGroupId {
|
|
8
|
+
FILE = "pdf.ribbon.group.file",
|
|
9
|
+
EDIT = "pdf.ribbon.group.edit",
|
|
10
|
+
TRANSFORM = "pdf.ribbon.group.transform",
|
|
11
|
+
INSERT = "pdf.ribbon.group.insert",
|
|
12
|
+
DISPLAY = "pdf.ribbon.group.display"
|
|
13
|
+
}
|
|
14
|
+
export declare enum PdfEditorRibbonActionId {
|
|
15
|
+
IMPORT_PDF = "pdf.ribbon.action.importPdf",
|
|
16
|
+
EXPORT_PDF = "pdf.ribbon.action.exportPdf",
|
|
17
|
+
UNDO = "pdf.ribbon.action.undo",
|
|
18
|
+
REDO = "pdf.ribbon.action.redo",
|
|
19
|
+
SELECT_TOOL = "pdf.ribbon.action.selectTool",
|
|
20
|
+
TEXT_TOOL = "pdf.ribbon.action.textTool",
|
|
21
|
+
FLIP_HORIZONTAL = "pdf.ribbon.action.flipHorizontal",
|
|
22
|
+
FLIP_VERTICAL = "pdf.ribbon.action.flipVertical",
|
|
23
|
+
ADD_TEXT = "pdf.ribbon.action.addText",
|
|
24
|
+
INSERT_IMAGE = "pdf.ribbon.action.insertImage",
|
|
25
|
+
INSERT_DIVIDER = "pdf.ribbon.action.insertDivider",
|
|
26
|
+
INSERT_TABLE = "pdf.ribbon.action.insertTable",
|
|
27
|
+
INSERT_LIST = "pdf.ribbon.action.insertList",
|
|
28
|
+
SHOW_ANNOTATIONS = "pdf.ribbon.action.showAnnotations",
|
|
29
|
+
SHOW_BOUNDS = "pdf.ribbon.action.showBounds",
|
|
30
|
+
SHOW_RAW = "pdf.ribbon.action.showRaw"
|
|
31
|
+
}
|
|
32
|
+
export type PdfEditorRibbonItemKind = 'button' | 'toggle';
|
|
33
|
+
export type PdfEditorRibbonTool = 'select' | 'text';
|
|
34
|
+
export interface IPdfEditorRibbonModelOptions {
|
|
35
|
+
activeTool: PdfEditorRibbonTool;
|
|
36
|
+
annotationsVisible: boolean;
|
|
37
|
+
boundsVisible: boolean;
|
|
38
|
+
rawVisible: boolean;
|
|
39
|
+
canTransformSelection: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface IPdfEditorRibbonItem {
|
|
42
|
+
id: PdfEditorRibbonActionId;
|
|
43
|
+
label: string;
|
|
44
|
+
kind: PdfEditorRibbonItemKind;
|
|
45
|
+
enabled: boolean;
|
|
46
|
+
active?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface IPdfEditorRibbonGroup {
|
|
49
|
+
id: PdfEditorRibbonGroupId;
|
|
50
|
+
label: string;
|
|
51
|
+
items: IPdfEditorRibbonItem[];
|
|
52
|
+
}
|
|
53
|
+
export interface IPdfEditorRibbonTab {
|
|
54
|
+
id: PdfEditorRibbonTabId;
|
|
55
|
+
label: string;
|
|
56
|
+
groups: IPdfEditorRibbonGroup[];
|
|
57
|
+
}
|
|
58
|
+
export interface IPdfEditorRibbonModel {
|
|
59
|
+
tabs: IPdfEditorRibbonTab[];
|
|
60
|
+
}
|
|
61
|
+
export declare function createPdfEditorRibbonModel(options: IPdfEditorRibbonModelOptions, localeService: LocaleService): IPdfEditorRibbonModel;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IPdfEditorSession } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { LocaleService } from '@univerjs/core';
|
|
3
|
+
export type PdfEditorContextMenuActionId = 'addText' | 'editText' | 'copy' | 'paste' | 'replaceImage' | 'cropImage' | 'flipHorizontal' | 'flipVertical' | 'bringForward' | 'sendBackward' | 'exportPatch' | 'delete';
|
|
4
|
+
export interface IPdfEditorContextMenuItem {
|
|
5
|
+
id: PdfEditorContextMenuActionId;
|
|
6
|
+
label: string;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
danger?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface IPdfEditorContextMenuGroup {
|
|
11
|
+
id: string;
|
|
12
|
+
items: IPdfEditorContextMenuItem[];
|
|
13
|
+
}
|
|
14
|
+
export interface IPdfEditorContextMenuModel {
|
|
15
|
+
groups: IPdfEditorContextMenuGroup[];
|
|
16
|
+
}
|
|
17
|
+
export declare function createPdfEditorContextMenuModel(session: IPdfEditorSession, localeService: LocaleService): IPdfEditorContextMenuModel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfEditorFormFieldHitTarget, PdfPageId } from '@univerjs-pro/pdfs';
|
|
2
|
+
/**
|
|
3
|
+
* Build bbox-level hit targets for page-visible AcroForm widgets.
|
|
4
|
+
*
|
|
5
|
+
* The returned target keeps both widget and field identities. The widget owns
|
|
6
|
+
* page placement and appearance; the form field owns semantic value state.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createPdfFormFieldHitTargets(document: IPdfDocument, pageId: PdfPageId): IPdfEditorFormFieldHitTarget[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PdfJsonValue } from '@univerjs-pro/pdfs';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a PDF form value represents an active checkbox/radio state.
|
|
4
|
+
*
|
|
5
|
+
* PDF button fields often use name values such as `/Yes` and `/Off` instead of
|
|
6
|
+
* booleans. This helper keeps UI logic independent from one source convention.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isPdfFormFieldOnValue(value: PdfJsonValue | undefined): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Toggle a checkbox while preserving source-style PDF name values when known.
|
|
11
|
+
*/
|
|
12
|
+
export declare function togglePdfCheckboxValue(currentValue: PdfJsonValue | undefined, onValue?: PdfJsonValue, offValue?: PdfJsonValue): PdfJsonValue;
|
|
13
|
+
/**
|
|
14
|
+
* Convert a PDF choice value into compact display text for an editor overlay.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolvePdfChoiceDisplayText(value: PdfJsonValue | undefined): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PdfMatrix, PdfPoint, PdfRect } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfCanvasViewport } from '../render/viewport';
|
|
3
|
+
export interface IPdfEditorCssBox {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Convert a PDF editor model-space rect into page-local CSS pixels.
|
|
11
|
+
*
|
|
12
|
+
* Editor model coordinates are EMU. DOM overlays such as textareas and resize
|
|
13
|
+
* handles are positioned in CSS pixels, so this helper keeps that boundary
|
|
14
|
+
* explicit and shared with the canvas overlay renderer.
|
|
15
|
+
*/
|
|
16
|
+
export declare function pdfEditorModelRectToCssBox(rect: PdfRect, viewport: Pick<IPdfCanvasViewport, 'zoom'>): IPdfEditorCssBox;
|
|
17
|
+
export declare function pdfEditorModelLengthToCssPx(value: number, viewport: Pick<IPdfCanvasViewport, 'zoom'>): number;
|
|
18
|
+
export declare function pdfEditorCanvasPointToObjectLocalCssPoint(point: PdfPoint, transform: PdfMatrix | undefined, viewport: Pick<IPdfCanvasViewport, 'zoom'>): PdfPoint | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PdfRect } from '@univerjs-pro/pdfs';
|
|
2
|
+
/** Transform fields exposed by the PDF editor inspector. */
|
|
3
|
+
export declare enum PdfEditorInspectorTransformFieldId {
|
|
4
|
+
X = "x",
|
|
5
|
+
Y = "y",
|
|
6
|
+
WIDTH = "width",
|
|
7
|
+
HEIGHT = "height"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Applies a logical CSS-pixel inspector value to an EMU object rectangle.
|
|
11
|
+
* Position edits preserve dimensions, while dimensions remain at least one px.
|
|
12
|
+
*/
|
|
13
|
+
export declare function updatePdfEditorInspectorBboxFromPx(bbox: readonly number[], fieldId: PdfEditorInspectorTransformFieldId, valuePx: number): PdfRect;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { IPdfEditorSession, IPdfStroke, IPdfTableCell, IPdfTableCellStyle, IPdfTableObject, IPdfTextBlock, IPdfTextRun, IPdfTextStory, PdfObjectId } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { LocaleService } from '@univerjs/core';
|
|
3
|
+
export type PdfEditorInspectorFieldType = 'readonly' | 'text' | 'number' | 'color' | 'select';
|
|
4
|
+
export declare enum PdfEditorInspectorParagraphFieldId {
|
|
5
|
+
ALIGN = "paragraphAlign",
|
|
6
|
+
LINE_HEIGHT = "paragraphLineHeight",
|
|
7
|
+
INDENT = "paragraphIndent",
|
|
8
|
+
FIRST_LINE_INDENT = "paragraphFirstLineIndent",
|
|
9
|
+
RIGHT_INDENT = "paragraphRightIndent",
|
|
10
|
+
SPACING_BEFORE = "paragraphSpacingBefore",
|
|
11
|
+
SPACING_AFTER = "paragraphSpacingAfter"
|
|
12
|
+
}
|
|
13
|
+
export declare enum PdfEditorInspectorCellFieldId {
|
|
14
|
+
BACKGROUND = "cellBackground",
|
|
15
|
+
VERTICAL_ALIGN = "cellVerticalAlign"
|
|
16
|
+
}
|
|
17
|
+
export declare enum PdfEditorInspectorTableFieldId {
|
|
18
|
+
THEME = "tableTheme"
|
|
19
|
+
}
|
|
20
|
+
export declare enum PdfEditorInspectorPathFieldId {
|
|
21
|
+
STROKE_COLOR = "strokeColor"
|
|
22
|
+
}
|
|
23
|
+
export interface IPdfEditorInspectorTableTarget {
|
|
24
|
+
tableId: PdfObjectId;
|
|
25
|
+
pageId?: string;
|
|
26
|
+
table: IPdfTableObject;
|
|
27
|
+
}
|
|
28
|
+
export interface IPdfEditorInspectorTableCellTarget {
|
|
29
|
+
tableId: PdfObjectId;
|
|
30
|
+
cellId: string;
|
|
31
|
+
pageId?: string;
|
|
32
|
+
table: IPdfTableObject;
|
|
33
|
+
cell: IPdfTableCell;
|
|
34
|
+
style: IPdfTableCellStyle;
|
|
35
|
+
storyId: string;
|
|
36
|
+
story?: IPdfTextStory;
|
|
37
|
+
block?: IPdfTextBlock;
|
|
38
|
+
}
|
|
39
|
+
export interface IPdfEditorInspectorField {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
type: PdfEditorInspectorFieldType;
|
|
43
|
+
value?: string | number | boolean;
|
|
44
|
+
unit?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface IPdfEditorInspectorAction {
|
|
47
|
+
id: string;
|
|
48
|
+
label: string;
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface IPdfEditorInspectorSection {
|
|
52
|
+
id: string;
|
|
53
|
+
title: string;
|
|
54
|
+
fields: IPdfEditorInspectorField[];
|
|
55
|
+
actions: IPdfEditorInspectorAction[];
|
|
56
|
+
}
|
|
57
|
+
export interface IPdfEditorInspectorModel {
|
|
58
|
+
title: string;
|
|
59
|
+
subtitle?: string;
|
|
60
|
+
sections: IPdfEditorInspectorSection[];
|
|
61
|
+
}
|
|
62
|
+
/** Resolves the run whose style should be represented by the inspector. */
|
|
63
|
+
export declare function resolvePdfEditorInspectorTextRun(session: IPdfEditorSession, objectId: PdfObjectId): IPdfTextRun | undefined;
|
|
64
|
+
/** Resolves the semantic story block containing the active text run. */
|
|
65
|
+
export declare function resolvePdfEditorInspectorTextBlock(session: IPdfEditorSession, objectId: PdfObjectId): {
|
|
66
|
+
storyId: string;
|
|
67
|
+
block: IPdfTextBlock;
|
|
68
|
+
} | undefined;
|
|
69
|
+
/** Resolves the effective stroke of an editable path object. */
|
|
70
|
+
export declare function resolvePdfEditorInspectorPathStroke(session: IPdfEditorSession, objectId: PdfObjectId): IPdfStroke | undefined;
|
|
71
|
+
/** Resolves the active structured table cell for cell or cell-text selections. */
|
|
72
|
+
export declare function resolvePdfEditorInspectorTableCell(session: IPdfEditorSession): IPdfEditorInspectorTableCellTarget | undefined;
|
|
73
|
+
/** Resolves a table from object, cell, or cell-text selection. */
|
|
74
|
+
export declare function resolvePdfEditorInspectorTable(session: IPdfEditorSession): IPdfEditorInspectorTableTarget | undefined;
|
|
75
|
+
export declare function createPdfEditorInspectorModel(session: IPdfEditorSession, localeService: LocaleService): IPdfEditorInspectorModel;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IPdfEditorCommandResult, IPdfEditorSession, PdfEditorGeneratedIdPrefix } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfCanvasViewport } from '../render/viewport';
|
|
3
|
+
export interface IPdfEditorKeyboardControllerOptions {
|
|
4
|
+
actorId: string;
|
|
5
|
+
viewport: IPdfCanvasViewport;
|
|
6
|
+
getSession: () => IPdfEditorSession;
|
|
7
|
+
setSession?: (session: IPdfEditorSession) => void;
|
|
8
|
+
clientId?: string;
|
|
9
|
+
now?: () => number;
|
|
10
|
+
createId?: (prefix: PdfEditorGeneratedIdPrefix) => string;
|
|
11
|
+
onUndo?: (session: IPdfEditorSession) => IPdfEditorSession | void;
|
|
12
|
+
onRedo?: (session: IPdfEditorSession) => IPdfEditorSession | void;
|
|
13
|
+
onClearActiveEdit?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface IPdfEditorKeyboardInput {
|
|
16
|
+
key: string;
|
|
17
|
+
shiftKey?: boolean;
|
|
18
|
+
ctrlKey?: boolean;
|
|
19
|
+
metaKey?: boolean;
|
|
20
|
+
altKey?: boolean;
|
|
21
|
+
targetEditable?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface IPdfEditorKeyboardResult {
|
|
24
|
+
handled: boolean;
|
|
25
|
+
session: IPdfEditorSession;
|
|
26
|
+
commandResult?: IPdfEditorCommandResult;
|
|
27
|
+
reason?: 'nudge' | 'delete' | 'undo' | 'redo' | 'escape';
|
|
28
|
+
}
|
|
29
|
+
export interface IPdfEditorKeyboardController {
|
|
30
|
+
handleKeyDown(input: IPdfEditorKeyboardInput): IPdfEditorKeyboardResult;
|
|
31
|
+
}
|
|
32
|
+
export declare function createPdfEditorKeyboardController(options: IPdfEditorKeyboardControllerOptions): IPdfEditorKeyboardController;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PdfId } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfEditorTextStoryBlockLayout, IPdfEditorTextStoryLayout, IPdfEditorTextStoryLayoutInput, IPdfEditorTextStoryLineLayout, IPdfEditorTextStoryTextRect } from './story-layout';
|
|
3
|
+
export type IPdfEditorListStoryLayoutInput = IPdfEditorTextStoryLayoutInput;
|
|
4
|
+
export type IPdfEditorListLineLayout = IPdfEditorTextStoryLineLayout;
|
|
5
|
+
export type IPdfEditorListBlockLayout = IPdfEditorTextStoryBlockLayout;
|
|
6
|
+
export type IPdfEditorListStoryLayout = IPdfEditorTextStoryLayout;
|
|
7
|
+
export type IPdfEditorListStoryTextRect = IPdfEditorTextStoryTextRect;
|
|
8
|
+
export interface IPdfEditorListStoryTextTarget {
|
|
9
|
+
blockId: PdfId;
|
|
10
|
+
offset: number;
|
|
11
|
+
storyOffset: number;
|
|
12
|
+
}
|
|
13
|
+
/** Compatibility wrapper for list callers migrated to the shared Story Layout. */
|
|
14
|
+
export declare function layoutPdfEditorListStory(input: IPdfEditorListStoryLayoutInput): IPdfEditorListStoryLayout;
|
|
15
|
+
/** Compatibility wrapper that preserves the original list target shape. */
|
|
16
|
+
export declare function getPdfEditorListStoryTargetAtPoint(layout: IPdfEditorListStoryLayout, point: readonly [number, number]): IPdfEditorListStoryTextTarget | undefined;
|
|
17
|
+
export declare function getPdfEditorListStoryCaretRect(layout: IPdfEditorListStoryLayout, blockId: PdfId, offset: number): IPdfEditorListStoryTextRect | undefined;
|
|
18
|
+
export declare function getPdfEditorListStorySelectionRects(layout: IPdfEditorListStoryLayout, blockId: PdfId, range: {
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
}): IPdfEditorListStoryTextRect[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfEditorCommandContext, IPdfEditorCommandResult, IPdfEditorSession, IPdfPage, PdfAssetId, PdfPageId, PdfRect } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { PdfImageResolverResult } from '../render/image-resolver';
|
|
3
|
+
import type { IPdfManagedImageRuntimeAdapter } from '../services/pdf-managed-image-runtime.adapter';
|
|
4
|
+
export interface IPdfManagedImageDimensions {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const PDF_MANAGED_IMAGE_MAX_PAGE_RATIO = 0.6;
|
|
9
|
+
export interface IPdfManagedImageInsertionPreparationOptions {
|
|
10
|
+
document: IPdfDocument;
|
|
11
|
+
session: IPdfEditorSession;
|
|
12
|
+
pageId: PdfPageId;
|
|
13
|
+
file: File;
|
|
14
|
+
adapter: Pick<IPdfManagedImageRuntimeAdapter, 'save' | 'release'>;
|
|
15
|
+
commandContext: IPdfEditorCommandContext;
|
|
16
|
+
createAssetId(document: IPdfDocument, session: IPdfEditorSession): PdfAssetId;
|
|
17
|
+
zIndex: number;
|
|
18
|
+
isContextCurrent(): boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface IPdfManagedImageInsertionPreparationResult {
|
|
21
|
+
assetId: PdfAssetId;
|
|
22
|
+
pageId: PdfPageId;
|
|
23
|
+
commandResult: IPdfEditorCommandResult;
|
|
24
|
+
}
|
|
25
|
+
export interface IPdfWorkbenchDisposableOwner {
|
|
26
|
+
dispose(): void;
|
|
27
|
+
}
|
|
28
|
+
export type PdfWorkbenchDisposeErrorReporter = (errors: readonly unknown[]) => void;
|
|
29
|
+
/** Convert the visible native PDF page box into top-left editor EMU coordinates. */
|
|
30
|
+
export declare function getPdfPageVisibleModelBox(page: Pick<IPdfPage, 'pdfBoxes'>): PdfRect;
|
|
31
|
+
/**
|
|
32
|
+
* Fit an image within a centered portion of a PDF page box without changing
|
|
33
|
+
* its aspect ratio or enlarging it past its intrinsic CSS-pixel dimensions.
|
|
34
|
+
*/
|
|
35
|
+
export declare function fitPdfManagedImageIntoPage(image: IPdfManagedImageDimensions, pageBox: Readonly<PdfRect>, maxPageRatio?: number): PdfRect;
|
|
36
|
+
/** Prepare and execute a managed image insertion without applying host UI state. */
|
|
37
|
+
export declare function preparePdfManagedImageInsertion(options: IPdfManagedImageInsertionPreparationOptions): Promise<IPdfManagedImageInsertionPreparationResult>;
|
|
38
|
+
/** Resolve a durable managed resource first and invoke the native fallback only when needed. */
|
|
39
|
+
export declare function resolvePdfManagedImageRuntimeSource(documentId: string, editState: Pick<IPdfEditorSession['editState'], 'documentId' | 'managedResources'> | undefined, assetId: PdfAssetId, adapter: Pick<IPdfManagedImageRuntimeAdapter, 'resolve'>, fallback: () => PdfImageResolverResult): PdfImageResolverResult;
|
|
40
|
+
/** Dispose every Workbench owner, then report all failures together. */
|
|
41
|
+
export declare function disposePdfWorkbenchOwnersBestEffort(owners: readonly IPdfWorkbenchDisposableOwner[], reportErrors?: PdfWorkbenchDisposeErrorReporter): unknown[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IPdfDocument, IPdfEditorNativeFormXObjectHitTarget, IPdfEditorNativeTextHitTarget, IPdfPage, PdfDisplayListId, PdfPageId } from '@univerjs-pro/pdfs';
|
|
2
|
+
export interface IPdfNativeTargetBuildOptions {
|
|
3
|
+
/** Materialized page geometry to use while keeping source data indexed by document identity. */
|
|
4
|
+
page?: IPdfPage;
|
|
5
|
+
/**
|
|
6
|
+
* Maximum Form XObject nesting depth to walk while building targets.
|
|
7
|
+
*
|
|
8
|
+
* Real PDFs can contain recursive or deeply nested resources. A small cap
|
|
9
|
+
* keeps hit-target building bounded for large documents while covering the
|
|
10
|
+
* normal page -> form -> text cases.
|
|
11
|
+
*/
|
|
12
|
+
maxFormDepth?: number;
|
|
13
|
+
/** Explicit page roots avoid treating nested same-page Form lists as roots. */
|
|
14
|
+
rootDisplayListIds?: readonly PdfDisplayListId[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Build bbox-level hit targets for native PDF text display operations.
|
|
18
|
+
*
|
|
19
|
+
* The returned targets are already mapped into the containing page's model
|
|
20
|
+
* coordinate system (EMU, top-left origin). Form XObject targets include an
|
|
21
|
+
* operationPath so edit suppression can address one painted instance instead
|
|
22
|
+
* of every reuse of the same inner display operation.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createPdfNativeTextHitTargets(document: IPdfDocument, pageId: PdfPageId, options?: IPdfNativeTargetBuildOptions): IPdfEditorNativeTextHitTarget[];
|
|
25
|
+
/**
|
|
26
|
+
* Build bbox-level hit targets for native Form XObject paint operations.
|
|
27
|
+
*
|
|
28
|
+
* These targets represent one painted instance of a form, not the reusable form
|
|
29
|
+
* asset globally. The operationPath is therefore required for source
|
|
30
|
+
* suppression so editing one reuse does not hide every reuse of the same form.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createPdfNativeFormXObjectHitTargets(document: IPdfDocument, pageId: PdfPageId, options?: IPdfNativeTargetBuildOptions): IPdfEditorNativeFormXObjectHitTarget[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IPdfEditorNativeTextHitTarget, IPdfEditorSession } from '@univerjs-pro/pdfs';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the selected native PDF text span back to its hit target.
|
|
4
|
+
*
|
|
5
|
+
* Native text is first selected as a SOURCE_SPAN because the original PDF
|
|
6
|
+
* operators must remain immutable. Promotion to an editable overlay needs the
|
|
7
|
+
* richer target payload, including bbox, runs, and source mapping.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findPdfNativeTextTargetForSelection(session: IPdfEditorSession, targets: IPdfEditorNativeTextHitTarget[]): IPdfEditorNativeTextHitTarget | undefined;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { IPdfAcroFormDefaultAppearance, IPdfDocument, IPdfDurableEditState, IPdfEditorEditState, IPdfEditorSelectionState, IPdfEditorTextRange, IPdfImageAsset, PdfAssetId, PdfColor, PdfDisplayOperationId, PdfObjectId, PdfPageId, PdfRect } from '@univerjs-pro/pdfs';
|
|
2
|
+
import type { IPdfFontFamilyResolver } from '../render/decode-manifest';
|
|
3
|
+
import type { IPdfFontOutlineResolver } from '../render/font-outline';
|
|
4
|
+
import type { IPdfImageResolver } from '../render/image-resolver';
|
|
5
|
+
import type { IPdfCanvasViewport } from '../render/viewport';
|
|
6
|
+
import { PdfFormFieldType } from '@univerjs-pro/pdfs';
|
|
7
|
+
export interface IPdfEditorOverlayRenderOptions {
|
|
8
|
+
editState: IPdfEditorEditState;
|
|
9
|
+
pageId: PdfPageId;
|
|
10
|
+
includedObjectIds?: ReadonlySet<PdfObjectId>;
|
|
11
|
+
viewport: IPdfCanvasViewport;
|
|
12
|
+
selection?: IPdfEditorSelectionState;
|
|
13
|
+
showSelection?: boolean;
|
|
14
|
+
textPaddingCssPx?: number;
|
|
15
|
+
sourceSelectionBounds?: IPdfEditorSourceSelectionBounds[];
|
|
16
|
+
formFieldBounds?: IPdfEditorFormFieldOverlayBounds[];
|
|
17
|
+
document?: IPdfDocument;
|
|
18
|
+
fontFamilyResolver?: IPdfFontFamilyResolver;
|
|
19
|
+
fontOutlineResolver?: IPdfFontOutlineResolver;
|
|
20
|
+
imageResolver?: IPdfImageResolver;
|
|
21
|
+
imageAssetResolver?: IPdfEditorImageAssetResolver;
|
|
22
|
+
activeTextEditState?: IPdfEditorOverlayActiveTextEditState;
|
|
23
|
+
}
|
|
24
|
+
export type IPdfEditorImageAssetResolver = (document: IPdfDocument, editState: IPdfDurableEditState, assetId: PdfAssetId) => IPdfImageAsset | undefined;
|
|
25
|
+
export interface IPdfEditorOverlayActiveTextEditState {
|
|
26
|
+
objectId: PdfObjectId;
|
|
27
|
+
cellId?: string;
|
|
28
|
+
storyId?: string;
|
|
29
|
+
blockId?: string;
|
|
30
|
+
runId?: string;
|
|
31
|
+
text: string;
|
|
32
|
+
selection?: IPdfEditorTextRange;
|
|
33
|
+
}
|
|
34
|
+
export interface IPdfEditorSourceSelectionBounds {
|
|
35
|
+
id: string;
|
|
36
|
+
pageId: PdfPageId;
|
|
37
|
+
bbox: PdfRect;
|
|
38
|
+
displayOperationId?: PdfDisplayOperationId;
|
|
39
|
+
kind?: 'image' | 'formXObject' | 'path' | 'text' | 'unknown';
|
|
40
|
+
}
|
|
41
|
+
export interface IPdfEditorFormFieldOverlayBounds {
|
|
42
|
+
id: string;
|
|
43
|
+
pageId: PdfPageId;
|
|
44
|
+
bbox: PdfRect;
|
|
45
|
+
widgetObjectId: string;
|
|
46
|
+
fieldObjectId?: string;
|
|
47
|
+
fieldType?: PdfFormFieldType;
|
|
48
|
+
onValue?: string;
|
|
49
|
+
defaultAppearance?: IPdfAcroFormDefaultAppearance;
|
|
50
|
+
needsAppearance?: boolean;
|
|
51
|
+
quadding?: number;
|
|
52
|
+
backgroundColor?: PdfColor;
|
|
53
|
+
borderColor?: PdfColor;
|
|
54
|
+
borderWidth?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Render user-editable PDF overlay objects on top of the native page canvas.
|
|
58
|
+
*
|
|
59
|
+
* This renderer is deliberately separate from the PDF display-list renderer:
|
|
60
|
+
* imported native content remains in `pdfs-render`, while editor overlays are
|
|
61
|
+
* drawn from `PdfEditorEditState`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function renderPdfEditorOverlayToCanvas(context: CanvasRenderingContext2D, options: IPdfEditorOverlayRenderOptions): void;
|