@wangeditor-next/plugin-mention 6.4.1 → 6.4.2
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/image/menu/WidthBase.d.ts +1 -0
- package/dist/basic-modules/src/modules/image/resize.d.ts +14 -0
- package/dist/basic-modules/src/modules/link/parse-elem-html.d.ts +2 -1
- package/dist/core/src/config/interface.d.ts +22 -0
- package/dist/core/src/index.d.ts +1 -1
- package/dist/editor/src/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -7,6 +7,7 @@ declare abstract class ImageWidthBaseClass implements IButtonMenu {
|
|
|
7
7
|
abstract readonly title: string;
|
|
8
8
|
readonly tag = "button";
|
|
9
9
|
abstract readonly value: string;
|
|
10
|
+
getTitle(editor: IDomEditor): string;
|
|
10
11
|
getValue(_editor: IDomEditor): string | boolean;
|
|
11
12
|
isActive(_editor: IDomEditor): boolean;
|
|
12
13
|
private getSelectedNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description shared image resize policy
|
|
3
|
+
*/
|
|
4
|
+
import { IDomEditor, IImageResizeOption, ImageResizeSource, ImageResizeUnit } from '@wangeditor-next/core';
|
|
5
|
+
import { Node } from 'slate';
|
|
6
|
+
export interface IImageResizeResult {
|
|
7
|
+
width: string;
|
|
8
|
+
height: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function getImageResizePreset(editor: IDomEditor, defaultValue: string): IImageResizeOption;
|
|
11
|
+
/** Normalize a user value, returning null when it violates a configured unit. */
|
|
12
|
+
export declare function normalizeImageSize(value: string, unit?: ImageResizeUnit, source?: ImageResizeSource): string | null;
|
|
13
|
+
export declare function validateImageSize(editor: IDomEditor, rawWidth: string, rawHeight: string, source: ImageResizeSource): IImageResizeResult | null;
|
|
14
|
+
export declare function updateImageSize(editor: IDomEditor, imageNode: Node, rawWidth: string, rawHeight: string, source: ImageResizeSource): boolean;
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import { IDomEditor } from '@wangeditor-next/core';
|
|
6
6
|
import { Descendant } from 'slate';
|
|
7
7
|
import { DOMElement } from '../../utils/dom';
|
|
8
|
+
import { ImageElement } from '../image/custom-types';
|
|
8
9
|
import { LinkElement } from './custom-types';
|
|
9
|
-
declare function parseHtml(elem: DOMElement, children: Descendant[], editor: IDomEditor): LinkElement;
|
|
10
|
+
declare function parseHtml(elem: DOMElement, children: Descendant[], editor: IDomEditor): LinkElement | ImageElement;
|
|
10
11
|
export declare const parseHtmlConf: {
|
|
11
12
|
selector: string;
|
|
12
13
|
parseElemHtml: typeof parseHtml;
|
|
@@ -112,6 +112,27 @@ interface IInsertImageConfig extends IImageMenuBaseConfig {
|
|
|
112
112
|
interface IEditImageConfig extends IImageMenuBaseConfig {
|
|
113
113
|
onUpdatedImage?: (imageNode: ImageElement | null) => void;
|
|
114
114
|
}
|
|
115
|
+
export type ImageResizeUnit = 'px' | '%';
|
|
116
|
+
export type ImageResizeSource = 'modal' | 'preset' | 'drag';
|
|
117
|
+
export interface IImageResizeCheckPayload {
|
|
118
|
+
width: string;
|
|
119
|
+
height: string;
|
|
120
|
+
rawWidth: string;
|
|
121
|
+
rawHeight: string;
|
|
122
|
+
source: ImageResizeSource;
|
|
123
|
+
}
|
|
124
|
+
export interface IImageResizeOption {
|
|
125
|
+
label: string;
|
|
126
|
+
value: string;
|
|
127
|
+
}
|
|
128
|
+
export interface IImageResizeConfig {
|
|
129
|
+
/** Resize unit for editor-owned image resize actions. Omit to preserve legacy behavior. */
|
|
130
|
+
resizeUnit?: ImageResizeUnit;
|
|
131
|
+
/** Values for the built-in 30%/50%/100% preset buttons, in their existing order. */
|
|
132
|
+
resizeOptions?: IImageResizeOption[];
|
|
133
|
+
/** Validate normalized image dimensions before they are written to the document. */
|
|
134
|
+
checkImageSize?: (payload: IImageResizeCheckPayload) => boolean | undefined | string;
|
|
135
|
+
}
|
|
115
136
|
interface IEmotionConfig {
|
|
116
137
|
emotions: string[];
|
|
117
138
|
}
|
|
@@ -281,6 +302,7 @@ export interface IEditorConfig {
|
|
|
281
302
|
autoFocus: boolean;
|
|
282
303
|
decorate?: (nodeEntry: NodeEntry) => Range[];
|
|
283
304
|
maxLength?: number;
|
|
305
|
+
imageResize?: IImageResizeConfig;
|
|
284
306
|
MENU_CONF?: IMenuConfigUpdate;
|
|
285
307
|
hoverbarKeys?: IHoverbarConf;
|
|
286
308
|
EXTEND_CONF?: any;
|
package/dist/core/src/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { HtmlTransformFnType, IElemToHtmlConf, styleToHtmlFnType } from './
|
|
|
11
11
|
import createUploaderRuntime from './upload/createUploader';
|
|
12
12
|
import type { IUploadConfig } from './upload/interface';
|
|
13
13
|
export * from './create/index';
|
|
14
|
-
export type { ClassStylePolicy, IClassStyleUnsupportedPayload, IEditorConfig, ISingleMenuConfig, IToolbarConfig, IUploadImageConfig, IUploadVideoConfig, StyleClassTokenType, TextStyleMode, } from './config/interface';
|
|
14
|
+
export type { ClassStylePolicy, IClassStyleUnsupportedPayload, IEditorConfig, IImageResizeCheckPayload, IImageResizeConfig, IImageResizeOption, ImageResizeSource, ImageResizeUnit, ISingleMenuConfig, IToolbarConfig, IUploadImageConfig, IUploadVideoConfig, StyleClassTokenType, TextStyleMode, } from './config/interface';
|
|
15
15
|
export { EditorEvents } from './config/interface';
|
|
16
16
|
export * from './config/style-mode';
|
|
17
17
|
export * from './editor/dom-editor';
|
|
@@ -17,7 +17,7 @@ import './register-builtin-modules/index';
|
|
|
17
17
|
import './init-default-config';
|
|
18
18
|
import Boot from './Boot';
|
|
19
19
|
export { Boot };
|
|
20
|
-
export type { ClassStylePolicy, IButtonMenu, IClassStyleUnsupportedPayload, IDomEditor, IDropPanelMenu, IEditorConfig, IModalMenu, IModuleConf, IOption, ISelectMenu, IToolbarConfig, IUploadConfig, StyleClassTokenType, TextStyleMode, } from '@wangeditor-next/core';
|
|
20
|
+
export type { ClassStylePolicy, IButtonMenu, IClassStyleUnsupportedPayload, IDomEditor, IDropPanelMenu, IEditorConfig, IImageResizeCheckPayload, IImageResizeConfig, IImageResizeOption, ImageResizeSource, ImageResizeUnit, IModalMenu, IModuleConf, IOption, ISelectMenu, IToolbarConfig, IUploadConfig, StyleClassTokenType, TextStyleMode, } from '@wangeditor-next/core';
|
|
21
21
|
export { DomEditor, genModalButtonElems, genModalInputElems, genModalTextareaElems, getClassStylePolicy, getTextStyleMode, i18nAddResources, i18nChangeLanguage, i18nGetResources, reportUnsupportedClassStyle, t, Toolbar, } from '@wangeditor-next/core';
|
|
22
22
|
export { createUploader } from '@wangeditor-next/core/upload';
|
|
23
23
|
export type { Descendant as SlateDescendant, Location as SlateLocation, } from 'slate';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangeditor-next/plugin-mention",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.2",
|
|
4
4
|
"description": "wangEditor mention plugin",
|
|
5
5
|
"author": "cycleccc <2991205548@qq.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"snabbdom": "^3.6.0",
|
|
37
|
-
"@wangeditor-next/editor": "^6.4.
|
|
37
|
+
"@wangeditor-next/editor": "^6.4.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@wangeditor-next-shared/rollup-config": "^0.0.2"
|