@wangeditor-next/editor 5.6.49 → 5.6.51

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.
@@ -194,6 +194,11 @@ export interface IEditorConfig {
194
194
  * 自定义复制。拦截 event 添加或修改 clipboardData 数据
195
195
  */
196
196
  customCopy?: (editor: IDomEditor, e: ClipboardEvent) => void;
197
+ /**
198
+ * 自定义 HTML 清洗逻辑。在 setHtml / 初始化 html / 默认粘贴 HTML 前执行。
199
+ * 返回值会继续进入编辑器的 HTML 解析流程。
200
+ */
201
+ sanitizeHtml?: (html: string) => string;
197
202
  scroll: boolean;
198
203
  placeholder?: string;
199
204
  readOnly: boolean;
@@ -94,6 +94,7 @@ export declare const DomEditor: {
94
94
  toSlatePoint<T extends boolean>(editor: IDomEditor, domPoint: DOMPoint, options: {
95
95
  exactMatch: T;
96
96
  suppressThrow: T;
97
+ searchDirection?: "forward" | "backward";
97
98
  }): T extends true ? Point | null : Point;
98
99
  hasRange(editor: IDomEditor, range: Range): boolean;
99
100
  getNodeType(node: Node): string;
@@ -11,6 +11,7 @@ import { DOMElement } from '../utils/dom';
11
11
  export type ElementWithId = Element & {
12
12
  id: string;
13
13
  };
14
+ type MoveOptions = Parameters<Editor['move']>[0];
14
15
  export type getMenuConfigReturnType<K> = K extends keyof IMenuConfig ? IMenuConfig[K] : ISingleMenuConfig;
15
16
  /**
16
17
  * 扩展 slate Editor 接口
@@ -53,7 +54,8 @@ export interface IDomEditor extends Editor {
53
54
  getEditableContainer: () => DOMElement;
54
55
  select: (at: Location) => void;
55
56
  deselect: () => void;
56
- move: (distance: number, reverse?: boolean) => void;
57
+ move(options?: MoveOptions): void;
58
+ move(distance: number, reverse?: boolean): void;
57
59
  moveReverse: (distance: number) => void;
58
60
  restoreSelection: () => void;
59
61
  getTableSelection?: () => NodeEntryWithContext[][] | null;
@@ -68,3 +70,4 @@ export interface IDomEditor extends Editor {
68
70
  undo?: () => void;
69
71
  redo?: () => void;
70
72
  }
73
+ export {};
@@ -2,7 +2,7 @@
2
2
  * @description render text node
3
3
  * @author wangfupeng
4
4
  */
5
- import { Text as SlateText, Ancestor } from 'slate';
5
+ import { Ancestor, Text as SlateText } from 'slate';
6
6
  import { VNode } from 'snabbdom';
7
7
  import { IDomEditor } from '../../editor/interface';
8
8
  declare function renderText(textNode: SlateText, parent: Ancestor, editor: IDomEditor): VNode;
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { Dom7Array, DOMElement } from '../utils/dom';
6
6
  declare class TextArea {
7
+ private selectionChangeRoot;
7
8
  readonly id: number;
8
9
  $box: Dom7Array;
9
10
  $textAreaContainer: Dom7Array;
@@ -20,7 +21,9 @@ declare class TextArea {
20
21
  private latestEditorSelection;
21
22
  constructor(boxSelector: string | DOMElement);
22
23
  private get editorInstance();
24
+ private bindSelectionChange;
23
25
  private onDOMSelectionChange;
26
+ flushDOMSelectionChange(): void;
24
27
  /**
25
28
  * 绑定事件,如 beforeinput onblur onfocus keydown click copy/paste drag/drop 等
26
29
  */
@@ -2,8 +2,8 @@
2
2
  * @description textarea helper fns
3
3
  * @author wangfupeng
4
4
  */
5
- import { DOMRange, DOMNode } from '../utils/dom';
6
5
  import { IDomEditor } from '../editor/interface';
6
+ import { DOMNode, DOMRange } from '../utils/dom';
7
7
  /**
8
8
  * Check if two DOM range objects are equal.
9
9
  */
@@ -12,14 +12,18 @@ export declare const isRangeEqual: (a: DOMRange, b: DOMRange) => boolean;
12
12
  * Check if the target is editable and in the editor.
13
13
  */
14
14
  export declare function hasEditableTarget(editor: IDomEditor, target: EventTarget | null): target is DOMNode;
15
+ /**
16
+ * Check if the target is in the editor.
17
+ */
18
+ export declare function hasTarget(editor: IDomEditor, target: EventTarget | null): target is DOMNode;
15
19
  /**
16
20
  * Check if the target is inside void and in an non-readonly editor.
17
21
  */
18
22
  export declare function isTargetInsideNonReadonlyVoid(editor: IDomEditor, target: EventTarget | null): boolean;
19
23
  /**
20
- * Check if the target is in the editor.
24
+ * Check if the target can participate in editor selection.
21
25
  */
22
- export declare function hasTarget(editor: IDomEditor, target: EventTarget | null): target is DOMNode;
26
+ export declare function hasSelectableTarget(editor: IDomEditor, target: EventTarget | null): boolean;
23
27
  /**
24
28
  * Check if a DOM event is overrode by a handler.
25
29
  */
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @description sanitize html before parsing/importing into editor
3
+ * @author Codex
4
+ */
5
+ export declare function defaultSanitizeHtml(html?: string): string;
@@ -56,3 +56,5 @@ export declare const CHANGING_NODE_PATH: WeakMap<Editor, Path>;
56
56
  export declare const EDITOR_TO_SELECTION: WeakMap<Editor, Range>;
57
57
  export declare const EDITOR_TO_EMITTER: WeakMap<Editor, Emitter>;
58
58
  export declare const EDITOR_TO_CAN_PASTE: WeakMap<Editor, boolean>;
59
+ export declare const EDITOR_TO_PENDING_COMPOSITION_END: WeakMap<Editor, boolean>;
60
+ export declare const EDITOR_TO_PENDING_SELECTION: WeakMap<Editor, Range | null>;