@wangeditor-next/plugin-float-image 0.1.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.
Files changed (418) hide show
  1. package/dist/basic-modules/src/constants/icon-svg.d.ts +47 -0
  2. package/dist/basic-modules/src/index.d.ts +9 -0
  3. package/dist/basic-modules/src/locale/en.d.ts +101 -0
  4. package/dist/basic-modules/src/locale/index.d.ts +5 -0
  5. package/dist/basic-modules/src/locale/zh-CN.d.ts +101 -0
  6. package/dist/basic-modules/src/modules/blockquote/custom-types.d.ts +9 -0
  7. package/dist/basic-modules/src/modules/blockquote/elem-to-html.d.ts +11 -0
  8. package/dist/basic-modules/src/modules/blockquote/index.d.ts +7 -0
  9. package/dist/basic-modules/src/modules/blockquote/menu/BlockquoteMenu.d.ts +20 -0
  10. package/dist/basic-modules/src/modules/blockquote/menu/index.d.ts +9 -0
  11. package/dist/basic-modules/src/modules/blockquote/parse-elem-html.d.ts +14 -0
  12. package/dist/basic-modules/src/modules/blockquote/plugin.d.ts +7 -0
  13. package/dist/basic-modules/src/modules/blockquote/render-elem.d.ts +20 -0
  14. package/dist/basic-modules/src/modules/code-block/custom-types.d.ts +17 -0
  15. package/dist/basic-modules/src/modules/code-block/elem-to-html.d.ts +16 -0
  16. package/dist/basic-modules/src/modules/code-block/index.d.ts +7 -0
  17. package/dist/basic-modules/src/modules/code-block/menu/CodeBlockMenu.d.ts +22 -0
  18. package/dist/basic-modules/src/modules/code-block/menu/index.d.ts +9 -0
  19. package/dist/basic-modules/src/modules/code-block/parse-elem-html.d.ts +19 -0
  20. package/dist/basic-modules/src/modules/code-block/plugin.d.ts +7 -0
  21. package/dist/basic-modules/src/modules/code-block/pre-parse-html.d.ts +15 -0
  22. package/dist/basic-modules/src/modules/code-block/render-elem.d.ts +18 -0
  23. package/dist/basic-modules/src/modules/color/custom-types.d.ts +9 -0
  24. package/dist/basic-modules/src/modules/color/index.d.ts +7 -0
  25. package/dist/basic-modules/src/modules/color/menu/BaseMenu.d.ts +20 -0
  26. package/dist/basic-modules/src/modules/color/menu/BgColorMenu.d.ts +11 -0
  27. package/dist/basic-modules/src/modules/color/menu/ColorMenu.d.ts +11 -0
  28. package/dist/basic-modules/src/modules/color/menu/config.d.ts +6 -0
  29. package/dist/basic-modules/src/modules/color/menu/index.d.ts +20 -0
  30. package/dist/basic-modules/src/modules/color/parse-style-html.d.ts +8 -0
  31. package/dist/basic-modules/src/modules/color/pre-parse-html.d.ts +15 -0
  32. package/dist/basic-modules/src/modules/color/render-style.d.ts +13 -0
  33. package/dist/basic-modules/src/modules/color/style-to-html.d.ts +12 -0
  34. package/dist/basic-modules/src/modules/common/index.d.ts +7 -0
  35. package/dist/basic-modules/src/modules/common/menu/EnterMenu.d.ts +15 -0
  36. package/dist/basic-modules/src/modules/common/menu/index.d.ts +9 -0
  37. package/dist/basic-modules/src/modules/divider/custom-types.d.ts +12 -0
  38. package/dist/basic-modules/src/modules/divider/elem-to-html.d.ts +11 -0
  39. package/dist/basic-modules/src/modules/divider/index.d.ts +7 -0
  40. package/dist/basic-modules/src/modules/divider/menu/InsertDividerMenu.d.ts +15 -0
  41. package/dist/basic-modules/src/modules/divider/menu/index.d.ts +9 -0
  42. package/dist/basic-modules/src/modules/divider/parse-elem-html.d.ts +14 -0
  43. package/dist/basic-modules/src/modules/divider/plugin.d.ts +7 -0
  44. package/dist/basic-modules/src/modules/divider/render-elem.d.ts +13 -0
  45. package/dist/basic-modules/src/modules/emotion/index.d.ts +7 -0
  46. package/dist/basic-modules/src/modules/emotion/menu/EmotionMenu.d.ts +19 -0
  47. package/dist/basic-modules/src/modules/emotion/menu/config.d.ts +5 -0
  48. package/dist/basic-modules/src/modules/emotion/menu/index.d.ts +12 -0
  49. package/dist/basic-modules/src/modules/font-size-family/custom-types.d.ts +9 -0
  50. package/dist/basic-modules/src/modules/font-size-family/index.d.ts +7 -0
  51. package/dist/basic-modules/src/modules/font-size-family/menu/BaseMenu.d.ts +18 -0
  52. package/dist/basic-modules/src/modules/font-size-family/menu/FontFamilyMenu.d.ts +14 -0
  53. package/dist/basic-modules/src/modules/font-size-family/menu/FontSizeMenu.d.ts +13 -0
  54. package/dist/basic-modules/src/modules/font-size-family/menu/config.d.ts +12 -0
  55. package/dist/basic-modules/src/modules/font-size-family/menu/index.d.ts +26 -0
  56. package/dist/basic-modules/src/modules/font-size-family/parse-style-html.d.ts +8 -0
  57. package/dist/basic-modules/src/modules/font-size-family/pre-parse-html.d.ts +15 -0
  58. package/dist/basic-modules/src/modules/font-size-family/render-style.d.ts +13 -0
  59. package/dist/basic-modules/src/modules/font-size-family/style-to-html.d.ts +12 -0
  60. package/dist/basic-modules/src/modules/format-painter/helper.d.ts +3 -0
  61. package/dist/basic-modules/src/modules/format-painter/index.d.ts +7 -0
  62. package/dist/basic-modules/src/modules/format-painter/menu/FormatPainter.d.ts +22 -0
  63. package/dist/basic-modules/src/modules/format-painter/menu/index.d.ts +9 -0
  64. package/dist/basic-modules/src/modules/format-painter/plugin.d.ts +7 -0
  65. package/dist/basic-modules/src/modules/full-screen/index.d.ts +7 -0
  66. package/dist/basic-modules/src/modules/full-screen/menu/FullScreen.d.ts +18 -0
  67. package/dist/basic-modules/src/modules/full-screen/menu/index.d.ts +9 -0
  68. package/dist/basic-modules/src/modules/header/custom-types.d.ts +29 -0
  69. package/dist/basic-modules/src/modules/header/elem-to-html.d.ts +29 -0
  70. package/dist/basic-modules/src/modules/header/helper.d.ts +14 -0
  71. package/dist/basic-modules/src/modules/header/index.d.ts +7 -0
  72. package/dist/basic-modules/src/modules/header/menu/Header1ButtonMenu.d.ts +10 -0
  73. package/dist/basic-modules/src/modules/header/menu/Header2ButtonMenu.d.ts +10 -0
  74. package/dist/basic-modules/src/modules/header/menu/Header3ButtonMenu.d.ts +10 -0
  75. package/dist/basic-modules/src/modules/header/menu/Header4ButtonMenu.d.ts +10 -0
  76. package/dist/basic-modules/src/modules/header/menu/Header5ButtonMenu.d.ts +10 -0
  77. package/dist/basic-modules/src/modules/header/menu/Header6ButtonMenu.d.ts +10 -0
  78. package/dist/basic-modules/src/modules/header/menu/HeaderButtonMenuBase.d.ts +19 -0
  79. package/dist/basic-modules/src/modules/header/menu/HeaderSelectMenu.d.ts +26 -0
  80. package/dist/basic-modules/src/modules/header/menu/index.d.ts +39 -0
  81. package/dist/basic-modules/src/modules/header/parse-elem-html.d.ts +32 -0
  82. package/dist/basic-modules/src/modules/header/plugin.d.ts +7 -0
  83. package/dist/basic-modules/src/modules/header/render-elem.d.ts +32 -0
  84. package/dist/basic-modules/src/modules/image/custom-types.d.ts +22 -0
  85. package/dist/basic-modules/src/modules/image/elem-to-html.d.ts +11 -0
  86. package/dist/basic-modules/src/modules/image/helper.d.ts +13 -0
  87. package/dist/basic-modules/src/modules/image/index.d.ts +7 -0
  88. package/dist/basic-modules/src/modules/image/menu/DeleteImage.d.ts +15 -0
  89. package/dist/basic-modules/src/modules/image/menu/EditImage.d.ts +28 -0
  90. package/dist/basic-modules/src/modules/image/menu/EditImageSizeMenu.d.ts +25 -0
  91. package/dist/basic-modules/src/modules/image/menu/InsertImage.d.ts +27 -0
  92. package/dist/basic-modules/src/modules/image/menu/ViewImageLink.d.ts +15 -0
  93. package/dist/basic-modules/src/modules/image/menu/Width100.d.ts +10 -0
  94. package/dist/basic-modules/src/modules/image/menu/Width30.d.ts +10 -0
  95. package/dist/basic-modules/src/modules/image/menu/Width50.d.ts +10 -0
  96. package/dist/basic-modules/src/modules/image/menu/WidthBase.d.ts +16 -0
  97. package/dist/basic-modules/src/modules/image/menu/config.d.ts +30 -0
  98. package/dist/basic-modules/src/modules/image/menu/index.d.ts +56 -0
  99. package/dist/basic-modules/src/modules/image/parse-elem-html.d.ts +14 -0
  100. package/dist/basic-modules/src/modules/image/plugin.d.ts +7 -0
  101. package/dist/basic-modules/src/modules/image/render-elem.d.ts +13 -0
  102. package/dist/basic-modules/src/modules/indent/custom-types.d.ts +10 -0
  103. package/dist/basic-modules/src/modules/indent/index.d.ts +7 -0
  104. package/dist/basic-modules/src/modules/indent/menu/BaseMenu.d.ts +25 -0
  105. package/dist/basic-modules/src/modules/indent/menu/DecreaseIndentMenu.d.ts +13 -0
  106. package/dist/basic-modules/src/modules/indent/menu/IncreaseIndentMenu.d.ts +15 -0
  107. package/dist/basic-modules/src/modules/indent/menu/index.d.ts +14 -0
  108. package/dist/basic-modules/src/modules/indent/parse-style-html.d.ts +8 -0
  109. package/dist/basic-modules/src/modules/indent/pre-parse-html.d.ts +15 -0
  110. package/dist/basic-modules/src/modules/indent/render-style.d.ts +13 -0
  111. package/dist/basic-modules/src/modules/indent/style-to-html.d.ts +6 -0
  112. package/dist/basic-modules/src/modules/justify/custom-types.d.ts +10 -0
  113. package/dist/basic-modules/src/modules/justify/index.d.ts +7 -0
  114. package/dist/basic-modules/src/modules/justify/menu/BaseMenu.d.ts +15 -0
  115. package/dist/basic-modules/src/modules/justify/menu/JustifyCenterMenu.d.ts +12 -0
  116. package/dist/basic-modules/src/modules/justify/menu/JustifyJustifyMenu.d.ts +12 -0
  117. package/dist/basic-modules/src/modules/justify/menu/JustifyLeftMenu.d.ts +12 -0
  118. package/dist/basic-modules/src/modules/justify/menu/JustifyRightMenu.d.ts +12 -0
  119. package/dist/basic-modules/src/modules/justify/menu/index.d.ts +24 -0
  120. package/dist/basic-modules/src/modules/justify/parse-style-html.d.ts +8 -0
  121. package/dist/basic-modules/src/modules/justify/render-style.d.ts +13 -0
  122. package/dist/basic-modules/src/modules/justify/style-to-html.d.ts +6 -0
  123. package/dist/basic-modules/src/modules/line-height/custom-types.d.ts +10 -0
  124. package/dist/basic-modules/src/modules/line-height/index.d.ts +7 -0
  125. package/dist/basic-modules/src/modules/line-height/menu/LineHeightMenu.d.ts +26 -0
  126. package/dist/basic-modules/src/modules/line-height/menu/config.d.ts +5 -0
  127. package/dist/basic-modules/src/modules/line-height/menu/index.d.ts +12 -0
  128. package/dist/basic-modules/src/modules/line-height/parse-style-html.d.ts +8 -0
  129. package/dist/basic-modules/src/modules/line-height/render-style.d.ts +13 -0
  130. package/dist/basic-modules/src/modules/line-height/style-to-html.d.ts +6 -0
  131. package/dist/basic-modules/src/modules/link/custom-types.d.ts +11 -0
  132. package/dist/basic-modules/src/modules/link/elem-to-html.d.ts +11 -0
  133. package/dist/basic-modules/src/modules/link/helper.d.ts +20 -0
  134. package/dist/basic-modules/src/modules/link/index.d.ts +7 -0
  135. package/dist/basic-modules/src/modules/link/menu/EditLink.d.ts +29 -0
  136. package/dist/basic-modules/src/modules/link/menu/InsertLink.d.ts +25 -0
  137. package/dist/basic-modules/src/modules/link/menu/UnLink.d.ts +15 -0
  138. package/dist/basic-modules/src/modules/link/menu/ViewLink.d.ts +16 -0
  139. package/dist/basic-modules/src/modules/link/menu/config.d.ts +18 -0
  140. package/dist/basic-modules/src/modules/link/menu/index.d.ts +33 -0
  141. package/dist/basic-modules/src/modules/link/parse-elem-html.d.ts +14 -0
  142. package/dist/basic-modules/src/modules/link/plugin.d.ts +7 -0
  143. package/dist/basic-modules/src/modules/link/render-elem.d.ts +20 -0
  144. package/dist/basic-modules/src/modules/paragraph/custom-types.d.ts +9 -0
  145. package/dist/basic-modules/src/modules/paragraph/elem-to-html.d.ts +11 -0
  146. package/dist/basic-modules/src/modules/paragraph/index.d.ts +7 -0
  147. package/dist/basic-modules/src/modules/paragraph/parse-elem-html.d.ts +14 -0
  148. package/dist/basic-modules/src/modules/paragraph/plugin.d.ts +7 -0
  149. package/dist/basic-modules/src/modules/paragraph/render-elem.d.ts +20 -0
  150. package/dist/basic-modules/src/modules/text-style/custom-types.d.ts +14 -0
  151. package/dist/basic-modules/src/modules/text-style/helper.d.ts +8 -0
  152. package/dist/basic-modules/src/modules/text-style/index.d.ts +7 -0
  153. package/dist/basic-modules/src/modules/text-style/menu/BaseMenu.d.ts +27 -0
  154. package/dist/basic-modules/src/modules/text-style/menu/BoldMenu.d.ts +12 -0
  155. package/dist/basic-modules/src/modules/text-style/menu/ClearStyleMenu.d.ts +20 -0
  156. package/dist/basic-modules/src/modules/text-style/menu/CodeMenu.d.ts +12 -0
  157. package/dist/basic-modules/src/modules/text-style/menu/ItalicMenu.d.ts +12 -0
  158. package/dist/basic-modules/src/modules/text-style/menu/SubMenu.d.ts +13 -0
  159. package/dist/basic-modules/src/modules/text-style/menu/SupMenu.d.ts +13 -0
  160. package/dist/basic-modules/src/modules/text-style/menu/ThroughMenu.d.ts +12 -0
  161. package/dist/basic-modules/src/modules/text-style/menu/UnderlineMenu.d.ts +12 -0
  162. package/dist/basic-modules/src/modules/text-style/menu/index.d.ts +44 -0
  163. package/dist/basic-modules/src/modules/text-style/parse-style-html.d.ts +8 -0
  164. package/dist/basic-modules/src/modules/text-style/render-style.d.ts +13 -0
  165. package/dist/basic-modules/src/modules/text-style/style-to-html.d.ts +12 -0
  166. package/dist/basic-modules/src/modules/todo/custom-types.d.ts +10 -0
  167. package/dist/basic-modules/src/modules/todo/elem-to-html.d.ts +11 -0
  168. package/dist/basic-modules/src/modules/todo/index.d.ts +7 -0
  169. package/dist/basic-modules/src/modules/todo/menu/Todo.d.ts +15 -0
  170. package/dist/basic-modules/src/modules/todo/menu/index.d.ts +9 -0
  171. package/dist/basic-modules/src/modules/todo/parse-elem-html.d.ts +14 -0
  172. package/dist/basic-modules/src/modules/todo/plugin.d.ts +7 -0
  173. package/dist/basic-modules/src/modules/todo/pre-parse-html.d.ts +15 -0
  174. package/dist/basic-modules/src/modules/todo/render-elem.d.ts +20 -0
  175. package/dist/basic-modules/src/modules/undo-redo/index.d.ts +7 -0
  176. package/dist/basic-modules/src/modules/undo-redo/menu/RedoMenu.d.ts +15 -0
  177. package/dist/basic-modules/src/modules/undo-redo/menu/UndoMenu.d.ts +15 -0
  178. package/dist/basic-modules/src/modules/undo-redo/menu/index.d.ts +14 -0
  179. package/dist/basic-modules/src/utils/dom.d.ts +36 -0
  180. package/dist/basic-modules/src/utils/util.d.ts +11 -0
  181. package/dist/basic-modules/src/utils/vdom.d.ts +11 -0
  182. package/dist/code-highlight/src/constants/svg.d.ts +10 -0
  183. package/dist/code-highlight/src/custom-types.d.ts +17 -0
  184. package/dist/code-highlight/src/decorate/index.d.ts +7 -0
  185. package/dist/code-highlight/src/index.d.ts +9 -0
  186. package/dist/code-highlight/src/locale/en.d.ts +10 -0
  187. package/dist/code-highlight/src/locale/index.d.ts +5 -0
  188. package/dist/code-highlight/src/locale/zh-CN.d.ts +10 -0
  189. package/dist/code-highlight/src/module/elem-to-html.d.ts +11 -0
  190. package/dist/code-highlight/src/module/index.d.ts +7 -0
  191. package/dist/code-highlight/src/module/menu/SelectLangMenu.d.ts +24 -0
  192. package/dist/code-highlight/src/module/menu/config.d.ts +8 -0
  193. package/dist/code-highlight/src/module/menu/index.d.ts +15 -0
  194. package/dist/code-highlight/src/module/parse-style-html.d.ts +8 -0
  195. package/dist/code-highlight/src/module/render-style.d.ts +13 -0
  196. package/dist/code-highlight/src/utils/dom.d.ts +15 -0
  197. package/dist/code-highlight/src/utils/vdom.d.ts +11 -0
  198. package/dist/code-highlight/src/vendor/prism.d.ts +37 -0
  199. package/dist/core/src/config/index.d.ts +13 -0
  200. package/dist/core/src/config/interface.d.ts +219 -0
  201. package/dist/core/src/config/register.d.ts +12 -0
  202. package/dist/core/src/constants/index.d.ts +1 -0
  203. package/dist/core/src/constants/svg.d.ts +12 -0
  204. package/dist/core/src/create/bind-node-relation.d.ts +15 -0
  205. package/dist/core/src/create/create-editor.d.ts +10 -0
  206. package/dist/core/src/create/create-toolbar.d.ts +14 -0
  207. package/dist/core/src/create/helper.d.ts +37 -0
  208. package/dist/core/src/create/index.d.ts +7 -0
  209. package/dist/core/src/editor/dom-editor.d.ts +143 -0
  210. package/dist/core/src/editor/interface.d.ts +68 -0
  211. package/dist/core/src/editor/plugins/with-config.d.ts +7 -0
  212. package/dist/core/src/editor/plugins/with-content.d.ts +7 -0
  213. package/dist/core/src/editor/plugins/with-dom.d.ts +10 -0
  214. package/dist/core/src/editor/plugins/with-emitter.d.ts +7 -0
  215. package/dist/core/src/editor/plugins/with-event-data.d.ts +7 -0
  216. package/dist/core/src/editor/plugins/with-max-length.d.ts +7 -0
  217. package/dist/core/src/editor/plugins/with-selection.d.ts +7 -0
  218. package/dist/core/src/i18n/index.d.ts +32 -0
  219. package/dist/core/src/index.d.ts +32 -0
  220. package/dist/core/src/menus/bar/HoverBar.d.ts +48 -0
  221. package/dist/core/src/menus/bar/Toolbar.d.ts +35 -0
  222. package/dist/core/src/menus/bar-item/BaseButton.d.ts +26 -0
  223. package/dist/core/src/menus/bar-item/DropPanelButton.d.ts +14 -0
  224. package/dist/core/src/menus/bar-item/GroupButton.d.ts +17 -0
  225. package/dist/core/src/menus/bar-item/ModalButton.d.ts +25 -0
  226. package/dist/core/src/menus/bar-item/Select.d.ts +22 -0
  227. package/dist/core/src/menus/bar-item/SimpleButton.d.ts +11 -0
  228. package/dist/core/src/menus/bar-item/index.d.ts +24 -0
  229. package/dist/core/src/menus/bar-item/tooltip.d.ts +6 -0
  230. package/dist/core/src/menus/helpers/helpers.d.ts +18 -0
  231. package/dist/core/src/menus/helpers/position.d.ts +36 -0
  232. package/dist/core/src/menus/index.d.ts +9 -0
  233. package/dist/core/src/menus/interface.d.ts +65 -0
  234. package/dist/core/src/menus/panel-and-modal/BaseClass.d.ts +26 -0
  235. package/dist/core/src/menus/panel-and-modal/DropPanel.d.ts +14 -0
  236. package/dist/core/src/menus/panel-and-modal/Modal.d.ts +44 -0
  237. package/dist/core/src/menus/panel-and-modal/SelectList.d.ts +20 -0
  238. package/dist/core/src/menus/register.d.ts +15 -0
  239. package/dist/core/src/parse-html/helper.d.ts +10 -0
  240. package/dist/core/src/parse-html/index.d.ts +35 -0
  241. package/dist/core/src/parse-html/parse-common-elem-html.d.ts +15 -0
  242. package/dist/core/src/parse-html/parse-elem-html.d.ts +15 -0
  243. package/dist/core/src/parse-html/parse-text-elem-html.d.ts +15 -0
  244. package/dist/core/src/render/element/getRenderElem.d.ts +11 -0
  245. package/dist/core/src/render/element/renderElement.d.ts +9 -0
  246. package/dist/core/src/render/element/renderStyle.d.ts +13 -0
  247. package/dist/core/src/render/helper.d.ts +6 -0
  248. package/dist/core/src/render/index.d.ts +27 -0
  249. package/dist/core/src/render/node2Vnode.d.ts +15 -0
  250. package/dist/core/src/render/text/genVnode.d.ts +9 -0
  251. package/dist/core/src/render/text/renderStyle.d.ts +13 -0
  252. package/dist/core/src/render/text/renderText.d.ts +9 -0
  253. package/dist/core/src/text-area/TextArea.d.ts +47 -0
  254. package/dist/core/src/text-area/event-handlers/beforeInput.d.ts +8 -0
  255. package/dist/core/src/text-area/event-handlers/blur.d.ts +8 -0
  256. package/dist/core/src/text-area/event-handlers/click.d.ts +8 -0
  257. package/dist/core/src/text-area/event-handlers/composition.d.ts +27 -0
  258. package/dist/core/src/text-area/event-handlers/copy.d.ts +8 -0
  259. package/dist/core/src/text-area/event-handlers/cut.d.ts +8 -0
  260. package/dist/core/src/text-area/event-handlers/drag.d.ts +9 -0
  261. package/dist/core/src/text-area/event-handlers/drop.d.ts +8 -0
  262. package/dist/core/src/text-area/event-handlers/focus.d.ts +8 -0
  263. package/dist/core/src/text-area/event-handlers/index.d.ts +35 -0
  264. package/dist/core/src/text-area/event-handlers/keydown.d.ts +8 -0
  265. package/dist/core/src/text-area/event-handlers/keypress.d.ts +8 -0
  266. package/dist/core/src/text-area/event-handlers/paste.d.ts +8 -0
  267. package/dist/core/src/text-area/helpers.d.ts +26 -0
  268. package/dist/core/src/text-area/place-holder.d.ts +18 -0
  269. package/dist/core/src/text-area/syncSelection.d.ts +19 -0
  270. package/dist/core/src/text-area/update-view.d.ts +13 -0
  271. package/dist/core/src/to-html/elem2html.d.ts +8 -0
  272. package/dist/core/src/to-html/index.d.ts +32 -0
  273. package/dist/core/src/to-html/node2html.d.ts +8 -0
  274. package/dist/core/src/to-html/text2html.d.ts +8 -0
  275. package/dist/core/src/upload/createUploader.d.ts +8 -0
  276. package/dist/core/src/upload/index.d.ts +7 -0
  277. package/dist/core/src/upload/interface.d.ts +33 -0
  278. package/dist/core/src/utils/dom.d.ts +102 -0
  279. package/dist/core/src/utils/hotkeys.d.ts +35 -0
  280. package/dist/core/src/utils/key.d.ts +11 -0
  281. package/dist/core/src/utils/line.d.ts +14 -0
  282. package/dist/core/src/utils/ua.d.ts +14 -0
  283. package/dist/core/src/utils/util.d.ts +28 -0
  284. package/dist/core/src/utils/vdom.d.ts +34 -0
  285. package/dist/core/src/utils/weak-maps.d.ts +56 -0
  286. package/dist/css/style.css +29 -0
  287. package/dist/editor/src/Boot.d.ts +30 -0
  288. package/dist/editor/src/constants/svg.d.ts +14 -0
  289. package/dist/editor/src/create.d.ts +28 -0
  290. package/dist/editor/src/index.d.ts +18 -0
  291. package/dist/editor/src/init-default-config/config/hoverbar.d.ts +47 -0
  292. package/dist/editor/src/init-default-config/config/index.d.ts +67 -0
  293. package/dist/editor/src/init-default-config/config/toolbar.d.ts +16 -0
  294. package/dist/editor/src/init-default-config/index.d.ts +5 -0
  295. package/dist/editor/src/locale/en.d.ts +14 -0
  296. package/dist/editor/src/locale/index.d.ts +5 -0
  297. package/dist/editor/src/locale/zh-CN.d.ts +14 -0
  298. package/dist/editor/src/register-builtin-modules/index.d.ts +10 -0
  299. package/dist/editor/src/register-builtin-modules/register.d.ts +7 -0
  300. package/dist/editor/src/utils/browser-polyfill.d.ts +6 -0
  301. package/dist/editor/src/utils/dom.d.ts +6 -0
  302. package/dist/editor/src/utils/node-polyfill.d.ts +4 -0
  303. package/dist/index.js +1006 -0
  304. package/dist/index.mjs +1002 -0
  305. package/dist/list-module/src/constants/svg.d.ts +11 -0
  306. package/dist/list-module/src/index.d.ts +8 -0
  307. package/dist/list-module/src/locale/en.d.ts +11 -0
  308. package/dist/list-module/src/locale/index.d.ts +5 -0
  309. package/dist/list-module/src/locale/zh-CN.d.ts +11 -0
  310. package/dist/list-module/src/module/custom-types.d.ts +11 -0
  311. package/dist/list-module/src/module/elem-to-html.d.ts +15 -0
  312. package/dist/list-module/src/module/helpers.d.ts +13 -0
  313. package/dist/list-module/src/module/index.d.ts +7 -0
  314. package/dist/list-module/src/module/menu/BaseMenu.d.ts +18 -0
  315. package/dist/list-module/src/module/menu/BulletedListMenu.d.ts +11 -0
  316. package/dist/list-module/src/module/menu/NumberedListMenu.d.ts +11 -0
  317. package/dist/list-module/src/module/menu/index.d.ts +14 -0
  318. package/dist/list-module/src/module/parse-elem-html.d.ts +19 -0
  319. package/dist/list-module/src/module/plugin.d.ts +7 -0
  320. package/dist/list-module/src/module/render-elem.d.ts +13 -0
  321. package/dist/list-module/src/utils/dom.d.ts +19 -0
  322. package/dist/list-module/src/utils/maps.d.ts +6 -0
  323. package/dist/list-module/src/utils/util.d.ts +6 -0
  324. package/dist/plugin-float-image/src/constants/icon-svg.d.ts +12 -0
  325. package/dist/plugin-float-image/src/index.d.ts +8 -0
  326. package/dist/plugin-float-image/src/module/custom-types.d.ts +21 -0
  327. package/dist/plugin-float-image/src/module/elem-to-html.d.ts +11 -0
  328. package/dist/plugin-float-image/src/module/index.d.ts +8 -0
  329. package/dist/plugin-float-image/src/module/local.d.ts +5 -0
  330. package/dist/plugin-float-image/src/module/menu/FloatBase.d.ts +17 -0
  331. package/dist/plugin-float-image/src/module/menu/FloatLeft.d.ts +11 -0
  332. package/dist/plugin-float-image/src/module/menu/FloatNone.d.ts +11 -0
  333. package/dist/plugin-float-image/src/module/menu/FloatRight.d.ts +11 -0
  334. package/dist/plugin-float-image/src/module/menu/index.d.ts +19 -0
  335. package/dist/plugin-float-image/src/module/parse-elem-html.d.ts +13 -0
  336. package/dist/plugin-float-image/src/module/plugin.d.ts +7 -0
  337. package/dist/plugin-float-image/src/module/render-elem.d.ts +12 -0
  338. package/dist/plugin-float-image/src/utils/dom.d.ts +15 -0
  339. package/dist/table-module/src/constants/svg.d.ts +26 -0
  340. package/dist/table-module/src/index.d.ts +8 -0
  341. package/dist/table-module/src/locale/en.d.ts +43 -0
  342. package/dist/table-module/src/locale/index.d.ts +5 -0
  343. package/dist/table-module/src/locale/zh-CN.d.ts +43 -0
  344. package/dist/table-module/src/module/column-resize.d.ts +20 -0
  345. package/dist/table-module/src/module/custom-types.d.ts +39 -0
  346. package/dist/table-module/src/module/elem-to-html.d.ts +21 -0
  347. package/dist/table-module/src/module/helpers.d.ts +22 -0
  348. package/dist/table-module/src/module/index.d.ts +7 -0
  349. package/dist/table-module/src/module/menu/CellProperty.d.ts +11 -0
  350. package/dist/table-module/src/module/menu/DeleteCol.d.ts +15 -0
  351. package/dist/table-module/src/module/menu/DeleteRow.d.ts +15 -0
  352. package/dist/table-module/src/module/menu/DeleteTable.d.ts +15 -0
  353. package/dist/table-module/src/module/menu/FullWidth.d.ts +15 -0
  354. package/dist/table-module/src/module/menu/InsertCol.d.ts +15 -0
  355. package/dist/table-module/src/module/menu/InsertRow.d.ts +15 -0
  356. package/dist/table-module/src/module/menu/InsertTable.d.ts +24 -0
  357. package/dist/table-module/src/module/menu/MergeCell.d.ts +24 -0
  358. package/dist/table-module/src/module/menu/SplitCell.d.ts +24 -0
  359. package/dist/table-module/src/module/menu/TableHeader.d.ts +15 -0
  360. package/dist/table-module/src/module/menu/TableProperty.d.ts +34 -0
  361. package/dist/table-module/src/module/menu/index.d.ts +66 -0
  362. package/dist/table-module/src/module/parse-elem-html.d.ts +24 -0
  363. package/dist/table-module/src/module/parse-style-html.d.ts +8 -0
  364. package/dist/table-module/src/module/plugin.d.ts +7 -0
  365. package/dist/table-module/src/module/pre-parse-html.d.ts +15 -0
  366. package/dist/table-module/src/module/render-elem/index.d.ts +19 -0
  367. package/dist/table-module/src/module/render-elem/render-cell.d.ts +9 -0
  368. package/dist/table-module/src/module/render-elem/render-row.d.ts +9 -0
  369. package/dist/table-module/src/module/render-elem/render-table.d.ts +9 -0
  370. package/dist/table-module/src/module/render-style.d.ts +9 -0
  371. package/dist/table-module/src/module/style-to-html.d.ts +5 -0
  372. package/dist/table-module/src/module/table-cursor.d.ts +19 -0
  373. package/dist/table-module/src/module/weak-maps.d.ts +5 -0
  374. package/dist/table-module/src/module/with-selection.d.ts +2 -0
  375. package/dist/table-module/src/utils/dom.d.ts +31 -0
  376. package/dist/table-module/src/utils/has-common.d.ts +7 -0
  377. package/dist/table-module/src/utils/index.d.ts +5 -0
  378. package/dist/table-module/src/utils/is-of-type.d.ts +6 -0
  379. package/dist/table-module/src/utils/matrices.d.ts +9 -0
  380. package/dist/table-module/src/utils/options.d.ts +25 -0
  381. package/dist/table-module/src/utils/point.d.ts +7 -0
  382. package/dist/table-module/src/utils/types.d.ts +19 -0
  383. package/dist/table-module/src/utils/vdom.d.ts +11 -0
  384. package/dist/upload-image-module/src/constants/svg.d.ts +10 -0
  385. package/dist/upload-image-module/src/index.d.ts +8 -0
  386. package/dist/upload-image-module/src/locale/en.d.ts +11 -0
  387. package/dist/upload-image-module/src/locale/index.d.ts +5 -0
  388. package/dist/upload-image-module/src/locale/zh-CN.d.ts +11 -0
  389. package/dist/upload-image-module/src/module/index.d.ts +7 -0
  390. package/dist/upload-image-module/src/module/menu/UploadImageMenu.d.ts +16 -0
  391. package/dist/upload-image-module/src/module/menu/config.d.ts +6 -0
  392. package/dist/upload-image-module/src/module/menu/index.d.ts +10 -0
  393. package/dist/upload-image-module/src/module/plugin.d.ts +7 -0
  394. package/dist/upload-image-module/src/module/upload-images.d.ts +11 -0
  395. package/dist/upload-image-module/src/utils/dom.d.ts +7 -0
  396. package/dist/video-module/src/constants/svg.d.ts +12 -0
  397. package/dist/video-module/src/index.d.ts +8 -0
  398. package/dist/video-module/src/locale/en.d.ts +21 -0
  399. package/dist/video-module/src/locale/index.d.ts +5 -0
  400. package/dist/video-module/src/locale/zh-CN.d.ts +21 -0
  401. package/dist/video-module/src/module/custom-types.d.ts +23 -0
  402. package/dist/video-module/src/module/elem-to-html.d.ts +11 -0
  403. package/dist/video-module/src/module/helper/insert-video.d.ts +12 -0
  404. package/dist/video-module/src/module/helper/upload-videos.d.ts +6 -0
  405. package/dist/video-module/src/module/index.d.ts +7 -0
  406. package/dist/video-module/src/module/menu/EditVideoSizeMenu.d.ts +25 -0
  407. package/dist/video-module/src/module/menu/EditVideoSrcMenu.d.ts +26 -0
  408. package/dist/video-module/src/module/menu/InsertVideoMenu.d.ts +25 -0
  409. package/dist/video-module/src/module/menu/UploadVideoMenu.d.ts +16 -0
  410. package/dist/video-module/src/module/menu/config.d.ts +25 -0
  411. package/dist/video-module/src/module/menu/index.d.ts +30 -0
  412. package/dist/video-module/src/module/parse-elem-html.d.ts +14 -0
  413. package/dist/video-module/src/module/plugin.d.ts +7 -0
  414. package/dist/video-module/src/module/pre-parse-html.d.ts +15 -0
  415. package/dist/video-module/src/module/render-elem.d.ts +13 -0
  416. package/dist/video-module/src/utils/dom.d.ts +29 -0
  417. package/dist/video-module/src/utils/util.d.ts +12 -0
  418. package/package.json +49 -0
package/dist/index.js ADDED
@@ -0,0 +1,1006 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@wangeditor-next/editor'), require('snabbdom'), require('dom7')) :
3
+ typeof define === 'function' && define.amd ? define(['@wangeditor-next/editor', 'snabbdom', 'dom7'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.WangEditorFloatImagePlugin = factory(global.editor, global.snabbdom, global.$));
5
+ })(this, (function (editor, snabbdom, $) { 'use strict';
6
+
7
+ /**
8
+ * @description 多语言
9
+ * @author Yanghc
10
+ */
11
+ editor.i18nAddResources('en', {
12
+ float: {
13
+ none: 'Default',
14
+ left: 'Float Left',
15
+ right: 'Float Right',
16
+ },
17
+ });
18
+ editor.i18nAddResources('zh-CN', {
19
+ float: {
20
+ none: '默认',
21
+ left: '左浮动',
22
+ right: '右浮动',
23
+ },
24
+ });
25
+
26
+ /**
27
+ * @description elem to html
28
+ * @author Yanghc
29
+ */
30
+ // 生成 html 的函数
31
+ function imageToHtml(elem, _childrenHtml) {
32
+ var _a = elem, src = _a.src, _b = _a.alt, alt = _b === void 0 ? '' : _b, _c = _a.href, href = _c === void 0 ? '' : _c, _d = _a.style, style = _d === void 0 ? {} : _d;
33
+ var _e = style.width, width = _e === void 0 ? '' : _e, _f = style.height, height = _f === void 0 ? '' : _f, _g = style.float, float = _g === void 0 ? '' : _g;
34
+ var styleStr = '';
35
+ if (width) {
36
+ styleStr += "width: ".concat(width, ";");
37
+ }
38
+ if (height) {
39
+ styleStr += "height: ".concat(height, ";");
40
+ }
41
+ if (float) {
42
+ styleStr += "float: ".concat(float, ";");
43
+ }
44
+ return "<img src=\"".concat(src, "\" alt=\"").concat(alt, "\" data-href=\"").concat(href, "\" style=\"").concat(styleStr, "\"/>");
45
+ }
46
+ // 配置
47
+ var conf = {
48
+ type: 'image', // 节点 type ,重要!!!
49
+ elemToHtml: imageToHtml,
50
+ };
51
+
52
+ /******************************************************************************
53
+ Copyright (c) Microsoft Corporation.
54
+
55
+ Permission to use, copy, modify, and/or distribute this software for any
56
+ purpose with or without fee is hereby granted.
57
+
58
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
59
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
60
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
61
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
62
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
63
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
64
+ PERFORMANCE OF THIS SOFTWARE.
65
+ ***************************************************************************** */
66
+ /* global Reflect, Promise, SuppressedError, Symbol */
67
+
68
+ var extendStatics = function(d, b) {
69
+ extendStatics = Object.setPrototypeOf ||
70
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
71
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
72
+ return extendStatics(d, b);
73
+ };
74
+
75
+ function __extends(d, b) {
76
+ if (typeof b !== "function" && b !== null)
77
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
78
+ extendStatics(d, b);
79
+ function __() { this.constructor = d; }
80
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
81
+ }
82
+
83
+ var __assign = function() {
84
+ __assign = Object.assign || function __assign(t) {
85
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
86
+ s = arguments[i];
87
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
88
+ }
89
+ return t;
90
+ };
91
+ return __assign.apply(this, arguments);
92
+ };
93
+
94
+ function __read(o, n) {
95
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
96
+ if (!m) return o;
97
+ var i = m.call(o), r, ar = [], e;
98
+ try {
99
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
100
+ }
101
+ catch (error) { e = { error: error }; }
102
+ finally {
103
+ try {
104
+ if (r && !r.done && (m = i["return"])) m.call(i);
105
+ }
106
+ finally { if (e) throw e.error; }
107
+ }
108
+ return ar;
109
+ }
110
+
111
+ function __spreadArray(to, from, pack) {
112
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
113
+ if (ar || !(i in from)) {
114
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
115
+ ar[i] = from[i];
116
+ }
117
+ }
118
+ return to.concat(ar || Array.prototype.slice.call(from));
119
+ }
120
+
121
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
122
+ var e = new Error(message);
123
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
124
+ };
125
+
126
+ /**
127
+ * @description icon svg
128
+ * @author Yanghc
129
+ */
130
+ /**
131
+ * 【注意】svg 字符串的长度 ,否则会导致代码体积过大
132
+ * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
133
+ * 找不到再从 iconfont.com 搜索
134
+ */
135
+ // 默认不浮动
136
+ var 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>';
137
+ // 左浮动
138
+ var 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>';
139
+ // 右浮动
140
+ var 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>';
141
+
142
+ /**
143
+ * @description image float base class
144
+ * @author Yanghc
145
+ */
146
+ var ImageFloatBaseClass = /** @class */ (function () {
147
+ function ImageFloatBaseClass() {
148
+ this.tag = 'button';
149
+ }
150
+ ImageFloatBaseClass.prototype.getValue = function (editor) {
151
+ // 无需获取 val
152
+ return '';
153
+ };
154
+ ImageFloatBaseClass.prototype.isActive = function (editor) {
155
+ // 无需 active
156
+ return false;
157
+ };
158
+ ImageFloatBaseClass.prototype.getSelectedNode = function (editor$1) {
159
+ return editor.DomEditor.getSelectedNodeByType(editor$1, 'image');
160
+ };
161
+ ImageFloatBaseClass.prototype.isDisabled = function (editor) {
162
+ if (editor.selection == null) {
163
+ return true;
164
+ }
165
+ var imageNode = this.getSelectedNode(editor);
166
+ return imageNode == null;
167
+ };
168
+ ImageFloatBaseClass.prototype.exec = function (editor$1, value) {
169
+ if (this.isDisabled(editor$1)) {
170
+ return;
171
+ }
172
+ var imageNode = this.getSelectedNode(editor$1);
173
+ if (imageNode == null) {
174
+ return;
175
+ }
176
+ // 隐藏 hoverbar
177
+ var hoverbar = editor.DomEditor.getHoverbar(editor$1);
178
+ if (hoverbar) {
179
+ hoverbar.hideAndClean();
180
+ }
181
+ var _a = imageNode.style, style = _a === void 0 ? {} : _a;
182
+ var props = {
183
+ style: __assign(__assign({}, style), { float: this.value }),
184
+ };
185
+ editor.SlateTransforms.setNodes(editor$1, props, {
186
+ match: function (n) { return editor.DomEditor.checkNodeType(n, 'image'); },
187
+ });
188
+ };
189
+ return ImageFloatBaseClass;
190
+ }());
191
+
192
+ /**
193
+ * @description float image none
194
+ * @author Yanghc
195
+ */
196
+ var FloatNone = /** @class */ (function (_super) {
197
+ __extends(FloatNone, _super);
198
+ function FloatNone() {
199
+ var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
200
+ _this.title = editor.t('float.none'); // 菜单标题
201
+ _this.value = 'none'; // css float 的值
202
+ _this.iconSvg = DEFAULT_FLOAT_SVG;
203
+ return _this;
204
+ }
205
+ return FloatNone;
206
+ }(ImageFloatBaseClass));
207
+
208
+ /**
209
+ * @description float image left
210
+ * @author Yanghc
211
+ */
212
+ var FloatLeft = /** @class */ (function (_super) {
213
+ __extends(FloatLeft, _super);
214
+ function FloatLeft() {
215
+ var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
216
+ _this.title = editor.t('float.left'); // 菜单标题
217
+ _this.value = 'left'; // css float 的值
218
+ _this.iconSvg = LEFT_FLOAT_SVG;
219
+ return _this;
220
+ }
221
+ return FloatLeft;
222
+ }(ImageFloatBaseClass));
223
+
224
+ /**
225
+ * @description float image right
226
+ * @author Yanghc
227
+ */
228
+ var FloatRight = /** @class */ (function (_super) {
229
+ __extends(FloatRight, _super);
230
+ function FloatRight() {
231
+ var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
232
+ _this.title = editor.t('float.right'); // 菜单标题
233
+ _this.value = 'right'; // css float 的值
234
+ _this.iconSvg = RIGHT_FLOAT_SVG;
235
+ return _this;
236
+ }
237
+ return FloatRight;
238
+ }(ImageFloatBaseClass));
239
+
240
+ /**
241
+ * @description menu index
242
+ * @author Yanghc
243
+ */
244
+ var imageFloatNoneMenuConf = {
245
+ key: 'imageFloatNone',
246
+ factory: function () {
247
+ return new FloatNone();
248
+ },
249
+ };
250
+ var imageFloatLeftMenuConf = {
251
+ key: 'imageFloatLeft',
252
+ factory: function () {
253
+ return new FloatLeft();
254
+ },
255
+ };
256
+ var imageFloatRightMenuConf = {
257
+ key: 'imageFloatRight',
258
+ factory: function () {
259
+ return new FloatRight();
260
+ },
261
+ };
262
+
263
+ /**
264
+ * @description parse elem html
265
+ * @author Yanghc
266
+ */
267
+ function parseHtml(elem, _children, _editor) {
268
+ var href = elem.getAttribute('data-href') || '';
269
+ href = decodeURIComponent(href); // 兼容 V4
270
+ return {
271
+ type: 'image',
272
+ src: elem.getAttribute('src') || '',
273
+ alt: elem.getAttribute('alt') || '',
274
+ href: href,
275
+ style: {
276
+ width: elem.getAttribute('width') || '',
277
+ height: elem.getAttribute('height') || '',
278
+ float: elem.getAttribute('float') || '',
279
+ },
280
+ children: [{ text: '' }], // void node 有一个空白 text
281
+ };
282
+ }
283
+ var parseHtmlConf = {
284
+ selector: 'img:not([data-w-e-type])', // data-w-e-type 属性,留给自定义元素,保证扩展性
285
+ parseElemHtml: parseHtml,
286
+ };
287
+
288
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
289
+
290
+ function getDefaultExportFromCjs (x) {
291
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
292
+ }
293
+
294
+ /**
295
+ * lodash (Custom Build) <https://lodash.com/>
296
+ * Build: `lodash modularize exports="npm" -o ./`
297
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
298
+ * Released under MIT license <https://lodash.com/license>
299
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
300
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
301
+ */
302
+
303
+ var lodash_throttle;
304
+ var hasRequiredLodash_throttle;
305
+
306
+ function requireLodash_throttle () {
307
+ if (hasRequiredLodash_throttle) return lodash_throttle;
308
+ hasRequiredLodash_throttle = 1;
309
+ /** Used as the `TypeError` message for "Functions" methods. */
310
+ var FUNC_ERROR_TEXT = 'Expected a function';
311
+
312
+ /** Used as references for various `Number` constants. */
313
+ var NAN = 0 / 0;
314
+
315
+ /** `Object#toString` result references. */
316
+ var symbolTag = '[object Symbol]';
317
+
318
+ /** Used to match leading and trailing whitespace. */
319
+ var reTrim = /^\s+|\s+$/g;
320
+
321
+ /** Used to detect bad signed hexadecimal string values. */
322
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
323
+
324
+ /** Used to detect binary string values. */
325
+ var reIsBinary = /^0b[01]+$/i;
326
+
327
+ /** Used to detect octal string values. */
328
+ var reIsOctal = /^0o[0-7]+$/i;
329
+
330
+ /** Built-in method references without a dependency on `root`. */
331
+ var freeParseInt = parseInt;
332
+
333
+ /** Detect free variable `global` from Node.js. */
334
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
335
+
336
+ /** Detect free variable `self`. */
337
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
338
+
339
+ /** Used as a reference to the global object. */
340
+ var root = freeGlobal || freeSelf || Function('return this')();
341
+
342
+ /** Used for built-in method references. */
343
+ var objectProto = Object.prototype;
344
+
345
+ /**
346
+ * Used to resolve the
347
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
348
+ * of values.
349
+ */
350
+ var objectToString = objectProto.toString;
351
+
352
+ /* Built-in method references for those with the same name as other `lodash` methods. */
353
+ var nativeMax = Math.max,
354
+ nativeMin = Math.min;
355
+
356
+ /**
357
+ * Gets the timestamp of the number of milliseconds that have elapsed since
358
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
359
+ *
360
+ * @static
361
+ * @memberOf _
362
+ * @since 2.4.0
363
+ * @category Date
364
+ * @returns {number} Returns the timestamp.
365
+ * @example
366
+ *
367
+ * _.defer(function(stamp) {
368
+ * console.log(_.now() - stamp);
369
+ * }, _.now());
370
+ * // => Logs the number of milliseconds it took for the deferred invocation.
371
+ */
372
+ var now = function() {
373
+ return root.Date.now();
374
+ };
375
+
376
+ /**
377
+ * Creates a debounced function that delays invoking `func` until after `wait`
378
+ * milliseconds have elapsed since the last time the debounced function was
379
+ * invoked. The debounced function comes with a `cancel` method to cancel
380
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
381
+ * Provide `options` to indicate whether `func` should be invoked on the
382
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
383
+ * with the last arguments provided to the debounced function. Subsequent
384
+ * calls to the debounced function return the result of the last `func`
385
+ * invocation.
386
+ *
387
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
388
+ * invoked on the trailing edge of the timeout only if the debounced function
389
+ * is invoked more than once during the `wait` timeout.
390
+ *
391
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
392
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
393
+ *
394
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
395
+ * for details over the differences between `_.debounce` and `_.throttle`.
396
+ *
397
+ * @static
398
+ * @memberOf _
399
+ * @since 0.1.0
400
+ * @category Function
401
+ * @param {Function} func The function to debounce.
402
+ * @param {number} [wait=0] The number of milliseconds to delay.
403
+ * @param {Object} [options={}] The options object.
404
+ * @param {boolean} [options.leading=false]
405
+ * Specify invoking on the leading edge of the timeout.
406
+ * @param {number} [options.maxWait]
407
+ * The maximum time `func` is allowed to be delayed before it's invoked.
408
+ * @param {boolean} [options.trailing=true]
409
+ * Specify invoking on the trailing edge of the timeout.
410
+ * @returns {Function} Returns the new debounced function.
411
+ * @example
412
+ *
413
+ * // Avoid costly calculations while the window size is in flux.
414
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
415
+ *
416
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
417
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
418
+ * 'leading': true,
419
+ * 'trailing': false
420
+ * }));
421
+ *
422
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
423
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
424
+ * var source = new EventSource('/stream');
425
+ * jQuery(source).on('message', debounced);
426
+ *
427
+ * // Cancel the trailing debounced invocation.
428
+ * jQuery(window).on('popstate', debounced.cancel);
429
+ */
430
+ function debounce(func, wait, options) {
431
+ var lastArgs,
432
+ lastThis,
433
+ maxWait,
434
+ result,
435
+ timerId,
436
+ lastCallTime,
437
+ lastInvokeTime = 0,
438
+ leading = false,
439
+ maxing = false,
440
+ trailing = true;
441
+
442
+ if (typeof func != 'function') {
443
+ throw new TypeError(FUNC_ERROR_TEXT);
444
+ }
445
+ wait = toNumber(wait) || 0;
446
+ if (isObject(options)) {
447
+ leading = !!options.leading;
448
+ maxing = 'maxWait' in options;
449
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
450
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
451
+ }
452
+
453
+ function invokeFunc(time) {
454
+ var args = lastArgs,
455
+ thisArg = lastThis;
456
+
457
+ lastArgs = lastThis = undefined;
458
+ lastInvokeTime = time;
459
+ result = func.apply(thisArg, args);
460
+ return result;
461
+ }
462
+
463
+ function leadingEdge(time) {
464
+ // Reset any `maxWait` timer.
465
+ lastInvokeTime = time;
466
+ // Start the timer for the trailing edge.
467
+ timerId = setTimeout(timerExpired, wait);
468
+ // Invoke the leading edge.
469
+ return leading ? invokeFunc(time) : result;
470
+ }
471
+
472
+ function remainingWait(time) {
473
+ var timeSinceLastCall = time - lastCallTime,
474
+ timeSinceLastInvoke = time - lastInvokeTime,
475
+ result = wait - timeSinceLastCall;
476
+
477
+ return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
478
+ }
479
+
480
+ function shouldInvoke(time) {
481
+ var timeSinceLastCall = time - lastCallTime,
482
+ timeSinceLastInvoke = time - lastInvokeTime;
483
+
484
+ // Either this is the first call, activity has stopped and we're at the
485
+ // trailing edge, the system time has gone backwards and we're treating
486
+ // it as the trailing edge, or we've hit the `maxWait` limit.
487
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
488
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
489
+ }
490
+
491
+ function timerExpired() {
492
+ var time = now();
493
+ if (shouldInvoke(time)) {
494
+ return trailingEdge(time);
495
+ }
496
+ // Restart the timer.
497
+ timerId = setTimeout(timerExpired, remainingWait(time));
498
+ }
499
+
500
+ function trailingEdge(time) {
501
+ timerId = undefined;
502
+
503
+ // Only invoke if we have `lastArgs` which means `func` has been
504
+ // debounced at least once.
505
+ if (trailing && lastArgs) {
506
+ return invokeFunc(time);
507
+ }
508
+ lastArgs = lastThis = undefined;
509
+ return result;
510
+ }
511
+
512
+ function cancel() {
513
+ if (timerId !== undefined) {
514
+ clearTimeout(timerId);
515
+ }
516
+ lastInvokeTime = 0;
517
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
518
+ }
519
+
520
+ function flush() {
521
+ return timerId === undefined ? result : trailingEdge(now());
522
+ }
523
+
524
+ function debounced() {
525
+ var time = now(),
526
+ isInvoking = shouldInvoke(time);
527
+
528
+ lastArgs = arguments;
529
+ lastThis = this;
530
+ lastCallTime = time;
531
+
532
+ if (isInvoking) {
533
+ if (timerId === undefined) {
534
+ return leadingEdge(lastCallTime);
535
+ }
536
+ if (maxing) {
537
+ // Handle invocations in a tight loop.
538
+ timerId = setTimeout(timerExpired, wait);
539
+ return invokeFunc(lastCallTime);
540
+ }
541
+ }
542
+ if (timerId === undefined) {
543
+ timerId = setTimeout(timerExpired, wait);
544
+ }
545
+ return result;
546
+ }
547
+ debounced.cancel = cancel;
548
+ debounced.flush = flush;
549
+ return debounced;
550
+ }
551
+
552
+ /**
553
+ * Creates a throttled function that only invokes `func` at most once per
554
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
555
+ * method to cancel delayed `func` invocations and a `flush` method to
556
+ * immediately invoke them. Provide `options` to indicate whether `func`
557
+ * should be invoked on the leading and/or trailing edge of the `wait`
558
+ * timeout. The `func` is invoked with the last arguments provided to the
559
+ * throttled function. Subsequent calls to the throttled function return the
560
+ * result of the last `func` invocation.
561
+ *
562
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
563
+ * invoked on the trailing edge of the timeout only if the throttled function
564
+ * is invoked more than once during the `wait` timeout.
565
+ *
566
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
567
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
568
+ *
569
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
570
+ * for details over the differences between `_.throttle` and `_.debounce`.
571
+ *
572
+ * @static
573
+ * @memberOf _
574
+ * @since 0.1.0
575
+ * @category Function
576
+ * @param {Function} func The function to throttle.
577
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
578
+ * @param {Object} [options={}] The options object.
579
+ * @param {boolean} [options.leading=true]
580
+ * Specify invoking on the leading edge of the timeout.
581
+ * @param {boolean} [options.trailing=true]
582
+ * Specify invoking on the trailing edge of the timeout.
583
+ * @returns {Function} Returns the new throttled function.
584
+ * @example
585
+ *
586
+ * // Avoid excessively updating the position while scrolling.
587
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
588
+ *
589
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
590
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
591
+ * jQuery(element).on('click', throttled);
592
+ *
593
+ * // Cancel the trailing throttled invocation.
594
+ * jQuery(window).on('popstate', throttled.cancel);
595
+ */
596
+ function throttle(func, wait, options) {
597
+ var leading = true,
598
+ trailing = true;
599
+
600
+ if (typeof func != 'function') {
601
+ throw new TypeError(FUNC_ERROR_TEXT);
602
+ }
603
+ if (isObject(options)) {
604
+ leading = 'leading' in options ? !!options.leading : leading;
605
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
606
+ }
607
+ return debounce(func, wait, {
608
+ 'leading': leading,
609
+ 'maxWait': wait,
610
+ 'trailing': trailing
611
+ });
612
+ }
613
+
614
+ /**
615
+ * Checks if `value` is the
616
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
617
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
618
+ *
619
+ * @static
620
+ * @memberOf _
621
+ * @since 0.1.0
622
+ * @category Lang
623
+ * @param {*} value The value to check.
624
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
625
+ * @example
626
+ *
627
+ * _.isObject({});
628
+ * // => true
629
+ *
630
+ * _.isObject([1, 2, 3]);
631
+ * // => true
632
+ *
633
+ * _.isObject(_.noop);
634
+ * // => true
635
+ *
636
+ * _.isObject(null);
637
+ * // => false
638
+ */
639
+ function isObject(value) {
640
+ var type = typeof value;
641
+ return !!value && (type == 'object' || type == 'function');
642
+ }
643
+
644
+ /**
645
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
646
+ * and has a `typeof` result of "object".
647
+ *
648
+ * @static
649
+ * @memberOf _
650
+ * @since 4.0.0
651
+ * @category Lang
652
+ * @param {*} value The value to check.
653
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
654
+ * @example
655
+ *
656
+ * _.isObjectLike({});
657
+ * // => true
658
+ *
659
+ * _.isObjectLike([1, 2, 3]);
660
+ * // => true
661
+ *
662
+ * _.isObjectLike(_.noop);
663
+ * // => false
664
+ *
665
+ * _.isObjectLike(null);
666
+ * // => false
667
+ */
668
+ function isObjectLike(value) {
669
+ return !!value && typeof value == 'object';
670
+ }
671
+
672
+ /**
673
+ * Checks if `value` is classified as a `Symbol` primitive or object.
674
+ *
675
+ * @static
676
+ * @memberOf _
677
+ * @since 4.0.0
678
+ * @category Lang
679
+ * @param {*} value The value to check.
680
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
681
+ * @example
682
+ *
683
+ * _.isSymbol(Symbol.iterator);
684
+ * // => true
685
+ *
686
+ * _.isSymbol('abc');
687
+ * // => false
688
+ */
689
+ function isSymbol(value) {
690
+ return typeof value == 'symbol' ||
691
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
692
+ }
693
+
694
+ /**
695
+ * Converts `value` to a number.
696
+ *
697
+ * @static
698
+ * @memberOf _
699
+ * @since 4.0.0
700
+ * @category Lang
701
+ * @param {*} value The value to process.
702
+ * @returns {number} Returns the number.
703
+ * @example
704
+ *
705
+ * _.toNumber(3.2);
706
+ * // => 3.2
707
+ *
708
+ * _.toNumber(Number.MIN_VALUE);
709
+ * // => 5e-324
710
+ *
711
+ * _.toNumber(Infinity);
712
+ * // => Infinity
713
+ *
714
+ * _.toNumber('3.2');
715
+ * // => 3.2
716
+ */
717
+ function toNumber(value) {
718
+ if (typeof value == 'number') {
719
+ return value;
720
+ }
721
+ if (isSymbol(value)) {
722
+ return NAN;
723
+ }
724
+ if (isObject(value)) {
725
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
726
+ value = isObject(other) ? (other + '') : other;
727
+ }
728
+ if (typeof value != 'string') {
729
+ return value === 0 ? value : +value;
730
+ }
731
+ value = value.replace(reTrim, '');
732
+ var isBinary = reIsBinary.test(value);
733
+ return (isBinary || reIsOctal.test(value))
734
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
735
+ : (reIsBadHex.test(value) ? NAN : +value);
736
+ }
737
+
738
+ lodash_throttle = throttle;
739
+ return lodash_throttle;
740
+ }
741
+
742
+ var lodash_throttleExports = requireLodash_throttle();
743
+ var throttle = /*@__PURE__*/getDefaultExportFromCjs(lodash_throttleExports);
744
+
745
+ /**
746
+ * @description DOM 操作
747
+ * @author Yanghc
748
+ */
749
+ if ($.css) {
750
+ $.fn.css = $.css;
751
+ }
752
+ if ($.append) {
753
+ $.fn.append = $.append;
754
+ }
755
+ if ($.prepend) {
756
+ $.fn.prepend = $.prepend;
757
+ }
758
+ if ($.addClass) {
759
+ $.fn.addClass = $.addClass;
760
+ }
761
+ if ($.removeClass) {
762
+ $.fn.removeClass = $.removeClass;
763
+ }
764
+ if ($.hasClass) {
765
+ $.fn.hasClass = $.hasClass;
766
+ }
767
+ if ($.on) {
768
+ $.fn.on = $.on;
769
+ }
770
+ if ($.off) {
771
+ $.fn.off = $.off;
772
+ }
773
+ if ($.focus) {
774
+ $.fn.focus = $.focus;
775
+ }
776
+ if ($.attr) {
777
+ $.fn.attr = $.attr;
778
+ }
779
+ if ($.removeAttr) {
780
+ $.fn.removeAttr = $.removeAttr;
781
+ }
782
+ if ($.hide) {
783
+ $.fn.hide = $.hide;
784
+ }
785
+ if ($.show) {
786
+ $.fn.show = $.show;
787
+ }
788
+ if ($.parents) {
789
+ $.fn.parents = $.parents;
790
+ }
791
+ if ($.dataset) {
792
+ $.fn.dataset = $.dataset;
793
+ }
794
+ if ($.val) {
795
+ $.fn.val = $.val;
796
+ }
797
+ if ($.text) {
798
+ $.fn.text = $.text;
799
+ }
800
+ if ($.html) {
801
+ $.fn.html = $.html;
802
+ }
803
+ if ($.children) {
804
+ $.fn.children = $.children;
805
+ }
806
+ if ($.remove) {
807
+ $.fn.remove = $.remove;
808
+ }
809
+ if ($.find) {
810
+ $.fn.find = $.find;
811
+ }
812
+ if ($.width) {
813
+ $.fn.width = $.width;
814
+ }
815
+ if ($.height) {
816
+ $.fn.height = $.height;
817
+ }
818
+ if ($.filter) {
819
+ $.fn.filter = $.filter;
820
+ }
821
+ if ($.empty) {
822
+ $.fn.empty = $.empty;
823
+ }
824
+
825
+ /**
826
+ * @description image render elem
827
+ * @author wangfupeng
828
+ */
829
+ function genContainerId(editor$1, elemNode) {
830
+ var id = editor.DomEditor.findKey(editor$1, elemNode).id; // node 唯一 id
831
+ return "w-e-image-container-".concat(id);
832
+ }
833
+ /**
834
+ * 未选中时,渲染 image container
835
+ */
836
+ function renderContainer(editor, elemNode, imageVnode, imageInfo) {
837
+ var width = imageInfo.width, height = imageInfo.height, float = imageInfo.float;
838
+ var style = {};
839
+ if (width) {
840
+ style.width = width;
841
+ }
842
+ if (height) {
843
+ style.height = height;
844
+ }
845
+ if (float) {
846
+ style.float = float;
847
+ }
848
+ var containerId = genContainerId(editor, elemNode);
849
+ return (snabbdom.jsx("div", { id: containerId, style: style, className: "w-e-image-container" }, imageVnode));
850
+ }
851
+ /**
852
+ * 选中状态下,渲染 image container(渲染拖拽容器,修改图片尺寸)
853
+ */
854
+ function renderResizeContainer(editor$1, elemNode, imageVnode, imageInfo) {
855
+ var $body = $('body');
856
+ var containerId = genContainerId(editor$1, elemNode);
857
+ var width = imageInfo.width, height = imageInfo.height, float = imageInfo.float;
858
+ var originalX = 0;
859
+ var originalWith = 0;
860
+ var originalHeight = 0;
861
+ var revers = false; // 是否反转。如向右拖拽 right-top 需增加宽度(非反转),但向右拖拽 left-top 则需要减少宽度(反转)
862
+ var $container = null;
863
+ function getContainerElem() {
864
+ var $containerFromDom = $("#".concat(containerId));
865
+ if ($containerFromDom.length === 0) {
866
+ throw new Error('Cannot find image container elem');
867
+ }
868
+ return $containerFromDom;
869
+ }
870
+ // mouseover callback (节流)
871
+ var onMousemove = throttle(function (e) {
872
+ e.preventDefault();
873
+ var clientX = e.clientX;
874
+ var gap = revers ? originalX - clientX : clientX - originalX; // 考虑是否反转
875
+ var newWidth = originalWith + gap;
876
+ var newHeight = originalHeight * (newWidth / originalWith); // 根据 width ,按比例计算 height
877
+ // 实时修改 img 宽高 -【注意】这里只修改 DOM ,mouseup 时再统一不修改 node
878
+ if ($container == null) {
879
+ return;
880
+ }
881
+ if (newWidth <= 15 || newHeight <= 15) {
882
+ return;
883
+ } // 最小就是 15px
884
+ $container.css('width', "".concat(newWidth, "px"));
885
+ $container.css('height', "".concat(newHeight, "px"));
886
+ }, 100);
887
+ function onMouseup(_e) {
888
+ // 取消监听 mousemove
889
+ $body.off('mousemove', onMousemove);
890
+ if ($container == null) {
891
+ return;
892
+ }
893
+ var newWidth = $container.width().toFixed(2);
894
+ var newHeight = $container.height().toFixed(2);
895
+ // 修改 node
896
+ var props = {
897
+ style: __assign(__assign({}, elemNode.style), { width: "".concat(newWidth, "px"), height: "".concat(newHeight, "px") }),
898
+ };
899
+ editor.SlateTransforms.setNodes(editor$1, props, { at: editor.DomEditor.findPath(editor$1, elemNode) });
900
+ // 取消监听 mouseup
901
+ $body.off('mouseup', onMouseup);
902
+ }
903
+ /**
904
+ * 初始化。监听事件,记录原始数据
905
+ */
906
+ function init(clientX) {
907
+ $container = getContainerElem();
908
+ // 记录当前 x 坐标值
909
+ originalX = clientX;
910
+ // 记录 img 原始宽高
911
+ var $img = $container.find('img');
912
+ if ($img.length === 0) {
913
+ throw new Error('Cannot find image elem');
914
+ }
915
+ originalWith = $img.width();
916
+ originalHeight = $img.height();
917
+ // 监听 mousemove
918
+ $body.on('mousemove', onMousemove);
919
+ // 监听 mouseup
920
+ $body.on('mouseup', onMouseup);
921
+ // 隐藏 hoverbar
922
+ var hoverbar = editor.DomEditor.getHoverbar(editor$1);
923
+ if (hoverbar) {
924
+ hoverbar.hideAndClean();
925
+ }
926
+ }
927
+ var style = {};
928
+ if (width) {
929
+ style.width = width;
930
+ }
931
+ if (height) {
932
+ style.height = height;
933
+ }
934
+ if (float) {
935
+ style.float = float;
936
+ }
937
+ // style.boxShadow = '0 0 0 1px #B4D5FF' // 自定义 selected 样式,因为有拖拽触手
938
+ return (snabbdom.jsx("div", { id: containerId, style: style, className: "w-e-image-container w-e-selected-image-container", on: {
939
+ // 统一绑定拖拽触手的 mousedown 事件
940
+ mousedown: function (e) {
941
+ var $target = $(e.target);
942
+ if (!$target.hasClass('w-e-image-dragger')) {
943
+ // target 不是 .w-e-image-dragger 拖拽触手,则忽略
944
+ return;
945
+ }
946
+ e.preventDefault();
947
+ if ($target.hasClass('left-top') || $target.hasClass('left-bottom')) {
948
+ revers = true; // 反转。向右拖拽,减少宽度
949
+ }
950
+ init(e.clientX); // 初始化
951
+ },
952
+ } },
953
+ imageVnode,
954
+ snabbdom.jsx("div", { className: "w-e-image-dragger left-top" }),
955
+ snabbdom.jsx("div", { className: "w-e-image-dragger right-top" }),
956
+ snabbdom.jsx("div", { className: "w-e-image-dragger left-bottom" }),
957
+ snabbdom.jsx("div", { className: "w-e-image-dragger right-bottom" })));
958
+ }
959
+ function renderImage(elemNode, children, editor$1) {
960
+ var _a = elemNode, src = _a.src, _b = _a.alt, alt = _b === void 0 ? '' : _b, _c = _a.href, href = _c === void 0 ? '' : _c, _d = _a.style, style = _d === void 0 ? {} : _d;
961
+ var _f = style.width, width = _f === void 0 ? '' : _f, _g = style.height, height = _g === void 0 ? '' : _g, float = style.float;
962
+ var selected = editor.DomEditor.isNodeSelected(editor$1, elemNode); // 图片是否选中
963
+ var imageStyle = {};
964
+ if (width) {
965
+ imageStyle.width = '100%';
966
+ }
967
+ if (height) {
968
+ imageStyle.height = '100%';
969
+ }
970
+ if (float) {
971
+ imageStyle.float = float;
972
+ }
973
+ // 【注意】void node 中,renderElem 不用处理 children 。core 会统一处理。
974
+ var vnode = snabbdom.jsx("img", { style: imageStyle, src: src, alt: alt, "data-href": href });
975
+ var isDisabled = editor$1.isDisabled();
976
+ if (selected && !isDisabled) {
977
+ // 选中,未禁用 - 渲染 resize container
978
+ return renderResizeContainer(editor$1, elemNode, vnode, { width: width, height: height, float: float });
979
+ }
980
+ // 其他,渲染普通 image container
981
+ return renderContainer(editor$1, elemNode, vnode, { width: width, height: height, float: float });
982
+ }
983
+ var renderImageConf = {
984
+ type: 'image', // 和 elemNode.type 一致
985
+ renderElem: renderImage,
986
+ };
987
+
988
+ /**
989
+ * @description module entry
990
+ * @author Yanghc
991
+ */
992
+ var module = {
993
+ renderElems: [renderImageConf],
994
+ elemsToHtml: [conf],
995
+ parseElemsHtml: [parseHtmlConf],
996
+ menus: [imageFloatLeftMenuConf, imageFloatRightMenuConf, imageFloatNoneMenuConf],
997
+ };
998
+
999
+ /**
1000
+ * @description src entry
1001
+ * @author Yanghc
1002
+ */
1003
+
1004
+ return module;
1005
+
1006
+ }));