oasis-editor 0.0.31 → 0.0.33
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-CeDQ_a8-.js → OasisEditorApp-D6NxTc6l.js} +550 -176
- package/dist/app/services/indexedDbPersistence.d.ts +20 -0
- package/dist/assets/{importDocxWorker-C8ErVbAl.js → importDocxWorker-xRrspiYv.js} +1 -1
- package/dist/core/editorState.d.ts +7 -1
- package/dist/core/endnotes.d.ts +0 -2
- package/dist/core/footnotes.d.ts +0 -2
- package/dist/core/plugin.d.ts +1 -3
- package/dist/core/pluginUiTypes.d.ts +4 -0
- package/dist/i18n/I18nContext.d.ts +9 -0
- package/dist/i18n/index.d.ts +7 -3
- package/dist/{index-BYqaCJUC.js → index-CDi9hs5T.js} +896 -1207
- package/dist/index.d.ts +1 -1
- package/dist/oasis-editor.js +28 -28
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/OasisEditorAppProps.d.ts +6 -0
- package/dist/ui/app/useEditorContextMenuClipboard.d.ts +2 -0
- package/dist/ui/app/useEditorRuntimeBootstrap.d.ts +1 -0
- package/dist/ui/app/useEditorRuntimePlugins.d.ts +2 -0
- package/dist/ui/components/Menubar/Menubar.d.ts +1 -1
- package/dist/ui/components/Menubar/menuRegistry.d.ts +0 -1
- package/dist/ui/components/Toolbar/presets/defaultToolbar.d.ts +2 -1
- package/dist/ui/components/Toolbar/ribbon/ribbonModel.d.ts +4 -3
- package/dist/ui/components/Toolbar/schema/items.d.ts +2 -5
- package/dist/ui/components/Toolbar/state/createToolbarApi.d.ts +2 -1
- package/package.json +2 -1
- package/dist/app/services/PersistenceService.d.ts +0 -11
|
@@ -38,6 +38,12 @@ export interface OasisEditorAppDocumentProps {
|
|
|
38
38
|
readOnly?: boolean;
|
|
39
39
|
persistenceEnabled?: boolean;
|
|
40
40
|
persistence?: DocumentPersistence;
|
|
41
|
+
/**
|
|
42
|
+
* Storage key for the built-in IndexedDB persistence. Two editors on the same
|
|
43
|
+
* page must use distinct keys to avoid overwriting each other's document.
|
|
44
|
+
* Ignored when a custom `persistence` is provided.
|
|
45
|
+
*/
|
|
46
|
+
persistenceKey?: string;
|
|
41
47
|
}
|
|
42
48
|
export interface OasisEditorAppRuntimeProps {
|
|
43
49
|
onReady?: (client: OasisEditorClient) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditorState } from '../../core/model.js';
|
|
2
|
+
import { TranslateFn } from '../../i18n/index.js';
|
|
2
3
|
import { ContextMenuItem } from '../components/ContextMenu/ContextMenu.js';
|
|
3
4
|
import { EditorLogger } from '../../utils/logger.js';
|
|
4
5
|
|
|
@@ -10,6 +11,7 @@ interface ContextMenuState {
|
|
|
10
11
|
export interface EditorContextMenuClipboardDeps {
|
|
11
12
|
state: () => EditorState;
|
|
12
13
|
isReadOnly: () => boolean;
|
|
14
|
+
t: TranslateFn;
|
|
13
15
|
logger: EditorLogger;
|
|
14
16
|
setContextMenu: (state: ContextMenuState) => void;
|
|
15
17
|
clearPreferredColumn: () => void;
|
|
@@ -15,6 +15,7 @@ type RuntimeCommandHost = ReturnType<typeof createRuntimeCommandHost>;
|
|
|
15
15
|
export interface EditorRuntimeBootstrapContext {
|
|
16
16
|
essentials: EssentialsPluginDeps;
|
|
17
17
|
externalPlugins: RuntimePluginsConfig["externalPlugins"];
|
|
18
|
+
t: RuntimePluginsConfig["t"];
|
|
18
19
|
customizeToolbar: RuntimePluginsConfig["customizeToolbar"];
|
|
19
20
|
customizeMenubar: RuntimePluginsConfig["customizeMenubar"];
|
|
20
21
|
initialDocument: RuntimeCommandHostConfig["initialDocument"];
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { OasisPlugin } from '../../core/plugin.js';
|
|
2
|
+
import { TranslateFn } from '../../i18n/index.js';
|
|
2
3
|
import { MenuRegistry } from '../components/Menubar/menuRegistry.js';
|
|
3
4
|
import { ToolbarRegistry } from '../components/Toolbar/registry/ToolbarRegistry.js';
|
|
4
5
|
|
|
5
6
|
export interface EditorRuntimePluginsOptions {
|
|
6
7
|
essentialsPlugin: OasisPlugin;
|
|
7
8
|
externalPlugins?: OasisPlugin[];
|
|
9
|
+
t: TranslateFn;
|
|
8
10
|
customizeToolbar?: (registry: ToolbarRegistry) => void;
|
|
9
11
|
customizeMenubar?: (registry: MenuRegistry) => void;
|
|
10
12
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TranslateFn } from '../../../../i18n/index.js';
|
|
1
2
|
import { ToolbarItem } from '../schema/items.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -6,4 +7,4 @@ import { ToolbarItem } from '../schema/items.js';
|
|
|
6
7
|
* public contribution API clients use. Load each item into a registry via
|
|
7
8
|
* `registry.register` (see Toolbar bootstrap).
|
|
8
9
|
*/
|
|
9
|
-
export declare function createDefaultToolbarPreset(): ToolbarItem[];
|
|
10
|
+
export declare function createDefaultToolbarPreset(t: TranslateFn): ToolbarItem[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RibbonRow, RibbonTabId, ToolbarItem } from '../schema/items.js';
|
|
2
|
+
import { TranslateFn } from '../../../../i18n/index.js';
|
|
2
3
|
|
|
3
4
|
export interface RibbonTabDefinition {
|
|
4
5
|
id: RibbonTabId;
|
|
@@ -11,7 +12,7 @@ export interface RibbonGroupModel {
|
|
|
11
12
|
rows: Record<RibbonRow, ToolbarItem[]>;
|
|
12
13
|
order: number;
|
|
13
14
|
}
|
|
14
|
-
export declare
|
|
15
|
+
export declare function buildRibbonTabDefinitions(t: TranslateFn): RibbonTabDefinition[];
|
|
15
16
|
export declare const DEFAULT_RIBBON_TAB: RibbonTabId;
|
|
16
17
|
export declare const DEFAULT_RIBBON_GROUP = "general";
|
|
17
18
|
export declare const DEFAULT_RIBBON_ROW: RibbonRow;
|
|
@@ -19,5 +20,5 @@ export declare function normalizeRibbonTab(tab: ToolbarItem["tab"]): RibbonTabId
|
|
|
19
20
|
export declare function normalizeRibbonGroup(group: ToolbarItem["group"]): string;
|
|
20
21
|
export declare function normalizeRibbonRow(row: ToolbarItem["row"]): RibbonRow;
|
|
21
22
|
export declare function isLargeRibbonItem(item: ToolbarItem): boolean;
|
|
22
|
-
export declare function ribbonGroupLabel(group: string): string;
|
|
23
|
-
export declare function buildRibbonGroups(items: ToolbarItem[], tab: RibbonTabId): RibbonGroupModel[];
|
|
23
|
+
export declare function ribbonGroupLabel(group: string, t: TranslateFn): string;
|
|
24
|
+
export declare function buildRibbonGroups(items: ToolbarItem[], tab: RibbonTabId, t: TranslateFn): RibbonGroupModel[];
|
|
@@ -3,11 +3,9 @@ import { CommandBus } from '../../../../core/commands/CommandBus.js';
|
|
|
3
3
|
import { CommandRef } from '../../../../core/commands/CommandRef.js';
|
|
4
4
|
import { TranslationKey } from '../../../../i18n/index.js';
|
|
5
5
|
import { ColorPalette } from './palette.js';
|
|
6
|
+
import { RibbonTabId, RibbonRow, RibbonSize } from '../../../../core/pluginUiTypes.js';
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
export type RibbonTabId = (typeof RIBBON_TABS)[number];
|
|
9
|
-
export type RibbonRow = 1 | 2;
|
|
10
|
-
export type RibbonSize = "normal" | "large";
|
|
8
|
+
export { RIBBON_TABS, type RibbonTabId, type RibbonRow, type RibbonSize, } from '../../../../core/pluginUiTypes.js';
|
|
11
9
|
/** Reactive snapshot of a command's state, as consumed by toolbar items. */
|
|
12
10
|
export interface ToolbarCommandState {
|
|
13
11
|
isEnabled: boolean;
|
|
@@ -147,4 +145,3 @@ export interface CustomItem extends ToolbarItemBase {
|
|
|
147
145
|
}
|
|
148
146
|
export type ToolbarItem = ButtonItem | ToggleItem | SplitItem | MenuItem | SelectItem | ColorPickerItem | GridPickerItem | SeparatorItem | GroupItem | CustomItem;
|
|
149
147
|
export type ToolbarItemType = ToolbarItem["type"];
|
|
150
|
-
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TranslateFn } from '../../../../i18n/index.js';
|
|
1
2
|
import { CommandBus } from '../../../../core/commands/CommandBus.js';
|
|
2
3
|
import { ToolbarActionApi, ToolbarCommandState } from '../schema/items.js';
|
|
3
4
|
|
|
@@ -11,4 +12,4 @@ export interface ToolbarHost {
|
|
|
11
12
|
focusEditor(): void;
|
|
12
13
|
}
|
|
13
14
|
/** Builds the {@link ToolbarActionApi} from the narrow {@link ToolbarHost}. */
|
|
14
|
-
export declare function createToolbarApi(host: () => ToolbarHost): ToolbarActionApi;
|
|
15
|
+
export declare function createToolbarApi(host: () => ToolbarHost, t: TranslateFn): ToolbarActionApi;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oasis-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"build:all": "npm run wasm:build && npm run build",
|
|
59
59
|
"test": "vitest run",
|
|
60
60
|
"test:word-parity": "vitest run --config vitest.word-parity.config.js",
|
|
61
|
+
"check:imports": "node ./scripts/check-import-graph.mjs",
|
|
61
62
|
"lint": "eslint src --ext .ts",
|
|
62
63
|
"format": "prettier --write \"src/**/*.ts\""
|
|
63
64
|
},
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { EditorDocument } from '../../core/model.js';
|
|
2
|
-
|
|
3
|
-
export declare class PersistenceService {
|
|
4
|
-
private db;
|
|
5
|
-
private getDB;
|
|
6
|
-
saveDocument(doc: EditorDocument): Promise<void>;
|
|
7
|
-
loadDocument(): Promise<EditorDocument | null>;
|
|
8
|
-
clearDocument(): Promise<void>;
|
|
9
|
-
close(): void;
|
|
10
|
-
}
|
|
11
|
-
export declare const persistenceService: PersistenceService;
|