@wangeditor-next/core 1.7.6 → 1.7.8
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/dist/core/src/config/index.d.ts +13 -13
- package/dist/core/src/config/interface.d.ts +58 -58
- package/dist/core/src/config/register.d.ts +12 -12
- package/dist/core/src/constants/index.d.ts +1 -1
- package/dist/core/src/constants/svg.d.ts +12 -12
- package/dist/core/src/create/bind-node-relation.d.ts +15 -15
- package/dist/core/src/create/create-editor.d.ts +21 -21
- package/dist/core/src/create/create-toolbar.d.ts +14 -14
- package/dist/core/src/create/helper.d.ts +30 -30
- package/dist/core/src/create/index.d.ts +7 -7
- package/dist/core/src/editor/dom-editor.d.ts +143 -143
- package/dist/core/src/editor/interface.d.ts +67 -67
- package/dist/core/src/editor/plugins/with-config.d.ts +7 -6
- package/dist/core/src/editor/plugins/with-content.d.ts +7 -6
- package/dist/core/src/editor/plugins/with-dom.d.ts +10 -9
- package/dist/core/src/editor/plugins/with-emitter.d.ts +7 -6
- package/dist/core/src/editor/plugins/with-event-data.d.ts +7 -6
- package/dist/core/src/editor/plugins/with-max-length.d.ts +7 -6
- package/dist/core/src/editor/plugins/with-selection.d.ts +7 -6
- package/dist/core/src/i18n/index.d.ts +32 -32
- package/dist/core/src/index.d.ts +32 -32
- package/dist/core/src/menus/bar/HoverBar.d.ts +48 -48
- package/dist/core/src/menus/bar/Toolbar.d.ts +35 -35
- package/dist/core/src/menus/bar-item/BaseButton.d.ts +26 -26
- package/dist/core/src/menus/bar-item/DropPanelButton.d.ts +14 -14
- package/dist/core/src/menus/bar-item/GroupButton.d.ts +17 -17
- package/dist/core/src/menus/bar-item/ModalButton.d.ts +25 -25
- package/dist/core/src/menus/bar-item/Select.d.ts +22 -22
- package/dist/core/src/menus/bar-item/SimpleButton.d.ts +11 -11
- package/dist/core/src/menus/bar-item/index.d.ts +24 -24
- package/dist/core/src/menus/bar-item/tooltip.d.ts +6 -6
- package/dist/core/src/menus/helpers/helpers.d.ts +18 -18
- package/dist/core/src/menus/helpers/position.d.ts +36 -36
- package/dist/core/src/menus/index.d.ts +9 -9
- package/dist/core/src/menus/interface.d.ts +66 -66
- package/dist/core/src/menus/panel-and-modal/BaseClass.d.ts +26 -26
- package/dist/core/src/menus/panel-and-modal/DropPanel.d.ts +14 -14
- package/dist/core/src/menus/panel-and-modal/Modal.d.ts +44 -44
- package/dist/core/src/menus/panel-and-modal/SelectList.d.ts +20 -20
- package/dist/core/src/menus/register.d.ts +16 -16
- package/dist/core/src/parse-html/helper.d.ts +10 -10
- package/dist/core/src/parse-html/index.d.ts +35 -35
- package/dist/core/src/parse-html/parse-common-elem-html.d.ts +15 -15
- package/dist/core/src/parse-html/parse-elem-html.d.ts +15 -15
- package/dist/core/src/parse-html/parse-text-elem-html.d.ts +15 -15
- package/dist/core/src/render/element/getRenderElem.d.ts +11 -11
- package/dist/core/src/render/element/renderElement.d.ts +9 -9
- package/dist/core/src/render/element/renderStyle.d.ts +13 -13
- package/dist/core/src/render/helper.d.ts +6 -6
- package/dist/core/src/render/index.d.ts +27 -27
- package/dist/core/src/render/node2Vnode.d.ts +15 -15
- package/dist/core/src/render/text/genVnode.d.ts +9 -9
- package/dist/core/src/render/text/renderStyle.d.ts +13 -13
- package/dist/core/src/render/text/renderText.d.ts +9 -9
- package/dist/core/src/text-area/TextArea.d.ts +47 -47
- package/dist/core/src/text-area/event-handlers/beforeInput.d.ts +8 -8
- package/dist/core/src/text-area/event-handlers/blur.d.ts +8 -8
- package/dist/core/src/text-area/event-handlers/click.d.ts +8 -8
- package/dist/core/src/text-area/event-handlers/composition.d.ts +27 -27
- package/dist/core/src/text-area/event-handlers/copy.d.ts +8 -8
- package/dist/core/src/text-area/event-handlers/cut.d.ts +8 -8
- package/dist/core/src/text-area/event-handlers/drag.d.ts +9 -9
- package/dist/core/src/text-area/event-handlers/drop.d.ts +8 -8
- package/dist/core/src/text-area/event-handlers/focus.d.ts +8 -8
- package/dist/core/src/text-area/event-handlers/index.d.ts +35 -35
- package/dist/core/src/text-area/event-handlers/keydown.d.ts +8 -8
- package/dist/core/src/text-area/event-handlers/keypress.d.ts +8 -8
- package/dist/core/src/text-area/event-handlers/paste.d.ts +8 -8
- package/dist/core/src/text-area/helpers.d.ts +26 -26
- package/dist/core/src/text-area/place-holder.d.ts +18 -18
- package/dist/core/src/text-area/syncSelection.d.ts +19 -19
- package/dist/core/src/text-area/update-view.d.ts +13 -13
- package/dist/core/src/to-html/elem2html.d.ts +8 -8
- package/dist/core/src/to-html/index.d.ts +32 -32
- package/dist/core/src/to-html/node2html.d.ts +8 -8
- package/dist/core/src/to-html/text2html.d.ts +8 -8
- package/dist/core/src/upload/createUploader.d.ts +8 -8
- package/dist/core/src/upload/index.d.ts +7 -7
- package/dist/core/src/upload/interface.d.ts +28 -28
- package/dist/core/src/utils/dom.d.ts +102 -102
- package/dist/core/src/utils/hotkeys.d.ts +35 -35
- package/dist/core/src/utils/key.d.ts +11 -11
- package/dist/core/src/utils/line.d.ts +14 -14
- package/dist/core/src/utils/ua.d.ts +14 -14
- package/dist/core/src/utils/util.d.ts +28 -28
- package/dist/core/src/utils/vdom.d.ts +34 -34
- package/dist/core/src/utils/weak-maps.d.ts +56 -56
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +12 -9
- package/dist/index.esm.js +0 -9
- package/dist/index.esm.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description 显示/隐藏 placeholder
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { IDomEditor } from '../editor/interface';
|
|
6
|
-
import TextArea from './TextArea';
|
|
7
|
-
/**
|
|
8
|
-
* 处理 placeholder
|
|
9
|
-
* @param textarea textarea
|
|
10
|
-
* @param editor editor
|
|
11
|
-
*/
|
|
12
|
-
export declare function handlePlaceholder(textarea: TextArea, editor: IDomEditor): void;
|
|
13
|
-
/**
|
|
14
|
-
* 隐藏 placeholder (如拼音输入 compositionStart 时,要先隐藏,等 compositionEnd 时再判断是否显示)
|
|
15
|
-
* @param textarea textarea
|
|
16
|
-
* @param editor editor
|
|
17
|
-
*/
|
|
18
|
-
export declare function hidePlaceholder(textarea: TextArea, editor: IDomEditor): void;
|
|
1
|
+
/**
|
|
2
|
+
* @description 显示/隐藏 placeholder
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { IDomEditor } from '../editor/interface';
|
|
6
|
+
import TextArea from './TextArea';
|
|
7
|
+
/**
|
|
8
|
+
* 处理 placeholder
|
|
9
|
+
* @param textarea textarea
|
|
10
|
+
* @param editor editor
|
|
11
|
+
*/
|
|
12
|
+
export declare function handlePlaceholder(textarea: TextArea, editor: IDomEditor): void;
|
|
13
|
+
/**
|
|
14
|
+
* 隐藏 placeholder (如拼音输入 compositionStart 时,要先隐藏,等 compositionEnd 时再判断是否显示)
|
|
15
|
+
* @param textarea textarea
|
|
16
|
+
* @param editor editor
|
|
17
|
+
*/
|
|
18
|
+
export declare function hidePlaceholder(textarea: TextArea, editor: IDomEditor): void;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description 同步 selection
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { IDomEditor } from '../editor/interface';
|
|
6
|
-
import TextArea from './TextArea';
|
|
7
|
-
/**
|
|
8
|
-
* editor onchange 时,将 editor selection 同步给 DOM
|
|
9
|
-
* @param textarea textarea
|
|
10
|
-
* @param editor editor
|
|
11
|
-
* @param focus 是否强制更新选区
|
|
12
|
-
*/
|
|
13
|
-
export declare function editorSelectionToDOM(textarea: TextArea, editor: IDomEditor, focus?: boolean): void;
|
|
14
|
-
/**
|
|
15
|
-
* DOM selection change 时,把 DOM selection 同步给 slate
|
|
16
|
-
* @param textarea textarea
|
|
17
|
-
* @param editor editor
|
|
18
|
-
*/
|
|
19
|
-
export declare function DOMSelectionToEditor(textarea: TextArea, editor: IDomEditor): void;
|
|
1
|
+
/**
|
|
2
|
+
* @description 同步 selection
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { IDomEditor } from '../editor/interface';
|
|
6
|
+
import TextArea from './TextArea';
|
|
7
|
+
/**
|
|
8
|
+
* editor onchange 时,将 editor selection 同步给 DOM
|
|
9
|
+
* @param textarea textarea
|
|
10
|
+
* @param editor editor
|
|
11
|
+
* @param focus 是否强制更新选区
|
|
12
|
+
*/
|
|
13
|
+
export declare function editorSelectionToDOM(textarea: TextArea, editor: IDomEditor, focus?: boolean): void;
|
|
14
|
+
/**
|
|
15
|
+
* DOM selection change 时,把 DOM selection 同步给 slate
|
|
16
|
+
* @param textarea textarea
|
|
17
|
+
* @param editor editor
|
|
18
|
+
*/
|
|
19
|
+
export declare function DOMSelectionToEditor(textarea: TextArea, editor: IDomEditor): void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description patch textarea view
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { IDomEditor } from '../editor/interface';
|
|
6
|
-
import TextArea from './TextArea';
|
|
7
|
-
/**
|
|
8
|
-
* 获取 editor.children 渲染 DOM
|
|
9
|
-
* @param textarea textarea
|
|
10
|
-
* @param editor editor
|
|
11
|
-
*/
|
|
12
|
-
declare function updateView(textarea: TextArea, editor: IDomEditor): void;
|
|
13
|
-
export default updateView;
|
|
1
|
+
/**
|
|
2
|
+
* @description patch textarea view
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { IDomEditor } from '../editor/interface';
|
|
6
|
+
import TextArea from './TextArea';
|
|
7
|
+
/**
|
|
8
|
+
* 获取 editor.children 渲染 DOM
|
|
9
|
+
* @param textarea textarea
|
|
10
|
+
* @param editor editor
|
|
11
|
+
*/
|
|
12
|
+
declare function updateView(textarea: TextArea, editor: IDomEditor): void;
|
|
13
|
+
export default updateView;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description elem -> html
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { Element } from 'slate';
|
|
6
|
-
import { IDomEditor } from '../editor/interface';
|
|
7
|
-
declare function elemToHtml(elemNode: Element, editor: IDomEditor): string;
|
|
8
|
-
export default elemToHtml;
|
|
1
|
+
/**
|
|
2
|
+
* @description elem -> html
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Element } from 'slate';
|
|
6
|
+
import { IDomEditor } from '../editor/interface';
|
|
7
|
+
declare function elemToHtml(elemNode: Element, editor: IDomEditor): string;
|
|
8
|
+
export default elemToHtml;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description to-html entry
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { Element as SlateElement, Descendant } from 'slate';
|
|
6
|
-
import { IDomEditor } from '../editor/interface';
|
|
7
|
-
export type styleToHtmlFnType = (node: Descendant, elemHtml: string) => string;
|
|
8
|
-
export declare const STYLE_TO_HTML_FN_LIST: styleToHtmlFnType[];
|
|
9
|
-
/**
|
|
10
|
-
* 注册 toHtml 处理文本样式的函数
|
|
11
|
-
* @param fn 处理 toHtml 文本样式的函数
|
|
12
|
-
*/
|
|
13
|
-
export declare function registerStyleToHtmlHandler(fn: styleToHtmlFnType): void;
|
|
14
|
-
interface IElemToHtmlRes {
|
|
15
|
-
html: string;
|
|
16
|
-
prefix?: string;
|
|
17
|
-
suffix?: string;
|
|
18
|
-
}
|
|
19
|
-
export type ElemToHtmlFnType = (elemNode: SlateElement, childrenHtml: string, editor?: IDomEditor) => string | IElemToHtmlRes;
|
|
20
|
-
export declare const ELEM_TO_HTML_CONF: {
|
|
21
|
-
[key: string]: ElemToHtmlFnType;
|
|
22
|
-
};
|
|
23
|
-
export interface IElemToHtmlConf {
|
|
24
|
-
type: string;
|
|
25
|
-
elemToHtml: ElemToHtmlFnType;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* 注册 elem to html 函数
|
|
29
|
-
* @param conf { type, elemToHtml } ,type 即 node.type
|
|
30
|
-
*/
|
|
31
|
-
export declare function registerElemToHtmlConf(conf: IElemToHtmlConf): void;
|
|
32
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @description to-html entry
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Element as SlateElement, Descendant } from 'slate';
|
|
6
|
+
import { IDomEditor } from '../editor/interface';
|
|
7
|
+
export type styleToHtmlFnType = (node: Descendant, elemHtml: string) => string;
|
|
8
|
+
export declare const STYLE_TO_HTML_FN_LIST: styleToHtmlFnType[];
|
|
9
|
+
/**
|
|
10
|
+
* 注册 toHtml 处理文本样式的函数
|
|
11
|
+
* @param fn 处理 toHtml 文本样式的函数
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerStyleToHtmlHandler(fn: styleToHtmlFnType): void;
|
|
14
|
+
interface IElemToHtmlRes {
|
|
15
|
+
html: string;
|
|
16
|
+
prefix?: string;
|
|
17
|
+
suffix?: string;
|
|
18
|
+
}
|
|
19
|
+
export type ElemToHtmlFnType = (elemNode: SlateElement, childrenHtml: string, editor?: IDomEditor) => string | IElemToHtmlRes;
|
|
20
|
+
export declare const ELEM_TO_HTML_CONF: {
|
|
21
|
+
[key: string]: ElemToHtmlFnType;
|
|
22
|
+
};
|
|
23
|
+
export interface IElemToHtmlConf {
|
|
24
|
+
type: string;
|
|
25
|
+
elemToHtml: ElemToHtmlFnType;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 注册 elem to html 函数
|
|
29
|
+
* @param conf { type, elemToHtml } ,type 即 node.type
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerElemToHtmlConf(conf: IElemToHtmlConf): void;
|
|
32
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description node -> html
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { Descendant } from 'slate';
|
|
6
|
-
import { IDomEditor } from '../editor/interface';
|
|
7
|
-
declare function node2html(node: Descendant, editor: IDomEditor): string;
|
|
8
|
-
export default node2html;
|
|
1
|
+
/**
|
|
2
|
+
* @description node -> html
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Descendant } from 'slate';
|
|
6
|
+
import { IDomEditor } from '../editor/interface';
|
|
7
|
+
declare function node2html(node: Descendant, editor: IDomEditor): string;
|
|
8
|
+
export default node2html;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description text -> html
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { Text } from 'slate';
|
|
6
|
-
import { IDomEditor } from '../editor/interface';
|
|
7
|
-
declare function textToHtml(textNode: Text, editor: IDomEditor): string;
|
|
8
|
-
export default textToHtml;
|
|
1
|
+
/**
|
|
2
|
+
* @description text -> html
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Text } from 'slate';
|
|
6
|
+
import { IDomEditor } from '../editor/interface';
|
|
7
|
+
declare function textToHtml(textNode: Text, editor: IDomEditor): string;
|
|
8
|
+
export default textToHtml;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description gen uploader
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import Uppy from '@uppy/core';
|
|
6
|
-
import { IUploadConfig } from './interface';
|
|
7
|
-
declare function createUploader(config: IUploadConfig): Uppy;
|
|
8
|
-
export default createUploader;
|
|
1
|
+
/**
|
|
2
|
+
* @description gen uploader
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import Uppy from '@uppy/core';
|
|
6
|
+
import { IUploadConfig } from './interface';
|
|
7
|
+
declare function createUploader(config: IUploadConfig): Uppy;
|
|
8
|
+
export default createUploader;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description upload entry
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import createUploader from './createUploader';
|
|
6
|
-
import { IUploadConfig } from './interface';
|
|
7
|
-
export { createUploader, IUploadConfig };
|
|
1
|
+
/**
|
|
2
|
+
* @description upload entry
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import createUploader from './createUploader';
|
|
6
|
+
import { IUploadConfig } from './interface';
|
|
7
|
+
export { createUploader, IUploadConfig };
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description upload interface
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { UppyFile } from '@uppy/core';
|
|
6
|
-
type FilesType = {
|
|
7
|
-
[key: string]: UppyFile<{}, {}>;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* 配置参考 https://uppy.io/docs/uppy/
|
|
11
|
-
*/
|
|
12
|
-
export interface IUploadConfig {
|
|
13
|
-
server: string;
|
|
14
|
-
fieldName?: string;
|
|
15
|
-
maxFileSize?: number;
|
|
16
|
-
maxNumberOfFiles?: number;
|
|
17
|
-
meta?: Record<string, unknown>;
|
|
18
|
-
metaWithUrl: boolean;
|
|
19
|
-
headers?: Headers | ((file: UppyFile<Record<string, unknown>, Record<string, unknown>>) => Headers) | undefined;
|
|
20
|
-
withCredentials?: boolean;
|
|
21
|
-
timeout?: number;
|
|
22
|
-
onBeforeUpload?: (files: FilesType) => boolean | FilesType;
|
|
23
|
-
onSuccess: (file: UppyFile<{}, {}>, response: any) => void;
|
|
24
|
-
onProgress?: (progress: number) => void;
|
|
25
|
-
onFailed: (file: UppyFile<{}, {}>, response: any) => void;
|
|
26
|
-
onError: (file: UppyFile<{}, {}>, error: any, res: any) => void;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @description upload interface
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { UppyFile } from '@uppy/core';
|
|
6
|
+
type FilesType = {
|
|
7
|
+
[key: string]: UppyFile<{}, {}>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 配置参考 https://uppy.io/docs/uppy/
|
|
11
|
+
*/
|
|
12
|
+
export interface IUploadConfig {
|
|
13
|
+
server: string;
|
|
14
|
+
fieldName?: string;
|
|
15
|
+
maxFileSize?: number;
|
|
16
|
+
maxNumberOfFiles?: number;
|
|
17
|
+
meta?: Record<string, unknown>;
|
|
18
|
+
metaWithUrl: boolean;
|
|
19
|
+
headers?: Headers | ((file: UppyFile<Record<string, unknown>, Record<string, unknown>>) => Headers) | undefined;
|
|
20
|
+
withCredentials?: boolean;
|
|
21
|
+
timeout?: number;
|
|
22
|
+
onBeforeUpload?: (files: FilesType) => boolean | FilesType;
|
|
23
|
+
onSuccess: (file: UppyFile<{}, {}>, response: any) => void;
|
|
24
|
+
onProgress?: (progress: number) => void;
|
|
25
|
+
onFailed: (file: UppyFile<{}, {}>, response: any) => void;
|
|
26
|
+
onError: (file: UppyFile<{}, {}>, error: any, res: any) => void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description DOM 操作 part1 - DOM7 文档 https://framework7.io/docs/dom7.html
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import $, { Dom7Array } from 'dom7';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
export type DOMPoint = [Node, number];
|
|
21
|
-
/**
|
|
22
|
-
* Returns the host window of a DOM node
|
|
23
|
-
*/
|
|
24
|
-
export declare const getDefaultView: (value: any) => Window | null;
|
|
25
|
-
/**
|
|
26
|
-
* Check if a
|
|
27
|
-
*/
|
|
28
|
-
export declare const
|
|
29
|
-
/**
|
|
30
|
-
* Check if a DOM node is
|
|
31
|
-
*/
|
|
32
|
-
export declare const
|
|
33
|
-
/**
|
|
34
|
-
* Check if a
|
|
35
|
-
*/
|
|
36
|
-
export declare const
|
|
37
|
-
/**
|
|
38
|
-
* Check if a value is a DOM selection.
|
|
39
|
-
*/
|
|
40
|
-
export declare const isDOMSelection: (value: any) => value is DOMSelection;
|
|
41
|
-
/**
|
|
42
|
-
* Check if a DOM node is an element node.
|
|
43
|
-
*/
|
|
44
|
-
export declare const isDOMText: (value: any) => value is DOMText;
|
|
45
|
-
/**
|
|
46
|
-
* Checks whether a paste event is a plaintext-only event.
|
|
47
|
-
*/
|
|
48
|
-
export declare const isPlainTextOnlyPaste: (event: ClipboardEvent) => boolean | null;
|
|
49
|
-
/**
|
|
50
|
-
* Normalize a DOM point so that it always refers to a text node.
|
|
51
|
-
*/
|
|
52
|
-
export declare const normalizeDOMPoint: (domPoint: DOMPoint) => DOMPoint;
|
|
53
|
-
/**
|
|
54
|
-
* Determines wether the active element is nested within a shadowRoot
|
|
55
|
-
*/
|
|
56
|
-
export declare const hasShadowRoot: () => boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Get the element with the specified id
|
|
59
|
-
*/
|
|
60
|
-
export declare const getElementById: (id: string) => null | HTMLElement;
|
|
61
|
-
/**
|
|
62
|
-
* Get the nearest editable child and index at `index` in a `parent`, preferring `direction`.
|
|
63
|
-
*/
|
|
64
|
-
export declare const getEditableChildAndIndex: (parent: DOMElement, index: number, direction:
|
|
65
|
-
/**
|
|
66
|
-
* Get the nearest editable child at `index` in a `parent`, preferring
|
|
67
|
-
* `direction`.
|
|
68
|
-
*/
|
|
69
|
-
export declare const getEditableChild: (parent: DOMElement, index: number, direction:
|
|
70
|
-
/**
|
|
71
|
-
* Get a plaintext representation of the content of a node, accounting for block
|
|
72
|
-
* elements which get a newline appended.
|
|
73
|
-
*
|
|
74
|
-
* The domNode must be attached to the DOM.
|
|
75
|
-
*/
|
|
76
|
-
export declare const getPlainText: (domNode: DOMNode) => string;
|
|
77
|
-
/**
|
|
78
|
-
* 在下级节点中找到第一个 void elem
|
|
79
|
-
* @param elem elem
|
|
80
|
-
*/
|
|
81
|
-
export declare function getFirstVoidChild(elem: DOMElement): DOMElement | null;
|
|
82
|
-
/**
|
|
83
|
-
* 遍历一个 elem 内所有的 text node ,执行函数
|
|
84
|
-
* @param elem elem
|
|
85
|
-
* @param handler handler
|
|
86
|
-
*/
|
|
87
|
-
export declare function walkTextNodes(elem: DOMElement, handler: (textNode: DOMNode, parent: DOMElement) => void): void;
|
|
88
|
-
export declare enum NodeType {
|
|
89
|
-
ELEMENT_NODE = 1,
|
|
90
|
-
TEXT_NODE = 3,
|
|
91
|
-
CDATA_SECTION_NODE = 4,
|
|
92
|
-
PROCESSING_INSTRUCTION_NODE = 7,
|
|
93
|
-
COMMENT_NODE = 8,
|
|
94
|
-
DOCUMENT_NODE = 9,
|
|
95
|
-
DOCUMENT_TYPE_NODE = 10,
|
|
96
|
-
DOCUMENT_FRAGMENT_NODE = 11
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* 获取 tagName lower-case
|
|
100
|
-
* @param $elem $elem
|
|
101
|
-
*/
|
|
102
|
-
export declare function getTagName($elem: Dom7Array): string;
|
|
1
|
+
/**
|
|
2
|
+
* @description DOM 操作 part1 - DOM7 文档 https://framework7.io/docs/dom7.html
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import $, { Dom7Array } from 'dom7';
|
|
6
|
+
import DOMNode = globalThis.Node;
|
|
7
|
+
import DOMComment = globalThis.Comment;
|
|
8
|
+
import DOMElement = globalThis.Element;
|
|
9
|
+
import DOMText = globalThis.Text;
|
|
10
|
+
import DOMRange = globalThis.Range;
|
|
11
|
+
import DOMSelection = globalThis.Selection;
|
|
12
|
+
import DOMStaticRange = globalThis.StaticRange;
|
|
13
|
+
export { Dom7Array } from 'dom7';
|
|
14
|
+
export default $;
|
|
15
|
+
export declare const isDocument: (value: any) => value is Document;
|
|
16
|
+
export declare const isShadowRoot: (value: any) => value is ShadowRoot;
|
|
17
|
+
export declare const isDataTransfer: (value: any) => value is DataTransfer;
|
|
18
|
+
export declare const isHTMLElememt: (value: any) => value is HTMLElement;
|
|
19
|
+
export { DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText, };
|
|
20
|
+
export type DOMPoint = [Node, number];
|
|
21
|
+
/**
|
|
22
|
+
* Returns the host window of a DOM node
|
|
23
|
+
*/
|
|
24
|
+
export declare const getDefaultView: (value: any) => Window | null;
|
|
25
|
+
/**
|
|
26
|
+
* Check if a value is a DOM node.
|
|
27
|
+
*/
|
|
28
|
+
export declare const isDOMNode: (value: any) => value is DOMNode;
|
|
29
|
+
/**
|
|
30
|
+
* Check if a DOM node is a comment node.
|
|
31
|
+
*/
|
|
32
|
+
export declare const isDOMComment: (value: any) => value is DOMComment;
|
|
33
|
+
/**
|
|
34
|
+
* Check if a DOM node is an element node.
|
|
35
|
+
*/
|
|
36
|
+
export declare const isDOMElement: (value: any) => value is DOMElement;
|
|
37
|
+
/**
|
|
38
|
+
* Check if a value is a DOM selection.
|
|
39
|
+
*/
|
|
40
|
+
export declare const isDOMSelection: (value: any) => value is DOMSelection;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a DOM node is an element node.
|
|
43
|
+
*/
|
|
44
|
+
export declare const isDOMText: (value: any) => value is DOMText;
|
|
45
|
+
/**
|
|
46
|
+
* Checks whether a paste event is a plaintext-only event.
|
|
47
|
+
*/
|
|
48
|
+
export declare const isPlainTextOnlyPaste: (event: ClipboardEvent) => boolean | null;
|
|
49
|
+
/**
|
|
50
|
+
* Normalize a DOM point so that it always refers to a text node.
|
|
51
|
+
*/
|
|
52
|
+
export declare const normalizeDOMPoint: (domPoint: DOMPoint) => DOMPoint;
|
|
53
|
+
/**
|
|
54
|
+
* Determines wether the active element is nested within a shadowRoot
|
|
55
|
+
*/
|
|
56
|
+
export declare const hasShadowRoot: () => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Get the element with the specified id
|
|
59
|
+
*/
|
|
60
|
+
export declare const getElementById: (id: string) => null | HTMLElement;
|
|
61
|
+
/**
|
|
62
|
+
* Get the nearest editable child and index at `index` in a `parent`, preferring `direction`.
|
|
63
|
+
*/
|
|
64
|
+
export declare const getEditableChildAndIndex: (parent: DOMElement, index: number, direction: "forward" | "backward") => [DOMNode, number];
|
|
65
|
+
/**
|
|
66
|
+
* Get the nearest editable child at `index` in a `parent`, preferring
|
|
67
|
+
* `direction`.
|
|
68
|
+
*/
|
|
69
|
+
export declare const getEditableChild: (parent: DOMElement, index: number, direction: "forward" | "backward") => DOMNode;
|
|
70
|
+
/**
|
|
71
|
+
* Get a plaintext representation of the content of a node, accounting for block
|
|
72
|
+
* elements which get a newline appended.
|
|
73
|
+
*
|
|
74
|
+
* The domNode must be attached to the DOM.
|
|
75
|
+
*/
|
|
76
|
+
export declare const getPlainText: (domNode: DOMNode) => string;
|
|
77
|
+
/**
|
|
78
|
+
* 在下级节点中找到第一个 void elem
|
|
79
|
+
* @param elem elem
|
|
80
|
+
*/
|
|
81
|
+
export declare function getFirstVoidChild(elem: DOMElement): DOMElement | null;
|
|
82
|
+
/**
|
|
83
|
+
* 遍历一个 elem 内所有的 text node ,执行函数
|
|
84
|
+
* @param elem elem
|
|
85
|
+
* @param handler handler
|
|
86
|
+
*/
|
|
87
|
+
export declare function walkTextNodes(elem: DOMElement, handler: (textNode: DOMNode, parent: DOMElement) => void): void;
|
|
88
|
+
export declare enum NodeType {
|
|
89
|
+
ELEMENT_NODE = 1,
|
|
90
|
+
TEXT_NODE = 3,
|
|
91
|
+
CDATA_SECTION_NODE = 4,
|
|
92
|
+
PROCESSING_INSTRUCTION_NODE = 7,
|
|
93
|
+
COMMENT_NODE = 8,
|
|
94
|
+
DOCUMENT_NODE = 9,
|
|
95
|
+
DOCUMENT_TYPE_NODE = 10,
|
|
96
|
+
DOCUMENT_FRAGMENT_NODE = 11
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 获取 tagName lower-case
|
|
100
|
+
* @param $elem $elem
|
|
101
|
+
*/
|
|
102
|
+
export declare function getTagName($elem: Dom7Array): string;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description 快捷键
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Hotkeys.
|
|
7
|
-
*/
|
|
8
|
-
declare const _default: {
|
|
9
|
-
isBold: (event: KeyboardEvent) => boolean;
|
|
10
|
-
isCompose: (event: KeyboardEvent) => boolean;
|
|
11
|
-
isMoveBackward: (event: KeyboardEvent) => boolean;
|
|
12
|
-
isMoveForward: (event: KeyboardEvent) => boolean;
|
|
13
|
-
isDeleteBackward: (event: KeyboardEvent) => boolean;
|
|
14
|
-
isDeleteForward: (event: KeyboardEvent) => boolean;
|
|
15
|
-
isDeleteLineBackward: (event: KeyboardEvent) => boolean;
|
|
16
|
-
isDeleteLineForward: (event: KeyboardEvent) => boolean;
|
|
17
|
-
isDeleteWordBackward: (event: KeyboardEvent) => boolean;
|
|
18
|
-
isDeleteWordForward: (event: KeyboardEvent) => boolean;
|
|
19
|
-
isExtendBackward: (event: KeyboardEvent) => boolean;
|
|
20
|
-
isExtendForward: (event: KeyboardEvent) => boolean;
|
|
21
|
-
isExtendLineBackward: (event: KeyboardEvent) => boolean;
|
|
22
|
-
isExtendLineForward: (event: KeyboardEvent) => boolean;
|
|
23
|
-
isItalic: (event: KeyboardEvent) => boolean;
|
|
24
|
-
isMoveLineBackward: (event: KeyboardEvent) => boolean;
|
|
25
|
-
isMoveLineForward: (event: KeyboardEvent) => boolean;
|
|
26
|
-
isMoveWordBackward: (event: KeyboardEvent) => boolean;
|
|
27
|
-
isMoveWordForward: (event: KeyboardEvent) => boolean;
|
|
28
|
-
isRedo: (event: KeyboardEvent) => boolean;
|
|
29
|
-
isSplitBlock: (event: KeyboardEvent) => boolean;
|
|
30
|
-
isTransposeCharacter: (event: KeyboardEvent) => boolean;
|
|
31
|
-
isUndo: (event: KeyboardEvent) => boolean;
|
|
32
|
-
isTab: (event: KeyboardEvent) => boolean;
|
|
33
|
-
isSelectAll: (event: KeyboardEvent) => boolean;
|
|
34
|
-
};
|
|
35
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* @description 快捷键
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Hotkeys.
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: {
|
|
9
|
+
isBold: (event: KeyboardEvent) => boolean;
|
|
10
|
+
isCompose: (event: KeyboardEvent) => boolean;
|
|
11
|
+
isMoveBackward: (event: KeyboardEvent) => boolean;
|
|
12
|
+
isMoveForward: (event: KeyboardEvent) => boolean;
|
|
13
|
+
isDeleteBackward: (event: KeyboardEvent) => boolean;
|
|
14
|
+
isDeleteForward: (event: KeyboardEvent) => boolean;
|
|
15
|
+
isDeleteLineBackward: (event: KeyboardEvent) => boolean;
|
|
16
|
+
isDeleteLineForward: (event: KeyboardEvent) => boolean;
|
|
17
|
+
isDeleteWordBackward: (event: KeyboardEvent) => boolean;
|
|
18
|
+
isDeleteWordForward: (event: KeyboardEvent) => boolean;
|
|
19
|
+
isExtendBackward: (event: KeyboardEvent) => boolean;
|
|
20
|
+
isExtendForward: (event: KeyboardEvent) => boolean;
|
|
21
|
+
isExtendLineBackward: (event: KeyboardEvent) => boolean;
|
|
22
|
+
isExtendLineForward: (event: KeyboardEvent) => boolean;
|
|
23
|
+
isItalic: (event: KeyboardEvent) => boolean;
|
|
24
|
+
isMoveLineBackward: (event: KeyboardEvent) => boolean;
|
|
25
|
+
isMoveLineForward: (event: KeyboardEvent) => boolean;
|
|
26
|
+
isMoveWordBackward: (event: KeyboardEvent) => boolean;
|
|
27
|
+
isMoveWordForward: (event: KeyboardEvent) => boolean;
|
|
28
|
+
isRedo: (event: KeyboardEvent) => boolean;
|
|
29
|
+
isSplitBlock: (event: KeyboardEvent) => boolean;
|
|
30
|
+
isTransposeCharacter: (event: KeyboardEvent) => boolean;
|
|
31
|
+
isUndo: (event: KeyboardEvent) => boolean;
|
|
32
|
+
isTab: (event: KeyboardEvent) => boolean;
|
|
33
|
+
isSelectAll: (event: KeyboardEvent) => boolean;
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An auto-incrementing identifier for keys.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* A class that keeps track of a key string. We use a full class here because we
|
|
6
|
-
* want to be able to use them as keys in `WeakMap` objects.
|
|
7
|
-
*/
|
|
8
|
-
export declare class Key {
|
|
9
|
-
id: string;
|
|
10
|
-
constructor();
|
|
11
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* An auto-incrementing identifier for keys.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* A class that keeps track of a key string. We use a full class here because we
|
|
6
|
+
* want to be able to use them as keys in `WeakMap` objects.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Key {
|
|
9
|
+
id: string;
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Utilities for single-line deletion
|
|
3
|
-
*/
|
|
4
|
-
import { Range } from 'slate';
|
|
5
|
-
import { IDomEditor } from '../editor/interface';
|
|
6
|
-
/**
|
|
7
|
-
* A helper utility that returns the end portion of a `Range`
|
|
8
|
-
* which is located on a single line.
|
|
9
|
-
*
|
|
10
|
-
* @param {Editor} editor The editor object to compare against
|
|
11
|
-
* @param {Range} parentRange The parent range to compare against
|
|
12
|
-
* @returns {Range} A valid portion of the parentRange which is one a single line
|
|
13
|
-
*/
|
|
14
|
-
export declare const findCurrentLineRange: (editor: IDomEditor, parentRange: Range) => Range;
|
|
1
|
+
/**
|
|
2
|
+
* @description Utilities for single-line deletion
|
|
3
|
+
*/
|
|
4
|
+
import { Range } from 'slate';
|
|
5
|
+
import { IDomEditor } from '../editor/interface';
|
|
6
|
+
/**
|
|
7
|
+
* A helper utility that returns the end portion of a `Range`
|
|
8
|
+
* which is located on a single line.
|
|
9
|
+
*
|
|
10
|
+
* @param {Editor} editor The editor object to compare against
|
|
11
|
+
* @param {Range} parentRange The parent range to compare against
|
|
12
|
+
* @returns {Range} A valid portion of the parentRange which is one a single line
|
|
13
|
+
*/
|
|
14
|
+
export declare const findCurrentLineRange: (editor: IDomEditor, parentRange: Range) => Range;
|