@ones-editor/editor 2.1.7-beta.14 → 2.1.7-beta.16

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 (60) hide show
  1. package/@ones-editor/core/src/core/command-providers/block-attributes.d.ts +2 -0
  2. package/@ones-editor/core/src/core/editor/editor-dom/editor-dom.d.ts +1 -0
  3. package/@ones-editor/core/src/core/editor/index.d.ts +1 -1
  4. package/@ones-editor/core/src/core/types.d.ts +14 -4
  5. package/@ones-editor/core/src/core/undo-manager/actions/action.d.ts +5 -1
  6. package/@ones-editor/core/src/core/undo-manager/actions/block-action.d.ts +1 -0
  7. package/@ones-editor/core/src/core/undo-manager/actions/update-block-data-action.d.ts +1 -0
  8. package/@ones-editor/core/src/utils/animate-scroll.d.ts +2 -0
  9. package/@ones-editor/core/src/utils/dom.d.ts +3 -3
  10. package/@ones-editor/image-embed/src/image-object.d.ts +1 -0
  11. package/@ones-editor/mention/src/mention.d.ts +10 -2
  12. package/@ones-editor/mobile-helper/src/cursor-toolbar.d.ts +1 -1
  13. package/@ones-editor/mobile-helper/src/fixed-toolbar/index.d.ts +6 -10
  14. package/@ones-editor/mobile-helper/src/fixed-toolbar/providers/insert-menu.d.ts +4 -6
  15. package/@ones-editor/mobile-helper/src/fixed-toolbar/toolbar-handler.d.ts +3 -0
  16. package/@ones-editor/mobile-helper/src/index.d.ts +2 -1
  17. package/@ones-editor/scroll-container/src/utils.d.ts +1 -1
  18. package/@ones-editor/table-block/src/index.d.ts +2 -5
  19. package/@ones-editor/text-commands/src/index.d.ts +0 -1
  20. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  21. package/@ones-editor/ui/src/link-popup/mobile-link-popup.d.ts +22 -0
  22. package/@ones-editor/ui/src/link-popup/types.d.ts +34 -0
  23. package/@ones-editor/ui/src/link-popup/web-link-popup.d.ts +19 -0
  24. package/@ones-editor/ui/src/locale/en-us.d.ts +9 -0
  25. package/@ones-editor/ui/src/locale/ja-jp.d.ts +9 -0
  26. package/@ones-editor/ui/src/locale/zh-cn.d.ts +9 -0
  27. package/@ones-editor/ui/src/providers/insert-above.d.ts +2 -2
  28. package/@ones-editor/ui/src/providers/insert-after.d.ts +2 -2
  29. package/@ones-editor/ui/src/providers/insert-box-provider.d.ts +3 -3
  30. package/@ones-editor/ui/src/providers/insert-menu.d.ts +3 -3
  31. package/@ones-editor/ui/src/providers/mobile-link-provider.d.ts +6 -3
  32. package/@ones-editor/ui/src/providers/proxy-provider.d.ts +3 -3
  33. package/@ones-editor/ui/src/providers/selection-provider.d.ts +9 -0
  34. package/@ones-editor/ui/src/providers/text-command-provider.d.ts +2 -2
  35. package/@ones-editor/ui/src/providers/utils/text-styles.d.ts +1 -1
  36. package/@ones-editor/ui/src/readonly-toolbar/index.d.ts +1 -1
  37. package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +1 -1
  38. package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +2 -0
  39. package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +2 -0
  40. package/@ones-editor/ui-base/src/color-button/text-color-item.d.ts +3 -2
  41. package/@ones-editor/ui-base/src/color-palette/color-palette.d.ts +1 -1
  42. package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +4 -3
  43. package/@ones-editor/ui-base/src/command-bar/fixed-toolbar.d.ts +1 -2
  44. package/@ones-editor/ui-base/src/command-bar/manual-command-bar.d.ts +1 -0
  45. package/@ones-editor/ui-base/src/command-bar/types.d.ts +4 -2
  46. package/@ones-editor/ui-base/src/dialog/manual-close-dialog.d.ts +1 -1
  47. package/@ones-editor/ui-base/src/index.d.ts +1 -0
  48. package/@ones-editor/ui-base/src/input/create-input.d.ts +2 -2
  49. package/@ones-editor/ui-base/src/mobile-command-bar/mobile-bottom-menu.d.ts +0 -2
  50. package/@ones-editor/ui-base/src/mobile-command-bar/scroll-into-view.d.ts +3 -0
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.js +1785 -1697
  53. package/dist/types.d.ts +3 -2
  54. package/package.json +1 -1
  55. package/@ones-editor/text-commands/src/locale/en-us.d.ts +0 -13
  56. package/@ones-editor/text-commands/src/locale/index.d.ts +0 -1
  57. package/@ones-editor/text-commands/src/locale/ja-jp.d.ts +0 -13
  58. package/@ones-editor/text-commands/src/locale/zh-cn.d.ts +0 -13
  59. package/@ones-editor/ui/src/providers/utils/text-commands.d.ts +0 -3
  60. /package/@ones-editor/table-block/src/commands/{table-command-provider.d.ts → mobile-command-provider.d.ts} +0 -0
@@ -4,8 +4,10 @@ export default class BlockAttributesHandler implements OnesEditorCustom {
4
4
  private editor;
5
5
  private textBlockAttributes;
6
6
  private activeBlockAttributes;
7
+ private lastRange;
7
8
  constructor(editor: OnesEditor);
8
9
  clear: () => void;
10
+ handleSelectionChanged: () => void;
9
11
  destroy(): void;
10
12
  getEmptyBlockTextAttributes(blockId: string): DocBlockTextAttributes | undefined;
11
13
  setActiveBlockAttributes: (attributes: CommandParams) => void;
@@ -7,5 +7,6 @@ export declare function isBlockPositionVisible(editor: OnesEditor, pos: SimpleBl
7
7
  export declare function scrollIntoView(editor: OnesEditor, target: HTMLElement, options?: {
8
8
  animation?: boolean;
9
9
  verticalOffset?: number;
10
+ elementToScroll?: HTMLElement;
10
11
  }): void;
11
12
  export declare function editorScrollIntoView(editor: OnesEditor): void;
@@ -1,3 +1,3 @@
1
1
  export * from './editor';
2
2
  export * from './actions';
3
- export { scrollIntoView } from './editor-dom';
3
+ export { scrollIntoView, editorScrollIntoView } from './editor-dom';
@@ -356,6 +356,8 @@ export interface OnesEditorUndoAction {
356
356
  redo: (editor: OnesEditor) => boolean;
357
357
  combinable: (other: OnesEditorUndoAction) => boolean;
358
358
  combine: (other: OnesEditorUndoAction) => void;
359
+ getTimeStamp: () => number;
360
+ getBatchActionId?: () => string | undefined;
359
361
  }
360
362
  export interface OnesEditorUndoManager {
361
363
  reset: () => void;
@@ -642,6 +644,7 @@ export type PasteOptions = {
642
644
  };
643
645
  export interface OnesEditorInput {
644
646
  readonly inputElement: HTMLTextAreaElement;
647
+ getInput: () => HTMLTextAreaElement;
645
648
  destroy: () => void;
646
649
  focus: () => void;
647
650
  handleDocumentSelectionChange: () => void;
@@ -718,6 +721,7 @@ export type CommandParams = {
718
721
  [index: string]: unknown;
719
722
  } & {
720
723
  source?: string[];
724
+ isFilter?: boolean;
721
725
  };
722
726
  export type CommandResult = {
723
727
  [index: string]: unknown;
@@ -727,12 +731,12 @@ export interface OnesEditorCommandProvider {
727
731
  groupIndex?: number;
728
732
  getAvailableCommands: (editor: OnesEditor, block: BlockElement, range: SelectionRange, params?: CommandParams) => CommandItem[];
729
733
  getInsertCommands?: (editor: OnesEditor, containerId: string) => CommandItem[];
730
- executeInsertCommand?: (editor: OnesEditor, containerId: string, blockIndex: number, item: CommandItem, params: CommandParams, result?: CommandResult) => boolean;
734
+ executeInsertCommand?: (editor: OnesEditor, containerId: string, blockIndex: number, item: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
731
735
  executeRangeCommand?: (editor: OnesEditor, range: SelectionRange, command: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
732
- executeCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams, result?: CommandResult) => boolean;
736
+ executeCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItemWithSource, params: CommandParams, result?: CommandResult) => boolean;
733
737
  filterCommands?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, commands: CommandItemWithSource[]) => CommandItemWithSource[] | undefined;
734
- beforeExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams) => boolean | undefined;
735
- afterExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams, result: CommandResult) => void;
738
+ beforeExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItemWithSource, params: CommandParams) => boolean | undefined;
739
+ afterExecuteCommand?: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItemWithSource, params: CommandParams, result: CommandResult) => void;
736
740
  }
737
741
  export interface CommandItemWithSource extends CommandItem {
738
742
  source: string;
@@ -767,3 +771,9 @@ export interface OnesEditorBlockHook {
767
771
  writable?: (editor: OnesEditor, blockElement: BlockElement | BlockElement[]) => boolean | undefined;
768
772
  commands?: (editor: OnesEditor, blockElement: BlockElement, child: TextBlockContentChild | null) => BlockCommands | undefined;
769
773
  }
774
+ export interface MobileClient {
775
+ getViewPortHeight: () => number;
776
+ getOffsetHeight: () => number;
777
+ virtualViewportHeight: number;
778
+ virtualViewportOffsetTop: number;
779
+ }
@@ -4,11 +4,15 @@ export default class Action implements OnesEditorUndoAction {
4
4
  protected containerId: string;
5
5
  beforeRange: OnesEditorDocRange;
6
6
  afterRange: OnesEditorDocRange;
7
- constructor(editor: OnesEditor, containerId: string, afterRange: OnesEditorDocRange);
7
+ batchActionId?: string;
8
+ ts: number;
9
+ constructor(editor: OnesEditor, containerId: string, afterRange: OnesEditorDocRange, batchActionId?: string);
10
+ getTimeStamp(): number;
8
11
  undo(editor: OnesEditor): boolean;
9
12
  redo(editor: OnesEditor): boolean;
10
13
  combinable(other: OnesEditorUndoAction): boolean;
11
14
  combine(other: OnesEditorUndoAction): void;
15
+ getBatchActionId(): string | undefined;
12
16
  setAfterRange(range: OnesEditorDocRange): void;
13
17
  hasDocContainerId(editor: OnesEditor, id: string): boolean;
14
18
  findDocBlockById(editor: OnesEditor, id: string): DocBlock | undefined;
@@ -7,4 +7,5 @@ export default class BlockAction extends Action {
7
7
  constructor(editor: OnesEditor, containerId: string, blockIndex: number, data: DocBlock, afterRange: OnesEditorDocRange);
8
8
  deleteBlock(editor: OnesEditor, newRange: OnesEditorDocRange): boolean;
9
9
  insertBlock(editor: OnesEditor, newRange: OnesEditorDocRange): boolean;
10
+ getBatchActionId(): string | undefined;
10
11
  }
@@ -9,4 +9,5 @@ export default class UpdateBlockDataAction extends Action {
9
9
  undo(editor: OnesEditor): boolean;
10
10
  redo(editor: OnesEditor): boolean;
11
11
  private static toAttributes;
12
+ getBatchActionId(): string | undefined;
12
13
  }
@@ -10,6 +10,7 @@ export interface IUserOptions {
10
10
  verticalOffset?: number;
11
11
  disableHorizontal?: boolean;
12
12
  disableVertical?: boolean;
13
+ getClientHeight?: () => number;
13
14
  }
14
15
  export interface IOptions {
15
16
  cancelOnUserAction: boolean;
@@ -22,6 +23,7 @@ export interface IOptions {
22
23
  verticalOffset: number;
23
24
  disableHorizontal?: boolean;
24
25
  disableVertical?: boolean;
26
+ getClientHeight?: () => number;
25
27
  }
26
28
  declare function animateScrollTo(y: number, userOptions?: IUserOptions): Promise<boolean>;
27
29
  declare function animateScrollTo(coords: TCoords, userOptions?: IUserOptions): Promise<boolean>;
@@ -1,4 +1,4 @@
1
- import type { CSSStyles } from '../core/types';
1
+ import type { CSSStyles, OnesEditor } from '../core/types';
2
2
  export declare function addClass(dom: Element, ...className: Array<string>): void;
3
3
  export declare function hasClass(dom: Node | null, className: string): boolean;
4
4
  export declare function removeClass(dom: Element, ...className: Array<string>): void;
@@ -37,7 +37,7 @@ export declare function bindKeyDownEvent(input: HTMLInputElement | HTMLTextAreaE
37
37
  export declare function getElementFromPoint(x: number, y: number, options?: {
38
38
  noFilter: boolean;
39
39
  }): Element;
40
- export declare function ensureIsMobileEvent(events: MouseEvent | TouchEvent): events is TouchEvent;
41
40
  export declare function createMouseEventFromTouchEvent(event: TouchEvent, type: 'mousedown' | 'mousemove' | 'mouseup' | 'click'): MouseEvent;
42
- export declare function bindTouchEnd(elem: HTMLElement | Document, callback: (e: any) => void): void;
41
+ export declare function ensureIsMobileEvent(events: MouseEvent | TouchEvent): events is TouchEvent;
42
+ export declare function bindDbClick(editor: OnesEditor, elem: HTMLElement, handler: (event: MouseEvent) => void): () => void;
43
43
  export {};
@@ -42,4 +42,5 @@ export declare class ImageObject implements ImageObjectBase {
42
42
  private setData;
43
43
  static create(editor: OnesEditor, blockData: DocEmbedBlock): ImageObject;
44
44
  static getImageObject(editor: OnesEditor, block: BlockElement | string): ImageObject;
45
+ static findImageObject(editor: OnesEditor, block: BlockElement | string): ImageObject | null;
45
46
  }
@@ -1,24 +1,31 @@
1
1
  /// <reference types="lodash" />
2
2
  import { CommandItem, OnesEditor, OnesEditorCustom } from '../../../@ones-editor/core';
3
- import { AutoSuggestAnchor, OnesEditorAutoSuggest } from '../../../@ones-editor/ui-base';
3
+ import { AutoSuggestAnchor, EditorInput, OnesEditorAutoSuggest } from '../../../@ones-editor/ui-base';
4
4
  import { MentionOptions } from './types';
5
+ interface MobileWrap {
6
+ wrapper: HTMLElement;
7
+ input: EditorInput;
8
+ content: HTMLElement;
9
+ }
5
10
  export default class OnesEditorMention implements OnesEditorCustom {
6
11
  private editor;
7
12
  private options;
8
13
  suggest: OnesEditorAutoSuggest;
9
- private mobileWrap;
14
+ private mobileWrap?;
10
15
  private items;
11
16
  constructor(editor: OnesEditor, options: MentionOptions);
12
17
  createMobileHeader: () => HTMLDivElement | undefined;
13
18
  onClose: () => void;
14
19
  destroy(): void;
15
20
  onShow: (suggest: OnesEditorAutoSuggest, containerId: string, blockIndex: number, offset: number) => boolean;
21
+ onShown: (bar: OnesEditorAutoSuggest) => void;
16
22
  handleClickItem: (item: CommandItem) => void;
17
23
  handleMobileWrapClick: (e: Event) => void;
18
24
  onClickItem: (menu: OnesEditorAutoSuggest, item: CommandItem, anchor: AutoSuggestAnchor) => void;
19
25
  createItemElement: (item: CommandItem, find: string) => HTMLElement;
20
26
  createMobileItems: (content: HTMLElement, items: CommandItem[], find: string) => void;
21
27
  onInputChanged: import("lodash").DebouncedFunc<(content: HTMLElement, e: Event) => void>;
28
+ createMobileWrap: () => MobileWrap;
22
29
  createMobileCommandItem: (items: CommandItem[]) => {
23
30
  id: string;
24
31
  name: string;
@@ -27,3 +34,4 @@ export default class OnesEditorMention implements OnesEditorCustom {
27
34
  _queryItems: (text: string) => Promise<CommandItem[]>;
28
35
  queryItems: (menu: OnesEditorAutoSuggest, text: string) => Promise<CommandItem[]>;
29
36
  }
37
+ export {};
@@ -1,4 +1,4 @@
1
- import { type CommandItem, type OnesEditor } from '../../../@ones-editor/core';
1
+ import { CommandItem, OnesEditor } from '../../../@ones-editor/core';
2
2
  export declare class CursorToolbarHandler {
3
3
  private editor;
4
4
  private toolbar;
@@ -5,18 +5,14 @@ export declare class MobileCommandHandler {
5
5
  private editor;
6
6
  private commandBar;
7
7
  private observer;
8
+ private timer;
9
+ private mobileClient?;
8
10
  constructor(editor: OnesEditor);
9
- destroy(): void;
10
- private showKeyboard;
11
- private initViewportHeight;
12
- private get isKeyboardShow();
13
- private get virtualViewportHeight();
14
- private get clientHeight();
15
- private get virtualViewportOffsetTop();
16
- private get window();
17
- private setDebugInfo;
18
11
  private toggleDelay;
19
- toggle: import("lodash").DebouncedFunc<() => void>;
12
+ private preHeight;
13
+ layoutBar: import("lodash").DebouncedFunc<() => void>;
14
+ handScroll: import("lodash").DebouncedFunc<() => void>;
15
+ destroy(): void;
20
16
  handleFocusIn: () => void;
21
17
  handleFocusOut: () => void;
22
18
  }
@@ -1,15 +1,13 @@
1
- import { BlockElement, CommandItem, CommandParams, ContainerElement, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../../@ones-editor/core';
1
+ import { BlockElement, CommandItem, CommandItemWithSource, CommandParams, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../../@ones-editor/core';
2
2
  import { ProxyProvider } from '../../../../../@ones-editor/ui';
3
- export default class InsertMenuProvider extends ProxyProvider {
3
+ export default class MobileInsertMenuProvider extends ProxyProvider {
4
4
  private editor;
5
5
  id: string;
6
6
  get whiteList(): string[];
7
7
  providers: OnesEditorCommandProvider[];
8
8
  constructor(editor: OnesEditor);
9
- getNextBlock(container: ContainerElement, block: BlockElement): number;
10
9
  getInsertCommands: () => CommandItem[];
11
- getAvailableCommands: (editor: OnesEditor, block: BlockElement, range: SelectionRange) => CommandItem[];
10
+ getAvailableCommands: (editor: OnesEditor, block: BlockElement, range: SelectionRange, params?: CommandParams) => CommandItem[];
12
11
  executeInsertCommand: () => boolean;
13
- getNextBlockIndex: (container: ContainerElement, block: BlockElement) => number;
14
- executeCommand: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItem, params: CommandParams) => boolean;
12
+ executeCommand: (editor: OnesEditor, block: BlockElement, range: SelectionRange, item: CommandItemWithSource, params: CommandParams) => boolean;
15
13
  }
@@ -5,6 +5,9 @@ export declare class MobileToolbarHandler {
5
5
  private fixedProviders;
6
6
  bar: HTMLElement;
7
7
  constructor(editor: OnesEditor, parent: HTMLElement);
8
+ private subBar;
9
+ private handleSubBarShown;
10
+ layoutSubBar(): void;
8
11
  private handleSelectionChange;
9
12
  handleClick: (_: any, item: CommandItem) => void;
10
13
  destroy(): void;
@@ -1,8 +1,8 @@
1
1
  /// <reference types="lodash" />
2
2
  import { OnesEditor, OnesEditorCustom } from '../../../@ones-editor/core';
3
3
  import { MobileCommandHandler } from './fixed-toolbar';
4
- import './mobile-helper-styles.scss';
5
4
  import './locale';
5
+ import './mobile-helper-styles.scss';
6
6
  export { MobileCommandHandler };
7
7
  export declare class OnesEditorMobileHelper implements OnesEditorCustom {
8
8
  private editor;
@@ -18,5 +18,6 @@ export declare class OnesEditorMobileHelper implements OnesEditorCustom {
18
18
  handleLongPress: (event: TouchEvent) => boolean;
19
19
  handleTouchMove: (event: TouchEvent) => void;
20
20
  handleTouchStart: (event: TouchEvent) => void;
21
+ debounceShowCursorToolbar: import("lodash").DebouncedFunc<() => void>;
21
22
  handleTouchEnd: (event: TouchEvent) => void;
22
23
  }
@@ -1,5 +1,5 @@
1
1
  import { ContainerElement, ScrollAreaElement, ScrollContainerElement, ScrollCore } from './common-types';
2
- export declare function getContainerOption(scrollCore: ScrollCore, container: ContainerElement): import("./types").ScrollContainerOptions | undefined;
2
+ export declare function getContainerOption(scrollCore: ScrollCore, container: ContainerElement): import("@ones-editor/editor").ScrollContainerOptions | undefined;
3
3
  export declare function getScrollContainer(scrollChild: HTMLElement): ScrollContainerElement;
4
4
  export declare function getContainerScrollArea(scrollContainer: ScrollContainerElement): ScrollAreaElement;
5
5
  export declare function getContainer(scrollChild: HTMLElement): ContainerElement;
@@ -1,12 +1,9 @@
1
1
  import TableBlock, { includeBigTable } from './table-block';
2
- import { TableBlockCommandProvider, deleteColumns, deleteRows, setStripeStyle, setColTitle, setRowTitle, insertColumn, insertRow } from './commands';
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
- import { createEntireRowAndColumnRange, getAbstractTableSelectionRange } from './table-block/cell-menu/table-cell-dom';
7
- import MobileTableCommandProvider from './commands/table-command-provider';
6
+ import MobileTableCommandProvider from './commands/mobile-command-provider';
8
7
  export * from './types';
9
8
  export { MobileTableCommandProvider, TableBlock, TableBlockCommandProvider, TableShortcuts, includeBigTable };
10
- export { deleteColumns, deleteRows, setStripeStyle, setColTitle, setRowTitle, insertColumn, insertRow, };
11
- export { createEntireRowAndColumnRange, getAbstractTableSelectionRange };
12
9
  export type { CreateTableData } from './table-block/table-creator';
@@ -1,3 +1,2 @@
1
1
  import { HideTooltipShortcuts } from './shortcut-handler';
2
- import './locale';
3
2
  export { HideTooltipShortcuts };