@wangeditor-next/plugin-float-image 6.1.1 → 6.2.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/constants/icon-svg.d.ts +2 -0
- package/dist/basic-modules/src/locale/en.d.ts +2 -0
- package/dist/basic-modules/src/locale/zh-CN.d.ts +2 -0
- package/dist/basic-modules/src/modules/text-style/custom-types.d.ts +2 -0
- package/dist/basic-modules/src/modules/text-style/menu/EmphasisDotMenu.d.ts +11 -0
- package/dist/basic-modules/src/modules/text-style/menu/WavyUnderlineMenu.d.ts +11 -0
- package/dist/basic-modules/src/modules/text-style/menu/index.d.ts +10 -0
- package/dist/basic-modules/src/modules/text-style/render-style.d.ts +2 -1
- package/dist/basic-modules/src/modules/text-style/style-constants.d.ts +35 -0
- package/dist/basic-modules/src/modules/text-style/style-to-html.d.ts +2 -1
- package/dist/basic-modules/src/utils/dom.d.ts +1 -1
- package/dist/code-highlight/src/utils/dom.d.ts +1 -1
- package/dist/core/src/config/interface.d.ts +2 -0
- package/dist/core/src/utils/dom.d.ts +1 -1
- package/dist/editor/src/index.d.ts +7 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-float-image/src/utils/dom.d.ts +1 -1
- package/dist/table-module/src/utils/dom.d.ts +1 -1
- package/dist/table-module/src/utils/options.d.ts +3 -12
- package/dist/upload-image-module/src/utils/dom.d.ts +1 -1
- package/dist/video-module/src/utils/dom.d.ts +1 -1
- package/package.json +2 -2
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const BOLD_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M707.872 484.64A254.88 254.88 0 0 0 768 320c0-141.152-114.848-256-256-256H192v896h384c141.152 0 256-114.848 256-256a256.096 256.096 0 0 0-124.128-219.36zM384 192h101.504c55.968 0 101.504 57.408 101.504 128s-45.536 128-101.504 128H384V192z m159.008 640H384v-256h159.008c58.464 0 106.016 57.408 106.016 128s-47.552 128-106.016 128z\"></path></svg>";
|
|
11
11
|
export declare const UNDER_LINE_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M704 64l128 0 0 416c0 159.072-143.264 288-320 288s-320-128.928-320-288l0-416 128 0 0 416c0 40.16 18.24 78.688 51.36 108.512 36.896 33.216 86.848 51.488 140.64 51.488s103.744-18.304 140.64-51.488c33.12-29.792 51.36-68.352 51.36-108.512l0-416zM192 832l640 0 0 128-640 0z\"></path></svg>";
|
|
12
|
+
export declare const WAVY_UNDERLINE_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M64 704c64-96 128-96 192 0s128 96 192 0 128-96 192 0 128 96 192 0 128-96 192 0v128c-64 96-128 96-192 0s-128-96-192 0-128 96-192 0-128-96-192 0-128 96-192 0V704z\"></path></svg>";
|
|
13
|
+
export declare const EMPHASIS_DOT_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M256 128h128v512H256zM448 128h128v512H448zM640 128h128v512H640z\"></path><path d=\"M320 832m-64 0a64 64 0 1 0 128 0 64 64 0 0 0-128 0zM512 832m-64 0a64 64 0 1 0 128 0 64 64 0 0 0-128 0zM704 832m-64 0a64 64 0 1 0 128 0 64 64 0 0 0-128 0z\"></path></svg>";
|
|
12
14
|
export declare const ITALIC_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M896 64v64h-128L448 896h128v64H128v-64h128L576 128h-128V64z\"></path></svg>";
|
|
13
15
|
export declare const THROUGH_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M1024 512v64h-234.496c27.52 38.496 42.496 82.688 42.496 128 0 70.88-36.672 139.04-100.576 186.976C672.064 935.488 594.144 960 512 960s-160.064-24.512-219.424-69.024C228.64 843.04 192 774.88 192 704h128c0 69.376 87.936 128 192 128s192-58.624 192-128-87.936-128-192-128H0v-64h299.52a385.984 385.984 0 0 1-6.944-5.024C228.64 459.04 192 390.88 192 320s36.672-139.04 100.576-186.976C351.936 88.512 429.856 64 512 64s160.064 24.512 219.424 69.024C795.328 180.96 832 249.12 832 320h-128c0-69.376-87.936-128-192-128s-192 58.624-192 128 87.936 128 192 128c78.976 0 154.048 22.688 212.48 64H1024z\"></path></svg>";
|
|
14
16
|
export declare const CODE_SVG = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M576 736l96 96 320-320L672 192l-96 96 224 224zM448 288l-96-96L32 512l320 320 96-96-224-224z\"></path></svg>";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description lower dot emphasis menu
|
|
3
|
+
*/
|
|
4
|
+
import BaseMenu from './BaseMenu';
|
|
5
|
+
declare class EmphasisDotMenu extends BaseMenu {
|
|
6
|
+
readonly mark = "emphasisDot";
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly iconSvg = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M256 128h128v512H256zM448 128h128v512H448zM640 128h128v512H640z\"></path><path d=\"M320 832m-64 0a64 64 0 1 0 128 0 64 64 0 0 0-128 0zM512 832m-64 0a64 64 0 1 0 128 0 64 64 0 0 0-128 0zM704 832m-64 0a64 64 0 1 0 128 0 64 64 0 0 0-128 0z\"></path></svg>";
|
|
9
|
+
readonly hotkey = "";
|
|
10
|
+
}
|
|
11
|
+
export default EmphasisDotMenu;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description wavy underline menu
|
|
3
|
+
*/
|
|
4
|
+
import BaseMenu from './BaseMenu';
|
|
5
|
+
declare class WavyUnderlineMenu extends BaseMenu {
|
|
6
|
+
readonly mark = "wavyUnderline";
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly iconSvg = "<svg viewBox=\"0 0 1024 1024\"><path d=\"M64 704c64-96 128-96 192 0s128 96 192 0 128-96 192 0 128 96 192 0 128-96 192 0v128c-64 96-128 96-192 0s-128-96-192 0-128 96-192 0-128-96-192 0-128 96-192 0V704z\"></path></svg>";
|
|
9
|
+
readonly hotkey = "";
|
|
10
|
+
}
|
|
11
|
+
export default WavyUnderlineMenu;
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
import BoldMenu from './BoldMenu';
|
|
6
6
|
import ClearStyleMenu from './ClearStyleMenu';
|
|
7
7
|
import CodeMenu from './CodeMenu';
|
|
8
|
+
import EmphasisDotMenu from './EmphasisDotMenu';
|
|
8
9
|
import ItalicMenu from './ItalicMenu';
|
|
9
10
|
import SubMenu from './SubMenu';
|
|
10
11
|
import SupMenu from './SupMenu';
|
|
11
12
|
import ThroughMenu from './ThroughMenu';
|
|
12
13
|
import UnderlineMenu from './UnderlineMenu';
|
|
14
|
+
import WavyUnderlineMenu from './WavyUnderlineMenu';
|
|
13
15
|
export declare const boldMenuConf: {
|
|
14
16
|
key: string;
|
|
15
17
|
factory(): BoldMenu;
|
|
@@ -30,6 +32,14 @@ export declare const underlineMenuConf: {
|
|
|
30
32
|
key: string;
|
|
31
33
|
factory(): UnderlineMenu;
|
|
32
34
|
};
|
|
35
|
+
export declare const wavyUnderlineMenuConf: {
|
|
36
|
+
key: string;
|
|
37
|
+
factory(): WavyUnderlineMenu;
|
|
38
|
+
};
|
|
39
|
+
export declare const emphasisDotMenuConf: {
|
|
40
|
+
key: string;
|
|
41
|
+
factory(): EmphasisDotMenu;
|
|
42
|
+
};
|
|
33
43
|
export declare const supMenuConf: {
|
|
34
44
|
key: string;
|
|
35
45
|
factory(): SupMenu;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @description render text 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
|
/**
|
|
@@ -10,4 +11,4 @@ import { VNode } from 'snabbdom';
|
|
|
10
11
|
* @param vnode vnode
|
|
11
12
|
* @returns vnode
|
|
12
13
|
*/
|
|
13
|
-
export declare function renderStyle(node: Descendant, vnode: VNode): VNode;
|
|
14
|
+
export declare function renderStyle(node: Descendant, vnode: VNode, editor?: IDomEditor): VNode;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description CSS values shared by text-style render and HTML serialization
|
|
3
|
+
*/
|
|
4
|
+
export declare const UNDERLINE_OFFSET = "0.15em";
|
|
5
|
+
export declare const WAVY_UNDERLINE_OFFSET = "0.3em";
|
|
6
|
+
export declare const WAVY_UNDERLINE_WITH_EMPHASIS_OFFSET = "0.8em";
|
|
7
|
+
export declare const EMPHASIS_DOT_WITH_WAVY_LINE_HEIGHT = "2";
|
|
8
|
+
export declare const UNDERLINE_OFFSET_CLASS = "w-e-text-style-underline-offset";
|
|
9
|
+
export declare const WAVY_UNDERLINE_CLASS = "w-e-text-style-wavy-underline";
|
|
10
|
+
export declare const WAVY_UNDERLINE_WITH_EMPHASIS_CLASS = "w-e-text-style-wavy-underline-with-emphasis";
|
|
11
|
+
export declare const EMPHASIS_DOT_CLASS = "w-e-text-style-emphasis-dot";
|
|
12
|
+
export declare const EMPHASIS_DOT_WITH_WAVY_CLASS = "w-e-text-style-emphasis-dot-with-wavy";
|
|
13
|
+
export declare const WAVY_UNDERLINE_STYLE: {
|
|
14
|
+
textDecorationLine: string;
|
|
15
|
+
textDecorationStyle: string;
|
|
16
|
+
textUnderlineOffset: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const WAVY_UNDERLINE_STYLE_HTML = "text-decoration-line: underline; text-decoration-style: wavy; text-underline-offset: 0.3em;";
|
|
19
|
+
export declare const WAVY_UNDERLINE_WITH_EMPHASIS_STYLE: {
|
|
20
|
+
textUnderlineOffset: string;
|
|
21
|
+
textDecorationLine: string;
|
|
22
|
+
textDecorationStyle: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const WAVY_UNDERLINE_WITH_EMPHASIS_STYLE_HTML = "text-decoration-line: underline; text-decoration-style: wavy; text-underline-offset: 0.8em;";
|
|
25
|
+
export declare const EMPHASIS_DOT_STYLE: {
|
|
26
|
+
textEmphasisStyle: string;
|
|
27
|
+
textEmphasisPosition: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const EMPHASIS_DOT_STYLE_HTML = "text-emphasis-style: filled dot; text-emphasis-position: under left;";
|
|
30
|
+
export declare const EMPHASIS_DOT_WITH_WAVY_STYLE: {
|
|
31
|
+
lineHeight: string;
|
|
32
|
+
textEmphasisStyle: string;
|
|
33
|
+
textEmphasisPosition: string;
|
|
34
|
+
};
|
|
35
|
+
export declare const EMPHASIS_DOT_WITH_WAVY_STYLE_HTML = "text-emphasis-style: filled dot; text-emphasis-position: under left; line-height: 2;";
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @description text 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
|
|
@@ -9,4 +10,4 @@ import { Descendant } from 'slate';
|
|
|
9
10
|
* @param textHtml text html
|
|
10
11
|
* @returns styled html
|
|
11
12
|
*/
|
|
12
|
-
export declare function styleToHtml(textNode: Descendant, textHtml: string): string;
|
|
13
|
+
export declare function styleToHtml(textNode: Descendant, textHtml: string, editor?: IDomEditor): string;
|
|
@@ -10,7 +10,7 @@ import DOMText = globalThis.Text;
|
|
|
10
10
|
import DOMRange = globalThis.Range;
|
|
11
11
|
import DOMSelection = globalThis.Selection;
|
|
12
12
|
import DOMStaticRange = globalThis.StaticRange;
|
|
13
|
-
export { Dom7Array } from 'dom7';
|
|
13
|
+
export type { Dom7Array } from 'dom7';
|
|
14
14
|
export default $;
|
|
15
15
|
/**
|
|
16
16
|
* 判断 str 是不是纯字符串,而不是 html tag
|
|
@@ -10,6 +10,6 @@ import DOMText = globalThis.Text;
|
|
|
10
10
|
import DOMRange = globalThis.Range;
|
|
11
11
|
import DOMSelection = globalThis.Selection;
|
|
12
12
|
import DOMStaticRange = globalThis.StaticRange;
|
|
13
|
-
export { Dom7Array } from 'dom7';
|
|
13
|
+
export type { Dom7Array } from 'dom7';
|
|
14
14
|
export default $;
|
|
15
15
|
export { DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText, };
|
|
@@ -155,6 +155,8 @@ interface ICodeBlockConfig {
|
|
|
155
155
|
export interface IMenuConfig {
|
|
156
156
|
bold: ISingleMenuConfig;
|
|
157
157
|
underline: ISingleMenuConfig;
|
|
158
|
+
wavyUnderline: ISingleMenuConfig;
|
|
159
|
+
emphasisDot: ISingleMenuConfig;
|
|
158
160
|
italic: ISingleMenuConfig;
|
|
159
161
|
through: ISingleMenuConfig;
|
|
160
162
|
code: ISingleMenuConfig;
|
|
@@ -10,7 +10,7 @@ import DOMText = globalThis.Text;
|
|
|
10
10
|
import DOMRange = globalThis.Range;
|
|
11
11
|
import DOMSelection = globalThis.Selection;
|
|
12
12
|
import DOMStaticRange = globalThis.StaticRange;
|
|
13
|
-
export { Dom7Array } from 'dom7';
|
|
13
|
+
export type { Dom7Array } from 'dom7';
|
|
14
14
|
export default $;
|
|
15
15
|
export declare enum NodeType {
|
|
16
16
|
ELEMENT_NODE = 1,
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* @author wangfupeng
|
|
4
4
|
*/
|
|
5
5
|
import './assets/index.less';
|
|
6
|
+
import '@wangeditor-next/core/dist/css/style.css';
|
|
7
|
+
import '@wangeditor-next/basic-modules/dist/css/style.css';
|
|
8
|
+
import '@wangeditor-next/code-highlight/dist/css/style.css';
|
|
9
|
+
import '@wangeditor-next/list-module/dist/css/style.css';
|
|
10
|
+
import '@wangeditor-next/table-module/dist/css/style.css';
|
|
11
|
+
import '@wangeditor-next/upload-image-module/dist/css/style.css';
|
|
12
|
+
import '@wangeditor-next/video-module/dist/css/style.css';
|
|
6
13
|
import './utils/browser-polyfill';
|
|
7
14
|
import './utils/node-polyfill';
|
|
8
15
|
import './locale/index';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@wangeditor-next/editor"),require("dom7"),require("snabbdom")):"function"==typeof define&&define.amd?define(["@wangeditor-next/editor","dom7","snabbdom"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).WangEditorFloatImagePlugin=e(t.editor,t.$,t.snabbdom)}(this,function(t,e,n){"use strict";t.i18nAddResources("en",{float:{none:"Default",left:"Float Left",right:"Float Right"}}),t.i18nAddResources("zh-CN",{float:{none:"默认",left:"左浮动",right:"右浮动"}});var o={type:"image",elemToHtml:function(e,n,o){var r=e,a=r.src,i=r.alt,l=void 0===i?"":i,f=r.href,c=void 0===f?"":f,s=r.style,d=void 0===s?{}:s,u=d.width,h=void 0===u?"":u,p=d.height,g=void 0===p?"":p,v=d.float,m=void 0===v?"":v;if("class"===t.getTextStyleMode(o)){var y=h?' data-w-e-style-width="'.concat(h,'"'):"",w=g?' data-w-e-style-height="'.concat(g,'"'):"",b=m?' data-w-e-style-float="'.concat(m,'"'):"",q=function(t){var e=(t||"").trim().toLowerCase();return"left"===e?"w-e-float-image-left":"right"===e?"w-e-float-image-right":"none"===e?"w-e-float-image-none":""}(m),x=q?' class="'.concat(q,'"'):"";return'<img src="'.concat(a,'" alt="').concat(l,'" data-href="').concat(c,'" width="').concat(h,'" height="').concat(g,'"').concat(x).concat(y).concat(w).concat(b,"/>")}var j="";return h&&(j+="width: ".concat(h,";")),g&&(j+="height: ".concat(g,";")),m&&(j+="float: ".concat(m,";")),'<img src="'.concat(a,'" alt="').concat(l,'" data-href="').concat(c,'" style="').concat(j,'"/>')}},r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function f(t,e,n){if(n||2===arguments.length)for(var o,r=0,a=e.length;r<a;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var c=function(){function e(){this.tag="button"}return e.prototype.getValue=function(t){return""},e.prototype.isActive=function(t){return!1},e.prototype.getSelectedNode=function(e){return t.DomEditor.getSelectedNodeByType(e,"image")},e.prototype.isDisabled=function(t){return null==t.selection||null==this.getSelectedNode(t)},e.prototype.exec=function(e,n){if(!this.isDisabled(e)){var o=this.getSelectedNode(e);if(null!=o){var r=t.DomEditor.getHoverbar(e);r&&r.hideAndClean();var a=o.style,l={style:i(i({},void 0===a?{}:a),{float:this.value})};t.SlateTransforms.setNodes(e,l,{match:function(e){return t.DomEditor.checkNodeType(e,"image")}})}}},e}(),s=function(e){function n(){var n=e.apply(this,f([],l(arguments),!1))||this;return n.title=t.t("float.left"),n.value="left",n.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z"></path><path d="M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z"></path><path d="M89.46270815 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.42756742 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756742 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.4275674-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.4275674-12.42756741z"></path><path d="M512 552.8045037m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756742l0 68.35162073q0 12.42756741-12.4275674 12.42756741l-410.10972444 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162073q0-12.42756741 12.42756741-12.42756742Z"></path><path d="M512 366.39099259m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756741l0 68.35162075q0 12.42756741-12.4275674 12.4275674l-410.10972444 0q-12.42756741 0-12.42756741-12.4275674l0-68.35162075q0-12.42756741 12.42756741-12.42756741Z"></path></svg>',n}return a(n,e),n}(c),d=function(e){function n(){var n=e.apply(this,f([],l(arguments),!1))||this;return n.title=t.t("float.none"),n.value="none",n.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M76.73805432 117.83964445m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.4275674l0 68.35162074q0 12.42756741-12.42756741 12.42756741l-845.0745837 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162074q0-12.42756741 12.42756741-12.4275674Z"></path><path d="M76.73805432 801.35585185m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.42756741l0 68.35162074q0 12.42756741-12.42756741 12.42756742l-845.0745837 0q-12.42756741 0-12.42756741-12.42756742l0-68.35162074q0-12.42756741 12.42756741-12.42756741Z"></path><path d="M89.16562173 304.25315556h410.10972444c6.83516208 0 12.42756741 5.59240533 12.42756741 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756741 12.4275674h-410.10972444a12.42756741 12.42756741 0 0 1-12.42756741-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756741-12.42756741z"></path></svg>',n}return a(n,e),n}(c),u=function(e){function n(){var n=e.apply(this,f([],l(arguments),!1))||this;return n.title=t.t("float.right"),n.value="right",n.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z"></path><path d="M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z"></path><path d="M586.56540445 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.4275674 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.4275674 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.42756742-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756742-12.42756741z"></path><path d="M77.03514075 552.8045037m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756742l0 68.35162073q0 12.42756741-12.42756741 12.42756741l-410.10972444 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162073q0-12.42756741 12.4275674-12.42756742Z"></path><path d="M77.03514075 366.39099259m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756741l0 68.35162075q0 12.42756741-12.42756741 12.4275674l-410.10972444 0q-12.42756741 0-12.4275674-12.4275674l0-68.35162075q0-12.42756741 12.4275674-12.42756741Z"></path></svg>',n}return a(n,e),n}(c),h={key:"imageFloatNone",factory:function(){return new d}},p={key:"imageFloatLeft",factory:function(){return new s}},g={key:"imageFloatRight",factory:function(){return new u}};function v(t,e){for(var n="",o=(t.attr("style")||"").split(";"),r=o.length,a=0;a<r;a+=1){var i=o[a];if(i){var l=i.split(":");l[0].trim()===e&&(n=l[1].trim())}}return n}e.css&&(e.fn.css=e.css),e.append&&(e.fn.append=e.append),e.prepend&&(e.fn.prepend=e.prepend),e.addClass&&(e.fn.addClass=e.addClass),e.removeClass&&(e.fn.removeClass=e.removeClass),e.hasClass&&(e.fn.hasClass=e.hasClass),e.on&&(e.fn.on=e.on),e.off&&(e.fn.off=e.off),e.focus&&(e.fn.focus=e.focus),e.attr&&(e.fn.attr=e.attr),e.removeAttr&&(e.fn.removeAttr=e.removeAttr),e.hide&&(e.fn.hide=e.hide),e.show&&(e.fn.show=e.show),e.parents&&(e.fn.parents=e.parents),e.dataset&&(e.fn.dataset=e.dataset),e.val&&(e.fn.val=e.val),e.text&&(e.fn.text=e.text),e.html&&(e.fn.html=e.html),e.children&&(e.fn.children=e.children),e.remove&&(e.fn.remove=e.remove),e.find&&(e.fn.find=e.find),e.width&&(e.fn.width=e.width),e.height&&(e.fn.height=e.height),e.filter&&(e.fn.filter=e.filter),e.empty&&(e.fn.empty=e.empty);var m,y,w={selector:"img:not([data-w-e-type])",parseElemHtml:function(t,n,o){var r=e(t),a=r.attr("data-href")||"",i=r.attr("width")||"",l=r.attr("height")||"",f=v(r,"width")||r.attr("data-w-e-style-width")||i,c=v(r,"height")||r.attr("data-w-e-style-height")||l,s=function(t){var e=v(t,"float");if(e)return e;var n=(t.attr("data-w-e-style-float")||"").trim();if(n)return n;var o=(t.attr("class")||"").trim().split(/\s+/).filter(Boolean);return o.includes("w-e-float-image-left")?"left":o.includes("w-e-float-image-right")?"right":o.includes("w-e-float-image-none")?"none":""}(r);return a=decodeURIComponent(a),{type:"image",src:r.attr("src")||"",alt:r.attr("alt")||"",href:a,style:{width:f,height:c,float:s},width:i,height:l,children:[{text:""}]}}},b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function q(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var x=function(){if(y)return m;y=1;var t="Expected a function",e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,r=/^0o[0-7]+$/i,a=parseInt,i="object"==typeof b&&b&&b.Object===Object&&b,l="object"==typeof self&&self&&self.Object===Object&&self,f=i||l||Function("return this")(),c=Object.prototype.toString,s=Math.max,d=Math.min,u=function(){return f.Date.now()};function h(e,n,o){var r,a,i,l,f,c,h=0,v=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError(t);function w(t){var n=r,o=a;return r=a=void 0,h=t,l=e.apply(o,n)}function b(t){var e=t-c;return void 0===c||e>=n||e<0||m&&t-h>=i}function q(){var t=u();if(b(t))return x(t);f=setTimeout(q,function(t){var e=n-(t-c);return m?d(e,i-(t-h)):e}(t))}function x(t){return f=void 0,y&&r?w(t):(r=a=void 0,l)}function j(){var t=u(),e=b(t);if(r=arguments,a=this,c=t,e){if(void 0===f)return function(t){return h=t,f=setTimeout(q,n),v?w(t):l}(c);if(m)return f=setTimeout(q,n),w(c)}return void 0===f&&(f=setTimeout(q,n)),l}return n=g(n)||0,p(o)&&(v=!!o.leading,i=(m="maxWait"in o)?s(g(o.maxWait)||0,n):i,y="trailing"in o?!!o.trailing:y),j.cancel=function(){void 0!==f&&clearTimeout(f),h=0,r=c=a=f=void 0},j.flush=function(){return void 0===f?l:x(u())},j}function p(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function g(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==c.call(t)}(t))return NaN;if(p(t)){var i="function"==typeof t.valueOf?t.valueOf():t;t=p(i)?i+"":i}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(e,"");var l=o.test(t);return l||r.test(t)?a(t.slice(2),l?2:8):n.test(t)?NaN:+t}return m=function(e,n,o){var r=!0,a=!0;if("function"!=typeof e)throw new TypeError(t);return p(o)&&(r="leading"in o?!!o.leading:r,a="trailing"in o?!!o.trailing:a),h(e,n,{leading:r,maxWait:n,trailing:a})}}(),j=q(x);function C(e,n){var o=t.DomEditor.findKey(e,n).id;return"w-e-image-container-".concat(o)}function E(o,r,a,l){var f=e("body"),c=C(o,r),s=l.width,d=l.height,u=l.float,h=0,p=0,g=0,v=!1,m=null;var y=j(function(t){t.preventDefault();var e=t.clientX,n=p+(v?h-e:e-h),o=g*(n/p);null!=m&&(n<=15||o<=15||(m.css("width","".concat(n,"px")),m.css("height","".concat(o,"px"))))},100);function w(e){if(f.off("mousemove",y),null!=m){var n=m.width().toFixed(2),a=m.height().toFixed(2),l={style:i(i({},r.style),{width:"".concat(n,"px"),height:"".concat(a,"px")})};t.SlateTransforms.setNodes(o,l,{at:t.DomEditor.findPath(o,r)}),f.off("mouseup",w)}}function b(n){m=function(){var t=e("#".concat(c));if(0===t.length)throw new Error("Cannot find image container elem");return t}(),h=n;var r=m.find("img");if(0===r.length)throw new Error("Cannot find image elem");p=r.width(),g=r.height(),f.on("mousemove",y),f.on("mouseup",w);var a=t.DomEditor.getHoverbar(o);a&&a.hideAndClean()}var q={};return s&&(q.width=s),d&&(q.height=d),u&&(q.float=u),n.jsx("div",{id:c,style:q,className:"w-e-image-container w-e-selected-image-container",on:{mousedown:function(t){var n=e(t.target);n.hasClass("w-e-image-dragger")&&(t.preventDefault(),(n.hasClass("left-top")||n.hasClass("left-bottom"))&&(v=!0),b(t.clientX))}}},a,n.jsx("div",{className:"w-e-image-dragger left-top"}),n.jsx("div",{className:"w-e-image-dragger right-top"}),n.jsx("div",{className:"w-e-image-dragger left-bottom"}),n.jsx("div",{className:"w-e-image-dragger right-bottom"}))}return{renderElems:[{type:"image",renderElem:function(e,o,r){var a=e,i=a.src,l=a.alt,f=void 0===l?"":l,c=a.href,s=void 0===c?"":c,d=a.style,u=void 0===d?{}:d,h=u.width,p=void 0===h?"":h,g=u.height,v=void 0===g?"":g,m=u.float,y=t.DomEditor.isNodeSelected(r,e),w={};p&&(w.width="100%"),v&&(w.height="100%"),m&&(w.float=m);var b=n.jsx("img",{style:w,src:i,alt:f,"data-href":s}),q=r.isDisabled();return y&&!q?E(r,e,b,{width:p,height:v,float:m}):function(t,e,o,r){var a=r.width,i=r.height,l=r.float,f={};a&&(f.width=a),i&&(f.height=i),l&&(f.float=l);var c=C(t,e);return n.jsx("div",{id:c,style:f,className:"w-e-image-container"},o)}(r,e,b,{width:p,height:v,float:m})}}],elemsToHtml:[o],parseElemsHtml:[w],menus:[p,g,h]}});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@wangeditor-next/editor"),require("dom7"),require("snabbdom")):"function"==typeof define&&define.amd?define(["@wangeditor-next/editor","dom7","snabbdom"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).WangEditorFloatImagePlugin=e(t.wangEditor,t.$,t.snabbdom)}(this,function(t,e,n){"use strict";t.i18nAddResources("en",{float:{none:"Default",left:"Float Left",right:"Float Right"}}),t.i18nAddResources("zh-CN",{float:{none:"默认",left:"左浮动",right:"右浮动"}});var o={type:"image",elemToHtml:function(e,n,o){var r=e,a=r.src,i=r.alt,l=void 0===i?"":i,f=r.href,c=void 0===f?"":f,s=r.style,d=void 0===s?{}:s,u=d.width,h=void 0===u?"":u,p=d.height,g=void 0===p?"":p,v=d.float,m=void 0===v?"":v;if("class"===t.getTextStyleMode(o)){var y=h?' data-w-e-style-width="'.concat(h,'"'):"",w=g?' data-w-e-style-height="'.concat(g,'"'):"",b=m?' data-w-e-style-float="'.concat(m,'"'):"",q=function(t){var e=(t||"").trim().toLowerCase();return"left"===e?"w-e-float-image-left":"right"===e?"w-e-float-image-right":"none"===e?"w-e-float-image-none":""}(m),x=q?' class="'.concat(q,'"'):"";return'<img src="'.concat(a,'" alt="').concat(l,'" data-href="').concat(c,'" width="').concat(h,'" height="').concat(g,'"').concat(x).concat(y).concat(w).concat(b,"/>")}var j="";return h&&(j+="width: ".concat(h,";")),g&&(j+="height: ".concat(g,";")),m&&(j+="float: ".concat(m,";")),'<img src="'.concat(a,'" alt="').concat(l,'" data-href="').concat(c,'" style="').concat(j,'"/>')}},r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},i.apply(this,arguments)};function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function f(t,e,n){if(n||2===arguments.length)for(var o,r=0,a=e.length;r<a;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var c=function(){function e(){this.tag="button"}return e.prototype.getValue=function(t){return""},e.prototype.isActive=function(t){return!1},e.prototype.getSelectedNode=function(e){return t.DomEditor.getSelectedNodeByType(e,"image")},e.prototype.isDisabled=function(t){return null==t.selection||null==this.getSelectedNode(t)},e.prototype.exec=function(e,n){if(!this.isDisabled(e)){var o=this.getSelectedNode(e);if(null!=o){var r=t.DomEditor.getHoverbar(e);r&&r.hideAndClean();var a=o.style,l={style:i(i({},void 0===a?{}:a),{float:this.value})};t.SlateTransforms.setNodes(e,l,{match:function(e){return t.DomEditor.checkNodeType(e,"image")}})}}},e}(),s=function(e){function n(){var n=e.apply(this,f([],l(arguments),!1))||this;return n.title=t.t("float.left"),n.value="left",n.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z"></path><path d="M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z"></path><path d="M89.46270815 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.42756742 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756742 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.4275674-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.4275674-12.42756741z"></path><path d="M512 552.8045037m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756742l0 68.35162073q0 12.42756741-12.4275674 12.42756741l-410.10972444 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162073q0-12.42756741 12.42756741-12.42756742Z"></path><path d="M512 366.39099259m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756741l0 68.35162075q0 12.42756741-12.4275674 12.4275674l-410.10972444 0q-12.42756741 0-12.42756741-12.4275674l0-68.35162075q0-12.42756741 12.42756741-12.42756741Z"></path></svg>',n}return a(n,e),n}(c),d=function(e){function n(){var n=e.apply(this,f([],l(arguments),!1))||this;return n.title=t.t("float.none"),n.value="none",n.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M76.73805432 117.83964445m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.4275674l0 68.35162074q0 12.42756741-12.42756741 12.42756741l-845.0745837 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162074q0-12.42756741 12.42756741-12.4275674Z"></path><path d="M76.73805432 801.35585185m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.42756741l0 68.35162074q0 12.42756741-12.42756741 12.42756742l-845.0745837 0q-12.42756741 0-12.42756741-12.42756742l0-68.35162074q0-12.42756741 12.42756741-12.42756741Z"></path><path d="M89.16562173 304.25315556h410.10972444c6.83516208 0 12.42756741 5.59240533 12.42756741 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756741 12.4275674h-410.10972444a12.42756741 12.42756741 0 0 1-12.42756741-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756741-12.42756741z"></path></svg>',n}return a(n,e),n}(c),u=function(e){function n(){var n=e.apply(this,f([],l(arguments),!1))||this;return n.title=t.t("float.right"),n.value="right",n.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z"></path><path d="M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z"></path><path d="M586.56540445 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.4275674 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.4275674 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.42756742-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756742-12.42756741z"></path><path d="M77.03514075 552.8045037m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756742l0 68.35162073q0 12.42756741-12.42756741 12.42756741l-410.10972444 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162073q0-12.42756741 12.4275674-12.42756742Z"></path><path d="M77.03514075 366.39099259m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756741l0 68.35162075q0 12.42756741-12.42756741 12.4275674l-410.10972444 0q-12.42756741 0-12.4275674-12.4275674l0-68.35162075q0-12.42756741 12.4275674-12.42756741Z"></path></svg>',n}return a(n,e),n}(c),h={key:"imageFloatNone",factory:function(){return new d}},p={key:"imageFloatLeft",factory:function(){return new s}},g={key:"imageFloatRight",factory:function(){return new u}};function v(t,e){for(var n="",o=(t.attr("style")||"").split(";"),r=o.length,a=0;a<r;a+=1){var i=o[a];if(i){var l=i.split(":");l[0].trim()===e&&(n=l[1].trim())}}return n}e.css&&(e.fn.css=e.css),e.append&&(e.fn.append=e.append),e.prepend&&(e.fn.prepend=e.prepend),e.addClass&&(e.fn.addClass=e.addClass),e.removeClass&&(e.fn.removeClass=e.removeClass),e.hasClass&&(e.fn.hasClass=e.hasClass),e.on&&(e.fn.on=e.on),e.off&&(e.fn.off=e.off),e.focus&&(e.fn.focus=e.focus),e.attr&&(e.fn.attr=e.attr),e.removeAttr&&(e.fn.removeAttr=e.removeAttr),e.hide&&(e.fn.hide=e.hide),e.show&&(e.fn.show=e.show),e.parents&&(e.fn.parents=e.parents),e.dataset&&(e.fn.dataset=e.dataset),e.val&&(e.fn.val=e.val),e.text&&(e.fn.text=e.text),e.html&&(e.fn.html=e.html),e.children&&(e.fn.children=e.children),e.remove&&(e.fn.remove=e.remove),e.find&&(e.fn.find=e.find),e.width&&(e.fn.width=e.width),e.height&&(e.fn.height=e.height),e.filter&&(e.fn.filter=e.filter),e.empty&&(e.fn.empty=e.empty);var m,y,w={selector:"img:not([data-w-e-type])",parseElemHtml:function(t,n,o){var r=e(t),a=r.attr("data-href")||"",i=r.attr("width")||"",l=r.attr("height")||"",f=v(r,"width")||r.attr("data-w-e-style-width")||i,c=v(r,"height")||r.attr("data-w-e-style-height")||l,s=function(t){var e=v(t,"float");if(e)return e;var n=(t.attr("data-w-e-style-float")||"").trim();if(n)return n;var o=(t.attr("class")||"").trim().split(/\s+/).filter(Boolean);return o.includes("w-e-float-image-left")?"left":o.includes("w-e-float-image-right")?"right":o.includes("w-e-float-image-none")?"none":""}(r);return a=decodeURIComponent(a),{type:"image",src:r.attr("src")||"",alt:r.attr("alt")||"",href:a,style:{width:f,height:c,float:s},width:i,height:l,children:[{text:""}]}}},b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function q(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var x=function(){if(y)return m;y=1;var t="Expected a function",e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,r=/^0o[0-7]+$/i,a=parseInt,i="object"==typeof b&&b&&b.Object===Object&&b,l="object"==typeof self&&self&&self.Object===Object&&self,f=i||l||Function("return this")(),c=Object.prototype.toString,s=Math.max,d=Math.min,u=function(){return f.Date.now()};function h(e,n,o){var r,a,i,l,f,c,h=0,v=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError(t);function w(t){var n=r,o=a;return r=a=void 0,h=t,l=e.apply(o,n)}function b(t){var e=t-c;return void 0===c||e>=n||e<0||m&&t-h>=i}function q(){var t=u();if(b(t))return x(t);f=setTimeout(q,function(t){var e=n-(t-c);return m?d(e,i-(t-h)):e}(t))}function x(t){return f=void 0,y&&r?w(t):(r=a=void 0,l)}function j(){var t=u(),e=b(t);if(r=arguments,a=this,c=t,e){if(void 0===f)return function(t){return h=t,f=setTimeout(q,n),v?w(t):l}(c);if(m)return f=setTimeout(q,n),w(c)}return void 0===f&&(f=setTimeout(q,n)),l}return n=g(n)||0,p(o)&&(v=!!o.leading,i=(m="maxWait"in o)?s(g(o.maxWait)||0,n):i,y="trailing"in o?!!o.trailing:y),j.cancel=function(){void 0!==f&&clearTimeout(f),h=0,r=c=a=f=void 0},j.flush=function(){return void 0===f?l:x(u())},j}function p(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function g(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==c.call(t)}(t))return NaN;if(p(t)){var i="function"==typeof t.valueOf?t.valueOf():t;t=p(i)?i+"":i}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(e,"");var l=o.test(t);return l||r.test(t)?a(t.slice(2),l?2:8):n.test(t)?NaN:+t}return m=function(e,n,o){var r=!0,a=!0;if("function"!=typeof e)throw new TypeError(t);return p(o)&&(r="leading"in o?!!o.leading:r,a="trailing"in o?!!o.trailing:a),h(e,n,{leading:r,maxWait:n,trailing:a})}}(),j=q(x);function E(e,n){var o=t.DomEditor.findKey(e,n).id;return"w-e-image-container-".concat(o)}function C(o,r,a,l){var f=e("body"),c=E(o,r),s=l.width,d=l.height,u=l.float,h=0,p=0,g=0,v=!1,m=null;var y=j(function(t){t.preventDefault();var e=t.clientX,n=p+(v?h-e:e-h),o=g*(n/p);null!=m&&(n<=15||o<=15||(m.css("width","".concat(n,"px")),m.css("height","".concat(o,"px"))))},100);function w(e){if(f.off("mousemove",y),null!=m){var n=m.width().toFixed(2),a=m.height().toFixed(2),l={style:i(i({},r.style),{width:"".concat(n,"px"),height:"".concat(a,"px")})};t.SlateTransforms.setNodes(o,l,{at:t.DomEditor.findPath(o,r)}),f.off("mouseup",w)}}function b(n){m=function(){var t=e("#".concat(c));if(0===t.length)throw new Error("Cannot find image container elem");return t}(),h=n;var r=m.find("img");if(0===r.length)throw new Error("Cannot find image elem");p=r.width(),g=r.height(),f.on("mousemove",y),f.on("mouseup",w);var a=t.DomEditor.getHoverbar(o);a&&a.hideAndClean()}var q={};return s&&(q.width=s),d&&(q.height=d),u&&(q.float=u),n.jsx("div",{id:c,style:q,className:"w-e-image-container w-e-selected-image-container",on:{mousedown:function(t){var n=e(t.target);n.hasClass("w-e-image-dragger")&&(t.preventDefault(),(n.hasClass("left-top")||n.hasClass("left-bottom"))&&(v=!0),b(t.clientX))}}},a,n.jsx("div",{className:"w-e-image-dragger left-top"}),n.jsx("div",{className:"w-e-image-dragger right-top"}),n.jsx("div",{className:"w-e-image-dragger left-bottom"}),n.jsx("div",{className:"w-e-image-dragger right-bottom"}))}return{renderElems:[{type:"image",renderElem:function(e,o,r){var a=e,i=a.src,l=a.alt,f=void 0===l?"":l,c=a.href,s=void 0===c?"":c,d=a.style,u=void 0===d?{}:d,h=u.width,p=void 0===h?"":h,g=u.height,v=void 0===g?"":g,m=u.float,y=t.DomEditor.isNodeSelected(r,e),w={};p&&(w.width="100%"),v&&(w.height="100%"),m&&(w.float=m);var b=n.jsx("img",{style:w,src:i,alt:f,"data-href":s}),q=r.isDisabled();return y&&!q?C(r,e,b,{width:p,height:v,float:m}):function(t,e,o,r){var a=r.width,i=r.height,l=r.float,f={};a&&(f.width=a),i&&(f.height=i),l&&(f.float=l);var c=E(t,e);return n.jsx("div",{id:c,style:f,className:"w-e-image-container"},o)}(r,e,b,{width:p,height:v,float:m})}}],elemsToHtml:[o],parseElemsHtml:[w],menus:[p,g,h]}});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/module/local.ts","../src/module/elem-to-html.ts","../src/constants/icon-svg.ts","../src/module/menu/FloatBase.ts","../src/module/menu/FloatLeft.ts","../src/module/menu/FloatNone.ts","../src/module/menu/FloatRight.ts","../src/module/menu/index.ts","../src/utils/dom.ts","../src/module/parse-elem-html.ts","../../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js","../src/module/render-elem.tsx","../src/module/index.ts"],"sourcesContent":["/**\n * @description 多语言\n * @author cycleccc\n */\n\nimport { i18nAddResources } from '@wangeditor-next/editor'\n\ni18nAddResources('en', {\n float: {\n none: 'Default',\n left: 'Float Left',\n right: 'Float Right',\n },\n})\n\ni18nAddResources('zh-CN', {\n float: {\n none: '默认',\n left: '左浮动',\n right: '右浮动',\n },\n})\n","/**\n * @description elem to html\n * @author cycleccc\n */\n\nimport { getTextStyleMode, IDomEditor, SlateElement } from '@wangeditor-next/editor'\n\nimport { ImageElement } from './custom-types'\n\nfunction getFloatClass(float: string): string {\n const val = (float || '').trim().toLowerCase()\n\n if (val === 'left') { return 'w-e-float-image-left' }\n if (val === 'right') { return 'w-e-float-image-right' }\n if (val === 'none') { return 'w-e-float-image-none' }\n\n return ''\n}\n\n// 生成 html 的函数\nfunction imageToHtml(elem: SlateElement, _childrenHtml: string, editor?: IDomEditor): string {\n const {\n src, alt = '', href = '', style = {},\n } = elem as ImageElement\n const { width = '', height = '', float = '' } = style\n const mode = getTextStyleMode(editor)\n\n if (mode === 'class') {\n const widthData = width ? ` data-w-e-style-width=\"${width}\"` : ''\n const heightData = height ? ` data-w-e-style-height=\"${height}\"` : ''\n const floatData = float ? ` data-w-e-style-float=\"${float}\"` : ''\n const floatClass = getFloatClass(float)\n const classAttr = floatClass ? ` class=\"${floatClass}\"` : ''\n\n return `<img src=\"${src}\" alt=\"${alt}\" data-href=\"${href}\" width=\"${width}\" height=\"${height}\"${classAttr}${widthData}${heightData}${floatData}/>`\n }\n\n let styleStr = ''\n\n if (width) { styleStr += `width: ${width};` }\n if (height) { styleStr += `height: ${height};` }\n if (float) { styleStr += `float: ${float};` }\n return `<img src=\"${src}\" alt=\"${alt}\" data-href=\"${href}\" style=\"${styleStr}\"/>`\n}\n\n// 配置\nconst conf = {\n type: 'image', // 节点 type ,重要!!!\n elemToHtml: imageToHtml,\n}\n\nexport default conf\n","/**\n * @description icon svg\n * @author cycleccc\n */\n\n/**\n * 【注意】svg 字符串的长度 ,否则会导致代码体积过大\n * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293\n * 找不到再从 iconfont.com 搜索\n */\n\n// 默认不浮动\nexport const DEFAULT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M76.73805432 117.83964445m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.4275674l0 68.35162074q0 12.42756741-12.42756741 12.42756741l-845.0745837 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162074q0-12.42756741 12.42756741-12.4275674Z\"></path><path d=\"M76.73805432 801.35585185m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.42756741l0 68.35162074q0 12.42756741-12.42756741 12.42756742l-845.0745837 0q-12.42756741 0-12.42756741-12.42756742l0-68.35162074q0-12.42756741 12.42756741-12.42756741Z\"></path><path d=\"M89.16562173 304.25315556h410.10972444c6.83516208 0 12.42756741 5.59240533 12.42756741 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756741 12.4275674h-410.10972444a12.42756741 12.42756741 0 0 1-12.42756741-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756741-12.42756741z\"></path></svg>'\n// 左浮动\nexport const LEFT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z\"></path><path d=\"M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z\"></path><path d=\"M89.46270815 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.42756742 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756742 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.4275674-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.4275674-12.42756741z\"></path><path d=\"M512 552.8045037m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756742l0 68.35162073q0 12.42756741-12.4275674 12.42756741l-410.10972444 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162073q0-12.42756741 12.42756741-12.42756742Z\"></path><path d=\"M512 366.39099259m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756741l0 68.35162075q0 12.42756741-12.4275674 12.4275674l-410.10972444 0q-12.42756741 0-12.42756741-12.4275674l0-68.35162075q0-12.42756741 12.42756741-12.42756741Z\"></path></svg>'\n// 右浮动\nexport const RIGHT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z\"></path><path d=\"M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z\"></path><path d=\"M586.56540445 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.4275674 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.4275674 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.42756742-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756742-12.42756741z\"></path><path d=\"M77.03514075 552.8045037m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756742l0 68.35162073q0 12.42756741-12.42756741 12.42756741l-410.10972444 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162073q0-12.42756741 12.4275674-12.42756742Z\"></path><path d=\"M77.03514075 366.39099259m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756741l0 68.35162075q0 12.42756741-12.42756741 12.4275674l-410.10972444 0q-12.42756741 0-12.4275674-12.4275674l0-68.35162075q0-12.42756741 12.4275674-12.42756741Z\"></path></svg>'\n","/**\n * @description image float base class\n * @author cycleccc\n */\n\nimport {\n DomEditor, IButtonMenu, IDomEditor, SlateNode, SlateTransforms,\n} from '@wangeditor-next/editor'\n\nimport { ImageElement } from '../custom-types'\n\nabstract class ImageFloatBaseClass implements IButtonMenu {\n abstract readonly title: string // 菜单标题\n\n abstract readonly iconSvg: string // 图标\n\n abstract readonly value: string // css float 的值\n\n readonly tag = 'button'\n\n getValue(_editor: IDomEditor): string | boolean {\n // 无需获取 val\n return ''\n }\n\n isActive(_editor: IDomEditor): boolean {\n // 无需 active\n return false\n }\n\n private getSelectedNode(editor: IDomEditor): SlateNode | null {\n return DomEditor.getSelectedNodeByType(editor, 'image')\n }\n\n isDisabled(editor: IDomEditor): boolean {\n if (editor.selection == null) { return true }\n\n const imageNode = this.getSelectedNode(editor)\n\n return imageNode == null\n }\n\n exec(editor: IDomEditor, _value: string | boolean) {\n if (this.isDisabled(editor)) { return }\n\n const imageNode = this.getSelectedNode(editor)\n\n if (imageNode == null) { return }\n\n // 隐藏 hoverbar\n const hoverbar = DomEditor.getHoverbar(editor)\n\n if (hoverbar) { hoverbar.hideAndClean() }\n\n const { style = {} } = imageNode as ImageElement\n const props: Partial<ImageElement> = {\n style: {\n ...style,\n float: this.value, // 修改 float 的值\n },\n }\n\n SlateTransforms.setNodes(editor, props, {\n match: n => DomEditor.checkNodeType(n, 'image'),\n })\n }\n}\n\nexport default ImageFloatBaseClass\n","/**\n * @description float image left\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { LEFT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatLeft extends ImageFloatBaseClass {\n readonly title = t('float.left') // 菜单标题\n\n readonly value = 'left' // css float 的值\n\n readonly iconSvg = LEFT_FLOAT_SVG\n}\n\nexport default FloatLeft\n","/**\n * @description float image none\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { DEFAULT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatNone extends ImageFloatBaseClass {\n readonly title = t('float.none') // 菜单标题\n\n readonly value = 'none' // css float 的值\n\n readonly iconSvg = DEFAULT_FLOAT_SVG\n}\n\nexport default FloatNone\n","/**\n * @description float image right\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { RIGHT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatRight extends ImageFloatBaseClass {\n readonly title = t('float.right') // 菜单标题\n\n readonly value = 'right' // css float 的值\n\n readonly iconSvg = RIGHT_FLOAT_SVG\n}\n\nexport default FloatRight\n","/**\n * @description menu index\n * @author cycleccc\n */\n\nimport ImageFloatLeft from './FloatLeft'\nimport ImageFloatNone from './FloatNone'\nimport ImageFloatRight from './FloatRight'\n\nexport const imageFloatNoneMenuConf = {\n key: 'imageFloatNone',\n factory() {\n return new ImageFloatNone()\n },\n}\n\nexport const imageFloatLeftMenuConf = {\n key: 'imageFloatLeft',\n factory() {\n return new ImageFloatLeft()\n },\n}\n\nexport const imageFloatRightMenuConf = {\n key: 'imageFloatRight',\n factory() {\n return new ImageFloatRight()\n },\n}\n","/**\n * @description DOM 操作\n * @author cycleccc\n */\n\nimport $, {\n addClass,\n append,\n attr,\n children,\n css,\n dataset,\n Dom7Array,\n empty,\n filter,\n find,\n focus,\n hasClass,\n height,\n hide,\n html,\n off,\n on,\n parents,\n prepend,\n remove,\n removeAttr,\n removeClass,\n show,\n text,\n val,\n width,\n} from 'dom7'\n\n// COMPAT: This is required to prevent TypeScript aliases from doing some very\n// weird things for Slate's types with the same name as globals. (2019/11/27)\n// https://github.com/microsoft/TypeScript/issues/35002\nimport DOMNode = globalThis.Node\nimport DOMComment = globalThis.Comment\nimport DOMElement = globalThis.Element\nimport DOMText = globalThis.Text\nimport DOMRange = globalThis.Range\nimport DOMSelection = globalThis.Selection\nimport DOMStaticRange = globalThis.StaticRange\n\nexport { Dom7Array } from 'dom7'\n\nif (css) { $.fn.css = css }\nif (append) { $.fn.append = append }\nif (prepend) { $.fn.prepend = prepend }\nif (addClass) { $.fn.addClass = addClass }\nif (removeClass) { $.fn.removeClass = removeClass }\nif (hasClass) { $.fn.hasClass = hasClass }\nif (on) { $.fn.on = on }\nif (off) { $.fn.off = off }\nif (focus) { $.fn.focus = focus }\nif (attr) { $.fn.attr = attr }\nif (removeAttr) { $.fn.removeAttr = removeAttr }\nif (hide) { $.fn.hide = hide }\nif (show) { $.fn.show = show }\nif (parents) { $.fn.parents = parents }\nif (dataset) { $.fn.dataset = dataset }\nif (val) { $.fn.val = val }\nif (text) { $.fn.text = text }\nif (html) { $.fn.html = html }\nif (children) { $.fn.children = children }\nif (remove) { $.fn.remove = remove }\nif (find) { $.fn.find = find }\nif (width) { $.fn.width = width }\nif (height) { $.fn.height = height }\nif (filter) { $.fn.filter = filter }\nif (empty) { $.fn.empty = empty }\n\nexport function getStyleValue($elem: Dom7Array, styleKey: string): string {\n let res = ''\n\n const styleStr = $elem.attr('style') || ''\n const styleArr = styleStr.split(';')\n const length = styleArr.length\n\n for (let i = 0; i < length; i += 1) {\n const styleItemStr = styleArr[i]\n\n if (styleItemStr) {\n const arr = styleItemStr.split(':')\n\n if (arr[0].trim() === styleKey) {\n res = arr[1].trim()\n }\n }\n }\n\n return res\n}\n\nexport default $\nexport {\n DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText,\n}\n","/**\n * @description parse elem html\n * @author cycleccc\n */\n\nimport { IDomEditor, SlateDescendant } from '@wangeditor-next/editor'\n\nimport $, { Dom7Array, DOMElement, getStyleValue } from '../utils/dom'\nimport { ImageElement } from './custom-types'\n\nfunction getFloatValue($elem: Dom7Array): string {\n const styleFloat = getStyleValue($elem, 'float')\n\n if (styleFloat) { return styleFloat }\n\n const dataFloat = ($elem.attr('data-w-e-style-float') || '').trim()\n\n if (dataFloat) { return dataFloat }\n\n const classAttr = $elem.attr('class') || ''\n const classList = classAttr.trim().split(/\\s+/).filter(Boolean)\n\n if (classList.includes('w-e-float-image-left')) { return 'left' }\n if (classList.includes('w-e-float-image-right')) { return 'right' }\n if (classList.includes('w-e-float-image-none')) { return 'none' }\n\n return ''\n}\n\nfunction parseHtml(elem: DOMElement, _children: SlateDescendant[], _editor: IDomEditor): ImageElement {\n const $elem = $(elem)\n let href = $elem.attr('data-href') || ''\n const widthAttr = $elem.attr('width') || ''\n const heightAttr = $elem.attr('height') || ''\n const styleWidth = getStyleValue($elem, 'width') || $elem.attr('data-w-e-style-width') || widthAttr\n const styleHeight = getStyleValue($elem, 'height') || $elem.attr('data-w-e-style-height') || heightAttr\n const styleFloat = getFloatValue($elem)\n\n href = decodeURIComponent(href) // 兼容 V4\n\n return {\n type: 'image',\n src: $elem.attr('src') || '',\n alt: $elem.attr('alt') || '',\n href,\n style: {\n width: styleWidth,\n height: styleHeight,\n float: styleFloat,\n },\n width: widthAttr,\n height: heightAttr,\n children: [{ text: '' }], // void node 有一个空白 text\n }\n}\n\nexport const parseHtmlConf = {\n selector: 'img:not([data-w-e-type])', // data-w-e-type 属性,留给自定义元素,保证扩展性\n parseElemHtml: parseHtml,\n}\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n","/**\n * @description image render elem\n * @author wangfupeng\n */\n\nimport {\n DomEditor, IDomEditor, SlateElement, SlateTransforms,\n} from '@wangeditor-next/editor'\nimport throttle from 'lodash.throttle'\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { jsx, VNode } from 'snabbdom'\n\nimport $$, { Dom7Array } from '../utils/dom'\nimport { ImageElement } from './custom-types'\n\ninterface IImageSize {\n width?: string\n height?: string\n float?: string\n}\n\nfunction genContainerId(editor: IDomEditor, elemNode: SlateElement) {\n const { id } = DomEditor.findKey(editor, elemNode) // node 唯一 id\n\n return `w-e-image-container-${id}`\n}\n\n/**\n * 未选中时,渲染 image container\n */\nfunction renderContainer(\n editor: IDomEditor,\n elemNode: SlateElement,\n imageVnode: VNode,\n imageInfo: IImageSize,\n): VNode {\n const { width, height, float } = imageInfo\n\n const style: any = {}\n\n if (width) { style.width = width }\n if (height) { style.height = height }\n if (float) { style.float = float }\n\n const containerId = genContainerId(editor, elemNode)\n\n return (\n <div id={containerId} style={style} className=\"w-e-image-container\">\n {imageVnode}\n </div>\n ) as VNode\n}\n\n/**\n * 选中状态下,渲染 image container(渲染拖拽容器,修改图片尺寸)\n */\nfunction renderResizeContainer(\n editor: IDomEditor,\n elemNode: SlateElement,\n imageVnode: VNode,\n imageInfo: IImageSize,\n) {\n const $body = $$('body')\n const containerId = genContainerId(editor, elemNode)\n const { width, height, float } = imageInfo\n\n let originalX = 0\n let originalWith = 0\n let originalHeight = 0\n let revers = false // 是否反转。如向右拖拽 right-top 需增加宽度(非反转),但向右拖拽 left-top 则需要减少宽度(反转)\n let $container: Dom7Array | null = null\n\n function getContainerElem(): Dom7Array {\n const $containerFromDom = $$(`#${containerId}`)\n\n if ($containerFromDom.length === 0) { throw new Error('Cannot find image container elem') }\n return $containerFromDom\n }\n\n // mouseover callback (节流)\n const onMousemove = throttle((e: Event) => {\n e.preventDefault()\n\n const { clientX } = e as MouseEvent\n const gap = revers ? originalX - clientX : clientX - originalX // 考虑是否反转\n const newWidth = originalWith + gap\n const newHeight = originalHeight * (newWidth / originalWith) // 根据 width ,按比例计算 height\n\n // 实时修改 img 宽高 -【注意】这里只修改 DOM ,mouseup 时再统一不修改 node\n if ($container == null) { return }\n if (newWidth <= 15 || newHeight <= 15) { return } // 最小就是 15px\n\n $container.css('width', `${newWidth}px`)\n $container.css('height', `${newHeight}px`)\n }, 100)\n\n function onMouseup(_e: Event) {\n // 取消监听 mousemove\n $body.off('mousemove', onMousemove)\n\n if ($container == null) { return }\n const newWidth = $container.width().toFixed(2)\n const newHeight = $container.height().toFixed(2)\n\n // 修改 node\n const props: Partial<ImageElement> = {\n style: {\n ...(elemNode as ImageElement).style,\n width: `${newWidth}px`,\n height: `${newHeight}px`,\n },\n }\n\n SlateTransforms.setNodes(editor, props, { at: DomEditor.findPath(editor, elemNode) })\n\n // 取消监听 mouseup\n $body.off('mouseup', onMouseup)\n }\n\n /**\n * 初始化。监听事件,记录原始数据\n */\n function init(clientX: number) {\n $container = getContainerElem()\n\n // 记录当前 x 坐标值\n originalX = clientX\n\n // 记录 img 原始宽高\n const $img = $container.find('img')\n\n if ($img.length === 0) { throw new Error('Cannot find image elem') }\n originalWith = $img.width()\n originalHeight = $img.height()\n\n // 监听 mousemove\n $body.on('mousemove', onMousemove)\n\n // 监听 mouseup\n $body.on('mouseup', onMouseup)\n\n // 隐藏 hoverbar\n const hoverbar = DomEditor.getHoverbar(editor)\n\n if (hoverbar) { hoverbar.hideAndClean() }\n }\n\n const style: any = {}\n\n if (width) { style.width = width }\n if (height) { style.height = height }\n if (float) { style.float = float }\n // style.boxShadow = '0 0 0 1px #B4D5FF' // 自定义 selected 样式,因为有拖拽触手\n\n return (\n <div\n id={containerId}\n style={style}\n className=\"w-e-image-container w-e-selected-image-container\"\n on={{\n // 统一绑定拖拽触手的 mousedown 事件\n mousedown: (e: MouseEvent) => {\n const $target = $$(e.target as Element)\n\n if (!$target.hasClass('w-e-image-dragger')) {\n // target 不是 .w-e-image-dragger 拖拽触手,则忽略\n return\n }\n e.preventDefault()\n\n if ($target.hasClass('left-top') || $target.hasClass('left-bottom')) {\n revers = true // 反转。向右拖拽,减少宽度\n }\n init(e.clientX) // 初始化\n },\n }}\n >\n {imageVnode}\n\n {/* 拖拽的触手,会统一在上级 DOM 绑定拖拽事件 */}\n <div className=\"w-e-image-dragger left-top\"></div>\n <div className=\"w-e-image-dragger right-top\"></div>\n <div className=\"w-e-image-dragger left-bottom\"></div>\n <div className=\"w-e-image-dragger right-bottom\"></div>\n </div>\n )\n}\n\nfunction renderImage(elemNode: SlateElement, children: VNode[] | null, editor: IDomEditor): VNode {\n const {\n src, alt = '', href = '', style = {},\n } = elemNode as ImageElement\n const { width = '', height = '', float } = style\n const selected = DomEditor.isNodeSelected(editor, elemNode) // 图片是否选中\n\n const imageStyle: any = {}\n\n if (width) { imageStyle.width = '100%' }\n if (height) { imageStyle.height = '100%' }\n if (float) { imageStyle.float = float }\n\n // 【注意】void node 中,renderElem 不用处理 children 。core 会统一处理。\n const vnode = <img style={imageStyle} src={src} alt={alt} data-href={href}/>\n\n const isDisabled = editor.isDisabled()\n\n if (selected && !isDisabled) {\n // 选中,未禁用 - 渲染 resize container\n return renderResizeContainer(editor, elemNode, vnode, { width, height, float })\n }\n\n // 其他,渲染普通 image container\n return renderContainer(editor, elemNode, vnode, { width, height, float })\n}\n\nconst renderImageConf = {\n type: 'image', // 和 elemNode.type 一致\n renderElem: renderImage,\n}\n\nexport { renderImageConf }\n","/**\n * @description module entry\n * @author cycleccc\n */\n\nimport './local' // 多语言\n\nimport { IModuleConf } from '@wangeditor-next/editor'\n\nimport elemToHtmlConf from './elem-to-html'\nimport { imageFloatLeftMenuConf, imageFloatNoneMenuConf, imageFloatRightMenuConf } from './menu'\nimport { parseHtmlConf } from './parse-elem-html'\nimport { renderImageConf } from './render-elem'\n\nconst module: Partial<IModuleConf> = {\n renderElems: [renderImageConf],\n elemsToHtml: [elemToHtmlConf],\n parseElemsHtml: [parseHtmlConf],\n menus: [imageFloatLeftMenuConf, imageFloatRightMenuConf, imageFloatNoneMenuConf],\n}\n\nexport default module\n"],"names":["i18nAddResources","float","none","left","right","conf","type","elemToHtml","elem","_childrenHtml","editor","_a","src","_b","alt","_c","href","_d","style","_e","width","_f","height","_g","getTextStyleMode","widthData","concat","heightData","floatData","floatClass","val","trim","toLowerCase","getFloatClass","classAttr","styleStr","ImageFloatBaseClass","this","tag","prototype","getValue","_editor","isActive","getSelectedNode","DomEditor","getSelectedNodeByType","isDisabled","selection","exec","_value","imageNode","hoverbar","getHoverbar","hideAndClean","props","__assign","value","SlateTransforms","setNodes","match","n","checkNodeType","FloatLeft","_super","_this","title","t","iconSvg","__extends","FloatNone","FloatRight","imageFloatNoneMenuConf","key","factory","ImageFloatNone","imageFloatLeftMenuConf","ImageFloatLeft","imageFloatRightMenuConf","ImageFloatRight","getStyleValue","$elem","styleKey","res","styleArr","attr","split","length","i","styleItemStr","arr","css","$","fn","append","prepend","addClass","removeClass","hasClass","on","off","focus","removeAttr","hide","show","parents","dataset","text","html","children","remove","find","filter","empty","parseHtmlConf","selector","parseElemHtml","_children","widthAttr","heightAttr","styleWidth","styleHeight","styleFloat","dataFloat","classList","Boolean","includes","getFloatValue","decodeURIComponent","FUNC_ERROR_TEXT","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","parseInt","freeGlobal","global","Object","freeSelf","self","root","Function","objectToString","toString","nativeMax","Math","max","nativeMin","min","now","Date","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","TypeError","invokeFunc","time","args","thisArg","undefined","apply","shouldInvoke","timeSinceLastCall","timerExpired","trailingEdge","setTimeout","remainingWait","debounced","isInvoking","arguments","leadingEdge","toNumber","isObject","cancel","clearTimeout","flush","isObjectLike","call","isSymbol","other","valueOf","replace","isBinary","test","slice","lodash_throttle","genContainerId","elemNode","id","findKey","renderResizeContainer","imageVnode","imageInfo","$body","$$","containerId","originalX","originalWith","originalHeight","revers","$container","onMousemove","throttle","e","preventDefault","clientX","newWidth","newHeight","onMouseup","toFixed","at","findPath","init","$containerFromDom","Error","getContainerElem","$img","jsx","className","mousedown","$target","target","renderElems","renderElem","selected","isNodeSelected","imageStyle","vnode","renderContainer","elemsToHtml","elemToHtmlConf","parseElemsHtml","menus"],"mappings":"0YAOAA,EAAAA,iBAAiB,KAAM,CACrBC,MAAO,CACLC,KAAM,UACNC,KAAM,aACNC,MAAO,iBAIXJ,EAAAA,iBAAiB,QAAS,CACxBC,MAAO,CACLC,KAAM,KACNC,KAAM,MACNC,MAAO,SC2BX,IAAMC,EAAO,CACXC,KAAM,QACNC,WA5BF,SAAqBC,EAAoBC,EAAuBC,GACxD,IAAAC,EAEFH,EADFI,EAAGD,EAAAC,IAAEC,EAAAF,EAAAG,IAAAA,OAAG,IAAAD,EAAG,GAAEA,EAAEE,SAAAC,OAAI,IAAAD,EAAG,GAAEA,EAAEE,EAAAN,EAAAO,MAAAA,OAAK,IAAAD,EAAG,CAAA,EAAEA,EAE9BE,EAAwCD,EAAKE,MAA7CA,OAAK,IAAAD,EAAG,GAAEA,EAAEE,EAA4BH,EAAKI,OAAjCA,OAAM,IAAAD,EAAG,GAAEA,EAAEE,EAAeL,EAAKjB,MAApBA,OAAK,IAAAsB,EAAG,GAAEA,EAG3C,GAAa,UAFAC,EAAAA,iBAAiBd,GAER,CACpB,IAAMe,EAAYL,EAAQ,0BAAAM,OAA0BN,E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AAU,uBAC3C3B,EAGP,CAiKSqC,CAAgBrO,EAAQ4L,EAAUwC,EAAO,CAAE1N,MAAKA,EAAEE,OAAMA,EAAErB,MAAKA,GACxE,ICrME+O,YAAa,CAACC,GACdC,eAAgB,CAACjI,GACjBkI,MAAO,CAACxK,EAAwBE,EAAyBN","x_google_ignoreList":[10]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/module/local.ts","../src/module/elem-to-html.ts","../src/constants/icon-svg.ts","../src/module/menu/FloatBase.ts","../src/module/menu/FloatLeft.ts","../src/module/menu/FloatNone.ts","../src/module/menu/FloatRight.ts","../src/module/menu/index.ts","../src/utils/dom.ts","../src/module/parse-elem-html.ts","../../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js","../src/module/render-elem.tsx","../src/module/index.ts"],"sourcesContent":["/**\n * @description 多语言\n * @author cycleccc\n */\n\nimport { i18nAddResources } from '@wangeditor-next/editor'\n\ni18nAddResources('en', {\n float: {\n none: 'Default',\n left: 'Float Left',\n right: 'Float Right',\n },\n})\n\ni18nAddResources('zh-CN', {\n float: {\n none: '默认',\n left: '左浮动',\n right: '右浮动',\n },\n})\n","/**\n * @description elem to html\n * @author cycleccc\n */\n\nimport { getTextStyleMode, IDomEditor, SlateElement } from '@wangeditor-next/editor'\n\nimport { ImageElement } from './custom-types'\n\nfunction getFloatClass(float: string): string {\n const val = (float || '').trim().toLowerCase()\n\n if (val === 'left') { return 'w-e-float-image-left' }\n if (val === 'right') { return 'w-e-float-image-right' }\n if (val === 'none') { return 'w-e-float-image-none' }\n\n return ''\n}\n\n// 生成 html 的函数\nfunction imageToHtml(elem: SlateElement, _childrenHtml: string, editor?: IDomEditor): string {\n const {\n src, alt = '', href = '', style = {},\n } = elem as ImageElement\n const { width = '', height = '', float = '' } = style\n const mode = getTextStyleMode(editor)\n\n if (mode === 'class') {\n const widthData = width ? ` data-w-e-style-width=\"${width}\"` : ''\n const heightData = height ? ` data-w-e-style-height=\"${height}\"` : ''\n const floatData = float ? ` data-w-e-style-float=\"${float}\"` : ''\n const floatClass = getFloatClass(float)\n const classAttr = floatClass ? ` class=\"${floatClass}\"` : ''\n\n return `<img src=\"${src}\" alt=\"${alt}\" data-href=\"${href}\" width=\"${width}\" height=\"${height}\"${classAttr}${widthData}${heightData}${floatData}/>`\n }\n\n let styleStr = ''\n\n if (width) { styleStr += `width: ${width};` }\n if (height) { styleStr += `height: ${height};` }\n if (float) { styleStr += `float: ${float};` }\n return `<img src=\"${src}\" alt=\"${alt}\" data-href=\"${href}\" style=\"${styleStr}\"/>`\n}\n\n// 配置\nconst conf = {\n type: 'image', // 节点 type ,重要!!!\n elemToHtml: imageToHtml,\n}\n\nexport default conf\n","/**\n * @description icon svg\n * @author cycleccc\n */\n\n/**\n * 【注意】svg 字符串的长度 ,否则会导致代码体积过大\n * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293\n * 找不到再从 iconfont.com 搜索\n */\n\n// 默认不浮动\nexport const DEFAULT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M76.73805432 117.83964445m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.4275674l0 68.35162074q0 12.42756741-12.42756741 12.42756741l-845.0745837 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162074q0-12.42756741 12.42756741-12.4275674Z\"></path><path d=\"M76.73805432 801.35585185m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.42756741l0 68.35162074q0 12.42756741-12.42756741 12.42756742l-845.0745837 0q-12.42756741 0-12.42756741-12.42756742l0-68.35162074q0-12.42756741 12.42756741-12.42756741Z\"></path><path d=\"M89.16562173 304.25315556h410.10972444c6.83516208 0 12.42756741 5.59240533 12.42756741 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756741 12.4275674h-410.10972444a12.42756741 12.42756741 0 0 1-12.42756741-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756741-12.42756741z\"></path></svg>'\n// 左浮动\nexport const LEFT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z\"></path><path d=\"M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z\"></path><path d=\"M89.46270815 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.42756742 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756742 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.4275674-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.4275674-12.42756741z\"></path><path d=\"M512 552.8045037m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756742l0 68.35162073q0 12.42756741-12.4275674 12.42756741l-410.10972444 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162073q0-12.42756741 12.42756741-12.42756742Z\"></path><path d=\"M512 366.39099259m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756741l0 68.35162075q0 12.42756741-12.4275674 12.4275674l-410.10972444 0q-12.42756741 0-12.42756741-12.4275674l0-68.35162075q0-12.42756741 12.42756741-12.42756741Z\"></path></svg>'\n// 右浮动\nexport const RIGHT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z\"></path><path d=\"M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z\"></path><path d=\"M586.56540445 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.4275674 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.4275674 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.42756742-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756742-12.42756741z\"></path><path d=\"M77.03514075 552.8045037m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756742l0 68.35162073q0 12.42756741-12.42756741 12.42756741l-410.10972444 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162073q0-12.42756741 12.4275674-12.42756742Z\"></path><path d=\"M77.03514075 366.39099259m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756741l0 68.35162075q0 12.42756741-12.42756741 12.4275674l-410.10972444 0q-12.42756741 0-12.4275674-12.4275674l0-68.35162075q0-12.42756741 12.4275674-12.42756741Z\"></path></svg>'\n","/**\n * @description image float base class\n * @author cycleccc\n */\n\nimport {\n DomEditor, IButtonMenu, IDomEditor, SlateNode, SlateTransforms,\n} from '@wangeditor-next/editor'\n\nimport { ImageElement } from '../custom-types'\n\nabstract class ImageFloatBaseClass implements IButtonMenu {\n abstract readonly title: string // 菜单标题\n\n abstract readonly iconSvg: string // 图标\n\n abstract readonly value: string // css float 的值\n\n readonly tag = 'button'\n\n getValue(_editor: IDomEditor): string | boolean {\n // 无需获取 val\n return ''\n }\n\n isActive(_editor: IDomEditor): boolean {\n // 无需 active\n return false\n }\n\n private getSelectedNode(editor: IDomEditor): SlateNode | null {\n return DomEditor.getSelectedNodeByType(editor, 'image')\n }\n\n isDisabled(editor: IDomEditor): boolean {\n if (editor.selection == null) { return true }\n\n const imageNode = this.getSelectedNode(editor)\n\n return imageNode == null\n }\n\n exec(editor: IDomEditor, _value: string | boolean) {\n if (this.isDisabled(editor)) { return }\n\n const imageNode = this.getSelectedNode(editor)\n\n if (imageNode == null) { return }\n\n // 隐藏 hoverbar\n const hoverbar = DomEditor.getHoverbar(editor)\n\n if (hoverbar) { hoverbar.hideAndClean() }\n\n const { style = {} } = imageNode as ImageElement\n const props: Partial<ImageElement> = {\n style: {\n ...style,\n float: this.value, // 修改 float 的值\n },\n }\n\n SlateTransforms.setNodes(editor, props, {\n match: n => DomEditor.checkNodeType(n, 'image'),\n })\n }\n}\n\nexport default ImageFloatBaseClass\n","/**\n * @description float image left\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { LEFT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatLeft extends ImageFloatBaseClass {\n readonly title = t('float.left') // 菜单标题\n\n readonly value = 'left' // css float 的值\n\n readonly iconSvg = LEFT_FLOAT_SVG\n}\n\nexport default FloatLeft\n","/**\n * @description float image none\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { DEFAULT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatNone extends ImageFloatBaseClass {\n readonly title = t('float.none') // 菜单标题\n\n readonly value = 'none' // css float 的值\n\n readonly iconSvg = DEFAULT_FLOAT_SVG\n}\n\nexport default FloatNone\n","/**\n * @description float image right\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { RIGHT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatRight extends ImageFloatBaseClass {\n readonly title = t('float.right') // 菜单标题\n\n readonly value = 'right' // css float 的值\n\n readonly iconSvg = RIGHT_FLOAT_SVG\n}\n\nexport default FloatRight\n","/**\n * @description menu index\n * @author cycleccc\n */\n\nimport ImageFloatLeft from './FloatLeft'\nimport ImageFloatNone from './FloatNone'\nimport ImageFloatRight from './FloatRight'\n\nexport const imageFloatNoneMenuConf = {\n key: 'imageFloatNone',\n factory() {\n return new ImageFloatNone()\n },\n}\n\nexport const imageFloatLeftMenuConf = {\n key: 'imageFloatLeft',\n factory() {\n return new ImageFloatLeft()\n },\n}\n\nexport const imageFloatRightMenuConf = {\n key: 'imageFloatRight',\n factory() {\n return new ImageFloatRight()\n },\n}\n","/**\n * @description DOM 操作\n * @author cycleccc\n */\n\nimport $, {\n addClass,\n append,\n attr,\n children,\n css,\n dataset,\n Dom7Array,\n empty,\n filter,\n find,\n focus,\n hasClass,\n height,\n hide,\n html,\n off,\n on,\n parents,\n prepend,\n remove,\n removeAttr,\n removeClass,\n show,\n text,\n val,\n width,\n} from 'dom7'\n\n// COMPAT: This is required to prevent TypeScript aliases from doing some very\n// weird things for Slate's types with the same name as globals. (2019/11/27)\n// https://github.com/microsoft/TypeScript/issues/35002\nimport DOMNode = globalThis.Node\nimport DOMComment = globalThis.Comment\nimport DOMElement = globalThis.Element\nimport DOMText = globalThis.Text\nimport DOMRange = globalThis.Range\nimport DOMSelection = globalThis.Selection\nimport DOMStaticRange = globalThis.StaticRange\n\nexport type { Dom7Array } from 'dom7'\n\nif (css) { $.fn.css = css }\nif (append) { $.fn.append = append }\nif (prepend) { $.fn.prepend = prepend }\nif (addClass) { $.fn.addClass = addClass }\nif (removeClass) { $.fn.removeClass = removeClass }\nif (hasClass) { $.fn.hasClass = hasClass }\nif (on) { $.fn.on = on }\nif (off) { $.fn.off = off }\nif (focus) { $.fn.focus = focus }\nif (attr) { $.fn.attr = attr }\nif (removeAttr) { $.fn.removeAttr = removeAttr }\nif (hide) { $.fn.hide = hide }\nif (show) { $.fn.show = show }\nif (parents) { $.fn.parents = parents }\nif (dataset) { $.fn.dataset = dataset }\nif (val) { $.fn.val = val }\nif (text) { $.fn.text = text }\nif (html) { $.fn.html = html }\nif (children) { $.fn.children = children }\nif (remove) { $.fn.remove = remove }\nif (find) { $.fn.find = find }\nif (width) { $.fn.width = width }\nif (height) { $.fn.height = height }\nif (filter) { $.fn.filter = filter }\nif (empty) { $.fn.empty = empty }\n\nexport function getStyleValue($elem: Dom7Array, styleKey: string): string {\n let res = ''\n\n const styleStr = $elem.attr('style') || ''\n const styleArr = styleStr.split(';')\n const length = styleArr.length\n\n for (let i = 0; i < length; i += 1) {\n const styleItemStr = styleArr[i]\n\n if (styleItemStr) {\n const arr = styleItemStr.split(':')\n\n if (arr[0].trim() === styleKey) {\n res = arr[1].trim()\n }\n }\n }\n\n return res\n}\n\nexport default $\nexport {\n DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText,\n}\n","/**\n * @description parse elem html\n * @author cycleccc\n */\n\nimport { IDomEditor, SlateDescendant } from '@wangeditor-next/editor'\n\nimport $, { Dom7Array, DOMElement, getStyleValue } from '../utils/dom'\nimport { ImageElement } from './custom-types'\n\nfunction getFloatValue($elem: Dom7Array): string {\n const styleFloat = getStyleValue($elem, 'float')\n\n if (styleFloat) { return styleFloat }\n\n const dataFloat = ($elem.attr('data-w-e-style-float') || '').trim()\n\n if (dataFloat) { return dataFloat }\n\n const classAttr = $elem.attr('class') || ''\n const classList = classAttr.trim().split(/\\s+/).filter(Boolean)\n\n if (classList.includes('w-e-float-image-left')) { return 'left' }\n if (classList.includes('w-e-float-image-right')) { return 'right' }\n if (classList.includes('w-e-float-image-none')) { return 'none' }\n\n return ''\n}\n\nfunction parseHtml(elem: DOMElement, _children: SlateDescendant[], _editor: IDomEditor): ImageElement {\n const $elem = $(elem)\n let href = $elem.attr('data-href') || ''\n const widthAttr = $elem.attr('width') || ''\n const heightAttr = $elem.attr('height') || ''\n const styleWidth = getStyleValue($elem, 'width') || $elem.attr('data-w-e-style-width') || widthAttr\n const styleHeight = getStyleValue($elem, 'height') || $elem.attr('data-w-e-style-height') || heightAttr\n const styleFloat = getFloatValue($elem)\n\n href = decodeURIComponent(href) // 兼容 V4\n\n return {\n type: 'image',\n src: $elem.attr('src') || '',\n alt: $elem.attr('alt') || '',\n href,\n style: {\n width: styleWidth,\n height: styleHeight,\n float: styleFloat,\n },\n width: widthAttr,\n height: heightAttr,\n children: [{ text: '' }], // void node 有一个空白 text\n }\n}\n\nexport const parseHtmlConf = {\n selector: 'img:not([data-w-e-type])', // data-w-e-type 属性,留给自定义元素,保证扩展性\n parseElemHtml: parseHtml,\n}\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n","/**\n * @description image render elem\n * @author wangfupeng\n */\n\nimport {\n DomEditor, IDomEditor, SlateElement, SlateTransforms,\n} from '@wangeditor-next/editor'\nimport throttle from 'lodash.throttle'\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { jsx, VNode } from 'snabbdom'\n\nimport $$, { Dom7Array } from '../utils/dom'\nimport { ImageElement } from './custom-types'\n\ninterface IImageSize {\n width?: string\n height?: string\n float?: string\n}\n\nfunction genContainerId(editor: IDomEditor, elemNode: SlateElement) {\n const { id } = DomEditor.findKey(editor, elemNode) // node 唯一 id\n\n return `w-e-image-container-${id}`\n}\n\n/**\n * 未选中时,渲染 image container\n */\nfunction renderContainer(\n editor: IDomEditor,\n elemNode: SlateElement,\n imageVnode: VNode,\n imageInfo: IImageSize,\n): VNode {\n const { width, height, float } = imageInfo\n\n const style: any = {}\n\n if (width) { style.width = width }\n if (height) { style.height = height }\n if (float) { style.float = float }\n\n const containerId = genContainerId(editor, elemNode)\n\n return (\n <div id={containerId} style={style} className=\"w-e-image-container\">\n {imageVnode}\n </div>\n ) as VNode\n}\n\n/**\n * 选中状态下,渲染 image container(渲染拖拽容器,修改图片尺寸)\n */\nfunction renderResizeContainer(\n editor: IDomEditor,\n elemNode: SlateElement,\n imageVnode: VNode,\n imageInfo: IImageSize,\n) {\n const $body = $$('body')\n const containerId = genContainerId(editor, elemNode)\n const { width, height, float } = imageInfo\n\n let originalX = 0\n let originalWith = 0\n let originalHeight = 0\n let revers = false // 是否反转。如向右拖拽 right-top 需增加宽度(非反转),但向右拖拽 left-top 则需要减少宽度(反转)\n let $container: Dom7Array | null = null\n\n function getContainerElem(): Dom7Array {\n const $containerFromDom = $$(`#${containerId}`)\n\n if ($containerFromDom.length === 0) { throw new Error('Cannot find image container elem') }\n return $containerFromDom\n }\n\n // mouseover callback (节流)\n const onMousemove = throttle((e: Event) => {\n e.preventDefault()\n\n const { clientX } = e as MouseEvent\n const gap = revers ? originalX - clientX : clientX - originalX // 考虑是否反转\n const newWidth = originalWith + gap\n const newHeight = originalHeight * (newWidth / originalWith) // 根据 width ,按比例计算 height\n\n // 实时修改 img 宽高 -【注意】这里只修改 DOM ,mouseup 时再统一不修改 node\n if ($container == null) { return }\n if (newWidth <= 15 || newHeight <= 15) { return } // 最小就是 15px\n\n $container.css('width', `${newWidth}px`)\n $container.css('height', `${newHeight}px`)\n }, 100)\n\n function onMouseup(_e: Event) {\n // 取消监听 mousemove\n $body.off('mousemove', onMousemove)\n\n if ($container == null) { return }\n const newWidth = $container.width().toFixed(2)\n const newHeight = $container.height().toFixed(2)\n\n // 修改 node\n const props: Partial<ImageElement> = {\n style: {\n ...(elemNode as ImageElement).style,\n width: `${newWidth}px`,\n height: `${newHeight}px`,\n },\n }\n\n SlateTransforms.setNodes(editor, props, { at: DomEditor.findPath(editor, elemNode) })\n\n // 取消监听 mouseup\n $body.off('mouseup', onMouseup)\n }\n\n /**\n * 初始化。监听事件,记录原始数据\n */\n function init(clientX: number) {\n $container = getContainerElem()\n\n // 记录当前 x 坐标值\n originalX = clientX\n\n // 记录 img 原始宽高\n const $img = $container.find('img')\n\n if ($img.length === 0) { throw new Error('Cannot find image elem') }\n originalWith = $img.width()\n originalHeight = $img.height()\n\n // 监听 mousemove\n $body.on('mousemove', onMousemove)\n\n // 监听 mouseup\n $body.on('mouseup', onMouseup)\n\n // 隐藏 hoverbar\n const hoverbar = DomEditor.getHoverbar(editor)\n\n if (hoverbar) { hoverbar.hideAndClean() }\n }\n\n const style: any = {}\n\n if (width) { style.width = width }\n if (height) { style.height = height }\n if (float) { style.float = float }\n // style.boxShadow = '0 0 0 1px #B4D5FF' // 自定义 selected 样式,因为有拖拽触手\n\n return (\n <div\n id={containerId}\n style={style}\n className=\"w-e-image-container w-e-selected-image-container\"\n on={{\n // 统一绑定拖拽触手的 mousedown 事件\n mousedown: (e: MouseEvent) => {\n const $target = $$(e.target as Element)\n\n if (!$target.hasClass('w-e-image-dragger')) {\n // target 不是 .w-e-image-dragger 拖拽触手,则忽略\n return\n }\n e.preventDefault()\n\n if ($target.hasClass('left-top') || $target.hasClass('left-bottom')) {\n revers = true // 反转。向右拖拽,减少宽度\n }\n init(e.clientX) // 初始化\n },\n }}\n >\n {imageVnode}\n\n {/* 拖拽的触手,会统一在上级 DOM 绑定拖拽事件 */}\n <div className=\"w-e-image-dragger left-top\"></div>\n <div className=\"w-e-image-dragger right-top\"></div>\n <div className=\"w-e-image-dragger left-bottom\"></div>\n <div className=\"w-e-image-dragger right-bottom\"></div>\n </div>\n )\n}\n\nfunction renderImage(elemNode: SlateElement, children: VNode[] | null, editor: IDomEditor): VNode {\n const {\n src, alt = '', href = '', style = {},\n } = elemNode as ImageElement\n const { width = '', height = '', float } = style\n const selected = DomEditor.isNodeSelected(editor, elemNode) // 图片是否选中\n\n const imageStyle: any = {}\n\n if (width) { imageStyle.width = '100%' }\n if (height) { imageStyle.height = '100%' }\n if (float) { imageStyle.float = float }\n\n // 【注意】void node 中,renderElem 不用处理 children 。core 会统一处理。\n const vnode = <img style={imageStyle} src={src} alt={alt} data-href={href}/>\n\n const isDisabled = editor.isDisabled()\n\n if (selected && !isDisabled) {\n // 选中,未禁用 - 渲染 resize container\n return renderResizeContainer(editor, elemNode, vnode, { width, height, float })\n }\n\n // 其他,渲染普通 image container\n return renderContainer(editor, elemNode, vnode, { width, height, float })\n}\n\nconst renderImageConf = {\n type: 'image', // 和 elemNode.type 一致\n renderElem: renderImage,\n}\n\nexport { renderImageConf }\n","/**\n * @description module entry\n * @author cycleccc\n */\n\nimport './local' // 多语言\n\nimport { IModuleConf } from '@wangeditor-next/editor'\n\nimport elemToHtmlConf from './elem-to-html'\nimport { imageFloatLeftMenuConf, imageFloatNoneMenuConf, imageFloatRightMenuConf } from './menu'\nimport { parseHtmlConf } from './parse-elem-html'\nimport { renderImageConf } from './render-elem'\n\nconst module: Partial<IModuleConf> = {\n renderElems: [renderImageConf],\n elemsToHtml: [elemToHtmlConf],\n parseElemsHtml: [parseHtmlConf],\n menus: [imageFloatLeftMenuConf, imageFloatRightMenuConf, imageFloatNoneMenuConf],\n}\n\nexport default module\n"],"names":["i18nAddResources","float","none","left","right","conf","type","elemToHtml","elem","_childrenHtml","editor","_a","src","_b","alt","_c","href","_d","style","_e","width","_f","height","_g","getTextStyleMode","widthData","concat","heightData","floatData","floatClass","val","trim","toLowerCase","getFloatClass","classAttr","styleStr","ImageFloatBaseClass","this","tag","prototype","getValue","_editor","isActive","getSelectedNode","DomEditor","getSelectedNodeByType","isDisabled","selection","exec","_value","imageNode","hoverbar","getHoverbar","hideAndClean","props","__assign","value","SlateTransforms","setNodes","match","n","checkNodeType","FloatLeft","_super","_this","title","t","iconSvg","__extends","FloatNone","FloatRight","imageFloatNoneMenuConf","key","factory","ImageFloatNone","imageFloatLeftMenuConf","ImageFloatLeft","imageFloatRightMenuConf","ImageFloatRight","getStyleValue","$elem","styleKey","res","styleArr","attr","split","length","i","styleItemStr","arr","css","$","fn","append","prepend","addClass","removeClass","hasClass","on","off","focus","removeAttr","hide","show","parents","dataset","text","html","children","remove","find","filter","empty","parseHtmlConf","selector","parseElemHtml","_children","widthAttr","heightAttr","styleWidth","styleHeight","styleFloat","dataFloat","classList","Boolean","includes","getFloatValue","decodeURIComponent","FUNC_ERROR_TEXT","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","parseInt","freeGlobal","global","Object","freeSelf","self","root","Function","objectToString","toString","nativeMax","Math","max","nativeMin","min","now","Date","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","TypeError","invokeFunc","time","args","thisArg","undefined","apply","shouldInvoke","timeSinceLastCall","timerExpired","trailingEdge","setTimeout","remainingWait","debounced","isInvoking","arguments","leadingEdge","toNumber","isObject","cancel","clearTimeout","flush","isObjectLike","call","isSymbol","other","valueOf","replace","isBinary","test","slice","lodash_throttle","genContainerId","elemNode","id","findKey","renderResizeContainer","imageVnode","imageInfo","$body","$$","containerId","originalX","originalWith","originalHeight","revers","$container","onMousemove","throttle","e","preventDefault","clientX","newWidth","newHeight","onMouseup","toFixed","at","findPath","init","$containerFromDom","Error","getContainerElem","$img","jsx","className","mousedown","$target","target","renderElems","renderElem","selected","isNodeSelected","imageStyle","vnode","renderContainer","elemsToHtml","elemToHtmlConf","parseElemsHtml","menus"],"mappings":"8YAOAA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CuC,EAAkB,CAAA,EAEpBzN,IAASyN,EAAWzN,MAAQ,QAC5BE,IAAUuN,EAAWvN,OAAS,QAC9BrB,IAAS4O,EAAW5O,MAAQA,GAGhC,IAAM6O,EAAQV,EAAAA,IAAA,MAAA,CAAKlN,MAAO2N,EAAYjO,IAAKA,EAAKE,IAAKA,EAAG,YAAaE,IAE/D8B,EAAapC,EAAOoC,aAE1B,OAAI6L,IAAa7L,EAER2J,EAAsB/L,EAAQ4L,EAAUwC,EAAO,CAAE1N,MAAKA,EAAEE,OAAMA,EAAErB,MAAKA,IAlLhF,SACES,EACA4L,EACAI,EACAC,GAEQ,IAAAvL,EAAyBuL,EAASvL,MAA3BE,EAAkBqL,EAASrL,OAAnBrB,EAAU0M,QAE3BzL,EAAa,CAAA,EAEfE,IAASF,EAAME,MAAQA,GACvBE,IAAUJ,EAAMI,OAASA,GACzBrB,IAASiB,EAAMjB,MAAQA,GAE3B,IAAM6M,EAAcT,EAAe3L,EAAQ4L,GAE3C,OACE8B,EAAAA,IAAA,MAAA,CAAK7B,GAAIO,EAAa5L,MAAOA,EAAOmN,UAAU,uBAC3C3B,EAGP,CAiKSqC,CAAgBrO,EAAQ4L,EAAUwC,EAAO,CAAE1N,MAAKA,EAAEE,OAAMA,EAAErB,MAAKA,GACxE,ICrME+O,YAAa,CAACC,GACdC,eAAgB,CAACjI,GACjBkI,MAAO,CAACxK,EAAwBE,EAAyBN","x_google_ignoreList":[10]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/module/local.ts","../src/module/elem-to-html.ts","../src/constants/icon-svg.ts","../src/module/menu/FloatBase.ts","../src/module/menu/FloatLeft.ts","../src/module/menu/FloatNone.ts","../src/module/menu/FloatRight.ts","../src/module/menu/index.ts","../src/utils/dom.ts","../src/module/parse-elem-html.ts","../../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js","../src/module/render-elem.tsx","../src/module/index.ts"],"sourcesContent":["/**\n * @description 多语言\n * @author cycleccc\n */\n\nimport { i18nAddResources } from '@wangeditor-next/editor'\n\ni18nAddResources('en', {\n float: {\n none: 'Default',\n left: 'Float Left',\n right: 'Float Right',\n },\n})\n\ni18nAddResources('zh-CN', {\n float: {\n none: '默认',\n left: '左浮动',\n right: '右浮动',\n },\n})\n","/**\n * @description elem to html\n * @author cycleccc\n */\n\nimport { getTextStyleMode, IDomEditor, SlateElement } from '@wangeditor-next/editor'\n\nimport { ImageElement } from './custom-types'\n\nfunction getFloatClass(float: string): string {\n const val = (float || '').trim().toLowerCase()\n\n if (val === 'left') { return 'w-e-float-image-left' }\n if (val === 'right') { return 'w-e-float-image-right' }\n if (val === 'none') { return 'w-e-float-image-none' }\n\n return ''\n}\n\n// 生成 html 的函数\nfunction imageToHtml(elem: SlateElement, _childrenHtml: string, editor?: IDomEditor): string {\n const {\n src, alt = '', href = '', style = {},\n } = elem as ImageElement\n const { width = '', height = '', float = '' } = style\n const mode = getTextStyleMode(editor)\n\n if (mode === 'class') {\n const widthData = width ? ` data-w-e-style-width=\"${width}\"` : ''\n const heightData = height ? ` data-w-e-style-height=\"${height}\"` : ''\n const floatData = float ? ` data-w-e-style-float=\"${float}\"` : ''\n const floatClass = getFloatClass(float)\n const classAttr = floatClass ? ` class=\"${floatClass}\"` : ''\n\n return `<img src=\"${src}\" alt=\"${alt}\" data-href=\"${href}\" width=\"${width}\" height=\"${height}\"${classAttr}${widthData}${heightData}${floatData}/>`\n }\n\n let styleStr = ''\n\n if (width) { styleStr += `width: ${width};` }\n if (height) { styleStr += `height: ${height};` }\n if (float) { styleStr += `float: ${float};` }\n return `<img src=\"${src}\" alt=\"${alt}\" data-href=\"${href}\" style=\"${styleStr}\"/>`\n}\n\n// 配置\nconst conf = {\n type: 'image', // 节点 type ,重要!!!\n elemToHtml: imageToHtml,\n}\n\nexport default conf\n","/**\n * @description icon svg\n * @author cycleccc\n */\n\n/**\n * 【注意】svg 字符串的长度 ,否则会导致代码体积过大\n * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293\n * 找不到再从 iconfont.com 搜索\n */\n\n// 默认不浮动\nexport const DEFAULT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M76.73805432 117.83964445m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.4275674l0 68.35162074q0 12.42756741-12.42756741 12.42756741l-845.0745837 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162074q0-12.42756741 12.42756741-12.4275674Z\"></path><path d=\"M76.73805432 801.35585185m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.42756741l0 68.35162074q0 12.42756741-12.42756741 12.42756742l-845.0745837 0q-12.42756741 0-12.42756741-12.42756742l0-68.35162074q0-12.42756741 12.42756741-12.42756741Z\"></path><path d=\"M89.16562173 304.25315556h410.10972444c6.83516208 0 12.42756741 5.59240533 12.42756741 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756741 12.4275674h-410.10972444a12.42756741 12.42756741 0 0 1-12.42756741-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756741-12.42756741z\"></path></svg>'\n// 左浮动\nexport const LEFT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z\"></path><path d=\"M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z\"></path><path d=\"M89.46270815 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.42756742 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756742 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.4275674-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.4275674-12.42756741z\"></path><path d=\"M512 552.8045037m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756742l0 68.35162073q0 12.42756741-12.4275674 12.42756741l-410.10972444 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162073q0-12.42756741 12.42756741-12.42756742Z\"></path><path d=\"M512 366.39099259m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756741l0 68.35162075q0 12.42756741-12.4275674 12.4275674l-410.10972444 0q-12.42756741 0-12.42756741-12.4275674l0-68.35162075q0-12.42756741 12.42756741-12.42756741Z\"></path></svg>'\n// 右浮动\nexport const RIGHT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z\"></path><path d=\"M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z\"></path><path d=\"M586.56540445 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.4275674 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.4275674 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.42756742-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756742-12.42756741z\"></path><path d=\"M77.03514075 552.8045037m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756742l0 68.35162073q0 12.42756741-12.42756741 12.42756741l-410.10972444 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162073q0-12.42756741 12.4275674-12.42756742Z\"></path><path d=\"M77.03514075 366.39099259m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756741l0 68.35162075q0 12.42756741-12.42756741 12.4275674l-410.10972444 0q-12.42756741 0-12.4275674-12.4275674l0-68.35162075q0-12.42756741 12.4275674-12.42756741Z\"></path></svg>'\n","/**\n * @description image float base class\n * @author cycleccc\n */\n\nimport {\n DomEditor, IButtonMenu, IDomEditor, SlateNode, SlateTransforms,\n} from '@wangeditor-next/editor'\n\nimport { ImageElement } from '../custom-types'\n\nabstract class ImageFloatBaseClass implements IButtonMenu {\n abstract readonly title: string // 菜单标题\n\n abstract readonly iconSvg: string // 图标\n\n abstract readonly value: string // css float 的值\n\n readonly tag = 'button'\n\n getValue(_editor: IDomEditor): string | boolean {\n // 无需获取 val\n return ''\n }\n\n isActive(_editor: IDomEditor): boolean {\n // 无需 active\n return false\n }\n\n private getSelectedNode(editor: IDomEditor): SlateNode | null {\n return DomEditor.getSelectedNodeByType(editor, 'image')\n }\n\n isDisabled(editor: IDomEditor): boolean {\n if (editor.selection == null) { return true }\n\n const imageNode = this.getSelectedNode(editor)\n\n return imageNode == null\n }\n\n exec(editor: IDomEditor, _value: string | boolean) {\n if (this.isDisabled(editor)) { return }\n\n const imageNode = this.getSelectedNode(editor)\n\n if (imageNode == null) { return }\n\n // 隐藏 hoverbar\n const hoverbar = DomEditor.getHoverbar(editor)\n\n if (hoverbar) { hoverbar.hideAndClean() }\n\n const { style = {} } = imageNode as ImageElement\n const props: Partial<ImageElement> = {\n style: {\n ...style,\n float: this.value, // 修改 float 的值\n },\n }\n\n SlateTransforms.setNodes(editor, props, {\n match: n => DomEditor.checkNodeType(n, 'image'),\n })\n }\n}\n\nexport default ImageFloatBaseClass\n","/**\n * @description float image left\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { LEFT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatLeft extends ImageFloatBaseClass {\n readonly title = t('float.left') // 菜单标题\n\n readonly value = 'left' // css float 的值\n\n readonly iconSvg = LEFT_FLOAT_SVG\n}\n\nexport default FloatLeft\n","/**\n * @description float image none\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { DEFAULT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatNone extends ImageFloatBaseClass {\n readonly title = t('float.none') // 菜单标题\n\n readonly value = 'none' // css float 的值\n\n readonly iconSvg = DEFAULT_FLOAT_SVG\n}\n\nexport default FloatNone\n","/**\n * @description float image right\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { RIGHT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatRight extends ImageFloatBaseClass {\n readonly title = t('float.right') // 菜单标题\n\n readonly value = 'right' // css float 的值\n\n readonly iconSvg = RIGHT_FLOAT_SVG\n}\n\nexport default FloatRight\n","/**\n * @description menu index\n * @author cycleccc\n */\n\nimport ImageFloatLeft from './FloatLeft'\nimport ImageFloatNone from './FloatNone'\nimport ImageFloatRight from './FloatRight'\n\nexport const imageFloatNoneMenuConf = {\n key: 'imageFloatNone',\n factory() {\n return new ImageFloatNone()\n },\n}\n\nexport const imageFloatLeftMenuConf = {\n key: 'imageFloatLeft',\n factory() {\n return new ImageFloatLeft()\n },\n}\n\nexport const imageFloatRightMenuConf = {\n key: 'imageFloatRight',\n factory() {\n return new ImageFloatRight()\n },\n}\n","/**\n * @description DOM 操作\n * @author cycleccc\n */\n\nimport $, {\n addClass,\n append,\n attr,\n children,\n css,\n dataset,\n Dom7Array,\n empty,\n filter,\n find,\n focus,\n hasClass,\n height,\n hide,\n html,\n off,\n on,\n parents,\n prepend,\n remove,\n removeAttr,\n removeClass,\n show,\n text,\n val,\n width,\n} from 'dom7'\n\n// COMPAT: This is required to prevent TypeScript aliases from doing some very\n// weird things for Slate's types with the same name as globals. (2019/11/27)\n// https://github.com/microsoft/TypeScript/issues/35002\nimport DOMNode = globalThis.Node\nimport DOMComment = globalThis.Comment\nimport DOMElement = globalThis.Element\nimport DOMText = globalThis.Text\nimport DOMRange = globalThis.Range\nimport DOMSelection = globalThis.Selection\nimport DOMStaticRange = globalThis.StaticRange\n\nexport { Dom7Array } from 'dom7'\n\nif (css) { $.fn.css = css }\nif (append) { $.fn.append = append }\nif (prepend) { $.fn.prepend = prepend }\nif (addClass) { $.fn.addClass = addClass }\nif (removeClass) { $.fn.removeClass = removeClass }\nif (hasClass) { $.fn.hasClass = hasClass }\nif (on) { $.fn.on = on }\nif (off) { $.fn.off = off }\nif (focus) { $.fn.focus = focus }\nif (attr) { $.fn.attr = attr }\nif (removeAttr) { $.fn.removeAttr = removeAttr }\nif (hide) { $.fn.hide = hide }\nif (show) { $.fn.show = show }\nif (parents) { $.fn.parents = parents }\nif (dataset) { $.fn.dataset = dataset }\nif (val) { $.fn.val = val }\nif (text) { $.fn.text = text }\nif (html) { $.fn.html = html }\nif (children) { $.fn.children = children }\nif (remove) { $.fn.remove = remove }\nif (find) { $.fn.find = find }\nif (width) { $.fn.width = width }\nif (height) { $.fn.height = height }\nif (filter) { $.fn.filter = filter }\nif (empty) { $.fn.empty = empty }\n\nexport function getStyleValue($elem: Dom7Array, styleKey: string): string {\n let res = ''\n\n const styleStr = $elem.attr('style') || ''\n const styleArr = styleStr.split(';')\n const length = styleArr.length\n\n for (let i = 0; i < length; i += 1) {\n const styleItemStr = styleArr[i]\n\n if (styleItemStr) {\n const arr = styleItemStr.split(':')\n\n if (arr[0].trim() === styleKey) {\n res = arr[1].trim()\n }\n }\n }\n\n return res\n}\n\nexport default $\nexport {\n DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText,\n}\n","/**\n * @description parse elem html\n * @author cycleccc\n */\n\nimport { IDomEditor, SlateDescendant } from '@wangeditor-next/editor'\n\nimport $, { Dom7Array, DOMElement, getStyleValue } from '../utils/dom'\nimport { ImageElement } from './custom-types'\n\nfunction getFloatValue($elem: Dom7Array): string {\n const styleFloat = getStyleValue($elem, 'float')\n\n if (styleFloat) { return styleFloat }\n\n const dataFloat = ($elem.attr('data-w-e-style-float') || '').trim()\n\n if (dataFloat) { return dataFloat }\n\n const classAttr = $elem.attr('class') || ''\n const classList = classAttr.trim().split(/\\s+/).filter(Boolean)\n\n if (classList.includes('w-e-float-image-left')) { return 'left' }\n if (classList.includes('w-e-float-image-right')) { return 'right' }\n if (classList.includes('w-e-float-image-none')) { return 'none' }\n\n return ''\n}\n\nfunction parseHtml(elem: DOMElement, _children: SlateDescendant[], _editor: IDomEditor): ImageElement {\n const $elem = $(elem)\n let href = $elem.attr('data-href') || ''\n const widthAttr = $elem.attr('width') || ''\n const heightAttr = $elem.attr('height') || ''\n const styleWidth = getStyleValue($elem, 'width') || $elem.attr('data-w-e-style-width') || widthAttr\n const styleHeight = getStyleValue($elem, 'height') || $elem.attr('data-w-e-style-height') || heightAttr\n const styleFloat = getFloatValue($elem)\n\n href = decodeURIComponent(href) // 兼容 V4\n\n return {\n type: 'image',\n src: $elem.attr('src') || '',\n alt: $elem.attr('alt') || '',\n href,\n style: {\n width: styleWidth,\n height: styleHeight,\n float: styleFloat,\n },\n width: widthAttr,\n height: heightAttr,\n children: [{ text: '' }], // void node 有一个空白 text\n }\n}\n\nexport const parseHtmlConf = {\n selector: 'img:not([data-w-e-type])', // data-w-e-type 属性,留给自定义元素,保证扩展性\n parseElemHtml: parseHtml,\n}\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n","/**\n * @description image render elem\n * @author wangfupeng\n */\n\nimport {\n DomEditor, IDomEditor, SlateElement, SlateTransforms,\n} from '@wangeditor-next/editor'\nimport throttle from 'lodash.throttle'\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { jsx, VNode } from 'snabbdom'\n\nimport $$, { Dom7Array } from '../utils/dom'\nimport { ImageElement } from './custom-types'\n\ninterface IImageSize {\n width?: string\n height?: string\n float?: string\n}\n\nfunction genContainerId(editor: IDomEditor, elemNode: SlateElement) {\n const { id } = DomEditor.findKey(editor, elemNode) // node 唯一 id\n\n return `w-e-image-container-${id}`\n}\n\n/**\n * 未选中时,渲染 image container\n */\nfunction renderContainer(\n editor: IDomEditor,\n elemNode: SlateElement,\n imageVnode: VNode,\n imageInfo: IImageSize,\n): VNode {\n const { width, height, float } = imageInfo\n\n const style: any = {}\n\n if (width) { style.width = width }\n if (height) { style.height = height }\n if (float) { style.float = float }\n\n const containerId = genContainerId(editor, elemNode)\n\n return (\n <div id={containerId} style={style} className=\"w-e-image-container\">\n {imageVnode}\n </div>\n ) as VNode\n}\n\n/**\n * 选中状态下,渲染 image container(渲染拖拽容器,修改图片尺寸)\n */\nfunction renderResizeContainer(\n editor: IDomEditor,\n elemNode: SlateElement,\n imageVnode: VNode,\n imageInfo: IImageSize,\n) {\n const $body = $$('body')\n const containerId = genContainerId(editor, elemNode)\n const { width, height, float } = imageInfo\n\n let originalX = 0\n let originalWith = 0\n let originalHeight = 0\n let revers = false // 是否反转。如向右拖拽 right-top 需增加宽度(非反转),但向右拖拽 left-top 则需要减少宽度(反转)\n let $container: Dom7Array | null = null\n\n function getContainerElem(): Dom7Array {\n const $containerFromDom = $$(`#${containerId}`)\n\n if ($containerFromDom.length === 0) { throw new Error('Cannot find image container elem') }\n return $containerFromDom\n }\n\n // mouseover callback (节流)\n const onMousemove = throttle((e: Event) => {\n e.preventDefault()\n\n const { clientX } = e as MouseEvent\n const gap = revers ? originalX - clientX : clientX - originalX // 考虑是否反转\n const newWidth = originalWith + gap\n const newHeight = originalHeight * (newWidth / originalWith) // 根据 width ,按比例计算 height\n\n // 实时修改 img 宽高 -【注意】这里只修改 DOM ,mouseup 时再统一不修改 node\n if ($container == null) { return }\n if (newWidth <= 15 || newHeight <= 15) { return } // 最小就是 15px\n\n $container.css('width', `${newWidth}px`)\n $container.css('height', `${newHeight}px`)\n }, 100)\n\n function onMouseup(_e: Event) {\n // 取消监听 mousemove\n $body.off('mousemove', onMousemove)\n\n if ($container == null) { return }\n const newWidth = $container.width().toFixed(2)\n const newHeight = $container.height().toFixed(2)\n\n // 修改 node\n const props: Partial<ImageElement> = {\n style: {\n ...(elemNode as ImageElement).style,\n width: `${newWidth}px`,\n height: `${newHeight}px`,\n },\n }\n\n SlateTransforms.setNodes(editor, props, { at: DomEditor.findPath(editor, elemNode) })\n\n // 取消监听 mouseup\n $body.off('mouseup', onMouseup)\n }\n\n /**\n * 初始化。监听事件,记录原始数据\n */\n function init(clientX: number) {\n $container = getContainerElem()\n\n // 记录当前 x 坐标值\n originalX = clientX\n\n // 记录 img 原始宽高\n const $img = $container.find('img')\n\n if ($img.length === 0) { throw new Error('Cannot find image elem') }\n originalWith = $img.width()\n originalHeight = $img.height()\n\n // 监听 mousemove\n $body.on('mousemove', onMousemove)\n\n // 监听 mouseup\n $body.on('mouseup', onMouseup)\n\n // 隐藏 hoverbar\n const hoverbar = DomEditor.getHoverbar(editor)\n\n if (hoverbar) { hoverbar.hideAndClean() }\n }\n\n const style: any = {}\n\n if (width) { style.width = width }\n if (height) { style.height = height }\n if (float) { style.float = float }\n // style.boxShadow = '0 0 0 1px #B4D5FF' // 自定义 selected 样式,因为有拖拽触手\n\n return (\n <div\n id={containerId}\n style={style}\n className=\"w-e-image-container w-e-selected-image-container\"\n on={{\n // 统一绑定拖拽触手的 mousedown 事件\n mousedown: (e: MouseEvent) => {\n const $target = $$(e.target as Element)\n\n if (!$target.hasClass('w-e-image-dragger')) {\n // target 不是 .w-e-image-dragger 拖拽触手,则忽略\n return\n }\n e.preventDefault()\n\n if ($target.hasClass('left-top') || $target.hasClass('left-bottom')) {\n revers = true // 反转。向右拖拽,减少宽度\n }\n init(e.clientX) // 初始化\n },\n }}\n >\n {imageVnode}\n\n {/* 拖拽的触手,会统一在上级 DOM 绑定拖拽事件 */}\n <div className=\"w-e-image-dragger left-top\"></div>\n <div className=\"w-e-image-dragger right-top\"></div>\n <div className=\"w-e-image-dragger left-bottom\"></div>\n <div className=\"w-e-image-dragger right-bottom\"></div>\n </div>\n )\n}\n\nfunction renderImage(elemNode: SlateElement, children: VNode[] | null, editor: IDomEditor): VNode {\n const {\n src, alt = '', href = '', style = {},\n } = elemNode as ImageElement\n const { width = '', height = '', float } = style\n const selected = DomEditor.isNodeSelected(editor, elemNode) // 图片是否选中\n\n const imageStyle: any = {}\n\n if (width) { imageStyle.width = '100%' }\n if (height) { imageStyle.height = '100%' }\n if (float) { imageStyle.float = float }\n\n // 【注意】void node 中,renderElem 不用处理 children 。core 会统一处理。\n const vnode = <img style={imageStyle} src={src} alt={alt} data-href={href}/>\n\n const isDisabled = editor.isDisabled()\n\n if (selected && !isDisabled) {\n // 选中,未禁用 - 渲染 resize container\n return renderResizeContainer(editor, elemNode, vnode, { width, height, float })\n }\n\n // 其他,渲染普通 image container\n return renderContainer(editor, elemNode, vnode, { width, height, float })\n}\n\nconst renderImageConf = {\n type: 'image', // 和 elemNode.type 一致\n renderElem: renderImage,\n}\n\nexport { renderImageConf }\n","/**\n * @description module entry\n * @author cycleccc\n */\n\nimport './local' // 多语言\n\nimport { IModuleConf } from '@wangeditor-next/editor'\n\nimport elemToHtmlConf from './elem-to-html'\nimport { imageFloatLeftMenuConf, imageFloatNoneMenuConf, imageFloatRightMenuConf } from './menu'\nimport { parseHtmlConf } from './parse-elem-html'\nimport { renderImageConf } from './render-elem'\n\nconst module: Partial<IModuleConf> = {\n renderElems: [renderImageConf],\n elemsToHtml: [elemToHtmlConf],\n parseElemsHtml: [parseHtmlConf],\n menus: [imageFloatLeftMenuConf, imageFloatRightMenuConf, imageFloatNoneMenuConf],\n}\n\nexport default module\n"],"names":["i18nAddResources","float","none","left","right","conf","type","elemToHtml","elem","_childrenHtml","editor","_a","src","_b","alt","_c","href","_d","style","_e","width","_f","height","_g","getTextStyleMode","widthData","concat","heightData","floatData","floatClass","val","trim","toLowerCase","getFloatClass","classAttr","styleStr","ImageFloatBaseClass","this","tag","prototype","getValue","_editor","isActive","getSelectedNode","DomEditor","getSelectedNodeByType","isDisabled","selection","exec","_value","imageNode","hoverbar","getHoverbar","hideAndClean","props","__assign","value","SlateTransforms","setNodes","match","n","checkNodeType","FloatLeft","_super","_this","title","t","iconSvg","__extends","FloatNone","FloatRight","imageFloatNoneMenuConf","key","factory","ImageFloatNone","imageFloatLeftMenuConf","ImageFloatLeft","imageFloatRightMenuConf","ImageFloatRight","getStyleValue","$elem","styleKey","res","styleArr","attr","split","length","i","styleItemStr","arr","css","$","fn","append","prepend","addClass","removeClass","hasClass","on","off","focus","removeAttr","hide","show","parents","dataset","text","html","children","remove","find","filter","empty","parseHtmlConf","selector","parseElemHtml","_children","widthAttr","heightAttr","styleWidth","styleHeight","styleFloat","dataFloat","classList","Boolean","includes","getFloatValue","decodeURIComponent","FUNC_ERROR_TEXT","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","parseInt","freeGlobal","global","Object","freeSelf","self","root","Function","objectToString","toString","nativeMax","Math","max","nativeMin","min","now","Date","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","TypeError","invokeFunc","time","args","thisArg","undefined","apply","shouldInvoke","timeSinceLastCall","timerExpired","trailingEdge","setTimeout","remainingWait","debounced","isInvoking","arguments","leadingEdge","toNumber","isObject","cancel","clearTimeout","flush","isObjectLike","call","isSymbol","other","valueOf","replace","isBinary","test","slice","lodash_throttle","genContainerId","elemNode","id","findKey","renderResizeContainer","imageVnode","imageInfo","$body","$$","containerId","originalX","originalWith","originalHeight","revers","$container","onMousemove","throttle","e","preventDefault","clientX","newWidth","newHeight","onMouseup","toFixed","at","findPath","init","$containerFromDom","Error","getContainerElem","$img","jsx","className","mousedown","$target","target","renderImageConf","renderElem","selected","isNodeSelected","imageStyle","vnode","renderContainer","module","renderElems","elemsToHtml","elemToHtmlConf","parseElemsHtml","menus"],"mappings":"kdAOAA,EAAiB,KAAM,CACrBC,MAAO,CACLC,KAAM,UACNC,KAAM,aACNC,MAAO,iBAIXJ,EAAiB,QAAS,CACxBC,MAAO,CACLC,KAAM,KACNC,KAAM,MACNC,MAAO,SC2BX,IAAMC,EAAO,CACXC,KAAM,QACNC,WA5BF,SAAqBC,EAAoBC,EAAuBC,GACxD,IAAAC,EAEFH,EADFI,EAAGD,EAAAC,IAAEC,EAAAF,EAAAG,IAAAA,OAAG,IAAAD,EAAG,GAAEA,EAAEE,SAAAC,OAAI,IAAAD,EAAG,GAAEA,EAAEE,EAAAN,EAAAO,MAAAA,OAAK,IAAAD,EAAG,CAAA,EAAEA,EAE9BE,EAAwCD,EAAKE,MAA7CA,OAAK,IAAAD,EAAG,GAAEA,EAAEE,EAA4BH,EAAKI,OAA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,CACnCC,YAAa,CAACR,IACdS,YAAa,CAACC,GACdC,eAAgB,CAACnI,GACjBoI,MAAO,CAAC1K,EAAwBE,EAAyBN","x_google_ignoreList":[10]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/module/local.ts","../src/module/elem-to-html.ts","../src/constants/icon-svg.ts","../src/module/menu/FloatBase.ts","../src/module/menu/FloatLeft.ts","../src/module/menu/FloatNone.ts","../src/module/menu/FloatRight.ts","../src/module/menu/index.ts","../src/utils/dom.ts","../src/module/parse-elem-html.ts","../../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js","../src/module/render-elem.tsx","../src/module/index.ts"],"sourcesContent":["/**\n * @description 多语言\n * @author cycleccc\n */\n\nimport { i18nAddResources } from '@wangeditor-next/editor'\n\ni18nAddResources('en', {\n float: {\n none: 'Default',\n left: 'Float Left',\n right: 'Float Right',\n },\n})\n\ni18nAddResources('zh-CN', {\n float: {\n none: '默认',\n left: '左浮动',\n right: '右浮动',\n },\n})\n","/**\n * @description elem to html\n * @author cycleccc\n */\n\nimport { getTextStyleMode, IDomEditor, SlateElement } from '@wangeditor-next/editor'\n\nimport { ImageElement } from './custom-types'\n\nfunction getFloatClass(float: string): string {\n const val = (float || '').trim().toLowerCase()\n\n if (val === 'left') { return 'w-e-float-image-left' }\n if (val === 'right') { return 'w-e-float-image-right' }\n if (val === 'none') { return 'w-e-float-image-none' }\n\n return ''\n}\n\n// 生成 html 的函数\nfunction imageToHtml(elem: SlateElement, _childrenHtml: string, editor?: IDomEditor): string {\n const {\n src, alt = '', href = '', style = {},\n } = elem as ImageElement\n const { width = '', height = '', float = '' } = style\n const mode = getTextStyleMode(editor)\n\n if (mode === 'class') {\n const widthData = width ? ` data-w-e-style-width=\"${width}\"` : ''\n const heightData = height ? ` data-w-e-style-height=\"${height}\"` : ''\n const floatData = float ? ` data-w-e-style-float=\"${float}\"` : ''\n const floatClass = getFloatClass(float)\n const classAttr = floatClass ? ` class=\"${floatClass}\"` : ''\n\n return `<img src=\"${src}\" alt=\"${alt}\" data-href=\"${href}\" width=\"${width}\" height=\"${height}\"${classAttr}${widthData}${heightData}${floatData}/>`\n }\n\n let styleStr = ''\n\n if (width) { styleStr += `width: ${width};` }\n if (height) { styleStr += `height: ${height};` }\n if (float) { styleStr += `float: ${float};` }\n return `<img src=\"${src}\" alt=\"${alt}\" data-href=\"${href}\" style=\"${styleStr}\"/>`\n}\n\n// 配置\nconst conf = {\n type: 'image', // 节点 type ,重要!!!\n elemToHtml: imageToHtml,\n}\n\nexport default conf\n","/**\n * @description icon svg\n * @author cycleccc\n */\n\n/**\n * 【注意】svg 字符串的长度 ,否则会导致代码体积过大\n * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293\n * 找不到再从 iconfont.com 搜索\n */\n\n// 默认不浮动\nexport const DEFAULT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M76.73805432 117.83964445m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.4275674l0 68.35162074q0 12.42756741-12.42756741 12.42756741l-845.0745837 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162074q0-12.42756741 12.42756741-12.4275674Z\"></path><path d=\"M76.73805432 801.35585185m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.42756741l0 68.35162074q0 12.42756741-12.42756741 12.42756742l-845.0745837 0q-12.42756741 0-12.42756741-12.42756742l0-68.35162074q0-12.42756741 12.42756741-12.42756741Z\"></path><path d=\"M89.16562173 304.25315556h410.10972444c6.83516208 0 12.42756741 5.59240533 12.42756741 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756741 12.4275674h-410.10972444a12.42756741 12.42756741 0 0 1-12.42756741-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756741-12.42756741z\"></path></svg>'\n// 左浮动\nexport const LEFT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z\"></path><path d=\"M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z\"></path><path d=\"M89.46270815 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.42756742 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756742 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.4275674-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.4275674-12.42756741z\"></path><path d=\"M512 552.8045037m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756742l0 68.35162073q0 12.42756741-12.4275674 12.42756741l-410.10972444 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162073q0-12.42756741 12.42756741-12.42756742Z\"></path><path d=\"M512 366.39099259m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756741l0 68.35162075q0 12.42756741-12.4275674 12.4275674l-410.10972444 0q-12.42756741 0-12.42756741-12.4275674l0-68.35162075q0-12.42756741 12.42756741-12.42756741Z\"></path></svg>'\n// 右浮动\nexport const RIGHT_FLOAT_SVG = '<svg viewBox=\"0 0 1024 1024\"><path d=\"M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z\"></path><path d=\"M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z\"></path><path d=\"M586.56540445 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.4275674 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.4275674 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.42756742-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756742-12.42756741z\"></path><path d=\"M77.03514075 552.8045037m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756742l0 68.35162073q0 12.42756741-12.42756741 12.42756741l-410.10972444 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162073q0-12.42756741 12.4275674-12.42756742Z\"></path><path d=\"M77.03514075 366.39099259m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756741l0 68.35162075q0 12.42756741-12.42756741 12.4275674l-410.10972444 0q-12.42756741 0-12.4275674-12.4275674l0-68.35162075q0-12.42756741 12.4275674-12.42756741Z\"></path></svg>'\n","/**\n * @description image float base class\n * @author cycleccc\n */\n\nimport {\n DomEditor, IButtonMenu, IDomEditor, SlateNode, SlateTransforms,\n} from '@wangeditor-next/editor'\n\nimport { ImageElement } from '../custom-types'\n\nabstract class ImageFloatBaseClass implements IButtonMenu {\n abstract readonly title: string // 菜单标题\n\n abstract readonly iconSvg: string // 图标\n\n abstract readonly value: string // css float 的值\n\n readonly tag = 'button'\n\n getValue(_editor: IDomEditor): string | boolean {\n // 无需获取 val\n return ''\n }\n\n isActive(_editor: IDomEditor): boolean {\n // 无需 active\n return false\n }\n\n private getSelectedNode(editor: IDomEditor): SlateNode | null {\n return DomEditor.getSelectedNodeByType(editor, 'image')\n }\n\n isDisabled(editor: IDomEditor): boolean {\n if (editor.selection == null) { return true }\n\n const imageNode = this.getSelectedNode(editor)\n\n return imageNode == null\n }\n\n exec(editor: IDomEditor, _value: string | boolean) {\n if (this.isDisabled(editor)) { return }\n\n const imageNode = this.getSelectedNode(editor)\n\n if (imageNode == null) { return }\n\n // 隐藏 hoverbar\n const hoverbar = DomEditor.getHoverbar(editor)\n\n if (hoverbar) { hoverbar.hideAndClean() }\n\n const { style = {} } = imageNode as ImageElement\n const props: Partial<ImageElement> = {\n style: {\n ...style,\n float: this.value, // 修改 float 的值\n },\n }\n\n SlateTransforms.setNodes(editor, props, {\n match: n => DomEditor.checkNodeType(n, 'image'),\n })\n }\n}\n\nexport default ImageFloatBaseClass\n","/**\n * @description float image left\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { LEFT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatLeft extends ImageFloatBaseClass {\n readonly title = t('float.left') // 菜单标题\n\n readonly value = 'left' // css float 的值\n\n readonly iconSvg = LEFT_FLOAT_SVG\n}\n\nexport default FloatLeft\n","/**\n * @description float image none\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { DEFAULT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatNone extends ImageFloatBaseClass {\n readonly title = t('float.none') // 菜单标题\n\n readonly value = 'none' // css float 的值\n\n readonly iconSvg = DEFAULT_FLOAT_SVG\n}\n\nexport default FloatNone\n","/**\n * @description float image right\n * @author cycleccc\n */\n\nimport { t } from '@wangeditor-next/editor'\n\nimport { RIGHT_FLOAT_SVG } from '../../constants/icon-svg'\nimport ImageFloatBaseClass from './FloatBase'\n\nclass FloatRight extends ImageFloatBaseClass {\n readonly title = t('float.right') // 菜单标题\n\n readonly value = 'right' // css float 的值\n\n readonly iconSvg = RIGHT_FLOAT_SVG\n}\n\nexport default FloatRight\n","/**\n * @description menu index\n * @author cycleccc\n */\n\nimport ImageFloatLeft from './FloatLeft'\nimport ImageFloatNone from './FloatNone'\nimport ImageFloatRight from './FloatRight'\n\nexport const imageFloatNoneMenuConf = {\n key: 'imageFloatNone',\n factory() {\n return new ImageFloatNone()\n },\n}\n\nexport const imageFloatLeftMenuConf = {\n key: 'imageFloatLeft',\n factory() {\n return new ImageFloatLeft()\n },\n}\n\nexport const imageFloatRightMenuConf = {\n key: 'imageFloatRight',\n factory() {\n return new ImageFloatRight()\n },\n}\n","/**\n * @description DOM 操作\n * @author cycleccc\n */\n\nimport $, {\n addClass,\n append,\n attr,\n children,\n css,\n dataset,\n Dom7Array,\n empty,\n filter,\n find,\n focus,\n hasClass,\n height,\n hide,\n html,\n off,\n on,\n parents,\n prepend,\n remove,\n removeAttr,\n removeClass,\n show,\n text,\n val,\n width,\n} from 'dom7'\n\n// COMPAT: This is required to prevent TypeScript aliases from doing some very\n// weird things for Slate's types with the same name as globals. (2019/11/27)\n// https://github.com/microsoft/TypeScript/issues/35002\nimport DOMNode = globalThis.Node\nimport DOMComment = globalThis.Comment\nimport DOMElement = globalThis.Element\nimport DOMText = globalThis.Text\nimport DOMRange = globalThis.Range\nimport DOMSelection = globalThis.Selection\nimport DOMStaticRange = globalThis.StaticRange\n\nexport type { Dom7Array } from 'dom7'\n\nif (css) { $.fn.css = css }\nif (append) { $.fn.append = append }\nif (prepend) { $.fn.prepend = prepend }\nif (addClass) { $.fn.addClass = addClass }\nif (removeClass) { $.fn.removeClass = removeClass }\nif (hasClass) { $.fn.hasClass = hasClass }\nif (on) { $.fn.on = on }\nif (off) { $.fn.off = off }\nif (focus) { $.fn.focus = focus }\nif (attr) { $.fn.attr = attr }\nif (removeAttr) { $.fn.removeAttr = removeAttr }\nif (hide) { $.fn.hide = hide }\nif (show) { $.fn.show = show }\nif (parents) { $.fn.parents = parents }\nif (dataset) { $.fn.dataset = dataset }\nif (val) { $.fn.val = val }\nif (text) { $.fn.text = text }\nif (html) { $.fn.html = html }\nif (children) { $.fn.children = children }\nif (remove) { $.fn.remove = remove }\nif (find) { $.fn.find = find }\nif (width) { $.fn.width = width }\nif (height) { $.fn.height = height }\nif (filter) { $.fn.filter = filter }\nif (empty) { $.fn.empty = empty }\n\nexport function getStyleValue($elem: Dom7Array, styleKey: string): string {\n let res = ''\n\n const styleStr = $elem.attr('style') || ''\n const styleArr = styleStr.split(';')\n const length = styleArr.length\n\n for (let i = 0; i < length; i += 1) {\n const styleItemStr = styleArr[i]\n\n if (styleItemStr) {\n const arr = styleItemStr.split(':')\n\n if (arr[0].trim() === styleKey) {\n res = arr[1].trim()\n }\n }\n }\n\n return res\n}\n\nexport default $\nexport {\n DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText,\n}\n","/**\n * @description parse elem html\n * @author cycleccc\n */\n\nimport { IDomEditor, SlateDescendant } from '@wangeditor-next/editor'\n\nimport $, { Dom7Array, DOMElement, getStyleValue } from '../utils/dom'\nimport { ImageElement } from './custom-types'\n\nfunction getFloatValue($elem: Dom7Array): string {\n const styleFloat = getStyleValue($elem, 'float')\n\n if (styleFloat) { return styleFloat }\n\n const dataFloat = ($elem.attr('data-w-e-style-float') || '').trim()\n\n if (dataFloat) { return dataFloat }\n\n const classAttr = $elem.attr('class') || ''\n const classList = classAttr.trim().split(/\\s+/).filter(Boolean)\n\n if (classList.includes('w-e-float-image-left')) { return 'left' }\n if (classList.includes('w-e-float-image-right')) { return 'right' }\n if (classList.includes('w-e-float-image-none')) { return 'none' }\n\n return ''\n}\n\nfunction parseHtml(elem: DOMElement, _children: SlateDescendant[], _editor: IDomEditor): ImageElement {\n const $elem = $(elem)\n let href = $elem.attr('data-href') || ''\n const widthAttr = $elem.attr('width') || ''\n const heightAttr = $elem.attr('height') || ''\n const styleWidth = getStyleValue($elem, 'width') || $elem.attr('data-w-e-style-width') || widthAttr\n const styleHeight = getStyleValue($elem, 'height') || $elem.attr('data-w-e-style-height') || heightAttr\n const styleFloat = getFloatValue($elem)\n\n href = decodeURIComponent(href) // 兼容 V4\n\n return {\n type: 'image',\n src: $elem.attr('src') || '',\n alt: $elem.attr('alt') || '',\n href,\n style: {\n width: styleWidth,\n height: styleHeight,\n float: styleFloat,\n },\n width: widthAttr,\n height: heightAttr,\n children: [{ text: '' }], // void node 有一个空白 text\n }\n}\n\nexport const parseHtmlConf = {\n selector: 'img:not([data-w-e-type])', // data-w-e-type 属性,留给自定义元素,保证扩展性\n parseElemHtml: parseHtml,\n}\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n","/**\n * @description image render elem\n * @author wangfupeng\n */\n\nimport {\n DomEditor, IDomEditor, SlateElement, SlateTransforms,\n} from '@wangeditor-next/editor'\nimport throttle from 'lodash.throttle'\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { jsx, VNode } from 'snabbdom'\n\nimport $$, { Dom7Array } from '../utils/dom'\nimport { ImageElement } from './custom-types'\n\ninterface IImageSize {\n width?: string\n height?: string\n float?: string\n}\n\nfunction genContainerId(editor: IDomEditor, elemNode: SlateElement) {\n const { id } = DomEditor.findKey(editor, elemNode) // node 唯一 id\n\n return `w-e-image-container-${id}`\n}\n\n/**\n * 未选中时,渲染 image container\n */\nfunction renderContainer(\n editor: IDomEditor,\n elemNode: SlateElement,\n imageVnode: VNode,\n imageInfo: IImageSize,\n): VNode {\n const { width, height, float } = imageInfo\n\n const style: any = {}\n\n if (width) { style.width = width }\n if (height) { style.height = height }\n if (float) { style.float = float }\n\n const containerId = genContainerId(editor, elemNode)\n\n return (\n <div id={containerId} style={style} className=\"w-e-image-container\">\n {imageVnode}\n </div>\n ) as VNode\n}\n\n/**\n * 选中状态下,渲染 image container(渲染拖拽容器,修改图片尺寸)\n */\nfunction renderResizeContainer(\n editor: IDomEditor,\n elemNode: SlateElement,\n imageVnode: VNode,\n imageInfo: IImageSize,\n) {\n const $body = $$('body')\n const containerId = genContainerId(editor, elemNode)\n const { width, height, float } = imageInfo\n\n let originalX = 0\n let originalWith = 0\n let originalHeight = 0\n let revers = false // 是否反转。如向右拖拽 right-top 需增加宽度(非反转),但向右拖拽 left-top 则需要减少宽度(反转)\n let $container: Dom7Array | null = null\n\n function getContainerElem(): Dom7Array {\n const $containerFromDom = $$(`#${containerId}`)\n\n if ($containerFromDom.length === 0) { throw new Error('Cannot find image container elem') }\n return $containerFromDom\n }\n\n // mouseover callback (节流)\n const onMousemove = throttle((e: Event) => {\n e.preventDefault()\n\n const { clientX } = e as MouseEvent\n const gap = revers ? originalX - clientX : clientX - originalX // 考虑是否反转\n const newWidth = originalWith + gap\n const newHeight = originalHeight * (newWidth / originalWith) // 根据 width ,按比例计算 height\n\n // 实时修改 img 宽高 -【注意】这里只修改 DOM ,mouseup 时再统一不修改 node\n if ($container == null) { return }\n if (newWidth <= 15 || newHeight <= 15) { return } // 最小就是 15px\n\n $container.css('width', `${newWidth}px`)\n $container.css('height', `${newHeight}px`)\n }, 100)\n\n function onMouseup(_e: Event) {\n // 取消监听 mousemove\n $body.off('mousemove', onMousemove)\n\n if ($container == null) { return }\n const newWidth = $container.width().toFixed(2)\n const newHeight = $container.height().toFixed(2)\n\n // 修改 node\n const props: Partial<ImageElement> = {\n style: {\n ...(elemNode as ImageElement).style,\n width: `${newWidth}px`,\n height: `${newHeight}px`,\n },\n }\n\n SlateTransforms.setNodes(editor, props, { at: DomEditor.findPath(editor, elemNode) })\n\n // 取消监听 mouseup\n $body.off('mouseup', onMouseup)\n }\n\n /**\n * 初始化。监听事件,记录原始数据\n */\n function init(clientX: number) {\n $container = getContainerElem()\n\n // 记录当前 x 坐标值\n originalX = clientX\n\n // 记录 img 原始宽高\n const $img = $container.find('img')\n\n if ($img.length === 0) { throw new Error('Cannot find image elem') }\n originalWith = $img.width()\n originalHeight = $img.height()\n\n // 监听 mousemove\n $body.on('mousemove', onMousemove)\n\n // 监听 mouseup\n $body.on('mouseup', onMouseup)\n\n // 隐藏 hoverbar\n const hoverbar = DomEditor.getHoverbar(editor)\n\n if (hoverbar) { hoverbar.hideAndClean() }\n }\n\n const style: any = {}\n\n if (width) { style.width = width }\n if (height) { style.height = height }\n if (float) { style.float = float }\n // style.boxShadow = '0 0 0 1px #B4D5FF' // 自定义 selected 样式,因为有拖拽触手\n\n return (\n <div\n id={containerId}\n style={style}\n className=\"w-e-image-container w-e-selected-image-container\"\n on={{\n // 统一绑定拖拽触手的 mousedown 事件\n mousedown: (e: MouseEvent) => {\n const $target = $$(e.target as Element)\n\n if (!$target.hasClass('w-e-image-dragger')) {\n // target 不是 .w-e-image-dragger 拖拽触手,则忽略\n return\n }\n e.preventDefault()\n\n if ($target.hasClass('left-top') || $target.hasClass('left-bottom')) {\n revers = true // 反转。向右拖拽,减少宽度\n }\n init(e.clientX) // 初始化\n },\n }}\n >\n {imageVnode}\n\n {/* 拖拽的触手,会统一在上级 DOM 绑定拖拽事件 */}\n <div className=\"w-e-image-dragger left-top\"></div>\n <div className=\"w-e-image-dragger right-top\"></div>\n <div className=\"w-e-image-dragger left-bottom\"></div>\n <div className=\"w-e-image-dragger right-bottom\"></div>\n </div>\n )\n}\n\nfunction renderImage(elemNode: SlateElement, children: VNode[] | null, editor: IDomEditor): VNode {\n const {\n src, alt = '', href = '', style = {},\n } = elemNode as ImageElement\n const { width = '', height = '', float } = style\n const selected = DomEditor.isNodeSelected(editor, elemNode) // 图片是否选中\n\n const imageStyle: any = {}\n\n if (width) { imageStyle.width = '100%' }\n if (height) { imageStyle.height = '100%' }\n if (float) { imageStyle.float = float }\n\n // 【注意】void node 中,renderElem 不用处理 children 。core 会统一处理。\n const vnode = <img style={imageStyle} src={src} alt={alt} data-href={href}/>\n\n const isDisabled = editor.isDisabled()\n\n if (selected && !isDisabled) {\n // 选中,未禁用 - 渲染 resize container\n return renderResizeContainer(editor, elemNode, vnode, { width, height, float })\n }\n\n // 其他,渲染普通 image container\n return renderContainer(editor, elemNode, vnode, { width, height, float })\n}\n\nconst renderImageConf = {\n type: 'image', // 和 elemNode.type 一致\n renderElem: renderImage,\n}\n\nexport { renderImageConf }\n","/**\n * @description module entry\n * @author cycleccc\n */\n\nimport './local' // 多语言\n\nimport { IModuleConf } from '@wangeditor-next/editor'\n\nimport elemToHtmlConf from './elem-to-html'\nimport { imageFloatLeftMenuConf, imageFloatNoneMenuConf, imageFloatRightMenuConf } from './menu'\nimport { parseHtmlConf } from './parse-elem-html'\nimport { renderImageConf } from './render-elem'\n\nconst module: Partial<IModuleConf> = {\n renderElems: [renderImageConf],\n elemsToHtml: [elemToHtmlConf],\n parseElemsHtml: [parseHtmlConf],\n menus: [imageFloatLeftMenuConf, imageFloatRightMenuConf, imageFloatNoneMenuConf],\n}\n\nexport default module\n"],"names":["i18nAddResources","float","none","left","right","conf","type","elemToHtml","elem","_childrenHtml","editor","_a","src","_b","alt","_c","href","_d","style","_e","width","_f","height","_g","getTextStyleMode","widthData","concat","heightData","floatData","floatClass","val","trim","toLowerCase","getFloatClass","classAttr","styleStr","ImageFloatBaseClass","this","tag","prototype","getValue","_editor","isActive","getSelectedNode","DomEditor","getSelectedNodeByType","isDisabled","selection","exec","_value","imageNode","hoverbar","getHoverbar","hideAndClean","props","__assign","value","SlateTransforms","setNodes","match","n","checkNodeType","FloatLeft","_super","_this","title","t","iconSvg","__extends","FloatNone","FloatRight","imageFloatNoneMenuConf","key","factory","ImageFloatNone","imageFloatLeftMenuConf","ImageFloatLeft","imageFloatRightMenuConf","ImageFloatRight","getStyleValue","$elem","styleKey","res","styleArr","attr","split","length","i","styleItemStr","arr","css","$","fn","append","prepend","addClass","removeClass","hasClass","on","off","focus","removeAttr","hide","show","parents","dataset","text","html","children","remove","find","filter","empty","parseHtmlConf","selector","parseElemHtml","_children","widthAttr","heightAttr","styleWidth","styleHeight","styleFloat","dataFloat","classList","Boolean","includes","getFloatValue","decodeURIComponent","FUNC_ERROR_TEXT","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","parseInt","freeGlobal","global","Object","freeSelf","self","root","Function","objectToString","toString","nativeMax","Math","max","nativeMin","min","now","Date","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","TypeError","invokeFunc","time","args","thisArg","undefined","apply","shouldInvoke","timeSinceLastCall","timerExpired","trailingEdge","setTimeout","remainingWait","debounced","isInvoking","arguments","leadingEdge","toNumber","isObject","cancel","clearTimeout","flush","isObjectLike","call","isSymbol","other","valueOf","replace","isBinary","test","slice","lodash_throttle","genContainerId","elemNode","id","findKey","renderResizeContainer","imageVnode","imageInfo","$body","$$","containerId","originalX","originalWith","originalHeight","revers","$container","onMousemove","throttle","e","preventDefault","clientX","newWidth","newHeight","onMouseup","toFixed","at","findPath","init","$containerFromDom","Error","getContainerElem","$img","jsx","className","mousedown","$target","target","renderImageConf","renderElem","selected","isNodeSelected","imageStyle","vnode","renderContainer","module","renderElems","elemsToHtml","elemToHtmlConf","parseElemsHtml","menus"],"mappings":"kdAOAA,EAAiB,KAAM,CACrBC,MAAO,CACLC,KAAM,UACNC,KAAM,aACNC,MAAO,iBAIXJ,EAAiB,QA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EAAyBuL,EAASvL,MAA3BE,EAAkBqL,EAASrL,OAAnBrB,EAAU0M,QAE3BzL,EAAa,CAAA,EAEfE,IAASF,EAAME,MAAQA,GACvBE,IAAUJ,EAAMI,OAASA,GACzBrB,IAASiB,EAAMjB,MAAQA,GAE3B,IAAM6M,EAAcT,EAAe3L,EAAQ4L,GAE3C,OACE8B,EAAA,MAAA,CAAK7B,GAAIO,EAAa5L,MAAOA,EAAOmN,UAAU,uBAC3C3B,EAGP,CAiKSqC,CAAgBrO,EAAQ4L,EAAUwC,EAAO,CAAE1N,MAAKA,EAAEE,OAAMA,EAAErB,MAAKA,GACxE,GCvMM+O,GAA+B,CACnCC,YAAa,CAACR,IACdS,YAAa,CAACC,GACdC,eAAgB,CAACnI,GACjBoI,MAAO,CAAC1K,EAAwBE,EAAyBN","x_google_ignoreList":[10]}
|
|
@@ -10,7 +10,7 @@ import DOMText = globalThis.Text;
|
|
|
10
10
|
import DOMRange = globalThis.Range;
|
|
11
11
|
import DOMSelection = globalThis.Selection;
|
|
12
12
|
import DOMStaticRange = globalThis.StaticRange;
|
|
13
|
-
export { Dom7Array } from 'dom7';
|
|
13
|
+
export type { Dom7Array } from 'dom7';
|
|
14
14
|
export declare function getStyleValue($elem: Dom7Array, styleKey: string): string;
|
|
15
15
|
export default $;
|
|
16
16
|
export { DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText, };
|
|
@@ -10,7 +10,7 @@ import DOMText = globalThis.Text;
|
|
|
10
10
|
import DOMRange = globalThis.Range;
|
|
11
11
|
import DOMSelection = globalThis.Selection;
|
|
12
12
|
import DOMStaticRange = globalThis.StaticRange;
|
|
13
|
-
export { Dom7Array } from 'dom7';
|
|
13
|
+
export type { Dom7Array } from 'dom7';
|
|
14
14
|
export default $;
|
|
15
15
|
/**
|
|
16
16
|
* 获取 tagName lower-case
|
|
@@ -8,18 +8,9 @@ export interface WithTableOptions {
|
|
|
8
8
|
tr: ElementType;
|
|
9
9
|
table: ElementType;
|
|
10
10
|
tbody: ElementType;
|
|
11
|
-
tfoot
|
|
12
|
-
thead
|
|
11
|
+
tfoot?: ElementType;
|
|
12
|
+
thead?: ElementType;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
export declare const DEFAULT_WITH_TABLE_OPTIONS:
|
|
16
|
-
blocks: {
|
|
17
|
-
td: string;
|
|
18
|
-
th: string;
|
|
19
|
-
content: string;
|
|
20
|
-
tr: string;
|
|
21
|
-
table: string;
|
|
22
|
-
tbody: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
15
|
+
export declare const DEFAULT_WITH_TABLE_OPTIONS: WithTableOptions;
|
|
25
16
|
export {};
|
|
@@ -11,7 +11,7 @@ import DOMText = globalThis.Text;
|
|
|
11
11
|
import DOMRange = globalThis.Range;
|
|
12
12
|
import DOMSelection = globalThis.Selection;
|
|
13
13
|
import DOMStaticRange = globalThis.StaticRange;
|
|
14
|
-
export { Dom7Array } from 'dom7';
|
|
14
|
+
export type { Dom7Array } from 'dom7';
|
|
15
15
|
export default $;
|
|
16
16
|
/**
|
|
17
17
|
* 获取 tagName lower-case
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangeditor-next/plugin-float-image",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "wangEditor float image plugin",
|
|
5
5
|
"author": "cycleccc <2991205548@qq.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dom7": "^3.0.0 || ^4.0.0",
|
|
38
38
|
"slate": "^0.124.0",
|
|
39
39
|
"snabbdom": "^3.6.0",
|
|
40
|
-
"@wangeditor-next/editor": "^6.
|
|
40
|
+
"@wangeditor-next/editor": "^6.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@wangeditor-next-shared/rollup-config": "^0.0.2"
|