@kaitify/core 0.0.2-beta.18 → 0.0.2-beta.19
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.
- package/lib/extensions/attachment/element.d.ts +1 -0
- package/lib/extensions/attachment/index.d.ts +10 -1
- package/lib/extensions/horizontal/element.d.ts +1 -0
- package/lib/extensions/horizontal/index.d.ts +10 -1
- package/lib/extensions/image/element.d.ts +1 -0
- package/lib/extensions/math/element.d.ts +1 -0
- package/lib/extensions/task/element.d.ts +1 -0
- package/lib/extensions/video/element.d.ts +1 -0
- package/lib/kaitify-core.es.js +1057 -807
- package/lib/kaitify-core.umd.js +2 -2
- package/lib/model/Editor.d.ts +15 -1
- package/lib/model/KNode.d.ts +0 -4
- package/lib/model/config/event-handler.d.ts +1 -1
- package/lib/model/config/format-rules.d.ts +5 -5
- package/package.json +1 -1
package/lib/model/Editor.d.ts
CHANGED
|
@@ -381,13 +381,27 @@ export declare class Editor {
|
|
|
381
381
|
*/
|
|
382
382
|
scrollViewToSelection(): void;
|
|
383
383
|
/**
|
|
384
|
-
* 根据dom
|
|
384
|
+
* 根据dom查找到编辑内的对应节点。如果是闭合节点内的dom,此时可能无标记或者无对应的节点,则会向上查找,最终找到闭合节点并返回
|
|
385
385
|
*/
|
|
386
386
|
findNode(dom: HTMLElement): KNode;
|
|
387
387
|
/**
|
|
388
388
|
* 根据编辑器内的node查找真实dom
|
|
389
389
|
*/
|
|
390
390
|
findDom(node: KNode): HTMLElement;
|
|
391
|
+
/**
|
|
392
|
+
* 判断某个dom是否在闭合节点对应的真实dom之内。
|
|
393
|
+
* - includeSelf 为 true(默认)时,闭合节点的根 dom 自身也算"在内";
|
|
394
|
+
* - includeSelf 为 false 时,只有闭合节点内部的子孙 dom 才算"在内",根 dom 自身返回 false。
|
|
395
|
+
*/
|
|
396
|
+
isDomInClosedNode(el: HTMLElement, includeSelf?: boolean): boolean;
|
|
397
|
+
/**
|
|
398
|
+
* 获取光标所在的闭合节点,仅当光标在闭合节点的两侧,即offset分别是0和1时,才会返回该闭合节点
|
|
399
|
+
*/
|
|
400
|
+
getClosedNodeBySelection(options?: KNodeMatchOptionType): KNode | null;
|
|
401
|
+
/**
|
|
402
|
+
* 判断光标范围内是否有闭合节点,必须完整包含的闭合节点才会被返回在内
|
|
403
|
+
*/
|
|
404
|
+
hasClosedNodeBySelection(options?: KNodeMatchOptionType): boolean;
|
|
391
405
|
/**
|
|
392
406
|
* 设置编辑器是否可编辑
|
|
393
407
|
*/
|
package/lib/model/KNode.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const onComposition: (this: Editor, e: Event) => Promise<void>;
|
|
|
14
14
|
/**
|
|
15
15
|
* 监听键盘事件
|
|
16
16
|
*/
|
|
17
|
-
export declare const onKeyboard: (this: Editor, e: Event) => void
|
|
17
|
+
export declare const onKeyboard: (this: Editor, e: Event) => Promise<void>;
|
|
18
18
|
/**
|
|
19
19
|
* 监听编辑器获取焦点
|
|
20
20
|
*/
|
|
@@ -7,20 +7,20 @@ export type RuleFunctionType = (state: {
|
|
|
7
7
|
editor: Editor;
|
|
8
8
|
node: KNode;
|
|
9
9
|
}) => void;
|
|
10
|
+
/**
|
|
11
|
+
* 针对节点自身:将带有 contenteditable="false" 标记的节点统一转为闭合节点,并移除该标记(渲染时由框架统一添加)
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatContenteditableToClosed: RuleFunctionType;
|
|
10
14
|
/**
|
|
11
15
|
* 针对节点自身:处理块节点的标签,部分块节点需要转为默认块节点标签
|
|
12
16
|
*/
|
|
13
|
-
export declare const
|
|
17
|
+
export declare const formatBlockTagParse: RuleFunctionType;
|
|
14
18
|
/**
|
|
15
19
|
* 针对子节点中的块节点:
|
|
16
20
|
* 1. 子节点中含有块节点则该节点转为块节点;
|
|
17
21
|
* 2. 子节点中含有块节点,则其他节点也转为块节点
|
|
18
22
|
*/
|
|
19
23
|
export declare const formatBlockInChildren: RuleFunctionType;
|
|
20
|
-
/**
|
|
21
|
-
* 针对节点自身:处理不可编辑的可见的非块级节点:在两侧添加零宽度空白字符 & 重置不可编辑节点内的光标位置
|
|
22
|
-
*/
|
|
23
|
-
export declare const formatUneditableNoodes: RuleFunctionType;
|
|
24
24
|
/**
|
|
25
25
|
* 针对节点的子节点数组:处理子节点中的占位符,如果占位符和其他节点共存则删除占位符,如果只存在占位符则将多个占位符合并为一个(光标可能会更新)
|
|
26
26
|
*/
|