@ones-editor/editor 2.1.0-beta.4 → 2.1.1-beta.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.
@@ -0,0 +1,24 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { BuildResourceUrlOptions } from '../../../../@ones-editor/core';
3
+ import { OnProgress } from '../types';
4
+ export default abstract class ShareDBClientBase {
5
+ abstract apiServer(): string;
6
+ abstract request<T = unknown>(url: string, opt?: any): Promise<AxiosResponse<any, T>>;
7
+ abstract token(): string;
8
+ abstract resourceToken(): string;
9
+ abstract docId(): string;
10
+ getFileUrlByHash(uploadFileUrl: string, hash: string, name: string, size: number, headers: {
11
+ [index: string]: string;
12
+ }): Promise<any>;
13
+ getFileUrlsByHashes(resourceHashes: string[]): Promise<any[]>;
14
+ uploadFile(url: string, file: File, headers: {
15
+ [index: string]: string;
16
+ }, onProgress: OnProgress, options?: {
17
+ thumbnail?: boolean;
18
+ }): Promise<string>;
19
+ uploadResource(file: File, onProgress?: OnProgress, options?: {
20
+ thumbnail?: boolean;
21
+ }): Promise<string>;
22
+ getResourceId(url: string): string;
23
+ buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
24
+ }
@@ -11,6 +11,9 @@ export default class ShareDBClient {
11
11
  private reauthFunc?;
12
12
  clientId: string;
13
13
  constructor(auth: AuthMessage, serverUrl: string, reauthFunc?: ReauthFunc);
14
+ token(): string;
15
+ resourceToken(): string;
16
+ docId(): string;
14
17
  editorServer(): string;
15
18
  close(logout: boolean): void;
16
19
  on(event: 'open' | 'close' | 'error', callback: (event: Event | Error) => void): void;
@@ -52,7 +55,7 @@ export default class ShareDBClient {
52
55
  revertVersion(ver: number): Promise<void>;
53
56
  createVersion(tag: string, publish: boolean): Promise<any>;
54
57
  recognizeLink(url: string): Promise<LinkDetails>;
55
- private getResourceId;
58
+ getResourceId(url: string): string;
56
59
  buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
57
60
  reAuth(auto?: boolean): void;
58
61
  }
@@ -0,0 +1,17 @@
1
+ import { DocObject, LocalDoc, OnesEditorUser, UploadResourceOptions, UploadResourceResult } from '../../../../@ones-editor/core';
2
+ export interface ShareDBLocalDocOptions {
3
+ serverUrl: string;
4
+ token: string;
5
+ resourceToken?: string;
6
+ user: OnesEditorUser;
7
+ docId: string;
8
+ }
9
+ export default class ShareDBLocalDoc extends LocalDoc {
10
+ private _options;
11
+ private _client;
12
+ constructor(docObject: DocObject, _options: ShareDBLocalDocOptions);
13
+ buildResourceUrl(src: string): string;
14
+ getUser(): OnesEditorUser;
15
+ request<T>(url: string, opt?: any): Promise<T>;
16
+ uploadResource(file: File, options?: UploadResourceOptions | undefined): Promise<UploadResourceResult>;
17
+ }
@@ -1,7 +1,11 @@
1
1
  import axios from 'axios';
2
2
  import ShareDBDoc from './doc/sharedb-doc';
3
3
  import { RemoteCarets, RemoteCaretsDecorator } from './remote-carets';
4
- export { ShareDBDoc, RemoteCarets, RemoteCaretsDecorator };
4
+ import ShareDBClientBase from './doc/sharedb-client-base';
5
+ import ShareDBLocalDoc from './doc/sharedb-local-doc';
6
+ import type { ShareDBLocalDocOptions } from './doc/sharedb-local-doc';
7
+ export { ShareDBDoc, RemoteCarets, RemoteCaretsDecorator, ShareDBClientBase, ShareDBLocalDoc };
8
+ export type { ShareDBLocalDocOptions };
5
9
  export * from './doc/comments';
6
10
  export * from './types';
7
11
  export * from './versions';