@wangeditor-next/core 1.7.4 → 1.7.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/core/src/config/interface.d.ts +1 -1
- package/dist/core/src/create/create-editor.d.ts +1 -1
- package/dist/core/src/editor/dom-editor.d.ts +5 -5
- package/dist/core/src/editor/interface.d.ts +1 -1
- package/dist/core/src/menus/bar/HoverBar.d.ts +1 -1
- package/dist/core/src/menus/bar/Toolbar.d.ts +1 -1
- package/dist/core/src/menus/bar-item/index.d.ts +1 -1
- package/dist/core/src/menus/interface.d.ts +1 -1
- package/dist/core/src/parse-html/index.d.ts +3 -3
- package/dist/core/src/render/index.d.ts +2 -2
- package/dist/core/src/to-html/index.d.ts +2 -2
- package/dist/core/src/upload/interface.d.ts +1 -1
- package/dist/core/src/utils/dom.d.ts +1 -1
- package/dist/core/src/utils/hotkeys.d.ts +3 -3
- package/dist/core/src/utils/ua.d.ts +1 -1
- package/dist/core/src/utils/vdom.d.ts +1 -1
- package/dist/css/style.css +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ interface IHoverbarConf {
|
|
|
11
11
|
menuKeys: string[];
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type AlertType = 'success' | 'info' | 'warning' | 'error';
|
|
15
15
|
export interface ISingleMenuConfig {
|
|
16
16
|
[key: string]: any;
|
|
17
17
|
}
|
|
@@ -6,7 +6,7 @@ import { Descendant } from 'slate';
|
|
|
6
6
|
import { IDomEditor } from '../editor/interface';
|
|
7
7
|
import { IEditorConfig } from '../config/interface';
|
|
8
8
|
import type { DOMElement } from '../utils/dom';
|
|
9
|
-
|
|
9
|
+
type PluginFnType = <T extends IDomEditor>(editor: T) => T;
|
|
10
10
|
interface ICreateOption {
|
|
11
11
|
selector: string | DOMElement;
|
|
12
12
|
config: Partial<IEditorConfig>;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @description 扩展 slate Editor(参考 slate-react react-editor.ts )
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import type { IDomEditor } from './interface';
|
|
7
|
-
import { Key } from '../utils/key';
|
|
8
|
-
import TextArea from '../text-area/TextArea';
|
|
9
|
-
import Toolbar from '../menus/bar/Toolbar';
|
|
5
|
+
import { Ancestor, Element, Node, Path, Point, Range } from 'slate';
|
|
10
6
|
import HoverBar from '../menus/bar/HoverBar';
|
|
7
|
+
import Toolbar from '../menus/bar/Toolbar';
|
|
8
|
+
import TextArea from '../text-area/TextArea';
|
|
11
9
|
import { DOMNode, DOMPoint, DOMRange, DOMSelection, DOMStaticRange } from '../utils/dom';
|
|
10
|
+
import { Key } from '../utils/key';
|
|
11
|
+
import type { IDomEditor } from './interface';
|
|
12
12
|
/**
|
|
13
13
|
* 自定义全局 command
|
|
14
14
|
*/
|
|
@@ -7,7 +7,7 @@ import ee from 'event-emitter';
|
|
|
7
7
|
import { IEditorConfig, AlertType, ISingleMenuConfig } from '../config/interface';
|
|
8
8
|
import { IPositionStyle } from '../menus/interface';
|
|
9
9
|
import { DOMElement } from '../utils/dom';
|
|
10
|
-
export
|
|
10
|
+
export type ElementWithId = Element & {
|
|
11
11
|
id: string;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
5
|
import { IButtonMenu, ISelectMenu, IDropPanelMenu, IModalMenu } from '../interface';
|
|
6
|
-
|
|
6
|
+
type MenuType = IButtonMenu | ISelectMenu | IDropPanelMenu | IModalMenu;
|
|
7
7
|
declare class HoverBar {
|
|
8
8
|
private readonly $elem;
|
|
9
9
|
private menus;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Dom7Array, DOMElement } from '../../utils/dom';
|
|
6
6
|
import { IButtonMenu, ISelectMenu, IDropPanelMenu, IModalMenu } from '../interface';
|
|
7
7
|
import { IToolbarConfig } from '../../config/interface';
|
|
8
|
-
|
|
8
|
+
type MenuType = IButtonMenu | ISelectMenu | IDropPanelMenu | IModalMenu;
|
|
9
9
|
declare class Toolbar {
|
|
10
10
|
$box: Dom7Array;
|
|
11
11
|
private readonly $toolbar;
|
|
@@ -6,7 +6,7 @@ import { Dom7Array } from '../../utils/dom';
|
|
|
6
6
|
import { IButtonMenu, ISelectMenu, IDropPanelMenu, IModalMenu, IMenuGroup } from '../interface';
|
|
7
7
|
import { IDomEditor } from '../../editor/interface';
|
|
8
8
|
import GroupButton from './GroupButton';
|
|
9
|
-
|
|
9
|
+
type MenuType = IButtonMenu | ISelectMenu | IDropPanelMenu | IModalMenu;
|
|
10
10
|
export interface IBarItem {
|
|
11
11
|
$elem: Dom7Array;
|
|
12
12
|
menu: MenuType;
|
|
@@ -55,7 +55,7 @@ export interface IModalMenu extends IBaseMenu {
|
|
|
55
55
|
getModalContentElem: (editor: IDomEditor) => DOMElement;
|
|
56
56
|
getModalPositionNode: (editor: IDomEditor) => Node | null;
|
|
57
57
|
}
|
|
58
|
-
export
|
|
58
|
+
export type MenuFactoryType = () => IButtonMenu | ISelectMenu | IDropPanelMenu | IModalMenu;
|
|
59
59
|
export interface IRegisterMenuConf {
|
|
60
60
|
key: string;
|
|
61
61
|
factory: MenuFactoryType;
|
|
@@ -6,7 +6,7 @@ import { DOMElement } from '../utils/dom';
|
|
|
6
6
|
import { Element as SlateElement, Descendant } from 'slate';
|
|
7
7
|
import { IDomEditor } from '../editor/interface';
|
|
8
8
|
export declare const TEXT_TAGS: string[];
|
|
9
|
-
export
|
|
9
|
+
export type PreParseHtmlFnType = ($node: DOMElement) => DOMElement;
|
|
10
10
|
export interface IPreParseHtmlConf {
|
|
11
11
|
selector: string;
|
|
12
12
|
preParseHtml: PreParseHtmlFnType;
|
|
@@ -17,14 +17,14 @@ export declare const PRE_PARSE_HTML_CONF_LIST: IPreParseHtmlConf[];
|
|
|
17
17
|
* @param conf pre-parse html conf
|
|
18
18
|
*/
|
|
19
19
|
export declare function registerPreParseHtmlConf(conf: IPreParseHtmlConf): void;
|
|
20
|
-
export
|
|
20
|
+
export type ParseStyleHtmlFnType = ($node: DOMElement, node: Descendant, editor: IDomEditor) => Descendant;
|
|
21
21
|
export declare const PARSE_STYLE_HTML_FN_LIST: ParseStyleHtmlFnType[];
|
|
22
22
|
/**
|
|
23
23
|
* 注册 parseStyleHtml 函数
|
|
24
24
|
* @param fn parse style html 的函数
|
|
25
25
|
*/
|
|
26
26
|
export declare function registerParseStyleHtmlHandler(fn: ParseStyleHtmlFnType): void;
|
|
27
|
-
export
|
|
27
|
+
export type ParseElemHtmlFnType = ($elem: DOMElement, children: Descendant[], editor: IDomEditor) => SlateElement | SlateElement[];
|
|
28
28
|
export declare const PARSE_ELEM_HTML_CONF: {
|
|
29
29
|
[key: string]: ParseElemHtmlFnType;
|
|
30
30
|
};
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
import { Element as SlateElement, Descendant } from 'slate';
|
|
6
6
|
import { VNode } from 'snabbdom';
|
|
7
7
|
import { IDomEditor } from '../editor/interface';
|
|
8
|
-
export
|
|
8
|
+
export type RenderStyleFnType = (node: Descendant, vnode: VNode) => VNode;
|
|
9
9
|
export declare const RENDER_STYLE_HANDLER_LIST: RenderStyleFnType[];
|
|
10
10
|
/**
|
|
11
11
|
* 注册处理文本样式的函数
|
|
12
12
|
* @param fn 处理文本样式的函数
|
|
13
13
|
*/
|
|
14
14
|
export declare function registerStyleHandler(fn: RenderStyleFnType): void;
|
|
15
|
-
export
|
|
15
|
+
export type RenderElemFnType = (elemNode: SlateElement, children: VNode[] | null, editor: IDomEditor) => VNode;
|
|
16
16
|
export declare const RENDER_ELEM_CONF: {
|
|
17
17
|
[key: string]: RenderElemFnType;
|
|
18
18
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Element as SlateElement, Descendant } from 'slate';
|
|
6
6
|
import { IDomEditor } from '../editor/interface';
|
|
7
|
-
export
|
|
7
|
+
export type styleToHtmlFnType = (node: Descendant, elemHtml: string) => string;
|
|
8
8
|
export declare const STYLE_TO_HTML_FN_LIST: styleToHtmlFnType[];
|
|
9
9
|
/**
|
|
10
10
|
* 注册 toHtml 处理文本样式的函数
|
|
@@ -16,7 +16,7 @@ interface IElemToHtmlRes {
|
|
|
16
16
|
prefix?: string;
|
|
17
17
|
suffix?: string;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export type ElemToHtmlFnType = (elemNode: SlateElement, childrenHtml: string, editor?: IDomEditor) => string | IElemToHtmlRes;
|
|
20
20
|
export declare const ELEM_TO_HTML_CONF: {
|
|
21
21
|
[key: string]: ElemToHtmlFnType;
|
|
22
22
|
};
|
|
@@ -17,7 +17,7 @@ import DOMRange = globalThis.Range;
|
|
|
17
17
|
import DOMSelection = globalThis.Selection;
|
|
18
18
|
import DOMStaticRange = globalThis.StaticRange;
|
|
19
19
|
export { DOMNode, DOMComment, DOMElement, DOMText, DOMRange, DOMSelection, DOMStaticRange };
|
|
20
|
-
export
|
|
20
|
+
export type DOMPoint = [Node, number];
|
|
21
21
|
/**
|
|
22
22
|
* Returns the host window of a DOM node
|
|
23
23
|
*/
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* @description 快捷键
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Hotkeys.
|
|
7
|
+
*/
|
|
5
8
|
declare const _default: {
|
|
6
9
|
isBold: (event: KeyboardEvent) => boolean;
|
|
7
10
|
isCompose: (event: KeyboardEvent) => boolean;
|
|
@@ -29,7 +32,4 @@ declare const _default: {
|
|
|
29
32
|
isTab: (event: KeyboardEvent) => boolean;
|
|
30
33
|
isSelectAll: (event: KeyboardEvent) => boolean;
|
|
31
34
|
};
|
|
32
|
-
/**
|
|
33
|
-
* Hotkeys.
|
|
34
|
-
*/
|
|
35
35
|
export default _default;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @description 通过 UA 判断浏览器
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
-
export declare const IS_IOS:
|
|
5
|
+
export declare const IS_IOS: boolean;
|
|
6
6
|
export declare const IS_APPLE: boolean;
|
|
7
7
|
export declare const IS_FIREFOX: boolean;
|
|
8
8
|
export declare const IS_FIREFOX_LEGACY: boolean;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
5
|
import { VNode, VNodeStyle, Props, Dataset } from 'snabbdom';
|
|
6
|
-
export
|
|
6
|
+
export type PatchFn = (oldVnode: VNode | Element, vnode: VNode) => VNode;
|
|
7
7
|
/**
|
|
8
8
|
* 创建 snabbdom patch
|
|
9
9
|
* @returns snabbdom patch 函数
|
package/dist/css/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.w-e-text-container *,.w-e-toolbar *{box-sizing:border-box;margin:0;outline:none;padding:0}.w-e-text-container blockquote,.w-e-text-container li,.w-e-text-container p,.w-e-text-container td,.w-e-text-container th,.w-e-toolbar *{line-height:1.5}.w-e-text-container{background-color:var(--w-e-textarea-bg-color);color:var(--w-e-textarea-color);height:100%;position:relative}.no-scroll{width:100%}.w-e-text-container .w-e-scroll{
|
|
1
|
+
.w-e-text-container *,.w-e-toolbar *{box-sizing:border-box;margin:0;outline:none;padding:0}.w-e-text-container blockquote,.w-e-text-container li,.w-e-text-container p,.w-e-text-container td,.w-e-text-container th,.w-e-toolbar *{line-height:1.5}.w-e-text-container{background-color:var(--w-e-textarea-bg-color);color:var(--w-e-textarea-color);height:100%;position:relative}.no-scroll{width:100%}.w-e-text-container .w-e-scroll{height:100%;-webkit-overflow-scrolling:touch}.w-e-text-container [data-slate-editor]{outline:0;white-space:pre-wrap;word-wrap:break-word;border-top:1px solid transparent;min-height:100%;padding:0 10px}.w-e-text-container [data-slate-editor] p{margin:15px 0}.w-e-text-container [data-slate-editor] h1,.w-e-text-container [data-slate-editor] h2,.w-e-text-container [data-slate-editor] h3,.w-e-text-container [data-slate-editor] h4,.w-e-text-container [data-slate-editor] h5{margin:20px 0}.w-e-text-container [data-slate-editor] img{cursor:default;display:inline!important;max-width:100%;min-height:20px;min-width:20px}.w-e-text-container [data-slate-editor] span{text-indent:0}.w-e-text-container [data-slate-editor] [data-selected=true]{box-shadow:0 0 0 2px var(--w-e-textarea-selected-border-color)}.w-e-text-placeholder{font-style:italic;left:10px;top:17px;width:90%}.w-e-max-length-info,.w-e-text-placeholder{color:var(--w-e-textarea-slight-color);pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.w-e-max-length-info{bottom:.5em;right:1em}.w-e-bar{background-color:var(--w-e-toolbar-bg-color);color:var(--w-e-toolbar-color);font-size:14px;padding:0 5px}.w-e-bar svg{height:14px;width:14px;fill:var(--w-e-toolbar-color)}.w-e-bar-show{display:flex}.w-e-bar-hidden{display:none}.w-e-hover-bar{border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 5px #0000001f;position:absolute}.w-e-toolbar{flex-wrap:wrap;position:relative}.w-e-bar-divider{background-color:var(--w-e-toolbar-border-color);display:inline-flex;height:40px;margin:0 5px;width:1px}.w-e-bar-item{display:flex;height:40px;padding:4px;position:relative;text-align:center}.w-e-bar-item,.w-e-bar-item button{align-items:center;justify-content:center}.w-e-bar-item button{background:transparent;border:none;color:var(--w-e-toolbar-color);cursor:pointer;display:inline-flex;height:32px;overflow:hidden;padding:0 8px;white-space:nowrap}.w-e-bar-item button:hover{background-color:var(--w-e-toolbar-active-bg-color);color:var(--w-e-toolbar-active-color)}.w-e-bar-item button .title{margin-left:5px}.w-e-bar-item .active{background-color:var(--w-e-toolbar-active-bg-color);color:var(--w-e-toolbar-active-color)}.w-e-bar-item .disabled{color:var(--w-e-toolbar-disabled-color);cursor:not-allowed}.w-e-bar-item .disabled svg{fill:var(--w-e-toolbar-disabled-color)}.w-e-bar-item .disabled:hover{background-color:var(--w-e-toolbar-bg-color);color:var(--w-e-toolbar-disabled-color)}.w-e-bar-item .disabled:hover svg{fill:var(--w-e-toolbar-disabled-color)}.w-e-menu-tooltip-v5:before{background-color:var(--w-e-toolbar-active-color);border-radius:5px;color:var(--w-e-toolbar-bg-color);content:attr(data-tooltip);font-size:.75em;opacity:0;padding:5px 10px;position:absolute;text-align:center;top:40px;transition:opacity .6s;visibility:hidden;white-space:pre;z-index:1}.w-e-menu-tooltip-v5:after{border-color:transparent transparent var(--w-e-toolbar-active-color) transparent;border-style:solid;border-width:5px;content:"";opacity:0;position:absolute;top:30px;transition:opacity .6s;visibility:hidden}.w-e-menu-tooltip-v5:hover:after,.w-e-menu-tooltip-v5:hover:before{opacity:1;visibility:visible}.w-e-menu-tooltip-v5.tooltip-right:before{left:100%;top:10px}.w-e-menu-tooltip-v5.tooltip-right:after{border-color:transparent var(--w-e-toolbar-active-color) transparent transparent;left:100%;margin-left:-10px;top:16px}.w-e-bar-item-group .w-e-bar-item-menus-container{background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 10px #0000001f;display:none;left:0;margin-top:40px;position:absolute;top:0;z-index:1}.w-e-bar-item-group:hover .w-e-bar-item-menus-container{display:block}.w-e-select-list{background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 10px #0000001f;left:0;margin-top:40px;max-height:350px;min-width:100px;overflow-y:auto;position:absolute;top:0;z-index:1}.w-e-select-list ul{line-height:1;list-style:none}.w-e-select-list ul .selected{background-color:var(--w-e-toolbar-active-bg-color)}.w-e-select-list ul li{cursor:pointer;padding:7px 0 7px 25px;position:relative;text-align:left;white-space:nowrap}.w-e-select-list ul li:hover{background-color:var(--w-e-toolbar-active-bg-color)}.w-e-select-list ul li svg{left:0;margin-left:5px;margin-top:-7px;position:absolute;top:50%}.w-e-bar-bottom .w-e-select-list{bottom:0;margin-bottom:40px;margin-top:0;top:inherit}.w-e-drop-panel{background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 10px #0000001f;margin-top:40px;min-width:200px;padding:10px;position:absolute;top:0;z-index:1}.w-e-bar-bottom .w-e-drop-panel{bottom:0;margin-bottom:40px;margin-top:0;top:inherit}.w-e-modal{background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-toolbar-border-color);border-radius:3px;box-shadow:0 2px 10px #0000001f;color:var(--w-e-toolbar-color);font-size:14px;min-height:40px;min-width:100px;padding:20px 15px 0;position:absolute;text-align:left;z-index:1}.w-e-modal .btn-close{cursor:pointer;line-height:1;padding:5px;position:absolute;right:8px;top:7px}.w-e-modal .btn-close svg{height:10px;width:10px;fill:var(--w-e-toolbar-color)}.w-e-modal .babel-container{display:block;margin-bottom:15px}.w-e-modal .babel-container span{display:block;margin-bottom:10px}.w-e-modal .button-container{margin-bottom:15px}.w-e-modal button{background-color:var(--w-e-modal-button-bg-color);border:1px solid var(--w-e-modal-button-border-color);border-radius:4px;color:var(--w-e-toolbar-color);cursor:pointer;font-weight:400;height:32px;padding:4.5px 15px;text-align:center;touch-action:manipulation;transition:all .3s cubic-bezier(.645,.045,.355,1);-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.w-e-modal input[type=number],.w-e-modal input[type=text],.w-e-modal textarea{background-color:var(--w-e-toolbar-bg-color);border:1px solid var(--w-e-modal-button-border-color);border-radius:4px;color:var(--w-e-toolbar-color);font-feature-settings:"tnum";font-variant:tabular-nums;padding:4.5px 11px;transition:all .3s;width:100%}.w-e-modal textarea{min-height:60px}body .w-e-modal,body .w-e-modal *{box-sizing:border-box}.w-e-progress-bar{background-color:var(--w-e-textarea-handler-bg-color);height:1px;position:absolute;transition:width .3s;width:0}.w-e-full-screen-container{bottom:0!important;display:flex!important;flex-direction:column!important;height:100%!important;left:0!important;margin:0!important;padding:0!important;position:fixed;right:0!important;top:0!important;width:100%!important}.w-e-full-screen-container [data-w-e-textarea=true]{flex:1!important}
|