@ones-editor/editor 0.0.2 → 0.0.3-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.
Files changed (113) hide show
  1. package/@ones-editor/block-menu/src/block-menu/index.d.ts +2 -1
  2. package/@ones-editor/block-menu/src/block-menu/items/index.d.ts +2 -1
  3. package/@ones-editor/block-menu/src/block-menu/items/insert-block-items/index.d.ts +1 -1
  4. package/@ones-editor/block-menu/src/block-menu/items/text-styles/text-style-item.d.ts +17 -3
  5. package/@ones-editor/block-menu/src/locale/en-us.d.ts +5 -0
  6. package/@ones-editor/block-menu/src/locale/zh-cn.d.ts +5 -0
  7. package/@ones-editor/comments/src/block-hook/index.d.ts +3 -1
  8. package/@ones-editor/comments/src/comment-editor/index.d.ts +3 -5
  9. package/@ones-editor/comments/src/comment-input-handler/index.d.ts +2 -10
  10. package/@ones-editor/comments/src/comment-input-handler/input-handler.d.ts +11 -0
  11. package/@ones-editor/comments/src/comment-input-handler/quick-reply-input-handler.d.ts +7 -0
  12. package/@ones-editor/comments/src/comment-item/comment-item.d.ts +1 -0
  13. package/@ones-editor/comments/src/comment-item/index.d.ts +2 -0
  14. package/@ones-editor/comments/src/comment-item/mini-comment-item/index.d.ts +1 -0
  15. package/@ones-editor/comments/src/comment-item/mini-comment-item/mini-comment-item.d.ts +7 -0
  16. package/@ones-editor/comments/src/comment-item/mobile-comment-item/index.d.ts +1 -0
  17. package/@ones-editor/comments/src/comment-item/mobile-comment-item/mobile-comment-item.d.ts +18 -0
  18. package/@ones-editor/comments/src/comments/comments.d.ts +12 -4
  19. package/@ones-editor/comments/src/comments-button/index.d.ts +3 -1
  20. package/@ones-editor/comments/src/comments-helper/get-comments-from-doc.d.ts +3 -1
  21. package/@ones-editor/comments/src/comments-helper/get-mini-comment-from-doc.d.ts +7 -0
  22. package/@ones-editor/comments/src/comments-helper/utils.d.ts +3 -2
  23. package/@ones-editor/comments/src/comments-list/comments-list.d.ts +12 -6
  24. package/@ones-editor/comments/src/comments-list/group-item.d.ts +0 -3
  25. package/@ones-editor/comments/src/comments-list/group-list.d.ts +1 -1
  26. package/@ones-editor/comments/src/comments-list/handler.d.ts +0 -1
  27. package/@ones-editor/comments/src/comments-list/index.d.ts +2 -0
  28. package/@ones-editor/comments/src/comments-list/list-base.d.ts +3 -2
  29. package/@ones-editor/comments/src/comments-list/mini-comment/group-item.d.ts +16 -0
  30. package/@ones-editor/comments/src/comments-list/mini-comment/group-list.d.ts +16 -0
  31. package/@ones-editor/comments/src/comments-list/mini-comment/index.d.ts +1 -0
  32. package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +27 -0
  33. package/@ones-editor/comments/src/comments-list/mobile-comments-list/children-list.d.ts +17 -0
  34. package/@ones-editor/comments/src/comments-list/mobile-comments-list/group-item.d.ts +30 -0
  35. package/@ones-editor/comments/src/comments-list/mobile-comments-list/group-list.d.ts +29 -0
  36. package/@ones-editor/comments/src/comments-list/mobile-comments-list/index.d.ts +1 -0
  37. package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts +28 -0
  38. package/@ones-editor/comments/src/constant/index.d.ts +1 -2
  39. package/@ones-editor/comments/src/index.d.ts +0 -1
  40. package/@ones-editor/comments/src/locale/en-us.d.ts +1 -0
  41. package/@ones-editor/comments/src/locale/ja-jp.d.ts +1 -0
  42. package/@ones-editor/comments/src/locale/zh-cn.d.ts +1 -0
  43. package/@ones-editor/comments/src/text-comments/comments-command-provider.d.ts +3 -1
  44. package/@ones-editor/comments/src/types.d.ts +14 -14
  45. package/@ones-editor/core/src/common/index.d.ts +2 -2
  46. package/@ones-editor/core/src/core/doc/rich-text/insert-text.d.ts +2 -1
  47. package/@ones-editor/core/src/core/editor/editor-dom/dom-events.d.ts +3 -3
  48. package/@ones-editor/core/src/core/types.d.ts +18 -5
  49. package/@ones-editor/core/src/utils/file.d.ts +3 -0
  50. package/@ones-editor/core/src/utils/logger/index.d.ts +0 -3
  51. package/@ones-editor/drawio-embed/src/helper/default-style.d.ts +1 -0
  52. package/@ones-editor/drop-target/src/drop-indicator.d.ts +1 -0
  53. package/@ones-editor/drop-target/src/drop-target.d.ts +1 -1
  54. package/@ones-editor/drop-target/src/handlers/drag-file.d.ts +8 -0
  55. package/@ones-editor/e2e/cypress/support/commands.d.ts +19 -0
  56. package/@ones-editor/e2e/cypress/support/e2e.d.ts +1 -0
  57. package/@ones-editor/e2e/cypress.config.d.ts +3 -0
  58. package/@ones-editor/e2e/package.json +13 -0
  59. package/@ones-editor/e2e/src/block-menu/menu-list.cy.d.ts +0 -0
  60. package/@ones-editor/e2e/src/data.d.ts +106 -0
  61. package/@ones-editor/e2e/src/input-handlers/case.d.ts +10 -0
  62. package/@ones-editor/e2e/src/input-handlers/shortcut.cy.d.ts +1 -0
  63. package/@ones-editor/e2e/src/list-block/case.d.ts +8 -0
  64. package/@ones-editor/e2e/src/list-block/list.cy.d.ts +1 -0
  65. package/@ones-editor/e2e/src/toc/case.d.ts +5 -0
  66. package/@ones-editor/e2e/src/toc/toc.cy.d.ts +1 -0
  67. package/@ones-editor/embed-block-helper/src/block-properties/embed-block-properties.d.ts +1 -0
  68. package/@ones-editor/file/package.json +8 -0
  69. package/@ones-editor/file/src/file-box/index.d.ts +4 -0
  70. package/@ones-editor/file/src/file-embed/card/file-icon.d.ts +1 -0
  71. package/@ones-editor/file/src/file-embed/card/index.d.ts +6 -0
  72. package/@ones-editor/file/src/file-embed/download-file.d.ts +2 -0
  73. package/@ones-editor/file/src/file-embed/index.d.ts +4 -0
  74. package/@ones-editor/file/src/index.d.ts +3 -0
  75. package/@ones-editor/file/src/types.d.ts +22 -0
  76. package/@ones-editor/find-dialog/src/find-dialog.d.ts +0 -1
  77. package/@ones-editor/heading-collapse/src/doc-event/index.d.ts +1 -1
  78. package/@ones-editor/heading-collapse/src/heading-collapse-button/drop-handler.d.ts +1 -1
  79. package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +5 -1
  80. package/@ones-editor/image-embed/src/drag-drop/handle-drop.d.ts +1 -1
  81. package/@ones-editor/list-block/src/drop/index.d.ts +1 -1
  82. package/@ones-editor/list-block/src/lang/en-us.d.ts +3 -0
  83. package/@ones-editor/list-block/src/lang/zh-cn.d.ts +3 -0
  84. package/@ones-editor/list-block/src/list-notify.d.ts +2 -0
  85. package/@ones-editor/list-block/src/mindmap/index.d.ts +2 -0
  86. package/@ones-editor/mention/src/block-mention.d.ts +10 -0
  87. package/@ones-editor/mention/src/dom/mention-button.d.ts +2 -0
  88. package/@ones-editor/mention/src/index.d.ts +2 -1
  89. package/@ones-editor/table-block/src/table-block/border-bar/table-border-bar.d.ts +1 -0
  90. package/@ones-editor/table-block/src/table-block/border-bar/table-row-column-toolbar.d.ts +1 -0
  91. package/@ones-editor/table-block/src/table-block/close-toolbar.d.ts +2 -0
  92. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  93. package/@ones-editor/ui/src/icons/index.d.ts +1 -14
  94. package/@ones-editor/ui/src/index.d.ts +5 -2
  95. package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +2 -4
  96. package/@ones-editor/ui/src/quick-menu/index.d.ts +1 -6
  97. package/@ones-editor/ui/src/quick-menu/insert-empty-block.d.ts +4 -2
  98. package/@ones-editor/ui/src/quick-menu/types.d.ts +24 -1
  99. package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +0 -1
  100. package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +1 -0
  101. package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -1
  102. package/@ones-editor/ui-base/src/dialog/manual-close-dialog.d.ts +1 -0
  103. package/@ones-editor/ui-base/src/icons/index.d.ts +36 -12
  104. package/@ones-editor/ui-base/src/index.d.ts +1 -0
  105. package/@ones-editor/{ui/src/quick-menu/item-shortcuts.d.ts → ui-base/src/item-shortcuts/index.d.ts} +0 -0
  106. package/@ones-editor/ui-base/src/locale/en-us.d.ts +3 -0
  107. package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +3 -0
  108. package/dist/comments/comments-provider.d.ts +2 -2
  109. package/dist/comments/create-comment-editor.d.ts +1 -4
  110. package/dist/index.js +572 -65039
  111. package/dist/types.d.ts +5 -2
  112. package/package.json +5 -2
  113. package/@ones-editor/core/src/utils/logger/fake-process.d.ts +0 -1
@@ -1,9 +1,11 @@
1
1
  import { BlockCommandItem, BlockCommandItemWithSource, BlockElement, CommandParams, CommandResult, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../@ones-editor/core';
2
2
  import { OnesEditorCommentsProvider } from '../types';
3
+ import type { OnesEditorComments } from '../comments';
3
4
  export default class CommentsCommandProvider implements OnesEditorCommandProvider {
4
5
  private provider;
6
+ private editorComments;
5
7
  id: string;
6
- constructor(provider: OnesEditorCommentsProvider);
8
+ constructor(provider: OnesEditorCommentsProvider, editorComments: OnesEditorComments);
7
9
  getAvailableCommands(editor: OnesEditor, block: BlockElement, range: SelectionRange): BlockCommandItem[];
8
10
  executeRangeCommand(editor: OnesEditor, range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams, result: CommandResult): boolean;
9
11
  }
@@ -1,7 +1,5 @@
1
1
  import { DocObject, LocalDoc, OnesEditor, OnesEditorComment } from '../../../@ones-editor/core';
2
2
  import { AuthMessage } from '../../../@ones-editor/sharedb-doc';
3
- import type { CommentGroupItem } from './comments-list/group-item';
4
- import type { CommentItem } from './comment-item';
5
3
  export type CommentData = {
6
4
  [p in string]: unknown;
7
5
  };
@@ -10,23 +8,13 @@ export interface OnesEditorCommentOptions {
10
8
  disableReply?: boolean;
11
9
  disableEdit?: boolean;
12
10
  onUpdateLayout?: (editor: OnesEditor, data: CommentData) => void;
11
+ pullThreshold?: number;
13
12
  }
14
13
  export interface OnesEditorCommentsEvents {
15
14
  onCreateComment: (commentId: string, local: boolean) => void;
16
15
  onDeleteComment: (commentId: string, local: boolean) => void;
17
16
  onUpdateComment: (commentId: string, local: boolean) => void;
18
17
  }
19
- export type CreateQuickReplyEditorOption = {
20
- type: 'quick-reply';
21
- groupItem: CommentGroupItem;
22
- };
23
- export type CreateCommentItemEditorOption = {
24
- type: 'comment-item';
25
- commentItem: CommentItem;
26
- groupItem: CommentGroupItem;
27
- comment: OnesEditorComment;
28
- };
29
- export type CreateCommentEditorOption = CreateQuickReplyEditorOption | CreateCommentItemEditorOption;
30
18
  export interface OnesEditorCommentsProvider {
31
19
  getAuth: () => AuthMessage;
32
20
  getComments: () => OnesEditorComment[];
@@ -37,7 +25,7 @@ export interface OnesEditorCommentsProvider {
37
25
  localUpdateComment: (comment: OnesEditorComment, doc: DocObject) => void;
38
26
  addListener: (callback: OnesEditorCommentsEvents) => void;
39
27
  removeListener: (callback: OnesEditorCommentsEvents) => void;
40
- createCommentEditor: (parent: HTMLElement, doc: LocalDoc, op: CreateCommentEditorOption) => OnesEditor;
28
+ createCommentEditor: (parent: HTMLElement, doc: LocalDoc) => OnesEditor;
41
29
  }
42
30
  export interface CommentWithChildren extends OnesEditorComment {
43
31
  children: OnesEditorComment[];
@@ -47,3 +35,15 @@ export interface ItemBase {
47
35
  comment: OnesEditorComment;
48
36
  destroy: () => void;
49
37
  }
38
+ export type BlockId = string;
39
+ export type CommentIds = Set<string>;
40
+ export type MiniCommentGroupsMap = Map<BlockId, {
41
+ firstComment: OnesEditorComment;
42
+ commentIds: CommentIds;
43
+ }>;
44
+ export interface MiniCommentGroup {
45
+ blockId: BlockId;
46
+ firstComment: OnesEditorComment;
47
+ commentIds: CommentIds;
48
+ }
49
+ export type MiniCommentGroups = MiniCommentGroup[];
@@ -1,6 +1,6 @@
1
1
  import genId from '../utils/gen-id';
2
2
  import SimpleCache from '../utils/simple-cache';
3
- import { getLogger, chalk } from '../utils/logger';
3
+ import { getLogger } from '../utils/logger';
4
4
  export { genId };
5
5
  export { SimpleCache };
6
- export { getLogger, chalk };
6
+ export { getLogger };
@@ -1,3 +1,4 @@
1
- import { DocBlockText, DocBlockTextActions, DocBlockTextAttributes } from '../doc';
1
+ import { DocBlockText, DocBlockTextActions, DocBlockTextAttributes, DocBox, DocBlockTextOp } from '../doc';
2
2
  export declare function insertText(richText: DocBlockText, offset: number, text: string | DocBlockText, attributes: DocBlockTextAttributes | null): DocBlockText;
3
+ export declare function createBoxOp(boxData: DocBox): DocBlockTextOp;
3
4
  export declare function createInsertOps(offset: number, text: string | DocBlockText, attributes: DocBlockTextAttributes | null): DocBlockTextActions;
@@ -1,5 +1,5 @@
1
1
  import { OnesEditor } from '../../types';
2
- export type DomEventCallback = (editor: OnesEditor, event: Event, data: unknown) => void;
2
+ export type DomEventCallback<T = Event> = (editor: OnesEditor, event: T, data: unknown) => void;
3
3
  declare class DomEventHandler {
4
4
  editor: OnesEditor;
5
5
  dom: Element | Document | Window;
@@ -12,10 +12,10 @@ declare class DomEventHandler {
12
12
  }
13
13
  export declare class EditorDomEvents {
14
14
  private editor;
15
- handlers: Map<Window | Element | Document, DomEventHandler[]>;
15
+ handlers: Map<Element | Document | Window, DomEventHandler[]>;
16
16
  constructor(editor: OnesEditor);
17
17
  destroy(): void;
18
- addEventListener(element: Element | Document | Window, eventName: string, eventHandler: DomEventCallback, data?: unknown): void;
18
+ addEventListener<T = Event>(element: Element | Document | Window, eventName: string, eventHandler: DomEventCallback<T>, data?: unknown): void;
19
19
  removeEventListener(element: Element | Document | Window | null, eventName: string | null, eventHandler: DomEventCallback): void;
20
20
  removeAllListeners(element: Element | Document | Window, eventName?: string): void;
21
21
  }
@@ -49,12 +49,21 @@ export interface ComplexBlockPosition {
49
49
  isSimple: () => false;
50
50
  }
51
51
  export type BlockPosition = SimpleBlockPosition | ComplexBlockPosition;
52
+ export interface BoxCommands {
53
+ group: string;
54
+ commands: CommandItem[];
55
+ executeCommand: (editor: OnesEditor, block: BlockElement, box: BoxElement, item: CommandItem) => unknown;
56
+ }
57
+ export interface BoxProperties {
58
+ boxCommands?: Record<string, BoxCommands>;
59
+ }
52
60
  export interface Box {
53
61
  boxType: string;
54
62
  updateBoxContent: (editor: OnesEditor, boxElement: BoxElement, boxContent: BoxContentElement, boxData: DocBox) => void;
55
63
  convertFrom?: (editor: OnesEditor, text: string) => DocBox | null;
56
64
  handleClickBox?: (editor: OnesEditor, box: BoxElement, event: MouseEvent) => void;
57
65
  toStandardText?: (editor: OnesEditor, box: DocBox) => Promise<DocBlockText | undefined>;
66
+ getBoxProperties?: (editor: OnesEditor, boxElement: BoxElement) => BoxProperties;
58
67
  }
59
68
  export interface Insertion {
60
69
  insertionType: string;
@@ -79,8 +88,8 @@ export interface Embed {
79
88
  getOptions?: (editor: OnesEditor) => EmbedOptions;
80
89
  handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
81
90
  handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocEmbedBlock) => boolean;
82
- handleDropOver?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, x: number, y: number) => DropInsertPos | undefined;
83
- handleDrop?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
91
+ handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | undefined;
92
+ handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
84
93
  convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
85
94
  offset: number;
86
95
  data?: DocBlockAttributes;
@@ -113,6 +122,7 @@ export interface CommandItem {
113
122
  icon?: string;
114
123
  childrenType?: 'menu' | 'toolbar';
115
124
  children?: CommandItem[];
125
+ childrenMenuId?: string;
116
126
  data?: unknown;
117
127
  group?: string;
118
128
  groupOrder?: number;
@@ -120,6 +130,7 @@ export interface CommandItem {
120
130
  manualShowChildren?: boolean;
121
131
  childrenPlacement?: CommandItemChildrenPlacement;
122
132
  childrenOffset?: [number, number];
133
+ shortcut?: string;
123
134
  setCloseable?: (closeable: Closeable) => void;
124
135
  beforePopup?: (parent: unknown) => void;
125
136
  }
@@ -188,12 +199,13 @@ export interface Block {
188
199
  clearSelection: (editor: OnesEditor) => void;
189
200
  getBlockProperties?: (editor: OnesEditor, block: BlockElement) => BlockProperties;
190
201
  getOptions?: (editor: OnesEditor) => BlockOptions;
202
+ notify?: (editor: OnesEditor, command: string, params?: unknown) => void;
191
203
  handleBlockElementUpdated?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => void;
192
204
  handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
193
205
  handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
194
206
  handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
195
- handleDropOver?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, x: number, y: number) => DropInsertPos | undefined;
196
- handleDrop?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
207
+ handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | undefined;
208
+ handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
197
209
  getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
198
210
  getMinWidth?: (editor: OnesEditor, block: BlockElement) => number | undefined;
199
211
  convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
@@ -409,7 +421,7 @@ export interface CloneBlockResultInfo {
409
421
  blockIdMap: Map<string, string>;
410
422
  }
411
423
  export interface OnesEditorDomEvents extends OnesEditorCustom {
412
- addEventListener: (element: Element | Document | Window, eventName: string, eventHandler: (editor: OnesEditor, event: Event) => void) => void;
424
+ addEventListener: <T = Event>(element: Element | Document | Window, eventName: string, eventHandler: (editor: OnesEditor, event: T) => void) => void;
413
425
  removeEventListener: (element: Element | Document | Window | null, eventName: string | null, eventHandler: (editor: OnesEditor, event: Event) => void) => void;
414
426
  removeAllListeners: (element: Element | Document | Window, eventName?: string) => void;
415
427
  }
@@ -445,6 +457,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
445
457
  getCustom: <T extends OnesEditorCustom>(name: string) => T;
446
458
  replaceCustom: <T extends OnesEditorCustom>(name: string, newCustom: T) => T;
447
459
  findCustom: <T extends OnesEditorCustom>(name: string) => T | null;
460
+ findCustomByType: <T extends OnesEditorCustom>(className: new (editor: OnesEditor) => T) => T | null;
448
461
  destroyCustom: (name: string) => void;
449
462
  getComponentOptions: <T>(name: string) => T | null;
450
463
  registerLocalEvents: (events: EditorDocLocalActionCallbacks) => void;
@@ -4,4 +4,7 @@ interface SelectFileOptions {
4
4
  export declare function selectFile<T extends SelectFileOptions = SelectFileOptions>(accept: string, options?: T): Promise<T extends {
5
5
  multiple: true;
6
6
  } ? File[] : File>;
7
+ export declare function isDraggingFiles(v: unknown): v is File[];
8
+ export declare function getFileExt(file: string): string;
9
+ export declare function requestDownload(downloadUrl: string, fileName?: string): void;
7
10
  export {};
@@ -1,5 +1,3 @@
1
- import './fake-process';
2
- declare const customChalk: import("chalk").Chalk;
3
1
  export declare class Logger {
4
2
  private category;
5
3
  private times;
@@ -17,4 +15,3 @@ export declare class Logger {
17
15
  static setExtParams(params: string): void;
18
16
  }
19
17
  export declare function getLogger(category: string): Logger;
20
- export { customChalk as chalk };
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_STYLES = "\n<mxStylesheet>\n<add as=\"defaultVertex\">\n<add as=\"shape\" value=\"label\"/>\n<add as=\"perimeter\" value=\"rectanglePerimeter\"/>\n<add as=\"fontSize\" value=\"12\"/>\n<add as=\"fontFamily\" value=\"Helvetica\"/>\n<add as=\"align\" value=\"center\"/>\n<add as=\"verticalAlign\" value=\"middle\"/>\n<add as=\"fillColor\" value=\"#ffffff\"/>\n<add as=\"strokeColor\" value=\"#000000\"/>\n<add as=\"fontColor\" value=\"#000000\"/>\n</add>\n<add as=\"defaultEdge\">\n<add as=\"shape\" value=\"connector\"/>\n<add as=\"labelBackgroundColor\" value=\"#ffffff\"/>\n<add as=\"endArrow\" value=\"classic\"/>\n<add as=\"fontSize\" value=\"11\"/>\n<add as=\"fontFamily\" value=\"Helvetica\"/>\n<add as=\"align\" value=\"center\"/>\n<add as=\"verticalAlign\" value=\"middle\"/>\n<add as=\"rounded\" value=\"1\"/>\n<add as=\"strokeColor\" value=\"#000000\"/>\n<add as=\"fontColor\" value=\"#000000\"/>\n</add>\n<add as=\"text\">\n<add as=\"fillColor\" value=\"none\"/>\n<add as=\"gradientColor\" value=\"none\"/>\n<add as=\"strokeColor\" value=\"none\"/>\n<add as=\"align\" value=\"left\"/>\n<add as=\"verticalAlign\" value=\"top\"/>\n</add>\n<add as=\"edgeLabel\" extend=\"text\">\n<add as=\"labelBackgroundColor\" value=\"#ffffff\"/>\n<add as=\"fontSize\" value=\"11\"/>\n</add>\n<add as=\"label\">\n<add as=\"fontStyle\" value=\"1\"/>\n<add as=\"align\" value=\"left\"/>\n<add as=\"verticalAlign\" value=\"middle\"/>\n<add as=\"spacing\" value=\"2\"/>\n<add as=\"spacingLeft\" value=\"52\"/>\n<add as=\"imageWidth\" value=\"42\"/>\n<add as=\"imageHeight\" value=\"42\"/>\n<add as=\"rounded\" value=\"1\"/>\n</add>\n<add as=\"icon\" extend=\"label\">\n<add as=\"align\" value=\"center\"/>\n<add as=\"imageAlign\" value=\"center\"/>\n<add as=\"verticalLabelPosition\" value=\"bottom\"/>\n<add as=\"verticalAlign\" value=\"top\"/>\n<add as=\"spacingTop\" value=\"4\"/>\n<add as=\"labelBackgroundColor\" value=\"#ffffff\"/>\n<add as=\"spacing\" value=\"0\"/>\n<add as=\"spacingLeft\" value=\"0\"/>\n<add as=\"spacingTop\" value=\"6\"/>\n<add as=\"fontStyle\" value=\"0\"/>\n<add as=\"imageWidth\" value=\"48\"/>\n<add as=\"imageHeight\" value=\"48\"/>\n</add>\n<add as=\"swimlane\">\n<add as=\"shape\" value=\"swimlane\"/>\n<add as=\"fontSize\" value=\"12\"/>\n<add as=\"fontStyle\" value=\"1\"/>\n<add as=\"startSize\" value=\"23\"/>\n</add>\n<add as=\"group\">\n<add as=\"verticalAlign\" value=\"top\"/>\n<add as=\"fillColor\" value=\"none\"/>\n<add as=\"strokeColor\" value=\"none\"/>\n<add as=\"gradientColor\" value=\"none\"/>\n<add as=\"pointerEvents\" value=\"0\"/>\n</add>\n<add as=\"ellipse\">\n<add as=\"shape\" value=\"ellipse\"/>\n<add as=\"perimeter\" value=\"ellipsePerimeter\"/>\n</add>\n<add as=\"rhombus\">\n<add as=\"shape\" value=\"rhombus\"/>\n<add as=\"perimeter\" value=\"rhombusPerimeter\"/>\n</add>\n<add as=\"triangle\">\n<add as=\"shape\" value=\"triangle\"/>\n<add as=\"perimeter\" value=\"trianglePerimeter\"/>\n</add>\n<add as=\"line\">\n<add as=\"shape\" value=\"line\"/>\n<add as=\"strokeWidth\" value=\"4\"/>\n<add as=\"labelBackgroundColor\" value=\"#ffffff\"/>\n<add as=\"verticalAlign\" value=\"top\"/>\n<add as=\"spacingTop\" value=\"8\"/>\n</add>\n<add as=\"image\">\n<add as=\"shape\" value=\"image\"/>\n<add as=\"labelBackgroundColor\" value=\"white\"/>\n<add as=\"verticalAlign\" value=\"top\"/>\n<add as=\"verticalLabelPosition\" value=\"bottom\"/>\n</add>\n<add as=\"roundImage\" extend=\"image\">\n<add as=\"perimeter\" value=\"ellipsePerimeter\"/>\n</add>\n<add as=\"rhombusImage\" extend=\"image\">\n<add as=\"perimeter\" value=\"rhombusPerimeter\"/>\n</add>\n<add as=\"arrow\">\n<add as=\"shape\" value=\"arrow\"/>\n<add as=\"edgeStyle\" value=\"none\"/>\n<add as=\"fillColor\" value=\"#ffffff\"/>\n</add>\n</mxStylesheet>\n";
@@ -1,4 +1,5 @@
1
1
  import { BlockElement, DropInsertPos, OnesEditor } from '../../../@ones-editor/core';
2
+ export declare const INDICATOR_SIZE = 2;
2
3
  interface DropTarget {
3
4
  block: BlockElement;
4
5
  insertPos: DropInsertPos;
@@ -1,7 +1,7 @@
1
1
  import { BlockElement, ContainerElement, OnesEditor } from '../../../@ones-editor/core';
2
2
  import DropIndicator from './drop-indicator';
3
3
  export interface DropHandler {
4
- handleDrop: (editor: OnesEditor, draggedBlock: BlockElement, targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
4
+ handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean | undefined;
5
5
  }
6
6
  export default class OnesEditorDropTarget {
7
7
  private editor;
@@ -0,0 +1,8 @@
1
+ import { OnesEditor, ContainerElement, BlockElement } from '../../../../@ones-editor/core';
2
+ import type { DropHandler } from '../drop-target';
3
+ export declare class DropFileHandler implements DropHandler {
4
+ private editor;
5
+ constructor(editor: OnesEditor);
6
+ private getEmbedClassByFile;
7
+ handleDrop: (editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number) => boolean;
8
+ }
@@ -0,0 +1,19 @@
1
+ /// <reference types="cypress" />
2
+ /// <reference types="cypress" />
3
+ declare namespace Cypress {
4
+ interface Chainable {
5
+ getBlocksByType: (blockType: string) => Chainable<Element>;
6
+ clearAllNoteByKeyboard: () => void;
7
+ getBlockContent: () => Chainable<Element>;
8
+ getBlockContentByBlockId: (blockId: string) => Chainable<Element>;
9
+ cacheBlock: (blockType: string, block: BlockCache) => Chainable<JQuery>;
10
+ createHeadingByShortcut: (blockId: string, level: number, title: string) => Chainable<Element>;
11
+ }
12
+ }
13
+ interface BlockCache {
14
+ TitleBlockId: string;
15
+ BlockCacheMap: Map<string, string[]>;
16
+ setBlock(blockType: string, blockId: string): void;
17
+ getLastBlockId(blockType: string): string;
18
+ setTitleBlockId(blockId: string): void;
19
+ }
@@ -0,0 +1 @@
1
+ import './commands';
@@ -0,0 +1,3 @@
1
+ /// <reference types="cypress" />
2
+ declare const _default: Cypress.ConfigOptions<any>;
3
+ export default _default;
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@ones-editor/e2e",
3
+ "private": "true",
4
+ "version": "1.0.0",
5
+ "main": "index.ts",
6
+ "license": "MIT",
7
+ "scripts": {
8
+ "test": "cypress open",
9
+ "e2e-headless": "node ./scripts/e2e-run-tests.js",
10
+ "test-mobile": "cypress open --config viewportWidth=390,viewportHeight=844"
11
+ },
12
+ "types": "src/index.d.ts"
13
+ }
@@ -0,0 +1,106 @@
1
+ export declare class BlockCache {
2
+ TitleBlockId: string;
3
+ BlockCacheMap: Map<string, string[]>;
4
+ constructor();
5
+ setBlock(blockType: string, blockId: string): Map<string, string[]>;
6
+ getLastBlockId(blockType: string): string;
7
+ setTitleBlockId(blockId: string): void;
8
+ }
9
+ export declare class TestTextStyleData {
10
+ inputStr: string;
11
+ checkSpanIndex: number;
12
+ expectedClassValue: string;
13
+ expectedTextValue: string;
14
+ constructor(inputStr: string, checkSpanIndex: number, expectedClassValue: string, expectedTextValue: string);
15
+ }
16
+ export declare class TestHeadingStyleData {
17
+ key: string;
18
+ inputStr: string;
19
+ expected: string;
20
+ expectedPlaceholder: string;
21
+ constructor(key: string, inputStr: string, expected: string, expectedPlaceholder: string);
22
+ }
23
+ export declare const docTestBlockStyle = "block-style";
24
+ export declare const blockCache: BlockCache;
25
+ export declare const TEXT_BLOCK_ATTRIBUTE: {
26
+ PLACE_HOLDER: {
27
+ KEY: string;
28
+ DEFAULT: string;
29
+ HEADING1: string;
30
+ HEADING2: string;
31
+ HEADING3: string;
32
+ HEADING4: string;
33
+ HEADING5: string;
34
+ HEADING6: string;
35
+ HEADING7: string;
36
+ HEADING8: string;
37
+ };
38
+ STYLE_HEADING: {
39
+ KEY: string;
40
+ };
41
+ STYLE_QUOTE: {
42
+ QUOTECLASSNAME: string;
43
+ };
44
+ STYLE_TEXT: {
45
+ BoldStyleClass: string;
46
+ ItalicStyleClass: string;
47
+ CodeStyleClass: string;
48
+ StrikeThrough: string;
49
+ };
50
+ };
51
+ export declare const LIST_BLOCK_ATTRIBUTE: {
52
+ PLACE_HOLDER: {
53
+ KEY: string;
54
+ LIST: string;
55
+ };
56
+ LEVEL: string;
57
+ START: string;
58
+ GROUP_ID: string;
59
+ LISTTYPE: string;
60
+ VALUE: {
61
+ LISTTYPE_ORDERED: string;
62
+ LISTTYPE_UNORDERED: string;
63
+ LISTTYPE_CHECKED: string;
64
+ LISTTYPE_UNCHECKED: string;
65
+ };
66
+ };
67
+ export declare const CODE_BLOCK_ATTRIBUTE: {
68
+ DATA_LANGUAGE: string;
69
+ LANGUAGE_PLAIN: string;
70
+ LANGUAGE_GOLANG: string;
71
+ LANGUAGE_JAVA: string;
72
+ LANGUAGE_JAVASCRIPT: string;
73
+ LANGUAGE_HTML_XML: string;
74
+ };
75
+ export declare const EMBED_BLOCK_ATTRIBUTE: {
76
+ HR: {
77
+ TYPE: string;
78
+ CLASS: string;
79
+ };
80
+ MERMAID: {
81
+ TYPE: string;
82
+ EMPTY_TIPS: string;
83
+ EMPTY_REPLACE: string;
84
+ ARIA_EXPANDED: string;
85
+ IMAGE_CLASS: string;
86
+ };
87
+ PLANTUML: {
88
+ TYPE: string;
89
+ EMPTY_TIPS: string;
90
+ EMPTY_REPLACE: string;
91
+ ARIA_EXPANDED: string;
92
+ IMAGE_CLASS: string;
93
+ };
94
+ TOC: {
95
+ TYPE: string;
96
+ CONTAINER_CLASS: string;
97
+ EMPTY_REPLACE: string;
98
+ EMPTY_CLASS: string;
99
+ };
100
+ };
101
+ export declare class TocNode {
102
+ children: TocNode[];
103
+ title: string;
104
+ level: number;
105
+ block: string;
106
+ }
@@ -0,0 +1,10 @@
1
+ import { TestHeadingStyleData, TestTextStyleData } from '../data';
2
+ export declare class ShortcutCase {
3
+ testHeadingStyleShortcut: (data: TestHeadingStyleData) => () => void;
4
+ testShortcutMethod: (data: TestTextStyleData) => () => void;
5
+ testQuoteBlockStyleShortcut: () => () => void;
6
+ testEmberStyleBrShortcut: () => () => void;
7
+ testEmberStyleMermaidPlantumlShortcut: (input: string, embedType: string, emptyReplace: string) => () => void;
8
+ testListBlockStyleShortcut: (input: string, expected: string, start: number, level: number) => () => void;
9
+ testCodeBlockShortcut: (input: string, expected: string) => () => void;
10
+ }
@@ -0,0 +1 @@
1
+ import 'cypress-real-events';
@@ -0,0 +1,8 @@
1
+ import 'cypress-real-events';
2
+ export declare class ListCase {
3
+ OrderListCreate: () => () => void;
4
+ OrderListAddLevel: () => () => void;
5
+ OrderListFirstNodeAddLevel: () => () => void;
6
+ OrderListSoluction4: () => () => void;
7
+ OrderListPalceholder: () => () => void;
8
+ }
@@ -0,0 +1 @@
1
+ import 'cypress-real-events';
@@ -0,0 +1,5 @@
1
+ import { TocNode } from '../data';
2
+ export declare class TocCase {
3
+ empty: (input: string) => () => void;
4
+ notempty: (input: string, tocNode: TocNode[]) => () => void;
5
+ }
@@ -0,0 +1 @@
1
+ import 'cypress-real-events';
@@ -5,6 +5,7 @@ export interface StandardEmbedBlockProperties<T = PresetCommandId> {
5
5
  extCommands?: CommandItem[];
6
6
  handleExecuteCommand?: (editor: OnesEditor, block: BlockElement, item: CommandItem) => boolean;
7
7
  }
8
+ export declare function addCommentToBlock(editor: OnesEditor, block: BlockElement): boolean;
8
9
  export declare class StandardEmbedBlockCommands<T = PresetCommandId> implements BlockCommands {
9
10
  protected editor: OnesEditor;
10
11
  protected properties?: StandardEmbedBlockProperties<T> | undefined;
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@ones-editor/file",
3
+ "version": "1.0.0",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "types": "src/index.d.ts"
8
+ }
@@ -0,0 +1,4 @@
1
+ import { Box } from '../../../../@ones-editor/core';
2
+ import './file-box-style.scss';
3
+ declare const FileBox: Box;
4
+ export default FileBox;
@@ -0,0 +1 @@
1
+ export declare function getFileIcon(fileName: string, fileType: string): string;
@@ -0,0 +1,6 @@
1
+ import { BlockContentElement } from '../../../../../@ones-editor/core';
2
+ import { FileEmbedData } from '../../types';
3
+ export declare function renderFileCard(content: BlockContentElement, data: FileEmbedData): {
4
+ card: HTMLDivElement;
5
+ downloadButton: HTMLButtonElement;
6
+ };
@@ -0,0 +1,2 @@
1
+ import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
2
+ export declare function downloadFile(editor: OnesEditor, block: BlockElement): void;
@@ -0,0 +1,4 @@
1
+ import type { Embed } from '../../../../@ones-editor/core';
2
+ import './file-card-style.scss';
3
+ declare const FileEmbed: Embed;
4
+ export default FileEmbed;
@@ -0,0 +1,3 @@
1
+ import FileBox from './file-box';
2
+ import FileEmbed from './file-embed';
3
+ export { FileBox, FileEmbed };
@@ -0,0 +1,22 @@
1
+ import { BlockElement, BoxElement, DocBox, DocEmbedData, OnesEditor } from '../../../@ones-editor/core';
2
+ export interface FileData {
3
+ src: string;
4
+ fileName: string;
5
+ fileSize: number;
6
+ fileType: string;
7
+ }
8
+ export interface FileBoxData extends DocBox, FileData {
9
+ }
10
+ export declare enum FilePreviewType {
11
+ Card = "card",
12
+ Preview = "preview"
13
+ }
14
+ export interface FileEmbedData extends DocEmbedData, FileData {
15
+ width?: number;
16
+ height?: number;
17
+ previewType?: FilePreviewType;
18
+ }
19
+ export interface FileOptions {
20
+ onClick?: (editor: OnesEditor, elem: BlockElement | BoxElement, event: MouseEvent) => void;
21
+ onDownloadFile?: (editor: OnesEditor, data: FileData) => void;
22
+ }
@@ -1,4 +1,3 @@
1
- /// <reference types="lodash" />
2
1
  import { ManualCloseDialog } from '../../../@ones-editor/ui-base';
3
2
  import { OnesEditor } from '../../../@ones-editor/core';
4
3
  export default class FindDialog {
@@ -4,5 +4,5 @@ export declare class HeadingBlockDocEvents implements OnesEditorDocCallbacks {
4
4
  constructor(editor: OnesEditor);
5
5
  onInsertBlock(containerId: string, blockIndex: number, blockData: DocBlock, local: boolean): void;
6
6
  onUpdateBlockData(containerId: string, blockIndex: number, delta: DocBlockDelta, local: boolean): void;
7
- updateBlockIfNeeded(blockId: string): void;
7
+ updateBlockIfNeeded(blockId: string, delta?: DocBlockDelta): void;
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import { DropHandler } from '../../../../@ones-editor/drop-target';
2
2
  import { OnesEditor, BlockElement, ContainerElement } from '../../../../@ones-editor/core';
3
3
  export default class HeadingBlockDropHandler implements DropHandler {
4
- handleDrop(editor: OnesEditor, draggedBlock: BlockElement, targetContainer: ContainerElement, blockIndex: number): boolean | undefined;
4
+ handleDrop(editor: OnesEditor, dragData: BlockElement | File[], targetContainer: ContainerElement, blockIndex: number): boolean | undefined;
5
5
  }
@@ -1,3 +1,7 @@
1
1
  import { BlockElement, DragObject, OnesEditor } from '../../../../@ones-editor/core';
2
2
  import { ImageDragInsertPos } from './types';
3
- export declare function handleDropOver(editor: OnesEditor, block: BlockElement, dragObject: DragObject, x: number, y: number): ImageDragInsertPos | undefined;
3
+ export declare function getDragInsertPos(editor: OnesEditor, block: BlockElement, images: HTMLElement[], x: number, y?: number): {
4
+ rect: DOMRect;
5
+ data: number;
6
+ };
7
+ export declare function handleDropOver(editor: OnesEditor, block: BlockElement, dragObject: DragObject | null, x: number, y: number): ImageDragInsertPos | undefined;
@@ -1,2 +1,2 @@
1
1
  import { BlockElement, DragObject, DropInsertPos, DropOptions, OnesEditor } from '../../../../@ones-editor/core';
2
- export declare function handleDrop(editor: OnesEditor, block: BlockElement, dragObject: DragObject, insertPos: DropInsertPos, options: DropOptions): boolean | undefined;
2
+ export declare function handleDrop(editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions): boolean | undefined;
@@ -1,2 +1,2 @@
1
1
  import { OnesEditor, BlockElement, DragObject, DropInsertPos, DropOptions } from '../../../../@ones-editor/core';
2
- export declare function handleListDrop(editor: OnesEditor, block: BlockElement, dragObject: DragObject, insertPos: DropInsertPos, options: DropOptions): boolean;
2
+ export declare function handleListDrop(editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions): boolean;
@@ -6,6 +6,9 @@ declare const _default: {
6
6
  restartList: string;
7
7
  changeNumber: string;
8
8
  numberLabel: string;
9
+ mention: {
10
+ tooltip: string;
11
+ };
9
12
  };
10
13
  mindmap: {
11
14
  viewAsMindMap: string;
@@ -6,6 +6,9 @@ declare const _default: {
6
6
  restartList: string;
7
7
  changeNumber: string;
8
8
  numberLabel: string;
9
+ mention: {
10
+ tooltip: string;
11
+ };
9
12
  };
10
13
  mindmap: {
11
14
  viewAsMindMap: string;
@@ -0,0 +1,2 @@
1
+ import { OnesEditor } from '../../../@ones-editor/core';
2
+ export declare function notify(editor: OnesEditor, command: string, params?: unknown): void;
@@ -5,9 +5,11 @@ export default class OnesEditorListMindmap implements OnesEditorCustom {
5
5
  toMindmapButton: HTMLButtonElement;
6
6
  currentBlock: BlockElement | null;
7
7
  constructor(editor: OnesEditor);
8
+ static get(editor: OnesEditor): OnesEditorListMindmap | null;
8
9
  destroy(): void;
9
10
  handleHoveringBlock: (block: BlockElement | null) => void;
10
11
  handleMouseEnter: () => void;
11
12
  handleMouseLeave: () => void;
12
13
  handleClick: () => void;
14
+ hide(): void;
13
15
  }
@@ -0,0 +1,10 @@
1
+ import type { OnesEditorCustom, OnesEditor } from '../../../@ones-editor/core';
2
+ export default class OnesEditorBlockMention implements OnesEditorCustom {
3
+ private editor;
4
+ mentionButton: HTMLButtonElement;
5
+ constructor(editor: OnesEditor);
6
+ private shouldBlockShowMention;
7
+ private handleHoveringBlock;
8
+ private handleMouseDown;
9
+ destroy: () => void;
10
+ }
@@ -0,0 +1,2 @@
1
+ import type { OnesEditor } from '../../../../@ones-editor/core';
2
+ export declare function createMentionButton(editor: OnesEditor): HTMLButtonElement;
@@ -1,5 +1,6 @@
1
1
  import OnesEditorMention from './mention';
2
2
  import MentionBox from './mention-box';
3
+ import OnesEditorBlockMention from './block-mention';
3
4
  import './mention-style.scss';
4
- export { OnesEditorMention, MentionBox };
5
+ export { OnesEditorMention, MentionBox, OnesEditorBlockMention };
5
6
  export * from './types';