@ones-editor/editor 2.8.35 → 2.8.37-beta.1
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/comments.d.ts +5 -1
- package/@ones-editor/comments/src/comments-helper/active-comment.d.ts +3 -1
- package/@ones-editor/comments/src/comments-helper/get-comment-from-selection.d.ts +3 -0
- package/@ones-editor/comments/src/comments-helper/get-comments-from-doc.d.ts +5 -1
- package/@ones-editor/comments/src/comments-helper/old-version-comment.d.ts +2 -1
- package/@ones-editor/comments/src/comments-list/comments-list.d.ts +14 -2
- package/@ones-editor/comments/src/comments-list/group-item.d.ts +2 -0
- package/@ones-editor/comments/src/comments-list/group-list.d.ts +8 -2
- package/@ones-editor/comments/src/comments-list/handler.d.ts +2 -1
- package/@ones-editor/comments/src/comments-list/mini-comment/group-list.d.ts +1 -1
- package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +1 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts +1 -0
- package/@ones-editor/comments/src/comments-render/get-block-comments.d.ts +5 -0
- package/@ones-editor/comments/src/comments-render/index.d.ts +10 -1
- package/@ones-editor/comments/src/constant/index.d.ts +2 -1
- package/@ones-editor/comments/src/index.d.ts +1 -0
- package/@ones-editor/comments/src/locale/en-us.d.ts +9 -0
- package/@ones-editor/comments/src/locale/ja-jp.d.ts +9 -0
- package/@ones-editor/comments/src/locale/zh-cn.d.ts +9 -0
- package/@ones-editor/comments/src/resolved-comments/index.d.ts +4 -0
- package/@ones-editor/comments/src/resolved-comments/resolved-comment-editor.d.ts +14 -0
- package/@ones-editor/comments/src/resolved-comments/resolved-comment-list.d.ts +4 -0
- package/@ones-editor/comments/src/types.d.ts +7 -1
- package/@ones-editor/core/src/core/block-renderers/block-renderers.d.ts +1 -0
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +2 -0
- package/@ones-editor/core/src/core/doc/doc.d.ts +11 -0
- package/@ones-editor/core/src/core/types.d.ts +3 -0
- package/@ones-editor/core/src/local-doc/index.d.ts +1 -0
- package/@ones-editor/main-toolbar/src/index.d.ts +7 -1
- package/@ones-editor/main-toolbar/src/items/index.d.ts +1 -1
- package/@ones-editor/sharedb-doc/src/doc/comments.d.ts +2 -1
- package/@ones-editor/sharedb-doc/src/doc/op-parser/parse-handler.d.ts +2 -1
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +3 -1
- package/@ones-editor/sharedb-doc/src/types.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/readonly-toolbar/add-comment-to-old-doc.d.ts +1 -0
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +8 -7
- package/@ones-editor/ui-base/src/icons/index.d.ts +2 -1
- package/@ones-editor/versions/src/version-dialog/history-handler.d.ts +1 -0
- package/dist/comments/local-doc-comments-provider.d.ts +2 -1
- package/dist/comments/sharedb-doc-comments-provider.d.ts +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1133 -206
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
import CommentsList, { MobileCommentsList, MiniCommentsList } from '../comments-list';
|
|
2
3
|
import { CommentRoot, OnesEditorCommentsProvider } from '../types';
|
|
3
4
|
export default class OnesEditorComments {
|
|
4
5
|
private editor;
|
|
@@ -9,9 +10,12 @@ export default class OnesEditorComments {
|
|
|
9
10
|
constructor(editor: OnesEditor, provider: OnesEditorCommentsProvider);
|
|
10
11
|
get commentProvider(): OnesEditorCommentsProvider;
|
|
11
12
|
get isMobile(): boolean;
|
|
13
|
+
getCommentList(): CommentsList | null;
|
|
14
|
+
getMobileCommentList(): MobileCommentsList | null;
|
|
15
|
+
getMiniCommentList(): MiniCommentsList;
|
|
12
16
|
destroy(): void;
|
|
13
17
|
private showComment;
|
|
14
|
-
showCommentList: (groupId?: string) => void;
|
|
18
|
+
showCommentList: (groupId?: string, type?: 'current' | 'resolved') => void;
|
|
15
19
|
setFirstEditingCommentActive(): void;
|
|
16
20
|
isEditing(includeEmpty?: boolean): boolean;
|
|
17
21
|
mount(containers: CommentRoot): void;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
1
|
+
import { OnesEditor, BlockElement } from '../../../../@ones-editor/core';
|
|
2
2
|
export declare function activeComment(editor: OnesEditor, commentId: string, direction?: 'prev' | 'next'): void;
|
|
3
|
+
export declare function getElementsByCommentId(editor: OnesEditor, commentId: string): HTMLElement[];
|
|
4
|
+
export declare function getBlockByComments(editor: OnesEditor, commentId: string): BlockElement[];
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
import { OnesEditorCommentsProvider } from '../types';
|
|
2
3
|
export declare function getCommentsFromSelection(editor: OnesEditor): string[];
|
|
4
|
+
export declare function removeUnresolvedComments(commentProvider: OnesEditorCommentsProvider, commentIds: string[]): string[];
|
|
5
|
+
export declare function removeResolvedComments(commentProvider: OnesEditorCommentsProvider, commentIds: string[]): string[];
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { OnesEditor, OnesEditorComment } from '../../../../@ones-editor/core';
|
|
1
|
+
import { DocObject, OnesEditor, OnesEditorComment } from '../../../../@ones-editor/core';
|
|
2
2
|
import { CommentWithChildren, OnesEditorCommentsProvider } from '../types';
|
|
3
|
+
export declare function getCommentsFromDoc(doc: DocObject): Map<string, number>;
|
|
4
|
+
export declare function getCommentsGroup(comments: OnesEditorComment[]): CommentWithChildren[];
|
|
3
5
|
export declare function getCommentsGroupFromDoc(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider): CommentWithChildren[];
|
|
6
|
+
export declare function getUnresolvedCommentsGroupFromDoc(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider): CommentWithChildren[];
|
|
7
|
+
export declare function getResolvedCommentsGroupFromDoc(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider): CommentWithChildren[];
|
|
4
8
|
export declare function flattenCommentGroup(comment: CommentWithChildren): OnesEditorComment[];
|
|
5
9
|
export declare function getCommentsCountInDoc(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocObject, OnesEditor, OnesEditorComment, OnesEditorDocRange, SelectionRange } from '../../../../@ones-editor/core';
|
|
1
|
+
import { DocCommentResolver, DocObject, OnesEditor, OnesEditorComment, OnesEditorDocRange, SelectionRange } from '../../../../@ones-editor/core';
|
|
2
2
|
export interface AddCommentToOldVersionBody {
|
|
3
3
|
avatarUrl: string;
|
|
4
4
|
containerId: string;
|
|
@@ -14,3 +14,4 @@ export declare function addCommentToOldVersion(editor: OnesEditor, version: numb
|
|
|
14
14
|
export declare function replyCommentToOldVersion(editor: OnesEditor, version: number, comment: OnesEditorComment, commentDoc: DocObject): Promise<unknown>;
|
|
15
15
|
export declare function updateCommentToOldDoc(editor: OnesEditor, version: number, commentId: string, commentDoc: DocObject): Promise<unknown>;
|
|
16
16
|
export declare function deleteCommentFromOldDoc(editor: OnesEditor, version: number, commentId: string): Promise<unknown>;
|
|
17
|
+
export declare function updateCommentResolverToOldDoc(editor: OnesEditor, version: number, commentId: string, resolver?: DocCommentResolver): Promise<unknown>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
1
|
+
import { OnesEditor, CommandItem } from '../../../../@ones-editor/core';
|
|
2
2
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
3
|
-
import {
|
|
3
|
+
import { FixedToolbar } from '../../../../@ones-editor/ui-base';
|
|
4
|
+
import { OnesEditorCommentsEvents, OnesEditorCommentsProvider, CommentListType } from '../types';
|
|
4
5
|
import CommentGroupList from './group-list';
|
|
5
6
|
interface CommentsListEvents {
|
|
6
7
|
onSelectComment: () => void;
|
|
@@ -11,17 +12,28 @@ export default class CommentsList extends TypedEmitter<CommentsListEvents> imple
|
|
|
11
12
|
root: HTMLElement;
|
|
12
13
|
private groupsContainer;
|
|
13
14
|
private list;
|
|
15
|
+
private listType;
|
|
16
|
+
private switcherItem;
|
|
17
|
+
private switcherBar;
|
|
18
|
+
private noCommentTip;
|
|
14
19
|
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider);
|
|
15
20
|
private get commentOptions();
|
|
16
21
|
destroy(): void;
|
|
17
22
|
onCreateComment(commentId: string, local: boolean): void;
|
|
18
23
|
onDeleteComment(commentId: string, local: boolean): void;
|
|
19
24
|
onUpdateComment(commentId: string, local: boolean): void;
|
|
25
|
+
onUpdateCommentResolver(commentId: string, local: boolean): void;
|
|
20
26
|
createList(): CommentGroupList;
|
|
27
|
+
createSwitcher(): FixedToolbar;
|
|
28
|
+
setSwitcherParent(parent: HTMLElement): void;
|
|
21
29
|
isEditing(includeEmpty?: boolean): boolean;
|
|
22
30
|
setFirstEditingCommentActive(): void;
|
|
31
|
+
handleSwitchType: (bar: unknown, item: CommandItem) => void;
|
|
32
|
+
getListType(): CommentListType;
|
|
33
|
+
setListType(type: CommentListType): void;
|
|
23
34
|
handleSelectionOnComment: () => void;
|
|
24
35
|
updateCommentCount: () => void;
|
|
36
|
+
updateCommentCountTip(): void;
|
|
25
37
|
handleActiveItemChanged: (index: number, direction?: 'prev' | 'next') => void;
|
|
26
38
|
handleItemLayoutUpdated: () => void;
|
|
27
39
|
show(groupId?: string): void;
|
|
@@ -22,6 +22,7 @@ export declare class CommentGroupItem extends TypedEmitter<CommentGroupItemEvent
|
|
|
22
22
|
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, comment: CommentWithChildren, groupList: CommentGroupList);
|
|
23
23
|
get commentCount(): number;
|
|
24
24
|
private createRoot;
|
|
25
|
+
private createFooter;
|
|
25
26
|
private createQuickReply;
|
|
26
27
|
private createHeader;
|
|
27
28
|
private createItem;
|
|
@@ -35,6 +36,7 @@ export declare class CommentGroupItem extends TypedEmitter<CommentGroupItemEvent
|
|
|
35
36
|
deleteMainComment(commentId: OnesEditorComment['id']): void;
|
|
36
37
|
handleReadonlyChanged: (editor: OnesEditor) => void;
|
|
37
38
|
edit(): void;
|
|
39
|
+
setCreatingComment(creating: boolean): void;
|
|
38
40
|
getCommentEditor: () => import("../comment-editor").CommentEditor;
|
|
39
41
|
destroy(): void;
|
|
40
42
|
private handleResize;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
2
|
import { OnesEditor, OnesEditorComment } from '../../../../@ones-editor/core';
|
|
3
|
-
import { CommentWithChildren, OnesEditorCommentsProvider } from '../types';
|
|
3
|
+
import { CommentListType, CommentWithChildren, OnesEditorCommentsProvider } from '../types';
|
|
4
4
|
import { CommentGroupItem } from './group-item';
|
|
5
5
|
import ListBase from './list-base';
|
|
6
6
|
import { CommentGroupItemHandlers } from './handler';
|
|
@@ -11,8 +11,10 @@ export interface CommentGroupListEvents {
|
|
|
11
11
|
commentCountChanged: () => void;
|
|
12
12
|
}
|
|
13
13
|
export default class CommentGroupList extends ListBase<CommentWithChildren, CommentGroupItem, unknown, CommentGroupListEvents> {
|
|
14
|
+
editor: OnesEditor;
|
|
15
|
+
private type;
|
|
14
16
|
groupItemHandlers: CommentGroupItemHandlers;
|
|
15
|
-
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement);
|
|
17
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement, type: CommentListType);
|
|
16
18
|
destroy(): void;
|
|
17
19
|
dispatchScroll: import("lodash").DebouncedFunc<() => void>;
|
|
18
20
|
updateItemsLayout(dispatchScroll?: boolean): void;
|
|
@@ -33,12 +35,16 @@ export default class CommentGroupList extends ListBase<CommentWithChildren, Comm
|
|
|
33
35
|
findGroupItem: (groupId: string) => CommentGroupItem | undefined;
|
|
34
36
|
handleCreateComment(comment: OnesEditorComment, local: boolean): void;
|
|
35
37
|
handleDeleteComment(commentId: string): void;
|
|
38
|
+
handleResolveComment(commentId: string): void;
|
|
39
|
+
removeGroupItem(comment: OnesEditorComment): void;
|
|
36
40
|
handleUpdateComment(comment: OnesEditorComment): void;
|
|
37
41
|
handleContainerClick: (event: MouseEvent) => void;
|
|
38
42
|
handleDocumentClick: (event: MouseEvent) => void;
|
|
39
43
|
handleSelectionChanged: () => void;
|
|
40
44
|
handleEditorResize: () => void;
|
|
41
45
|
handleDocChanged: () => void;
|
|
46
|
+
changeType(type: CommentListType): void;
|
|
47
|
+
protected reloadList(data: CommentWithChildren[]): void;
|
|
42
48
|
handleItemResize: () => void;
|
|
43
49
|
handleScroll: (event: WheelEvent) => void;
|
|
44
50
|
updateGroupItemSwitch: () => void;
|
|
@@ -17,6 +17,7 @@ export declare class CommentGroupItemHandlers {
|
|
|
17
17
|
handleCommentItemCancel: (groupItem: CommentGroupItem, commentId: string | null) => void;
|
|
18
18
|
handleCommentItemEdit: (commentItem: CommentItem) => void;
|
|
19
19
|
handleCommentItemDelete: (commentItem: CommentItem) => void;
|
|
20
|
-
|
|
20
|
+
handleResolve: (groupItem: CommentGroupItem) => void;
|
|
21
|
+
execute: (element: HTMLElement, groupItem: CommentGroupItem, commentId: string | null, itemIndex: number, event: Event) => void;
|
|
21
22
|
destroy(): void;
|
|
22
23
|
}
|
|
@@ -10,7 +10,7 @@ export declare class MiniGroupList extends ListBase<MiniCommentGroup, MiniGroupI
|
|
|
10
10
|
protected createItem(data: MiniCommentGroup): MiniGroupItem;
|
|
11
11
|
protected findInsertPos(): number;
|
|
12
12
|
private handleDocChanged;
|
|
13
|
-
|
|
13
|
+
updateMiniCommentsGroup: () => void;
|
|
14
14
|
handleCreateComment(comment: OnesEditorComment, local: boolean): void;
|
|
15
15
|
handleDeleteComment(commentId: string): void;
|
|
16
16
|
destroy(): void;
|
|
@@ -15,6 +15,7 @@ export declare class MiniCommentsList extends TypedEmitter<MiniCommentsListEvent
|
|
|
15
15
|
onCreateComment(commentId: string, local: boolean): void;
|
|
16
16
|
onDeleteComment(commentId: string, local: boolean): void;
|
|
17
17
|
onUpdateComment(commentId: string, local: boolean): void;
|
|
18
|
+
onUpdateCommentResolver(commentId: string, local: boolean): void;
|
|
18
19
|
private createList;
|
|
19
20
|
private handleListContainerClick;
|
|
20
21
|
show(): void;
|
package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare class MobileCommentsList extends TypedEmitter<MobileCommentsListE
|
|
|
16
16
|
onCreateComment(commentId: string, local: boolean): void;
|
|
17
17
|
onDeleteComment(commentId: string, local: boolean): void;
|
|
18
18
|
onUpdateComment(commentId: string, local: boolean): void;
|
|
19
|
+
onUpdateCommentResolver(commentId: string, local: boolean): void;
|
|
19
20
|
private get commentOptions();
|
|
20
21
|
private handleRootClick;
|
|
21
22
|
private createPullInfo;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DocObject } from '../../../../@ones-editor/core';
|
|
2
|
+
type CommentIds = Set<string>;
|
|
3
|
+
export declare function getBlockCommentsFromDoc(doc: DocObject): Map<string, CommentIds>;
|
|
4
|
+
export declare function getBlocksByCommentId(doc: DocObject, commentId: string): string[];
|
|
5
|
+
export {};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import { BlockElement, BlockPath, DocBlock, DocBlockTextAttributes, OnesEditor, OnesEditorBlockRenderer, OnesEditorBlockRenderResult, OnesEditorComment } from '../../../../@ones-editor/core';
|
|
3
|
+
import { CommentListType } from '../types';
|
|
2
4
|
export declare class OnesEditorCommentsRender implements OnesEditorBlockRenderer {
|
|
5
|
+
private type;
|
|
6
|
+
constructor(type?: CommentListType);
|
|
3
7
|
renderText(editor: OnesEditor, path: BlockPath, attributes: DocBlockTextAttributes): OnesEditorBlockRenderResult;
|
|
4
8
|
renderBox(editor: OnesEditor, path: BlockPath, attributes: DocBlockTextAttributes): OnesEditorBlockRenderResult;
|
|
5
9
|
renderBlock(editor: OnesEditor, path: BlockPath, blockData: DocBlock): OnesEditorBlockRenderResult;
|
|
6
10
|
updateBlock(editor: OnesEditor, path: BlockPath, blockElement: BlockElement, blockData: DocBlock): void;
|
|
11
|
+
getCommentStatus(editor: OnesEditor, commentId: string): "unknown" | "resolved" | "unresolved";
|
|
12
|
+
renderCommentElement(editor: OnesEditor, key: string, commentId: string, classes: string[], textAttributes: Record<string, string>): void;
|
|
13
|
+
getComments(editor: OnesEditor): OnesEditorComment[];
|
|
14
|
+
updateUnknownCommentsDelayed: import("lodash").DebouncedFunc<(editor: OnesEditor) => void>;
|
|
15
|
+
changeType(editor: OnesEditor, type: CommentListType): void;
|
|
7
16
|
}
|
|
@@ -9,7 +9,8 @@ export declare enum GroupItemActions {
|
|
|
9
9
|
CommentItemEdit = "comment-item-edit",
|
|
10
10
|
QuickReply = "quick-reply",
|
|
11
11
|
QuickReplyOk = "quick-reply-ok",
|
|
12
|
-
QuickReplyCancel = "quick-reply-cancel"
|
|
12
|
+
QuickReplyCancel = "quick-reply-cancel",
|
|
13
|
+
Resolve = "resolve"
|
|
13
14
|
}
|
|
14
15
|
export declare const GROUP_ITEM_ACTION_MARK = "group-item-action";
|
|
15
16
|
export declare const LAST_COMMENT_ITEM_MARK = "last-comment-item";
|
|
@@ -14,3 +14,4 @@ export { addCommentToTextBlocks } from './actions/add-comment-to-text-block';
|
|
|
14
14
|
export { addCommentToBlock } from './actions/add-comment-to-block';
|
|
15
15
|
export { editorAddComment } from './actions/editor-add-comment';
|
|
16
16
|
export * from './comments-helper/old-version-comment';
|
|
17
|
+
export * from './resolved-comments';
|
|
@@ -19,6 +19,15 @@ declare const _default: {
|
|
|
19
19
|
comment: string;
|
|
20
20
|
command: string;
|
|
21
21
|
quickMenuCommand: string;
|
|
22
|
+
resolvedBy: string;
|
|
23
|
+
reopen: string;
|
|
24
|
+
currentComment: string;
|
|
25
|
+
resolvedComment: string;
|
|
26
|
+
removedFromDoc: string;
|
|
27
|
+
noCurrentComment: string;
|
|
28
|
+
noResolvedComment: string;
|
|
29
|
+
resolveComment: string;
|
|
30
|
+
commentHasAlreadyRemoved: string;
|
|
22
31
|
};
|
|
23
32
|
};
|
|
24
33
|
export default _default;
|
|
@@ -19,6 +19,15 @@ declare const _default: {
|
|
|
19
19
|
comment: string;
|
|
20
20
|
command: string;
|
|
21
21
|
quickMenuCommand: string;
|
|
22
|
+
resolvedBy: string;
|
|
23
|
+
reopen: string;
|
|
24
|
+
currentComment: string;
|
|
25
|
+
resolvedComment: string;
|
|
26
|
+
removedFromDoc: string;
|
|
27
|
+
noCurrentComment: string;
|
|
28
|
+
noResolvedComment: string;
|
|
29
|
+
resolveComment: string;
|
|
30
|
+
commentHasAlreadyRemoved: string;
|
|
22
31
|
};
|
|
23
32
|
};
|
|
24
33
|
export default _default;
|
|
@@ -19,6 +19,15 @@ declare const _default: {
|
|
|
19
19
|
comment: string;
|
|
20
20
|
command: string;
|
|
21
21
|
quickMenuCommand: string;
|
|
22
|
+
resolvedBy: string;
|
|
23
|
+
reopen: string;
|
|
24
|
+
currentComment: string;
|
|
25
|
+
resolvedComment: string;
|
|
26
|
+
removedFromDoc: string;
|
|
27
|
+
noCurrentComment: string;
|
|
28
|
+
noResolvedComment: string;
|
|
29
|
+
resolveComment: string;
|
|
30
|
+
commentHasAlreadyRemoved: string;
|
|
22
31
|
};
|
|
23
32
|
};
|
|
24
33
|
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OnesEditor, DocObject } from '../../../../@ones-editor/core';
|
|
2
|
+
import { OnesEditorCommentsProvider } from '../types';
|
|
3
|
+
export declare class ResolvedCommentEditor {
|
|
4
|
+
private commentsProvider;
|
|
5
|
+
private doc;
|
|
6
|
+
root: HTMLDivElement;
|
|
7
|
+
private components;
|
|
8
|
+
constructor(commentsProvider: OnesEditorCommentsProvider, doc: DocObject);
|
|
9
|
+
private createEditor;
|
|
10
|
+
get editor(): OnesEditor;
|
|
11
|
+
setDoc: (doc: DocObject) => void;
|
|
12
|
+
readonly: () => void;
|
|
13
|
+
destroy: () => void;
|
|
14
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocObject, LocalDoc, OnesEditor, OnesEditorComment } from '../../../@ones-editor/core';
|
|
1
|
+
import { DocCommentResolver, DocObject, LocalDoc, OnesEditor, OnesEditorComment } from '../../../@ones-editor/core';
|
|
2
2
|
type EditorEvents = {
|
|
3
3
|
onPreviewImage?: (editor: OnesEditor, img: HTMLImageElement) => void;
|
|
4
4
|
};
|
|
@@ -12,6 +12,7 @@ export type CommentRoot = {
|
|
|
12
12
|
container?: HTMLElement;
|
|
13
13
|
miniContainer?: HTMLElement;
|
|
14
14
|
mobileContainer?: HTMLElement;
|
|
15
|
+
switchBarContainer?: HTMLElement;
|
|
15
16
|
};
|
|
16
17
|
export interface OnesEditorCommentOptions {
|
|
17
18
|
controller: OnesEditorCommentController;
|
|
@@ -21,6 +22,7 @@ export interface OnesEditorCommentOptions {
|
|
|
21
22
|
onUpdateLayout?: (editor: OnesEditor, data: CommentData) => void;
|
|
22
23
|
onCommentCountChange?: (count: number) => void;
|
|
23
24
|
onCommentEditorClick?: (editor: OnesEditor, event: MouseEvent) => void;
|
|
25
|
+
onCommentListTypeChange?: (editor: OnesEditor, type: 'current' | 'resolved') => void;
|
|
24
26
|
events?: EditorEvents;
|
|
25
27
|
componentsOptions?: {
|
|
26
28
|
[index: string]: unknown;
|
|
@@ -30,6 +32,7 @@ export interface OnesEditorCommentsEvents {
|
|
|
30
32
|
onCreateComment: (commentId: string, local: boolean) => void;
|
|
31
33
|
onDeleteComment: (commentId: string, local: boolean) => void;
|
|
32
34
|
onUpdateComment: (commentId: string, local: boolean) => void;
|
|
35
|
+
onUpdateCommentResolver: (commentId: string, local: boolean) => void;
|
|
33
36
|
}
|
|
34
37
|
export interface OnesEditorCommentsProvider {
|
|
35
38
|
getComments: () => OnesEditorComment[];
|
|
@@ -38,6 +41,7 @@ export interface OnesEditorCommentsProvider {
|
|
|
38
41
|
localCreateComment: (comment: OnesEditorComment, doc: DocObject) => void;
|
|
39
42
|
localDeleteComment: (commentId: string) => void;
|
|
40
43
|
localUpdateComment: (comment: OnesEditorComment, doc: DocObject) => void;
|
|
44
|
+
localUpdateCommentResolver: (commentId: string, resolver?: DocCommentResolver) => void;
|
|
41
45
|
addListener: (callback: OnesEditorCommentsEvents) => void;
|
|
42
46
|
removeListener: (callback: OnesEditorCommentsEvents) => void;
|
|
43
47
|
createCommentEditor: (parent: HTMLElement, doc: LocalDoc) => OnesEditor;
|
|
@@ -45,6 +49,7 @@ export interface OnesEditorCommentsProvider {
|
|
|
45
49
|
}
|
|
46
50
|
export interface CommentWithChildren extends OnesEditorComment {
|
|
47
51
|
children: OnesEditorComment[];
|
|
52
|
+
removedFromDoc?: boolean;
|
|
48
53
|
}
|
|
49
54
|
export interface ItemBase {
|
|
50
55
|
root: HTMLElement;
|
|
@@ -63,4 +68,5 @@ export interface MiniCommentGroup {
|
|
|
63
68
|
commentIds: CommentIds;
|
|
64
69
|
}
|
|
65
70
|
export type MiniCommentGroups = MiniCommentGroup[];
|
|
71
|
+
export type CommentListType = 'current' | 'resolved';
|
|
66
72
|
export {};
|
|
@@ -4,6 +4,7 @@ export declare class EditorBlockRenderers implements OnesEditorBlockRenderers {
|
|
|
4
4
|
private editor;
|
|
5
5
|
private renders;
|
|
6
6
|
constructor(editor: OnesEditor);
|
|
7
|
+
getRenderers(): OnesEditorBlockRenderer[];
|
|
7
8
|
registerRender(render: OnesEditorBlockRenderer): void;
|
|
8
9
|
renderBox(path: BlockPath, attributes: DocBlockTextAttributes): OnesEditorBlockRenderResult;
|
|
9
10
|
renderText(path: BlockPath, attributes: DocBlockTextAttributes): OnesEditorBlockRenderResult;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { OnesEditorInput, OnesEditor, OnesEditorInputHandler, OnesEditorUndoAction, RemoteChangeType, PasteOptions } from '../types';
|
|
2
3
|
import { DocObject } from '../doc';
|
|
3
4
|
export interface EditorInputCallbacks {
|
|
@@ -24,6 +25,7 @@ export interface EditorInputCallbacks {
|
|
|
24
25
|
export declare class EditorInput implements OnesEditorInput {
|
|
25
26
|
editor: OnesEditor;
|
|
26
27
|
composing: boolean;
|
|
28
|
+
composingTimer: NodeJS.Timeout | undefined;
|
|
27
29
|
callbacks: EditorInputCallbacks;
|
|
28
30
|
inputElement: HTMLTextAreaElement;
|
|
29
31
|
constructor(editor: OnesEditor, callbacks: EditorInputCallbacks);
|
|
@@ -70,6 +70,11 @@ export interface DocInsertion {
|
|
|
70
70
|
[index: string]: string | boolean | number | AttributeMap | undefined;
|
|
71
71
|
attributes?: AttributeMap;
|
|
72
72
|
}
|
|
73
|
+
export interface DocCommentResolver {
|
|
74
|
+
date: number;
|
|
75
|
+
userId: string;
|
|
76
|
+
displayName: string;
|
|
77
|
+
}
|
|
73
78
|
export interface DocComment {
|
|
74
79
|
id: string;
|
|
75
80
|
groupId: string;
|
|
@@ -80,6 +85,7 @@ export interface DocComment {
|
|
|
80
85
|
blocks: DocBlock[];
|
|
81
86
|
created: number;
|
|
82
87
|
modified: number;
|
|
88
|
+
resolver?: DocCommentResolver;
|
|
83
89
|
}
|
|
84
90
|
export type DocBlocks = DocBlock[];
|
|
85
91
|
export type DocMeta = OnesEditorDocServerMeta & {
|
|
@@ -133,8 +139,10 @@ export interface OnesEditorDocCallbacks {
|
|
|
133
139
|
onStatusChanged?: (status: OnesEditorDocStatus) => void;
|
|
134
140
|
onError?: (error: Error) => void;
|
|
135
141
|
}
|
|
142
|
+
export type OnesEditorResourceType = 'image' | 'media' | 'file' | 'graph' | 'paste' | 'unknown';
|
|
136
143
|
export interface UploadResourceOptions {
|
|
137
144
|
onProgress?: (progress: number) => void;
|
|
145
|
+
resourceType?: OnesEditorResourceType;
|
|
138
146
|
}
|
|
139
147
|
export interface UploadResourceResult {
|
|
140
148
|
resourceId: string;
|
|
@@ -247,6 +255,7 @@ export interface OnesEditorDoc extends OnesEditorDocServer {
|
|
|
247
255
|
beginBatchUpdate: () => number;
|
|
248
256
|
endBatchUpdate: () => number;
|
|
249
257
|
triggerReAuth?: (auto?: boolean) => void;
|
|
258
|
+
rawData?: () => DocObject;
|
|
250
259
|
}
|
|
251
260
|
export interface OnesEditorDocHistoryData {
|
|
252
261
|
user: {
|
|
@@ -265,6 +274,7 @@ export interface OnesEditorHistoryDataParseHandler {
|
|
|
265
274
|
onDeleteComment: (commentId: string, local: boolean) => void;
|
|
266
275
|
onCreateComment: (commentId: string, local: boolean) => void;
|
|
267
276
|
onUpdateComment: (commentId: string, local: boolean) => void;
|
|
277
|
+
onUpdateCommentResolver: (commentId: string, local: boolean) => void;
|
|
268
278
|
}
|
|
269
279
|
export interface OnesEditorDocVersionHelper {
|
|
270
280
|
getVersions: (showPublished?: boolean) => Promise<DocVersion[]>;
|
|
@@ -288,4 +298,5 @@ export interface OnesEditorComment {
|
|
|
288
298
|
abstract: string;
|
|
289
299
|
created: number;
|
|
290
300
|
modified: number;
|
|
301
|
+
resolver?: DocCommentResolver;
|
|
291
302
|
}
|
|
@@ -412,6 +412,7 @@ export interface OnesEditorBlockRenderers {
|
|
|
412
412
|
renderChildContainer: (editor: OnesEditor, path: BlockPath, containerId: string) => OnesEditorBlockRenderResult;
|
|
413
413
|
updateBlock: (editor: OnesEditor, path: BlockPath, blockElement: BlockElement, blockData: DocBlock) => void;
|
|
414
414
|
registerRender: (decorator: OnesEditorBlockRenderer) => void;
|
|
415
|
+
getRenderers: () => OnesEditorBlockRenderer[];
|
|
415
416
|
}
|
|
416
417
|
export type OnesEditorDocSource = 'text/html' | 'text/office-html' | 'text/plain' | 'text/markdown' | 'image/*' | 'text/x-ones-editor-doc' | '*';
|
|
417
418
|
export type OnesEditorDocs = Partial<Record<OnesEditorDocSource, DocObject>>;
|
|
@@ -460,6 +461,7 @@ export interface OnesEditorOptionalOptions {
|
|
|
460
461
|
colors?: string[];
|
|
461
462
|
scrollContainer?: HTMLElement;
|
|
462
463
|
enableComments?: boolean;
|
|
464
|
+
enableResolveComments?: boolean;
|
|
463
465
|
enableContextMenu?: boolean;
|
|
464
466
|
settingsProvider?: OnesEditorSettingsProvider;
|
|
465
467
|
}
|
|
@@ -469,6 +471,7 @@ export interface OnesEditorOptions {
|
|
|
469
471
|
[index: string]: unknown;
|
|
470
472
|
};
|
|
471
473
|
enableComments?: boolean;
|
|
474
|
+
enableResolveComments?: boolean;
|
|
472
475
|
enableContextMenu?: boolean;
|
|
473
476
|
scrollContainer?: HTMLElement;
|
|
474
477
|
}
|
|
@@ -10,6 +10,7 @@ export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> imp
|
|
|
10
10
|
beginBatchUpdate(): number;
|
|
11
11
|
endBatchUpdate(): number;
|
|
12
12
|
toJSON(): DocObject;
|
|
13
|
+
rawData(): DocObject;
|
|
13
14
|
getContainerBlocks(containerId: string): DocBlock[];
|
|
14
15
|
findContainerBlocks(containerId: string): DocBlock[];
|
|
15
16
|
getBlockData(containerId: string, blockIndex: number): DocBlock;
|
|
@@ -5,10 +5,16 @@ import './locale';
|
|
|
5
5
|
import './style.scss';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export * from './items';
|
|
8
|
+
export interface MainToolbarOptions {
|
|
9
|
+
enableFullScreen?: boolean;
|
|
10
|
+
onFullScreenClick?: (editor: OnesEditor, item: CommandItem) => void;
|
|
11
|
+
}
|
|
8
12
|
export declare class MainToolbar implements OnesEditorCustom {
|
|
9
13
|
private editor;
|
|
14
|
+
private options;
|
|
10
15
|
toolbar: FixedToolbar;
|
|
11
|
-
|
|
16
|
+
toolbarFullScreen?: FixedToolbar;
|
|
17
|
+
constructor(editor: OnesEditor, parent: HTMLElement, options?: MainToolbarOptions);
|
|
12
18
|
destroy(): void;
|
|
13
19
|
setItems(items: ToolbarItem[]): void;
|
|
14
20
|
getItems(): ToolbarItem[];
|
|
@@ -13,5 +13,5 @@ import { FindReplaceItem } from './find';
|
|
|
13
13
|
import { CommentItem } from './comment';
|
|
14
14
|
import { ColorItem } from './text-color';
|
|
15
15
|
import { MoreItem } from './more-item';
|
|
16
|
-
export declare function getToolbarDefaultItems(editor: OnesEditor): (FontBoldItem | FontItalicItem | FontUnderlineItem | FontStrikethroughItem | InlineCodeItem | SuperscriptItem | SubscriptItem |
|
|
16
|
+
export declare function getToolbarDefaultItems(editor: OnesEditor): (FontBoldItem | FontItalicItem | FontUnderlineItem | FontStrikethroughItem | InlineCodeItem | SuperscriptItem | SubscriptItem | InsertLinkItem | OrderedListItem | UnorderedListItem | CheckListItem | ParagraphItem | QuoteItem | SeparatorItem | AlignLeftItem | AlignCenterItem | AlignRightItem | UndoItem | RedoItem | InsertItem | FindReplaceItem | CommentItem | ColorItem | MoreItem)[];
|
|
17
17
|
export { UndoItem, RedoItem, FontBoldItem, FontItalicItem, FontUnderlineItem, FontStrikethroughItem, ColorItem, InlineCodeItem, SuperscriptItem, SubscriptItem, AlignLeftItem, AlignCenterItem, AlignRightItem, ParagraphItem, SeparatorItem, OrderedListItem, UnorderedListItem, CheckListItem, InsertImageItem, InsertLinkItem, QuoteItem, InsertItem, FindReplaceItem, CommentItem, MoreItem, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocBlocks, DocObject, OnesEditorComment } from '../../../../@ones-editor/core';
|
|
1
|
+
import { DocBlocks, DocCommentResolver, DocObject, OnesEditorComment } from '../../../../@ones-editor/core';
|
|
2
2
|
export interface ShareDBDocCommentBase {
|
|
3
3
|
id: string;
|
|
4
4
|
groupId: string;
|
|
@@ -9,6 +9,7 @@ export interface ShareDBDocCommentBase {
|
|
|
9
9
|
created: number;
|
|
10
10
|
modified: number;
|
|
11
11
|
blocks?: DocBlocks;
|
|
12
|
+
resolver?: DocCommentResolver;
|
|
12
13
|
}
|
|
13
14
|
export type ShareDBDocComment = ShareDBDocCommentBase & {
|
|
14
15
|
[index: string]: DocBlocks;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DocBlock, DocBlockTextActions, OnesEditorHistoryDataParseHandler } from '../../../../../@ones-editor/core';
|
|
2
|
-
type ActionType = 'deleteBlock' | 'insertBlock' | 'deleteBlockData' | 'insertBlockData' | 'updateBlockText' | 'deleteContainer' | 'createContainer' | 'deleteComment' | 'createComment' | 'updateComment';
|
|
2
|
+
type ActionType = 'deleteBlock' | 'insertBlock' | 'deleteBlockData' | 'insertBlockData' | 'updateBlockText' | 'deleteContainer' | 'createContainer' | 'deleteComment' | 'createComment' | 'updateComment' | 'updateCommentResolved';
|
|
3
3
|
interface Action {
|
|
4
4
|
type: ActionType;
|
|
5
5
|
containerId?: string;
|
|
@@ -20,6 +20,7 @@ export declare class ParseHandler {
|
|
|
20
20
|
onDeleteComment(commentId: string): void;
|
|
21
21
|
onCreateComment(commentId: string): void;
|
|
22
22
|
onUpdateComment(commentId: string): void;
|
|
23
|
+
onUpdateCommentResolver(commentId: string): void;
|
|
23
24
|
end(): void;
|
|
24
25
|
}
|
|
25
26
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildResourceUrlOptions, DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocObject, DocVersion, EventCallbacks, OnesEditorComment, OnesEditorDoc, OnesEditorDocHistoryData, OnesEditorDocServerMeta, OnesEditorDocStatus, OnesEditorDocVersionExtra, OnesEditorDocVersionHelper, OnesEditorHistoryDataParseHandler, UploadResourceOptions, UploadResourceResult } from '../../../../@ones-editor/core';
|
|
1
|
+
import { BuildResourceUrlOptions, DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocCommentResolver, DocObject, DocVersion, EventCallbacks, OnesEditorComment, OnesEditorDoc, OnesEditorDocHistoryData, OnesEditorDocServerMeta, OnesEditorDocStatus, OnesEditorDocVersionExtra, OnesEditorDocVersionHelper, OnesEditorHistoryDataParseHandler, UploadResourceOptions, UploadResourceResult } from '../../../../@ones-editor/core';
|
|
2
2
|
import { Doc } from 'sharedb/lib/client';
|
|
3
3
|
import { LocalPresence } from 'sharedb/lib/sharedb';
|
|
4
4
|
import RemoteCaretsHandler from './remote-caret-handler';
|
|
@@ -66,6 +66,7 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
66
66
|
localCreateComment(comment: OnesEditorComment, doc: DocObject): Promise<void>;
|
|
67
67
|
localDeleteComment(commentId: string): Promise<void>;
|
|
68
68
|
localUpdateComment(comment: OnesEditorComment, doc: DocObject): Promise<void>;
|
|
69
|
+
localUpdateCommentResolver(commentId: string, resolver?: DocCommentResolver): Promise<void> | Promise<boolean>;
|
|
69
70
|
destroy(): void;
|
|
70
71
|
private handleOp;
|
|
71
72
|
onDeleteBlock(containerId: string, blockIndex: number, local: boolean): void;
|
|
@@ -77,6 +78,7 @@ export default class ShareDBDoc extends EventCallbacks<ShareDBDocCallbacks> impl
|
|
|
77
78
|
onDeleteComment(commentId: string, local: boolean): void;
|
|
78
79
|
onCreateComment(commentId: string, local: boolean): void;
|
|
79
80
|
onUpdateComment(commentId: string, local: boolean): void;
|
|
81
|
+
onUpdateCommentResolver(commentId: string, local: boolean): void;
|
|
80
82
|
onCustomMessage(msg: unknown): void;
|
|
81
83
|
addResources(resourceIds: string[]): Promise<string[]>;
|
|
82
84
|
uploadResource(file: File, options?: UploadResourceOptions): Promise<UploadResourceResult>;
|
|
@@ -134,4 +134,5 @@ export interface ShareDBDocCallbacks extends OnesEditorDocCallbacks {
|
|
|
134
134
|
onCreateComment?: (commentId: string, local: boolean) => void;
|
|
135
135
|
onDeleteComment?: (commentId: string, local: boolean) => void;
|
|
136
136
|
onUpdateComment?: (commentId: string, local: boolean) => void;
|
|
137
|
+
onUpdateCommentResolver?: (commentId: string, local: boolean) => void;
|
|
137
138
|
}
|