@ones-editor/editor 1.1.5 → 1.1.6-beta.2

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 (34) hide show
  1. package/@ones-editor/comments/src/comments-render/index.d.ts +1 -0
  2. package/@ones-editor/core/src/core/blocks/text-blocks/base/text-range.d.ts +1 -1
  3. package/@ones-editor/core/src/core/doc/doc.d.ts +1 -0
  4. package/@ones-editor/core/src/core/editor/actions/update-block-text.d.ts +3 -3
  5. package/@ones-editor/core/src/core/editor/actions/update-box-data.d.ts +2 -2
  6. package/@ones-editor/core/src/core/types.d.ts +2 -1
  7. package/@ones-editor/drawio-embed/package.json +3 -1
  8. package/@ones-editor/graph-embed/package.json +3 -1
  9. package/@ones-editor/mathjax/package.json +2 -1
  10. package/@ones-editor/media-embed/package.json +4 -0
  11. package/@ones-editor/media-embed/src/core/media.d.ts +1 -1
  12. package/@ones-editor/paste-special/src/paste-special-button.d.ts +0 -1
  13. package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +4 -0
  14. package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +1 -0
  15. package/@ones-editor/sharedb-doc/src/doc/sharedb-ext.d.ts +1 -0
  16. package/@ones-editor/status/package.json +7 -0
  17. package/@ones-editor/status/src/dom/input.d.ts +1 -0
  18. package/@ones-editor/status/src/dom/overflow-tooltip-tag.d.ts +10 -0
  19. package/@ones-editor/status/src/dom/status-palette.d.ts +6 -0
  20. package/@ones-editor/status/src/index.d.ts +4 -0
  21. package/@ones-editor/status/src/locale/en-us.d.ts +25 -0
  22. package/@ones-editor/status/src/locale/index.d.ts +1 -0
  23. package/@ones-editor/status/src/locale/ja-jp.d.ts +25 -0
  24. package/@ones-editor/status/src/locale/zh-cn.d.ts +25 -0
  25. package/@ones-editor/status/src/status-box-command.d.ts +7 -0
  26. package/@ones-editor/status/src/status-box-data.d.ts +5 -0
  27. package/@ones-editor/status/src/status-box-editor.d.ts +21 -0
  28. package/@ones-editor/status/src/status-box.d.ts +4 -0
  29. package/@ones-editor/status/src/types.d.ts +8 -0
  30. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  31. package/@ones-editor/ui-base/src/icons/index.d.ts +2 -1
  32. package/@ones-editor/ui-base/src/input/create-input.d.ts +2 -1
  33. package/dist/index.js +209 -198
  34. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { BlockElement, BlockPath, DocBlock, DocBlockTextAttributes, OnesEditor, OnesEditorBlockRenderer, OnesEditorBlockRenderResult } from '../../../../@ones-editor/core';
2
2
  export declare class OnesEditorCommentsRender implements OnesEditorBlockRenderer {
3
3
  renderText(editor: OnesEditor, path: BlockPath, attributes: DocBlockTextAttributes): OnesEditorBlockRenderResult;
4
+ renderBox(editor: OnesEditor, path: BlockPath, attributes: DocBlockTextAttributes): OnesEditorBlockRenderResult;
4
5
  renderBlock(editor: OnesEditor, path: BlockPath, blockData: DocBlock): OnesEditorBlockRenderResult;
5
6
  updateBlock(editor: OnesEditor, path: BlockPath, blockElement: BlockElement, blockData: DocBlock): void;
6
7
  }
@@ -1,3 +1,3 @@
1
1
  import { BlockElement, OnesEditor } from '../../../types';
2
2
  import EditorSimpleSelectionRange from '../../../selection/range/simple-range';
3
- export declare function getTextBlockRangeFromPoint(editor: OnesEditor, block: BlockElement, x: number, y: number): EditorSimpleSelectionRange | null;
3
+ export declare function getTextBlockRangeFromPoint(editor: OnesEditor, block: BlockElement, xOrign: number, yOrign: number): EditorSimpleSelectionRange | null;
@@ -120,6 +120,7 @@ export interface UploadResourceResult {
120
120
  export interface BuildResourceUrlOptions {
121
121
  withToken?: boolean;
122
122
  downloadFileName?: string;
123
+ syncNewResources?: (newResourceId: string, resourceUrl: string) => void;
123
124
  }
124
125
  export type OnesEditorUserPermission = 'w' | 'r' | 'c';
125
126
  export interface OnesEditorUser {
@@ -1,4 +1,4 @@
1
- import { OnesEditor, BlockElement } from '../../types';
1
+ import { OnesEditor, BlockElement, InsertTextOptions } from '../../types';
2
2
  import { DocBlockText, DocBlockTextActions } from '../../doc';
3
- export declare function editorUpdateBlockText(editor: OnesEditor, block: BlockElement, ops: DocBlockTextActions): DocBlockText;
4
- export declare function editorSetBlockText(editor: OnesEditor, block: BlockElement, newText: DocBlockText): void;
3
+ export declare function editorUpdateBlockText(editor: OnesEditor, block: BlockElement, ops: DocBlockTextActions, options?: InsertTextOptions): DocBlockText;
4
+ export declare function editorSetBlockText(editor: OnesEditor, block: BlockElement, newText: DocBlockText, options?: InsertTextOptions): void;
@@ -1,3 +1,3 @@
1
- import { OnesEditor } from '../../types';
1
+ import { InsertTextOptions, OnesEditor } from '../../types';
2
2
  import { DocBox } from '../../doc';
3
- export declare function editorUpdateBoxData(editor: OnesEditor, boxData: DocBox): void;
3
+ export declare function editorUpdateBoxData(editor: OnesEditor, boxData: DocBox, options?: InsertTextOptions): void;
@@ -440,6 +440,7 @@ export type OnesEditorCustomCreator = (editor: OnesEditor) => OnesEditorCustom;
440
440
  export interface CloneBlockResultInfo {
441
441
  containerIdMap: Map<string, string>;
442
442
  blockIdMap: Map<string, string>;
443
+ boxIdMap: Map<string, string>;
443
444
  }
444
445
  export interface OnesEditorDomEvents extends OnesEditorCustom {
445
446
  addEventListener: <T = Event>(element: Element | Document | Window, eventName: string, eventHandler: (editor: OnesEditor, event: T) => void) => void;
@@ -540,7 +541,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
540
541
  deleteChildContainers: (containerIds: string[]) => void;
541
542
  updateBlockData: (block: BlockElement, data: DocBlockAttributes, newRange?: SelectionRange) => DocBlock;
542
543
  updateEmbedData: (block: BlockElement, data: DocEmbedData, newRange?: SelectionRange) => DocBlock;
543
- updateBoxData: (boxData: DocBox) => void;
544
+ updateBoxData: (boxData: DocBox, options?: InsertTextOptions) => void;
544
545
  updateCompositionText: (text: string, end: boolean) => void;
545
546
  getColor: (index: number, type?: string) => string;
546
547
  }
@@ -11,7 +11,9 @@
11
11
  "license": "ISC",
12
12
  "devDependencies": {
13
13
  "@types/mime-db": "^1.43.1",
14
- "@types/pako": "^2.0.0"
14
+ "@types/pako": "^2.0.0",
15
+ "@types/lodash-es": "4.17.8",
16
+ "@types/lodash.clonedeep": "^4.5.0"
15
17
  },
16
18
  "types": "src/index.d.ts"
17
19
  }
@@ -6,7 +6,9 @@
6
6
  "devDependencies": {
7
7
  "@types/lodash.camelcase": "^4.3.7",
8
8
  "@types/mermaid": "^9.1.0",
9
- "@types/plantuml-encoder": "^1.4.0"
9
+ "@types/plantuml-encoder": "^1.4.0",
10
+ "@types/lodash-es": "4.17.8",
11
+ "@types/lodash.clonedeep": "^4.5.0"
10
12
  },
11
13
  "types": "src/index.d.ts"
12
14
  }
@@ -5,7 +5,8 @@
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
7
7
  "devDependencies": {
8
- "@types/lodash.debounce": "^4.0.7"
8
+ "@types/lodash.debounce": "^4.0.7",
9
+ "@types/lodash.clonedeep": "^4.5.0"
9
10
  },
10
11
  "types": "src/index.d.ts"
11
12
  }
@@ -3,5 +3,9 @@
3
3
  "version": "1.0.0",
4
4
  "main": "src/index.ts",
5
5
  "type": "module",
6
+ "devDependencies": {
7
+ "@types/lodash-es": "4.17.8",
8
+ "@types/lodash.clonedeep": "^4.5.0"
9
+ },
6
10
  "types": "src/index.d.ts"
7
11
  }
@@ -20,7 +20,7 @@ export declare class Media extends TypedEmitter<MediaEvent> {
20
20
  private renderMediaElement;
21
21
  handleUploadFile: (file: File) => Promise<void>;
22
22
  renderEmpty(blockData: MediaBlockData): void;
23
- getResourceUrl(url: string): string;
23
+ getResourceUrl(blockData: MediaBlockData, content?: BlockContentElement): string;
24
24
  setFullScreen(): void;
25
25
  removeFullScreen(): void;
26
26
  updateBlockAlign(blockData: MediaBlockData, content: BlockContentElement): void;
@@ -14,7 +14,6 @@ export default class PasteSpecialButton {
14
14
  private cleaningDoc;
15
15
  handlePasteSpecial: (bar: AbstractCommandBar, item: CommandItem) => void;
16
16
  handleClose: () => void;
17
- handleSelectionChange: () => void;
18
17
  hide(): void;
19
18
  clearCheckedState(): void;
20
19
  destroy(): void;
@@ -14,6 +14,10 @@ export declare class AuthConnection {
14
14
  events: EventEmitter;
15
15
  token: string | null;
16
16
  resourceToken: string | null;
17
+ pingOptions: {
18
+ interval: number;
19
+ timeout: number;
20
+ };
17
21
  constructor(url: string, reauthFunc?: ReauthFunc | undefined);
18
22
  getBaseURL(): string;
19
23
  getBase64BaseURL(): string;
@@ -52,6 +52,7 @@ export default class ShareDBClient {
52
52
  revertVersion(ver: number): Promise<void>;
53
53
  createVersion(tag: string, publish: boolean): Promise<any>;
54
54
  recognizeLink(url: string): Promise<LinkDetails>;
55
+ private getResourceId;
55
56
  buildResourceUrl(resourceId: string, options?: BuildResourceUrlOptions): string;
56
57
  reAuth(): void;
57
58
  }
@@ -3,6 +3,7 @@ declare module 'sharedb/lib/client' {
3
3
  interface Connection {
4
4
  id: string | null;
5
5
  auth: object;
6
+ _ping: number;
6
7
  lastReceiveTime?: number;
7
8
  _initializeHandshake(): void;
8
9
  send(message: object): void;
@@ -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) => 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) => 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
+ }