@ones-editor/editor 0.0.3-beta.33 → 0.0.3-beta.37
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 +1 -0
- package/@ones-editor/comments/src/comments-list/group-item.d.ts +1 -0
- package/@ones-editor/comments/src/types.d.ts +0 -2
- package/@ones-editor/core/src/core/doc/doc.d.ts +6 -2
- 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-doc/editor-doc.d.ts +4 -3
- package/@ones-editor/core/src/core/selection/editor-selection.d.ts +2 -2
- package/@ones-editor/core/src/core/types.d.ts +9 -6
- package/@ones-editor/core/src/i18n/i18n.d.ts +36 -0
- package/@ones-editor/core/src/utils/logger/index.d.ts +1 -0
- package/@ones-editor/image-embed/src/empty-image-converter.d.ts +5 -0
- package/@ones-editor/image-embed/src/index.d.ts +2 -1
- 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/input-handlers/src/markdown-shortcuts/table-converter.d.ts +2 -0
- package/@ones-editor/mathjax/package.json +3 -0
- package/@ones-editor/mathjax/src/index.d.ts +2 -1
- package/@ones-editor/mathjax/src/mathjax-box/convert-mathjax.d.ts +5 -0
- package/@ones-editor/mathjax/src/mathjax-box/mathjax-editor.d.ts +2 -2
- 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 +6 -1
- package/@ones-editor/sharedb-doc/src/index.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/types.d.ts +3 -2
- package/@ones-editor/templates/src/templates/select-template.d.ts +0 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/tooltips/index.d.ts +4 -0
- package/@ones-editor/ui-base/src/auto-suggest/should-focus-to-editor.d.ts +2 -0
- 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/comments/create-comment-editor.d.ts +4 -7
- package/dist/comments/local-doc-comments-provider.d.ts +18 -0
- package/dist/comments/{comments-provider.d.ts → sharedb-doc-comments-provider.d.ts} +3 -6
- package/dist/index.d.ts +7 -4
- package/dist/index.js +138 -221
- 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 +11 -2
- package/package.json +1 -1
|
@@ -33,6 +33,7 @@ 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;
|
|
36
37
|
edit(): void;
|
|
37
38
|
destroy(): void;
|
|
38
39
|
private handleResize;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DocObject, LocalDoc, OnesEditor, OnesEditorComment } from '../../../@ones-editor/core';
|
|
2
|
-
import { AuthMessage } from '../../../@ones-editor/sharedb-doc';
|
|
3
2
|
export type CommentData = {
|
|
4
3
|
[p in string]: unknown;
|
|
5
4
|
};
|
|
@@ -24,7 +23,6 @@ export interface OnesEditorCommentsEvents {
|
|
|
24
23
|
onUpdateComment: (commentId: string, local: boolean) => void;
|
|
25
24
|
}
|
|
26
25
|
export interface OnesEditorCommentsProvider {
|
|
27
|
-
getAuth: () => AuthMessage;
|
|
28
26
|
getComments: () => OnesEditorComment[];
|
|
29
27
|
getComment: (id: string) => OnesEditorComment;
|
|
30
28
|
getCommentDoc: (commentId: string) => DocObject;
|
|
@@ -179,15 +179,19 @@ 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;
|
|
182
186
|
export interface OnesEditorDoc {
|
|
183
187
|
registerCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
184
188
|
unregisterCallback: (callbacks: OnesEditorDocCallbacks) => void;
|
|
185
189
|
toJSON: () => DocObject;
|
|
186
190
|
getContainerBlocks: (containerId: string) => DocBlock[];
|
|
187
191
|
getBlockData: (containerId: string, blockIndex: number) => DocBlock;
|
|
188
|
-
localUpdateBlockText: (containerId: string, blockIndex: number, actions: DocBlockTextActions) => DocBlockText;
|
|
192
|
+
localUpdateBlockText: (containerId: string, blockIndex: number, actions: DocBlockTextActions, options?: UpdateBlockOptions) => DocBlockText;
|
|
189
193
|
localUpdateBlockData: (containerId: string, blockIndex: number, delta: DocBlockDelta, newRange: OnesEditorDocRange) => DocBlock;
|
|
190
|
-
localInsertBlock: (containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange) => DocBlock;
|
|
194
|
+
localInsertBlock: (containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange, options?: InsertBlockOptions) => DocBlock;
|
|
191
195
|
localDeleteBlock: (containerId: string, blockIndex: number, newRange: OnesEditorDocRange) => DocBlock;
|
|
192
196
|
localInsertChildContainer: (containerId: string, blocks: DocBlock[]) => void;
|
|
193
197
|
localDeleteChildContainers: (containerIds: string[]) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DocBlock, OnesEditorDocRange } from '../../doc';
|
|
1
|
+
import { InsertBlockOptions, 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): import("../../types").BlockElement;
|
|
3
|
+
export declare function editorAutoInsertBlock(editor: OnesEditor, blockData: DocBlock, containerId?: string, blockIndex?: number, newRange?: OnesEditorDocRange, insertBlockOptions?: InsertBlockOptions): import("../../types").BlockElement;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement } from '../../types';
|
|
2
|
-
export declare function editorDeleteBlockText(editor: OnesEditor, block: BlockElement, offset: number, count: number): number;
|
|
1
|
+
import { OnesEditor, BlockElement, InsertTextOptions } from '../../types';
|
|
2
|
+
export declare function editorDeleteBlockText(editor: OnesEditor, block: BlockElement, offset: number, count: number, options?: InsertTextOptions): number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DocBlock, OnesEditorDocRange } from '../../doc';
|
|
1
|
+
import { DocBlock, InsertBlockOptions, 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): BlockElement;
|
|
3
|
+
export declare function editorInsertBlock(editor: OnesEditor, containerId: string, blockIndex: number, blockData: DocBlock, newRange: OnesEditorDocRange, options?: InsertBlockOptions): BlockElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement } from '../../types';
|
|
1
|
+
import { OnesEditor, BlockElement, InsertTextOptions } from '../../types';
|
|
2
2
|
import { DocBlockText, DocBox } from '../../doc';
|
|
3
|
-
export declare function editorInsertTextToBlock(editor: OnesEditor, block: BlockElement, offset: number, text: string | DocBlockText): DocBlockText;
|
|
3
|
+
export declare function editorInsertTextToBlock(editor: OnesEditor, block: BlockElement, offset: number, text: string | DocBlockText, options?: InsertTextOptions): 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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorDocLocalActionCallbacks, OnesEditor } from '../types';
|
|
2
|
-
import { BuildResourceUrlOptions, DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorDocRange, OnesEditorDocServerMeta, OnesEditorDocStatus, UploadResourceOptions, UploadResourceResult } from '../doc';
|
|
2
|
+
import { BuildResourceUrlOptions, InsertBlockOptions, DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorDocRange, OnesEditorDocServerMeta, OnesEditorDocStatus, UploadResourceOptions, UploadResourceResult, UpdateBlockOptions } 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): DocBlockText;
|
|
16
|
+
localUpdateBlockText(containerId: string, blockIndex: number, actions: DocBlockTextActions, options?: UpdateBlockOptions): DocBlockText;
|
|
17
17
|
localUpdateBlockData(containerId: string, blockIndex: number, delta: DocBlockDelta, newRange: OnesEditorDocRange): DocBlock;
|
|
18
|
-
localInsertBlock(containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange): DocBlock;
|
|
18
|
+
localInsertBlock(containerId: string, blockIndex: number, data: DocBlock, newRange: OnesEditorDocRange, options?: InsertBlockOptions): 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,4 +38,5 @@ 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;
|
|
41
42
|
}
|
|
@@ -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, DeleteBlockEventOptions, ChangeSelectionOptions } 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): SelectionRange;
|
|
19
|
+
setRange(range: SelectionRange, options?: ChangeSelectionOptions): 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, OnesEditorDoc, OnesEditorDocRange } from './doc';
|
|
2
|
+
import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange } from './doc';
|
|
3
3
|
export type ContainerElement = HTMLDivElement & {
|
|
4
4
|
__neverUse: 'ContainerElement';
|
|
5
5
|
};
|
|
@@ -349,7 +349,7 @@ export interface BreakTextOptions {
|
|
|
349
349
|
copyBlockAttributes?: boolean;
|
|
350
350
|
}
|
|
351
351
|
export interface OnesEditorEvents {
|
|
352
|
-
'docChanged': (editor: OnesEditor) => void;
|
|
352
|
+
'docChanged': (editor: OnesEditor, local: boolean) => void;
|
|
353
353
|
'readonlyChanged': (editor: OnesEditor) => void;
|
|
354
354
|
'selectionChanged': (editor: OnesEditor) => void;
|
|
355
355
|
'focusBlockChanged': (editor: OnesEditor, newBlock: BlockElement | null, oldBlock: BlockElement | null) => void;
|
|
@@ -428,6 +428,7 @@ export interface OnesEditorDomEvents extends OnesEditorCustom {
|
|
|
428
428
|
removeEventListener: (element: Element | Document | Window | null, eventName: string | null, eventHandler: (editor: OnesEditor, event: Event) => void) => void;
|
|
429
429
|
removeAllListeners: (element: Element | Document | Window, eventName?: string) => void;
|
|
430
430
|
}
|
|
431
|
+
export type InsertTextOptions = InsertBlockOptions;
|
|
431
432
|
export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
432
433
|
readonly parent: HTMLElement;
|
|
433
434
|
readonly rootElement: HTMLDivElement;
|
|
@@ -492,7 +493,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
492
493
|
contains: (node: Node) => boolean;
|
|
493
494
|
getSelectedText: () => string;
|
|
494
495
|
clearSelectedContents: () => void;
|
|
495
|
-
insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange) => BlockElement;
|
|
496
|
+
insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange, options?: InsertBlockOptions) => BlockElement;
|
|
496
497
|
insertEmbed: (containerId: string, blockIndex: number, embedType: string, embedData: DocEmbedData, newRange?: OnesEditorDocRange) => BlockElement;
|
|
497
498
|
deleteBlock: (block: BlockElement, newRange?: OnesEditorDocRange) => void;
|
|
498
499
|
getTextPosition: () => BlockTextPosition;
|
|
@@ -503,8 +504,8 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
503
504
|
getBlockText: (block: BlockElement) => DocBlockText;
|
|
504
505
|
setBlockText: (block: BlockElement, text: DocBlockText) => void;
|
|
505
506
|
getBoxData: (box: BoxElement) => DocBox;
|
|
506
|
-
deleteTextFromBlock: (block: BlockElement, offset: number, count: number) => number;
|
|
507
|
-
insertTextToBlock: (block: BlockElement, offset: number, text: string | DocBlockText) => DocBlockText;
|
|
507
|
+
deleteTextFromBlock: (block: BlockElement, offset: number, count: number, options?: InsertTextOptions) => number;
|
|
508
|
+
insertTextToBlock: (block: BlockElement, offset: number, text: string | DocBlockText, options?: InsertTextOptions) => DocBlockText;
|
|
508
509
|
insertBoxToBlock: (block: BlockElement, offset: number, boxData: DocBox) => DocBlockText;
|
|
509
510
|
mergeTextBlock: (block1: BlockElement, block2: BlockElement, options?: {
|
|
510
511
|
focus?: boolean;
|
|
@@ -512,6 +513,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
512
513
|
breakTextBlock: (block: BlockElement, offset: number, options?: BreakTextOptions) => BlockElement;
|
|
513
514
|
insertTextBlock: (text?: string | DocBlockText, containerId?: string, blockIndex?: number, options?: {
|
|
514
515
|
newRange?: OnesEditorDocRange;
|
|
516
|
+
insertBlockOptions?: InsertBlockOptions;
|
|
515
517
|
}) => BlockElement;
|
|
516
518
|
insertDoc: (block: BlockElement, offset: number, doc: DocObject, cloneDocResult?: CloneBlockResultInfo) => void;
|
|
517
519
|
insertDocAt: (container: ContainerElement, blockIndex: number, doc: DocObject, cloneDocResult?: CloneBlockResultInfo) => BlockElement[];
|
|
@@ -533,7 +535,7 @@ export interface OnesEditorSelection {
|
|
|
533
535
|
readonly startBlock: BlockElement;
|
|
534
536
|
readonly endBlock: BlockElement;
|
|
535
537
|
setSelection: (anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions) => SelectionRange;
|
|
536
|
-
setRange: (range: SelectionRange) => SelectionRange;
|
|
538
|
+
setRange: (range: SelectionRange, options?: ChangeSelectionOptions) => SelectionRange;
|
|
537
539
|
selectBlock: (block: BlockElement, start: number, end?: number) => void;
|
|
538
540
|
updateSelection: (old: SelectionRange | null) => void;
|
|
539
541
|
updateLastCaretRect: () => void;
|
|
@@ -592,6 +594,7 @@ export interface OnesEditorBlocks {
|
|
|
592
594
|
getBlockClass: (type: string) => Block;
|
|
593
595
|
createBlock: (path: BlockPath, container: ContainerElement, block: DocBlock) => BlockElement;
|
|
594
596
|
forEach: (callback: (blockClass: Block) => void) => void;
|
|
597
|
+
hasBlock: (type: string) => boolean;
|
|
595
598
|
}
|
|
596
599
|
export interface OnesEditorEmbeds {
|
|
597
600
|
registerEmbedClass: (embedClass: Embed) => 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 {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OnesEditor, OnesEditorInputHandler } from '../../../@ones-editor/core';
|
|
2
|
+
declare class EmptyImageConverterInputHandler implements OnesEditorInputHandler {
|
|
3
|
+
handleAfterInsertText(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string): boolean;
|
|
4
|
+
}
|
|
5
|
+
export default EmptyImageConverterInputHandler;
|
|
@@ -2,8 +2,9 @@ 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';
|
|
5
6
|
export * from './shortcuts';
|
|
6
7
|
export * from './types';
|
|
7
8
|
export { ImageObject };
|
|
8
9
|
declare const ImageEmbed: Embed;
|
|
9
|
-
export { ImageEmbed };
|
|
10
|
+
export { ImageEmbed, EmptyImageConverterInputHandler };
|
|
@@ -3,4 +3,5 @@ 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
|
-
|
|
6
|
+
import ConvertEmptyMathjaxBoxInputHandler from './mathjax-box/convert-mathjax';
|
|
7
|
+
export { MathjaxBox, MathjaxEmbed, createEmptyMathjaxBox, editMathjaxBox, ConvertEmptyMathjaxBoxInputHandler, };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OnesEditor, OnesEditorInputHandler } from '../../../../@ones-editor/core';
|
|
2
|
+
declare class ConvertEmptyMathjaxBoxInputHandler implements OnesEditorInputHandler {
|
|
3
|
+
handleAfterInsertText(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string): boolean;
|
|
4
|
+
}
|
|
5
|
+
export default ConvertEmptyMathjaxBoxInputHandler;
|
|
@@ -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 OnEditChange = (tex: string) => void;
|
|
3
|
+
export declare function editMathjax(editor: OnesEditor, elem: HTMLElement, tex: string, onChange: OnEditChange): 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,13 +11,18 @@ 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
|
+
destroyed: boolean;
|
|
16
|
+
constructor(client: ShareDBClient, doc: Doc, disableLogout?: boolean);
|
|
15
17
|
beginBatchUpdate(): number;
|
|
16
18
|
endBatchUpdate(): number;
|
|
17
19
|
static load(options: ShareDBDocOptions): Promise<ShareDBDoc>;
|
|
18
20
|
private handleNothingPending;
|
|
19
21
|
private handleCreate;
|
|
20
22
|
private handleDel;
|
|
23
|
+
private handleReload;
|
|
24
|
+
private handleReset;
|
|
25
|
+
private handleWriteConflictError;
|
|
21
26
|
private setStatus;
|
|
22
27
|
initEvents(): void;
|
|
23
28
|
clearEvents(): void;
|
|
@@ -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;
|