@ones-editor/editor 0.0.3-beta.26 → 0.0.3-beta.27
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/types.d.ts +1 -2
- package/@ones-editor/core/src/i18n/i18n.d.ts +36 -0
- package/@ones-editor/core/src/local-doc/index.d.ts +2 -6
- package/@ones-editor/input-handlers/src/enforce-with-document-title/types.d.ts +1 -0
- package/@ones-editor/input-handlers/src/i18n/en-us.d.ts +1 -0
- package/@ones-editor/input-handlers/src/i18n/zh-cn.d.ts +1 -0
- package/@ones-editor/scroll-container/src/index.d.ts +6 -18
- package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +3 -3
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +3 -3
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +2 -1
- package/@ones-editor/sharedb-doc/src/types.d.ts +3 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -0
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +5 -0
- package/@ones-editor/ui-base/src/dialog/index.d.ts +1 -0
- package/@ones-editor/ui-base/src/dialog/types.d.ts +4 -0
- package/@ones-editor/versions/src/types.d.ts +1 -0
- package/@ones-editor/versions/src/version-dialog/index.d.ts +3 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +133 -135
- package/dist/lang/en-us.d.ts +13 -0
- package/dist/lang/index.d.ts +1 -0
- package/dist/lang/zh-cn.d.ts +13 -0
- package/dist/types.d.ts +10 -3
- package/package.json +1 -1
|
@@ -94,7 +94,6 @@ export interface Embed {
|
|
|
94
94
|
offset: number;
|
|
95
95
|
data?: DocBlockAttributes;
|
|
96
96
|
}) => ConvertBlockResult | null;
|
|
97
|
-
notify?: (editor: OnesEditor, command: string, params?: unknown) => void;
|
|
98
97
|
}
|
|
99
98
|
export interface ConvertBlockResult {
|
|
100
99
|
blockData: DocBlock;
|
|
@@ -349,7 +348,7 @@ export interface BreakTextOptions {
|
|
|
349
348
|
copyBlockAttributes?: boolean;
|
|
350
349
|
}
|
|
351
350
|
export interface OnesEditorEvents {
|
|
352
|
-
'docChanged': (editor: OnesEditor) => void;
|
|
351
|
+
'docChanged': (editor: OnesEditor, local: boolean) => void;
|
|
353
352
|
'readonlyChanged': (editor: OnesEditor) => void;
|
|
354
353
|
'selectionChanged': (editor: OnesEditor) => void;
|
|
355
354
|
'focusBlockChanged': (editor: OnesEditor, newBlock: BlockElement | null, oldBlock: BlockElement | null) => void;
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
declare const langs: {
|
|
2
|
+
'en-US': {
|
|
3
|
+
name: string;
|
|
4
|
+
date: {
|
|
5
|
+
dateFromFuture: string;
|
|
6
|
+
dateJustNow: string;
|
|
7
|
+
dateYesterday: string;
|
|
8
|
+
dateMinutesAgo: string;
|
|
9
|
+
date1HourAgo: string;
|
|
10
|
+
dateHoursAgo: string;
|
|
11
|
+
dateDaysAgo: string;
|
|
12
|
+
dateWeeksAgo: string;
|
|
13
|
+
};
|
|
14
|
+
common: {
|
|
15
|
+
cancel: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
'zh-CN': {
|
|
19
|
+
name: string;
|
|
20
|
+
date: {
|
|
21
|
+
dateFromFuture: string;
|
|
22
|
+
dateJustNow: string;
|
|
23
|
+
dateYesterday: string;
|
|
24
|
+
dateMinutesAgo: string;
|
|
25
|
+
date1HourAgo: string;
|
|
26
|
+
dateHoursAgo: string;
|
|
27
|
+
dateDaysAgo: string;
|
|
28
|
+
dateWeeksAgo: string;
|
|
29
|
+
};
|
|
30
|
+
common: {
|
|
31
|
+
cancel: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
1
35
|
export declare function setLang(lang?: string | null | undefined): void;
|
|
2
36
|
export declare function mergeLang(l: any): void;
|
|
3
37
|
export declare function t(key: string, args?: Record<string, string>): string;
|
|
38
|
+
export type LANGS = keyof typeof langs;
|
|
39
|
+
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { DocBlock, DocBlockDelta, DocBlockText,
|
|
1
|
+
import { DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorUser, UploadResourceOptions, UploadResourceResult } from '../core/doc';
|
|
2
2
|
import { EventCallbacks } from '../utils';
|
|
3
3
|
import { RemoteUsers } from '../users';
|
|
4
4
|
export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> implements OnesEditorDoc {
|
|
5
5
|
doc: DocObject;
|
|
6
|
-
|
|
7
|
-
constructor(doc: DocObject | null, options?: {
|
|
8
|
-
serverUrl?: string;
|
|
9
|
-
});
|
|
6
|
+
constructor(doc?: DocObject);
|
|
10
7
|
beginBatchUpdate(): number;
|
|
11
8
|
endBatchUpdate(): number;
|
|
12
9
|
toJSON(): DocObject;
|
|
@@ -23,7 +20,6 @@ export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> imp
|
|
|
23
20
|
buildResourceUrl(src: string): string;
|
|
24
21
|
request<T>(url: string, opt?: any): Promise<T>;
|
|
25
22
|
broadcastMessage(data: unknown): void;
|
|
26
|
-
getServerMeta(): OnesEditorDocServerMeta;
|
|
27
23
|
getUser(): OnesEditorUser;
|
|
28
24
|
getRemoteUsers(): RemoteUsers;
|
|
29
25
|
setDoc(doc: DocObject): void;
|
|
@@ -5,27 +5,15 @@ export interface ChildEvents {
|
|
|
5
5
|
scroll: (scrollContainer: ScrollContainer) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare class ScrollContainer extends TypedEmitter<ChildEvents> {
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private scrollContainerElement
|
|
11
|
-
constructor(options: ScrollContainerOptions);
|
|
8
|
+
private scrollListener?;
|
|
9
|
+
private options?;
|
|
10
|
+
private scrollContainerElement?;
|
|
12
11
|
get rootElement(): HTMLElement;
|
|
13
12
|
get contentElement(): HTMLElement;
|
|
14
|
-
get scrollOptions():
|
|
15
|
-
|
|
16
|
-
safeLeftSpace?: number | undefined;
|
|
17
|
-
barFloatWindowBottom?: number | undefined;
|
|
18
|
-
parentContainer: Element;
|
|
19
|
-
locatingContainer: Element;
|
|
20
|
-
parentElement: HTMLElement;
|
|
21
|
-
childElement: HTMLElement;
|
|
22
|
-
paddingTop?: number | undefined;
|
|
23
|
-
paddingLeft?: number | undefined;
|
|
24
|
-
paddingBottom?: number | undefined;
|
|
25
|
-
paddingRight?: number | undefined;
|
|
26
|
-
};
|
|
13
|
+
get scrollOptions(): ScrollContainerOptions;
|
|
14
|
+
init: (options: ScrollContainerOptions) => void;
|
|
27
15
|
private handleContainerScroll;
|
|
28
16
|
private handleBaseListenerDestroy;
|
|
29
17
|
destroy(): void;
|
|
30
18
|
}
|
|
31
|
-
export declare function createScrollContainer(
|
|
19
|
+
export declare function createScrollContainer(): ScrollContainer;
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import { Connection, Doc } from 'sharedb/lib/client';
|
|
3
3
|
import ReconnectingWebSocket, { Event } from 'reconnecting-websocket';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
|
-
import { AuthMessage,
|
|
5
|
+
import { AuthMessage, ReauthFunc } from '../types';
|
|
6
6
|
import './sharedb-ext';
|
|
7
7
|
export declare class AuthConnection {
|
|
8
8
|
url: string;
|
|
9
|
-
private
|
|
9
|
+
private reauthFunc?;
|
|
10
10
|
connection?: Connection;
|
|
11
11
|
ws?: ReconnectingWebSocket;
|
|
12
12
|
retryCount: number;
|
|
13
13
|
events: EventEmitter;
|
|
14
14
|
token: string | null;
|
|
15
15
|
resourceToken: string | null;
|
|
16
|
-
constructor(url: string,
|
|
16
|
+
constructor(url: string, reauthFunc?: ReauthFunc | undefined);
|
|
17
17
|
getBaseURL(): string;
|
|
18
18
|
getBase64BaseURL(): string;
|
|
19
19
|
auth(auth: AuthMessage): Promise<{
|
|
@@ -3,14 +3,14 @@ import { Doc } from 'sharedb/lib/client';
|
|
|
3
3
|
import { Event } from 'reconnecting-websocket';
|
|
4
4
|
import type { AxiosResponse } from 'axios';
|
|
5
5
|
import { AuthConnection } from './auth-connection';
|
|
6
|
-
import { EditorDoc,
|
|
6
|
+
import { EditorDoc, ReauthFunc, AuthMessage, OnProgress, EditorOp, LinkDetails } from '../types';
|
|
7
7
|
export default class ShareDBClient {
|
|
8
8
|
connection: AuthConnection;
|
|
9
9
|
auth: AuthMessage;
|
|
10
10
|
private doc;
|
|
11
|
-
private
|
|
11
|
+
private reauthFunc?;
|
|
12
12
|
clientId: string;
|
|
13
|
-
constructor(auth: AuthMessage, serverUrl: string,
|
|
13
|
+
constructor(auth: AuthMessage, serverUrl: string, reauthFunc?: ReauthFunc);
|
|
14
14
|
editorServer(): string;
|
|
15
15
|
close(logout: boolean): void;
|
|
16
16
|
on(event: 'open' | 'close' | 'error', callback: (event: Event | Error) => void): void;
|
|
@@ -11,7 +11,8 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
11
11
|
remoteCaretHandler: RemoteCaretsHandler;
|
|
12
12
|
batching: number;
|
|
13
13
|
status: OnesEditorDocStatus;
|
|
14
|
-
|
|
14
|
+
disableLogout: boolean;
|
|
15
|
+
constructor(client: ShareDBClient, doc: Doc, disableLogout?: boolean);
|
|
15
16
|
beginBatchUpdate(): number;
|
|
16
17
|
endBatchUpdate(): number;
|
|
17
18
|
static load(options: ShareDBDocOptions): Promise<ShareDBDoc>;
|
|
@@ -62,14 +62,15 @@ export declare const FileExtError: {
|
|
|
62
62
|
};
|
|
63
63
|
export declare const AuthHeader = "x-live-editor-token";
|
|
64
64
|
export declare const BaseURLHeader = "x-live-editor-base-url";
|
|
65
|
-
export type
|
|
65
|
+
export type ReauthFunc = () => Promise<AuthMessage>;
|
|
66
66
|
export type OnProgress = (percentage: number) => void;
|
|
67
67
|
export interface ShareDBDocOptions {
|
|
68
68
|
auth: AuthMessage;
|
|
69
69
|
serverUrl: string;
|
|
70
|
-
|
|
70
|
+
reauthFunc?: ReauthFunc;
|
|
71
71
|
autoCreateDoc?: boolean;
|
|
72
72
|
templateData?: EditorDoc;
|
|
73
|
+
disableLogout?: boolean;
|
|
73
74
|
}
|
|
74
75
|
export interface EditorOp {
|
|
75
76
|
c: string;
|