@ones-editor/editor 2.2.0 → 2.2.1

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.
@@ -1,4 +1,5 @@
1
- import { OnesEditor, BlockElement, BlockPosition, ContainerElement, ComplexBlockPosition, GetChildContainerOptions, ComplexSelectionRange } from '../../types';
1
+ import { OnesEditor, BlockElement, BlockPosition, ContainerElement, GetChildContainerOptions, ComplexSelectionRange } from '../../types';
2
+ export declare const logger: import("../../../utils").Logger;
2
3
  export declare function complexBlockGetAllChildContainers(editor: OnesEditor, block: BlockElement, options?: GetChildContainerOptions): ContainerElement[];
3
4
  export declare function complexBlockGetSelectedContainers(editor: OnesEditor, block: BlockElement, start: BlockPosition, end: BlockPosition): ContainerElement[];
4
5
  export declare function isFirstChildBlockInComplexBlock(editor: OnesEditor, childBlock: BlockElement): boolean;
@@ -9,8 +10,4 @@ export declare function findPrevSimpleBlockBeforeChildContainer(editor: OnesEdit
9
10
  export declare function complexBlockGetTopChildContainers(editor: OnesEditor, complexBlock: BlockElement): ContainerElement[];
10
11
  export declare function complexBlockGetBottomChildContainers(editor: OnesEditor, complexBlock: BlockElement): ContainerElement[];
11
12
  export declare function complexBlockFindNearestChildBlock(editor: OnesEditor, complexBlock: BlockElement, x: number, y: number): BlockElement;
12
- export declare function complexBlockAdjustSelectionPos(editor: OnesEditor, complexBlock: BlockElement, anchor: ComplexBlockPosition, focus: ComplexBlockPosition): {
13
- anchor: ComplexBlockPosition;
14
- focus: ComplexBlockPosition;
15
- };
16
13
  export declare function isFullSelectedOneComplexBlock(editor: OnesEditor, complexRange?: ComplexSelectionRange): boolean;
@@ -1,5 +1,4 @@
1
- import { BlockElement, TextBlockContentTextChild, TextBlockContentBoxChild, TextBlockContentInsertionChild, TextBlockContentChild } from '../../../types';
2
- export type { TextBlockContentTextChild, TextBlockContentBoxChild, TextBlockContentInsertionChild, TextBlockContentChild };
1
+ import { BlockElement, TextBlockContentChild } from '../../../types';
3
2
  export type TextBlockContentChildren = TextBlockContentChild[];
4
3
  export type TextBlockContentChildType = 'text' | 'box' | 'insertion';
5
4
  export declare function isTextBlockContentChild(elem: Element): boolean;
@@ -1,5 +1,4 @@
1
- import { BlockElement, SimpleBlockPosition } from '../../../types';
2
- import { TextBlockContentChild } from './child';
1
+ import { BlockElement, SimpleBlockPosition, TextBlockContentChild } from '../../../types';
3
2
  export interface LineBreakInfo {
4
3
  offset: number;
5
4
  type: 'betweenChild' | 'textBreakWord';
@@ -1,5 +1,4 @@
1
- import { BlockElement, BoxElement, InsertionElement } from '../../../types';
2
- import { TextBlockContentChild } from './child';
1
+ import { BlockElement, BoxElement, InsertionElement, TextBlockContentChild } from '../../../types';
3
2
  export interface BlockRangeInfo {
4
3
  child: TextBlockContentChild;
5
4
  container: Text | BoxElement | HTMLBRElement | InsertionElement;
@@ -1,5 +1,4 @@
1
- import { BlockElement } from '../../../types';
2
- import { TextBlockContentChild } from './child';
1
+ import { BlockElement, TextBlockContentChild } from '../../../types';
3
2
  export declare function getChildOffset(block: BlockElement, child: TextBlockContentChild): {
4
3
  start: number;
5
4
  end: number;
@@ -32,7 +32,7 @@ export declare class EditorInput implements OnesEditorInput {
32
32
  getInput(): HTMLTextAreaElement;
33
33
  focus(options?: FocusOptions): void;
34
34
  isInDisableScrollMask(target: Node): boolean;
35
- handleWindowBlur: () => void;
35
+ handleBlur: () => void;
36
36
  handleWindowFocus: () => void;
37
37
  handleDocumentClick: (event: MouseEvent | TouchEvent) => void;
38
38
  handleDocumentSelectionChange: () => void;
@@ -19,7 +19,8 @@ export declare class EditorInputHandlers implements EditorInputCallbacks {
19
19
  onPaste(event: ClipboardEvent): void;
20
20
  onPasteText: (text: string, options?: PasteOptions) => Promise<void>;
21
21
  onFocus(): void;
22
- onBlur: import("lodash").DebouncedFunc<() => void>;
22
+ onBlur: () => void;
23
+ debounceBlur: import("lodash").DebouncedFunc<() => void>;
23
24
  removeActiveForBlur: import("lodash").DebouncedFunc<() => void>;
24
25
  addHandler(handler: OnesEditorInputHandler): void;
25
26
  removeHandler(handler: OnesEditorInputHandler): void;
@@ -6,5 +6,6 @@ export default class EditorInsertions {
6
6
  constructor(editor: OnesEditor);
7
7
  registerInsertionClass(insertionClass: Insertion): void;
8
8
  getInsertionClass(type: string): Insertion;
9
+ private createInsertionElement;
9
10
  createInsertion(blockContent: BlockContentElement, insertion: DocInsertion): InsertionElement;
10
11
  }
@@ -1,4 +1,4 @@
1
- import { BlockPosition, OnesEditor } from '../types';
1
+ import { BlockElement, BlockPosition, OnesEditor, ComplexBlockPosition } from '../types';
2
2
  import { EditorComplexBlockPosition, EditorSimpleBlockPosition } from './editor-position';
3
3
  type AdjustSelectionPosResult = {
4
4
  anchor: EditorSimpleBlockPosition;
@@ -7,5 +7,9 @@ type AdjustSelectionPosResult = {
7
7
  anchor: EditorComplexBlockPosition;
8
8
  focus: EditorComplexBlockPosition;
9
9
  };
10
+ export declare function complexBlockAdjustSelectionPos(editor: OnesEditor, complexBlock: BlockElement, anchor: ComplexBlockPosition, focus: ComplexBlockPosition): {
11
+ anchor: ComplexBlockPosition;
12
+ focus: ComplexBlockPosition;
13
+ };
10
14
  export declare function adjustSelectionPos(editor: OnesEditor, anchor: BlockPosition, focus: BlockPosition): AdjustSelectionPosResult | null;
11
15
  export {};
@@ -688,6 +688,7 @@ export interface OnesEditorInputHandler {
688
688
  handleRemoteChanged?: (editor: OnesEditor, type: RemoteChangeType) => void;
689
689
  handleCompositionStart?: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number) => void;
690
690
  handleUpdateCompositionText?: (editor: OnesEditor, containerId: string, blockIndex: number, offset: number, end: boolean) => void;
691
+ handleBlur?: (editor: OnesEditor) => void;
691
692
  destroy?: (editor: OnesEditor) => void;
692
693
  }
693
694
  export interface OnesEditorBlocks {
@@ -1,6 +1,5 @@
1
1
  import { TypedEmitter } from 'tiny-typed-emitter';
2
- import type { TextBlockContentChild } from '../core/blocks/text-blocks/base/child';
3
- import { BlockElement, OnesEditor, OnesEditorCustom } from '../core/types';
2
+ import { BlockElement, OnesEditor, OnesEditorCustom, TextBlockContentChild } from '../core/types';
4
3
  export interface OnesEditorHoveringBlockEvents {
5
4
  change: (block: BlockElement | null, old: BlockElement | null, event: MouseEvent) => void;
6
5
  targetChange: (block: BlockElement | null, old: BlockElement | null, target: EventTarget | null, oldTarget: EventTarget | null) => void;
@@ -7,5 +7,9 @@
7
7
  "@types/react": "^18.0.26",
8
8
  "@types/react-dom": "^18.0.9"
9
9
  },
10
+ "peerDependencies": {
11
+ "react": "^17.0.2 || ^18.2.0",
12
+ "react-dom": "^17.0.2 || ^18.2.0"
13
+ },
10
14
  "types": "src/index.d.ts"
11
15
  }
@@ -1,3 +1,5 @@
1
+ import { DocBlock } from '../../../../@ones-editor/core';
1
2
  import { DocListBlock, ListBlockType } from '../types';
2
3
  export declare function getListType(listData: DocListBlock): ListBlockType;
3
4
  export declare function getListMarker(listData: DocListBlock): string;
5
+ export declare function pickTextBlockData(listBlockData: DocBlock): DocBlock;