@wangeditor-next/plugin-formula 1.0.42 → 2.0.0
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/basic-modules/src/modules/color/render-style.d.ts +3 -1
- package/dist/basic-modules/src/modules/color/style-to-html.d.ts +3 -1
- package/dist/basic-modules/src/modules/font-size-family/render-style.d.ts +3 -1
- package/dist/basic-modules/src/modules/font-size-family/style-to-html.d.ts +3 -1
- package/dist/basic-modules/src/modules/image/elem-to-html.d.ts +2 -1
- package/dist/basic-modules/src/modules/indent/render-style.d.ts +3 -1
- package/dist/basic-modules/src/modules/indent/style-to-html.d.ts +2 -1
- package/dist/basic-modules/src/modules/justify/render-style.d.ts +3 -1
- package/dist/basic-modules/src/modules/justify/style-to-html.d.ts +2 -1
- package/dist/basic-modules/src/modules/line-height/render-style.d.ts +3 -1
- package/dist/basic-modules/src/modules/line-height/style-to-html.d.ts +2 -1
- package/dist/basic-modules/src/utils/style-class.d.ts +14 -0
- package/dist/basic-modules/src/utils/vdom.d.ts +14 -0
- package/dist/core/src/config/interface.d.ts +32 -0
- package/dist/core/src/config/style-mode.d.ts +8 -0
- package/dist/core/src/index.d.ts +2 -1
- package/dist/core/src/render/element/renderStyle.d.ts +3 -1
- package/dist/core/src/render/index.d.ts +2 -2
- package/dist/core/src/render/text/renderStyle.d.ts +3 -1
- package/dist/core/src/to-html/index.d.ts +2 -2
- package/dist/core/src/upload/createUploader.d.ts +7 -3
- package/dist/core/src/upload/createUppyUploader.d.ts +7 -0
- package/dist/core/src/upload/index.d.ts +4 -3
- package/dist/core/src/upload/interface.d.ts +37 -9
- package/dist/editor/src/index.d.ts +2 -2
- package/dist/list-module/src/module/elem-to-html.d.ts +2 -1
- package/dist/list-module/src/module/style-class.d.ts +6 -0
- package/dist/table-module/src/module/elem-to-html.d.ts +3 -2
- package/dist/table-module/src/module/style-to-html.d.ts +2 -1
- package/dist/video-module/src/module/elem-to-html.d.ts +2 -1
- package/dist/video-module/src/utils/dom.d.ts +1 -1
- package/package.json +2 -2
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* @description render color style
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
7
|
import { VNode } from 'snabbdom';
|
|
7
8
|
/**
|
|
8
9
|
* 添加样式
|
|
9
10
|
* @param node text node
|
|
10
11
|
* @param vnode vnode
|
|
12
|
+
* @param editor editor
|
|
11
13
|
* @returns vnode
|
|
12
14
|
*/
|
|
13
|
-
export declare function renderStyle(node: Descendant, vnode: VNode): VNode;
|
|
15
|
+
export declare function renderStyle(node: Descendant, vnode: VNode, editor?: IDomEditor): VNode;
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @description textStyle to html
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
7
|
/**
|
|
7
8
|
* style to html
|
|
8
9
|
* @param textNode slate text node
|
|
9
10
|
* @param textHtml text html
|
|
11
|
+
* @param editor editor instance
|
|
10
12
|
* @returns styled html
|
|
11
13
|
*/
|
|
12
|
-
export declare function styleToHtml(textNode: Descendant, textHtml: string): string;
|
|
14
|
+
export declare function styleToHtml(textNode: Descendant, textHtml: string, editor?: IDomEditor): string;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* @description render font-size font-family style
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
7
|
import { VNode } from 'snabbdom';
|
|
7
8
|
/**
|
|
8
9
|
* 添加样式
|
|
9
10
|
* @param node slate elem
|
|
10
11
|
* @param vnode vnode
|
|
12
|
+
* @param editor editor
|
|
11
13
|
* @returns vnode
|
|
12
14
|
*/
|
|
13
|
-
export declare function renderStyle(node: Descendant, vnode: VNode): VNode;
|
|
15
|
+
export declare function renderStyle(node: Descendant, vnode: VNode, editor?: IDomEditor): VNode;
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @description textStyle to html
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
7
|
/**
|
|
7
8
|
* style to html
|
|
8
9
|
* @param textNode slate text node
|
|
9
10
|
* @param textHtml text html
|
|
11
|
+
* @param editor editor instance
|
|
10
12
|
* @returns styled html
|
|
11
13
|
*/
|
|
12
|
-
export declare function styleToHtml(textNode: Descendant, textHtml: string): string;
|
|
14
|
+
export declare function styleToHtml(textNode: Descendant, textHtml: string, editor?: IDomEditor): string;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* @description to html
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Element } from 'slate';
|
|
6
|
-
declare function imageToHtml(elemNode: Element, _childrenHtml: string): string;
|
|
7
|
+
declare function imageToHtml(elemNode: Element, _childrenHtml: string, editor?: IDomEditor): string;
|
|
7
8
|
export declare const imageToHtmlConf: {
|
|
8
9
|
type: string;
|
|
9
10
|
elemToHtml: typeof imageToHtml;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* @description render indent style
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
7
|
import { VNode } from 'snabbdom';
|
|
7
8
|
/**
|
|
8
9
|
* 添加样式
|
|
9
10
|
* @param node slate elem
|
|
10
11
|
* @param vnode vnode
|
|
12
|
+
* @param editor editor
|
|
11
13
|
* @returns vnode
|
|
12
14
|
*/
|
|
13
|
-
export declare function renderStyle(node: Descendant, vnode: VNode): VNode;
|
|
15
|
+
export declare function renderStyle(node: Descendant, vnode: VNode, editor?: IDomEditor): VNode;
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
* @description textStyle to html
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
|
-
export declare function styleToHtml(node: Descendant, elemHtml: string): string;
|
|
7
|
+
export declare function styleToHtml(node: Descendant, elemHtml: string, editor?: IDomEditor): string;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* @description render justify style
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
7
|
import { VNode } from 'snabbdom';
|
|
7
8
|
/**
|
|
8
9
|
* 添加样式
|
|
9
10
|
* @param node slate elem
|
|
10
11
|
* @param vnode vnode
|
|
12
|
+
* @param editor editor
|
|
11
13
|
* @returns vnode
|
|
12
14
|
*/
|
|
13
|
-
export declare function renderStyle(node: Descendant, vnode: VNode): VNode;
|
|
15
|
+
export declare function renderStyle(node: Descendant, vnode: VNode, editor?: IDomEditor): VNode;
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
* @description textStyle to html
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
|
-
export declare function styleToHtml(node: Descendant, elemHtml: string): string;
|
|
7
|
+
export declare function styleToHtml(node: Descendant, elemHtml: string, editor?: IDomEditor): string;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* @description render line-height style
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
7
|
import { VNode } from 'snabbdom';
|
|
7
8
|
/**
|
|
8
9
|
* 添加样式
|
|
9
10
|
* @param node slate elem
|
|
10
11
|
* @param vnode vnode
|
|
12
|
+
* @param editor editor
|
|
11
13
|
* @returns vnode
|
|
12
14
|
*/
|
|
13
|
-
export declare function renderStyle(node: Descendant, vnode: VNode): VNode;
|
|
15
|
+
export declare function renderStyle(node: Descendant, vnode: VNode, editor?: IDomEditor): VNode;
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
* @description textStyle to html
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Descendant } from 'slate';
|
|
6
|
-
export declare function styleToHtml(node: Descendant, elemHtml: string): string;
|
|
7
|
+
export declare function styleToHtml(node: Descendant, elemHtml: string, editor?: IDomEditor): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description text style class utils
|
|
3
|
+
*/
|
|
4
|
+
import { IDomEditor, StyleClassTokenType } from '@wangeditor-next/core';
|
|
5
|
+
import { VNode, VNodeStyle } from 'snabbdom';
|
|
6
|
+
import { Dom7Array } from './dom';
|
|
7
|
+
export type TextStyleType = StyleClassTokenType;
|
|
8
|
+
export type ClassStyleScene = 'render' | 'toHtml';
|
|
9
|
+
export declare function genStyleClassName(type: TextStyleType, value: string): string;
|
|
10
|
+
export declare function getRegisteredStyleTokenValues(editor: IDomEditor | undefined, type: TextStyleType): string[];
|
|
11
|
+
export declare function getTextStyleMode(editor?: IDomEditor): import("@wangeditor-next/core").TextStyleMode;
|
|
12
|
+
export declare function appendStyleClassAndData($text: Dom7Array, type: TextStyleType, value: string, editor?: IDomEditor, scene?: ClassStyleScene, inlineFallback?: () => void): void;
|
|
13
|
+
export declare function appendVnodeStyleClassAndData(vnode: VNode, type: TextStyleType, value: string, editor?: IDomEditor, scene?: ClassStyleScene, inlineFallback?: VNodeStyle): void;
|
|
14
|
+
export declare function getStyleValueFromDataOrClass($text: Dom7Array, type: TextStyleType, editor?: IDomEditor): string;
|
|
@@ -3,9 +3,23 @@
|
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
5
|
import { VNode, VNodeStyle } from 'snabbdom';
|
|
6
|
+
type VNodeDataset = Record<string, string>;
|
|
6
7
|
/**
|
|
7
8
|
* 给 vnode 添加样式
|
|
8
9
|
* @param vnode vnode
|
|
9
10
|
* @param newStyle { key: val }
|
|
10
11
|
*/
|
|
11
12
|
export declare function addVnodeStyle(vnode: VNode, newStyle: VNodeStyle): void;
|
|
13
|
+
/**
|
|
14
|
+
* 给 vnode 添加 className
|
|
15
|
+
* @param vnode vnode
|
|
16
|
+
* @param className css class
|
|
17
|
+
*/
|
|
18
|
+
export declare function addVnodeClassName(vnode: VNode, className: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* 给 vnode 添加 dataset
|
|
21
|
+
* @param vnode vnode
|
|
22
|
+
* @param newDataset { key: val }
|
|
23
|
+
*/
|
|
24
|
+
export declare function addVnodeDataset(vnode: VNode, newDataset: VNodeDataset): void;
|
|
25
|
+
export {};
|
|
@@ -16,6 +16,16 @@ interface IHoverbarConf {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
export type AlertType = 'success' | 'info' | 'warning' | 'error';
|
|
19
|
+
export type TextStyleMode = 'inline' | 'class';
|
|
20
|
+
export type ClassStylePolicy = 'preserve-data' | 'fallback-inline' | 'strict';
|
|
21
|
+
export type StyleClassTokenType = 'color' | 'bgColor' | 'fontSize' | 'fontFamily' | 'textAlign' | 'lineHeight' | 'indent';
|
|
22
|
+
export interface IClassStyleUnsupportedPayload {
|
|
23
|
+
type: string;
|
|
24
|
+
value: string;
|
|
25
|
+
scene: 'render' | 'toHtml';
|
|
26
|
+
fallback: 'preserve-data' | 'inline' | 'throw';
|
|
27
|
+
message: string;
|
|
28
|
+
}
|
|
19
29
|
/**
|
|
20
30
|
* EditorEvents 包含所有编辑器的生命周期事件。
|
|
21
31
|
*
|
|
@@ -202,6 +212,28 @@ export interface IEditorConfig {
|
|
|
202
212
|
* 返回值会继续进入编辑器的 HTML 解析流程。
|
|
203
213
|
*/
|
|
204
214
|
sanitizeHtml?: (html: string) => string;
|
|
215
|
+
/**
|
|
216
|
+
* 文本/段落样式(color/bgColor/fontSize/fontFamily/textAlign/lineHeight/indent)导出模式。
|
|
217
|
+
* - `inline`: 输出 style 属性(默认)
|
|
218
|
+
* - `class`: 输出 class + data-w-e-*,便于严格 CSP 场景使用
|
|
219
|
+
*/
|
|
220
|
+
textStyleMode?: TextStyleMode;
|
|
221
|
+
/**
|
|
222
|
+
* class 模式遇到“不在受支持样式 token 集合中”的值时的处理策略。
|
|
223
|
+
* - `preserve-data`(默认):保留 data-w-e-*,不输出 class/inline,确保可回读但可能不展示
|
|
224
|
+
* - `fallback-inline`:回退为 inline style,优先保证展示
|
|
225
|
+
* - `strict`:直接抛错,阻止静默降级
|
|
226
|
+
*/
|
|
227
|
+
classStylePolicy?: ClassStylePolicy;
|
|
228
|
+
/**
|
|
229
|
+
* class 模式遇到未知值时的通知回调。
|
|
230
|
+
*/
|
|
231
|
+
onClassStyleUnsupported?: (payload: IClassStyleUnsupportedPayload) => void;
|
|
232
|
+
/**
|
|
233
|
+
* class 模式下允许输出 class 的样式 token 注册表。
|
|
234
|
+
* 用于扩展默认 token(需配合业务方自行提供对应 CSS)。
|
|
235
|
+
*/
|
|
236
|
+
styleClassTokens?: Partial<Record<StyleClassTokenType, string[]>>;
|
|
205
237
|
scroll: boolean;
|
|
206
238
|
placeholder?: string;
|
|
207
239
|
readOnly: boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description class/inline style mode helpers
|
|
3
|
+
*/
|
|
4
|
+
import { IDomEditor } from '../editor/interface';
|
|
5
|
+
import { ClassStylePolicy, IClassStyleUnsupportedPayload, TextStyleMode } from './interface';
|
|
6
|
+
export declare function getTextStyleMode(editor?: IDomEditor): TextStyleMode;
|
|
7
|
+
export declare function getClassStylePolicy(editor?: IDomEditor): ClassStylePolicy;
|
|
8
|
+
export declare function reportUnsupportedClassStyle(editor: IDomEditor | undefined, payload: IClassStyleUnsupportedPayload): void;
|
package/dist/core/src/index.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ import type { IParseElemHtmlConf, IPreParseHtmlConf, ParseStyleHtmlFnType } from
|
|
|
9
9
|
import type { IRenderElemConf, RenderStyleFnType } from './render/index';
|
|
10
10
|
import type { IElemToHtmlConf, styleToHtmlFnType } from './to-html/index';
|
|
11
11
|
export * from './create/index';
|
|
12
|
-
export type { IEditorConfig, IToolbarConfig, IUploadImageConfig, IUploadVideoConfig, } from './config/interface';
|
|
12
|
+
export type { ClassStylePolicy, IClassStyleUnsupportedPayload, IEditorConfig, IToolbarConfig, IUploadImageConfig, IUploadVideoConfig, StyleClassTokenType, TextStyleMode, } from './config/interface';
|
|
13
|
+
export * from './config/style-mode';
|
|
13
14
|
export * from './editor/dom-editor';
|
|
14
15
|
export * from './editor/interface';
|
|
15
16
|
export * from './render/index';
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Element as SlateElement } from 'slate';
|
|
6
6
|
import { VNode } from 'snabbdom';
|
|
7
|
+
import { IDomEditor } from '../../editor/interface';
|
|
7
8
|
/**
|
|
8
9
|
* 渲染样式
|
|
9
10
|
* @param elem slate elem node
|
|
10
11
|
* @param vnode elem Vnode
|
|
12
|
+
* @param editor editor
|
|
11
13
|
*/
|
|
12
|
-
declare function renderStyle(elem: SlateElement, vnode: VNode): VNode;
|
|
14
|
+
declare function renderStyle(elem: SlateElement, vnode: VNode, editor?: IDomEditor): VNode;
|
|
13
15
|
export default renderStyle;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @description formats entry
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
-
import { Element as SlateElement
|
|
5
|
+
import { Descendant, Element as SlateElement } from 'slate';
|
|
6
6
|
import { VNode } from 'snabbdom';
|
|
7
7
|
import { IDomEditor } from '../editor/interface';
|
|
8
|
-
export type RenderStyleFnType = (node: Descendant, vnode: VNode) => VNode;
|
|
8
|
+
export type RenderStyleFnType = (node: Descendant, vnode: VNode, editor?: IDomEditor) => VNode;
|
|
9
9
|
export declare const RENDER_STYLE_HANDLER_LIST: RenderStyleFnType[];
|
|
10
10
|
/**
|
|
11
11
|
* 注册处理文本样式的函数
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Text as SlateText } from 'slate';
|
|
6
6
|
import { VNode } from 'snabbdom';
|
|
7
|
+
import { IDomEditor } from '../../editor/interface';
|
|
7
8
|
/**
|
|
8
9
|
* 给字符串增加样式
|
|
9
10
|
* @param leafNode slate text leaf node
|
|
10
11
|
* @param textVnode textVnode
|
|
12
|
+
* @param editor editor
|
|
11
13
|
*/
|
|
12
|
-
declare function addTextVnodeStyle(leafNode: SlateText, textVnode: VNode): VNode;
|
|
14
|
+
declare function addTextVnodeStyle(leafNode: SlateText, textVnode: VNode, editor?: IDomEditor): VNode;
|
|
13
15
|
export default addTextVnodeStyle;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @description to-html entry
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
-
import { Element as SlateElement
|
|
5
|
+
import { Descendant, Element as SlateElement } from 'slate';
|
|
6
6
|
import { IDomEditor } from '../editor/interface';
|
|
7
|
-
export type styleToHtmlFnType = (node: Descendant, elemHtml: string) => string;
|
|
7
|
+
export type styleToHtmlFnType = (node: Descendant, elemHtml: string, editor?: IDomEditor) => string;
|
|
8
8
|
export declare const STYLE_TO_HTML_FN_LIST: styleToHtmlFnType[];
|
|
9
9
|
/**
|
|
10
10
|
* 注册 toHtml 处理文本样式的函数
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* @description gen uploader
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
-
import Uppy from '@uppy/core';
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import type Uppy from '@uppy/core';
|
|
6
|
+
import type { IDomEditor } from '../editor/interface';
|
|
7
|
+
import type { IUploadAdapter, IUploadConfig, IUploader } from './interface';
|
|
8
|
+
type IUploadConfigWithAdapter = IUploadConfig & {
|
|
9
|
+
uploadAdapter: IUploadAdapter;
|
|
10
|
+
};
|
|
11
|
+
declare function createUploader<T extends IUploadConfig>(config: T, editor?: IDomEditor): T extends IUploadConfigWithAdapter ? IUploader : Uppy;
|
|
8
12
|
export default createUploader;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
5
|
import createUploader from './createUploader';
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
export
|
|
6
|
+
import createUppyUploader from './createUppyUploader';
|
|
7
|
+
import type { IUploadAdapter, IUploadAdapterContext, IUploadConfig, IUploader, IUploadFile, IUploadResultFile } from './interface';
|
|
8
|
+
export { createUploader, createUppyUploader };
|
|
9
|
+
export type { IUploadAdapter, IUploadAdapterContext, IUploadConfig, IUploader, IUploadFile, IUploadResultFile, };
|
|
@@ -2,30 +2,52 @@
|
|
|
2
2
|
* @description upload interface
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
-
import type { UppyFile } from '@uppy/core';
|
|
6
5
|
import type { IDomEditor } from '../editor/interface';
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export type IUploadHeaders = Record<string, string | number>;
|
|
7
|
+
export interface IUploadResultFile {
|
|
8
|
+
name: string;
|
|
9
|
+
type?: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface IUploadFile {
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
size: number;
|
|
17
|
+
data: Blob | File;
|
|
18
|
+
source?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface IUploader {
|
|
21
|
+
addFiles: (files: IUploadFile[]) => void;
|
|
22
|
+
upload: () => Promise<unknown>;
|
|
23
|
+
destroy?: () => void;
|
|
24
|
+
}
|
|
25
|
+
type FilesType = Record<string, any>;
|
|
10
26
|
type InsertFn = (src: string, poster?: string, alt?: string, href?: string) => void | Promise<void>;
|
|
27
|
+
export interface IUploadAdapterContext {
|
|
28
|
+
config: IUploadConfig;
|
|
29
|
+
editor?: IDomEditor;
|
|
30
|
+
}
|
|
31
|
+
export type IUploadAdapter = (context: IUploadAdapterContext) => IUploader;
|
|
11
32
|
interface IBaseUploadConfig {
|
|
12
33
|
fieldName?: string;
|
|
13
34
|
maxFileSize?: number;
|
|
14
35
|
maxNumberOfFiles?: number;
|
|
15
36
|
meta?: Record<string, unknown>;
|
|
16
37
|
metaWithUrl: boolean;
|
|
17
|
-
headers?:
|
|
38
|
+
headers?: IUploadHeaders | ((file: IUploadResultFile) => IUploadHeaders) | undefined;
|
|
18
39
|
withCredentials?: boolean;
|
|
19
40
|
timeout?: number;
|
|
20
41
|
onBeforeUpload?: (files: FilesType) => boolean | FilesType;
|
|
21
|
-
onSuccess: (file:
|
|
42
|
+
onSuccess: (file: IUploadResultFile, response: any) => void;
|
|
22
43
|
onProgress?: (progress: number) => void;
|
|
23
|
-
onFailed: (file:
|
|
24
|
-
onError: (file:
|
|
44
|
+
onFailed: (file: IUploadResultFile, response: any) => void;
|
|
45
|
+
onError: (file: IUploadResultFile, error: any, res: any) => void;
|
|
25
46
|
allowedFileTypes?: string[];
|
|
26
47
|
customInsert?: (res: any, insertFn: InsertFn) => void;
|
|
27
48
|
customUpload?: (files: File, insertFn: InsertFn, editor: IDomEditor) => void;
|
|
28
49
|
customBrowseAndUpload?: (insertFn: InsertFn) => void;
|
|
50
|
+
uploadAdapter?: IUploadAdapter;
|
|
29
51
|
uppyConfig?: Record<string, any>;
|
|
30
52
|
xhrConfig?: Record<string, any>;
|
|
31
53
|
}
|
|
@@ -33,12 +55,18 @@ interface IUploadConfigWithCustomUpload extends IBaseUploadConfig {
|
|
|
33
55
|
server?: string;
|
|
34
56
|
customUpload: (files: File, insertFn: InsertFn, editor: IDomEditor) => void;
|
|
35
57
|
}
|
|
58
|
+
interface IUploadConfigWithUploadAdapter extends IBaseUploadConfig {
|
|
59
|
+
server?: string;
|
|
60
|
+
uploadAdapter: IUploadAdapter;
|
|
61
|
+
customUpload?: (files: File, insertFn: InsertFn, editor: IDomEditor) => void;
|
|
62
|
+
}
|
|
36
63
|
interface IUploadConfigWithoutCustomUpload extends IBaseUploadConfig {
|
|
37
64
|
server: string;
|
|
38
65
|
customUpload?: never;
|
|
66
|
+
uploadAdapter?: never;
|
|
39
67
|
}
|
|
40
68
|
/**
|
|
41
69
|
* 配置参考 https://uppy.io/docs/uppy/
|
|
42
70
|
*/
|
|
43
|
-
export type IUploadConfig = IUploadConfigWithCustomUpload | IUploadConfigWithoutCustomUpload;
|
|
71
|
+
export type IUploadConfig = IUploadConfigWithCustomUpload | IUploadConfigWithUploadAdapter | IUploadConfigWithoutCustomUpload;
|
|
44
72
|
export {};
|
|
@@ -10,8 +10,8 @@ import './register-builtin-modules/index';
|
|
|
10
10
|
import './init-default-config';
|
|
11
11
|
import Boot from './Boot';
|
|
12
12
|
export { Boot };
|
|
13
|
-
export type { IButtonMenu, IDomEditor, IDropPanelMenu, IEditorConfig, IModalMenu, IModuleConf, ISelectMenu, IToolbarConfig, IUploadConfig, } from '@wangeditor-next/core';
|
|
14
|
-
export { createUploader, DomEditor, genModalButtonElems, genModalInputElems, genModalTextareaElems, i18nAddResources, i18nChangeLanguage, i18nGetResources, t, Toolbar, } from '@wangeditor-next/core';
|
|
13
|
+
export type { ClassStylePolicy, IButtonMenu, IClassStyleUnsupportedPayload, IDomEditor, IDropPanelMenu, IEditorConfig, IModalMenu, IModuleConf, ISelectMenu, IToolbarConfig, IUploadConfig, StyleClassTokenType, TextStyleMode, } from '@wangeditor-next/core';
|
|
14
|
+
export { createUploader, DomEditor, genModalButtonElems, genModalInputElems, genModalTextareaElems, getTextStyleMode, i18nAddResources, i18nChangeLanguage, i18nGetResources, t, Toolbar, } from '@wangeditor-next/core';
|
|
15
15
|
export type { Descendant as SlateDescendant, Location as SlateLocation, } from 'slate';
|
|
16
16
|
export { Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Path as SlatePath, Point as SlatePoint, Range as SlateRange, Text as SlateText, Transforms as SlateTransforms, } from 'slate';
|
|
17
17
|
export { createEditor, createToolbar } from './create';
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* @description to html
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Element } from 'slate';
|
|
6
|
-
declare function elemToHtml(elem: Element, childrenHtml: string): {
|
|
7
|
+
declare function elemToHtml(elem: Element, childrenHtml: string, editor?: IDomEditor): {
|
|
7
8
|
html: string;
|
|
8
9
|
prefix?: string;
|
|
9
10
|
suffix?: string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description list style class utils
|
|
3
|
+
*/
|
|
4
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
|
+
export declare function genListColorClassName(color: string): string;
|
|
6
|
+
export declare function resolveListColorAction(editor: IDomEditor | undefined, color: string): 'class' | 'preserve-data' | 'inline';
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* @description to html
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Element } from 'slate';
|
|
6
|
-
declare function tableToHtml(elemNode: Element, childrenHtml: string): string;
|
|
7
|
-
declare function tableRowToHtml(elem: Element, childrenHtml: string): string;
|
|
7
|
+
declare function tableToHtml(elemNode: Element, childrenHtml: string, editor?: IDomEditor): string;
|
|
8
|
+
declare function tableRowToHtml(elem: Element, childrenHtml: string, editor?: IDomEditor): string;
|
|
8
9
|
declare function tableCellToHtml(cellNode: Element, childrenHtml: string): string;
|
|
9
10
|
export declare const tableToHtmlConf: {
|
|
10
11
|
type: string;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* @description to html
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
|
+
import { IDomEditor } from '@wangeditor-next/core';
|
|
5
6
|
import { Element } from 'slate';
|
|
6
|
-
declare function videoToHtml(elemNode: Element, _childrenHtml?: string): string;
|
|
7
|
+
declare function videoToHtml(elemNode: Element, _childrenHtml?: string, editor?: IDomEditor): string;
|
|
7
8
|
export declare const videoToHtmlConf: {
|
|
8
9
|
type: string;
|
|
9
10
|
elemToHtml: typeof videoToHtml;
|
|
@@ -25,5 +25,5 @@ export declare function getTagName($elem: Dom7Array): string;
|
|
|
25
25
|
* @param height height
|
|
26
26
|
* @returns iframe html string with size style
|
|
27
27
|
*/
|
|
28
|
-
export declare function genSizeStyledIframeHtml(iframeHtml: string, width?: string, height?: string, style?: videoStyle): string;
|
|
28
|
+
export declare function genSizeStyledIframeHtml(iframeHtml: string, width?: string, height?: string, style?: videoStyle, classMode?: boolean): string;
|
|
29
29
|
export { DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangeditor-next/plugin-formula",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "wangEditor next formula 公式",
|
|
5
5
|
"author": "cycleccc <2991205548@qq.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@wangeditor-next-shared/rollup-config": "^0.0.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@wangeditor-next/editor": "5.
|
|
41
|
+
"@wangeditor-next/editor": "5.7.0",
|
|
42
42
|
"katex": "^0.16.0",
|
|
43
43
|
"snabbdom": "^3.6.0"
|
|
44
44
|
},
|