@wangeditor-next/plugin-float-image 3.0.0 → 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/header/parse-elem-html.d.ts +2 -2
- 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 +32 -2
- package/dist/core/src/editor/interface.d.ts +16 -3
- package/dist/core/src/index.d.ts +4 -2
- package/dist/core/src/render/helper.d.ts +1 -2
- package/dist/core/src/to-html/index.d.ts +12 -0
- package/dist/core/src/utils/dom.d.ts +1 -1
- package/dist/editor/src/Boot.d.ts +2 -2
- 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/list-module/src/locale/en.d.ts +3 -0
- package/dist/list-module/src/locale/zh-CN.d.ts +3 -0
- package/dist/list-module/src/module/custom-types.d.ts +13 -0
- package/dist/list-module/src/module/helpers.d.ts +14 -4
- package/dist/list-module/src/module/html-transform.d.ts +10 -0
- package/dist/list-module/src/module/menu/BaseMenu.d.ts +2 -2
- package/dist/list-module/src/module/outline-actions.d.ts +9 -0
- package/dist/list-module/src/module/parse-elem-html.d.ts +1 -2
- package/dist/list-module/src/module/plugin.d.ts +1 -1
- package/dist/list-module/src/utils/maps.d.ts +2 -1
- package/dist/plugin-float-image/src/utils/dom.d.ts +1 -1
- package/dist/table-module/src/module/menu/CellProperty.d.ts +2 -1
- package/dist/table-module/src/module/menu/TableProperty.d.ts +2 -1
- package/dist/table-module/src/module/render-elem/selection-overlay.d.ts +21 -0
- package/dist/table-module/src/module/weak-maps.d.ts +3 -2
- 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 +3 -3
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,EAAK,KAAM,GACzDO,EAAaL,EAAS,2BAAAI,OAA2BJ,EAAM,KAAM,GAC7DM,EAAY3B,EAAQ,0BAAAyB,OAA0BzB,EAAK,KAAM,GACzD4B,EAtBV,SAAuB5B,GACrB,IAAM6B,GAAO7B,GAAS,IAAI8B,OAAOC,cAEjC,MAAY,SAARF,EAAyB,uBACjB,UAARA,EAA0B,wBAClB,SAARA,EAAyB,uBAEtB,EACT,CAcu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.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,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,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J,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,OAAjCA,OAAM,IAAAD,EAAG,GAAEA,EAAEE,EAAeL,EAAKjB,MAApBA,OAAK,IAAAsB,EAAG,GAAEA,EAG3C,GAAa,UAFAC,EAAiBd,GAER,CACpB,IAAMe,EAAYL,EAAQ,0BAAAM,OAA0BN,EAAK,KAAM,GACzDO,EAAaL,EAAS,2BAAAI,OAA2BJ,EAAM,KAAM,GAC7DM,EAAY3B,EAAQ,0BAAAyB,OAA0BzB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AmCH,EAAKE,MAAxCA,OAAK,IAAAC,EAAG,GAAEA,EAAEE,EAAuBL,SAAvBI,aAAS,GAAEC,EAAEtB,EAAUiB,EAAKjB,MAC1C0O,EAAW/L,EAAUgM,eAAelO,EAAQ4L,GAE5CuC,EAAkB,CAAA,EAEpBzN,IAASyN,EAAWzN,MAAQ,QAC5BE,IAAUuN,EAAWvN,OAAS,QAC9BrB,IAAS4O,EAAW5O,MAAQA,GAGhC,IAAM6O,EAAQV,EAAA,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,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]}
|
|
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,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,EAA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mN,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]}
|
|
@@ -4,11 +4,24 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Text } from 'slate';
|
|
6
6
|
export type OrderedListType = '1' | 'a' | 'A' | 'i' | 'I';
|
|
7
|
+
/**
|
|
8
|
+
* An outline keeps the established list-item wire format and records the
|
|
9
|
+
* heading semantics as additive metadata.
|
|
10
|
+
*/
|
|
11
|
+
export type HeadingType = 'header1' | 'header2' | 'header3' | 'header4' | 'header5' | 'header6';
|
|
7
12
|
export type ListItemElement = {
|
|
8
13
|
type: 'list-item';
|
|
9
14
|
ordered: boolean;
|
|
10
15
|
level: number;
|
|
11
16
|
start?: number;
|
|
12
17
|
orderType?: OrderedListType;
|
|
18
|
+
headingType?: HeadingType;
|
|
19
|
+
listMode?: 'outline';
|
|
20
|
+
listRestart?: number;
|
|
13
21
|
children: Text[];
|
|
14
22
|
};
|
|
23
|
+
export type OutlineListItemElement = ListItemElement & {
|
|
24
|
+
ordered: true;
|
|
25
|
+
headingType: HeadingType;
|
|
26
|
+
listMode: 'outline';
|
|
27
|
+
};
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @description
|
|
3
|
-
* @author wangfupeng
|
|
2
|
+
* @description list helpers
|
|
4
3
|
*/
|
|
5
4
|
import { IDomEditor } from '@wangeditor-next/core';
|
|
6
|
-
import {
|
|
5
|
+
import { Node } from 'slate';
|
|
6
|
+
import { HeadingType, ListItemElement, OrderedListType, OutlineListItemElement } from './custom-types';
|
|
7
|
+
export declare function isListNode(node: Node): node is ListItemElement;
|
|
8
|
+
export declare const isLegacyListItem: typeof isListNode;
|
|
9
|
+
export declare function isHeadingType(value: unknown): value is HeadingType;
|
|
10
|
+
export declare function getHeadingType(node: Node): HeadingType | null;
|
|
11
|
+
export declare function getListIndent(node: Node): number;
|
|
12
|
+
export declare function getListMode(node: Node): 'standard' | 'outline';
|
|
13
|
+
export declare function isOutlineListNode(node: Node): node is OutlineListItemElement;
|
|
14
|
+
export declare function getOutlineLevel(node: Node): number;
|
|
7
15
|
export declare function getNormalizedOrderedListStart(elem: ListItemElement): number;
|
|
8
16
|
export declare function getNormalizedOrderedListType(elem: ListItemElement): OrderedListType;
|
|
9
17
|
export declare function hasSameListConfig(a: ListItemElement, b: ListItemElement): boolean;
|
|
18
|
+
export declare function getOrderedItemNumber(editor: IDomEditor, elem: ListItemElement): number;
|
|
19
|
+
export declare function getOutlineNumber(editor: IDomEditor, elem: ListItemElement): string;
|
|
10
20
|
/**
|
|
11
21
|
* 获取上一个同一 level 的 list item
|
|
12
|
-
* @param editor
|
|
22
|
+
* @param editor editor
|
|
13
23
|
* @param elem elem
|
|
14
24
|
*/
|
|
15
25
|
export declare function getBrotherListNodeByLevel(editor: IDomEditor, elem: ListItemElement, level?: number): ListItemElement | null;
|