@ones-editor/editor 1.1.8 → 1.1.9-beta.3

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 (100) hide show
  1. package/@ones-editor/block-menu/src/block-menu/items/insert-block-items/index.d.ts +1 -1
  2. package/@ones-editor/block-menu/src/block-menu/standard-block-actions/hook.d.ts +2 -0
  3. package/@ones-editor/code-block/src/code-block/header/index.d.ts +1 -0
  4. package/@ones-editor/code-block/src/code-block/languages.d.ts +1 -1
  5. package/@ones-editor/code-block/src/locale/en-us.d.ts +1 -0
  6. package/@ones-editor/code-block/src/locale/ja-jp.d.ts +1 -0
  7. package/@ones-editor/code-block/src/locale/zh-cn.d.ts +1 -0
  8. package/@ones-editor/comments/src/comment-quick-reply/index.d.ts +1 -0
  9. package/@ones-editor/comments/src/comments/comments.d.ts +1 -1
  10. package/@ones-editor/comments/src/comments-list/comments-list.d.ts +1 -1
  11. package/@ones-editor/comments/src/comments-list/group-list.d.ts +3 -1
  12. package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +1 -1
  13. package/@ones-editor/comments/src/comments-render/index.d.ts +1 -0
  14. package/@ones-editor/context-menu/src/menu/index.d.ts +1 -0
  15. package/@ones-editor/core/src/core/blocks/common/execute-block-command.d.ts +2 -2
  16. package/@ones-editor/core/src/core/blocks/common/heading-block-dom.d.ts +7 -0
  17. package/@ones-editor/core/src/core/blocks/common/index.d.ts +1 -0
  18. package/@ones-editor/core/src/core/blocks/complex-blocks/child-blocks.d.ts +1 -0
  19. package/@ones-editor/core/src/core/blocks/complex-blocks/complex-block-helper.d.ts +3 -2
  20. package/@ones-editor/core/src/core/command-providers/commands/range-commands.d.ts +1 -1
  21. package/@ones-editor/core/src/core/command-providers/editor-command-providers.d.ts +1 -1
  22. package/@ones-editor/core/src/core/composition/clipboard/copy.d.ts +2 -1
  23. package/@ones-editor/core/src/core/composition/editor-input.d.ts +2 -0
  24. package/@ones-editor/core/src/core/composition/index.d.ts +1 -1
  25. package/@ones-editor/core/src/core/containers/container.d.ts +1 -1
  26. package/@ones-editor/core/src/core/containers/root-container.d.ts +1 -0
  27. package/@ones-editor/core/src/core/doc/rich-text/text-style.d.ts +1 -0
  28. package/@ones-editor/core/src/core/editor/actions/update-block-text.d.ts +3 -3
  29. package/@ones-editor/core/src/core/editor/actions/update-box-data.d.ts +2 -2
  30. package/@ones-editor/core/src/core/editor/editor-dom/editor-dom.d.ts +5 -3
  31. package/@ones-editor/core/src/core/editor/index.d.ts +1 -0
  32. package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +1 -0
  33. package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +3 -1
  34. package/@ones-editor/core/src/core/selection/ensure-block-visible.d.ts +2 -0
  35. package/@ones-editor/core/src/core/types.d.ts +15 -5
  36. package/@ones-editor/core/src/core/undo-manager/actions/action.d.ts +2 -2
  37. package/@ones-editor/core/src/utils/animate-scroll.d.ts +4 -0
  38. package/@ones-editor/core/src/utils/dom.d.ts +4 -0
  39. package/@ones-editor/core/src/utils/file.d.ts +2 -1
  40. package/@ones-editor/excalidraw/src/types.d.ts +2 -1
  41. package/@ones-editor/find-dialog/src/find-dialog.d.ts +1 -0
  42. package/@ones-editor/heading-collapse/src/doc-event/collapse-handler.d.ts +4 -0
  43. package/@ones-editor/heading-collapse/src/heading-collapse-button/collapse-heading-block.d.ts +2 -2
  44. package/@ones-editor/heading-collapse/src/heading-collapse-button/heading-utils.d.ts +0 -4
  45. package/@ones-editor/heading-collapse/src/heading-collapse-button/index.d.ts +1 -0
  46. package/@ones-editor/heading-collapse/src/heading-collapse-button/paste-handler.d.ts +8 -0
  47. package/@ones-editor/input-handlers/src/enforce-with-document-title/types.d.ts +2 -0
  48. package/@ones-editor/list-block/src/index.d.ts +2 -1
  49. package/@ones-editor/list-block/src/local-events/paste-handler.d.ts +6 -0
  50. package/@ones-editor/list-block/src/mindmap/to-mindmap/to-mindmap.d.ts +2 -2
  51. package/@ones-editor/list-block/src/mindmap/to-mindmap/types.d.ts +2 -2
  52. package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +2 -1
  53. package/@ones-editor/sharedb-doc/src/types.d.ts +1 -0
  54. package/@ones-editor/status/package.json +7 -0
  55. package/@ones-editor/status/src/dom/input.d.ts +1 -0
  56. package/@ones-editor/status/src/dom/overflow-tooltip-tag.d.ts +10 -0
  57. package/@ones-editor/status/src/dom/status-palette.d.ts +6 -0
  58. package/@ones-editor/status/src/index.d.ts +4 -0
  59. package/@ones-editor/status/src/locale/en-us.d.ts +25 -0
  60. package/@ones-editor/status/src/locale/index.d.ts +1 -0
  61. package/@ones-editor/status/src/locale/ja-jp.d.ts +25 -0
  62. package/@ones-editor/status/src/locale/zh-cn.d.ts +25 -0
  63. package/@ones-editor/status/src/status-box-command.d.ts +7 -0
  64. package/@ones-editor/status/src/status-box-data.d.ts +5 -0
  65. package/@ones-editor/status/src/status-box-editor.d.ts +21 -0
  66. package/@ones-editor/status/src/status-box.d.ts +4 -0
  67. package/@ones-editor/status/src/types.d.ts +8 -0
  68. package/@ones-editor/table-block/package.json +1 -0
  69. package/@ones-editor/table-block/src/index.d.ts +2 -2
  70. package/@ones-editor/table-block/src/table-block/index.d.ts +1 -0
  71. package/@ones-editor/table-block/src/table-block/table-dom.d.ts +1 -0
  72. package/@ones-editor/table-block/src/table-block/table-grid.d.ts +3 -0
  73. package/@ones-editor/table-block/src/types.d.ts +1 -0
  74. package/@ones-editor/templates/src/index.d.ts +2 -2
  75. package/@ones-editor/templates/src/templates/select-template.d.ts +4 -0
  76. package/@ones-editor/templates/src/templates/types.d.ts +1 -0
  77. package/@ones-editor/to-docx/src/doc2other/core.d.ts +1 -0
  78. package/@ones-editor/to-docx/src/doc2other/image.d.ts +1 -1
  79. package/@ones-editor/to-docx/src/doc2other/types.d.ts +1 -1
  80. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  81. package/@ones-editor/ui/src/index.d.ts +2 -2
  82. package/@ones-editor/ui/src/link-popup/index.d.ts +4 -1
  83. package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +2 -2
  84. package/@ones-editor/ui/src/quick-menu/inline-box-items.d.ts +2 -2
  85. package/@ones-editor/ui/src/quick-menu/quick-menu-items.d.ts +2 -1
  86. package/@ones-editor/ui/src/quick-menu/types.d.ts +8 -3
  87. package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +2 -0
  88. package/@ones-editor/ui-base/src/command-bar/manual-menu.d.ts +1 -1
  89. package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -0
  90. package/@ones-editor/ui-base/src/icons/index.d.ts +2 -1
  91. package/@ones-editor/ui-base/src/input/create-input.d.ts +3 -2
  92. package/@ones-editor/ui-base/src/popup/popup.d.ts +1 -0
  93. package/@ones-editor/versions/src/types.d.ts +4 -1
  94. package/@ones-editor/versions/src/version-dialog/size-limit-textarea.d.ts +2 -1
  95. package/@ones-editor/versions/src/version-dialog/version-list.d.ts +2 -0
  96. package/dist/index.d.ts +1 -1
  97. package/dist/index.js +210 -199
  98. package/dist/types.d.ts +8 -0
  99. package/package.json +5 -3
  100. package/@ones-editor/to-docx/src/doc2other/html-css.d.ts +0 -1
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
2
3
  import { Connection, Doc } from 'sharedb/lib/client';
3
4
  import ReconnectingWebSocket, { Event } from 'reconnecting-websocket';
4
- import { EventEmitter } from 'events';
5
5
  import { AuthMessage, ReauthFunc } from '../types';
6
6
  import './sharedb-ext';
7
7
  export declare class AuthConnection {
@@ -27,6 +27,7 @@ export declare class AuthConnection {
27
27
  }>;
28
28
  logout(): Promise<void>;
29
29
  init(auth: AuthMessage): Promise<void>;
30
+ reConnect(token: string): Promise<void>;
30
31
  handleAuthError(): Promise<void>;
31
32
  reAuth: () => Promise<void>;
32
33
  private emitPermissionError;
@@ -71,6 +71,7 @@ export interface ShareDBDocOptions {
71
71
  autoCreateDoc?: boolean;
72
72
  templateData?: EditorDoc;
73
73
  disableLogout?: boolean;
74
+ onMaxUsersError?: () => void;
74
75
  }
75
76
  export interface EditorOp {
76
77
  c: string;
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@ones-editor/status",
3
+ "version": "1.0.0",
4
+ "main": "./src/index.js",
5
+ "license": "MIT",
6
+ "types": "src/index.d.ts"
7
+ }
@@ -0,0 +1 @@
1
+ export declare function createStatusInput(parent: HTMLElement, defaultValue: string, onChange: ((e: Event) => void), onKeyDown: (e: KeyboardEvent, composing: boolean) => void): void;
@@ -0,0 +1,10 @@
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ export declare class OverflowTooltipTag {
3
+ private editor;
4
+ constructor(editor: OnesEditor);
5
+ private check;
6
+ private onMouseOver;
7
+ destroy(): void;
8
+ static create(classes: string[], title: string): HTMLAnchorElement;
9
+ static replaceTitleSpace(title: string): string;
10
+ }
@@ -0,0 +1,6 @@
1
+ import { StatusColor } from '../types';
2
+ export declare function createPalette(): HTMLDivElement;
3
+ export declare class StatusPalette {
4
+ root: HTMLElement;
5
+ changeColor: (color: StatusColor) => void;
6
+ }
@@ -0,0 +1,4 @@
1
+ import StatusBox from './status-box';
2
+ import { StatusBoxCommand } from './status-box-command';
3
+ import './locale';
4
+ export { StatusBox, StatusBoxCommand, };
@@ -0,0 +1,25 @@
1
+ declare const _default: {
2
+ status: {
3
+ empty: string;
4
+ command: {
5
+ name: string;
6
+ };
7
+ color: {
8
+ red: string;
9
+ yellow: string;
10
+ green: string;
11
+ blue: string;
12
+ purple: string;
13
+ grey: string;
14
+ };
15
+ colorDefaultTitle: {
16
+ red: string;
17
+ yellow: string;
18
+ green: string;
19
+ blue: string;
20
+ purple: string;
21
+ grey: string;
22
+ };
23
+ };
24
+ };
25
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ declare const _default: {
2
+ status: {
3
+ empty: string;
4
+ command: {
5
+ name: string;
6
+ };
7
+ color: {
8
+ red: string;
9
+ yellow: string;
10
+ green: string;
11
+ blue: string;
12
+ purple: string;
13
+ grey: string;
14
+ };
15
+ colorDefaultTitle: {
16
+ red: string;
17
+ yellow: string;
18
+ green: string;
19
+ blue: string;
20
+ purple: string;
21
+ grey: string;
22
+ };
23
+ };
24
+ };
25
+ export default _default;
@@ -0,0 +1,25 @@
1
+ declare const _default: {
2
+ status: {
3
+ empty: string;
4
+ command: {
5
+ name: string;
6
+ };
7
+ color: {
8
+ red: string;
9
+ yellow: string;
10
+ green: string;
11
+ blue: string;
12
+ purple: string;
13
+ grey: string;
14
+ };
15
+ colorDefaultTitle: {
16
+ red: string;
17
+ yellow: string;
18
+ green: string;
19
+ blue: string;
20
+ purple: string;
21
+ grey: string;
22
+ };
23
+ };
24
+ };
25
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { CommandItem, OnesEditor } from '../../../@ones-editor/core';
2
+ export declare class StatusBoxCommand {
3
+ static id: string;
4
+ static get commands(): CommandItem[];
5
+ static insertStatus(editor: OnesEditor, containerId: string, blockIndex: number): void;
6
+ static insertEmptyBlockStatus(editor: OnesEditor, containerId: string, blockIndex: number): import("@ones-editor/core").BlockElement;
7
+ }
@@ -0,0 +1,5 @@
1
+ import { DocBlockTextOp } from '../../../@ones-editor/core';
2
+ import { StatusBoxData, StatusColor } from './types';
3
+ export declare function recordLastStatusBoxData(box: StatusBoxData): void;
4
+ export declare function getLastStatusBoxTitle(color: StatusColor): string;
5
+ export declare function createEmptyStatusBox(): DocBlockTextOp;
@@ -0,0 +1,21 @@
1
+ import { BoxElement, OnesEditor } from '../../../@ones-editor/core';
2
+ import { Popup } from '../../../@ones-editor/ui-base';
3
+ import { StatusColor } from './types';
4
+ import { StatusPalette } from './dom/status-palette';
5
+ export declare class StatusBoxEditor {
6
+ private editor;
7
+ linkPopup: Popup | null;
8
+ boxElement?: BoxElement;
9
+ statusPalette: StatusPalette;
10
+ isEditing: boolean;
11
+ constructor(editor: OnesEditor);
12
+ editorStatus: (boxElement: BoxElement) => void;
13
+ focus(): void;
14
+ handleShow: () => void;
15
+ handClose: () => void;
16
+ handleKeyDown: (e: KeyboardEvent, composing: boolean) => void;
17
+ createPopupContent(title: string, color: StatusColor, subtle: boolean): HTMLDivElement;
18
+ onColorChange: (e: Event) => void;
19
+ onTitleChange: (e: Event) => void;
20
+ destroy(): void;
21
+ }
@@ -0,0 +1,4 @@
1
+ import { Box } from '../../../@ones-editor/core';
2
+ import './status-box.scss';
3
+ declare const StatusBox: Box;
4
+ export default StatusBox;
@@ -0,0 +1,8 @@
1
+ import { DocBox } from '../../../@ones-editor/core';
2
+ export declare const STATUS_COLORS: readonly ["Blue", "Grey", "Yellow", "Red", "Green", "Purple"];
3
+ export type StatusColor = typeof STATUS_COLORS[number];
4
+ export interface StatusBoxData extends DocBox {
5
+ title: string;
6
+ subtle: boolean;
7
+ color: StatusColor;
8
+ }
@@ -10,6 +10,7 @@
10
10
  "@types/lodash.debounce": "^4.0.7",
11
11
  "@types/lodash.merge": "^4.6.7",
12
12
  "@types/lodash.throttle": "^4.1.7",
13
+ "@types/lodash.uniqby": "^4.7.7",
13
14
  "sass": "^1.54.9"
14
15
  },
15
16
  "types": "src/index.d.ts"
@@ -1,7 +1,7 @@
1
- import TableBlock from './table-block';
1
+ import TableBlock, { includeBigTable } from './table-block';
2
2
  import { TableBlockCommandProvider } from './commands';
3
3
  import './locale';
4
4
  import './table-style.scss';
5
5
  import TableShortcuts from './table-block/table-shortcuts';
6
6
  export * from './types';
7
- export { TableBlock, TableBlockCommandProvider, TableShortcuts };
7
+ export { TableBlock, TableBlockCommandProvider, TableShortcuts, includeBigTable };
@@ -1,3 +1,4 @@
1
1
  import { ComplexKindBlock } from '../../../../@ones-editor/core';
2
+ export { includeBigTable } from './table-dom';
2
3
  declare const TableBlock: ComplexKindBlock;
3
4
  export default TableBlock;
@@ -15,3 +15,4 @@ export declare function getParentTableBlock(block: BlockElement): BlockElement |
15
15
  export declare function getTableCol(table: HTMLTableElement, colIndex: number): HTMLTableColElement;
16
16
  export declare function isValid(tableBlock: BlockElement): boolean;
17
17
  export declare function resetBlockHelperPos(scrollContainer: ScrollContainer): void;
18
+ export declare function includeBigTable(editor: OnesEditor): boolean;
@@ -48,6 +48,9 @@ export declare class TableGrid {
48
48
  map<T>(fn: (cell: TableCell) => T): T[][];
49
49
  getBottomCell(cellData: TableCell): TableCell | null;
50
50
  getTopCell(cellData: TableCell): TableCell | null;
51
+ getLeftCell(cellData: TableCell): TableCell | null;
52
+ getRightCell(cellData: TableCell): TableCell | null;
53
+ get uniqueCells(): TableCell[];
51
54
  get cells(): TableCell[];
52
55
  getVirtualCellContainersGrid(): string[][];
53
56
  static virtualCellContainersGridToChildren(virtualCellContainersGrid: string[][]): string[];
@@ -6,4 +6,5 @@ export interface TableOptions {
6
6
  allowScrollBarFixed?: boolean;
7
7
  hideCellMenu?: boolean;
8
8
  hideToolbar?: boolean;
9
+ bigTableBoundary?: number;
9
10
  }
@@ -1,4 +1,4 @@
1
1
  import './locale';
2
- import { autoShowHideTemplates } from './templates/select-template';
2
+ import { autoShowHideTemplates, hideTemplates, showTemplates } from './templates/select-template';
3
3
  export * from './templates/types';
4
- export { autoShowHideTemplates };
4
+ export { autoShowHideTemplates, hideTemplates, showTemplates };
@@ -1,7 +1,11 @@
1
+ /// <reference types="lodash" />
1
2
  import { OnesEditor } from '../../../../@ones-editor/core';
2
3
  import './select-templates.scss';
3
4
  interface ShowTemplatesOptions {
4
5
  reset?: boolean;
5
6
  }
7
+ declare function showTemplatesCore(editor: OnesEditor, options?: ShowTemplatesOptions): void;
8
+ export declare const showTemplates: import("lodash").DebouncedFunc<typeof showTemplatesCore>;
9
+ export declare function hideTemplates(editor: OnesEditor): void;
6
10
  export declare function autoShowHideTemplates(editor: OnesEditor, options?: ShowTemplatesOptions): void;
7
11
  export {};
@@ -11,4 +11,5 @@ export interface TemplateOptions {
11
11
  onChooseTemplate?: (editor: OnesEditor) => void;
12
12
  onApplyTemplate?: (editor: OnesEditor, template: DocTemplate) => Promise<void>;
13
13
  onTemplateChooserStatusChanged?: (editor: OnesEditor, cardContainer: HTMLElement | null, status: 'visible' | 'hide') => void;
14
+ onBeforeTemplateShow?: (editor: OnesEditor) => boolean;
14
15
  }
@@ -18,6 +18,7 @@ export interface BlocksGenerator {
18
18
  addHyperlinkParagraph(link: string | undefined, title?: string): void;
19
19
  addOtherEmbedBlock(embedType: string, embedData: any): Promise<void>;
20
20
  addTableMatrix(colsWidth: number[], matrix: CalcCell[][], data: DocObject): Promise<void>;
21
+ addVirtualBlock(blockId: string, data: DocObject, maxWidth: number): Promise<void>;
21
22
  addEmptyParagraph(): void;
22
23
  }
23
24
  export declare function convertBlocksOfDoc(parent: string, // 父节点,暂时只有list block需要这个
@@ -8,7 +8,7 @@ export declare function getImageDim(obj: ImageObject, buffer: ArrayBuffer): Prom
8
8
  width: number;
9
9
  height: number;
10
10
  buffer: ArrayBuffer;
11
- }>;
11
+ } | undefined>;
12
12
  export declare function reCalculateImageDims(dims: (ImageDimWithBuffer | undefined)[], maxWidth: number): {
13
13
  width: number;
14
14
  height: number;
@@ -64,7 +64,7 @@ export type BlockObject = {
64
64
  border: boolean;
65
65
  };
66
66
  export type CodeObject = BlockObject[][];
67
- export type ReadImageFunc = (appId: string, docId: string, image: string) => Promise<ArrayBuffer | undefined>;
67
+ export type ReadImageFunc = (appId: string, docId: string, image: string) => Promise<[ArrayBuffer | undefined, string]>;
68
68
  export type GetDocByBlockFunc = (appId: string, docId: string, block: DocBlock) => Promise<DocObject | undefined>;
69
69
  export type GetTextsByBoxFunc = (box: DocBlockTextOp) => Promise<DocBlockText | undefined>;
70
70
  export type MD5Func = (s: string) => string;