@wangeditor-next/plugin-float-image 0.1.0

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