@ones-editor/editor 0.0.3-beta.1 → 0.0.3-beta.11
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/block-menu/src/block-menu/index.d.ts +2 -1
- package/@ones-editor/block-menu/src/block-menu/items/index.d.ts +2 -1
- package/@ones-editor/block-menu/src/block-menu/items/insert-block-items/index.d.ts +1 -1
- package/@ones-editor/block-menu/src/block-menu/items/text-styles/text-style-item.d.ts +17 -3
- package/@ones-editor/block-menu/src/locale/en-us.d.ts +5 -0
- package/@ones-editor/block-menu/src/locale/zh-cn.d.ts +5 -0
- package/@ones-editor/comments/src/block-hook/index.d.ts +3 -1
- package/@ones-editor/comments/src/comment-editor/index.d.ts +3 -5
- package/@ones-editor/comments/src/comment-input-handler/index.d.ts +2 -10
- package/@ones-editor/comments/src/comment-input-handler/input-handler.d.ts +11 -0
- package/@ones-editor/comments/src/comment-input-handler/quick-reply-input-handler.d.ts +7 -0
- package/@ones-editor/comments/src/comment-item/comment-item.d.ts +1 -0
- package/@ones-editor/comments/src/comment-item/index.d.ts +2 -0
- package/@ones-editor/comments/src/comment-item/mini-comment-item/index.d.ts +1 -0
- package/@ones-editor/comments/src/comment-item/mini-comment-item/mini-comment-item.d.ts +7 -0
- package/@ones-editor/comments/src/comment-item/mobile-comment-item/index.d.ts +1 -0
- package/@ones-editor/comments/src/comment-item/mobile-comment-item/mobile-comment-item.d.ts +18 -0
- package/@ones-editor/comments/src/comments/comments.d.ts +12 -4
- package/@ones-editor/comments/src/comments-button/index.d.ts +3 -1
- package/@ones-editor/comments/src/comments-helper/get-comments-from-doc.d.ts +3 -1
- package/@ones-editor/comments/src/comments-helper/get-mini-comment-from-doc.d.ts +7 -0
- package/@ones-editor/comments/src/comments-helper/utils.d.ts +3 -2
- package/@ones-editor/comments/src/comments-list/comments-list.d.ts +12 -6
- package/@ones-editor/comments/src/comments-list/group-item.d.ts +0 -3
- package/@ones-editor/comments/src/comments-list/group-list.d.ts +1 -1
- package/@ones-editor/comments/src/comments-list/handler.d.ts +0 -1
- package/@ones-editor/comments/src/comments-list/index.d.ts +2 -0
- package/@ones-editor/comments/src/comments-list/list-base.d.ts +3 -2
- package/@ones-editor/comments/src/comments-list/mini-comment/group-item.d.ts +16 -0
- package/@ones-editor/comments/src/comments-list/mini-comment/group-list.d.ts +16 -0
- package/@ones-editor/comments/src/comments-list/mini-comment/index.d.ts +1 -0
- package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +27 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/children-list.d.ts +17 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/group-item.d.ts +30 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/group-list.d.ts +29 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/index.d.ts +1 -0
- package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts +28 -0
- package/@ones-editor/comments/src/constant/index.d.ts +1 -2
- package/@ones-editor/comments/src/index.d.ts +0 -1
- package/@ones-editor/comments/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/comments/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/comments/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/comments/src/text-comments/comments-command-provider.d.ts +3 -1
- package/@ones-editor/comments/src/types.d.ts +14 -14
- package/@ones-editor/core/src/common/index.d.ts +2 -2
- package/@ones-editor/core/src/core/doc/rich-text/insert-text.d.ts +2 -1
- package/@ones-editor/core/src/core/editor/editor-dom/dom-events.d.ts +3 -3
- package/@ones-editor/core/src/core/types.d.ts +18 -5
- package/@ones-editor/core/src/utils/file.d.ts +3 -0
- package/@ones-editor/core/src/utils/logger/index.d.ts +0 -3
- package/@ones-editor/drawio-embed/src/helper/default-style.d.ts +1 -0
- package/@ones-editor/drop-target/src/drop-indicator.d.ts +1 -0
- package/@ones-editor/drop-target/src/drop-target.d.ts +1 -1
- package/@ones-editor/drop-target/src/handlers/drag-file.d.ts +8 -0
- package/@ones-editor/e2e/cypress/support/commands.d.ts +19 -0
- package/@ones-editor/e2e/cypress/support/e2e.d.ts +1 -0
- package/@ones-editor/e2e/cypress.config.d.ts +3 -0
- package/@ones-editor/e2e/package.json +13 -0
- package/@ones-editor/e2e/src/block-menu/menu-list.cy.d.ts +0 -0
- package/@ones-editor/e2e/src/data.d.ts +106 -0
- package/@ones-editor/e2e/src/input-handlers/case.d.ts +10 -0
- package/@ones-editor/e2e/src/input-handlers/shortcut.cy.d.ts +1 -0
- package/@ones-editor/e2e/src/list-block/case.d.ts +8 -0
- package/@ones-editor/e2e/src/list-block/list.cy.d.ts +1 -0
- package/@ones-editor/e2e/src/toc/case.d.ts +5 -0
- package/@ones-editor/e2e/src/toc/toc.cy.d.ts +1 -0
- package/@ones-editor/embed-block-helper/src/block-properties/embed-block-properties.d.ts +1 -0
- package/@ones-editor/file/package.json +8 -0
- package/@ones-editor/file/src/file-box/index.d.ts +4 -0
- package/@ones-editor/file/src/file-embed/card/file-icon.d.ts +1 -0
- package/@ones-editor/file/src/file-embed/card/index.d.ts +6 -0
- package/@ones-editor/file/src/file-embed/download-file.d.ts +2 -0
- package/@ones-editor/file/src/file-embed/index.d.ts +4 -0
- package/@ones-editor/file/src/index.d.ts +3 -0
- package/@ones-editor/file/src/types.d.ts +22 -0
- package/@ones-editor/find-dialog/src/find-dialog.d.ts +0 -1
- package/@ones-editor/heading-collapse/src/doc-event/index.d.ts +1 -1
- package/@ones-editor/heading-collapse/src/heading-collapse-button/drop-handler.d.ts +1 -1
- package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +5 -1
- package/@ones-editor/image-embed/src/drag-drop/handle-drop.d.ts +1 -1
- package/@ones-editor/list-block/src/drop/index.d.ts +1 -1
- package/@ones-editor/list-block/src/lang/en-us.d.ts +3 -0
- package/@ones-editor/list-block/src/lang/zh-cn.d.ts +3 -0
- package/@ones-editor/list-block/src/list-notify.d.ts +2 -0
- package/@ones-editor/list-block/src/mindmap/index.d.ts +2 -0
- package/@ones-editor/mention/src/block-mention.d.ts +10 -0
- package/@ones-editor/mention/src/dom/mention-button.d.ts +2 -0
- package/@ones-editor/mention/src/index.d.ts +2 -1
- package/@ones-editor/table-block/src/table-block/border-bar/table-border-bar.d.ts +1 -0
- package/@ones-editor/table-block/src/table-block/border-bar/table-row-column-toolbar.d.ts +1 -0
- package/@ones-editor/table-block/src/table-block/close-toolbar.d.ts +2 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/icons/index.d.ts +1 -14
- package/@ones-editor/ui/src/index.d.ts +5 -2
- package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +2 -4
- package/@ones-editor/ui/src/quick-menu/index.d.ts +1 -6
- package/@ones-editor/ui/src/quick-menu/insert-empty-block.d.ts +4 -2
- package/@ones-editor/ui/src/quick-menu/types.d.ts +24 -1
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +0 -1
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +1 -0
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -1
- package/@ones-editor/ui-base/src/dialog/manual-close-dialog.d.ts +1 -0
- package/@ones-editor/ui-base/src/icons/index.d.ts +36 -12
- package/@ones-editor/ui-base/src/index.d.ts +1 -0
- package/@ones-editor/{ui/src/quick-menu/item-shortcuts.d.ts → ui-base/src/item-shortcuts/index.d.ts} +0 -0
- package/@ones-editor/ui-base/src/locale/en-us.d.ts +3 -0
- package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +3 -0
- package/dist/comments/comments-provider.d.ts +2 -2
- package/dist/comments/create-comment-editor.d.ts +1 -4
- package/dist/index.js +563 -29064
- package/dist/types.d.ts +5 -2
- package/package.json +5 -2
- package/@ones-editor/core/src/utils/logger/fake-process.d.ts +0 -1
|
@@ -8,9 +8,10 @@ export default class BlockMenu {
|
|
|
8
8
|
show(target: HTMLElement): void;
|
|
9
9
|
isInMenu(eventTarget: EventTarget | null): boolean;
|
|
10
10
|
handleShow: () => void;
|
|
11
|
+
handleClose: () => void;
|
|
11
12
|
handleItemClick: (bar: unknown, item: CommandItem) => void;
|
|
12
13
|
setBlock(block: BlockElement): void;
|
|
13
|
-
close()
|
|
14
|
+
close: () => void;
|
|
14
15
|
get isVisible(): boolean;
|
|
15
16
|
destroy(): void;
|
|
16
17
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { TextStyleItemOptions } from './text-styles/text-style-item';
|
|
2
3
|
import { BlockMenuItem } from './types';
|
|
3
|
-
export declare function getBlockMenuItems(editor: OnesEditor, block: BlockElement): BlockMenuItem[];
|
|
4
|
+
export declare function getBlockMenuItems(editor: OnesEditor, block: BlockElement, options: TextStyleItemOptions): BlockMenuItem[];
|
|
4
5
|
export declare function handleBlockMenuItemClick(editor: OnesEditor, block: BlockElement, item: BlockMenuItem): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor } from '../../../../../../@ones-editor/core';
|
|
2
2
|
import { BlockMenuItem } from '../types';
|
|
3
3
|
export declare function getAllInsertBlockItems(editor: OnesEditor): BlockMenuItem[];
|
|
4
|
-
export declare function executeInsertBlockCommand(editor: OnesEditor, block: BlockElement, item: BlockMenuItem): Promise<BlockElement | null> | undefined;
|
|
4
|
+
export declare function executeInsertBlockCommand(editor: OnesEditor, block: BlockElement, item: BlockMenuItem, insertAbove?: boolean): Promise<BlockElement | null> | undefined;
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import { BlockElement, OnesEditor } from '../../../../../../@ones-editor/core';
|
|
1
|
+
import { BlockElement, OnesEditor, DocBlock } from '../../../../../../@ones-editor/core';
|
|
2
2
|
import { BlockMenuItem } from '../types';
|
|
3
|
+
export interface ParagraphBlockAttribute extends DocBlock {
|
|
4
|
+
'heading'?: number;
|
|
5
|
+
quoted?: boolean;
|
|
6
|
+
align?: 'left' | 'center' | 'right';
|
|
7
|
+
checkbox?: 'checked' | 'unchecked';
|
|
8
|
+
ordered?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type TextStyleItemOptions = {
|
|
11
|
+
onAfterStyleItemClick?: () => void;
|
|
12
|
+
};
|
|
3
13
|
export default class TextStyleItem implements BlockMenuItem {
|
|
14
|
+
private editor;
|
|
4
15
|
private block;
|
|
16
|
+
private options;
|
|
5
17
|
source: string;
|
|
6
18
|
id: string;
|
|
7
19
|
name: string;
|
|
8
20
|
element: HTMLElement;
|
|
9
|
-
constructor(editor: OnesEditor, block: BlockElement);
|
|
21
|
+
constructor(editor: OnesEditor, block: BlockElement, options: TextStyleItemOptions);
|
|
10
22
|
createItemElement(editor: OnesEditor, block: BlockElement): HTMLDivElement;
|
|
11
|
-
|
|
23
|
+
private createHeadingItemElement;
|
|
24
|
+
private createListItemElement;
|
|
25
|
+
createItem(id: string, icon: string, parent: HTMLElement, active?: boolean): void;
|
|
12
26
|
handleClick: (editor: OnesEditor, event: Event) => void;
|
|
13
27
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BlockCommands, BlockElement, CommandItem, OnesEditor, OnesEditorBlockHook } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { OnesEditorComments } from '../comments';
|
|
2
3
|
import { OnesEditorCommentsProvider } from '../types';
|
|
3
4
|
export default class CommentBlockHook implements OnesEditorBlockHook {
|
|
4
5
|
private provider;
|
|
5
|
-
|
|
6
|
+
private editorComments;
|
|
7
|
+
constructor(provider: OnesEditorCommentsProvider, editorComments: OnesEditorComments);
|
|
6
8
|
commands(editor: OnesEditor, blockElement: BlockElement): BlockCommands;
|
|
7
9
|
executeCommand: (editor: OnesEditor, block: BlockElement, item: CommandItem) => void;
|
|
8
10
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { OnesEditor, DocObject } from '../../../../@ones-editor/core';
|
|
2
|
-
import {
|
|
2
|
+
import { OnesEditorCommentsProvider } from '../types';
|
|
3
3
|
import './index.scss';
|
|
4
4
|
export declare class CommentEditor {
|
|
5
5
|
private mainEditor;
|
|
6
6
|
private commentsProvider;
|
|
7
|
-
private
|
|
7
|
+
private doc;
|
|
8
8
|
root: HTMLDivElement;
|
|
9
9
|
private components;
|
|
10
|
-
constructor(mainEditor: OnesEditor, commentsProvider: OnesEditorCommentsProvider,
|
|
11
|
-
private get editorDoc();
|
|
10
|
+
constructor(mainEditor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, doc: DocObject);
|
|
12
11
|
private createEditor;
|
|
13
12
|
get editor(): OnesEditor;
|
|
14
13
|
private handleEditorBlur;
|
|
@@ -17,7 +16,6 @@ export declare class CommentEditor {
|
|
|
17
16
|
private inactiveEditor;
|
|
18
17
|
handleInsertImg: () => Promise<void>;
|
|
19
18
|
handleReadonlyChange: (editor: OnesEditor) => void;
|
|
20
|
-
reloadDoc: () => void;
|
|
21
19
|
setDoc: (doc: DocObject) => void;
|
|
22
20
|
getDoc: () => DocObject;
|
|
23
21
|
isEmpty: () => boolean;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare class OnesEditorCommentInputHandler implements OnesEditorInputHandler {
|
|
4
|
-
private commentsProvider;
|
|
5
|
-
private createCommentEditorOptions;
|
|
6
|
-
constructor(commentsProvider: OnesEditorCommentsProvider, createCommentEditorOptions: CreateCommentEditorOption);
|
|
7
|
-
private handleQuickReplyEnter;
|
|
8
|
-
private handleCommentItemEnter;
|
|
9
|
-
handleBeforeKeyDown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
10
|
-
}
|
|
1
|
+
export { QuickReplyEditorInputHandler } from './quick-reply-input-handler';
|
|
2
|
+
export { CommentEditorInputHandler } from './input-handler';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OnesEditor, OnesEditorInputHandler } from '../../../../@ones-editor/core';
|
|
2
|
+
import { OnesEditorCommentsProvider } from '../types';
|
|
3
|
+
import type { CommentGroupItem } from '../comments-list/group-item';
|
|
4
|
+
import type { CommentItem } from '../comment-item';
|
|
5
|
+
export declare class CommentEditorInputHandler implements OnesEditorInputHandler {
|
|
6
|
+
private commentsProvider;
|
|
7
|
+
private groupItem;
|
|
8
|
+
private commentItem;
|
|
9
|
+
constructor(commentsProvider: OnesEditorCommentsProvider, groupItem: CommentGroupItem, commentItem: CommentItem);
|
|
10
|
+
handleBeforeKeyDown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OnesEditor, OnesEditorInputHandler } from '../../../../@ones-editor/core';
|
|
2
|
+
import type { CommentGroupItem } from '../comments-list/group-item';
|
|
3
|
+
export declare class QuickReplyEditorInputHandler implements OnesEditorInputHandler {
|
|
4
|
+
private groupItem;
|
|
5
|
+
constructor(groupItem: CommentGroupItem);
|
|
6
|
+
handleBeforeKeyDown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
|
|
7
|
+
}
|
|
@@ -20,6 +20,7 @@ export declare class CommentItem {
|
|
|
20
20
|
constructor(options: CommentItemOptions);
|
|
21
21
|
private get commentOptions();
|
|
22
22
|
get comment(): OnesEditorComment;
|
|
23
|
+
get doc(): import("@ones-editor/core").DocObject;
|
|
23
24
|
private createRoot;
|
|
24
25
|
private createMoreMenu;
|
|
25
26
|
private createItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MiniCommentItem } from './mini-comment-item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MobileCommentItem } from './mobile-comment-item';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OnesEditorComment, OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { CommentEditor } from '../../comment-editor';
|
|
3
|
+
import { OnesEditorCommentsProvider } from '../../types';
|
|
4
|
+
import './mobile-comment-item.scss';
|
|
5
|
+
export declare class MobileCommentItem {
|
|
6
|
+
private editor;
|
|
7
|
+
private commentsProvider;
|
|
8
|
+
comment: OnesEditorComment;
|
|
9
|
+
root: HTMLDivElement;
|
|
10
|
+
private components;
|
|
11
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, comment: OnesEditorComment);
|
|
12
|
+
private get doc();
|
|
13
|
+
createItem(): {
|
|
14
|
+
mobileCommentEditor: CommentEditor;
|
|
15
|
+
};
|
|
16
|
+
reloadDoc: () => void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
-
import CommentsList from '../comments-list';
|
|
3
2
|
import { OnesEditorCommentsProvider } from '../types';
|
|
4
3
|
export default class OnesEditorComments {
|
|
5
4
|
private editor;
|
|
6
5
|
private provider;
|
|
7
|
-
private
|
|
8
|
-
|
|
6
|
+
private root;
|
|
7
|
+
private commentList;
|
|
8
|
+
private mobileCommentList;
|
|
9
|
+
private miniCommentList;
|
|
10
|
+
constructor(editor: OnesEditor, provider: OnesEditorCommentsProvider, parent?: HTMLElement);
|
|
11
|
+
get isMobile(): boolean;
|
|
9
12
|
destroy(): void;
|
|
10
|
-
|
|
13
|
+
private showComment;
|
|
14
|
+
showCommentList: (groupId?: string) => void;
|
|
15
|
+
private handleCommentListClose;
|
|
16
|
+
private handleOnSelectComment;
|
|
17
|
+
private handleMiniCommentClose;
|
|
18
|
+
private handleMiniCommentItemClick;
|
|
11
19
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
2
|
import { OnesEditorCommentsProvider } from '../types';
|
|
3
|
+
import type OnesEditorComments from '../comments/comments';
|
|
3
4
|
export default class BlockCommentButton {
|
|
4
5
|
private editor;
|
|
5
6
|
private commentProvider;
|
|
7
|
+
private editorComments;
|
|
6
8
|
private buttonElement;
|
|
7
9
|
private currentBlockId;
|
|
8
|
-
constructor(editor: OnesEditor, commentProvider: OnesEditorCommentsProvider);
|
|
10
|
+
constructor(editor: OnesEditor, commentProvider: OnesEditorCommentsProvider, editorComments: OnesEditorComments);
|
|
9
11
|
destroy(): void;
|
|
10
12
|
handleDocumentMouseMove: (event: MouseEvent) => void;
|
|
11
13
|
handleButtonClick: (event: MouseEvent) => void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
1
|
+
import { OnesEditor, OnesEditorComment } from '../../../../@ones-editor/core';
|
|
2
2
|
import { CommentWithChildren, OnesEditorCommentsProvider } from '../types';
|
|
3
3
|
export declare function getCommentsGroupFromDoc(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider): CommentWithChildren[];
|
|
4
|
+
export declare function flattenCommentGroup(comment: CommentWithChildren): OnesEditorComment[];
|
|
5
|
+
export declare function getCommentsCountInDoc(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
import { OnesEditorCommentsProvider } from '../types';
|
|
3
|
+
export declare function getMiniCommentsGroupFromDoc(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider): {
|
|
4
|
+
firstComment: import("@ones-editor/core").OnesEditorComment;
|
|
5
|
+
commentIds: import("../types").CommentIds;
|
|
6
|
+
blockId: string;
|
|
7
|
+
}[];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { OnesEditorComment } from '../../../../@ones-editor/core';
|
|
1
|
+
import { OnesEditorComment, OnesEditor } from '../../../../@ones-editor/core';
|
|
2
2
|
export declare function isChildComment(comment: OnesEditorComment): boolean;
|
|
3
3
|
export declare function getCommentsRoot(): HTMLDivElement;
|
|
4
|
-
export declare function getCommentItemCountInGroupItem(groupItemRoot: HTMLElement): number;
|
|
4
|
+
export declare function getCommentItemCountInGroupItem(groupItemRoot: HTMLElement, commentItemCls?: string): number;
|
|
5
5
|
export declare function getClosestCommentItemId(element: HTMLElement): string | null;
|
|
6
6
|
export declare function addGroupActionToElement(element: HTMLElement, action: string): void;
|
|
7
7
|
export declare function getClosestGroupItemActionElement(element: HTMLElement): HTMLElement;
|
|
8
8
|
export declare function getActionFromActionElement(actionElement: HTMLElement): string;
|
|
9
9
|
export declare function isDisabledActionElement(actionElement: HTMLElement): boolean;
|
|
10
|
+
export declare function getBlockIdByGroupId(editor: OnesEditor, commentId: string): string | null;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
2
|
+
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
3
|
import { OnesEditorCommentsEvents, OnesEditorCommentsProvider } from '../types';
|
|
3
4
|
import CommentGroupList from './group-list';
|
|
4
|
-
|
|
5
|
+
interface CommentsListEvents {
|
|
6
|
+
onCommentListClose: () => void;
|
|
7
|
+
onSelectComment: () => void;
|
|
8
|
+
}
|
|
9
|
+
export default class CommentsList extends TypedEmitter<CommentsListEvents> implements OnesEditorCommentsEvents {
|
|
5
10
|
private editor;
|
|
6
11
|
private commentsProvider;
|
|
7
12
|
private root;
|
|
8
13
|
private header;
|
|
9
14
|
private groupsContainer;
|
|
10
15
|
private list;
|
|
11
|
-
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider);
|
|
16
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement);
|
|
12
17
|
private get commentOptions();
|
|
13
18
|
destroy(): void;
|
|
14
19
|
onCreateComment(commentId: string, local: boolean): void;
|
|
@@ -18,13 +23,14 @@ export default class CommentsList implements OnesEditorCommentsEvents {
|
|
|
18
23
|
header: HTMLDivElement;
|
|
19
24
|
count: HTMLSpanElement;
|
|
20
25
|
closeButton: HTMLButtonElement;
|
|
21
|
-
openButton: HTMLButtonElement;
|
|
22
26
|
};
|
|
23
27
|
createList(): CommentGroupList;
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
handleCloseButtonClick: () => void;
|
|
29
|
+
handleSelectionOnComment: () => void;
|
|
26
30
|
updateCommentCount: () => void;
|
|
27
31
|
handleActiveItemChanged: () => void;
|
|
28
32
|
handleItemLayoutUpdated: () => void;
|
|
29
|
-
|
|
33
|
+
show(groupId?: string): void;
|
|
34
|
+
hide(): void;
|
|
30
35
|
}
|
|
36
|
+
export {};
|
|
@@ -14,7 +14,6 @@ export declare class CommentGroupItem extends TypedEmitter<CommentGroupItemEvent
|
|
|
14
14
|
comment: CommentWithChildren;
|
|
15
15
|
private groupList;
|
|
16
16
|
root: HTMLDivElement;
|
|
17
|
-
private commentCountElement;
|
|
18
17
|
private header;
|
|
19
18
|
private mainItem;
|
|
20
19
|
childrenList: CommentChildrenList;
|
|
@@ -24,12 +23,10 @@ export declare class CommentGroupItem extends TypedEmitter<CommentGroupItemEvent
|
|
|
24
23
|
get commentCount(): number;
|
|
25
24
|
private createRoot;
|
|
26
25
|
private createQuickReply;
|
|
27
|
-
private createCountElement;
|
|
28
26
|
private createHeader;
|
|
29
27
|
private createItem;
|
|
30
28
|
private createChildrenList;
|
|
31
29
|
findCommentItem(commentId: string | null): CommentItem | null | undefined;
|
|
32
|
-
updateCommentItemCount: () => void;
|
|
33
30
|
updateLastCommentItem: () => void;
|
|
34
31
|
updateSwitchButton: () => void;
|
|
35
32
|
handleCreateComment(comment: OnesEditorComment): CommentItem;
|
|
@@ -8,6 +8,7 @@ export interface CommentGroupListEvents {
|
|
|
8
8
|
itemLayoutUpdated: () => void;
|
|
9
9
|
itemCountClicked: () => void;
|
|
10
10
|
selectionOnComment: () => void;
|
|
11
|
+
commentCountChanged: () => void;
|
|
11
12
|
}
|
|
12
13
|
export default class CommentGroupList extends ListBase<CommentWithChildren, CommentGroupItem, unknown, CommentGroupListEvents> {
|
|
13
14
|
groupItemHandlers: CommentGroupItemHandlers;
|
|
@@ -32,6 +33,5 @@ export default class CommentGroupList extends ListBase<CommentWithChildren, Comm
|
|
|
32
33
|
handleDocChanged: () => void;
|
|
33
34
|
handleItemResize: () => void;
|
|
34
35
|
updateGroupItemSwitch: () => void;
|
|
35
|
-
updateAllGroupItemCount: () => void;
|
|
36
36
|
private updateComments;
|
|
37
37
|
}
|
|
@@ -15,7 +15,6 @@ export declare class CommentGroupItemHandlers {
|
|
|
15
15
|
private handleCommentItemMore;
|
|
16
16
|
private handleCommentItemOk;
|
|
17
17
|
private handleCommentItemCancel;
|
|
18
|
-
private handleCommentItemCountClick;
|
|
19
18
|
handleCommentItemEdit: (commentItem: CommentItem) => void;
|
|
20
19
|
handleCommentItemDelete: (commentItem: CommentItem) => void;
|
|
21
20
|
execute: (element: HTMLElement, groupItem: CommentGroupItem, commentId: string | null, itemIndex: number) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypedEmitter, ListenerSignature, DefaultListener } from 'tiny-typed-emitter';
|
|
2
|
-
import { OnesEditor
|
|
2
|
+
import { OnesEditor } from '../../../../@ones-editor/core';
|
|
3
3
|
import { OnesEditorCommentsProvider, ItemBase } from '../types';
|
|
4
|
-
export default abstract class ListBase<TData
|
|
4
|
+
export default abstract class ListBase<TData, TItem extends ItemBase, ListOptions = unknown, TEvents extends ListenerSignature<TEvents> = DefaultListener> extends TypedEmitter<TEvents> {
|
|
5
5
|
protected editor: OnesEditor;
|
|
6
6
|
protected commentsProvider: OnesEditorCommentsProvider;
|
|
7
7
|
protected container: HTMLElement;
|
|
@@ -10,6 +10,7 @@ export default abstract class ListBase<TData extends OnesEditorComment, TItem ex
|
|
|
10
10
|
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, container: HTMLElement, data: TData[], options: ListOptions);
|
|
11
11
|
get items(): TItem[];
|
|
12
12
|
private createList;
|
|
13
|
+
protected reloadList(data: TData[]): void;
|
|
13
14
|
insertItem(data: TData): TItem | null;
|
|
14
15
|
deleteItem(commentId: string): boolean;
|
|
15
16
|
findItemIndex(commentId: string): number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OnesEditor, OnesEditorComment } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { MiniCommentGroup } from '../../types';
|
|
3
|
+
export declare class MiniGroupItem {
|
|
4
|
+
private editor;
|
|
5
|
+
private commentGroup;
|
|
6
|
+
root: HTMLElement;
|
|
7
|
+
blockId: string;
|
|
8
|
+
comment: OnesEditorComment;
|
|
9
|
+
private miniCommentItem;
|
|
10
|
+
constructor(editor: OnesEditor, commentGroup: MiniCommentGroup);
|
|
11
|
+
private getBlockId;
|
|
12
|
+
private updateCommentItemCount;
|
|
13
|
+
get commentCount(): number;
|
|
14
|
+
alignToBlock(): void;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OnesEditor, OnesEditorComment } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { MiniCommentGroup, OnesEditorCommentsProvider } from '../../types';
|
|
3
|
+
import ListBase from '../list-base';
|
|
4
|
+
import { MiniGroupItem } from './group-item';
|
|
5
|
+
export declare class MiniGroupList extends ListBase<MiniCommentGroup, MiniGroupItem, unknown> {
|
|
6
|
+
protected editor: OnesEditor;
|
|
7
|
+
protected commentsProvider: OnesEditorCommentsProvider;
|
|
8
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement);
|
|
9
|
+
protected createItem(data: MiniCommentGroup): MiniGroupItem;
|
|
10
|
+
protected findInsertPos(): number;
|
|
11
|
+
private handleDocChanged;
|
|
12
|
+
private updateMiniCommentsGroup;
|
|
13
|
+
handleCreateComment(comment: OnesEditorComment, local: boolean): void;
|
|
14
|
+
handleDeleteComment(commentId: string): void;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MiniCommentsList } from './mini-comments-list';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
3
|
+
import { OnesEditorCommentsEvents, OnesEditorCommentsProvider } from '../..';
|
|
4
|
+
import { MiniGroupList } from './group-list';
|
|
5
|
+
interface MiniCommentsListEvents {
|
|
6
|
+
onMiniCommentClose: () => void;
|
|
7
|
+
onItemClick: (groupId: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare class MiniCommentsList extends TypedEmitter<MiniCommentsListEvents> implements OnesEditorCommentsEvents {
|
|
10
|
+
private editor;
|
|
11
|
+
private commentsProvider;
|
|
12
|
+
list: MiniGroupList;
|
|
13
|
+
root: HTMLElement;
|
|
14
|
+
header: HTMLElement;
|
|
15
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement);
|
|
16
|
+
onCreateComment(commentId: string, local: boolean): void;
|
|
17
|
+
onDeleteComment(commentId: string, local: boolean): void;
|
|
18
|
+
onUpdateComment(commentId: string, local: boolean): void;
|
|
19
|
+
private createHeader;
|
|
20
|
+
private createList;
|
|
21
|
+
private handleListContainerClick;
|
|
22
|
+
private closeMiniComment;
|
|
23
|
+
show(): void;
|
|
24
|
+
hide(): void;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OnesEditor, OnesEditorComment } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { MobileCommentItem } from '../../comment-item';
|
|
3
|
+
import ListBase from '../list-base';
|
|
4
|
+
import { OnesEditorCommentsProvider } from '../../types';
|
|
5
|
+
interface MobileCommentChildrenListOptions {
|
|
6
|
+
editor: OnesEditor;
|
|
7
|
+
commentsProvider: OnesEditorCommentsProvider;
|
|
8
|
+
parent: HTMLElement;
|
|
9
|
+
comments: OnesEditorComment[];
|
|
10
|
+
}
|
|
11
|
+
export declare class MobileCommentChildrenList extends ListBase<OnesEditorComment, MobileCommentItem, unknown> {
|
|
12
|
+
constructor({ editor, parent, commentsProvider, comments }: MobileCommentChildrenListOptions);
|
|
13
|
+
protected findInsertPos(): number;
|
|
14
|
+
createItem(data: OnesEditorComment): MobileCommentItem;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
+
import { OnesEditor, OnesEditorComment } from '../../../../../@ones-editor/core';
|
|
3
|
+
import type { CommentWithChildren, OnesEditorCommentsProvider } from '../../types';
|
|
4
|
+
import { MobileCommentChildrenList } from './children-list';
|
|
5
|
+
interface MobileGroupItemEvents {
|
|
6
|
+
onSwitchGroup: (groupId: CommentWithChildren['groupId'], scrollTime: number) => void;
|
|
7
|
+
onReachBottom: () => void;
|
|
8
|
+
onReachTop: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare class MobileGroupItem extends TypedEmitter<MobileGroupItemEvents> {
|
|
11
|
+
private editor;
|
|
12
|
+
private commentsProvider;
|
|
13
|
+
comment: CommentWithChildren;
|
|
14
|
+
root: HTMLElement;
|
|
15
|
+
childrenList: MobileCommentChildrenList;
|
|
16
|
+
private mainItem;
|
|
17
|
+
private scroller;
|
|
18
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, comment: CommentWithChildren);
|
|
19
|
+
createRoot: () => HTMLDivElement;
|
|
20
|
+
private createMainItem;
|
|
21
|
+
private createChildrenList;
|
|
22
|
+
get commentCount(): number;
|
|
23
|
+
private handleTouchEnd;
|
|
24
|
+
refreshScroller: () => void;
|
|
25
|
+
handleUpdateChildComment(comment: OnesEditorComment): void;
|
|
26
|
+
handleUpdateMainComment(comment: OnesEditorComment): void;
|
|
27
|
+
deleteMainComment(commentId: OnesEditorComment['id']): void;
|
|
28
|
+
destroy(): void;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OnesEditor, OnesEditorComment } from '../../../../../@ones-editor/core';
|
|
2
|
+
import type { CommentWithChildren, OnesEditorCommentsProvider } from '../../types';
|
|
3
|
+
import ListBase from '../list-base';
|
|
4
|
+
import { MobileGroupItem } from './group-item';
|
|
5
|
+
interface MobileCommentGroupListEvents {
|
|
6
|
+
onReachBottom: () => void;
|
|
7
|
+
onReachTop: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare class MobileGroupList extends ListBase<CommentWithChildren, MobileGroupItem, unknown, MobileCommentGroupListEvents> {
|
|
10
|
+
private scroller;
|
|
11
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement, scrollElement: HTMLElement);
|
|
12
|
+
createItem(data: CommentWithChildren): MobileGroupItem;
|
|
13
|
+
insertItem(data: CommentWithChildren): MobileGroupItem | null;
|
|
14
|
+
deleteItem: (commonId: CommentWithChildren['id']) => boolean;
|
|
15
|
+
private setupGroupItem;
|
|
16
|
+
protected findInsertPos(data: CommentWithChildren): number;
|
|
17
|
+
private handleReachBottom;
|
|
18
|
+
private handleReachTop;
|
|
19
|
+
private scrollToGroup;
|
|
20
|
+
setActiveItem(groupId: CommentWithChildren['groupId']): void;
|
|
21
|
+
findGroupItem: (groupId: string) => MobileGroupItem | undefined;
|
|
22
|
+
handleCreateComment(comment: OnesEditorComment, local: boolean): void;
|
|
23
|
+
handleDeleteComment(commentId: string): void;
|
|
24
|
+
handleUpdateComment(comment: OnesEditorComment): void;
|
|
25
|
+
handleDocChanged: () => void;
|
|
26
|
+
private updateComments;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MobileCommentsList } from './mobile-comments-list';
|
package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OnesEditor } from '../../../../../@ones-editor/core';
|
|
2
|
+
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
3
|
+
import type { OnesEditorCommentsEvents, OnesEditorCommentsProvider } from '../../types';
|
|
4
|
+
interface MobileCommentsListEvents {
|
|
5
|
+
onCommentListClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare class MobileCommentsList extends TypedEmitter<MobileCommentsListEvents> implements OnesEditorCommentsEvents {
|
|
8
|
+
private editor;
|
|
9
|
+
private commentsProvider;
|
|
10
|
+
private root;
|
|
11
|
+
private list;
|
|
12
|
+
private mask;
|
|
13
|
+
private pullInfoContainer;
|
|
14
|
+
constructor(editor: OnesEditor, commentsProvider: OnesEditorCommentsProvider, parent: HTMLElement);
|
|
15
|
+
onCreateComment(commentId: string, local: boolean): void;
|
|
16
|
+
onDeleteComment(commentId: string, local: boolean): void;
|
|
17
|
+
onUpdateComment(commentId: string, local: boolean): void;
|
|
18
|
+
private handleRootClick;
|
|
19
|
+
private createPullInfo;
|
|
20
|
+
private showPullInfo;
|
|
21
|
+
private hidePullInfo;
|
|
22
|
+
private handleReachBottom;
|
|
23
|
+
private handleReachTop;
|
|
24
|
+
show: (groupId?: string) => void;
|
|
25
|
+
hide: () => void;
|
|
26
|
+
destroy(): void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -7,7 +7,6 @@ export declare enum GroupItemActions {
|
|
|
7
7
|
CommentItemCancel = "comment-item-cancel",
|
|
8
8
|
CommentItemDelete = "comment-item-delete",
|
|
9
9
|
CommentItemEdit = "comment-item-edit",
|
|
10
|
-
CommentItemCountClick = "comment-item-count-click",
|
|
11
10
|
QuickReply = "quick-reply",
|
|
12
11
|
QuickReplyOk = "quick-reply-ok",
|
|
13
12
|
QuickReplyCancel = "quick-reply-cancel"
|
|
@@ -15,4 +14,4 @@ export declare enum GroupItemActions {
|
|
|
15
14
|
export declare const GROUP_ITEM_ACTION_MARK = "group-item-action";
|
|
16
15
|
export declare const LAST_COMMENT_ITEM_MARK = "last-comment-item";
|
|
17
16
|
export declare const DISABLED_ACTION_CLS = "disabled";
|
|
18
|
-
export declare const
|
|
17
|
+
export declare const SWITCH_SCROLL_TIME = 500;
|
|
@@ -3,7 +3,6 @@ import './style.scss';
|
|
|
3
3
|
import './locale';
|
|
4
4
|
export * from './types';
|
|
5
5
|
export { OnesEditorCommentsRender } from './comments-render';
|
|
6
|
-
export { OnesEditorCommentInputHandler } from './comment-input-handler';
|
|
7
6
|
export { OnesEditorCommentPlaceholderHandler } from './comment-placeholder-handler';
|
|
8
7
|
export { OnesEditorComments };
|
|
9
8
|
export type { CommentItem } from './comment-item';
|