@wangeditor-next/code-highlight 1.3.3 → 1.3.5
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/code-highlight/src/constants/svg.d.ts +10 -10
- package/dist/code-highlight/src/custom-types.d.ts +17 -17
- package/dist/code-highlight/src/decorate/index.d.ts +7 -7
- package/dist/code-highlight/src/index.d.ts +9 -9
- package/dist/code-highlight/src/locale/en.d.ts +10 -10
- package/dist/code-highlight/src/locale/index.d.ts +5 -5
- package/dist/code-highlight/src/locale/zh-CN.d.ts +10 -10
- package/dist/code-highlight/src/module/elem-to-html.d.ts +11 -11
- package/dist/code-highlight/src/module/index.d.ts +7 -7
- package/dist/code-highlight/src/module/menu/SelectLangMenu.d.ts +24 -24
- package/dist/code-highlight/src/module/menu/config.d.ts +8 -8
- package/dist/code-highlight/src/module/menu/index.d.ts +15 -15
- package/dist/code-highlight/src/module/parse-style-html.d.ts +8 -8
- package/dist/code-highlight/src/module/render-style.d.ts +13 -13
- package/dist/code-highlight/src/utils/dom.d.ts +15 -15
- package/dist/code-highlight/src/utils/vdom.d.ts +11 -11
- package/dist/code-highlight/src/vendor/prism.d.ts +37 -37
- package/dist/core/src/config/index.d.ts +13 -0
- package/dist/core/src/config/interface.d.ts +58 -0
- package/dist/core/src/config/register.d.ts +12 -0
- package/dist/core/src/constants/index.d.ts +1 -0
- package/dist/core/src/constants/svg.d.ts +12 -0
- package/dist/core/src/create/bind-node-relation.d.ts +15 -0
- package/dist/core/src/create/create-editor.d.ts +21 -0
- package/dist/core/src/create/create-toolbar.d.ts +14 -0
- package/dist/core/src/create/helper.d.ts +30 -0
- package/dist/core/src/create/index.d.ts +7 -0
- package/dist/core/src/editor/dom-editor.d.ts +143 -0
- package/dist/core/src/editor/interface.d.ts +67 -0
- package/dist/core/src/editor/plugins/with-config.d.ts +7 -0
- package/dist/core/src/editor/plugins/with-content.d.ts +7 -0
- package/dist/core/src/editor/plugins/with-dom.d.ts +10 -0
- package/dist/core/src/editor/plugins/with-emitter.d.ts +7 -0
- package/dist/core/src/editor/plugins/with-event-data.d.ts +7 -0
- package/dist/core/src/editor/plugins/with-max-length.d.ts +7 -0
- package/dist/core/src/editor/plugins/with-selection.d.ts +7 -0
- package/dist/core/src/i18n/index.d.ts +32 -0
- package/dist/core/src/index.d.ts +32 -0
- package/dist/core/src/menus/bar/HoverBar.d.ts +48 -0
- package/dist/core/src/menus/bar/Toolbar.d.ts +35 -0
- package/dist/core/src/menus/bar-item/BaseButton.d.ts +26 -0
- package/dist/core/src/menus/bar-item/DropPanelButton.d.ts +14 -0
- package/dist/core/src/menus/bar-item/GroupButton.d.ts +17 -0
- package/dist/core/src/menus/bar-item/ModalButton.d.ts +25 -0
- package/dist/core/src/menus/bar-item/Select.d.ts +22 -0
- package/dist/core/src/menus/bar-item/SimpleButton.d.ts +11 -0
- package/dist/core/src/menus/bar-item/index.d.ts +24 -0
- package/dist/core/src/menus/bar-item/tooltip.d.ts +6 -0
- package/dist/core/src/menus/helpers/helpers.d.ts +18 -0
- package/dist/core/src/menus/helpers/position.d.ts +36 -0
- package/dist/core/src/menus/index.d.ts +9 -0
- package/dist/core/src/menus/interface.d.ts +66 -0
- package/dist/core/src/menus/panel-and-modal/BaseClass.d.ts +26 -0
- package/dist/core/src/menus/panel-and-modal/DropPanel.d.ts +14 -0
- package/dist/core/src/menus/panel-and-modal/Modal.d.ts +44 -0
- package/dist/core/src/menus/panel-and-modal/SelectList.d.ts +20 -0
- package/dist/core/src/menus/register.d.ts +16 -0
- package/dist/core/src/parse-html/helper.d.ts +10 -0
- package/dist/core/src/parse-html/index.d.ts +35 -0
- package/dist/core/src/parse-html/parse-common-elem-html.d.ts +15 -0
- package/dist/core/src/parse-html/parse-elem-html.d.ts +15 -0
- package/dist/core/src/parse-html/parse-text-elem-html.d.ts +15 -0
- package/dist/core/src/render/element/getRenderElem.d.ts +11 -0
- package/dist/core/src/render/element/renderElement.d.ts +9 -0
- package/dist/core/src/render/element/renderStyle.d.ts +13 -0
- package/dist/core/src/render/helper.d.ts +6 -0
- package/dist/core/src/render/index.d.ts +27 -0
- package/dist/core/src/render/node2Vnode.d.ts +15 -0
- package/dist/core/src/render/text/genVnode.d.ts +9 -0
- package/dist/core/src/render/text/renderStyle.d.ts +13 -0
- package/dist/core/src/render/text/renderText.d.ts +9 -0
- package/dist/core/src/text-area/TextArea.d.ts +47 -0
- package/dist/core/src/text-area/event-handlers/beforeInput.d.ts +8 -0
- package/dist/core/src/text-area/event-handlers/blur.d.ts +8 -0
- package/dist/core/src/text-area/event-handlers/click.d.ts +8 -0
- package/dist/core/src/text-area/event-handlers/composition.d.ts +27 -0
- package/dist/core/src/text-area/event-handlers/copy.d.ts +8 -0
- package/dist/core/src/text-area/event-handlers/cut.d.ts +8 -0
- package/dist/core/src/text-area/event-handlers/drag.d.ts +9 -0
- package/dist/core/src/text-area/event-handlers/drop.d.ts +8 -0
- package/dist/core/src/text-area/event-handlers/focus.d.ts +8 -0
- package/dist/core/src/text-area/event-handlers/index.d.ts +35 -0
- package/dist/core/src/text-area/event-handlers/keydown.d.ts +8 -0
- package/dist/core/src/text-area/event-handlers/keypress.d.ts +8 -0
- package/dist/core/src/text-area/event-handlers/paste.d.ts +8 -0
- package/dist/core/src/text-area/helpers.d.ts +26 -0
- package/dist/core/src/text-area/place-holder.d.ts +18 -0
- package/dist/core/src/text-area/syncSelection.d.ts +19 -0
- package/dist/core/src/text-area/update-view.d.ts +13 -0
- package/dist/core/src/to-html/elem2html.d.ts +8 -0
- package/dist/core/src/to-html/index.d.ts +32 -0
- package/dist/core/src/to-html/node2html.d.ts +8 -0
- package/dist/core/src/to-html/text2html.d.ts +8 -0
- package/dist/core/src/upload/createUploader.d.ts +8 -0
- package/dist/core/src/upload/index.d.ts +7 -0
- package/dist/core/src/upload/interface.d.ts +28 -0
- package/dist/core/src/utils/dom.d.ts +102 -0
- package/dist/core/src/utils/hotkeys.d.ts +35 -0
- package/dist/core/src/utils/key.d.ts +11 -0
- package/dist/core/src/utils/line.d.ts +14 -0
- package/dist/core/src/utils/ua.d.ts +14 -0
- package/dist/core/src/utils/util.d.ts +28 -0
- package/dist/core/src/utils/vdom.d.ts +34 -0
- package/dist/core/src/utils/weak-maps.d.ts +56 -0
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +10 -7
- package/dist/index.esm.js +0 -10
- package/dist/index.esm.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description icon svg
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* 【注意】svg 字符串的长度 ,否则会导致代码体积过大
|
|
7
|
-
* 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
|
|
8
|
-
* 找不到再从 iconfont.com 搜索
|
|
9
|
-
*/
|
|
10
|
-
export declare const JS_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M64 64v896h896V64H64z m487.6 698.8c0 87.2-51.2 127-125.8 127-67.4 0-106.4-34.8-126.4-77l68.6-41.4c13.2 23.4 25.2 43.2 54.2 43.2 27.6 0 45.2-10.8 45.2-53V475.4h84.2v287.4z m199.2 127c-78.2 0-128.8-37.2-153.4-86l68.6-39.6c18 29.4 41.6 51.2 83 51.2 34.8 0 57.2-17.4 57.2-41.6 0-28.8-22.8-39-61.4-56l-21-9c-60.8-25.8-101-58.4-101-127 0-63.2 48.2-111.2 123.2-111.2 53.6 0 92 18.6 119.6 67.4L800 580c-14.4-25.8-30-36-54.2-36-24.6 0-40.2 15.6-40.2 36 0 25.2 15.6 35.4 51.8 51.2l21 9c71.6 30.6 111.8 62 111.8 132.4 0 75.6-59.6 117.2-139.4 117.2z\"></path></svg>";
|
|
1
|
+
/**
|
|
2
|
+
* @description icon svg
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 【注意】svg 字符串的长度 ,否则会导致代码体积过大
|
|
7
|
+
* 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
|
|
8
|
+
* 找不到再从 iconfont.com 搜索
|
|
9
|
+
*/
|
|
10
|
+
export declare const JS_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M64 64v896h896V64H64z m487.6 698.8c0 87.2-51.2 127-125.8 127-67.4 0-106.4-34.8-126.4-77l68.6-41.4c13.2 23.4 25.2 43.2 54.2 43.2 27.6 0 45.2-10.8 45.2-53V475.4h84.2v287.4z m199.2 127c-78.2 0-128.8-37.2-153.4-86l68.6-39.6c18 29.4 41.6 51.2 83 51.2 34.8 0 57.2-17.4 57.2-41.6 0-28.8-22.8-39-61.4-56l-21-9c-60.8-25.8-101-58.4-101-127 0-63.2 48.2-111.2 123.2-111.2 53.6 0 92 18.6 119.6 67.4L800 580c-14.4-25.8-30-36-54.2-36-24.6 0-40.2 15.6-40.2 36 0 25.2 15.6 35.4 51.8 51.2l21 9c71.6 30.6 111.8 62 111.8 132.4 0 75.6-59.6 117.2-139.4 117.2z\"></path></svg>";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description 自定义 element
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
type PureText = {
|
|
6
|
-
text: string;
|
|
7
|
-
};
|
|
8
|
-
export type PreElement = {
|
|
9
|
-
type: 'pre';
|
|
10
|
-
children: CodeElement[];
|
|
11
|
-
};
|
|
12
|
-
export type CodeElement = {
|
|
13
|
-
type: 'code';
|
|
14
|
-
language: string;
|
|
15
|
-
children: PureText[];
|
|
16
|
-
};
|
|
17
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @description 自定义 element
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
type PureText = {
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
export type PreElement = {
|
|
9
|
+
type: 'pre';
|
|
10
|
+
children: CodeElement[];
|
|
11
|
+
};
|
|
12
|
+
export type CodeElement = {
|
|
13
|
+
type: 'code';
|
|
14
|
+
language: string;
|
|
15
|
+
children: PureText[];
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description code-highlight decorate
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import {
|
|
6
|
-
declare const codeHighLightDecorate: (nodeEntry: NodeEntry
|
|
7
|
-
export default codeHighLightDecorate;
|
|
1
|
+
/**
|
|
2
|
+
* @description code-highlight decorate
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { NodeEntry, Range } from 'slate';
|
|
6
|
+
declare const codeHighLightDecorate: (nodeEntry: NodeEntry) => Range[];
|
|
7
|
+
export default codeHighLightDecorate;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description code-highlight
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import './assets/index.less';
|
|
6
|
-
import './locale/index';
|
|
7
|
-
import wangEditorCodeHighLightDecorate from './decorate';
|
|
8
|
-
import wangEditorCodeHighlightModule from './module/index';
|
|
9
|
-
export { wangEditorCodeHighLightDecorate, wangEditorCodeHighlightModule };
|
|
1
|
+
/**
|
|
2
|
+
* @description code-highlight
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import './assets/index.less';
|
|
6
|
+
import './locale/index';
|
|
7
|
+
import wangEditorCodeHighLightDecorate from './decorate';
|
|
8
|
+
import wangEditorCodeHighlightModule from './module/index';
|
|
9
|
+
export { wangEditorCodeHighLightDecorate, wangEditorCodeHighlightModule };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description i18n en
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
declare const _default: {
|
|
6
|
-
highLightModule: {
|
|
7
|
-
selectLang: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* @description i18n en
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
declare const _default: {
|
|
6
|
+
highLightModule: {
|
|
7
|
+
selectLang: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description i18n entry
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @description i18n entry
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description i18n zh-CN
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
declare const _default: {
|
|
6
|
-
highLightModule: {
|
|
7
|
-
selectLang: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* @description i18n zh-CN
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
declare const _default: {
|
|
6
|
+
highLightModule: {
|
|
7
|
+
selectLang: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description to html
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { Element } from 'slate';
|
|
6
|
-
declare function codeToHtml(elem: Element, childrenHtml: string): string;
|
|
7
|
-
export declare const codeToHtmlConf: {
|
|
8
|
-
type: string;
|
|
9
|
-
elemToHtml: typeof codeToHtml;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @description to html
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Element } from 'slate';
|
|
6
|
+
declare function codeToHtml(elem: Element, childrenHtml: string): string;
|
|
7
|
+
export declare const codeToHtmlConf: {
|
|
8
|
+
type: string;
|
|
9
|
+
elemToHtml: typeof codeToHtml;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description code highlight module
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { IModuleConf } from '@wangeditor-next/core';
|
|
6
|
-
declare const codeHighlightModule: Partial<IModuleConf>;
|
|
7
|
-
export default codeHighlightModule;
|
|
1
|
+
/**
|
|
2
|
+
* @description code highlight module
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { IModuleConf } from '@wangeditor-next/core';
|
|
6
|
+
declare const codeHighlightModule: Partial<IModuleConf>;
|
|
7
|
+
export default codeHighlightModule;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description code-highlight select lang
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { IDomEditor, IOption, ISelectMenu } from '@wangeditor-next/core';
|
|
6
|
-
declare class SelectLangMenu implements ISelectMenu {
|
|
7
|
-
readonly title: string;
|
|
8
|
-
readonly iconSvg = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M64 64v896h896V64H64z m487.6 698.8c0 87.2-51.2 127-125.8 127-67.4 0-106.4-34.8-126.4-77l68.6-41.4c13.2 23.4 25.2 43.2 54.2 43.2 27.6 0 45.2-10.8 45.2-53V475.4h84.2v287.4z m199.2 127c-78.2 0-128.8-37.2-153.4-86l68.6-39.6c18 29.4 41.6 51.2 83 51.2 34.8 0 57.2-17.4 57.2-41.6 0-28.8-22.8-39-61.4-56l-21-9c-60.8-25.8-101-58.4-101-127 0-63.2 48.2-111.2 123.2-111.2 53.6 0 92 18.6 119.6 67.4L800 580c-14.4-25.8-30-36-54.2-36-24.6 0-40.2 15.6-40.2 36 0 25.2 15.6 35.4 51.8 51.2l21 9c71.6 30.6 111.8 62 111.8 132.4 0 75.6-59.6 117.2-139.4 117.2z\"></path></svg>";
|
|
9
|
-
readonly tag = "select";
|
|
10
|
-
readonly width = 95;
|
|
11
|
-
readonly selectPanelWidth = 115;
|
|
12
|
-
private defaultCodeLang;
|
|
13
|
-
getOptions(editor: IDomEditor): IOption[];
|
|
14
|
-
isActive(_editor: IDomEditor): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* 获取语言类型
|
|
17
|
-
* @param editor editor
|
|
18
|
-
*/
|
|
19
|
-
getValue(editor: IDomEditor): string | boolean;
|
|
20
|
-
isDisabled(editor: IDomEditor): boolean;
|
|
21
|
-
exec(editor: IDomEditor, value: string | boolean): void;
|
|
22
|
-
private getSelectCodeElem;
|
|
23
|
-
}
|
|
24
|
-
export default SelectLangMenu;
|
|
1
|
+
/**
|
|
2
|
+
* @description code-highlight select lang
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { IDomEditor, IOption, ISelectMenu } from '@wangeditor-next/core';
|
|
6
|
+
declare class SelectLangMenu implements ISelectMenu {
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly iconSvg = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M64 64v896h896V64H64z m487.6 698.8c0 87.2-51.2 127-125.8 127-67.4 0-106.4-34.8-126.4-77l68.6-41.4c13.2 23.4 25.2 43.2 54.2 43.2 27.6 0 45.2-10.8 45.2-53V475.4h84.2v287.4z m199.2 127c-78.2 0-128.8-37.2-153.4-86l68.6-39.6c18 29.4 41.6 51.2 83 51.2 34.8 0 57.2-17.4 57.2-41.6 0-28.8-22.8-39-61.4-56l-21-9c-60.8-25.8-101-58.4-101-127 0-63.2 48.2-111.2 123.2-111.2 53.6 0 92 18.6 119.6 67.4L800 580c-14.4-25.8-30-36-54.2-36-24.6 0-40.2 15.6-40.2 36 0 25.2 15.6 35.4 51.8 51.2l21 9c71.6 30.6 111.8 62 111.8 132.4 0 75.6-59.6 117.2-139.4 117.2z\"></path></svg>";
|
|
9
|
+
readonly tag = "select";
|
|
10
|
+
readonly width = 95;
|
|
11
|
+
readonly selectPanelWidth = 115;
|
|
12
|
+
private defaultCodeLang;
|
|
13
|
+
getOptions(editor: IDomEditor): IOption[];
|
|
14
|
+
isActive(_editor: IDomEditor): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 获取语言类型
|
|
17
|
+
* @param editor editor
|
|
18
|
+
*/
|
|
19
|
+
getValue(editor: IDomEditor): string | boolean;
|
|
20
|
+
isDisabled(editor: IDomEditor): boolean;
|
|
21
|
+
exec(editor: IDomEditor, value: string | boolean): void;
|
|
22
|
+
private getSelectCodeElem;
|
|
23
|
+
}
|
|
24
|
+
export default SelectLangMenu;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description menu config
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
export declare function genCodeLangs(): {
|
|
6
|
-
text: string;
|
|
7
|
-
value: string;
|
|
8
|
-
}[];
|
|
1
|
+
/**
|
|
2
|
+
* @description menu config
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
export declare function genCodeLangs(): {
|
|
6
|
+
text: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description code-highlight menu
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import SelectLangMenu from './SelectLangMenu';
|
|
6
|
-
export declare const selectLangMenuConf: {
|
|
7
|
-
key: string;
|
|
8
|
-
factory(): SelectLangMenu;
|
|
9
|
-
config: {
|
|
10
|
-
codeLangs: {
|
|
11
|
-
text: string;
|
|
12
|
-
value: string;
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @description code-highlight menu
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import SelectLangMenu from './SelectLangMenu';
|
|
6
|
+
export declare const selectLangMenuConf: {
|
|
7
|
+
key: string;
|
|
8
|
+
factory(): SelectLangMenu;
|
|
9
|
+
config: {
|
|
10
|
+
codeLangs: {
|
|
11
|
+
text: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description parse style html
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { IDomEditor } from '@wangeditor-next/core';
|
|
6
|
-
import { Descendant } from 'slate';
|
|
7
|
-
import { DOMElement } from '../utils/dom';
|
|
8
|
-
export declare function parseCodeStyleHtml(elem: DOMElement, node: Descendant, _editor: IDomEditor): Descendant;
|
|
1
|
+
/**
|
|
2
|
+
* @description parse style html
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
6
|
+
import { Descendant } from 'slate';
|
|
7
|
+
import { DOMElement } from '../utils/dom';
|
|
8
|
+
export declare function parseCodeStyleHtml(elem: DOMElement, node: Descendant, _editor: IDomEditor): Descendant;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description render code highlight style
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { Descendant } from 'slate';
|
|
6
|
-
import { VNode } from 'snabbdom';
|
|
7
|
-
/**
|
|
8
|
-
* 添加样式
|
|
9
|
-
* @param node slate text
|
|
10
|
-
* @param vnode vnode
|
|
11
|
-
* @returns vnode
|
|
12
|
-
*/
|
|
13
|
-
export declare function renderStyle(node: Descendant, vnode: VNode): VNode;
|
|
1
|
+
/**
|
|
2
|
+
* @description render code highlight style
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Descendant } from 'slate';
|
|
6
|
+
import { VNode } from 'snabbdom';
|
|
7
|
+
/**
|
|
8
|
+
* 添加样式
|
|
9
|
+
* @param node slate text
|
|
10
|
+
* @param vnode vnode
|
|
11
|
+
* @returns vnode
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderStyle(node: Descendant, vnode: VNode): VNode;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description DOM 操作
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import $ 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 { DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText, };
|
|
1
|
+
/**
|
|
2
|
+
* @description DOM 操作
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import $ 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 { DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText, };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description vdom utils fn
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { VNode } from 'snabbdom';
|
|
6
|
-
/**
|
|
7
|
-
* 给 vnode 添加 className
|
|
8
|
-
* @param vnode vnode
|
|
9
|
-
* @param className css class
|
|
10
|
-
*/
|
|
11
|
-
export declare function addVnodeClassName(vnode: VNode, className: string): void;
|
|
1
|
+
/**
|
|
2
|
+
* @description vdom utils fn
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { VNode } from 'snabbdom';
|
|
6
|
+
/**
|
|
7
|
+
* 给 vnode 添加 className
|
|
8
|
+
* @param vnode vnode
|
|
9
|
+
* @param className css class
|
|
10
|
+
*/
|
|
11
|
+
export declare function addVnodeClassName(vnode: VNode, className: string): void;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description prismjs
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import { Text } from 'slate';
|
|
6
|
-
import Prism from 'prismjs';
|
|
7
|
-
import 'prismjs/components/prism-jsx';
|
|
8
|
-
import 'prismjs/components/prism-typescript';
|
|
9
|
-
import 'prismjs/components/prism-markup';
|
|
10
|
-
import 'prismjs/components/prism-go';
|
|
11
|
-
import 'prismjs/components/prism-php';
|
|
12
|
-
import 'prismjs/components/prism-c';
|
|
13
|
-
import 'prismjs/components/prism-python';
|
|
14
|
-
import 'prismjs/components/prism-java';
|
|
15
|
-
import 'prismjs/components/prism-cpp';
|
|
16
|
-
import 'prismjs/components/prism-csharp';
|
|
17
|
-
import 'prismjs/components/prism-visual-basic';
|
|
18
|
-
import 'prismjs/components/prism-sql';
|
|
19
|
-
import 'prismjs/components/prism-ruby';
|
|
20
|
-
import 'prismjs/components/prism-swift';
|
|
21
|
-
import 'prismjs/components/prism-bash';
|
|
22
|
-
import 'prismjs/components/prism-markdown';
|
|
23
|
-
import 'prismjs/components/prism-lua';
|
|
24
|
-
import 'prismjs/components/prism-groovy';
|
|
25
|
-
import 'prismjs/components/prism-abap';
|
|
26
|
-
export declare const prismTokenTypes: string[];
|
|
27
|
-
/**
|
|
28
|
-
* 获取 prism token 的字符串长度
|
|
29
|
-
* @param token prism token
|
|
30
|
-
*/
|
|
31
|
-
export declare function getPrismTokenLength(token: any): any;
|
|
32
|
-
/**
|
|
33
|
-
* 获取 prism 解析的 token 列表
|
|
34
|
-
* @param textNode text node
|
|
35
|
-
* @param language 代码语言
|
|
36
|
-
*/
|
|
37
|
-
export declare function getPrismTokens(textNode: Text, language: string): (string | Prism.Token)[];
|
|
1
|
+
/**
|
|
2
|
+
* @description prismjs
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Text } from 'slate';
|
|
6
|
+
import Prism from 'prismjs';
|
|
7
|
+
import 'prismjs/components/prism-jsx';
|
|
8
|
+
import 'prismjs/components/prism-typescript';
|
|
9
|
+
import 'prismjs/components/prism-markup';
|
|
10
|
+
import 'prismjs/components/prism-go';
|
|
11
|
+
import 'prismjs/components/prism-php';
|
|
12
|
+
import 'prismjs/components/prism-c';
|
|
13
|
+
import 'prismjs/components/prism-python';
|
|
14
|
+
import 'prismjs/components/prism-java';
|
|
15
|
+
import 'prismjs/components/prism-cpp';
|
|
16
|
+
import 'prismjs/components/prism-csharp';
|
|
17
|
+
import 'prismjs/components/prism-visual-basic';
|
|
18
|
+
import 'prismjs/components/prism-sql';
|
|
19
|
+
import 'prismjs/components/prism-ruby';
|
|
20
|
+
import 'prismjs/components/prism-swift';
|
|
21
|
+
import 'prismjs/components/prism-bash';
|
|
22
|
+
import 'prismjs/components/prism-markdown';
|
|
23
|
+
import 'prismjs/components/prism-lua';
|
|
24
|
+
import 'prismjs/components/prism-groovy';
|
|
25
|
+
import 'prismjs/components/prism-abap';
|
|
26
|
+
export declare const prismTokenTypes: string[];
|
|
27
|
+
/**
|
|
28
|
+
* 获取 prism token 的字符串长度
|
|
29
|
+
* @param token prism token
|
|
30
|
+
*/
|
|
31
|
+
export declare function getPrismTokenLength(token: any): any;
|
|
32
|
+
/**
|
|
33
|
+
* 获取 prism 解析的 token 列表
|
|
34
|
+
* @param textNode text node
|
|
35
|
+
* @param language 代码语言
|
|
36
|
+
*/
|
|
37
|
+
export declare function getPrismTokens(textNode: Text, language: string): (string | Prism.Token)[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description editor config
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { IEditorConfig, IToolbarConfig } from './interface';
|
|
6
|
+
/**
|
|
7
|
+
* 生成编辑器默认配置
|
|
8
|
+
*/
|
|
9
|
+
export declare function genEditorConfig(userConfig?: Partial<IEditorConfig>): IEditorConfig;
|
|
10
|
+
/**
|
|
11
|
+
* 生成 toolbar 默认配置
|
|
12
|
+
*/
|
|
13
|
+
export declare function genToolbarConfig(userConfig?: Partial<IToolbarConfig>): IToolbarConfig;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description config interface
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Range, NodeEntry, Node } from 'slate';
|
|
6
|
+
import { IDomEditor } from '../editor/interface';
|
|
7
|
+
import { IMenuGroup } from '../menus/interface';
|
|
8
|
+
interface IHoverbarConf {
|
|
9
|
+
[key: string]: {
|
|
10
|
+
match?: (editor: IDomEditor, n: Node) => boolean;
|
|
11
|
+
menuKeys: string[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export type AlertType = 'success' | 'info' | 'warning' | 'error';
|
|
15
|
+
export interface ISingleMenuConfig {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
export interface IMenuConfig {
|
|
19
|
+
[key: string]: ISingleMenuConfig;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* editor config
|
|
23
|
+
*/
|
|
24
|
+
export interface IEditorConfig {
|
|
25
|
+
customAlert: (info: string, type: AlertType) => void;
|
|
26
|
+
onCreated?: (editor: IDomEditor) => void;
|
|
27
|
+
onChange?: (editor: IDomEditor) => void;
|
|
28
|
+
onDestroyed?: (editor: IDomEditor) => void;
|
|
29
|
+
onMaxLength?: (editor: IDomEditor) => void;
|
|
30
|
+
onFocus?: (editor: IDomEditor) => void;
|
|
31
|
+
onBlur?: (editor: IDomEditor) => void;
|
|
32
|
+
/**
|
|
33
|
+
* 自定义粘贴。返回 true 则继续粘贴,返回 false 则自行实现粘贴,阻止默认粘贴
|
|
34
|
+
*/
|
|
35
|
+
customPaste?: (editor: IDomEditor, e: ClipboardEvent) => boolean;
|
|
36
|
+
scroll: boolean;
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
readOnly: boolean;
|
|
39
|
+
autoFocus: boolean;
|
|
40
|
+
decorate?: (nodeEntry: NodeEntry) => Range[];
|
|
41
|
+
maxLength?: number;
|
|
42
|
+
MENU_CONF?: IMenuConfig;
|
|
43
|
+
hoverbarKeys?: IHoverbarConf;
|
|
44
|
+
EXTEND_CONF?: any;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* toolbar config
|
|
48
|
+
*/
|
|
49
|
+
export interface IToolbarConfig {
|
|
50
|
+
toolbarKeys: Array<string | IMenuGroup>;
|
|
51
|
+
insertKeys: {
|
|
52
|
+
index: number;
|
|
53
|
+
keys: string | Array<string | IMenuGroup>;
|
|
54
|
+
};
|
|
55
|
+
excludeKeys: Array<string>;
|
|
56
|
+
modalAppendToBody: boolean;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description config register
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { IMenuConfig, ISingleMenuConfig } from '../config/interface';
|
|
6
|
+
export declare const GLOBAL_MENU_CONF: IMenuConfig;
|
|
7
|
+
/**
|
|
8
|
+
* 注册全局菜单配置
|
|
9
|
+
* @param key menu key
|
|
10
|
+
* @param config config
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerGlobalMenuConf(key: string, config?: ISingleMenuConfig): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IGNORE_TAGS: Set<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description svg tag
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 【注意】svg 字符串的长度 ,否则会导致代码体积过大
|
|
7
|
+
* 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
|
|
8
|
+
* 找不到再从 iconfont.com 搜索
|
|
9
|
+
*/
|
|
10
|
+
export declare const SVG_CHECK_MARK = "<svg viewBox=\"0 0 1446 1024\"><path d=\"M574.116299 786.736392 1238.811249 48.517862C1272.390222 11.224635 1329.414799 7.827718 1366.75664 41.450462 1403.840015 74.840484 1406.731043 132.084741 1373.10189 169.433699L655.118888 966.834607C653.072421 969.716875 650.835807 972.514337 648.407938 975.210759 615.017957 1012.29409 558.292155 1015.652019 521.195664 982.250188L72.778218 578.493306C35.910826 545.297758 32.859041 488.584019 66.481825 451.242134 99.871807 414.158803 156.597563 410.800834 193.694055 444.202665L574.116299 786.736392Z\"></path></svg>";
|
|
11
|
+
export declare const SVG_DOWN_ARROW = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M498.7 655.8l-197.6-268c-8.1-10.9-0.3-26.4 13.3-26.4h395.2c13.6 0 21.4 15.4 13.3 26.4l-197.6 268c-6.6 9-20 9-26.6 0z\"></path></svg>";
|
|
12
|
+
export declare const SVG_CLOSE = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M1024 896.1024l-128 128L512 640 128 1024 0 896 384 512 0 128 128 0 512 384 896.1024 0l128 128L640 512z\"></path></svg>";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 绑定 node 的关系
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Node, Ancestor } from 'slate';
|
|
6
|
+
import { IDomEditor } from '../editor/interface';
|
|
7
|
+
/**
|
|
8
|
+
* createEditor 未传递 selector 时,绑定 node 的关系( NODE_TO_PARENT, NODE_TO_INDEX 等 )
|
|
9
|
+
* @param node node
|
|
10
|
+
* @param index index
|
|
11
|
+
* @param parent parent node
|
|
12
|
+
* @param editor editor
|
|
13
|
+
*/
|
|
14
|
+
declare function bindNodeRelation(node: Node, index: number, parent: Ancestor, editor: IDomEditor): void;
|
|
15
|
+
export default bindNodeRelation;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description create editor
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Descendant } from 'slate';
|
|
6
|
+
import { IDomEditor } from '../editor/interface';
|
|
7
|
+
import { IEditorConfig } from '../config/interface';
|
|
8
|
+
import type { DOMElement } from '../utils/dom';
|
|
9
|
+
type PluginFnType = <T extends IDomEditor>(editor: T) => T;
|
|
10
|
+
interface ICreateOption {
|
|
11
|
+
selector: string | DOMElement;
|
|
12
|
+
config: Partial<IEditorConfig>;
|
|
13
|
+
content?: Descendant[];
|
|
14
|
+
html?: string;
|
|
15
|
+
plugins: PluginFnType[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 创建编辑器
|
|
19
|
+
*/
|
|
20
|
+
export default function (option: Partial<ICreateOption>): import("slate").BaseEditor & IDomEditor & import("slate-history").HistoryEditor;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description create toolbar
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { IDomEditor } from '../editor/interface';
|
|
6
|
+
import Toolbar from '../menus/bar/Toolbar';
|
|
7
|
+
import { IToolbarConfig } from '../config/interface';
|
|
8
|
+
import { DOMElement } from '../utils/dom';
|
|
9
|
+
interface ICreateOption {
|
|
10
|
+
selector: string | DOMElement;
|
|
11
|
+
config?: Partial<IToolbarConfig>;
|
|
12
|
+
}
|
|
13
|
+
export default function (editor: IDomEditor | null, option: ICreateOption): Toolbar;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description create helper
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import { Descendant } from 'slate';
|
|
6
|
+
import { IDomEditor } from '../editor/interface';
|
|
7
|
+
import { DOMElement } from '../utils/dom';
|
|
8
|
+
/**
|
|
9
|
+
* 检查是否重复创建 textarea
|
|
10
|
+
*/
|
|
11
|
+
export declare function isRepeatedCreateTextarea(editor: IDomEditor, selector: string | DOMElement): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 检查是否重复创建 toolbar
|
|
14
|
+
*/
|
|
15
|
+
export declare function isRepeatedCreateToolbar(editor: IDomEditor, selector: string | DOMElement): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 生成默认 content
|
|
18
|
+
*/
|
|
19
|
+
export declare function genDefaultContent(): {
|
|
20
|
+
type: string;
|
|
21
|
+
children: {
|
|
22
|
+
text: string;
|
|
23
|
+
}[];
|
|
24
|
+
}[];
|
|
25
|
+
/**
|
|
26
|
+
* html 字符串 -> content
|
|
27
|
+
* @param editor editor
|
|
28
|
+
* @param html html 字符串
|
|
29
|
+
*/
|
|
30
|
+
export declare function htmlToContent(editor: IDomEditor, html?: string): Descendant[];
|