@ones-editor/editor 1.1.8 → 1.1.10

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 (31) hide show
  1. package/@ones-editor/block-menu/src/block-menu/standard-block-actions/hook.d.ts +2 -0
  2. package/@ones-editor/core/src/core/blocks/common/execute-block-command.d.ts +2 -2
  3. package/@ones-editor/core/src/core/blocks/complex-blocks/complex-block-helper.d.ts +1 -1
  4. package/@ones-editor/core/src/core/command-providers/commands/range-commands.d.ts +1 -1
  5. package/@ones-editor/core/src/core/command-providers/editor-command-providers.d.ts +1 -1
  6. package/@ones-editor/core/src/core/composition/clipboard/copy.d.ts +2 -1
  7. package/@ones-editor/core/src/core/composition/index.d.ts +1 -1
  8. package/@ones-editor/core/src/core/containers/root-container.d.ts +1 -0
  9. package/@ones-editor/core/src/core/editor/editor-dom/editor-dom.d.ts +4 -3
  10. package/@ones-editor/core/src/core/editor/index.d.ts +1 -0
  11. package/@ones-editor/core/src/core/selection/ensure-block-visible.d.ts +2 -0
  12. package/@ones-editor/core/src/core/types.d.ts +8 -2
  13. package/@ones-editor/core/src/utils/animate-scroll.d.ts +4 -0
  14. package/@ones-editor/heading-collapse/src/doc-event/collapse-handler.d.ts +3 -0
  15. package/@ones-editor/heading-collapse/src/heading-collapse-button/collapse-heading-block.d.ts +2 -0
  16. package/@ones-editor/heading-collapse/src/heading-collapse-button/index.d.ts +3 -1
  17. package/@ones-editor/heading-collapse/src/heading-collapse-button/paste-handler.d.ts +8 -0
  18. package/@ones-editor/table-block/src/index.d.ts +2 -2
  19. package/@ones-editor/table-block/src/table-block/index.d.ts +1 -0
  20. package/@ones-editor/table-block/src/table-block/table-dom.d.ts +1 -0
  21. package/@ones-editor/table-block/src/types.d.ts +1 -0
  22. package/@ones-editor/to-docx/src/doc2other/image.d.ts +1 -1
  23. package/@ones-editor/to-docx/src/doc2other/types.d.ts +1 -1
  24. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  25. package/@ones-editor/ui/src/index.d.ts +2 -2
  26. package/@ones-editor/ui/src/quick-menu/basic-menu-items.d.ts +2 -2
  27. package/@ones-editor/ui/src/quick-menu/inline-box-items.d.ts +2 -2
  28. package/@ones-editor/ui/src/quick-menu/types.d.ts +7 -2
  29. package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +1 -0
  30. package/dist/index.js +195 -195
  31. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
1
  import { BlockCommands, BlockElement, CommandItem, OnesEditor, OnesEditorBlockHook } from '../../../../../@ones-editor/core';
2
2
  export default class StandardBlockActionHook implements OnesEditorBlockHook {
3
3
  commands(editor: OnesEditor, blockElement: BlockElement): BlockCommands;
4
+ deleteBlock(editor: OnesEditor, block: BlockElement): void;
5
+ copyBlock(editor: OnesEditor, block: BlockElement): void;
4
6
  executeCommand: (editor: OnesEditor, bloockElement: BlockElement, item: CommandItem) => void;
5
7
  }
@@ -1,3 +1,3 @@
1
- import { BlockElement, CommandItem, OnesEditor } from '../../types';
1
+ import { BlockCommandItemWithSource, BlockElement, CommandItem, OnesEditor } from '../../types';
2
2
  export declare function executeEmbedBlockCommand(editor: OnesEditor, block: BlockElement, commandGroup: string, item: CommandItem): unknown;
3
- export declare function executeBlockCommand(editor: OnesEditor, block: BlockElement, commandGroup: string, item: CommandItem): unknown;
3
+ export declare function executeBlockCommand(editor: OnesEditor, block: BlockElement, commandGroup: string, item: BlockCommandItemWithSource): unknown;
@@ -4,7 +4,7 @@ export declare function complexBlockGetSelectedContainers(editor: OnesEditor, bl
4
4
  export declare function isFirstChildBlockInComplexBlock(editor: OnesEditor, childBlock: BlockElement): boolean;
5
5
  export declare function complexBlockGeFirstSimpleChild(editor: OnesEditor, complexBlock: BlockElement, options?: GetChildContainerOptions): BlockElement | null;
6
6
  export declare function complexBlockGetLastSimpleChild(editor: OnesEditor, complexBlock: BlockElement, options?: GetChildContainerOptions): BlockElement | null;
7
- export declare function findPrevSimpleBlockBeforeChildContainer(editor: OnesEditor, childContainer: ContainerElement): BlockElement | null;
7
+ export declare function findPrevSimpleBlockBeforeChildContainer(editor: OnesEditor, childContainer: ContainerElement, options?: GetChildContainerOptions): BlockElement | null;
8
8
  export declare function complexBlockGetTopChildContainers(editor: OnesEditor, complexBlock: BlockElement): ContainerElement[];
9
9
  export declare function complexBlockGetBottomChildContainers(editor: OnesEditor, complexBlock: BlockElement): ContainerElement[];
10
10
  export declare function complexBlockFindNearestChildBlock(editor: OnesEditor, complexBlock: BlockElement, x: number, y: number): BlockElement;
@@ -1,5 +1,5 @@
1
1
  import { BlockCommandItemWithSource, CommandParams, CommandResult, SelectionRange } from '../../types';
2
- export declare function getRangeCommands(range: SelectionRange): BlockCommandItemWithSource[];
2
+ export declare function getRangeCommands(range: SelectionRange, source: string): BlockCommandItemWithSource[];
3
3
  export declare function executeRangeCommand(range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams): {
4
4
  [index: string]: CommandResult;
5
5
  };
@@ -7,7 +7,7 @@ export default class EditorCommandProviders implements OnesEditorCommandProvider
7
7
  registerCommandProvider(provider: OnesEditorCommandProvider): void;
8
8
  getCommandProviders(): OnesEditorCommandProvider[];
9
9
  getCommandProvider(id: string): OnesEditorCommandProvider;
10
- getCommands(range: SelectionRange): BlockCommandItemWithSource[];
10
+ getCommands(range: SelectionRange, source: string): BlockCommandItemWithSource[];
11
11
  executeCommand(range: SelectionRange, command: BlockCommandItemWithSource, params: CommandParams): {
12
12
  [index: string]: import("../types").CommandResult;
13
13
  };
@@ -4,5 +4,6 @@ export declare function injectDocToHtmlFragment(htmlFragment: string, doc: DocOb
4
4
  export declare function addMetaToDoc(editor: OnesEditor, doc: DocObject): void;
5
5
  export type BeforeCopyCallback = (editor: OnesEditor, event: ClipboardEvent, doc: DocObject) => DocObject | boolean | undefined;
6
6
  export declare function editorCopy(editor: OnesEditor, event: ClipboardEvent, beforeCopy?: BeforeCopyCallback): void;
7
+ export declare function editorCopyDoc(editor: OnesEditor, doc: DocObject): void;
7
8
  export declare function editorCopyWithoutEvent(editor: OnesEditor, beforeCopy?: BeforeCopyCallback): void;
8
- export declare function editorCopyBlock(editor: OnesEditor, block: BlockElement): Promise<boolean>;
9
+ export declare function editorCopyBlock(editor: OnesEditor, block: BlockElement): Promise<void>;
@@ -1,2 +1,2 @@
1
- export { editorCopyBlock, addMetaToDoc, injectDocToHtmlFragment } from './clipboard/copy';
1
+ export { editorCopyBlock, editorCopyDoc, addMetaToDoc, injectDocToHtmlFragment } from './clipboard/copy';
2
2
  export { copyResourcesFromDoc } from './clipboard/resources/copy-resources';
@@ -5,6 +5,7 @@ export declare class RootContainer {
5
5
  rootContainer: ContainerElement;
6
6
  resizeObserver: ResizeObserver;
7
7
  private isMoved;
8
+ private mouseDownEvent;
8
9
  constructor(editor: OnesEditor, rootContainer: ContainerElement);
9
10
  private bindEvents;
10
11
  private unbindEvents;
@@ -1,9 +1,10 @@
1
- import { OnesEditor, SimpleBlockPosition, ContainerElement } from '../../types';
1
+ import { OnesEditor, SimpleBlockPosition } from '../../types';
2
2
  export declare function editorGetClientHeight(editor: OnesEditor): number;
3
3
  export declare function editorGetClientTop(editor: OnesEditor): number;
4
4
  export declare function editorGetClientBottom(editor: OnesEditor): number;
5
5
  export declare function editorGetVisibleRect(editor: OnesEditor): DOMRect;
6
6
  export declare function isBlockPositionVisible(editor: OnesEditor, pos: SimpleBlockPosition): boolean;
7
- export declare function isChildContainerVisible(editor: OnesEditor, container: ContainerElement): boolean;
7
+ export declare function scrollIntoView(editor: OnesEditor, target: HTMLElement, options?: {
8
+ animation?: boolean;
9
+ }): void;
8
10
  export declare function editorScrollIntoView(editor: OnesEditor): void;
9
- export declare function scrollIntoView(dom: Element, options?: any): void;
@@ -1,2 +1,3 @@
1
1
  export * from './editor';
2
2
  export * from './actions';
3
+ export { scrollIntoView } from './editor-dom';
@@ -0,0 +1,2 @@
1
+ import { BlockElement, OnesEditor } from '../types';
2
+ export declare function ensureBlockVisible(editor: OnesEditor, block: BlockElement): void;
@@ -78,7 +78,7 @@ export interface InsertEmptyBlockOptions {
78
78
  containerId: string;
79
79
  blockIndex: number;
80
80
  data?: Record<string, unknown>;
81
- from?: 'block-menu' | 'quick-menu';
81
+ from?: 'block-menu' | 'quick-menu' | 'add-block-menu';
82
82
  }
83
83
  export interface EmbedOptions {
84
84
  name: string;
@@ -255,6 +255,8 @@ export interface ComplexKindBlock extends Block {
255
255
  focus: ComplexBlockPosition;
256
256
  };
257
257
  getTextToolbarReferenceClient?: (editor: OnesEditor, complexBlock: BlockElement) => DOMRect | undefined;
258
+ isChildContainerVisible?: (editor: OnesEditor, complexBlock: BlockElement, childContainer: ContainerElement) => boolean;
259
+ showChildContainer?: (editor: OnesEditor, complexBlock: BlockElement, childContainer: ContainerElement) => void;
258
260
  }
259
261
  export interface SelectedBlock {
260
262
  block: BlockElement;
@@ -380,6 +382,9 @@ export interface OnesEditorEvents {
380
382
  'blur': (editor: OnesEditor) => void;
381
383
  'focus': (editor: OnesEditor) => void;
382
384
  'containerRemount': (editor: OnesEditor, containerId: string) => void;
385
+ 'beforeExecCommand': (editor: OnesEditor, command: CommandItem, option: {
386
+ source: string;
387
+ }) => void;
383
388
  }
384
389
  export interface OnesEditorSettingsProvider {
385
390
  getItem: (key: string) => string | null;
@@ -476,6 +481,7 @@ export interface OnesEditor extends TypedEmitter<OnesEditorEvents> {
476
481
  readonly options: OnesEditorOptions;
477
482
  readonly domEvents: OnesEditorDomEvents;
478
483
  readonly settingsProvider: OnesEditorSettingsProvider;
484
+ version: string;
479
485
  readonly: boolean;
480
486
  addCustom: <T extends OnesEditorCustom>(name: string, creator: OnesEditorCustomCreator) => T;
481
487
  getCustom: <T extends OnesEditorCustom>(name: string) => T;
@@ -667,7 +673,7 @@ export interface OnesEditorCommandProviders {
667
673
  registerCommandProvider: (provider: OnesEditorCommandProvider) => void;
668
674
  getCommandProviders: () => OnesEditorCommandProvider[];
669
675
  getCommandProvider: (id: string) => OnesEditorCommandProvider;
670
- getCommands: (range: SelectionRange) => BlockCommandItemWithSource[];
676
+ getCommands: (range: SelectionRange, source: string) => BlockCommandItemWithSource[];
671
677
  executeCommand: (range: SelectionRange, item: BlockCommandItemWithSource, params: CommandParams) => {
672
678
  [index: string]: CommandResult;
673
679
  };
@@ -8,6 +8,8 @@ export interface IUserOptions {
8
8
  minDuration?: number;
9
9
  speed?: number;
10
10
  verticalOffset?: number;
11
+ disableHorizontal?: boolean;
12
+ disableVertical?: boolean;
11
13
  }
12
14
  export interface IOptions {
13
15
  cancelOnUserAction: boolean;
@@ -18,6 +20,8 @@ export interface IOptions {
18
20
  minDuration: number;
19
21
  speed: number;
20
22
  verticalOffset: number;
23
+ disableHorizontal?: boolean;
24
+ disableVertical?: boolean;
21
25
  }
22
26
  declare function animateScrollTo(y: number, userOptions?: IUserOptions): Promise<boolean>;
23
27
  declare function animateScrollTo(coords: TCoords, userOptions?: IUserOptions): Promise<boolean>;
@@ -0,0 +1,3 @@
1
+ import { OnesEditor } from '../../../../@ones-editor/core';
2
+ export declare function getCollapsedHeading(editor: OnesEditor, blockId: string): boolean | undefined;
3
+ export declare function setCollapsedHeading(editor: OnesEditor, blockId: string, collapsed: boolean): void;
@@ -1,5 +1,7 @@
1
1
  import { BlockElement, OnesEditor } from '../../../../@ones-editor/core';
2
2
  export declare function getHeadingBlockChildren(block: BlockElement): BlockElement[];
3
+ export declare function getNextHiddenBlocks(block: BlockElement): BlockElement[];
3
4
  export declare function collapseHeadingBlock(editor: OnesEditor, block: BlockElement): void;
5
+ export declare function showBlocks(editor: OnesEditor, blocks: BlockElement[]): void;
4
6
  export declare function expandHeadingBlock(editor: OnesEditor, block: BlockElement): void;
5
7
  export declare function toggleHeadingBlock(editor: OnesEditor, block: BlockElement): void;
@@ -1,2 +1,4 @@
1
+ import { getHeadingBlockChildren } from './collapse-heading-block';
1
2
  import { HeadingBlockCollapseButton } from './heading-block-collapse-button-render';
2
- export { HeadingBlockCollapseButton };
3
+ export * from './heading-utils';
4
+ export { HeadingBlockCollapseButton, getHeadingBlockChildren };
@@ -0,0 +1,8 @@
1
+ import { DocObject, OnesEditor, OnesEditorCustom, OnesEditorInputHandler } from '../../../../@ones-editor/core';
2
+ export declare class HeadingPasteHandler implements OnesEditorInputHandler, OnesEditorCustom {
3
+ private startIndex;
4
+ private containerId;
5
+ handleBeforePaste(editor: OnesEditor): Promise<boolean>;
6
+ handleAfterPasteDoc(editor: OnesEditor, doc: DocObject): Promise<boolean>;
7
+ destroy(): void;
8
+ }
@@ -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;
@@ -6,4 +6,5 @@ export interface TableOptions {
6
6
  allowScrollBarFixed?: boolean;
7
7
  hideCellMenu?: boolean;
8
8
  hideToolbar?: boolean;
9
+ bigTableBoundary?: number;
9
10
  }
@@ -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;