@ones-editor/editor 0.0.3-beta.5 → 0.0.3-beta.51

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 (191) hide show
  1. package/@ones-editor/block-locker/src/i18n/en-US.d.ts +8 -0
  2. package/@ones-editor/block-locker/src/i18n/index.d.ts +1 -0
  3. package/@ones-editor/block-locker/src/i18n/zh-CN.d.ts +8 -0
  4. package/@ones-editor/block-locker/src/index.d.ts +2 -0
  5. package/@ones-editor/block-menu/src/block-menu/index.d.ts +1 -0
  6. package/@ones-editor/block-menu/src/block-menu/items/insert-block-items/index.d.ts +1 -1
  7. package/@ones-editor/block-menu/src/block-menu-button/drag-drop/find-preview-element.d.ts +1 -1
  8. package/@ones-editor/code-block/src/code-block/caption/caption-input-handler.d.ts +2 -2
  9. package/@ones-editor/code-block/src/code-block/code-caret.d.ts +7 -0
  10. package/@ones-editor/code-block/src/code-block/code-copy.d.ts +4 -0
  11. package/@ones-editor/code-block/src/code-block/create-empty-code.d.ts +2 -2
  12. package/@ones-editor/code-block/src/code-block/index.d.ts +3 -1
  13. package/@ones-editor/code-block/src/code-block/settings/index.d.ts +3 -0
  14. package/@ones-editor/comments/src/actions/add-comment-to-block.d.ts +3 -2
  15. package/@ones-editor/comments/src/actions/add-comment-to-text-block.d.ts +2 -1
  16. package/@ones-editor/comments/src/actions/editor-add-comment.d.ts +2 -0
  17. package/@ones-editor/comments/src/comment-item/comment-item.d.ts +1 -0
  18. package/@ones-editor/comments/src/comments/comments.d.ts +4 -3
  19. package/@ones-editor/comments/src/comments-helper/utils.d.ts +1 -1
  20. package/@ones-editor/comments/src/comments-list/arrange-items.d.ts +1 -1
  21. package/@ones-editor/comments/src/comments-list/comments-list.d.ts +0 -8
  22. package/@ones-editor/comments/src/comments-list/group-item.d.ts +1 -0
  23. package/@ones-editor/comments/src/comments-list/group-list.d.ts +1 -1
  24. package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +0 -3
  25. package/@ones-editor/comments/src/index.d.ts +1 -0
  26. package/@ones-editor/comments/src/types.d.ts +10 -4
  27. package/@ones-editor/core/src/core/blocks/block-anchor/create-block-anchor.d.ts +1 -0
  28. package/@ones-editor/core/src/core/blocks/text-blocks/index.d.ts +1 -0
  29. package/@ones-editor/core/src/core/blocks/text-blocks/text-block/to-markdown.d.ts +3 -0
  30. package/@ones-editor/core/src/core/blocks/text-blocks/text-block/to-plain-html.d.ts +3 -0
  31. package/@ones-editor/core/src/core/blocks/text-blocks/text-block/to-plain-text.d.ts +3 -0
  32. package/@ones-editor/core/src/core/composition/clipboard/copy.d.ts +2 -2
  33. package/@ones-editor/core/src/core/composition/editor-input.d.ts +3 -0
  34. package/@ones-editor/core/src/core/converter/block-to-doc.d.ts +1 -1
  35. package/@ones-editor/core/src/core/converter/block-to-html.d.ts +2 -2
  36. package/@ones-editor/core/src/core/converter/block-to-markdown.d.ts +2 -2
  37. package/@ones-editor/core/src/core/converter/block-to-text.d.ts +2 -2
  38. package/@ones-editor/core/src/core/converter/selected-block-to-doc.d.ts +3 -1
  39. package/@ones-editor/core/src/core/doc/doc.d.ts +6 -2
  40. package/@ones-editor/core/src/core/doc/rich-text/insert-text.d.ts +2 -1
  41. package/@ones-editor/core/src/core/editor/actions/auto-insert-block.d.ts +2 -2
  42. package/@ones-editor/core/src/core/editor/actions/break-text-block.d.ts +2 -0
  43. package/@ones-editor/core/src/core/editor/actions/delete-block-text.d.ts +2 -2
  44. package/@ones-editor/core/src/core/editor/actions/focus-to-end.d.ts +0 -1
  45. package/@ones-editor/core/src/core/editor/actions/insert-block.d.ts +2 -2
  46. package/@ones-editor/core/src/core/editor/actions/insert-text.d.ts +2 -2
  47. package/@ones-editor/core/src/core/editor/editor-dom/dom-events.d.ts +3 -3
  48. package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +4 -3
  49. package/@ones-editor/core/src/core/index.d.ts +1 -0
  50. package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +3 -0
  51. package/@ones-editor/core/src/core/input-handler/remove-quoted.d.ts +2 -0
  52. package/@ones-editor/core/src/core/selection/actions/index.d.ts +2 -2
  53. package/@ones-editor/core/src/core/selection/actions/select-all.d.ts +3 -1
  54. package/@ones-editor/core/src/core/selection/actions/select-block.d.ts +2 -0
  55. package/@ones-editor/core/src/core/selection/actions/word-offset.d.ts +1 -1
  56. package/@ones-editor/core/src/core/selection/editor-selection.d.ts +3 -2
  57. package/@ones-editor/core/src/core/types.d.ts +35 -15
  58. package/@ones-editor/core/src/i18n/i18n.d.ts +36 -0
  59. package/@ones-editor/core/src/local-doc/index.d.ts +6 -2
  60. package/@ones-editor/core/src/utils/dom-scroll.d.ts +3 -1
  61. package/@ones-editor/core/src/utils/file.d.ts +3 -0
  62. package/@ones-editor/core/src/utils/logger/index.d.ts +1 -0
  63. package/@ones-editor/drop-target/src/drop-indicator.d.ts +1 -0
  64. package/@ones-editor/drop-target/src/drop-target.d.ts +1 -1
  65. package/@ones-editor/drop-target/src/handlers/drag-file.d.ts +8 -0
  66. package/@ones-editor/e2e/cypress/support/commands.d.ts +25 -0
  67. package/@ones-editor/e2e/cypress/support/e2e.d.ts +1 -0
  68. package/@ones-editor/e2e/cypress.config.d.ts +3 -0
  69. package/@ones-editor/e2e/package.json +13 -0
  70. package/@ones-editor/e2e/src/block-menu/case.d.ts +17 -0
  71. package/@ones-editor/e2e/src/block-menu/menu.cy.d.ts +1 -0
  72. package/@ones-editor/e2e/src/data.d.ts +131 -0
  73. package/@ones-editor/e2e/src/input-handlers/case.d.ts +10 -0
  74. package/@ones-editor/e2e/src/input-handlers/shortcut.cy.d.ts +1 -0
  75. package/@ones-editor/e2e/src/list-block/case.d.ts +8 -0
  76. package/@ones-editor/e2e/src/list-block/list.cy.d.ts +1 -0
  77. package/@ones-editor/e2e/src/toc/case.d.ts +5 -0
  78. package/@ones-editor/e2e/src/toc/toc.cy.d.ts +1 -0
  79. package/@ones-editor/embed-block-helper/src/block-properties/embed-block-properties.d.ts +1 -0
  80. package/@ones-editor/file/package.json +8 -0
  81. package/@ones-editor/file/src/file-box/index.d.ts +4 -0
  82. package/@ones-editor/file/src/file-embed/card/file-icon.d.ts +1 -0
  83. package/@ones-editor/file/src/file-embed/card/index.d.ts +6 -0
  84. package/@ones-editor/file/src/file-embed/download-file.d.ts +2 -0
  85. package/@ones-editor/file/src/file-embed/index.d.ts +4 -0
  86. package/@ones-editor/file/src/index.d.ts +3 -0
  87. package/@ones-editor/file/src/types.d.ts +22 -0
  88. package/@ones-editor/find-dialog/src/find-dialog.d.ts +0 -1
  89. package/@ones-editor/graph-embed/src/helper/graph-base.d.ts +1 -0
  90. package/@ones-editor/heading-collapse/src/heading-collapse-button/drop-handler.d.ts +1 -1
  91. package/@ones-editor/image-embed/package.json +2 -1
  92. package/@ones-editor/image-embed/src/drag-drop/drag-handler.d.ts +4 -0
  93. package/@ones-editor/image-embed/src/drag-drop/handle-drop-over.d.ts +5 -1
  94. package/@ones-editor/image-embed/src/drag-drop/handle-drop.d.ts +1 -1
  95. package/@ones-editor/image-embed/src/empty-image-converter.d.ts +5 -0
  96. package/@ones-editor/image-embed/src/index.d.ts +2 -1
  97. package/@ones-editor/input-handlers/src/enforce-with-document-title/types.d.ts +1 -0
  98. package/@ones-editor/input-handlers/src/i18n/en-us.d.ts +1 -0
  99. package/@ones-editor/input-handlers/src/i18n/zh-cn.d.ts +1 -0
  100. package/@ones-editor/input-handlers/src/markdown-shortcuts/table-converter.d.ts +2 -0
  101. package/@ones-editor/list-block/src/converter/convert-list-to.d.ts +2 -0
  102. package/@ones-editor/list-block/src/converter/convert-to-list.d.ts +14 -0
  103. package/@ones-editor/list-block/src/converter/index.d.ts +2 -14
  104. package/@ones-editor/list-block/src/drop/index.d.ts +1 -1
  105. package/@ones-editor/list-block/src/index.d.ts +3 -2
  106. package/@ones-editor/list-block/src/level/change-multi-levels.d.ts +2 -0
  107. package/@ones-editor/list-block/src/level/decrease-level.d.ts +1 -0
  108. package/@ones-editor/list-block/src/types.d.ts +2 -1
  109. package/@ones-editor/markdown-to-doc/src/markdown-to-doc.d.ts +1 -0
  110. package/@ones-editor/markdown-to-doc/src/tokens/block-tokens/latex.d.ts +4 -0
  111. package/@ones-editor/mathjax/package.json +3 -0
  112. package/@ones-editor/mathjax/src/index.d.ts +2 -1
  113. package/@ones-editor/mathjax/src/mathjax-box/convert-mathjax.d.ts +5 -0
  114. package/@ones-editor/mathjax/src/mathjax-box/mathjax-editor.d.ts +2 -2
  115. package/@ones-editor/media-embed/src/core/media-embed.d.ts +3 -1
  116. package/@ones-editor/mention/src/mention.d.ts +1 -0
  117. package/@ones-editor/paste-handler/src/paste-handler.d.ts +1 -1
  118. package/@ones-editor/paste-special/src/paste-special-handler.d.ts +2 -2
  119. package/@ones-editor/scroll-container/src/dom-utils.d.ts +9 -0
  120. package/@ones-editor/scroll-container/src/index.d.ts +8 -18
  121. package/@ones-editor/scroll-container/src/observer/container-resize-observer.d.ts +2 -1
  122. package/@ones-editor/scroll-container/src/observer/locating-resize-observer.d.ts +13 -0
  123. package/@ones-editor/scroll-container/src/scroll-listener.d.ts +3 -0
  124. package/@ones-editor/scroll-container/src/types.d.ts +1 -0
  125. package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +3 -3
  126. package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +3 -3
  127. package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +6 -1
  128. package/@ones-editor/sharedb-doc/src/index.d.ts +1 -0
  129. package/@ones-editor/sharedb-doc/src/types.d.ts +3 -2
  130. package/@ones-editor/table-block/src/locale/en-us.d.ts +5 -0
  131. package/@ones-editor/table-block/src/locale/zh-cn.d.ts +5 -0
  132. package/@ones-editor/table-block/src/table-block/convert-table-to.d.ts +2 -0
  133. package/@ones-editor/table-block/src/table-block/doc-table-data.d.ts +1 -1
  134. package/@ones-editor/table-block/src/table-block/table-creator/index.d.ts +1 -1
  135. package/@ones-editor/table-block/src/table-block/table-resize/resize-gripper.d.ts +1 -1
  136. package/@ones-editor/table-block/src/table-block/table-scroll-events.d.ts +1 -0
  137. package/@ones-editor/table-block/src/types.d.ts +2 -0
  138. package/@ones-editor/templates/package.json +9 -0
  139. package/@ones-editor/templates/src/index.d.ts +4 -0
  140. package/@ones-editor/templates/src/locale/en-us.d.ts +9 -0
  141. package/@ones-editor/templates/src/locale/index.d.ts +1 -0
  142. package/@ones-editor/templates/src/locale/zh-cn.d.ts +9 -0
  143. package/@ones-editor/templates/src/templates/select-template.d.ts +7 -0
  144. package/@ones-editor/templates/src/templates/types.d.ts +14 -0
  145. package/@ones-editor/text-commands/src/locale/en-us.d.ts +1 -0
  146. package/@ones-editor/text-commands/src/locale/zh-cn.d.ts +1 -0
  147. package/@ones-editor/toc/src/heading-scroll/index.d.ts +22 -0
  148. package/@ones-editor/toc/src/heading-scroll/utils.d.ts +7 -0
  149. package/@ones-editor/toc/src/index.d.ts +1 -0
  150. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  151. package/@ones-editor/ui/src/index.d.ts +3 -1
  152. package/@ones-editor/ui/src/locale/en-us.d.ts +2 -0
  153. package/@ones-editor/ui/src/locale/zh-cn.d.ts +2 -0
  154. package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +10 -12
  155. package/@ones-editor/ui/src/quick-menu/index.d.ts +1 -6
  156. package/@ones-editor/ui/src/quick-menu/inline-box-items.d.ts +1 -0
  157. package/@ones-editor/ui/src/quick-menu/insert-empty-block.d.ts +4 -2
  158. package/@ones-editor/ui/src/quick-menu/types.d.ts +24 -1
  159. package/@ones-editor/ui/src/toolbar/box-only.d.ts +2 -0
  160. package/@ones-editor/ui/src/toolbar/commands/paragraph.d.ts +1 -0
  161. package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +2 -2
  162. package/@ones-editor/ui/src/tooltips/index.d.ts +4 -0
  163. package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +2 -1
  164. package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +1 -1
  165. package/@ones-editor/ui-base/src/auto-suggest/index.d.ts +2 -1
  166. package/@ones-editor/ui-base/src/auto-suggest/should-focus-to-editor.d.ts +2 -0
  167. package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +2 -1
  168. package/@ones-editor/ui-base/src/command-bar/types.d.ts +5 -0
  169. package/@ones-editor/ui-base/src/dialog/index.d.ts +1 -0
  170. package/@ones-editor/ui-base/src/dialog/manual-close-dialog.d.ts +1 -1
  171. package/@ones-editor/ui-base/src/dialog/types.d.ts +4 -0
  172. package/@ones-editor/ui-base/src/input/create-input.d.ts +1 -0
  173. package/@ones-editor/ui-base/src/item-shortcuts/index.d.ts +1 -0
  174. package/@ones-editor/ui-base/src/list/drop-down-filterable-list.d.ts +2 -2
  175. package/@ones-editor/ui-base/src/locale/en-us.d.ts +1 -0
  176. package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +1 -0
  177. package/@ones-editor/versions/src/types.d.ts +1 -0
  178. package/@ones-editor/versions/src/version-dialog/index.d.ts +3 -1
  179. package/@ones-editor/webpage-embed/src/ui/dialog.d.ts +2 -2
  180. package/@ones-editor/webpage-embed/src/webpage-embed/webpage-items.d.ts +2 -0
  181. package/dist/comments/create-comment-editor.d.ts +4 -7
  182. package/dist/comments/local-doc-comments-provider.d.ts +18 -0
  183. package/dist/comments/{comments-provider.d.ts → sharedb-doc-comments-provider.d.ts} +3 -6
  184. package/dist/index.d.ts +15 -3
  185. package/dist/index.js +244 -220
  186. package/dist/lang/en-us.d.ts +13 -0
  187. package/dist/lang/index.d.ts +1 -0
  188. package/dist/lang/zh-cn.d.ts +13 -0
  189. package/dist/types.d.ts +25 -4
  190. package/package.json +6 -1
  191. package/@ones-editor/list-block/src/command/covert-to-list.d.ts +0 -3
@@ -1,5 +1,5 @@
1
1
  import { TypedEmitter } from 'tiny-typed-emitter';
2
- import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, OnesEditorDoc, OnesEditorDocRange } from './doc';
2
+ import { DocBlock, DocBlockAttributes, DocBlocks, DocBlockText, DocBlockTextAttributes, DocBox, DocEmbedBlock, DocEmbedData, DocInsertion, DocObject, InsertBlockOptions, OnesEditorDoc, OnesEditorDocRange } from './doc';
3
3
  export type ContainerElement = HTMLDivElement & {
4
4
  __neverUse: 'ContainerElement';
5
5
  };
@@ -49,12 +49,22 @@ 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;
64
+ convertTo?: (editor: OnesEditor, boxData: DocBox, doc: DocObject, type: 'text' | 'html' | 'markdown') => string;
56
65
  handleClickBox?: (editor: OnesEditor, box: BoxElement, event: MouseEvent) => void;
57
66
  toStandardText?: (editor: OnesEditor, box: DocBox) => Promise<DocBlockText | undefined>;
67
+ getBoxProperties?: (editor: OnesEditor, boxElement: BoxElement) => BoxProperties;
58
68
  }
59
69
  export interface Insertion {
60
70
  insertionType: string;
@@ -79,8 +89,8 @@ export interface Embed {
79
89
  getOptions?: (editor: OnesEditor) => EmbedOptions;
80
90
  handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
81
91
  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;
92
+ handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | undefined;
93
+ handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
84
94
  convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
85
95
  offset: number;
86
96
  data?: DocBlockAttributes;
@@ -109,7 +119,7 @@ export interface CommandItem {
109
119
  value?: string;
110
120
  order?: number;
111
121
  type?: CommandItemType;
112
- element?: HTMLElement;
122
+ element?: HTMLElement | ((item: CommandItem) => HTMLElement);
113
123
  icon?: string;
114
124
  childrenType?: 'menu' | 'toolbar';
115
125
  children?: CommandItem[];
@@ -121,6 +131,9 @@ export interface CommandItem {
121
131
  manualShowChildren?: boolean;
122
132
  childrenPlacement?: CommandItemChildrenPlacement;
123
133
  childrenOffset?: [number, number];
134
+ subText?: string;
135
+ defaultCheckedChildren?: string[];
136
+ disableTooltip?: boolean;
124
137
  setCloseable?: (closeable: Closeable) => void;
125
138
  beforePopup?: (parent: unknown) => void;
126
139
  }
@@ -194,8 +207,8 @@ export interface Block {
194
207
  handleContainerResized?: (editor: OnesEditor, block: BlockElement) => void;
195
208
  handleDeleteBlock?: (editor: OnesEditor, block: BlockElement, local: boolean, options: DeleteBlockEventOptions) => void;
196
209
  handleUpdateBlock?: (editor: OnesEditor, block: BlockElement, blockData: DocBlock) => boolean;
197
- handleDropOver?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, x: number, y: number) => DropInsertPos | undefined;
198
- handleDrop?: (editor: OnesEditor, block: BlockElement, dragObject: DragObject, insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
210
+ handleDropOver?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | null, x: number, y: number) => DropInsertPos | undefined;
211
+ handleDrop?: (editor: OnesEditor, block: BlockElement, dragData: DragObject | File[], insertPos: DropInsertPos, options: DropOptions) => boolean | undefined;
199
212
  getClientRects?: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => DOMRect[];
200
213
  getMinWidth?: (editor: OnesEditor, block: BlockElement) => number | undefined;
201
214
  convertFrom?: (editor: OnesEditor, srcBlock: BlockElement, options: {
@@ -203,7 +216,7 @@ export interface Block {
203
216
  data?: DocBlockAttributes;
204
217
  }) => ConvertBlockResult | null;
205
218
  selectionToDoc?: (editor: OnesEditor, selectedBlock: SelectedBlock) => DocObject;
206
- convertTo?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, type: 'text' | 'html' | 'markdown') => string;
219
+ convertTo?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject, type: 'text' | 'html' | 'markdown', path: BlockPath) => string;
207
220
  toStandardDoc?: (editor: OnesEditor, blockData: DocBlock, doc: DocObject) => Promise<DocObject | undefined>;
208
221
  getBlockStyles?: (editor: OnesEditor, block: BlockElement) => BlockStyles;
209
222
  blockToDoc?: (srcDoc: DocObject, srcBlockData: DocBlock, childBlockConverter: (srcDoc: DocObject, srcBlockData: DocBlock) => DocObject) => DocObject;
@@ -334,9 +347,10 @@ export interface OnesEditorDataConverters {
334
347
  export interface BreakTextOptions {
335
348
  forceInsertAfter?: boolean;
336
349
  newBlockData?: DocBlock;
350
+ copyBlockAttributes?: boolean;
337
351
  }
338
352
  export interface OnesEditorEvents {
339
- 'docChanged': (editor: OnesEditor) => void;
353
+ 'docChanged': (editor: OnesEditor, local: boolean) => void;
340
354
  'readonlyChanged': (editor: OnesEditor) => void;
341
355
  'selectionChanged': (editor: OnesEditor) => void;
342
356
  'focusBlockChanged': (editor: OnesEditor, newBlock: BlockElement | null, oldBlock: BlockElement | null) => void;
@@ -411,10 +425,11 @@ export interface CloneBlockResultInfo {
411
425
  blockIdMap: Map<string, string>;
412
426
  }
413
427
  export interface OnesEditorDomEvents extends OnesEditorCustom {
414
- addEventListener: (element: Element | Document | Window, eventName: string, eventHandler: (editor: OnesEditor, event: Event) => void) => void;
428
+ addEventListener: <T = Event>(element: Element | Document | Window, eventName: string, eventHandler: (editor: OnesEditor, event: T) => void) => void;
415
429
  removeEventListener: (element: Element | Document | Window | null, eventName: string | null, eventHandler: (editor: OnesEditor, event: Event) => void) => void;
416
430
  removeAllListeners: (element: Element | Document | Window, eventName?: string) => void;
417
431
  }
432
+ export type InsertTextOptions = InsertBlockOptions;
418
433
  export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
419
434
  readonly parent: HTMLElement;
420
435
  readonly rootElement: HTMLDivElement;
@@ -479,7 +494,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
479
494
  contains: (node: Node) => boolean;
480
495
  getSelectedText: () => string;
481
496
  clearSelectedContents: () => void;
482
- insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange) => BlockElement;
497
+ insertBlock: (containerId: string, blockIndex: number, blockData: DocBlock, newRange?: OnesEditorDocRange, options?: InsertBlockOptions) => BlockElement;
483
498
  insertEmbed: (containerId: string, blockIndex: number, embedType: string, embedData: DocEmbedData, newRange?: OnesEditorDocRange) => BlockElement;
484
499
  deleteBlock: (block: BlockElement, newRange?: OnesEditorDocRange) => void;
485
500
  getTextPosition: () => BlockTextPosition;
@@ -490,8 +505,8 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
490
505
  getBlockText: (block: BlockElement) => DocBlockText;
491
506
  setBlockText: (block: BlockElement, text: DocBlockText) => void;
492
507
  getBoxData: (box: BoxElement) => DocBox;
493
- deleteTextFromBlock: (block: BlockElement, offset: number, count: number) => number;
494
- insertTextToBlock: (block: BlockElement, offset: number, text: string | DocBlockText) => DocBlockText;
508
+ deleteTextFromBlock: (block: BlockElement, offset: number, count: number, options?: InsertTextOptions) => number;
509
+ insertTextToBlock: (block: BlockElement, offset: number, text: string | DocBlockText, options?: InsertTextOptions) => DocBlockText;
495
510
  insertBoxToBlock: (block: BlockElement, offset: number, boxData: DocBox) => DocBlockText;
496
511
  mergeTextBlock: (block1: BlockElement, block2: BlockElement, options?: {
497
512
  focus?: boolean;
@@ -499,6 +514,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
499
514
  breakTextBlock: (block: BlockElement, offset: number, options?: BreakTextOptions) => BlockElement;
500
515
  insertTextBlock: (text?: string | DocBlockText, containerId?: string, blockIndex?: number, options?: {
501
516
  newRange?: OnesEditorDocRange;
517
+ insertBlockOptions?: InsertBlockOptions;
502
518
  }) => BlockElement;
503
519
  insertDoc: (block: BlockElement, offset: number, doc: DocObject, cloneDocResult?: CloneBlockResultInfo) => void;
504
520
  insertDocAt: (container: ContainerElement, blockIndex: number, doc: DocObject, cloneDocResult?: CloneBlockResultInfo) => BlockElement[];
@@ -520,7 +536,7 @@ export interface OnesEditorSelection {
520
536
  readonly startBlock: BlockElement;
521
537
  readonly endBlock: BlockElement;
522
538
  setSelection: (anchor: BlockPosition, focus?: BlockPosition, options?: ChangeSelectionOptions) => SelectionRange;
523
- setRange: (range: SelectionRange) => SelectionRange;
539
+ setRange: (range: SelectionRange, options?: ChangeSelectionOptions) => SelectionRange;
524
540
  selectBlock: (block: BlockElement, start: number, end?: number) => void;
525
541
  updateSelection: (old: SelectionRange | null) => void;
526
542
  updateLastCaretRect: () => void;
@@ -528,6 +544,7 @@ export interface OnesEditorSelection {
528
544
  getAnchorPos: () => BlockPosition;
529
545
  getFocusedPos: () => BlockPosition;
530
546
  scrollIntoView: () => void;
547
+ to: (type: 'text' | 'markdown' | 'html') => string;
531
548
  }
532
549
  export type RemoteChangeType = 'UpdateBlockText' | 'UpdateBlockData' | 'InsertBlock' | 'DeleteBlock' | 'InsertChildContainer' | 'DeleteChildContainer';
533
550
  export interface OnesEditorInput {
@@ -541,6 +558,7 @@ export interface OnesEditorInput {
541
558
  handleKeyDown: (event: KeyboardEvent) => void;
542
559
  handleChanged: (action: OnesEditorUndoAction) => void;
543
560
  handleRemoteChanged: (type: RemoteChangeType) => void;
561
+ handlePasteText: (text: string) => void;
544
562
  addHandler: (handler: OnesEditorInputHandler) => void;
545
563
  removeHandler: (handler: OnesEditorInputHandler) => void;
546
564
  defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
@@ -564,8 +582,9 @@ export interface OnesEditorInputHandler {
564
582
  handleAfterInsertText?: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => boolean;
565
583
  handleBeforeKeyDown?: (editor: OnesEditor, event: KeyboardEvent) => boolean;
566
584
  handleAfterKeyDown?: (editor: OnesEditor, event: KeyboardEvent) => boolean;
567
- handleBeforePaste?: (editor: OnesEditor, event: ClipboardEvent, doc: OnesEditorDocs) => Promise<boolean>;
568
- handleAfterPaste?: (editor: OnesEditor, event: ClipboardEvent, doc: OnesEditorDocs) => Promise<boolean>;
585
+ handleBeforeCopy?: (editor: OnesEditor, event: ClipboardEvent, doc: DocObject) => DocObject | boolean | undefined;
586
+ handleBeforePaste?: (editor: OnesEditor, event: ClipboardEvent | null, doc: OnesEditorDocs) => Promise<boolean>;
587
+ handleAfterPaste?: (editor: OnesEditor, event: ClipboardEvent | null, doc: OnesEditorDocs) => Promise<boolean>;
569
588
  handleBeforePasteDoc?: (editor: OnesEditor, doc: DocObject) => Promise<boolean>;
570
589
  handleAfterPasteDoc?: (editor: OnesEditor, doc: DocObject) => Promise<boolean>;
571
590
  handleChanged?: (editor: OnesEditor, action: OnesEditorUndoAction) => void;
@@ -579,6 +598,7 @@ export interface OnesEditorBlocks {
579
598
  getBlockClass: (type: string) => Block;
580
599
  createBlock: (path: BlockPath, container: ContainerElement, block: DocBlock) => BlockElement;
581
600
  forEach: (callback: (blockClass: Block) => void) => void;
601
+ hasBlock: (type: string) => boolean;
582
602
  }
583
603
  export interface OnesEditorEmbeds {
584
604
  registerEmbedClass: (embedClass: Embed) => void;
@@ -1,3 +1,39 @@
1
+ declare const langs: {
2
+ 'en-US': {
3
+ name: string;
4
+ date: {
5
+ dateFromFuture: string;
6
+ dateJustNow: string;
7
+ dateYesterday: string;
8
+ dateMinutesAgo: string;
9
+ date1HourAgo: string;
10
+ dateHoursAgo: string;
11
+ dateDaysAgo: string;
12
+ dateWeeksAgo: string;
13
+ };
14
+ common: {
15
+ cancel: string;
16
+ };
17
+ };
18
+ 'zh-CN': {
19
+ name: string;
20
+ date: {
21
+ dateFromFuture: string;
22
+ dateJustNow: string;
23
+ dateYesterday: string;
24
+ dateMinutesAgo: string;
25
+ date1HourAgo: string;
26
+ dateHoursAgo: string;
27
+ dateDaysAgo: string;
28
+ dateWeeksAgo: string;
29
+ };
30
+ common: {
31
+ cancel: string;
32
+ };
33
+ };
34
+ };
1
35
  export declare function setLang(lang?: string | null | undefined): void;
2
36
  export declare function mergeLang(l: any): void;
3
37
  export declare function t(key: string, args?: Record<string, string>): string;
38
+ export type LANGS = keyof typeof langs;
39
+ export {};
@@ -1,9 +1,12 @@
1
- import { DocBlock, DocBlockDelta, DocBlockText, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorUser, UploadResourceOptions, UploadResourceResult } from '../core/doc';
1
+ import { DocBlock, DocBlockDelta, DocBlockText, OnesEditorDocServerMeta, DocBlockTextActions, DocObject, OnesEditorDoc, OnesEditorDocCallbacks, OnesEditorUser, UploadResourceOptions, UploadResourceResult } from '../core/doc';
2
2
  import { EventCallbacks } from '../utils';
3
3
  import { RemoteUsers } from '../users';
4
4
  export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> implements OnesEditorDoc {
5
5
  doc: DocObject;
6
- constructor(doc?: DocObject);
6
+ serviceUrl: string;
7
+ constructor(doc: DocObject | null, options?: {
8
+ serverUrl?: string;
9
+ });
7
10
  beginBatchUpdate(): number;
8
11
  endBatchUpdate(): number;
9
12
  toJSON(): DocObject;
@@ -20,6 +23,7 @@ export declare class LocalDoc extends EventCallbacks<OnesEditorDocCallbacks> imp
20
23
  buildResourceUrl(src: string): string;
21
24
  request<T>(url: string, opt?: any): Promise<T>;
22
25
  broadcastMessage(data: unknown): void;
26
+ getServerMeta(): OnesEditorDocServerMeta;
23
27
  getUser(): OnesEditorUser;
24
28
  getRemoteUsers(): RemoteUsers;
25
29
  setDoc(doc: DocObject): void;
@@ -1,3 +1,5 @@
1
- export declare function getScrollContainer(element: HTMLElement): HTMLElement;
1
+ export declare function getScrollContainer(element: HTMLElement, options?: {
2
+ horizontal?: boolean;
3
+ }): HTMLElement;
2
4
  export declare function disablePageScroll(id: string): void;
3
5
  export declare function enablePageScroll(id: string): 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,6 +1,7 @@
1
1
  export declare class Logger {
2
2
  private category;
3
3
  private times;
4
+ static debugMode: boolean;
4
5
  constructor(category: string);
5
6
  private _log;
6
7
  log(msg: string | object, context?: string): void;
@@ -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,25 @@
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
+ getMenuItemByDataId: (dataId: string) => Chainable<Element>;
12
+ clickBlockMenuButton: (dataId: string) => Chainable<JQuery>;
13
+ getBlockMenuButton: (dataId: string) => Chainable<JQuery>;
14
+ checkTextStyle: (blockId: string, checkSpanIndex: number, expectedClassValue: string, expectedTextValue: string) => Chainable<JQuery>;
15
+ checkTextColer: (blockId: string, checkSpanIndex: number, expectedClassValue: string, expectBlockAttr: string, expectBlockAttrValue: string, expectedTextValue: string) => Chainable<JQuery>;
16
+ checkHeadingStyle: (blockId: string, expectBlockAttr: string, expectBlockAttrValue: string) => Chainable<JQuery>;
17
+ }
18
+ }
19
+ interface BlockCache {
20
+ TitleBlockId: string;
21
+ BlockCacheMap: Map<string, string[]>;
22
+ setBlock(blockType: string, blockId: string): void;
23
+ getLastBlockId(blockType: string): string;
24
+ setTitleBlockId(blockId: string): void;
25
+ }
@@ -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,17 @@
1
+ import { BaseAssertion } from '../data';
2
+ declare class Item {
3
+ id: string;
4
+ name: string;
5
+ shortcut: string;
6
+ constructor(id: string, name: string, shortcut: string);
7
+ }
8
+ export declare const items: Map<string, Item>;
9
+ export declare class BlockMenuCase {
10
+ /**
11
+ * howToOpen : clickToOpen | shortcutToOpen:default
12
+ * @returns null
13
+ */
14
+ checkBlockMenuItem: (howToOpen: string, block: string) => () => void;
15
+ checkBlockMenuButton: (button: string, assertData: BaseAssertion) => () => void;
16
+ }
17
+ export {};
@@ -0,0 +1 @@
1
+ import 'cypress-real-events';
@@ -0,0 +1,131 @@
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 BaseAssertion {
10
+ }
11
+ export declare class TestHeadingStyleData extends BaseAssertion {
12
+ key: string;
13
+ inputStr: string;
14
+ expected: string;
15
+ expectedPlaceholder: string;
16
+ constructor(key: string, inputStr: string, expected: string, expectedPlaceholder: string);
17
+ }
18
+ export declare class CheckBlockData extends BaseAssertion {
19
+ expectBlockAttr: string;
20
+ expectBlockAttrValue: string;
21
+ constructor(expectBlockAttr: string, expectBlockAttrValue: string);
22
+ }
23
+ export declare class CheckTextStyleData extends BaseAssertion {
24
+ checkSpanIndex: number;
25
+ expectedClassValue: string;
26
+ expectedTextValue: string;
27
+ constructor(checkSpanIndex: number, expectedClassValue: string, expectedTextValue: string);
28
+ }
29
+ export declare class TestTextStyleData extends CheckTextStyleData {
30
+ inputStr: string;
31
+ constructor(inputStr: string, checkSpanIndex: number, expectedClassValue: string, expectedTextValue: string);
32
+ }
33
+ export declare class CheckTextColerData extends CheckTextStyleData {
34
+ attr: string;
35
+ attrValue: string;
36
+ constructor(attr: string, attrValue: string, checkSpanIndex: number, expectedClassValue: string, expectedTextValue: string);
37
+ }
38
+ export declare const docTestBlockStyle = "block-style";
39
+ export declare const blockCache: BlockCache;
40
+ export declare const TEXT_BLOCK_ATTRIBUTE: {
41
+ PLACE_HOLDER: {
42
+ KEY: string;
43
+ DEFAULT: string;
44
+ HEADING1: string;
45
+ HEADING2: string;
46
+ HEADING3: string;
47
+ HEADING4: string;
48
+ HEADING5: string;
49
+ HEADING6: string;
50
+ HEADING7: string;
51
+ HEADING8: string;
52
+ };
53
+ STYLE_HEADING: {
54
+ KEY: string;
55
+ };
56
+ STYLE_QUOTE: {
57
+ QUOTECLASSNAME: string;
58
+ };
59
+ STYLE_ALIGN: {
60
+ ALIGN: string;
61
+ };
62
+ STYLE_COLER: {
63
+ TC_COLER: string;
64
+ BC_CLOER: string;
65
+ };
66
+ STYLE_TEXT: {
67
+ BoldStyleClass: string;
68
+ BoldAndItalicStyleClass: string;
69
+ ItalicStyleClass: string;
70
+ CodeStyleClass: string;
71
+ StrikeThrough: string;
72
+ SubscriptCLass: string;
73
+ SuperscriptClass: string;
74
+ };
75
+ };
76
+ export declare const LIST_BLOCK_ATTRIBUTE: {
77
+ PLACE_HOLDER: {
78
+ KEY: string;
79
+ LIST: string;
80
+ };
81
+ LEVEL: string;
82
+ START: string;
83
+ GROUP_ID: string;
84
+ LISTTYPE: string;
85
+ VALUE: {
86
+ LISTTYPE_ORDERED: string;
87
+ LISTTYPE_UNORDERED: string;
88
+ LISTTYPE_CHECKED: string;
89
+ LISTTYPE_UNCHECKED: string;
90
+ };
91
+ };
92
+ export declare const CODE_BLOCK_ATTRIBUTE: {
93
+ DATA_LANGUAGE: string;
94
+ LANGUAGE_PLAIN: string;
95
+ LANGUAGE_GOLANG: string;
96
+ LANGUAGE_JAVA: string;
97
+ LANGUAGE_JAVASCRIPT: string;
98
+ LANGUAGE_HTML_XML: string;
99
+ };
100
+ export declare const EMBED_BLOCK_ATTRIBUTE: {
101
+ HR: {
102
+ TYPE: string;
103
+ CLASS: string;
104
+ };
105
+ MERMAID: {
106
+ TYPE: string;
107
+ EMPTY_TIPS: string;
108
+ EMPTY_REPLACE: string;
109
+ ARIA_EXPANDED: string;
110
+ IMAGE_CLASS: string;
111
+ };
112
+ PLANTUML: {
113
+ TYPE: string;
114
+ EMPTY_TIPS: string;
115
+ EMPTY_REPLACE: string;
116
+ ARIA_EXPANDED: string;
117
+ IMAGE_CLASS: string;
118
+ };
119
+ TOC: {
120
+ TYPE: string;
121
+ CONTAINER_CLASS: string;
122
+ EMPTY_REPLACE: string;
123
+ EMPTY_CLASS: string;
124
+ };
125
+ };
126
+ export declare class TocNode {
127
+ children: TocNode[];
128
+ title: string;
129
+ level: number;
130
+ block: string;
131
+ }
@@ -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 {
@@ -6,6 +6,7 @@ export default abstract class GraphBase {
6
6
  private codeEmbedDataKey;
7
7
  protected editor: OnesEditor;
8
8
  logger: Logger;
9
+ editing: boolean;
9
10
  constructor(editor: OnesEditor, graphType: GraphType, codeEmbedDataKey: string);
10
11
  protected abstract code2ObjectUrl(code: string): Promise<string>;
11
12
  protected abstract code2ResourceId(code: string): Promise<string>;
@@ -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
  }
@@ -6,7 +6,8 @@
6
6
  "main": "./src/index.ts",
7
7
  "devDependencies": {
8
8
  "@types/lodash.clonedeep": "^4.5.0",
9
- "@types/lodash.debounce": "^4.0.7"
9
+ "@types/lodash.debounce": "^4.0.7",
10
+ "@types/dom-to-image": "^2.6.4"
10
11
  },
11
12
  "types": "src/index.d.ts"
12
13
  }