@ones-editor/editor 5.0.5 → 5.0.6-beta.p8216.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/@ones-editor/core/src/core/doc/doc.d.ts +2 -0
- package/@ones-editor/core/src/core/doc/index.d.ts +1 -0
- package/@ones-editor/core/src/core/doc/wiki-macro.d.ts +15 -0
- package/@ones-editor/core/src/core/doc/wiki-macro.test.d.ts +1 -0
- package/@ones-editor/core/src/core/types.d.ts +11 -0
- package/@ones-editor/core/src/core/undo-manager/actions/async-action.d.ts +7 -0
- package/@ones-editor/core/src/core/undo-manager/undo-manager.d.ts +10 -0
- package/@ones-editor/core/src/core/undo-manager/undo-manager.test.d.ts +1 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/wiki-macro.d.ts +4 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/wiki-macro.test.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +198 -6
- package/package.json +1 -1
|
@@ -234,6 +234,8 @@ export interface OnesEditorDoc extends OnesEditorDocServer {
|
|
|
234
234
|
registerCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
235
235
|
unregisterCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
236
236
|
toJSON: () => DocObject;
|
|
237
|
+
/** Current collaboration revision, when this is a live document. */
|
|
238
|
+
getDocumentVersion?: () => number | undefined;
|
|
237
239
|
getContainerBlocks: (containerId: string) => DocBlock[];
|
|
238
240
|
findContainerBlocks: (containerId: string) => DocBlock[] | null;
|
|
239
241
|
getBlockData: (containerId: string, blockIndex: number) => DocBlock;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const WIKI_MACRO_TYPE = "ones-open-wiki-macro";
|
|
2
|
+
export interface WikiMacroData {
|
|
3
|
+
protocolVersion?: number;
|
|
4
|
+
resources?: unknown;
|
|
5
|
+
exportSpec?: unknown;
|
|
6
|
+
}
|
|
7
|
+
interface ExportItem {
|
|
8
|
+
type: string;
|
|
9
|
+
data: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare function getWikiMacroExportSpec(data: WikiMacroData | null | undefined): ExportItem[];
|
|
12
|
+
export declare function getWikiMacroResources(data: WikiMacroData | null | undefined): string[];
|
|
13
|
+
export declare function replaceWikiMacroResources(data: WikiMacroData | null | undefined, resources: Map<string, string>): void;
|
|
14
|
+
export declare function wikiMacroToText(data: WikiMacroData | null | undefined): string;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -362,6 +362,10 @@ export interface OnesEditorUndoAction {
|
|
|
362
362
|
export interface OnesEditorUndoManager {
|
|
363
363
|
reset: () => void;
|
|
364
364
|
addAction: (action: OnesEditorUndoAction) => void;
|
|
365
|
+
addAsyncAction: (action: OnesEditorAsyncUndoAction) => () => void;
|
|
366
|
+
acquireUndoLock: () => () => void;
|
|
367
|
+
undoAsync: () => Promise<boolean>;
|
|
368
|
+
redoAsync: () => Promise<boolean>;
|
|
365
369
|
hasGroup: () => boolean;
|
|
366
370
|
undo: () => boolean;
|
|
367
371
|
redo: () => boolean;
|
|
@@ -371,6 +375,12 @@ export interface OnesEditorUndoManager {
|
|
|
371
375
|
lastAction: () => OnesEditorUndoAction | null;
|
|
372
376
|
undoTo: (action: OnesEditorUndoAction | null) => boolean;
|
|
373
377
|
}
|
|
378
|
+
export interface OnesEditorAsyncUndoAction {
|
|
379
|
+
onDiscard?: () => void;
|
|
380
|
+
undo: () => Promise<boolean>;
|
|
381
|
+
redo: () => Promise<boolean>;
|
|
382
|
+
onError: (error: unknown) => void;
|
|
383
|
+
}
|
|
374
384
|
export interface ShortcutRecords {
|
|
375
385
|
[index: string]: (editor: OnesEditor, event: Event) => boolean | undefined;
|
|
376
386
|
}
|
|
@@ -558,6 +568,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
558
568
|
readonly settingsProvider: OnesEditorSettingsProvider;
|
|
559
569
|
version: string;
|
|
560
570
|
readonly: boolean;
|
|
571
|
+
acquireReadonly: () => () => void;
|
|
561
572
|
destroyed: boolean;
|
|
562
573
|
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator<T>) => T;
|
|
563
574
|
getCustom: <T extends OnesEditorCustom>(name: string) => T;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OnesEditor, OnesEditorAsyncUndoAction } from '../../types';
|
|
2
|
+
import Action from './action';
|
|
3
|
+
/** A server-confirmed edit session is one action, independent of synchronous groups. */
|
|
4
|
+
export default class AsyncAction extends Action {
|
|
5
|
+
readonly operation: OnesEditorAsyncUndoAction;
|
|
6
|
+
constructor(editor: OnesEditor, operation: OnesEditorAsyncUndoAction);
|
|
7
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DocBlock, DocBlockText, OnesEditorDocRange } from '../doc';
|
|
2
2
|
import { EditorDocLocalActionCallbacks, OnesEditor, OnesEditorUndoAction, OnesEditorUndoManager } from '../types';
|
|
3
|
+
import type { OnesEditorAsyncUndoAction } from '../types';
|
|
3
4
|
import Action from './actions/action';
|
|
4
5
|
declare class UndoManager implements OnesEditorUndoManager, EditorDocLocalActionCallbacks {
|
|
5
6
|
editor: OnesEditor;
|
|
@@ -8,10 +9,19 @@ declare class UndoManager implements OnesEditorUndoManager, EditorDocLocalAction
|
|
|
8
9
|
private currentGroup;
|
|
9
10
|
private groupCounter;
|
|
10
11
|
private undoRedoing;
|
|
12
|
+
private undoLocks;
|
|
13
|
+
private pendingAction?;
|
|
14
|
+
private resetVersion;
|
|
11
15
|
constructor(editor: OnesEditor);
|
|
12
16
|
reset(): void;
|
|
13
17
|
prepareSaveUndoState(): void;
|
|
14
18
|
addAction(action: OnesEditorUndoAction): void;
|
|
19
|
+
addAsyncAction(operation: OnesEditorAsyncUndoAction): () => void;
|
|
20
|
+
private discard;
|
|
21
|
+
acquireUndoLock(): () => void;
|
|
22
|
+
undoAsync(): Promise<boolean>;
|
|
23
|
+
redoAsync(): Promise<boolean>;
|
|
24
|
+
private runAsyncAction;
|
|
15
25
|
private beginGroup;
|
|
16
26
|
private endGroup;
|
|
17
27
|
hasGroup(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DocEmbedBlock, DocObject } from '../../../../../@ones-editor/core';
|
|
2
|
+
import type { Converters } from '../types';
|
|
3
|
+
/** Images use the existing document-resource placeholder consumed by Wiki API. */
|
|
4
|
+
export default function macroToMarkdown(converters: Converters, block: DocEmbedBlock, doc: DocObject): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -42,6 +42,7 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
42
42
|
initPresence(): Promise<void>;
|
|
43
43
|
private subscribe;
|
|
44
44
|
data: () => any;
|
|
45
|
+
getDocumentVersion(): number | undefined;
|
|
45
46
|
toJSON(): DocObject;
|
|
46
47
|
private submitOp;
|
|
47
48
|
createDoc: (data: EditorDoc) => Promise<void>;
|