oasis-editor 0.0.76 → 0.0.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{OasisEditorApp-BkJmlejJ.js → OasisEditorApp-C3VK8dmM.js} +21511 -21160
- package/dist/{index-ByZZP8TQ.js → index-CqVqLWyO.js} +163 -163
- package/dist/oasis-editor.js +12 -12
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/app/EditorWorkspace.d.ts +16 -4
- package/dist/ui/app/connectEditorClientHost.d.ts +31 -0
- package/dist/ui/app/createAppCommandsController.d.ts +112 -0
- package/dist/ui/app/createEditorChangeBroadcast.d.ts +19 -0
- package/dist/ui/app/createEditorChrome.d.ts +57 -0
- package/dist/ui/app/createEditorCommandRuntime.d.ts +106 -0
- package/dist/ui/app/createEditorDocumentRuntime.d.ts +85 -0
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +209 -0
- package/dist/ui/app/createEditorKeyboardBinding.d.ts +51 -0
- package/package.json +1 -1
|
@@ -8,15 +8,18 @@ import { EditorLayoutParagraph, EditorState } from '../../core/model.js';
|
|
|
8
8
|
import { ToolbarLayoutMode, ToolbarViewMode } from '../OasisEditorAppProps.js';
|
|
9
9
|
import { OasisEditor } from '../../core/plugin.js';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
shellComponent: () => (props: ShellProps) => ReturnType<typeof OasisEditorEditor>;
|
|
11
|
+
/** Runtime facade the workspace forwards to the editor surface and shell. */
|
|
12
|
+
export interface EditorWorkspaceRuntime {
|
|
14
13
|
state: Accessor<EditorState>;
|
|
15
14
|
toolbarHost: () => ToolbarHost;
|
|
16
15
|
runtimeEditor: Accessor<OasisEditor>;
|
|
17
16
|
persistenceStatus: () => string;
|
|
18
17
|
toolbarRegistry: ToolbarRegistry;
|
|
19
18
|
menuRegistry: MenuRegistry;
|
|
19
|
+
showFloatingTableToolbar: Accessor<boolean>;
|
|
20
|
+
}
|
|
21
|
+
/** Chrome visibility / toolbar-mode flags. */
|
|
22
|
+
export interface EditorWorkspaceChrome {
|
|
20
23
|
showChrome: () => boolean;
|
|
21
24
|
showTitleBar: () => boolean;
|
|
22
25
|
showMenubar: () => boolean;
|
|
@@ -24,11 +27,13 @@ export interface EditorWorkspaceProps {
|
|
|
24
27
|
showOutline: () => boolean;
|
|
25
28
|
toolbarView: () => ToolbarViewMode;
|
|
26
29
|
toolbarLayout: () => ToolbarLayoutMode;
|
|
30
|
+
}
|
|
31
|
+
/** The document-view props: read-only/sizing plus the assembled prop bundles. */
|
|
32
|
+
export interface EditorWorkspaceView {
|
|
27
33
|
isReadOnly: () => boolean;
|
|
28
34
|
viewportHeight: () => number | string | undefined;
|
|
29
35
|
measuredBlockHeights: Accessor<Record<string, number>>;
|
|
30
36
|
measuredParagraphLayouts: Accessor<Record<string, EditorLayoutParagraph>>;
|
|
31
|
-
showFloatingTableToolbar: Accessor<boolean>;
|
|
32
37
|
layout: OasisEditorEditorLayoutProps;
|
|
33
38
|
overlays: OasisEditorEditorOverlayProps;
|
|
34
39
|
refs: OasisEditorEditorRefProps;
|
|
@@ -36,6 +41,13 @@ export interface EditorWorkspaceProps {
|
|
|
36
41
|
inputHandlers: OasisEditorEditorInputHandlers;
|
|
37
42
|
fileHandlers: OasisEditorEditorFileHandlers;
|
|
38
43
|
}
|
|
44
|
+
export interface EditorWorkspaceProps {
|
|
45
|
+
useComposedShell: () => boolean;
|
|
46
|
+
shellComponent: () => (props: ShellProps) => ReturnType<typeof OasisEditorEditor>;
|
|
47
|
+
runtime: EditorWorkspaceRuntime;
|
|
48
|
+
chrome: EditorWorkspaceChrome;
|
|
49
|
+
view: EditorWorkspaceView;
|
|
50
|
+
}
|
|
39
51
|
/**
|
|
40
52
|
* Renders the editor body, choosing between the composed shell (docs/inline/
|
|
41
53
|
* balloon chrome) and the bare canvas editor. Pure binding: it forwards the
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EditorDocument, EditorState } from '../../core/model.js';
|
|
2
|
+
import { OasisEditorClientController } from '../../app/client/OasisEditorClient.js';
|
|
3
|
+
import { createEditorDocumentIO } from '../../app/controllers/useEditorDocumentIO.js';
|
|
4
|
+
import { useEditorRuntimeBootstrap } from './useEditorRuntimeBootstrap.js';
|
|
5
|
+
|
|
6
|
+
type RuntimeEditorAccessor = ReturnType<typeof useEditorRuntimeBootstrap>["runtimeEditor"];
|
|
7
|
+
type EditorDocumentIO = ReturnType<typeof createEditorDocumentIO>;
|
|
8
|
+
export interface ConnectEditorClientHostDeps {
|
|
9
|
+
runtimeReady: () => boolean;
|
|
10
|
+
runtimeEditor: RuntimeEditorAccessor;
|
|
11
|
+
getStateSnapshot: () => EditorState;
|
|
12
|
+
cloneState: (state: EditorState) => EditorState;
|
|
13
|
+
applyState: (next: EditorState) => void;
|
|
14
|
+
resetEditorChromeState: () => void;
|
|
15
|
+
focusInput: () => void;
|
|
16
|
+
setFocused: (focused: boolean) => void;
|
|
17
|
+
clearHistory: () => void;
|
|
18
|
+
getPersistence: () => {
|
|
19
|
+
saveDocument: (document: EditorDocument) => Promise<void> | void;
|
|
20
|
+
};
|
|
21
|
+
docIO: Pick<EditorDocumentIO, "handleImportFile" | "handleExportDocx" | "handleExportPdf">;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Wires the imperative `OasisEditorClient` host surface (get/set document,
|
|
25
|
+
* selection, save, focus, import/export) onto the editor's state and IO
|
|
26
|
+
* controllers. Pure callback wiring with no reactive ownership, extracted from
|
|
27
|
+
* `OasisEditorApp` so the composition root no longer hosts the public client
|
|
28
|
+
* adapter inline (S1).
|
|
29
|
+
*/
|
|
30
|
+
export declare function connectEditorClientHost(controller: OasisEditorClientController, deps: ConnectEditorClientHostDeps): void;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { EditorState } from '../../core/model.js';
|
|
2
|
+
import { SelectedImageRun } from '../../core/commands/image.js';
|
|
3
|
+
import { BooleanStyleKey, ToolbarStyleState } from '../toolbarStyleState.js';
|
|
4
|
+
import { EditorLogger } from '../../utils/logger.js';
|
|
5
|
+
import { EditorTransactionPort } from '../../app/controllers/controllerPorts.js';
|
|
6
|
+
import { createEditorTableOperations } from '../../app/controllers/useEditorTableOperations.js';
|
|
7
|
+
|
|
8
|
+
type EditorTableOperations = ReturnType<typeof createEditorTableOperations>;
|
|
9
|
+
export interface AppCommandsControllerDeps {
|
|
10
|
+
state: EditorState;
|
|
11
|
+
logger: EditorLogger;
|
|
12
|
+
applyState: EditorTransactionPort["applyState"];
|
|
13
|
+
applyTransactionalState: EditorTransactionPort["applyTransactionalState"];
|
|
14
|
+
clearPreferredColumn: () => void;
|
|
15
|
+
resetTransactionGrouping: () => void;
|
|
16
|
+
focusInput: () => void;
|
|
17
|
+
selectedImageRun: () => SelectedImageRun | null;
|
|
18
|
+
tableOps: Pick<EditorTableOperations, "applySelectionAwareTextCommand" | "applySelectionAwareParagraphCommand" | "applyTableAwareParagraphEdit">;
|
|
19
|
+
toolbarStyleState: () => ToolbarStyleState;
|
|
20
|
+
applyBooleanStyleCommand: (style: BooleanStyleKey) => void;
|
|
21
|
+
locale: () => string;
|
|
22
|
+
setLinkDialog: (state: {
|
|
23
|
+
isOpen: boolean;
|
|
24
|
+
initialHref: string;
|
|
25
|
+
}) => void;
|
|
26
|
+
setImageAltDialog: (state: {
|
|
27
|
+
isOpen: boolean;
|
|
28
|
+
initialAlt: string;
|
|
29
|
+
}) => void;
|
|
30
|
+
setImageCaptionDialog: (state: {
|
|
31
|
+
isOpen: boolean;
|
|
32
|
+
initialCaption: string;
|
|
33
|
+
}) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds the command controller (and its keyboard-flavoured variant that adds
|
|
37
|
+
* `applyBooleanStyleCommand`) from the editor's collaborators, owning the inline
|
|
38
|
+
* dialog-opener closures and the locale-derived caption label. Extracted from
|
|
39
|
+
* `OasisEditorApp` so the composition root no longer maps these payload/dialog
|
|
40
|
+
* callbacks by hand (S1).
|
|
41
|
+
*/
|
|
42
|
+
export declare function createAppCommandsController(deps: AppCommandsControllerDeps): {
|
|
43
|
+
commandsController: {
|
|
44
|
+
applyBooleanStyleCommand: (key: BooleanStyleKey) => void;
|
|
45
|
+
applyValueStyleCommand: <K extends "fontFamily" | "fontSize" | "color" | "highlight" | "shading" | "language" | "textEffect" | "link" | "underlineStyle">(key: K, value: import('../../core/model.js').EditorTextStyle[K] | null) => void;
|
|
46
|
+
applyChangeTextCaseCommand: (mode: import('../../core/commands/textCase').TextCaseMode) => void;
|
|
47
|
+
applyClearFormattingCommand: () => void;
|
|
48
|
+
applyParagraphStyleCommand: <K extends import('../toolbarStyleState.js').ParagraphStyleKey>(key: K, value: import('../../core/model.js').EditorParagraphStyle[K] | null) => void;
|
|
49
|
+
toggleParagraphFlagCommand: (key: "pageBreakBefore" | "keepWithNext") => void;
|
|
50
|
+
applyParagraphListCommand: (kind: NonNullable<import('../../core/model.js').EditorParagraphListStyle["kind"]>) => void;
|
|
51
|
+
handleListFormatChange: (format: import('../../core/model.js').EditorParagraphListStyle["format"]) => void;
|
|
52
|
+
handleListStartAtChange: (startAt: number | null) => void;
|
|
53
|
+
applyInsertSectionBreakCommand: (breakType: "nextPage" | "continuous") => void;
|
|
54
|
+
applyInsertPageBreakCommand: () => void;
|
|
55
|
+
canInsertFootnoteCommand: () => boolean;
|
|
56
|
+
applyInsertFootnoteCommand: () => void;
|
|
57
|
+
handleStyleChange: (styleId: string) => void;
|
|
58
|
+
applyUpdateSectionSettingsCommand: (sectionIndex: number, settings: Partial<import('../../core/model.js').EditorSection>) => void;
|
|
59
|
+
applyToggleTrackChangesCommand: () => void;
|
|
60
|
+
applyToggleShowMarginsCommand: () => void;
|
|
61
|
+
applyToggleShowParagraphMarksCommand: () => void;
|
|
62
|
+
applyAcceptRevisionsCommand: () => void;
|
|
63
|
+
applyRejectRevisionsCommand: () => void;
|
|
64
|
+
applyLinkCommand: (href: string | null) => void;
|
|
65
|
+
promptForLink: () => void;
|
|
66
|
+
removeLinkCommand: () => void;
|
|
67
|
+
applyImageAltCommand: (alt: string) => void;
|
|
68
|
+
promptForImageAlt: () => void;
|
|
69
|
+
applyImageCaptionCommand: (caption: string) => void;
|
|
70
|
+
promptForImageCaption: () => void;
|
|
71
|
+
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
72
|
+
handleListEnter: () => boolean;
|
|
73
|
+
handleListBoundaryBackspace: (event: KeyboardEvent & {
|
|
74
|
+
currentTarget: HTMLTextAreaElement;
|
|
75
|
+
}) => boolean;
|
|
76
|
+
};
|
|
77
|
+
keyboardCommandsController: {
|
|
78
|
+
applyBooleanStyleCommand: (style: BooleanStyleKey) => void;
|
|
79
|
+
applyValueStyleCommand: <K extends "fontFamily" | "fontSize" | "color" | "highlight" | "shading" | "language" | "textEffect" | "link" | "underlineStyle">(key: K, value: import('../../core/model.js').EditorTextStyle[K] | null) => void;
|
|
80
|
+
applyChangeTextCaseCommand: (mode: import('../../core/commands/textCase').TextCaseMode) => void;
|
|
81
|
+
applyClearFormattingCommand: () => void;
|
|
82
|
+
applyParagraphStyleCommand: <K extends import('../toolbarStyleState.js').ParagraphStyleKey>(key: K, value: import('../../core/model.js').EditorParagraphStyle[K] | null) => void;
|
|
83
|
+
toggleParagraphFlagCommand: (key: "pageBreakBefore" | "keepWithNext") => void;
|
|
84
|
+
applyParagraphListCommand: (kind: NonNullable<import('../../core/model.js').EditorParagraphListStyle["kind"]>) => void;
|
|
85
|
+
handleListFormatChange: (format: import('../../core/model.js').EditorParagraphListStyle["format"]) => void;
|
|
86
|
+
handleListStartAtChange: (startAt: number | null) => void;
|
|
87
|
+
applyInsertSectionBreakCommand: (breakType: "nextPage" | "continuous") => void;
|
|
88
|
+
applyInsertPageBreakCommand: () => void;
|
|
89
|
+
canInsertFootnoteCommand: () => boolean;
|
|
90
|
+
applyInsertFootnoteCommand: () => void;
|
|
91
|
+
handleStyleChange: (styleId: string) => void;
|
|
92
|
+
applyUpdateSectionSettingsCommand: (sectionIndex: number, settings: Partial<import('../../core/model.js').EditorSection>) => void;
|
|
93
|
+
applyToggleTrackChangesCommand: () => void;
|
|
94
|
+
applyToggleShowMarginsCommand: () => void;
|
|
95
|
+
applyToggleShowParagraphMarksCommand: () => void;
|
|
96
|
+
applyAcceptRevisionsCommand: () => void;
|
|
97
|
+
applyRejectRevisionsCommand: () => void;
|
|
98
|
+
applyLinkCommand: (href: string | null) => void;
|
|
99
|
+
promptForLink: () => void;
|
|
100
|
+
removeLinkCommand: () => void;
|
|
101
|
+
applyImageAltCommand: (alt: string) => void;
|
|
102
|
+
promptForImageAlt: () => void;
|
|
103
|
+
applyImageCaptionCommand: (caption: string) => void;
|
|
104
|
+
promptForImageCaption: () => void;
|
|
105
|
+
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
106
|
+
handleListEnter: () => boolean;
|
|
107
|
+
handleListBoundaryBackspace: (event: KeyboardEvent & {
|
|
108
|
+
currentTarget: HTMLTextAreaElement;
|
|
109
|
+
}) => boolean;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EditorState } from '../../core/model.js';
|
|
2
|
+
import { OasisEditorClientController } from '../../app/client/OasisEditorClient.js';
|
|
3
|
+
|
|
4
|
+
export interface EditorChangeBroadcastDeps {
|
|
5
|
+
state: EditorState;
|
|
6
|
+
isImportInProgress: () => boolean;
|
|
7
|
+
cloneState: (state: EditorState) => EditorState;
|
|
8
|
+
getStateSnapshot: () => EditorState;
|
|
9
|
+
getOnStateChange: () => ((snapshot: EditorState) => void) | undefined;
|
|
10
|
+
emit: OasisEditorClientController["emit"];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Sets up the reactive effect that mirrors document/selection changes out to the
|
|
14
|
+
* host: records the canvas-debug selection, then (when not mid-import) notifies
|
|
15
|
+
* `onStateChange` and emits the client `change`/`documentChange`/`selectionChange`
|
|
16
|
+
* events. Must be called synchronously within the component owner so the effect
|
|
17
|
+
* is tracked. Extracted from `OasisEditorApp` (S1).
|
|
18
|
+
*/
|
|
19
|
+
export declare function createEditorChangeBroadcast(deps: EditorChangeBroadcastDeps): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { EditorSelection, EditorState } from '../../core/model.js';
|
|
2
|
+
import { ToolbarStyleState } from '../toolbarStyleState.js';
|
|
3
|
+
import { TranslateFn } from '../../i18n/index.js';
|
|
4
|
+
import { EditorLogger } from '../../utils/logger.js';
|
|
5
|
+
import { createEditorTableOperations } from '../../app/controllers/useEditorTableOperations.js';
|
|
6
|
+
import { FontDialogInitialValues } from '../components/Dialogs/FontDialog.js';
|
|
7
|
+
import { ParagraphDialogInitialValues } from '../components/Dialogs/ParagraphDialog.js';
|
|
8
|
+
import { TablePropertiesDialogInitialValues } from '../components/Dialogs/TablePropertiesDialog.js';
|
|
9
|
+
|
|
10
|
+
type EditorTableOperations = ReturnType<typeof createEditorTableOperations>;
|
|
11
|
+
interface DialogState<TInitial> {
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
initial: TInitial;
|
|
14
|
+
}
|
|
15
|
+
interface ContextMenuState {
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}
|
|
20
|
+
export interface EditorChromeDeps {
|
|
21
|
+
state: () => EditorState;
|
|
22
|
+
selection: () => EditorSelection;
|
|
23
|
+
toolbarStyleState: () => ToolbarStyleState;
|
|
24
|
+
isReadOnly: () => boolean;
|
|
25
|
+
t: TranslateFn;
|
|
26
|
+
logger: EditorLogger;
|
|
27
|
+
setFontDialog: (state: DialogState<FontDialogInitialValues>) => void;
|
|
28
|
+
setParagraphDialog: (state: DialogState<ParagraphDialogInitialValues>) => void;
|
|
29
|
+
setTablePropertiesDialog: (state: DialogState<TablePropertiesDialogInitialValues>) => void;
|
|
30
|
+
setContextMenu: (state: ContextMenuState) => void;
|
|
31
|
+
clearPreferredColumn: () => void;
|
|
32
|
+
resetTransactionGrouping: () => void;
|
|
33
|
+
applyTransactionalState: (producer: (current: EditorState) => EditorState, options?: {
|
|
34
|
+
mergeKey?: string;
|
|
35
|
+
}) => void;
|
|
36
|
+
applyTableAwareParagraphEdit: (state: EditorState, edit: (state: EditorState) => EditorState) => EditorState;
|
|
37
|
+
focusInput: () => void;
|
|
38
|
+
promptForLink: () => void;
|
|
39
|
+
tableOps: EditorTableOperations;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Owns the editor "chrome": font option catalogues, the font/paragraph/table
|
|
43
|
+
* dialog bridges and the context-menu clipboard wiring. Extracted from
|
|
44
|
+
* `OasisEditorApp` so the composition root only creates and renders contexts
|
|
45
|
+
* instead of mapping every dialog/menu callback by hand (S1).
|
|
46
|
+
*/
|
|
47
|
+
export declare function createEditorChrome(deps: EditorChromeDeps): {
|
|
48
|
+
computeFontFamilyOptions: () => string[];
|
|
49
|
+
computeFontSizeOptions: () => number[];
|
|
50
|
+
applyFontDialogValues: (values: import('../components/Dialogs/FontDialog.js').FontDialogApplyValues, original: FontDialogInitialValues) => void;
|
|
51
|
+
applyParagraphDialogValues: (values: import('../components/Dialogs/ParagraphDialog.js').ParagraphDialogApplyValues, original: ParagraphDialogInitialValues) => void;
|
|
52
|
+
applyTablePropertiesDialogValues: (values: import('../components/Dialogs/TablePropertiesDialog.js').TablePropertiesDialogApplyValues) => void;
|
|
53
|
+
buildContextMenuItems: () => import('../components/ContextMenu/ContextMenu.jsx').ContextMenuItem[];
|
|
54
|
+
handleEditorContextMenu: (event: MouseEvent) => void;
|
|
55
|
+
closeContextMenu: () => void;
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { BooleanStyleKey } from '../toolbarStyleState.js';
|
|
2
|
+
import { EditorState } from '../../core/model.js';
|
|
3
|
+
import { EditorLogger } from '../../utils/logger.js';
|
|
4
|
+
import { OasisEditorClientController } from '../../app/client/OasisEditorClient.js';
|
|
5
|
+
import { TranslateFn } from '../../i18n/index.js';
|
|
6
|
+
import { createEditorDocumentRuntime } from './createEditorDocumentRuntime.js';
|
|
7
|
+
import { createEditorInteractionRuntime } from './createEditorInteractionRuntime.js';
|
|
8
|
+
import { OasisEditorAppDocumentProps, OasisEditorAppRuntimeProps } from '../OasisEditorAppProps.js';
|
|
9
|
+
|
|
10
|
+
type DocumentRuntime = ReturnType<typeof createEditorDocumentRuntime>;
|
|
11
|
+
type InteractionRuntime = ReturnType<typeof createEditorInteractionRuntime>;
|
|
12
|
+
interface LinkDialogSetter {
|
|
13
|
+
(state: {
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
initialHref: string;
|
|
16
|
+
}): void;
|
|
17
|
+
}
|
|
18
|
+
export interface EditorCommandRuntimeDeps {
|
|
19
|
+
document: DocumentRuntime;
|
|
20
|
+
interaction: InteractionRuntime;
|
|
21
|
+
state: EditorState;
|
|
22
|
+
logger: EditorLogger;
|
|
23
|
+
isReadOnly: () => boolean;
|
|
24
|
+
focusInput: () => void;
|
|
25
|
+
applyState: (next: EditorState) => void;
|
|
26
|
+
getStateSnapshot: () => EditorState;
|
|
27
|
+
cloneState: (state: EditorState) => EditorState;
|
|
28
|
+
setFocused: (focused: boolean) => void;
|
|
29
|
+
setInitialLoading: (loading: boolean) => void;
|
|
30
|
+
getForcePlainTextPaste: () => boolean;
|
|
31
|
+
setForcePlainTextPaste: (value: boolean) => void;
|
|
32
|
+
locale: () => string;
|
|
33
|
+
translator: TranslateFn;
|
|
34
|
+
runtimeClient: OasisEditorClientController;
|
|
35
|
+
runtimeOptions: () => OasisEditorAppRuntimeProps;
|
|
36
|
+
documentOptions: () => OasisEditorAppDocumentProps;
|
|
37
|
+
importInputRef: () => HTMLInputElement | undefined;
|
|
38
|
+
imageInputRef: () => HTMLInputElement | undefined;
|
|
39
|
+
setLinkDialog: LinkDialogSetter;
|
|
40
|
+
setImageAltDialog: (state: {
|
|
41
|
+
isOpen: boolean;
|
|
42
|
+
initialAlt: string;
|
|
43
|
+
}) => void;
|
|
44
|
+
setImageCaptionDialog: (state: {
|
|
45
|
+
isOpen: boolean;
|
|
46
|
+
initialCaption: string;
|
|
47
|
+
}) => void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Phase C of the editor runtime: the command controller, the public runtime
|
|
51
|
+
* bootstrap (plugins/toolbar/menu), the imperative client host wiring, the
|
|
52
|
+
* runtime dispatch effect and the keyboard binding. Runs synchronously after
|
|
53
|
+
* the document and interaction runtimes, preserving creation order. Reads the
|
|
54
|
+
* earlier phases through their returned bags. Extracted from `OasisEditorApp`
|
|
55
|
+
* (S1).
|
|
56
|
+
*/
|
|
57
|
+
export declare function createEditorCommandRuntime(deps: EditorCommandRuntimeDeps): {
|
|
58
|
+
commandsController: {
|
|
59
|
+
applyBooleanStyleCommand: (key: BooleanStyleKey) => void;
|
|
60
|
+
applyValueStyleCommand: <K extends "fontFamily" | "fontSize" | "color" | "highlight" | "shading" | "language" | "textEffect" | "link" | "underlineStyle">(key: K, value: import('../../core/model.js').EditorTextStyle[K] | null) => void;
|
|
61
|
+
applyChangeTextCaseCommand: (mode: import('../../core/commands/textCase.js').TextCaseMode) => void;
|
|
62
|
+
applyClearFormattingCommand: () => void;
|
|
63
|
+
applyParagraphStyleCommand: <K extends import('../toolbarStyleState.js').ParagraphStyleKey>(key: K, value: import('../../core/model.js').EditorParagraphStyle[K] | null) => void;
|
|
64
|
+
toggleParagraphFlagCommand: (key: "pageBreakBefore" | "keepWithNext") => void;
|
|
65
|
+
applyParagraphListCommand: (kind: NonNullable<import('../../core/model.js').EditorParagraphListStyle["kind"]>) => void;
|
|
66
|
+
handleListFormatChange: (format: import('../../core/model.js').EditorParagraphListStyle["format"]) => void;
|
|
67
|
+
handleListStartAtChange: (startAt: number | null) => void;
|
|
68
|
+
applyInsertSectionBreakCommand: (breakType: "nextPage" | "continuous") => void;
|
|
69
|
+
applyInsertPageBreakCommand: () => void;
|
|
70
|
+
canInsertFootnoteCommand: () => boolean;
|
|
71
|
+
applyInsertFootnoteCommand: () => void;
|
|
72
|
+
handleStyleChange: (styleId: string) => void;
|
|
73
|
+
applyUpdateSectionSettingsCommand: (sectionIndex: number, settings: Partial<import('../../core/model.js').EditorSection>) => void;
|
|
74
|
+
applyToggleTrackChangesCommand: () => void;
|
|
75
|
+
applyToggleShowMarginsCommand: () => void;
|
|
76
|
+
applyToggleShowParagraphMarksCommand: () => void;
|
|
77
|
+
applyAcceptRevisionsCommand: () => void;
|
|
78
|
+
applyRejectRevisionsCommand: () => void;
|
|
79
|
+
applyLinkCommand: (href: string | null) => void;
|
|
80
|
+
promptForLink: () => void;
|
|
81
|
+
removeLinkCommand: () => void;
|
|
82
|
+
applyImageAltCommand: (alt: string) => void;
|
|
83
|
+
promptForImageAlt: () => void;
|
|
84
|
+
applyImageCaptionCommand: (caption: string) => void;
|
|
85
|
+
promptForImageCaption: () => void;
|
|
86
|
+
handleListTab: (direction: "indent" | "outdent") => boolean;
|
|
87
|
+
handleListEnter: () => boolean;
|
|
88
|
+
handleListBoundaryBackspace: (event: KeyboardEvent & {
|
|
89
|
+
currentTarget: HTMLTextAreaElement;
|
|
90
|
+
}) => boolean;
|
|
91
|
+
};
|
|
92
|
+
runtimeReady: import('solid-js').Accessor<boolean>;
|
|
93
|
+
runtimeEditor: import('solid-js').Accessor<import('../../index.js').Editor>;
|
|
94
|
+
commandStateOf: (commandRef: import('../../index.js').CommandRef) => {
|
|
95
|
+
isEnabled: boolean;
|
|
96
|
+
isActive: boolean;
|
|
97
|
+
value: unknown;
|
|
98
|
+
};
|
|
99
|
+
toolbarHost: () => import('../components/Toolbar/state/createToolbarApi.js').ToolbarHost;
|
|
100
|
+
toolbarRegistry: import('../../index.js').ToolbarRegistry;
|
|
101
|
+
menuRegistry: import('../../index.js').MenuRegistry;
|
|
102
|
+
handleKeyDown: (event: KeyboardEvent & {
|
|
103
|
+
currentTarget: HTMLTextAreaElement;
|
|
104
|
+
}) => void;
|
|
105
|
+
};
|
|
106
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { EditorState } from '../../core/model.js';
|
|
2
|
+
import { EditorLogger } from '../../utils/logger.js';
|
|
3
|
+
import { OasisEditorClientController } from '../../app/client/OasisEditorClient.js';
|
|
4
|
+
import { createEditorImageOperations } from '../../app/controllers/useEditorImageOperations.js';
|
|
5
|
+
import { OasisEditorAppDocumentProps } from '../OasisEditorAppProps.js';
|
|
6
|
+
|
|
7
|
+
type EditorImageOperations = ReturnType<typeof createEditorImageOperations>;
|
|
8
|
+
export interface EditorDocumentRuntimeDeps {
|
|
9
|
+
documentOptions: () => OasisEditorAppDocumentProps;
|
|
10
|
+
logger: EditorLogger;
|
|
11
|
+
runtimeClient: OasisEditorClientController;
|
|
12
|
+
/**
|
|
13
|
+
* Document state, created by the app before this runtime so its store signal
|
|
14
|
+
* keeps its original creation position (no signal reordering).
|
|
15
|
+
*/
|
|
16
|
+
state: EditorState;
|
|
17
|
+
commitState: (next: EditorState) => void;
|
|
18
|
+
getStateSnapshot: () => EditorState;
|
|
19
|
+
applyState: (next: EditorState) => void;
|
|
20
|
+
cloneState: (state: EditorState) => EditorState;
|
|
21
|
+
isReadOnly: () => boolean;
|
|
22
|
+
focusInput: () => void;
|
|
23
|
+
surfaceRef: () => HTMLDivElement | undefined;
|
|
24
|
+
viewportRef: () => HTMLDivElement | undefined;
|
|
25
|
+
zoomFactor: () => number;
|
|
26
|
+
/**
|
|
27
|
+
* Back-edge to the interaction runtime: history's image-move actions read the
|
|
28
|
+
* image operations, which are created after this runtime. Read lazily so the
|
|
29
|
+
* synchronous creation order is preserved (the getter is only invoked at
|
|
30
|
+
* command time). [[i1-controller-ports]]
|
|
31
|
+
*/
|
|
32
|
+
getImageOps: () => EditorImageOperations;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Phase A of the editor runtime: document state, IO, layout measurement,
|
|
36
|
+
* persistence, the transaction/history machinery and the change-broadcast
|
|
37
|
+
* effect. Runs synchronously within the component owner, in the original
|
|
38
|
+
* creation order, so every signal/effect stays bound exactly as before.
|
|
39
|
+
* Extracted from `OasisEditorApp` (S1).
|
|
40
|
+
*/
|
|
41
|
+
export declare function createEditorDocumentRuntime(deps: EditorDocumentRuntimeDeps): {
|
|
42
|
+
docIO: {
|
|
43
|
+
importProgress: import('solid-js').Accessor<import('../../app/controllers/useEditorDocumentIO.js').ImportProgressState | null>;
|
|
44
|
+
handleImportFile: (file: File | null) => Promise<void>;
|
|
45
|
+
handleExportDocx: () => Promise<void>;
|
|
46
|
+
handleExportPdf: () => Promise<void>;
|
|
47
|
+
insertImageFromFile: (file: File, position?: import('../../core/model.js').EditorPosition | null) => Promise<void>;
|
|
48
|
+
handleInsertImage: (file: File | null) => Promise<void>;
|
|
49
|
+
};
|
|
50
|
+
isImportInProgress: () => boolean;
|
|
51
|
+
measuredBlockHeights: import('solid-js').Accessor<Record<string, number>>;
|
|
52
|
+
measuredParagraphLayouts: import('solid-js').Accessor<Record<string, import('../../core/model.js').EditorLayoutParagraph>>;
|
|
53
|
+
inputBox: import('solid-js').Accessor<import('../editorUiTypes.js').InputBox>;
|
|
54
|
+
selectionBoxes: import('solid-js').Accessor<import('../editorUiTypes.js').SelectionBox[]>;
|
|
55
|
+
commentHighlights: import('solid-js').Accessor<import('../editorUiTypes.js').CommentHighlightBox[]>;
|
|
56
|
+
selectedImageBox: import('solid-js').Accessor<import('../canvas/CanvasSelectionGeometry.js').SelectedImageSelectionBox | null>;
|
|
57
|
+
selectedTextBoxBox: import('solid-js').Accessor<import('../canvas/CanvasSelectionGeometry.js').SelectedTextBoxSelectionBox | null>;
|
|
58
|
+
caretBox: import('solid-js').Accessor<import('../editorUiTypes.js').CaretBox>;
|
|
59
|
+
preferredColumnX: import('solid-js').Accessor<number | null>;
|
|
60
|
+
setPreferredColumnX: import('solid-js').Setter<number | null>;
|
|
61
|
+
clearPreferredColumn: () => null;
|
|
62
|
+
stabilizeLayoutAfterImport: () => Promise<void>;
|
|
63
|
+
setMeasuredBlockHeights: import('solid-js').Setter<Record<string, number>>;
|
|
64
|
+
setMeasuredParagraphLayouts: import('solid-js').Setter<Record<string, import('../../core/model.js').EditorLayoutParagraph>>;
|
|
65
|
+
applyLayoutInvalidation: (invalidation: import('../../app/controllers/useEditorLayout.js').LayoutInvalidation) => void;
|
|
66
|
+
onCleanupHook: () => void;
|
|
67
|
+
fallbackPersistence: import('../../app/services/indexedDbPersistence.js').IndexedDbPersistence;
|
|
68
|
+
persistenceStatus: () => import('../../app/controllers/useEditorPersistence.js').PersistenceStatus;
|
|
69
|
+
undoStack: import('solid-js').Accessor<EditorState[]>;
|
|
70
|
+
redoStack: import('solid-js').Accessor<EditorState[]>;
|
|
71
|
+
applyTransactionalState: (producer: (current: EditorState) => EditorState, options?: import('../editorHistory.js').EditorTransactionOptions) => void;
|
|
72
|
+
applyHistoryState: (nextState: EditorState) => void;
|
|
73
|
+
resetTransactionGrouping: () => void;
|
|
74
|
+
updateHistoryState: (updater: (current: import('../editorHistory.js').EditorHistoryState) => import('../editorHistory.js').EditorHistoryState) => void;
|
|
75
|
+
getHistoryState: () => import('../editorHistory.js').EditorHistoryState;
|
|
76
|
+
clearHistory: () => void;
|
|
77
|
+
historyActions: {
|
|
78
|
+
performUndo: () => void;
|
|
79
|
+
performRedo: () => void;
|
|
80
|
+
moveSelectedImageByParagraph: (direction: -1 | 1) => boolean;
|
|
81
|
+
applySelectionPreservingStructure: (nextSelection: EditorState["selection"]) => void;
|
|
82
|
+
};
|
|
83
|
+
resetEditorChromeState: () => void;
|
|
84
|
+
};
|
|
85
|
+
export {};
|