@ones-editor/editor 0.0.3-beta.32 → 0.0.3-beta.33
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/comments/src/comment-item/comment-item.d.ts +0 -1
- package/@ones-editor/comments/src/comments/comments.d.ts +2 -2
- package/@ones-editor/comments/src/comments-list/comments-list.d.ts +2 -2
- package/@ones-editor/comments/src/comments-list/group-item.d.ts +0 -1
- package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +1 -1
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts +2 -2
- package/@ones-editor/comments/src/types.d.ts +5 -4
- package/@ones-editor/core/src/core/doc/doc.d.ts +2 -6
- package/@ones-editor/core/src/core/editor/actions/auto-insert-block.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/actions/delete-block-text.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/actions/insert-block.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/actions/insert-text.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/editor-dom/dom-events.d.ts +1 -1
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +3 -4
- package/@ones-editor/core/src/core/selection/editor-selection.d.ts +2 -2
- package/@ones-editor/core/src/core/types.d.ts +7 -9
- package/@ones-editor/core/src/i18n/i18n.d.ts +0 -36
- package/@ones-editor/core/src/local-doc/index.d.ts +6 -2
- package/@ones-editor/core/src/utils/logger/index.d.ts +0 -1
- package/@ones-editor/image-embed/src/index.d.ts +1 -2
- package/@ones-editor/input-handlers/src/enforce-with-document-title/types.d.ts +0 -1
- package/@ones-editor/input-handlers/src/i18n/en-us.d.ts +0 -1
- package/@ones-editor/input-handlers/src/i18n/zh-cn.d.ts +0 -1
- package/@ones-editor/mathjax/package.json +0 -3
- package/@ones-editor/mathjax/src/index.d.ts +1 -2
- package/@ones-editor/mathjax/src/mathjax-box/mathjax-editor.d.ts +2 -2
- package/@ones-editor/scroll-container/src/index.d.ts +18 -6
- 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 +1 -6
- package/@ones-editor/sharedb-doc/src/index.d.ts +0 -1
- package/@ones-editor/sharedb-doc/src/types.d.ts +2 -3
- package/@ones-editor/templates/src/templates/select-template.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/tooltips/index.d.ts +0 -4
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +0 -1
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +0 -5
- package/@ones-editor/ui-base/src/dialog/index.d.ts +0 -1
- package/@ones-editor/versions/src/types.d.ts +0 -1
- package/@ones-editor/versions/src/version-dialog/index.d.ts +1 -3
- package/dist/comments/{sharedb-doc-comments-provider.d.ts → comments-provider.d.ts} +6 -3
- package/dist/comments/create-comment-editor.d.ts +7 -4
- package/dist/index.d.ts +5 -6
- package/dist/index.js +160 -158
- package/dist/types.d.ts +3 -11
- package/package.json +1 -1
- package/@ones-editor/image-embed/src/empty-image-converter.d.ts +0 -5
- package/@ones-editor/input-handlers/src/markdown-shortcuts/table-converter.d.ts +0 -2
- package/@ones-editor/mathjax/src/mathjax-box/convert-mathjax.d.ts +0 -5
- package/@ones-editor/ui-base/src/auto-suggest/should-focus-to-editor.d.ts +0 -2
- package/@ones-editor/ui-base/src/dialog/types.d.ts +0 -4
- package/dist/comments/local-doc-comments-provider.d.ts +0 -18
- package/dist/lang/en-us.d.ts +0 -13
- package/dist/lang/index.d.ts +0 -1
- package/dist/lang/zh-cn.d.ts +0 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
-
import {
|
|
2
|
+
import { OnesEditorCommentsProvider } from '../types';
|
|
3
3
|
export default class OnesEditorComments {
|
|
4
4
|
private editor;
|
|
5
5
|
private provider;
|
|
@@ -10,10 +10,10 @@ export default class OnesEditorComments {
|
|
|
10
10
|
private get commentOptions();
|
|
11
11
|
get commentProvider(): OnesEditorCommentsProvider;
|
|
12
12
|
get isMobile(): boolean;
|
|
13
|
+
private getCommentRoot;
|
|
13
14
|
destroy(): void;
|
|
14
15
|
private showComment;
|
|
15
16
|
showCommentList: (groupId?: string) => void;
|
|
16
|
-
mount(containers: CommentRoot): void;
|
|
17
17
|
private handleCommentListClose;
|
|
18
18
|
private handleOnSelectComment;
|
|
19
19
|
private handleMiniCommentItemClick;
|
|
@@ -8,10 +8,10 @@ interface CommentsListEvents {
|
|
|
8
8
|
export default class CommentsList extends TypedEmitter<CommentsListEvents> implements OnesEditorCommentsEvents {
|
|
9
9
|
private editor;
|
|
10
10
|
private commentsProvider;
|
|
11
|
-
root
|
|
11
|
+
private root;
|
|
12
12
|
private groupsContainer;
|
|
13
13
|
private list;
|
|
14
|
-
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider);
|
|
14
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement);
|
|
15
15
|
private get commentOptions();
|
|
16
16
|
destroy(): void;
|
|
17
17
|
onCreateComment(commentId: string, local: boolean): void;
|
|
@@ -33,7 +33,6 @@ export declare class CommentGroupItem extends TypedEmitter<CommentGroupItemEvent
|
|
|
33
33
|
handleUpdateChildComment(comment: OnesEditorComment): void;
|
|
34
34
|
handleUpdateMainComment(comment: OnesEditorComment): void;
|
|
35
35
|
deleteMainComment(commentId: OnesEditorComment['id']): void;
|
|
36
|
-
handleReadonlyChanged: (editor: OnesEditor) => void;
|
|
37
36
|
edit(): void;
|
|
38
37
|
destroy(): void;
|
|
39
38
|
private handleResize;
|
|
@@ -11,7 +11,7 @@ export declare class MiniCommentsList extends TypedEmitter<MiniCommentsListEvent
|
|
|
11
11
|
private commentsProvider;
|
|
12
12
|
list: MiniGroupList;
|
|
13
13
|
root: HTMLElement;
|
|
14
|
-
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider);
|
|
14
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement);
|
|
15
15
|
onCreateComment(commentId: string, local: boolean): void;
|
|
16
16
|
onDeleteComment(commentId: string, local: boolean): void;
|
|
17
17
|
onUpdateComment(commentId: string, local: boolean): void;
|
package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts
CHANGED
|
@@ -7,11 +7,11 @@ interface MobileCommentsListEvents {
|
|
|
7
7
|
export declare class MobileCommentsList extends TypedEmitter<MobileCommentsListEvents> implements OnesEditorCommentsEvents {
|
|
8
8
|
private editor;
|
|
9
9
|
private commentsProvider;
|
|
10
|
-
root
|
|
10
|
+
private root;
|
|
11
11
|
private list;
|
|
12
12
|
private mask;
|
|
13
13
|
private pullInfoContainer;
|
|
14
|
-
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider);
|
|
14
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement);
|
|
15
15
|
onCreateComment(commentId: string, local: boolean): void;
|
|
16
16
|
onDeleteComment(commentId: string, local: boolean): void;
|
|
17
17
|
onUpdateComment(commentId: string, local: boolean): void;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { DocObject, LocalDoc, OnesEditor, OnesEditorComment } from '../../../@ones-editor/core';
|
|
2
|
+
import { AuthMessage } from '../../../@ones-editor/sharedb-doc';
|
|
2
3
|
export type CommentData = {
|
|
3
4
|
[p in string]: unknown;
|
|
4
5
|
};
|
|
5
6
|
export interface OnesEditorCommentController {
|
|
6
7
|
showCommentList: () => void;
|
|
7
8
|
}
|
|
8
|
-
export type
|
|
9
|
+
export type CommentRootType = keyof Pick<OnesEditorCommentOptions, 'container' | 'miniContainer' | 'mobileContainer'>;
|
|
10
|
+
export interface OnesEditorCommentOptions {
|
|
11
|
+
controller: OnesEditorCommentController;
|
|
9
12
|
container?: HTMLElement;
|
|
10
13
|
miniContainer?: HTMLElement;
|
|
11
14
|
mobileContainer?: HTMLElement;
|
|
12
|
-
};
|
|
13
|
-
export interface OnesEditorCommentOptions {
|
|
14
|
-
controller: OnesEditorCommentController;
|
|
15
15
|
disableReply?: boolean;
|
|
16
16
|
disableEdit?: boolean;
|
|
17
17
|
pullThreshold?: number;
|
|
@@ -24,6 +24,7 @@ export interface OnesEditorCommentsEvents {
|
|
|
24
24
|
onUpdateComment: (commentId: string, local: boolean) => void;
|
|
25
25
|
}
|
|
26
26
|
export interface OnesEditorCommentsProvider {
|
|
27
|
+
getAuth: () => AuthMessage;
|
|
27
28
|
getComments: () => OnesEditorComment[];
|
|
28
29
|
getComment: (id: string) => OnesEditorComment;
|
|
29
30
|
getCommentDoc: (commentId: string) => DocObject;
|
|
@@ -179,19 +179,15 @@ export interface RecognizeLinkResult {
|
|
|
179
179
|
providerName?: string;
|
|
180
180
|
url: string;
|
|
181
181
|
}
|
|
182
|
-
export interface InsertBlockOptions {
|
|
183
|
-
noScroll?: boolean;
|
|
184
|
-
}
|
|
185
|
-
export type UpdateBlockOptions = InsertBlockOptions;
|
|
186
182
|
export interface OnesEditorDoc {
|
|
187
183
|
registerCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
188
184
|
unregisterCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
189
185
|
toJSON: () => DocObject;
|
|
190
186
|
getContainerBlocks: (containerId: string) => DocBlock[];
|
|
191
187
|
getBlockData: (containerId: string, blockIndex: number) => DocBlock;
|
|
192
|
-
localUpdateBlockText: (containerId: string, blockIndex: number, actions: DocBlockTextActions
|
|
188
|
+
localUpdateBlockText: (containerId: string, blockIndex: number, actions: DocBlockTextActions) => DocBlockText;
|
|
193
189
|
localUpdateBlockData: (containerId: string, blockIndex: number, delta: DocBlockDelta, newRange: OnesEditorDocRange) => DocBlock;
|
|
194
|
-
localInsertBlock: (containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange
|
|
190
|
+
localInsertBlock: (containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange) => DocBlock;
|
|
195
191
|
localDeleteBlock: (containerId: string, blockIndex: number, newRange: OnesEditorDocRange) => DocBlock;
|
|
196
192
|
localInsertChildContainer: (containerId: string, blocks: DocBlock[]) => void;
|
|
197
193
|
localDeleteChildContainers: (containerIds: string[]) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DocBlock, OnesEditorDocRange } from '../../doc';
|
|
2
2
|
import { OnesEditor } from '../../types';
|
|
3
|
-
export declare function editorAutoInsertBlock(editor: OnesEditor, blockData: DocBlock, containerId?: string, blockIndex?: number, newRange?: OnesEditorDocRange
|
|
3
|
+
export declare function editorAutoInsertBlock(editor: OnesEditor, blockData: DocBlock, containerId?: string, blockIndex?: number, newRange?: OnesEditorDocRange): import("../../types").BlockElement;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement
|
|
2
|
-
export declare function editorDeleteBlockText(editor: OnesEditor, block: BlockElement, offset: number, count: number
|
|
1
|
+
import { OnesEditor, BlockElement } from '../../types';
|
|
2
|
+
export declare function editorDeleteBlockText(editor: OnesEditor, block: BlockElement, offset: number, count: number): number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DocBlock,
|
|
1
|
+
import { DocBlock, OnesEditorDocRange } from '../../doc';
|
|
2
2
|
import { OnesEditor, BlockElement } from '../../types';
|
|
3
|
-
export declare function editorInsertBlock(editor: OnesEditor, containerId: string, blockIndex: number, blockData: DocBlock, newRange: OnesEditorDocRange
|
|
3
|
+
export declare function editorInsertBlock(editor: OnesEditor, containerId: string, blockIndex: number, blockData: DocBlock, newRange: OnesEditorDocRange): BlockElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement
|
|
1
|
+
import { OnesEditor, BlockElement } from '../../types';
|
|
2
2
|
import { DocBlockText, DocBox } from '../../doc';
|
|
3
|
-
export declare function editorInsertTextToBlock(editor: OnesEditor, block: BlockElement, offset: number, text: string | DocBlockText
|
|
3
|
+
export declare function editorInsertTextToBlock(editor: OnesEditor, block: BlockElement, offset: number, text: string | DocBlockText): DocBlockText;
|
|
4
4
|
export declare function editorInsertBoxToBlock(editor: OnesEditor, block: BlockElement, offset: number, boxData: DocBox): DocBlockText;
|
|
5
5
|
export declare function editorInsertTextToBlockEx(editor: OnesEditor, text: string | DocBlockText, containerId: string, blockIndex: number, offset: number): DocBlockText;
|
|
6
6
|
export declare function editorInsertText(editor: OnesEditor, text: string | DocBlockText): void;
|
|
@@ -12,7 +12,7 @@ declare class DomEventHandler {
|
|
|
12
12
|
}
|
|
13
13
|
export declare class EditorDomEvents {
|
|
14
14
|
private editor;
|
|
15
|
-
handlers: Map<
|
|
15
|
+
handlers: Map<Document | Element | Window, DomEventHandler[]>;
|
|
16
16
|
constructor(editor: OnesEditor);
|
|
17
17
|
destroy(): void;
|
|
18
18
|
addEventListener<T = Event>(element: Element | Document | Window, eventName: string, eventHandler: DomEventCallback<T>, data?: unknown): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorDocLocalActionCallbacks, OnesEditor } from '../types';
|
|
2
|
-
import { BuildResourceUrlOptions,
|
|
2
|
+
import { BuildResourceUrlOptions, DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorDocRange, OnesEditorDocServerMeta, OnesEditorDocStatus, UploadResourceOptions, UploadResourceResult } from '../doc';
|
|
3
3
|
import { EventCallbacks } from '../../utils';
|
|
4
4
|
export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> implements OnesEditorDoc, OnesEditorDocCallbacks {
|
|
5
5
|
private editor;
|
|
@@ -13,9 +13,9 @@ export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> im
|
|
|
13
13
|
getVersionHelper(): import("../doc").OnesEditorDocVersionHelper | undefined;
|
|
14
14
|
getContainerBlocks(containerId: string): DocBlock[];
|
|
15
15
|
getBlockData(containerId: string, blockIndex: number): DocBlock;
|
|
16
|
-
localUpdateBlockText(containerId: string, blockIndex: number, actions: DocBlockTextActions
|
|
16
|
+
localUpdateBlockText(containerId: string, blockIndex: number, actions: DocBlockTextActions): DocBlockText;
|
|
17
17
|
localUpdateBlockData(containerId: string, blockIndex: number, delta: DocBlockDelta, newRange: OnesEditorDocRange): DocBlock;
|
|
18
|
-
localInsertBlock(containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange
|
|
18
|
+
localInsertBlock(containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange): DocBlock;
|
|
19
19
|
localDeleteBlock(containerId: string, blockIndex: number, newRange: OnesEditorDocRange): DocBlock;
|
|
20
20
|
localDeleteChildContainers(containerIds: string[]): void;
|
|
21
21
|
localInsertChildContainer(containerId: string, blocks: DocBlock[]): void;
|
|
@@ -38,5 +38,4 @@ export default class EditorDoc extends EventCallbacks<OnesEditorDocCallbacks> im
|
|
|
38
38
|
getRemoteUsers(): import("../doc").OnesEditorRemoteUsers;
|
|
39
39
|
destroy(): void;
|
|
40
40
|
getServerMeta(): OnesEditorDocServerMeta;
|
|
41
|
-
reset(doc: OnesEditorDoc): void;
|
|
42
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorCaret } from '../blocks/text-blocks/caret/editor-caret';
|
|
2
|
-
import { OnesEditorSelection, BlockElement, BlockPosition, SelectionRange, OnesEditor,
|
|
2
|
+
import { OnesEditorSelection, BlockElement, BlockPosition, SelectionRange, OnesEditor, ChangeSelectionOptions, DeleteBlockEventOptions } from '../types';
|
|
3
3
|
export declare class EditorSelection implements OnesEditorSelection {
|
|
4
4
|
readonly editor: OnesEditor;
|
|
5
5
|
readonly caret: EditorCaret;
|
|
@@ -16,7 +16,7 @@ export declare class EditorSelection implements OnesEditorSelection {
|
|
|
16
16
|
getEndBlock(): BlockElement;
|
|
17
17
|
selectBlock(block: BlockElement, start: number, end?: number): void;
|
|
18
18
|
setSelection(anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions): SelectionRange;
|
|
19
|
-
setRange(range: SelectionRange
|
|
19
|
+
setRange(range: SelectionRange): SelectionRange;
|
|
20
20
|
updateSelection(): void;
|
|
21
21
|
getFocusedPos(): BlockPosition;
|
|
22
22
|
getAnchorPos(): BlockPosition;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject,
|
|
2
|
+
import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, OnesEditorDoc, OnesEditorDocRange } from './doc';
|
|
3
3
|
export type ContainerElement = HTMLDivElement & {
|
|
4
4
|
__neverUse: 'ContainerElement';
|
|
5
5
|
};
|
|
@@ -94,6 +94,7 @@ export interface Embed {
|
|
|
94
94
|
offset: number;
|
|
95
95
|
data?: DocBlockAttributes;
|
|
96
96
|
}) => ConvertBlockResult | null;
|
|
97
|
+
notify?: (editor: OnesEditor, command: string, params?: unknown) => void;
|
|
97
98
|
}
|
|
98
99
|
export interface ConvertBlockResult {
|
|
99
100
|
blockData: DocBlock;
|
|
@@ -348,7 +349,7 @@ export interface BreakTextOptions {
|
|
|
348
349
|
copyBlockAttributes?: boolean;
|
|
349
350
|
}
|
|
350
351
|
export interface OnesEditorEvents {
|
|
351
|
-
'docChanged': (editor: OnesEditor
|
|
352
|
+
'docChanged': (editor: OnesEditor) => void;
|
|
352
353
|
'readonlyChanged': (editor: OnesEditor) => void;
|
|
353
354
|
'selectionChanged': (editor: OnesEditor) => void;
|
|
354
355
|
'focusBlockChanged': (editor: OnesEditor, newBlock: BlockElement | null, oldBlock: BlockElement | null) => void;
|
|
@@ -427,7 +428,6 @@ export interface OnesEditorDomEvents extends OnesEditorCustom {
|
|
|
427
428
|
removeEventListener: (element: Element | Document | Window | null, eventName: string | null, eventHandler: (editor: OnesEditor, event: Event) => void) => void;
|
|
428
429
|
removeAllListeners: (element: Element | Document | Window, eventName?: string) => void;
|
|
429
430
|
}
|
|
430
|
-
export type InsertTextOptions = InsertBlockOptions;
|
|
431
431
|
export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
432
432
|
readonly parent: HTMLElement;
|
|
433
433
|
readonly rootElement: HTMLDivElement;
|
|
@@ -492,7 +492,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
492
492
|
contains: (node: Node) => boolean;
|
|
493
493
|
getSelectedText: () => string;
|
|
494
494
|
clearSelectedContents: () => void;
|
|
495
|
-
insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange
|
|
495
|
+
insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange) => BlockElement;
|
|
496
496
|
insertEmbed: (containerId: string, blockIndex: number, embedType: string, embedData: DocEmbedData, newRange?: OnesEditorDocRange) => BlockElement;
|
|
497
497
|
deleteBlock: (block: BlockElement, newRange?: OnesEditorDocRange) => void;
|
|
498
498
|
getTextPosition: () => BlockTextPosition;
|
|
@@ -503,8 +503,8 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
503
503
|
getBlockText: (block: BlockElement) => DocBlockText;
|
|
504
504
|
setBlockText: (block: BlockElement, text: DocBlockText) => void;
|
|
505
505
|
getBoxData: (box: BoxElement) => DocBox;
|
|
506
|
-
deleteTextFromBlock: (block: BlockElement, offset: number, count: number
|
|
507
|
-
insertTextToBlock: (block: BlockElement, offset: number, text: string | DocBlockText
|
|
506
|
+
deleteTextFromBlock: (block: BlockElement, offset: number, count: number) => number;
|
|
507
|
+
insertTextToBlock: (block: BlockElement, offset: number, text: string | DocBlockText) => DocBlockText;
|
|
508
508
|
insertBoxToBlock: (block: BlockElement, offset: number, boxData: DocBox) => DocBlockText;
|
|
509
509
|
mergeTextBlock: (block1: BlockElement, block2: BlockElement, options?: {
|
|
510
510
|
focus?: boolean;
|
|
@@ -512,7 +512,6 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
512
512
|
breakTextBlock: (block: BlockElement, offset: number, options?: BreakTextOptions) => BlockElement;
|
|
513
513
|
insertTextBlock: (text?: string | DocBlockText, containerId?: string, blockIndex?: number, options?: {
|
|
514
514
|
newRange?: OnesEditorDocRange;
|
|
515
|
-
insertBlockOptions?: InsertBlockOptions;
|
|
516
515
|
}) => BlockElement;
|
|
517
516
|
insertDoc: (block: BlockElement, offset: number, doc: DocObject, cloneDocResult?: CloneBlockResultInfo) => void;
|
|
518
517
|
insertDocAt: (container: ContainerElement, blockIndex: number, doc: DocObject, cloneDocResult?: CloneBlockResultInfo) => BlockElement[];
|
|
@@ -534,7 +533,7 @@ export interface OnesEditorSelection {
|
|
|
534
533
|
readonly startBlock: BlockElement;
|
|
535
534
|
readonly endBlock: BlockElement;
|
|
536
535
|
setSelection: (anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions) => SelectionRange;
|
|
537
|
-
setRange: (range: SelectionRange
|
|
536
|
+
setRange: (range: SelectionRange) => SelectionRange;
|
|
538
537
|
selectBlock: (block: BlockElement, start: number, end?: number) => void;
|
|
539
538
|
updateSelection: (old: SelectionRange | null) => void;
|
|
540
539
|
updateLastCaretRect: () => void;
|
|
@@ -593,7 +592,6 @@ export interface OnesEditorBlocks {
|
|
|
593
592
|
getBlockClass: (type: string) => Block;
|
|
594
593
|
createBlock: (path: BlockPath, container: ContainerElement, block: DocBlock) => BlockElement;
|
|
595
594
|
forEach: (callback: (blockClass: Block) => void) => void;
|
|
596
|
-
hasBlock: (type: string) => boolean;
|
|
597
595
|
}
|
|
598
596
|
export interface OnesEditorEmbeds {
|
|
599
597
|
registerEmbedClass: (embedClass: Embed) => void;
|
|
@@ -1,39 +1,3 @@
|
|
|
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
|
-
};
|
|
35
1
|
export declare function setLang(lang?: string | null | undefined): void;
|
|
36
2
|
export declare function mergeLang(l: any): void;
|
|
37
3
|
export declare function t(key: string, args?: Record<string, string>): string;
|
|
38
|
-
export type LANGS = keyof typeof langs;
|
|
39
|
-
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorUser, UploadResourceOptions, UploadResourceResult } from '../core/doc';
|
|
1
|
+
import { DocBlock, DocBlockDelta, DocBlockText, OnesEditorDocServerMeta, 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
|
-
|
|
6
|
+
serviceUrl: string;
|
|
7
|
+
constructor(doc: DocObject | null, options?: {
|
|
8
|
+
serverUrl?: string;
|
|
9
|
+
});
|
|
7
10
|
beginBatchUpdate(): number;
|
|
8
11
|
endBatchUpdate(): number;
|
|
9
12
|
toJSON(): DocObject;
|
|
@@ -20,6 +23,7 @@ export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> imp
|
|
|
20
23
|
buildResourceUrl(src: string): string;
|
|
21
24
|
request<T>(url: string, opt?: any): Promise<T>;
|
|
22
25
|
broadcastMessage(data: unknown): void;
|
|
26
|
+
getServerMeta(): OnesEditorDocServerMeta;
|
|
23
27
|
getUser(): OnesEditorUser;
|
|
24
28
|
getRemoteUsers(): RemoteUsers;
|
|
25
29
|
setDoc(doc: DocObject): void;
|
|
@@ -2,9 +2,8 @@ import { Embed } from '../../../@ones-editor/core';
|
|
|
2
2
|
import { ImageObject } from './image-object';
|
|
3
3
|
import './image-embed-style.scss';
|
|
4
4
|
import './locale';
|
|
5
|
-
import EmptyImageConverterInputHandler from './empty-image-converter';
|
|
6
5
|
export * from './shortcuts';
|
|
7
6
|
export * from './types';
|
|
8
7
|
export { ImageObject };
|
|
9
8
|
declare const ImageEmbed: Embed;
|
|
10
|
-
export { ImageEmbed
|
|
9
|
+
export { ImageEmbed };
|
|
@@ -3,5 +3,4 @@ import { createEmptyMathjaxBox, editMathjaxBox } from './mathjax-box/mathjax-box
|
|
|
3
3
|
import MathjaxEmbed from './mathjax-embed';
|
|
4
4
|
import './mathjax-style.scss';
|
|
5
5
|
import './locale';
|
|
6
|
-
|
|
7
|
-
export { MathjaxBox, MathjaxEmbed, createEmptyMathjaxBox, editMathjaxBox, ConvertEmptyMathjaxBoxInputHandler, };
|
|
6
|
+
export { MathjaxBox, MathjaxEmbed, createEmptyMathjaxBox, editMathjaxBox, };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
-
export type
|
|
3
|
-
export declare function editMathjax(editor: OnesEditor, elem: HTMLElement, tex: string,
|
|
2
|
+
export type OnEditFinished = (tex: string) => void;
|
|
3
|
+
export declare function editMathjax(editor: OnesEditor, elem: HTMLElement, tex: string, onFinished: OnEditFinished): void;
|
|
@@ -5,15 +5,27 @@ 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
|
|
8
|
+
private options;
|
|
9
|
+
private scrollListener;
|
|
10
|
+
private scrollContainerElement;
|
|
11
|
+
constructor(options: ScrollContainerOptions);
|
|
11
12
|
get rootElement(): HTMLElement;
|
|
12
13
|
get contentElement(): HTMLElement;
|
|
13
|
-
get scrollOptions():
|
|
14
|
-
|
|
14
|
+
get scrollOptions(): {
|
|
15
|
+
safeRightSpace?: number | undefined;
|
|
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
|
+
};
|
|
15
27
|
private handleContainerScroll;
|
|
16
28
|
private handleBaseListenerDestroy;
|
|
17
29
|
destroy(): void;
|
|
18
30
|
}
|
|
19
|
-
export declare function createScrollContainer(): ScrollContainer;
|
|
31
|
+
export declare function createScrollContainer(options: ScrollContainerOptions): 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,18 +11,13 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
11
11
|
remoteCaretHandler: RemoteCaretsHandler;
|
|
12
12
|
batching: number;
|
|
13
13
|
status: OnesEditorDocStatus;
|
|
14
|
-
|
|
15
|
-
destroyed: boolean;
|
|
16
|
-
constructor(client: ShareDBClient, doc: Doc, disableLogout?: boolean);
|
|
14
|
+
constructor(client: ShareDBClient, doc: Doc);
|
|
17
15
|
beginBatchUpdate(): number;
|
|
18
16
|
endBatchUpdate(): number;
|
|
19
17
|
static load(options: ShareDBDocOptions): Promise<ShareDBDoc>;
|
|
20
18
|
private handleNothingPending;
|
|
21
19
|
private handleCreate;
|
|
22
20
|
private handleDel;
|
|
23
|
-
private handleReload;
|
|
24
|
-
private handleReset;
|
|
25
|
-
private handleWriteConflictError;
|
|
26
21
|
private setStatus;
|
|
27
22
|
initEvents(): void;
|
|
28
23
|
clearEvents(): void;
|
|
@@ -62,15 +62,14 @@ 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;
|
|
74
73
|
}
|
|
75
74
|
export interface EditorOp {
|
|
76
75
|
c: string;
|