@ones-editor/editor 5.0.5-beta.h1454.2 → 5.0.6-beta.DNP8216.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/composition/clipboard/resources/doc-resource-hooks.d.ts +6 -0
- package/@ones-editor/core/src/core/doc/doc.d.ts +72 -0
- package/@ones-editor/core/src/core/editor/index.d.ts +1 -0
- package/@ones-editor/core/src/core/editor/wiki-macro-locks.d.ts +9 -0
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +6 -0
- package/@ones-editor/core/src/core/types.d.ts +19 -1
- package/@ones-editor/core/src/core/undo-manager/actions/macro-edit-action.d.ts +10 -0
- package/@ones-editor/core/src/core/undo-manager/undo-manager.d.ts +10 -0
- package/@ones-editor/core/src/local-doc/index.d.ts +7 -1
- package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +12 -0
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +2 -1
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +6 -0
- package/@ones-editor/sharedb-doc/src/doc/sharedb-local-doc.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/types.d.ts +4 -0
- package/@ones-editor/sharedb-doc/src/versions/sharedb-server.d.ts +2 -0
- package/@ones-editor/sharedb-doc/src/versions/simple-client.d.ts +2 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/block-menu/index.d.ts +1 -0
- package/@ones-editor/versions/src/history-diff.d.ts +1 -0
- package/@ones-editor/versions/src/history-doc/history-doc.d.ts +6 -1
- package/dist/index.js +590 -30
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DocObject } from '../../../doc/doc';
|
|
2
|
+
import type { OnesEditor, OnesEditorDocResourceHook } from '../../../types';
|
|
3
|
+
export declare function registerDocResourceHook(editor: OnesEditor, hook: OnesEditorDocResourceHook): () => void;
|
|
4
|
+
export declare function collectDocResourceHooks(editor: OnesEditor, doc: DocObject, resources: Set<string>): void;
|
|
5
|
+
export declare function rewriteDocResourceHooks(editor: OnesEditor, doc: DocObject, resources: Map<string, string>): void;
|
|
6
|
+
export declare function clearDocResourceHooks(editor: OnesEditor): void;
|
|
@@ -230,7 +230,74 @@ export interface OnesEditorDocServer {
|
|
|
230
230
|
getVersionHelper?: () => OnesEditorDocVersionHelper | undefined;
|
|
231
231
|
getRemoteUsers: () => OnesEditorRemoteUsers;
|
|
232
232
|
}
|
|
233
|
+
export type WikiMacroJSON = null | boolean | number | string | WikiMacroJSON[] | {
|
|
234
|
+
[key: string]: WikiMacroJSON;
|
|
235
|
+
};
|
|
236
|
+
export interface WikiMacroContent {
|
|
237
|
+
customData: WikiMacroJSON;
|
|
238
|
+
exportSpec: (ExportDSpecText | ExportDSpecImage | ExportDSpecLink)[];
|
|
239
|
+
resources: string[];
|
|
240
|
+
}
|
|
241
|
+
export interface WikiMacroLock {
|
|
242
|
+
blockId: string;
|
|
243
|
+
sessionId: string;
|
|
244
|
+
userId: string;
|
|
245
|
+
clientId: string;
|
|
246
|
+
leaseExpiresAt: number;
|
|
247
|
+
}
|
|
248
|
+
export interface WikiMacroRequest {
|
|
249
|
+
operation: 'beginEdit' | 'renewEdit' | 'saveData' | 'finishEdit' | 'cancelEdit' | 'getEditResult' | 'applyHistoryAction' | 'locks';
|
|
250
|
+
blockId?: string;
|
|
251
|
+
sessionId?: string;
|
|
252
|
+
fence?: string;
|
|
253
|
+
expectedRevision?: number;
|
|
254
|
+
content?: WikiMacroContent;
|
|
255
|
+
actionId?: string;
|
|
256
|
+
direction?: 'undo' | 'redo';
|
|
257
|
+
targetRequestId?: string;
|
|
258
|
+
}
|
|
259
|
+
export interface WikiMacroResult {
|
|
260
|
+
requestId?: string;
|
|
261
|
+
state?: 'active' | 'finished' | 'cancelled' | 'expired';
|
|
262
|
+
status?: 'processing' | 'completed';
|
|
263
|
+
error?: WikiMacroErrorDetails;
|
|
264
|
+
sessionId?: string;
|
|
265
|
+
fence?: string;
|
|
266
|
+
revision?: number;
|
|
267
|
+
finalRevision?: number;
|
|
268
|
+
documentVersion?: number;
|
|
269
|
+
leaseExpiresAt?: number;
|
|
270
|
+
beforeContent?: WikiMacroContent;
|
|
271
|
+
content?: WikiMacroContent;
|
|
272
|
+
actionId?: string;
|
|
273
|
+
locks?: WikiMacroLock[];
|
|
274
|
+
}
|
|
275
|
+
export interface WikiMacroErrorDetails {
|
|
276
|
+
code: string;
|
|
277
|
+
message?: string;
|
|
278
|
+
sizeBytes?: number;
|
|
279
|
+
limitBytes?: number;
|
|
280
|
+
}
|
|
281
|
+
export declare class WikiMacroError extends Error {
|
|
282
|
+
readonly requestId?: string | undefined;
|
|
283
|
+
readonly code: string;
|
|
284
|
+
readonly sizeBytes?: number;
|
|
285
|
+
readonly limitBytes?: number;
|
|
286
|
+
constructor(details: WikiMacroErrorDetails, requestId?: string | undefined);
|
|
287
|
+
}
|
|
288
|
+
export interface WikiMacroReply {
|
|
289
|
+
a: 'wikiMacro';
|
|
290
|
+
requestId?: string;
|
|
291
|
+
operation?: 'locks';
|
|
292
|
+
result?: WikiMacroResult;
|
|
293
|
+
error?: WikiMacroErrorDetails;
|
|
294
|
+
locks?: WikiMacroLock[];
|
|
295
|
+
}
|
|
296
|
+
export type WikiMacroLocksListener = (locks: WikiMacroLock[]) => void;
|
|
233
297
|
export interface OnesEditorDoc extends OnesEditorDocServer {
|
|
298
|
+
requestWikiMacro: (message: WikiMacroRequest) => Promise<WikiMacroResult>;
|
|
299
|
+
onWikiMacroLocks: (listener: WikiMacroLocksListener) => () => void;
|
|
300
|
+
getDocumentVersion?: () => number | undefined;
|
|
234
301
|
registerCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
235
302
|
unregisterCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
236
303
|
toJSON: () => DocObject;
|
|
@@ -278,9 +345,14 @@ export interface OnesEditorHistoryDataParseHandler {
|
|
|
278
345
|
onUpdateComment: (commentId: string, local: boolean) => void;
|
|
279
346
|
onUpdateCommentResolver: (commentId: string, local: boolean) => void;
|
|
280
347
|
}
|
|
348
|
+
export interface OnesEditorDocSnapshot {
|
|
349
|
+
doc: DocObject;
|
|
350
|
+
documentVersion?: number;
|
|
351
|
+
}
|
|
281
352
|
export interface OnesEditorDocVersionHelper {
|
|
282
353
|
getVersions: (showPublished?: boolean) => Promise<DocVersion[]>;
|
|
283
354
|
getVersion: (ver: number) => Promise<DocObject>;
|
|
355
|
+
getVersionSnapshot?: (ver: number) => Promise<OnesEditorDocSnapshot>;
|
|
284
356
|
getLatestVersion: () => Promise<DocObject>;
|
|
285
357
|
getHistoryData: (version: number, from?: number) => Promise<{
|
|
286
358
|
doc: DocObject;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DocBlock, WikiMacroLock } from '../doc';
|
|
2
|
+
import { BlockElement, OnesEditor } from '../types';
|
|
3
|
+
export declare function initializeWikiMacroLocks(editor: OnesEditor): void;
|
|
4
|
+
export declare function updateWikiMacroLocks(editor: OnesEditor, locks: WikiMacroLock[]): void;
|
|
5
|
+
export declare function setWikiMacroLockSession(editor: OnesEditor, sessionId: string, active: boolean): void;
|
|
6
|
+
/** Leases are server notifications, never v1 persistent lock attributes or local-clock unlocks. */
|
|
7
|
+
export declare function isWikiMacroBlockLocked(editor: OnesEditor, block: DocBlock, macroSessionId?: string): boolean;
|
|
8
|
+
export declare function isWikiMacroElementLocked(editor: OnesEditor, block: BlockElement, macroSessionId?: string): boolean;
|
|
9
|
+
export declare function clearWikiMacroLocks(editor: OnesEditor): void;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { EditorDocLocalActionCallbacks, OnesEditor } from '../types';
|
|
2
2
|
import { BuildResourceUrlOptions, InsertBlockOptions, DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorDocRange, OnesEditorDocServerMeta, OnesEditorDocStatus, UploadResourceOptions, UploadResourceResult, UpdateBlockOptions } from '../doc';
|
|
3
|
+
import { WikiMacroLocksListener, WikiMacroRequest, WikiMacroResult } from '../doc';
|
|
3
4
|
import { EventCallbacks } from '../../utils';
|
|
4
5
|
export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> implements OnesEditorDoc, OnesEditorDocCallbacks {
|
|
5
6
|
private editor;
|
|
6
7
|
externalDoc: OnesEditorDoc;
|
|
7
8
|
localEvents: EditorDocLocalActionCallbacks[];
|
|
9
|
+
private unsubscribeMacroLocks?;
|
|
10
|
+
private subscribeMacroLocks;
|
|
8
11
|
constructor(editor: OnesEditor, externalDoc: OnesEditorDoc, localEvents: EditorDocLocalActionCallbacks);
|
|
12
|
+
requestWikiMacro(message: WikiMacroRequest): Promise<WikiMacroResult>;
|
|
13
|
+
onWikiMacroLocks(listener: WikiMacroLocksListener): () => void;
|
|
14
|
+
getDocumentVersion(): number | undefined;
|
|
9
15
|
beginBatchUpdate(): number;
|
|
10
16
|
endBatchUpdate(): number;
|
|
11
17
|
applyingRemoteOps(): boolean;
|
|
@@ -359,9 +359,19 @@ export interface OnesEditorUndoAction {
|
|
|
359
359
|
getTimeStamp: () => number;
|
|
360
360
|
getBatchActionId?: () => string | undefined;
|
|
361
361
|
}
|
|
362
|
+
export interface MacroEditActionOptions {
|
|
363
|
+
actionId: string;
|
|
364
|
+
blockId: string;
|
|
365
|
+
undo: () => Promise<void>;
|
|
366
|
+
redo: () => Promise<void>;
|
|
367
|
+
onError?: (error: Error) => void;
|
|
368
|
+
}
|
|
362
369
|
export interface OnesEditorUndoManager {
|
|
363
370
|
reset: () => void;
|
|
364
371
|
addAction: (action: OnesEditorUndoAction) => void;
|
|
372
|
+
registerMacroEditAction: (options: MacroEditActionOptions) => void;
|
|
373
|
+
setMacroEditSessionActive: (sessionId: string, active: boolean) => void;
|
|
374
|
+
destroy: () => void;
|
|
365
375
|
hasGroup: () => boolean;
|
|
366
376
|
undo: () => boolean;
|
|
367
377
|
redo: () => boolean;
|
|
@@ -433,6 +443,7 @@ export interface BreakTextOptions {
|
|
|
433
443
|
}
|
|
434
444
|
export interface OnesEditorEvents {
|
|
435
445
|
'docChanged': (editor: OnesEditor, local: boolean) => void;
|
|
446
|
+
'wikiMacroLocksChanged': (editor: OnesEditor) => void;
|
|
436
447
|
'readonlyChanged': (editor: OnesEditor) => void;
|
|
437
448
|
'selectionChanged': (editor: OnesEditor) => void;
|
|
438
449
|
'focusBlockChanged': (editor: OnesEditor, newBlock: BlockElement | null, oldBlock: BlockElement | null) => void;
|
|
@@ -529,6 +540,10 @@ export interface OnesEditorDomEvents extends OnesEditorCustom {
|
|
|
529
540
|
removeAllListeners: (element: Element | Document | Window, eventName?: string) => void;
|
|
530
541
|
}
|
|
531
542
|
export type InsertTextOptions = InsertBlockOptions;
|
|
543
|
+
export interface OnesEditorDocResourceHook {
|
|
544
|
+
collect: (doc: DocObject) => readonly string[];
|
|
545
|
+
rewrite: (doc: DocObject, resources: Map<string, string>) => void;
|
|
546
|
+
}
|
|
532
547
|
export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
533
548
|
readonly parent: HTMLElement;
|
|
534
549
|
readonly rootElement: HTMLDivElement;
|
|
@@ -565,6 +580,9 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
565
580
|
findCustom: <T extends OnesEditorCustom>(name: string) => T | null;
|
|
566
581
|
findCustomByType: <T extends OnesEditorCustom>(className: new (editor: OnesEditor) => T) => T | null;
|
|
567
582
|
destroyCustom: (name: string) => void;
|
|
583
|
+
addDocResourceHook: (hook: OnesEditorDocResourceHook) => () => void;
|
|
584
|
+
registerMacroEditAction: (options: MacroEditActionOptions) => void;
|
|
585
|
+
setMacroEditSessionActive: (sessionId: string, active: boolean) => void;
|
|
568
586
|
getComponentOptions: <T>(name: string) => T | null;
|
|
569
587
|
registerLocalEvents: (events: EditorDocLocalActionCallbacks) => void;
|
|
570
588
|
createBlock: (path: BlockPath, container: ContainerElement, block: DocBlock) => BlockElement;
|
|
@@ -576,7 +594,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
576
594
|
tryFocusToChildSimpleBlock?: boolean;
|
|
577
595
|
}) => void;
|
|
578
596
|
isWritable: () => boolean;
|
|
579
|
-
isBlockWritable: (block: BlockElement | BlockElement[]) => boolean;
|
|
597
|
+
isBlockWritable: (block: BlockElement | BlockElement[], macroSessionId?: string) => boolean;
|
|
580
598
|
reload: () => void;
|
|
581
599
|
getChildContainerData: (childContainerId: string) => DocBlocks;
|
|
582
600
|
createChildContainer: (path: BlockPath, parentElement: HTMLElement, childContainerId: string) => ContainerElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MacroEditActionOptions, OnesEditor } from '../../types';
|
|
2
|
+
import Action from './action';
|
|
3
|
+
/** A server-confirmed edit, never combined with ordinary document operations. */
|
|
4
|
+
export default class MacroEditAction extends Action {
|
|
5
|
+
private options;
|
|
6
|
+
constructor(editor: OnesEditor, options: MacroEditActionOptions);
|
|
7
|
+
apply(direction: 'undo' | 'redo'): Promise<void>;
|
|
8
|
+
reportError(error: Error): void;
|
|
9
|
+
dispose(): void;
|
|
10
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DocBlock, DocBlockText, OnesEditorDocRange } from '../doc';
|
|
2
2
|
import { EditorDocLocalActionCallbacks, OnesEditor, OnesEditorUndoAction, OnesEditorUndoManager } from '../types';
|
|
3
|
+
import { MacroEditActionOptions } from '../types';
|
|
3
4
|
import Action from './actions/action';
|
|
4
5
|
declare class UndoManager implements OnesEditorUndoManager, EditorDocLocalActionCallbacks {
|
|
5
6
|
editor: OnesEditor;
|
|
@@ -8,6 +9,15 @@ declare class UndoManager implements OnesEditorUndoManager, EditorDocLocalAction
|
|
|
8
9
|
private currentGroup;
|
|
9
10
|
private groupCounter;
|
|
10
11
|
private undoRedoing;
|
|
12
|
+
private macroSessions;
|
|
13
|
+
private macroActionIds;
|
|
14
|
+
private pendingMacroAction;
|
|
15
|
+
private macroGeneration;
|
|
16
|
+
private destroyed;
|
|
17
|
+
registerMacroEditAction(options: MacroEditActionOptions): void;
|
|
18
|
+
setMacroEditSessionActive(sessionId: string, active: boolean): void;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
private applyMacroAction;
|
|
11
21
|
constructor(editor: OnesEditor);
|
|
12
22
|
reset(): void;
|
|
13
23
|
prepareSaveUndoState(): void;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { DocBlock, DocBlockDelta, DocBlockText, OnesEditorDocServerMeta, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorUser, UploadResourceOptions, UploadResourceResult } from '../core/doc';
|
|
2
|
+
import { WikiMacroLocksListener, WikiMacroRequest, WikiMacroResult } from '../core/doc';
|
|
2
3
|
import { EventCallbacks } from '../utils';
|
|
3
4
|
import { RemoteUsers } from '../users';
|
|
4
5
|
export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> implements OnesEditorDoc {
|
|
5
6
|
doc: DocObject;
|
|
6
7
|
serviceUrl: string;
|
|
8
|
+
private documentVersion?;
|
|
7
9
|
constructor(doc: DocObject | null, options?: {
|
|
8
10
|
serverUrl?: string;
|
|
11
|
+
documentVersion?: number;
|
|
9
12
|
});
|
|
13
|
+
requestWikiMacro(message: WikiMacroRequest): Promise<WikiMacroResult>;
|
|
14
|
+
onWikiMacroLocks(listener: WikiMacroLocksListener): () => void;
|
|
15
|
+
getDocumentVersion(): number | undefined;
|
|
10
16
|
beginBatchUpdate(): number;
|
|
11
17
|
endBatchUpdate(): number;
|
|
12
18
|
toJSON(): DocObject;
|
|
@@ -32,6 +38,6 @@ export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> imp
|
|
|
32
38
|
getServerMeta(): OnesEditorDocServerMeta;
|
|
33
39
|
getUser(): OnesEditorUser;
|
|
34
40
|
getRemoteUsers(): RemoteUsers;
|
|
35
|
-
setDoc(doc: DocObject): void;
|
|
41
|
+
setDoc(doc: DocObject, documentVersion?: number): void;
|
|
36
42
|
destroy(): void;
|
|
37
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Doc } from 'sharedb/lib/client';
|
|
2
2
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
3
|
+
import { WikiMacroLocksListener, WikiMacroRequest, WikiMacroResult } from '../../../../@ones-editor/core';
|
|
3
4
|
import { AuthMessage, RenewTokenFunc } from '../types';
|
|
4
5
|
import './sharedb-ext';
|
|
5
6
|
export interface AutoConnectionEvents {
|
|
@@ -33,6 +34,17 @@ export declare class AuthConnection extends TypedEmitter<AutoConnectionEvents> {
|
|
|
33
34
|
private connectionStatus;
|
|
34
35
|
private reauthing;
|
|
35
36
|
private ready;
|
|
37
|
+
private macroRequests;
|
|
38
|
+
private macroLocksListeners;
|
|
39
|
+
private macroLocks;
|
|
40
|
+
private macroLocksKnown;
|
|
41
|
+
private macroLocksLoading;
|
|
42
|
+
private loadWikiMacroLocks;
|
|
43
|
+
requestWikiMacro(message: WikiMacroRequest): Promise<WikiMacroResult>;
|
|
44
|
+
onWikiMacroLocks(listener: WikiMacroLocksListener): () => void;
|
|
45
|
+
private handleWikiMacroReply;
|
|
46
|
+
private clearWikiMacroRequests;
|
|
47
|
+
private notifyWikiMacroLocks;
|
|
36
48
|
pingOptions: {
|
|
37
49
|
interval: number;
|
|
38
50
|
timeout: number;
|
|
@@ -2,7 +2,7 @@ import { BuildResourceUrlOptions, DocVersion, OnesEditorDocVersionExtra } from '
|
|
|
2
2
|
import { Doc } from 'sharedb/lib/client';
|
|
3
3
|
import type { AxiosResponse } from 'axios';
|
|
4
4
|
import { AuthConnection } from './auth-connection';
|
|
5
|
-
import { EditorDoc, RenewTokenFunc, AuthMessage, OnProgress, EditorOp, LinkDetails } from '../types';
|
|
5
|
+
import { EditorDoc, EditorDocSnapshot, RenewTokenFunc, AuthMessage, OnProgress, EditorOp, LinkDetails } from '../types';
|
|
6
6
|
export default class ShareDBClient {
|
|
7
7
|
connection: AuthConnection;
|
|
8
8
|
private doc;
|
|
@@ -40,6 +40,7 @@ export default class ShareDBClient {
|
|
|
40
40
|
request<T = unknown>(url: string, opt?: any): Promise<AxiosResponse<any, T>>;
|
|
41
41
|
getVersions(): Promise<DocVersion[]>;
|
|
42
42
|
getVersion(ver: number): Promise<EditorDoc>;
|
|
43
|
+
getVersionSnapshot(ver: number): Promise<EditorDocSnapshot>;
|
|
43
44
|
getLatestVersion(): Promise<EditorDoc>;
|
|
44
45
|
getVersionOps(version: number, from?: number): Promise<{
|
|
45
46
|
doc: EditorDoc;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BuildResourceUrlOptions, DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocCommentResolver, DocObject, DocVersion, EventCallbacks, OnesEditorComment, OnesEditorDoc, OnesEditorDocHistoryData, OnesEditorDocServerMeta, OnesEditorDocStatus, OnesEditorDocVersionExtra, OnesEditorDocVersionHelper, OnesEditorHistoryDataParseHandler, UploadResourceOptions, UploadResourceResult } from '../../../../@ones-editor/core';
|
|
2
|
+
import { WikiMacroLocksListener, WikiMacroRequest, WikiMacroResult } from '../../../../@ones-editor/core';
|
|
3
|
+
import { OnesEditorDocSnapshot } from '../../../../@ones-editor/core';
|
|
2
4
|
import { Doc } from 'sharedb/lib/client';
|
|
3
5
|
import { LocalPresence } from 'sharedb/lib/sharedb';
|
|
4
6
|
import RemoteCaretsHandler from './remote-caret-handler';
|
|
@@ -18,6 +20,9 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
18
20
|
editStatus: EditStatus;
|
|
19
21
|
_applyingRemoteOps: boolean;
|
|
20
22
|
constructor(options: ShareDBDocOptions, client: ShareDBClient, doc: Doc, disableLogout?: boolean);
|
|
23
|
+
requestWikiMacro(message: WikiMacroRequest): Promise<WikiMacroResult>;
|
|
24
|
+
onWikiMacroLocks(listener: WikiMacroLocksListener): () => void;
|
|
25
|
+
getDocumentVersion(): number | undefined;
|
|
21
26
|
beginBatchUpdate(): number;
|
|
22
27
|
endBatchUpdate(): number;
|
|
23
28
|
applyingRemoteOps(): boolean;
|
|
@@ -99,6 +104,7 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
99
104
|
getVersionHelper(): OnesEditorDocVersionHelper;
|
|
100
105
|
getVersions(): Promise<DocVersion[]>;
|
|
101
106
|
getVersion(ver: number): Promise<DocObject>;
|
|
107
|
+
getVersionSnapshot(ver: number): Promise<OnesEditorDocSnapshot>;
|
|
102
108
|
getLatestVersion(): Promise<DocObject>;
|
|
103
109
|
getHistoryData(version: number, from?: number | undefined): Promise<{
|
|
104
110
|
doc: DocObject;
|
|
@@ -19,6 +19,10 @@ export type EditorDocBase = {
|
|
|
19
19
|
export type EditorDoc = EditorDocBase & {
|
|
20
20
|
[index: string]: BlocksType | unknown;
|
|
21
21
|
};
|
|
22
|
+
export interface EditorDocSnapshot {
|
|
23
|
+
doc: EditorDoc;
|
|
24
|
+
documentVersion?: number;
|
|
25
|
+
}
|
|
22
26
|
export interface AuthMessage {
|
|
23
27
|
appId: string;
|
|
24
28
|
docId: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BuildResourceUrlOptions, DocObject, DocVersion, EventCallbacks, OnesEditorDocHistoryData, OnesEditorDocServer, OnesEditorDocServerMeta, OnesEditorDocVersionExtra, OnesEditorDocVersionHelper, OnesEditorHistoryDataParseHandler, RemoteUsers } from '../../../../@ones-editor/core';
|
|
2
|
+
import { OnesEditorDocSnapshot } from '../../../../@ones-editor/core';
|
|
2
3
|
import { AuthMessage, ShareDBDocCallbacks, ShareDBDocOptions } from '../types';
|
|
3
4
|
import ShareDBSimpleClient from './simple-client';
|
|
4
5
|
export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> implements OnesEditorDocServer, OnesEditorDocVersionHelper {
|
|
@@ -12,6 +13,7 @@ export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> i
|
|
|
12
13
|
getVersionHelper(): OnesEditorDocVersionHelper;
|
|
13
14
|
getVersions(showPublished?: boolean): Promise<DocVersion[]>;
|
|
14
15
|
getVersion(ver: number): Promise<DocObject>;
|
|
16
|
+
getVersionSnapshot(ver: number): Promise<OnesEditorDocSnapshot>;
|
|
15
17
|
getLatestVersion(): Promise<DocObject>;
|
|
16
18
|
getHistoryData(version: number, from?: number | undefined): Promise<{
|
|
17
19
|
doc: DocObject;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuildResourceUrlOptions, DocVersion, OnesEditorDocVersionExtra } from '../../../../@ones-editor/core';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
|
-
import { AuthMessage, EditorDoc, EditorOp } from '../types';
|
|
3
|
+
import { AuthMessage, EditorDoc, EditorDocSnapshot, EditorOp } from '../types';
|
|
4
4
|
export default class ShareDBSimpleClient {
|
|
5
5
|
private serverUrl;
|
|
6
6
|
auth: AuthMessage;
|
|
@@ -13,6 +13,7 @@ export default class ShareDBSimpleClient {
|
|
|
13
13
|
request<T = unknown>(url: string, opt?: any): Promise<AxiosResponse<any, T>>;
|
|
14
14
|
getVersions(showPublished: boolean): Promise<DocVersion[]>;
|
|
15
15
|
getVersion(ver: number): Promise<EditorDoc>;
|
|
16
|
+
getVersionSnapshot(ver: number): Promise<EditorDocSnapshot>;
|
|
16
17
|
getLatestVersion(): Promise<EditorDoc>;
|
|
17
18
|
getVersionOps(version: number, from?: number): Promise<{
|
|
18
19
|
doc: EditorDoc;
|