@ones-editor/editor 5.0.6-beta.DNP8216.3 → 5.0.6-beta.p8216.2
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 -72
- 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/editor/index.d.ts +0 -1
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +0 -6
- package/@ones-editor/core/src/core/types.d.ts +9 -23
- package/@ones-editor/core/src/core/undo-manager/actions/async-action.d.ts +4 -7
- package/@ones-editor/core/src/core/undo-manager/undo-manager.d.ts +9 -15
- package/@ones-editor/core/src/local-doc/index.d.ts +1 -7
- package/@ones-editor/server-tools/src/to-markdown/embeds/wiki-macro.d.ts +1 -1
- package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +0 -12
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +1 -2
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +1 -6
- package/@ones-editor/sharedb-doc/src/doc/sharedb-local-doc.d.ts +0 -1
- package/@ones-editor/sharedb-doc/src/types.d.ts +0 -4
- package/@ones-editor/sharedb-doc/src/versions/sharedb-server.d.ts +0 -2
- package/@ones-editor/sharedb-doc/src/versions/simple-client.d.ts +1 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/block-menu/index.d.ts +0 -1
- package/@ones-editor/versions/src/history-diff.d.ts +0 -1
- package/@ones-editor/versions/src/history-doc/history-doc.d.ts +1 -6
- package/dist/index.js +679 -1119
- package/package.json +1 -1
- package/@ones-editor/core/src/core/composition/clipboard/resources/doc-resource-hooks.d.ts +0 -6
- package/@ones-editor/core/src/core/editor/wiki-macro-locks.d.ts +0 -9
- package/@ones-editor/core/src/core/undo-manager/actions/macro-edit-action.d.ts +0 -4
|
@@ -230,77 +230,12 @@ 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;
|
|
297
233
|
export interface OnesEditorDoc extends OnesEditorDocServer {
|
|
298
|
-
requestWikiMacro: (message: WikiMacroRequest) => Promise<WikiMacroResult>;
|
|
299
|
-
onWikiMacroLocks: (listener: WikiMacroLocksListener) => () => void;
|
|
300
|
-
getDocumentVersion?: () => number | undefined;
|
|
301
234
|
registerCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
302
235
|
unregisterCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
303
236
|
toJSON: () => DocObject;
|
|
237
|
+
/** Current collaboration revision, when this is a live document. */
|
|
238
|
+
getDocumentVersion?: () => number | undefined;
|
|
304
239
|
getContainerBlocks: (containerId: string) => DocBlock[];
|
|
305
240
|
findContainerBlocks: (containerId: string) => DocBlock[] | null;
|
|
306
241
|
getBlockData: (containerId: string, blockIndex: number) => DocBlock;
|
|
@@ -345,14 +280,9 @@ export interface OnesEditorHistoryDataParseHandler {
|
|
|
345
280
|
onUpdateComment: (commentId: string, local: boolean) => void;
|
|
346
281
|
onUpdateCommentResolver: (commentId: string, local: boolean) => void;
|
|
347
282
|
}
|
|
348
|
-
export interface OnesEditorDocSnapshot {
|
|
349
|
-
doc: DocObject;
|
|
350
|
-
documentVersion?: number;
|
|
351
|
-
}
|
|
352
283
|
export interface OnesEditorDocVersionHelper {
|
|
353
284
|
getVersions: (showPublished?: boolean) => Promise<DocVersion[]>;
|
|
354
285
|
getVersion: (ver: number) => Promise<DocObject>;
|
|
355
|
-
getVersionSnapshot?: (ver: number) => Promise<OnesEditorDocSnapshot>;
|
|
356
286
|
getLatestVersion: () => Promise<DocObject>;
|
|
357
287
|
getHistoryData: (version: number, from?: number) => Promise<{
|
|
358
288
|
doc: DocObject;
|
|
@@ -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 {};
|
|
@@ -1,17 +1,11 @@
|
|
|
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';
|
|
4
3
|
import { EventCallbacks } from '../../utils';
|
|
5
4
|
export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> implements OnesEditorDoc, OnesEditorDocCallbacks {
|
|
6
5
|
private editor;
|
|
7
6
|
externalDoc: OnesEditorDoc;
|
|
8
7
|
localEvents: EditorDocLocalActionCallbacks[];
|
|
9
|
-
private unsubscribeMacroLocks?;
|
|
10
|
-
private subscribeMacroLocks;
|
|
11
8
|
constructor(editor: OnesEditor, externalDoc: OnesEditorDoc, localEvents: EditorDocLocalActionCallbacks);
|
|
12
|
-
requestWikiMacro(message: WikiMacroRequest): Promise<WikiMacroResult>;
|
|
13
|
-
onWikiMacroLocks(listener: WikiMacroLocksListener): () => void;
|
|
14
|
-
getDocumentVersion(): number | undefined;
|
|
15
9
|
beginBatchUpdate(): number;
|
|
16
10
|
endBatchUpdate(): number;
|
|
17
11
|
applyingRemoteOps(): boolean;
|
|
@@ -359,26 +359,13 @@ export interface OnesEditorUndoAction {
|
|
|
359
359
|
getTimeStamp: () => number;
|
|
360
360
|
getBatchActionId?: () => string | undefined;
|
|
361
361
|
}
|
|
362
|
-
export interface AsyncUndoActionOptions {
|
|
363
|
-
undo: () => Promise<void>;
|
|
364
|
-
redo: () => Promise<void>;
|
|
365
|
-
onError?: (error: Error) => void;
|
|
366
|
-
onDiscard?: () => void;
|
|
367
|
-
}
|
|
368
|
-
export interface MacroEditActionOptions extends AsyncUndoActionOptions {
|
|
369
|
-
actionId: string;
|
|
370
|
-
blockId: string;
|
|
371
|
-
}
|
|
372
362
|
export interface OnesEditorUndoManager {
|
|
373
363
|
reset: () => void;
|
|
374
364
|
addAction: (action: OnesEditorUndoAction) => void;
|
|
375
|
-
addAsyncAction: (
|
|
365
|
+
addAsyncAction: (action: OnesEditorAsyncUndoAction) => () => void;
|
|
376
366
|
acquireUndoLock: () => () => void;
|
|
377
367
|
undoAsync: () => Promise<boolean>;
|
|
378
368
|
redoAsync: () => Promise<boolean>;
|
|
379
|
-
registerMacroEditAction: (options: MacroEditActionOptions) => void;
|
|
380
|
-
setMacroEditSessionActive: (sessionId: string, active: boolean) => void;
|
|
381
|
-
destroy: () => void;
|
|
382
369
|
hasGroup: () => boolean;
|
|
383
370
|
undo: () => boolean;
|
|
384
371
|
redo: () => boolean;
|
|
@@ -388,6 +375,12 @@ export interface OnesEditorUndoManager {
|
|
|
388
375
|
lastAction: () => OnesEditorUndoAction | null;
|
|
389
376
|
undoTo: (action: OnesEditorUndoAction | null) => boolean;
|
|
390
377
|
}
|
|
378
|
+
export interface OnesEditorAsyncUndoAction {
|
|
379
|
+
onDiscard?: () => void;
|
|
380
|
+
undo: () => Promise<boolean>;
|
|
381
|
+
redo: () => Promise<boolean>;
|
|
382
|
+
onError: (error: unknown) => void;
|
|
383
|
+
}
|
|
391
384
|
export interface ShortcutRecords {
|
|
392
385
|
[index: string]: (editor: OnesEditor, event: Event) => boolean | undefined;
|
|
393
386
|
}
|
|
@@ -450,7 +443,6 @@ export interface BreakTextOptions {
|
|
|
450
443
|
}
|
|
451
444
|
export interface OnesEditorEvents {
|
|
452
445
|
'docChanged': (editor: OnesEditor, local: boolean) => void;
|
|
453
|
-
'wikiMacroLocksChanged': (editor: OnesEditor) => void;
|
|
454
446
|
'readonlyChanged': (editor: OnesEditor) => void;
|
|
455
447
|
'selectionChanged': (editor: OnesEditor) => void;
|
|
456
448
|
'focusBlockChanged': (editor: OnesEditor, newBlock: BlockElement | null, oldBlock: BlockElement | null) => void;
|
|
@@ -547,10 +539,6 @@ export interface OnesEditorDomEvents extends OnesEditorCustom {
|
|
|
547
539
|
removeAllListeners: (element: Element | Document | Window, eventName?: string) => void;
|
|
548
540
|
}
|
|
549
541
|
export type InsertTextOptions = InsertBlockOptions;
|
|
550
|
-
export interface OnesEditorDocResourceHook {
|
|
551
|
-
collect: (doc: DocObject) => readonly string[];
|
|
552
|
-
rewrite: (doc: DocObject, resources: Map<string, string>) => void;
|
|
553
|
-
}
|
|
554
542
|
export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
555
543
|
readonly parent: HTMLElement;
|
|
556
544
|
readonly rootElement: HTMLDivElement;
|
|
@@ -580,6 +568,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
580
568
|
readonly settingsProvider: OnesEditorSettingsProvider;
|
|
581
569
|
version: string;
|
|
582
570
|
readonly: boolean;
|
|
571
|
+
acquireReadonly: () => () => void;
|
|
583
572
|
destroyed: boolean;
|
|
584
573
|
addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator<T>) => T;
|
|
585
574
|
getCustom: <T extends OnesEditorCustom>(name: string) => T;
|
|
@@ -587,9 +576,6 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
587
576
|
findCustom: <T extends OnesEditorCustom>(name: string) => T | null;
|
|
588
577
|
findCustomByType: <T extends OnesEditorCustom>(className: new (editor: OnesEditor) => T) => T | null;
|
|
589
578
|
destroyCustom: (name: string) => void;
|
|
590
|
-
addDocResourceHook: (hook: OnesEditorDocResourceHook) => () => void;
|
|
591
|
-
registerMacroEditAction: (options: MacroEditActionOptions) => void;
|
|
592
|
-
setMacroEditSessionActive: (sessionId: string, active: boolean) => void;
|
|
593
579
|
getComponentOptions: <T>(name: string) => T | null;
|
|
594
580
|
registerLocalEvents: (events: EditorDocLocalActionCallbacks) => void;
|
|
595
581
|
createBlock: (path: BlockPath, container: ContainerElement, block: DocBlock) => BlockElement;
|
|
@@ -601,7 +587,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
601
587
|
tryFocusToChildSimpleBlock?: boolean;
|
|
602
588
|
}) => void;
|
|
603
589
|
isWritable: () => boolean;
|
|
604
|
-
isBlockWritable: (block: BlockElement | BlockElement[]
|
|
590
|
+
isBlockWritable: (block: BlockElement | BlockElement[]) => boolean;
|
|
605
591
|
reload: () => void;
|
|
606
592
|
getChildContainerData: (childContainerId: string) => DocBlocks;
|
|
607
593
|
createChildContainer: (path: BlockPath, parentElement: HTMLElement, childContainerId: string) => ContainerElement;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OnesEditor, OnesEditorAsyncUndoAction } from '../../types';
|
|
2
2
|
import Action from './action';
|
|
3
|
-
/** A confirmed
|
|
3
|
+
/** A server-confirmed edit session is one action, independent of synchronous groups. */
|
|
4
4
|
export default class AsyncAction extends Action {
|
|
5
|
-
|
|
6
|
-
constructor(editor: OnesEditor, operation:
|
|
7
|
-
apply(direction: 'undo' | 'redo'): Promise<void>;
|
|
8
|
-
reportError(error: Error): void;
|
|
9
|
-
dispose(): void;
|
|
5
|
+
readonly operation: OnesEditorAsyncUndoAction;
|
|
6
|
+
constructor(editor: OnesEditor, operation: OnesEditorAsyncUndoAction);
|
|
10
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocBlock, DocBlockText, OnesEditorDocRange } from '../doc';
|
|
2
2
|
import { EditorDocLocalActionCallbacks, OnesEditor, OnesEditorUndoAction, OnesEditorUndoManager } from '../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OnesEditorAsyncUndoAction } from '../types';
|
|
4
4
|
import Action from './actions/action';
|
|
5
5
|
declare class UndoManager implements OnesEditorUndoManager, EditorDocLocalActionCallbacks {
|
|
6
6
|
editor: OnesEditor;
|
|
@@ -9,25 +9,19 @@ declare class UndoManager implements OnesEditorUndoManager, EditorDocLocalAction
|
|
|
9
9
|
private currentGroup;
|
|
10
10
|
private groupCounter;
|
|
11
11
|
private undoRedoing;
|
|
12
|
-
private macroSessions;
|
|
13
|
-
private macroActionIds;
|
|
14
|
-
private pendingMacroAction;
|
|
15
|
-
private pendingAsyncPromise;
|
|
16
12
|
private undoLocks;
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
registerMacroEditAction(options: MacroEditActionOptions): void;
|
|
20
|
-
addAsyncAction(operation: AsyncUndoActionOptions): void;
|
|
21
|
-
acquireUndoLock(): () => void;
|
|
22
|
-
undoAsync(): Promise<boolean>;
|
|
23
|
-
redoAsync(): Promise<boolean>;
|
|
24
|
-
setMacroEditSessionActive(sessionId: string, active: boolean): void;
|
|
25
|
-
destroy(): void;
|
|
26
|
-
private applyMacroAction;
|
|
13
|
+
private pendingAction?;
|
|
14
|
+
private resetVersion;
|
|
27
15
|
constructor(editor: OnesEditor);
|
|
28
16
|
reset(): void;
|
|
29
17
|
prepareSaveUndoState(): void;
|
|
30
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;
|
|
31
25
|
private beginGroup;
|
|
32
26
|
private endGroup;
|
|
33
27
|
hasGroup(): boolean;
|
|
@@ -1,18 +1,12 @@
|
|
|
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';
|
|
3
2
|
import { EventCallbacks } from '../utils';
|
|
4
3
|
import { RemoteUsers } from '../users';
|
|
5
4
|
export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> implements OnesEditorDoc {
|
|
6
5
|
doc: DocObject;
|
|
7
6
|
serviceUrl: string;
|
|
8
|
-
private documentVersion?;
|
|
9
7
|
constructor(doc: DocObject | null, options?: {
|
|
10
8
|
serverUrl?: string;
|
|
11
|
-
documentVersion?: number;
|
|
12
9
|
});
|
|
13
|
-
requestWikiMacro(message: WikiMacroRequest): Promise<WikiMacroResult>;
|
|
14
|
-
onWikiMacroLocks(listener: WikiMacroLocksListener): () => void;
|
|
15
|
-
getDocumentVersion(): number | undefined;
|
|
16
10
|
beginBatchUpdate(): number;
|
|
17
11
|
endBatchUpdate(): number;
|
|
18
12
|
toJSON(): DocObject;
|
|
@@ -38,6 +32,6 @@ export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> imp
|
|
|
38
32
|
getServerMeta(): OnesEditorDocServerMeta;
|
|
39
33
|
getUser(): OnesEditorUser;
|
|
40
34
|
getRemoteUsers(): RemoteUsers;
|
|
41
|
-
setDoc(doc: DocObject
|
|
35
|
+
setDoc(doc: DocObject): void;
|
|
42
36
|
destroy(): void;
|
|
43
37
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DocEmbedBlock, DocObject } from '../../../../../@ones-editor/core';
|
|
2
2
|
import type { Converters } from '../types';
|
|
3
|
-
/**
|
|
3
|
+
/** Images use the existing document-resource placeholder consumed by Wiki API. */
|
|
4
4
|
export default function macroToMarkdown(converters: Converters, block: DocEmbedBlock, doc: DocObject): string;
|
|
@@ -1,6 +1,5 @@
|
|
|
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';
|
|
4
3
|
import { AuthMessage, RenewTokenFunc } from '../types';
|
|
5
4
|
import './sharedb-ext';
|
|
6
5
|
export interface AutoConnectionEvents {
|
|
@@ -34,17 +33,6 @@ export declare class AuthConnection extends TypedEmitter<AutoConnectionEvents> {
|
|
|
34
33
|
private connectionStatus;
|
|
35
34
|
private reauthing;
|
|
36
35
|
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;
|
|
48
36
|
pingOptions: {
|
|
49
37
|
interval: number;
|
|
50
38
|
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,
|
|
5
|
+
import { EditorDoc, RenewTokenFunc, AuthMessage, OnProgress, EditorOp, LinkDetails } from '../types';
|
|
6
6
|
export default class ShareDBClient {
|
|
7
7
|
connection: AuthConnection;
|
|
8
8
|
private doc;
|
|
@@ -40,7 +40,6 @@ 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>;
|
|
44
43
|
getLatestVersion(): Promise<EditorDoc>;
|
|
45
44
|
getVersionOps(version: number, from?: number): Promise<{
|
|
46
45
|
doc: EditorDoc;
|
|
@@ -1,6 +1,4 @@
|
|
|
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';
|
|
4
2
|
import { Doc } from 'sharedb/lib/client';
|
|
5
3
|
import { LocalPresence } from 'sharedb/lib/sharedb';
|
|
6
4
|
import RemoteCaretsHandler from './remote-caret-handler';
|
|
@@ -20,9 +18,6 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
20
18
|
editStatus: EditStatus;
|
|
21
19
|
_applyingRemoteOps: boolean;
|
|
22
20
|
constructor(options: ShareDBDocOptions, client: ShareDBClient, doc: Doc, disableLogout?: boolean);
|
|
23
|
-
requestWikiMacro(message: WikiMacroRequest): Promise<WikiMacroResult>;
|
|
24
|
-
onWikiMacroLocks(listener: WikiMacroLocksListener): () => void;
|
|
25
|
-
getDocumentVersion(): number | undefined;
|
|
26
21
|
beginBatchUpdate(): number;
|
|
27
22
|
endBatchUpdate(): number;
|
|
28
23
|
applyingRemoteOps(): boolean;
|
|
@@ -47,6 +42,7 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
47
42
|
initPresence(): Promise<void>;
|
|
48
43
|
private subscribe;
|
|
49
44
|
data: () => any;
|
|
45
|
+
getDocumentVersion(): number | undefined;
|
|
50
46
|
toJSON(): DocObject;
|
|
51
47
|
private submitOp;
|
|
52
48
|
createDoc: (data: EditorDoc) => Promise<void>;
|
|
@@ -104,7 +100,6 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
104
100
|
getVersionHelper(): OnesEditorDocVersionHelper;
|
|
105
101
|
getVersions(): Promise<DocVersion[]>;
|
|
106
102
|
getVersion(ver: number): Promise<DocObject>;
|
|
107
|
-
getVersionSnapshot(ver: number): Promise<OnesEditorDocSnapshot>;
|
|
108
103
|
getLatestVersion(): Promise<DocObject>;
|
|
109
104
|
getHistoryData(version: number, from?: number | undefined): Promise<{
|
|
110
105
|
doc: DocObject;
|
|
@@ -19,10 +19,6 @@ 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
|
-
}
|
|
26
22
|
export interface AuthMessage {
|
|
27
23
|
appId: string;
|
|
28
24
|
docId: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
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';
|
|
3
2
|
import { AuthMessage, ShareDBDocCallbacks, ShareDBDocOptions } from '../types';
|
|
4
3
|
import ShareDBSimpleClient from './simple-client';
|
|
5
4
|
export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> implements OnesEditorDocServer, OnesEditorDocVersionHelper {
|
|
@@ -13,7 +12,6 @@ export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> i
|
|
|
13
12
|
getVersionHelper(): OnesEditorDocVersionHelper;
|
|
14
13
|
getVersions(showPublished?: boolean): Promise<DocVersion[]>;
|
|
15
14
|
getVersion(ver: number): Promise<DocObject>;
|
|
16
|
-
getVersionSnapshot(ver: number): Promise<OnesEditorDocSnapshot>;
|
|
17
15
|
getLatestVersion(): Promise<DocObject>;
|
|
18
16
|
getHistoryData(version: number, from?: number | undefined): Promise<{
|
|
19
17
|
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,
|
|
3
|
+
import { AuthMessage, EditorDoc, EditorOp } from '../types';
|
|
4
4
|
export default class ShareDBSimpleClient {
|
|
5
5
|
private serverUrl;
|
|
6
6
|
auth: AuthMessage;
|
|
@@ -13,7 +13,6 @@ 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>;
|
|
17
16
|
getLatestVersion(): Promise<EditorDoc>;
|
|
18
17
|
getVersionOps(version: number, from?: number): Promise<{
|
|
19
18
|
doc: EditorDoc;
|