@ones-editor/editor 0.0.7-beta.54 → 0.0.7-beta.55

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.
@@ -15,6 +15,7 @@ export default abstract class ListBase<TData, TItem extends ItemBase, ListOption
15
15
  deleteItem(commentId: string): boolean;
16
16
  findItemIndex(commentId: string): number;
17
17
  findItem(commentId: string): TItem | null;
18
+ findItemAsGroupId(commentId: string): TItem | null;
18
19
  destroy(): void;
19
20
  protected abstract createItem(data: TData, reason: 'init' | 'insert'): TItem;
20
21
  protected abstract findInsertPos(data: TData): number;
@@ -19,6 +19,7 @@ export interface EditorInputCallbacks {
19
19
  defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
20
20
  destroy: () => void;
21
21
  pasteDoc: (doc: DocObject) => Promise<void>;
22
+ forEach: (callback: (handler: OnesEditorInputHandler) => void) => void;
22
23
  }
23
24
  export declare class EditorInput implements OnesEditorInput {
24
25
  editor: OnesEditor;
@@ -47,4 +48,5 @@ export declare class EditorInput implements OnesEditorInput {
47
48
  removeHandler(handler: OnesEditorInputHandler): void;
48
49
  defaultInsertText(editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string): void;
49
50
  defaultHandleKeydown(editor: OnesEditor, event: KeyboardEvent): boolean;
51
+ forEach(callback: (handler: OnesEditorInputHandler) => void): void;
50
52
  }
@@ -1,3 +1,4 @@
1
+ import ResizeObserver from 'resize-observer-polyfill';
1
2
  import { OnesEditor, ContainerElement, BlockElement } from '../types';
2
3
  export declare class RootContainer {
3
4
  private editor;
@@ -7,7 +8,7 @@ export declare class RootContainer {
7
8
  private bindEvents;
8
9
  private unbindEvents;
9
10
  destroy(): void;
10
- handleContextMenu: (event: Event) => void;
11
+ handleContextMenu: (event: MouseEvent) => void;
11
12
  handleResize: () => void;
12
13
  handleClick: (event: MouseEvent) => void;
13
14
  handleBlockClick: (event: MouseEvent, block: BlockElement, elem: Element) => void;
@@ -1,3 +1,3 @@
1
1
  import { DocObject } from '../../doc';
2
- import { ContainerElement, OnesEditor } from '../../types';
3
- export declare function editorReplaceContainer(editor: OnesEditor, container: ContainerElement, doc: DocObject): void;
2
+ import { CloneBlockResultInfo, ContainerElement, OnesEditor } from '../../types';
3
+ export declare function editorReplaceContainer(editor: OnesEditor, container: ContainerElement, doc: DocObject, cloneDocResult: CloneBlockResultInfo): void;
@@ -28,4 +28,5 @@ export declare class EditorInputHandlers implements EditorInputCallbacks {
28
28
  pasteDoc(doc: DocObject): Promise<void>;
29
29
  private pasteDocs;
30
30
  destroy(): void;
31
+ forEach(cb: (handler: OnesEditorInputHandler) => void): void;
31
32
  }
@@ -1,4 +1,4 @@
1
1
  import { SelectionRange, OnesEditor } from '../types';
2
2
  import EditorSimpleSelectionRange from './range/simple-range';
3
- export declare function getBlockRangeFromPoint(editor: OnesEditor, x: number, y: number): SelectionRange | null;
3
+ export declare function getBlockRangeFromPoint(editor: OnesEditor, pointX: number, pointY: number): SelectionRange | null;
4
4
  export declare function getBlockNearestRangeFromPoint(editor: OnesEditor, x: number, y: number): EditorSimpleSelectionRange | null;
@@ -579,6 +579,7 @@ export interface OnesEditorInput {
579
579
  handlePasteText: (text: string, options?: PasteOptions) => void;
580
580
  addHandler: (handler: OnesEditorInputHandler) => void;
581
581
  removeHandler: (handler: OnesEditorInputHandler) => void;
582
+ forEach: (cb: (handler: OnesEditorInputHandler) => void) => void;
582
583
  defaultInsertText: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, text: string) => void;
583
584
  defaultHandleKeydown: (editor: OnesEditor, event: KeyboardEvent) => boolean;
584
585
  }
@@ -1,3 +1,4 @@
1
+ export type LANGS = keyof typeof langs;
1
2
  declare const langs: {
2
3
  'en-US': {
3
4
  name: string;
@@ -57,8 +58,8 @@ declare const langs: {
57
58
  };
58
59
  };
59
60
  };
60
- export declare function setLang(lang?: string | null | undefined): void;
61
+ export declare function setLang(lang?: LANGS | null | undefined): void;
61
62
  export declare function mergeLang(l: any): void;
62
63
  export declare function t(key: string, args?: Record<string, string>): string;
63
- export type LANGS = keyof typeof langs;
64
+ export declare function getCurrentLang(): "en-US" | "zh-CN" | "ja-JP";
64
65
  export {};
@@ -12,7 +12,7 @@ export declare function hashCode(str: string): number;
12
12
  */
13
13
  export declare function abbreviation(name: string, maxLength?: number): string;
14
14
  declare enum EColor {
15
- blue = "#338FE5",
15
+ blue = "#0064FF",
16
16
  cyan = "#34AFDE",
17
17
  teal = "#2CB2AE",
18
18
  green = "#24B47E",
@@ -11,6 +11,10 @@ export declare function createExpandedRange(startNode: Node, startOffset: number
11
11
  export declare function getFirstClientRect(elem: Element): DOMRect;
12
12
  export declare function getLastClientRect(elem: Element): DOMRect;
13
13
  export declare function getDistanceSquare(rect: DOMRect, x: number, y: number): number;
14
+ export declare function getOffsetFromPoint(x: number, y: number): {
15
+ textNode: any;
16
+ offset: number;
17
+ };
14
18
  export declare function textNodeOffsetFromPoint(node: Text, x: number, y: number): number;
15
19
  export declare function compareElement(elem1: Element, elem2: Element): number;
16
20
  export declare function getHorizontalPadding(elem: Element): number;
@@ -0,0 +1,2 @@
1
+ import GraphIcon from './graph-icon.svg?raw';
2
+ export { GraphIcon, };
@@ -1,3 +1,19 @@
1
+ /// <reference types="lodash" />
2
+ import { AbstractCommandBar, Popup } from '../../../../@ones-editor/ui-base';
1
3
  import { OnesEditor } from '../../../../@ones-editor/core';
2
4
  export type OnEditChange = (tex: string, end: boolean) => void;
5
+ export default class MathjaxEditor {
6
+ editMathjaxPopup: Popup | null;
7
+ onChange: OnEditChange | null;
8
+ tex: string;
9
+ private observer;
10
+ editMathjax(elem: HTMLElement, tex: string, onChange: OnEditChange): void;
11
+ handleClose: (commandBar: AbstractCommandBar) => void;
12
+ handleKeyup: (event: KeyboardEvent) => void;
13
+ handleChange: import("lodash").DebouncedFunc<(text: string) => void>;
14
+ createPopupContent(tex: string): HTMLTextAreaElement;
15
+ textareaWatcher(textarea: HTMLTextAreaElement): void;
16
+ getTextarea(): HTMLTextAreaElement;
17
+ destroy(): void;
18
+ }
3
19
  export declare function editMathjax(editor: OnesEditor, elem: HTMLElement, tex: string, onChange: OnEditChange): void;
@@ -2,6 +2,7 @@ declare const _default: {
2
2
  media: {
3
3
  upload: {
4
4
  failed: string;
5
+ maxSizeFailed: string;
5
6
  };
6
7
  load: {
7
8
  failed: string;
@@ -2,6 +2,7 @@ declare const _default: {
2
2
  media: {
3
3
  upload: {
4
4
  failed: string;
5
+ maxSizeFailed: string;
5
6
  };
6
7
  load: {
7
8
  failed: string;
@@ -2,6 +2,7 @@ declare const _default: {
2
2
  media: {
3
3
  upload: {
4
4
  failed: string;
5
+ maxSizeFailed: string;
5
6
  };
6
7
  load: {
7
8
  failed: string;
@@ -1,2 +1,2 @@
1
- import { BlockElement, DocObject, OnesEditor } from '../../../../../@ones-editor/core';
2
- export declare function pasteTableInTableBlock(editor: OnesEditor, doc: DocObject, tableBlock: BlockElement, destCell: HTMLTableCellElement): void;
1
+ import { BlockElement, DocObject, OnesEditor, CloneBlockResultInfo } from '../../../../../@ones-editor/core';
2
+ export declare function pasteTableInTableBlock(editor: OnesEditor, doc: DocObject, tableBlock: BlockElement, destCell: HTMLTableCellElement, cloneDocResult: CloneBlockResultInfo): void;