@wangeditor-next/editor 5.7.0 → 5.7.1
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/README.md +48 -0
- package/dist/core/src/config/interface.d.ts +1 -1
- package/dist/core/src/editor/dom-editor.d.ts +9 -0
- package/dist/core/src/index.d.ts +11 -1
- package/dist/core/src/upload.d.ts +5 -0
- package/dist/core.js +13 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +13 -0
- package/dist/core.mjs.map +1 -0
- package/dist/editor/src/core.d.ts +54 -0
- package/dist/editor/src/index.d.ts +3 -2
- package/dist/editor/src/upload.d.ts +6 -0
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/upload.js +13 -0
- package/dist/upload.js.map +1 -0
- package/dist/upload.mjs +13 -0
- package/dist/upload.mjs.map +1 -0
- package/package.json +18 -8
package/README.md
CHANGED
|
@@ -9,5 +9,53 @@
|
|
|
9
9
|
|
|
10
10
|

|
|
11
11
|
|
|
12
|
+
## 体积优化(按需模块)
|
|
13
|
+
|
|
14
|
+
默认入口 `@wangeditor-next/editor` 会自动注册全部内置模块(表格、上传、代码高亮等)。
|
|
15
|
+
如果业务只用到部分能力,建议使用同包轻量入口 `@wangeditor-next/editor/core`。
|
|
16
|
+
该入口不会自动注册内置模块,且不包含上传运行时代码;如需二次开发上传能力,可从
|
|
17
|
+
`@wangeditor-next/editor/upload`
|
|
18
|
+
引入 `createUploader`。
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { createEditorFactory } from '@wangeditor-next/editor/core'
|
|
22
|
+
import basicModules from '@wangeditor-next/basic-modules'
|
|
23
|
+
import wangEditorListModule from '@wangeditor-next/list-module'
|
|
24
|
+
|
|
25
|
+
const factory = createEditorFactory({
|
|
26
|
+
// tiptap-like:按 extensions 组合功能
|
|
27
|
+
extensions: [...basicModules, wangEditorListModule],
|
|
28
|
+
toolbarConfig: {
|
|
29
|
+
toolbarKeys: [
|
|
30
|
+
'headerSelect',
|
|
31
|
+
'bold',
|
|
32
|
+
'italic',
|
|
33
|
+
'|',
|
|
34
|
+
'bulletedList',
|
|
35
|
+
'numberedList',
|
|
36
|
+
'|',
|
|
37
|
+
'undo',
|
|
38
|
+
'redo',
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const { editor, toolbar } = factory.create({
|
|
44
|
+
editor: {
|
|
45
|
+
selector: '#editor',
|
|
46
|
+
config: {
|
|
47
|
+
hoverbarKeys: {},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
toolbar: {
|
|
51
|
+
selector: '#toolbar',
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { createUploader } from '@wangeditor-next/editor/upload'
|
|
58
|
+
```
|
|
59
|
+
|
|
12
60
|
交流
|
|
13
61
|
- [提交问题和建议](https://github.com/wangeditor-next/wangEditor-next/issues)
|
|
@@ -7,7 +7,7 @@ import type { VideoElement } from 'packages/video-module/src/module/custom-types
|
|
|
7
7
|
import type { Descendant, Node, NodeEntry, Range } from 'slate';
|
|
8
8
|
import type { IDomEditor } from '../editor/interface';
|
|
9
9
|
import type { IMenuGroup } from '../menus/interface';
|
|
10
|
-
import type { IUploadConfig } from '../upload';
|
|
10
|
+
import type { IUploadConfig } from '../upload/interface';
|
|
11
11
|
import type { DOMElement } from '../utils/dom';
|
|
12
12
|
interface IHoverbarConf {
|
|
13
13
|
[key: string]: {
|
|
@@ -54,6 +54,15 @@ export declare const DomEditor: {
|
|
|
54
54
|
* Find the native DOM element from a Slate node or editor.
|
|
55
55
|
*/
|
|
56
56
|
toDOMNode(editor: IDomEditor, node: Node): HTMLElement;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a Slate node currently has a mapped DOM node.
|
|
59
|
+
* During IME/composition transitions the Slate tree can update before DOM patching finishes.
|
|
60
|
+
*/
|
|
61
|
+
hasDOMNodeBySlateNode(editor: IDomEditor, node: Node): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Check if both range endpoints can be resolved to DOM nodes right now.
|
|
64
|
+
*/
|
|
65
|
+
canResolveDOMRange(editor: IDomEditor, range: Range): boolean;
|
|
57
66
|
/**
|
|
58
67
|
* Check if a DOM node is within the editor.
|
|
59
68
|
*/
|
package/dist/core/src/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import type { IRegisterMenuConf } from './menus/index';
|
|
|
8
8
|
import type { IParseElemHtmlConf, IPreParseHtmlConf, ParseStyleHtmlFnType } from './parse-html/index';
|
|
9
9
|
import type { IRenderElemConf, RenderStyleFnType } from './render/index';
|
|
10
10
|
import type { IElemToHtmlConf, styleToHtmlFnType } from './to-html/index';
|
|
11
|
+
import createUploaderRuntime from './upload/createUploader';
|
|
12
|
+
import type { IUploadConfig } from './upload/interface';
|
|
11
13
|
export * from './create/index';
|
|
12
14
|
export type { ClassStylePolicy, IClassStyleUnsupportedPayload, IEditorConfig, IToolbarConfig, IUploadImageConfig, IUploadVideoConfig, StyleClassTokenType, TextStyleMode, } from './config/interface';
|
|
13
15
|
export * from './config/style-mode';
|
|
@@ -17,7 +19,15 @@ export * from './render/index';
|
|
|
17
19
|
export * from './to-html/index';
|
|
18
20
|
export * from './parse-html/index';
|
|
19
21
|
export * from './menus/index';
|
|
20
|
-
export
|
|
22
|
+
export type { IUploadAdapter, IUploadAdapterContext, IUploadConfig, IUploader, IUploadFile, IUploadResultFile, } from './upload/interface';
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Please import from `@wangeditor-next/core/upload`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const createUploader: typeof createUploaderRuntime;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Please import from `@wangeditor-next/core/upload`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createUppyUploader(config: IUploadConfig): import("./upload/interface").IUploader;
|
|
21
31
|
export * from './i18n/index';
|
|
22
32
|
export * from './utils/dom';
|
|
23
33
|
export interface IModuleConf {
|