@ones-editor/editor 1.1.3-bate.8 → 1.1.4-bate.28
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/child-block-tracker/src/event-tracker.d.ts +3 -1
- package/@ones-editor/context-menu/src/helper/actions.d.ts +1 -0
- package/@ones-editor/context-menu/src/helper/utils.d.ts +2 -0
- package/@ones-editor/core/package.json +1 -1
- package/@ones-editor/core/src/core/composition/clipboard/copy.d.ts +1 -1
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +22 -1
- package/@ones-editor/core/src/core/composition/index.d.ts +1 -1
- package/@ones-editor/core/src/core/containers/children.d.ts +1 -0
- package/@ones-editor/core/src/core/containers/root-container.d.ts +3 -0
- package/@ones-editor/core/src/core/input-handler/actions.d.ts +2 -0
- package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +5 -4
- package/@ones-editor/core/src/core/selection/editor-selection.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +2 -25
- package/@ones-editor/core/src/utils/dom-scroll.d.ts +1 -1
- package/@ones-editor/core/src/utils/index.d.ts +0 -1
- package/@ones-editor/drawio-embed/src/index.d.ts +0 -1
- package/@ones-editor/misc/src/index.d.ts +1 -1
- package/@ones-editor/misc/src/re-auth/index.d.ts +18 -0
- package/@ones-editor/misc/src/re-auth/locale/en-us.d.ts +6 -0
- package/@ones-editor/misc/src/re-auth/locale/index.d.ts +1 -0
- package/@ones-editor/misc/src/re-auth/locale/ja-jp.d.ts +6 -0
- package/@ones-editor/misc/src/re-auth/locale/zh-cn.d.ts +6 -0
- package/@ones-editor/misc/src/re-auth/ui/toolbar.d.ts +9 -0
- package/@ones-editor/sharedb-doc/src/versions/sharedb-server.d.ts +6 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/versions/src/version-dialog/version-list.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +830 -75463
- package/package.json +2 -2
- package/@ones-editor/core/src/utils/blob-to-string.d.ts +0 -1
- package/@ones-editor/drawio-embed/src/helper/iframe-embed-doc-event.d.ts +0 -23
- package/@ones-editor/misc/src/is-secure-env.d.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
2
|
import { BlockElement, OnesEditor, OnesEditorDocCallbacks } from '../../../@ones-editor/core';
|
|
3
|
-
export type ChildBlockAction = 'text-change' | 'data-change';
|
|
3
|
+
export type ChildBlockAction = 'text-change' | 'data-change' | 'insert' | 'remove';
|
|
4
4
|
export interface ChildBlockEvents {
|
|
5
5
|
change: (editor: OnesEditor, parentBlock: BlockElement, childBlock: BlockElement, action: ChildBlockAction) => void;
|
|
6
6
|
}
|
|
@@ -10,5 +10,7 @@ export declare class ChildBlockEventTracker extends TypedEmitter<ChildBlockEvent
|
|
|
10
10
|
handleChild(containerId: string, blockIndex: number, action: ChildBlockAction): void;
|
|
11
11
|
onUpdateBlockData(containerId: string, blockIndex: number): void;
|
|
12
12
|
onUpdateBlockText(containerId: string, blockIndex: number): void;
|
|
13
|
+
onInsertBlock(containerId: string, blockIndex: number): void;
|
|
14
|
+
onDeleteBlock(containerId: string, blockIndex: number): void;
|
|
13
15
|
destroy(): void;
|
|
14
16
|
}
|
|
@@ -3,3 +3,4 @@ export declare function handleCopyAction(editor: OnesEditor): Promise<void>;
|
|
|
3
3
|
export declare function handleCopyMarkdownAction(editor: OnesEditor): Promise<void>;
|
|
4
4
|
export declare function handleCutAction(editor: OnesEditor): Promise<void>;
|
|
5
5
|
export declare function handleSaveImageFromImageEmbedTypeBlock(editor: OnesEditor, block: BlockElement): Promise<void>;
|
|
6
|
+
export declare function handleMockPasteAction(editor: OnesEditor): void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare function blobToString(blob: Blob): Promise<string>;
|
|
2
2
|
export declare function isClipboardEmpty(): Promise<boolean>;
|
|
3
3
|
export declare function saveAs(resourceUrl: string, resourceId: string): void;
|
|
4
|
+
export declare function blob2String(blob: Blob): Promise<string>;
|
|
5
|
+
export declare function getClipboardData(): Promise<DataTransfer>;
|
|
@@ -4,5 +4,5 @@ export declare function injectDocToHtmlFragment(htmlFragment: string, doc: DocOb
|
|
|
4
4
|
export declare function addMetaToDoc(editor: OnesEditor, doc: DocObject): void;
|
|
5
5
|
export type BeforeCopyCallback = (editor: OnesEditor, event: ClipboardEvent, doc: DocObject) => DocObject | boolean | undefined;
|
|
6
6
|
export declare function editorCopy(editor: OnesEditor, event: ClipboardEvent, beforeCopy?: BeforeCopyCallback): void;
|
|
7
|
-
export declare function editorCopyWithoutEvent(editor: OnesEditor): void;
|
|
7
|
+
export declare function editorCopyWithoutEvent(editor: OnesEditor, beforeCopy?: BeforeCopyCallback): void;
|
|
8
8
|
export declare function editorCopyBlock(editor: OnesEditor, block: BlockElement): Promise<boolean>;
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { OnesEditorInput, OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
2
|
-
import
|
|
2
|
+
import { DocObject } from '../doc';
|
|
3
|
+
export interface EditorInputCallbacks {
|
|
4
|
+
onInsertText: (event: Event, text: string) => void;
|
|
5
|
+
onCompositionStart: (event: Event) => void;
|
|
6
|
+
onUpdateCompositionText: (event: Event, text: string, end: boolean) => void;
|
|
7
|
+
onKeyDown: (event: KeyboardEvent) => boolean;
|
|
8
|
+
onChanged: (action: OnesEditorUndoAction) => void;
|
|
9
|
+
onRemoteChanged: (type: RemoteChangeType) => void;
|
|
10
|
+
onFocus: () => void;
|
|
11
|
+
onBlur: () => void;
|
|
12
|
+
onPaste: (event: ClipboardEvent) => void;
|
|
13
|
+
onPasteText: (text: string, options?: PasteOptions) => void;
|
|
14
|
+
onCopy: (event: ClipboardEvent) => void;
|
|
15
|
+
onCut: (event: ClipboardEvent) => void;
|
|
16
|
+
addHandler: (handler: OnesEditorInputHandler) => void;
|
|
17
|
+
removeHandler: (handler: OnesEditorInputHandler) => void;
|
|
18
|
+
defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
|
|
19
|
+
defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
20
|
+
destroy: () => void;
|
|
21
|
+
pasteDoc: (doc: DocObject) => Promise<void>;
|
|
22
|
+
forEach: (callback: (handler: OnesEditorInputHandler) => void) => void;
|
|
23
|
+
}
|
|
3
24
|
export declare class EditorInput implements OnesEditorInput {
|
|
4
25
|
editor: OnesEditor;
|
|
5
26
|
composing: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { editorCopyBlock, addMetaToDoc, injectDocToHtmlFragment
|
|
1
|
+
export { editorCopyBlock, addMetaToDoc, injectDocToHtmlFragment } from './clipboard/copy';
|
|
2
2
|
export { copyResourcesFromDoc } from './clipboard/resources/copy-resources';
|
|
@@ -4,3 +4,4 @@ export declare function getFirstChildBlock(container: ContainerElement): BlockEl
|
|
|
4
4
|
export declare function getLastChildBlock(container: ContainerElement): BlockElement;
|
|
5
5
|
export declare function getChildBlockCount(container: ContainerElement): number;
|
|
6
6
|
export declare function getBlockByIndex(container: ContainerElement, blockIndex: number): BlockElement;
|
|
7
|
+
export declare function findBlockByIndex(container: ContainerElement, blockIndex: number): BlockElement | null;
|
|
@@ -4,6 +4,7 @@ export declare class RootContainer {
|
|
|
4
4
|
private editor;
|
|
5
5
|
rootContainer: ContainerElement;
|
|
6
6
|
resizeObserver: ResizeObserver;
|
|
7
|
+
private isMoved;
|
|
7
8
|
constructor(editor: OnesEditor, rootContainer: ContainerElement);
|
|
8
9
|
private bindEvents;
|
|
9
10
|
private unbindEvents;
|
|
@@ -16,6 +17,8 @@ export declare class RootContainer {
|
|
|
16
17
|
handleMouseDown: (event: MouseEvent) => void;
|
|
17
18
|
handleMouseMove: (event: MouseEvent) => void;
|
|
18
19
|
handleMouseUp: (event: MouseEvent) => void;
|
|
20
|
+
handleCaptureClick: (event: MouseEvent) => void;
|
|
21
|
+
handleCaptureDbClick: (event: MouseEvent) => void;
|
|
19
22
|
reload(): void;
|
|
20
23
|
}
|
|
21
24
|
export declare function createRootContainer(editor: OnesEditor): RootContainer;
|
|
@@ -4,4 +4,6 @@ export declare function editorHandleDelete(editor: OnesEditor, event: Event): bo
|
|
|
4
4
|
export declare function editorHandleBackspace(editor: OnesEditor, event: Event): boolean;
|
|
5
5
|
export declare function editorHandleInsertBr(editor: OnesEditor, event: Event): boolean;
|
|
6
6
|
export declare function editorHandlePastePlainText(editor: OnesEditor): boolean;
|
|
7
|
+
export declare function isSelectedCodeTextBlock(editor: OnesEditor): boolean;
|
|
8
|
+
export declare function getSelectedCodeBlockMarkdown(editor: OnesEditor, codeText: string): string;
|
|
7
9
|
export declare function editorHandleCopyMarkdown(editor: OnesEditor): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EditorInputCallbacks } from '../composition/editor-input';
|
|
2
|
+
import { OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
2
3
|
import { DocObject } from '../doc';
|
|
3
|
-
import type { EditorInputCallbacks } from '../types';
|
|
4
4
|
export declare class EditorInputHandlers implements EditorInputCallbacks {
|
|
5
5
|
editor: OnesEditor;
|
|
6
6
|
handlers: OnesEditorInputHandler[];
|
|
@@ -11,7 +11,9 @@ export declare class EditorInputHandlers implements EditorInputCallbacks {
|
|
|
11
11
|
onRemoteChanged(type: RemoteChangeType): void;
|
|
12
12
|
onCompositionStart(event: Event): void;
|
|
13
13
|
onUpdateCompositionText(event: Event, text: string, end: boolean): void;
|
|
14
|
+
private hookExecutionAttempt;
|
|
14
15
|
onCopy(event: ClipboardEvent): void;
|
|
16
|
+
onCopyWithoutEvent(): void;
|
|
15
17
|
onCut(event: ClipboardEvent): void;
|
|
16
18
|
onPaste(event: ClipboardEvent): void;
|
|
17
19
|
onPasteText: (text: string, options?: PasteOptions) => Promise<void>;
|
|
@@ -26,8 +28,7 @@ export declare class EditorInputHandlers implements EditorInputCallbacks {
|
|
|
26
28
|
defaultInsertText(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string): void;
|
|
27
29
|
defaultHandleKeydown(editor: OnesEditor, event: KeyboardEvent): boolean;
|
|
28
30
|
pasteDoc(doc: DocObject): Promise<void>;
|
|
29
|
-
pasteDocs
|
|
31
|
+
private pasteDocs;
|
|
30
32
|
destroy(): void;
|
|
31
33
|
forEach(cb: (handler: OnesEditorInputHandler) => void): void;
|
|
32
|
-
private getClipboardData;
|
|
33
34
|
}
|
|
@@ -14,7 +14,7 @@ export declare class EditorSelection implements OnesEditorSelection {
|
|
|
14
14
|
getFocusedBlock(): BlockElement;
|
|
15
15
|
getStartBlock(): BlockElement;
|
|
16
16
|
getEndBlock(): BlockElement;
|
|
17
|
-
selectBlock(block: BlockElement, start: number, end?: number): void;
|
|
17
|
+
selectBlock(block: BlockElement, start: number, end?: number, options?: ChangeSelectionOptions): void;
|
|
18
18
|
setSelection(anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions): SelectionRange;
|
|
19
19
|
setRange(range: SelectionRange, options?: ChangeSelectionOptions): SelectionRange;
|
|
20
20
|
updateSelection(): void;
|
|
@@ -391,7 +391,6 @@ export interface OnesEditorOptionalOptions {
|
|
|
391
391
|
colors?: string[];
|
|
392
392
|
scrollContainer?: HTMLElement;
|
|
393
393
|
enableComments?: boolean;
|
|
394
|
-
enableContextMenu?: boolean;
|
|
395
394
|
settingsProvider?: OnesEditorSettingsProvider;
|
|
396
395
|
}
|
|
397
396
|
export interface OnesEditorOptions {
|
|
@@ -400,7 +399,6 @@ export interface OnesEditorOptions {
|
|
|
400
399
|
[index: string]: unknown;
|
|
401
400
|
};
|
|
402
401
|
enableComments?: boolean;
|
|
403
|
-
enableContextMenu?: boolean;
|
|
404
402
|
scrollContainer?: HTMLElement;
|
|
405
403
|
}
|
|
406
404
|
export interface OnesEditorComponents {
|
|
@@ -506,6 +504,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
506
504
|
getBlockById: (id: string) => BlockElement;
|
|
507
505
|
getBoxById: (id: string) => BoxElement;
|
|
508
506
|
getBlockByIndex: (containerId: string, blockIndex: number) => BlockElement;
|
|
507
|
+
findBlockByIndex: (containerId: string, blockIndex: number) => BlockElement | null;
|
|
509
508
|
getBlockIndex: (block: BlockElement | string) => number;
|
|
510
509
|
getContainerById: (id: string) => ContainerElement;
|
|
511
510
|
getParentContainer: (block: BlockElement) => ContainerElement;
|
|
@@ -556,7 +555,7 @@ export interface OnesEditorSelection {
|
|
|
556
555
|
readonly endBlock: BlockElement;
|
|
557
556
|
setSelection: (anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions) => SelectionRange;
|
|
558
557
|
setRange: (range: SelectionRange, options?: ChangeSelectionOptions) => SelectionRange;
|
|
559
|
-
selectBlock: (block: BlockElement, start: number, end?: number) => void;
|
|
558
|
+
selectBlock: (block: BlockElement, start: number, end?: number, options?: ChangeSelectionOptions) => void;
|
|
560
559
|
updateSelection: (old: SelectionRange | null) => void;
|
|
561
560
|
updateLastCaretRect: () => void;
|
|
562
561
|
getSuggestedCaretX: () => number | undefined;
|
|
@@ -569,32 +568,10 @@ export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBl
|
|
|
569
568
|
export type PasteOptions = {
|
|
570
569
|
toPlainText?: boolean;
|
|
571
570
|
};
|
|
572
|
-
export interface EditorInputCallbacks {
|
|
573
|
-
onInsertText: (event: Event, text: string) => void;
|
|
574
|
-
onCompositionStart: (event: Event) => void;
|
|
575
|
-
onUpdateCompositionText: (event: Event, text: string, end: boolean) => void;
|
|
576
|
-
onKeyDown: (event: KeyboardEvent) => boolean;
|
|
577
|
-
onChanged: (action: OnesEditorUndoAction) => void;
|
|
578
|
-
onRemoteChanged: (type: RemoteChangeType) => void;
|
|
579
|
-
onFocus: () => void;
|
|
580
|
-
onBlur: () => void;
|
|
581
|
-
onPaste: (event: ClipboardEvent) => void;
|
|
582
|
-
onPasteText: (text: string, options?: PasteOptions) => void;
|
|
583
|
-
onCopy: (event: ClipboardEvent) => void;
|
|
584
|
-
onCut: (event: ClipboardEvent) => void;
|
|
585
|
-
addHandler: (handler: OnesEditorInputHandler) => void;
|
|
586
|
-
removeHandler: (handler: OnesEditorInputHandler) => void;
|
|
587
|
-
defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
|
|
588
|
-
defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
589
|
-
destroy: () => void;
|
|
590
|
-
pasteDoc: (doc: DocObject) => Promise<void>;
|
|
591
|
-
forEach: (callback: (handler: OnesEditorInputHandler) => void) => void;
|
|
592
|
-
}
|
|
593
571
|
export interface OnesEditorInput {
|
|
594
572
|
readonly inputElement: HTMLInputElement;
|
|
595
573
|
destroy: () => void;
|
|
596
574
|
focus: () => void;
|
|
597
|
-
callbacks: EditorInputCallbacks;
|
|
598
575
|
handleDocumentSelectionChange: () => void;
|
|
599
576
|
handleCompositionstart: (event: CompositionEvent) => void;
|
|
600
577
|
handleCompositionend: (event: CompositionEvent) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function getScrollContainer(element: HTMLElement, options?: {
|
|
2
2
|
horizontal?: boolean;
|
|
3
3
|
}): HTMLElement;
|
|
4
|
-
export declare function disablePageScroll(id: string):
|
|
4
|
+
export declare function disablePageScroll(id: string): void;
|
|
5
5
|
export declare function enablePageScroll(id: string): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
+
import type { OnesEditor, OnesEditorCustom, OnesEditorDocCallbacks } from '../../../../@ones-editor/core';
|
|
3
|
+
import ReAuthToolbar from './ui/toolbar';
|
|
4
|
+
import './locale';
|
|
5
|
+
type EventCallback = (() => void) | undefined;
|
|
6
|
+
declare const DOC_RE_AUTH_KEYS = "doc-re-auth-event";
|
|
7
|
+
declare class DocReAuthCallbacks extends TypedEmitter implements OnesEditorCustom, OnesEditorDocCallbacks {
|
|
8
|
+
private editor;
|
|
9
|
+
private authErrorCallback;
|
|
10
|
+
private authRecoverCallback;
|
|
11
|
+
constructor(editor: OnesEditor);
|
|
12
|
+
addAuthListen(event: 'authError' | 'authRecover', callback: EventCallback): void;
|
|
13
|
+
removeListeners(): void;
|
|
14
|
+
destroy: () => void;
|
|
15
|
+
onError: (error: Error) => void;
|
|
16
|
+
onAuthRecover: () => void;
|
|
17
|
+
}
|
|
18
|
+
export { ReAuthToolbar, DocReAuthCallbacks, DOC_RE_AUTH_KEYS, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BlockElement, OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
+
import './toolbar.scss';
|
|
3
|
+
export default class ReAuthToolbar {
|
|
4
|
+
private editor;
|
|
5
|
+
private currentBlock;
|
|
6
|
+
constructor(editor: OnesEditor);
|
|
7
|
+
render(block: BlockElement, onExit?: () => void): void;
|
|
8
|
+
destroy(): void;
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildResourceUrlOptions, DocObject, DocVersion, EventCallbacks, OnesEditorDocHistoryData, OnesEditorDocServer, OnesEditorDocServerMeta, OnesEditorDocVersionExtra, OnesEditorDocVersionHelper, OnesEditorHistoryDataParseHandler, RemoteUsers } from '../../../../@ones-editor/core';
|
|
2
|
-
import { ShareDBDocCallbacks, ShareDBDocOptions } from '../types';
|
|
2
|
+
import { AuthMessage, ShareDBDocCallbacks, ShareDBDocOptions } from '../types';
|
|
3
3
|
import ShareDBSimpleClient from './simple-client';
|
|
4
4
|
export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> implements OnesEditorDocServer, OnesEditorDocVersionHelper {
|
|
5
5
|
private options;
|
|
@@ -26,4 +26,9 @@ export default class ShareDBServer extends EventCallbacks<ShareDBDocCallbacks> i
|
|
|
26
26
|
createVersion(tag: string, publish: boolean): Promise<DocVersion>;
|
|
27
27
|
parseHistoryData(historyData: OnesEditorDocHistoryData, handler: OnesEditorHistoryDataParseHandler): void;
|
|
28
28
|
getServerMeta(): OnesEditorDocServerMeta;
|
|
29
|
+
static auth(auth: AuthMessage, serverUrl: string): Promise<{
|
|
30
|
+
read: string;
|
|
31
|
+
user: string;
|
|
32
|
+
}>;
|
|
33
|
+
static load(options: ShareDBDocOptions): Promise<ShareDBServer>;
|
|
29
34
|
}
|