@ones-editor/editor 1.1.0-beta.1 → 1.1.0-beta.10
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/containers/children.d.ts +1 -0
- package/@ones-editor/core/src/core/editor/actions/update-block-text.d.ts +3 -3
- package/@ones-editor/core/src/core/editor/actions/update-box-data.d.ts +2 -2
- package/@ones-editor/core/src/core/selection/editor-selection.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +7 -3
- package/@ones-editor/misc/src/index.d.ts +0 -1
- package/@ones-editor/sharedb-doc/src/versions/sharedb-server.d.ts +6 -1
- package/@ones-editor/status/src/dom/create-status-tag.d.ts +8 -0
- package/@ones-editor/status/src/dom/overflow-tooltip-tag.d.ts +18 -0
- package/@ones-editor/status/src/locale/en-us.d.ts +0 -1
- package/@ones-editor/status/src/locale/ja-jp.d.ts +2 -3
- package/@ones-editor/status/src/locale/zh-cn.d.ts +2 -3
- package/@ones-editor/status/src/status-box-editor.d.ts +2 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +180 -180
- package/package.json +1 -1
- package/@ones-editor/misc/src/is-secure-env.d.ts +0 -1
|
@@ -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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement } from '../../types';
|
|
1
|
+
import { OnesEditor, BlockElement, InsertTextOptions } from '../../types';
|
|
2
2
|
import { DocBlockText, DocBlockTextActions } from '../../doc';
|
|
3
|
-
export declare function editorUpdateBlockText(editor: OnesEditor, block: BlockElement, ops: DocBlockTextActions): DocBlockText;
|
|
4
|
-
export declare function editorSetBlockText(editor: OnesEditor, block: BlockElement, newText: DocBlockText): void;
|
|
3
|
+
export declare function editorUpdateBlockText(editor: OnesEditor, block: BlockElement, ops: DocBlockTextActions, options?: InsertTextOptions): DocBlockText;
|
|
4
|
+
export declare function editorSetBlockText(editor: OnesEditor, block: BlockElement, newText: DocBlockText, options?: InsertTextOptions): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { OnesEditor } from '../../types';
|
|
1
|
+
import { InsertTextOptions, OnesEditor } from '../../types';
|
|
2
2
|
import { DocBox } from '../../doc';
|
|
3
|
-
export declare function editorUpdateBoxData(editor: OnesEditor, boxData: DocBox): void;
|
|
3
|
+
export declare function editorUpdateBoxData(editor: OnesEditor, boxData: DocBox, options?: InsertTextOptions): void;
|
|
@@ -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;
|
|
@@ -66,6 +66,7 @@ export interface Box {
|
|
|
66
66
|
handleClickBox?: (editor: OnesEditor, box: BoxElement, event: MouseEvent) => void;
|
|
67
67
|
toStandardText?: (editor: OnesEditor, box: DocBox) => Promise<DocBlockText | undefined>;
|
|
68
68
|
getBoxProperties?: (editor: OnesEditor, boxElement: BoxElement) => BoxProperties;
|
|
69
|
+
getResources?: (editor: OnesEditor, box: DocBox) => string[] | null;
|
|
69
70
|
}
|
|
70
71
|
export interface Insertion {
|
|
71
72
|
insertionType: string;
|
|
@@ -97,6 +98,7 @@ export interface Embed {
|
|
|
97
98
|
data?: DocBlockAttributes;
|
|
98
99
|
}) => ConvertBlockResult | null;
|
|
99
100
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, path: BlockPath) => Promise<DocObject | undefined>;
|
|
101
|
+
getResources?: (editor: OnesEditor, blockData: DocBlock) => string[];
|
|
100
102
|
}
|
|
101
103
|
export interface ConvertBlockResult {
|
|
102
104
|
blockData: DocBlock;
|
|
@@ -226,7 +228,7 @@ export interface Block {
|
|
|
226
228
|
toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject) => Promise<DocObject | undefined>;
|
|
227
229
|
getBlockStyles?: (editor: OnesEditor, block: BlockElement) => BlockStyles;
|
|
228
230
|
blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
|
|
229
|
-
getResources?: (data: DocBlock) => string[];
|
|
231
|
+
getResources?: (editor: OnesEditor, data: DocBlock) => string[] | null;
|
|
230
232
|
replaceResources?: (data: DocBlock, resources: Map<string, string>) => void;
|
|
231
233
|
}
|
|
232
234
|
export type TextStyles = {
|
|
@@ -438,6 +440,7 @@ export type OnesEditorCustomCreator = (editor: OnesEditor) => OnesEditorCustom;
|
|
|
438
440
|
export interface CloneBlockResultInfo {
|
|
439
441
|
containerIdMap: Map<string, string>;
|
|
440
442
|
blockIdMap: Map<string, string>;
|
|
443
|
+
boxIdMap: Map<string, string>;
|
|
441
444
|
}
|
|
442
445
|
export interface OnesEditorDomEvents extends OnesEditorCustom {
|
|
443
446
|
addEventListener: <T = Event>(element: Element | Document | Window, eventName: string, eventHandler: (editor: OnesEditor, event: T) => void) => void;
|
|
@@ -502,6 +505,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
502
505
|
getBlockById: (id: string) => BlockElement;
|
|
503
506
|
getBoxById: (id: string) => BoxElement;
|
|
504
507
|
getBlockByIndex: (containerId: string, blockIndex: number) => BlockElement;
|
|
508
|
+
findBlockByIndex: (containerId: string, blockIndex: number) => BlockElement | null;
|
|
505
509
|
getBlockIndex: (block: BlockElement | string) => number;
|
|
506
510
|
getContainerById: (id: string) => ContainerElement;
|
|
507
511
|
getParentContainer: (block: BlockElement) => ContainerElement;
|
|
@@ -537,7 +541,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
|
|
|
537
541
|
deleteChildContainers: (containerIds: string[]) => void;
|
|
538
542
|
updateBlockData: (block: BlockElement, data: DocBlockAttributes, newRange?: SelectionRange) => DocBlock;
|
|
539
543
|
updateEmbedData: (block: BlockElement, data: DocEmbedData, newRange?: SelectionRange) => DocBlock;
|
|
540
|
-
updateBoxData: (boxData: DocBox) => void;
|
|
544
|
+
updateBoxData: (boxData: DocBox, options?: InsertTextOptions) => void;
|
|
541
545
|
updateCompositionText: (text: string, end: boolean) => void;
|
|
542
546
|
getColor: (index: number, type?: string) => string;
|
|
543
547
|
}
|
|
@@ -552,7 +556,7 @@ export interface OnesEditorSelection {
|
|
|
552
556
|
readonly endBlock: BlockElement;
|
|
553
557
|
setSelection: (anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions) => SelectionRange;
|
|
554
558
|
setRange: (range: SelectionRange, options?: ChangeSelectionOptions) => SelectionRange;
|
|
555
|
-
selectBlock: (block: BlockElement, start: number, end?: number) => void;
|
|
559
|
+
selectBlock: (block: BlockElement, start: number, end?: number, options?: ChangeSelectionOptions) => void;
|
|
556
560
|
updateSelection: (old: SelectionRange | null) => void;
|
|
557
561
|
updateLastCaretRect: () => void;
|
|
558
562
|
getSuggestedCaretX: () => number | undefined;
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BoxContentElement, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
import { OverflowTooltipTag } from './overflow-tooltip-tag';
|
|
3
|
+
import { StatusBoxData } from '../types';
|
|
4
|
+
export declare class CreateStatusTag {
|
|
5
|
+
static tagRef: Map<string, OverflowTooltipTag>;
|
|
6
|
+
static create(editor: OnesEditor, classes: string[], data: StatusBoxData, boxContent: BoxContentElement): OverflowTooltipTag | undefined;
|
|
7
|
+
static remove(id: string): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
export declare class OverflowTooltipTag {
|
|
3
|
+
private editor;
|
|
4
|
+
root: HTMLElement;
|
|
5
|
+
private ro?;
|
|
6
|
+
private mo?;
|
|
7
|
+
constructor(editor: OnesEditor, title: string, classes: string[], parent: HTMLElement);
|
|
8
|
+
private replaceTitleSpace;
|
|
9
|
+
private check;
|
|
10
|
+
private observeResize;
|
|
11
|
+
private handleContentChange;
|
|
12
|
+
private observeRemoval;
|
|
13
|
+
private unbindResizeObserver;
|
|
14
|
+
private unbindMutationObserver;
|
|
15
|
+
rebind(root: HTMLElement): void;
|
|
16
|
+
changeTag(title: string, classes: string[]): void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
status: {
|
|
3
|
-
defaultTitle: string;
|
|
4
3
|
empty: string;
|
|
5
4
|
command: {
|
|
6
5
|
name: string;
|
|
@@ -11,7 +10,7 @@ declare const _default: {
|
|
|
11
10
|
green: string;
|
|
12
11
|
blue: string;
|
|
13
12
|
purple: string;
|
|
14
|
-
|
|
13
|
+
grey: string;
|
|
15
14
|
};
|
|
16
15
|
colorDefaultTitle: {
|
|
17
16
|
red: string;
|
|
@@ -19,7 +18,7 @@ declare const _default: {
|
|
|
19
18
|
green: string;
|
|
20
19
|
blue: string;
|
|
21
20
|
purple: string;
|
|
22
|
-
|
|
21
|
+
grey: string;
|
|
23
22
|
};
|
|
24
23
|
};
|
|
25
24
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
status: {
|
|
3
|
-
defaultTitle: string;
|
|
4
3
|
empty: string;
|
|
5
4
|
command: {
|
|
6
5
|
name: string;
|
|
@@ -11,7 +10,7 @@ declare const _default: {
|
|
|
11
10
|
green: string;
|
|
12
11
|
blue: string;
|
|
13
12
|
purple: string;
|
|
14
|
-
|
|
13
|
+
grey: string;
|
|
15
14
|
};
|
|
16
15
|
colorDefaultTitle: {
|
|
17
16
|
red: string;
|
|
@@ -19,7 +18,7 @@ declare const _default: {
|
|
|
19
18
|
green: string;
|
|
20
19
|
blue: string;
|
|
21
20
|
purple: string;
|
|
22
|
-
|
|
21
|
+
grey: string;
|
|
23
22
|
};
|
|
24
23
|
};
|
|
25
24
|
};
|
|
@@ -7,6 +7,7 @@ export declare class StatusBoxEditor {
|
|
|
7
7
|
linkPopup: Popup | null;
|
|
8
8
|
boxElement?: BoxElement;
|
|
9
9
|
statusPalette: StatusPalette;
|
|
10
|
+
isEditing: boolean;
|
|
10
11
|
constructor(editor: OnesEditor);
|
|
11
12
|
editorStatus: (boxElement: BoxElement) => void;
|
|
12
13
|
focus(): void;
|
|
@@ -14,7 +15,7 @@ export declare class StatusBoxEditor {
|
|
|
14
15
|
handClose: () => void;
|
|
15
16
|
handleKeyDown: (e: KeyboardEvent) => void;
|
|
16
17
|
createPopupContent(title: string, color: StatusColor, subtle: boolean): HTMLDivElement;
|
|
17
|
-
|
|
18
|
+
onColorChange: (e: Event) => void;
|
|
18
19
|
changeTitle: (e: Event) => void;
|
|
19
20
|
destroy(): void;
|
|
20
21
|
}
|