@ones-editor/editor 2.1.7 → 2.1.8
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/comments-helper/old-version-comment.d.ts +16 -0
- package/@ones-editor/comments/src/index.d.ts +3 -0
- package/@ones-editor/core/src/core/blocks/common/block-properties.d.ts +9 -9
- package/@ones-editor/core/src/core/blocks/complex-blocks/child-blocks.d.ts +2 -1
- package/@ones-editor/core/src/core/blocks/complex-blocks/complex-block-helper.d.ts +2 -1
- package/@ones-editor/core/src/core/blocks/text-blocks/base/child.d.ts +2 -7
- package/@ones-editor/core/src/core/doc/doc.d.ts +3 -0
- package/@ones-editor/core/src/core/types.d.ts +11 -2
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client-base.d.ts +24 -0
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +4 -1
- package/@ones-editor/sharedb-doc/src/doc/sharedb-local-doc.d.ts +17 -0
- package/@ones-editor/sharedb-doc/src/index.d.ts +8 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/index.d.ts +5 -2
- package/@ones-editor/ui/src/readonly-toolbar/add-comment-to-old-doc.d.ts +23 -0
- package/@ones-editor/ui/src/readonly-toolbar/index.d.ts +30 -0
- package/@ones-editor/ui/src/readonly-toolbar/types.d.ts +12 -0
- package/@ones-editor/ui/src/toolbar/link-commands.d.ts +7 -0
- package/dist/comments/local-doc-comments-provider.d.ts +2 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +16930 -16041
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DocObject, OnesEditor, OnesEditorComment, OnesEditorDocRange, SelectionRange } from '../../../../@ones-editor/core';
|
|
2
|
+
export interface AddCommentToOldVersionBody {
|
|
3
|
+
avatarUrl: string;
|
|
4
|
+
containerId: string;
|
|
5
|
+
rangeType: 'simple' | 'complex';
|
|
6
|
+
range: OnesEditorDocRange;
|
|
7
|
+
selectedContainers: string[];
|
|
8
|
+
commentId?: string;
|
|
9
|
+
commentGroupId?: string;
|
|
10
|
+
comment: DocObject;
|
|
11
|
+
abstract?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function addCommentToOldVersion(editor: OnesEditor, version: number, range: SelectionRange, comment: OnesEditorComment, commentDoc: DocObject): Promise<void>;
|
|
14
|
+
export declare function replyCommentToOldVersion(editor: OnesEditor, version: number, comment: OnesEditorComment, commentDoc: DocObject): Promise<unknown>;
|
|
15
|
+
export declare function updateCommentToOldDoc(editor: OnesEditor, version: number, commentId: string, commentDoc: DocObject): Promise<unknown>;
|
|
16
|
+
export declare function deleteCommentFromOldDoc(editor: OnesEditor, version: number, commentId: string): Promise<unknown>;
|
|
@@ -8,4 +8,7 @@ export { OnesEditorComments };
|
|
|
8
8
|
export type { CommentItem } from './comment-item';
|
|
9
9
|
export type { CommentGroupItem } from './comments-list/group-item';
|
|
10
10
|
export { removeCommentFromBlock } from './actions/remove-comment-from-block';
|
|
11
|
+
export { addCommentToTextBlocks } from './actions/add-comment-to-text-block';
|
|
12
|
+
export { addCommentToBlock } from './actions/add-comment-to-block';
|
|
11
13
|
export { editorAddComment } from './actions/editor-add-comment';
|
|
14
|
+
export * from './comments-helper/old-version-comment';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BlockCommands, BlockElement, OnesEditor } from '../../types';
|
|
1
|
+
import { BlockCommands, BlockElement, BoxCommands, OnesEditor, TextBlockContentChild } from '../../types';
|
|
2
2
|
export declare function getBlockProperties(editor: OnesEditor, block: BlockElement): import("../../types").BlockProperties | undefined;
|
|
3
|
-
export declare function getBlockCommandsWithHook(editor: OnesEditor, block: BlockElement): Record<string, BlockCommands>;
|
|
4
|
-
|
|
5
|
-
element:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
3
|
+
export declare function getBlockCommandsWithHook(editor: OnesEditor, block: BlockElement, child: TextBlockContentChild | null): Record<string, BlockCommands>;
|
|
4
|
+
interface SpecialBlockCommands {
|
|
5
|
+
element: HTMLElement | null;
|
|
6
|
+
blockCommands: BlockCommands[];
|
|
7
|
+
boxCommands: BoxCommands[];
|
|
8
|
+
}
|
|
9
|
+
export declare function getSpecialBlockCommands(editor: OnesEditor, blockElement: BlockElement, child: TextBlockContentChild | null, group: string): SpecialBlockCommands;
|
|
10
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { BlockElement, OnesEditor, SelectedBlock } from '../../types';
|
|
1
|
+
import { BlockElement, OnesEditor, SelectedBlock, SelectionRange } from '../../types';
|
|
2
2
|
export type GetAllChildBlocksOptions = {
|
|
3
3
|
simpleBlockOnly?: boolean;
|
|
4
4
|
visibleOnly?: boolean;
|
|
5
|
+
range?: SelectionRange;
|
|
5
6
|
};
|
|
6
7
|
export declare function getAllChildBlocks(editor: OnesEditor, options?: GetAllChildBlocksOptions): BlockElement[];
|
|
7
8
|
export declare function getAllSelectedBlocks(editor: OnesEditor, options?: GetAllChildBlocksOptions): SelectedBlock[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnesEditor, BlockElement, BlockPosition, ContainerElement, ComplexBlockPosition, GetChildContainerOptions } from '../../types';
|
|
1
|
+
import { OnesEditor, BlockElement, BlockPosition, ContainerElement, ComplexBlockPosition, GetChildContainerOptions, ComplexSelectionRange } from '../../types';
|
|
2
2
|
export declare function complexBlockGetAllChildContainers(editor: OnesEditor, block: BlockElement, options?: GetChildContainerOptions): ContainerElement[];
|
|
3
3
|
export declare function complexBlockGetSelectedContainers(editor: OnesEditor, block: BlockElement, start: BlockPosition, end: BlockPosition): ContainerElement[];
|
|
4
4
|
export declare function isFirstChildBlockInComplexBlock(editor: OnesEditor, childBlock: BlockElement): boolean;
|
|
@@ -13,3 +13,4 @@ export declare function complexBlockAdjustSelectionPos(editor: OnesEditor, compl
|
|
|
13
13
|
anchor: ComplexBlockPosition;
|
|
14
14
|
focus: ComplexBlockPosition;
|
|
15
15
|
};
|
|
16
|
+
export declare function isFullSelectedOneComplexBlock(editor: OnesEditor, complexRange?: ComplexSelectionRange): boolean;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { BlockElement,
|
|
2
|
-
export type TextBlockContentTextChild
|
|
3
|
-
__neverUse: 'TextBlockContentTextChild';
|
|
4
|
-
};
|
|
5
|
-
export type TextBlockContentInsertionChild = InsertionElement;
|
|
6
|
-
export type TextBlockContentBoxChild = BoxElement;
|
|
7
|
-
export type TextBlockContentChild = TextBlockContentTextChild | TextBlockContentBoxChild | TextBlockContentInsertionChild;
|
|
1
|
+
import { BlockElement, TextBlockContentTextChild, TextBlockContentBoxChild, TextBlockContentInsertionChild, TextBlockContentChild } from '../../../types';
|
|
2
|
+
export type { TextBlockContentTextChild, TextBlockContentBoxChild, TextBlockContentInsertionChild, TextBlockContentChild };
|
|
8
3
|
export type TextBlockContentChildren = TextBlockContentChild[];
|
|
9
4
|
export type TextBlockContentChildType = 'text' | 'box' | 'insertion';
|
|
10
5
|
export declare function isTextBlockContentChild(elem: Element): boolean;
|
|
@@ -110,10 +110,12 @@ export interface OnesEditorDocComplexBlockPos {
|
|
|
110
110
|
}
|
|
111
111
|
export type OnesEditorDocBlockPos = OnesEditorDocSimpleBlockPos | OnesEditorDocComplexBlockPos;
|
|
112
112
|
export interface OnesEditorDocSimpleRange {
|
|
113
|
+
reverse?: boolean;
|
|
113
114
|
anchor: OnesEditorDocSimpleBlockPos;
|
|
114
115
|
focus: OnesEditorDocSimpleBlockPos;
|
|
115
116
|
}
|
|
116
117
|
export interface OnesEditorDocComplexRange {
|
|
118
|
+
reverse?: boolean;
|
|
117
119
|
anchor: OnesEditorDocComplexBlockPos;
|
|
118
120
|
focus: OnesEditorDocComplexBlockPos;
|
|
119
121
|
}
|
|
@@ -202,6 +204,7 @@ export interface OnesEditorDocServerMeta {
|
|
|
202
204
|
serverId?: string;
|
|
203
205
|
docId?: string;
|
|
204
206
|
appId?: string;
|
|
207
|
+
apiServer?: string;
|
|
205
208
|
}
|
|
206
209
|
export interface RecognizeLinkResult {
|
|
207
210
|
type?: 'iframe' | 'video' | 'audio' | 'image';
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
2
|
import { DocBlock, DocBlockAttributes, DocBlockDelta, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange, UpdateBlockOptions } from './doc';
|
|
3
|
+
export type TextBlockContentTextChild = HTMLSpanElement & {
|
|
4
|
+
__neverUse: 'TextBlockContentTextChild';
|
|
5
|
+
};
|
|
6
|
+
export type TextBlockContentInsertionChild = InsertionElement;
|
|
7
|
+
export type TextBlockContentBoxChild = BoxElement;
|
|
8
|
+
export type TextBlockContentChild = TextBlockContentTextChild | TextBlockContentBoxChild | TextBlockContentInsertionChild;
|
|
3
9
|
export type ContainerElement = HTMLDivElement & {
|
|
4
10
|
__neverUse: 'ContainerElement';
|
|
5
11
|
};
|
|
@@ -52,6 +58,7 @@ export type BlockPosition = SimpleBlockPosition | ComplexBlockPosition;
|
|
|
52
58
|
export interface BoxCommands {
|
|
53
59
|
group: string;
|
|
54
60
|
commands: CommandItem[];
|
|
61
|
+
startGroup?: boolean;
|
|
55
62
|
executeCommand: (editor: OnesEditor, block: BlockElement, box: BoxElement, item: CommandItem) => unknown;
|
|
56
63
|
}
|
|
57
64
|
export interface BoxProperties {
|
|
@@ -174,9 +181,11 @@ export type BlockPathComponent = {
|
|
|
174
181
|
};
|
|
175
182
|
export type BlockPath = BlockPathComponent[];
|
|
176
183
|
export interface BlockCommands {
|
|
184
|
+
element?: HTMLElement;
|
|
177
185
|
group: string;
|
|
178
186
|
commands: CommandItem[];
|
|
179
|
-
|
|
187
|
+
startGroup?: boolean;
|
|
188
|
+
executeCommand: (editor: OnesEditor, block: BlockElement, item: CommandItem, child: TextBlockContentChild | null) => unknown;
|
|
180
189
|
}
|
|
181
190
|
export interface BlockProperties {
|
|
182
191
|
blockCommands?: Record<string, BlockCommands>;
|
|
@@ -753,5 +762,5 @@ export interface OnesEditorBlockHook {
|
|
|
753
762
|
create?: (editor: OnesEditor, path: BlockPath, container: ContainerElement, blockElement: BlockElement, blockData: DocBlock) => void;
|
|
754
763
|
update?: (editor: OnesEditor, path: BlockPath, container: ContainerElement, blockElement: BlockElement, blockData: DocBlock) => void;
|
|
755
764
|
writable?: (editor: OnesEditor, blockElement: BlockElement | BlockElement[]) => boolean | undefined;
|
|
756
|
-
commands?: (editor: OnesEditor, blockElement: BlockElement) => BlockCommands;
|
|
765
|
+
commands?: (editor: OnesEditor, blockElement: BlockElement, child: TextBlockContentChild | null) => BlockCommands | undefined;
|
|
757
766
|
}
|
|
@@ -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
|
-
|
|
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,6 +1,13 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
1
2
|
import ShareDBDoc from './doc/sharedb-doc';
|
|
2
3
|
import { RemoteCarets, RemoteCaretsDecorator } from './remote-carets';
|
|
3
|
-
|
|
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 };
|
|
4
9
|
export * from './doc/comments';
|
|
5
10
|
export * from './types';
|
|
6
11
|
export * from './versions';
|
|
12
|
+
export * from './utils/converter';
|
|
13
|
+
export { axios };
|