@chaoswise/ui 3.0.4 → 3.0.6

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 (1319) hide show
  1. package/package.json +1 -1
  2. package/lib/AbreastLayout/CollapsedBtn.js +0 -45
  3. package/lib/AbreastLayout/CollapsedIcon.js +0 -14
  4. package/lib/AbreastLayout/NavTreeContainer.js +0 -26
  5. package/lib/AbreastLayout/assets/icon.png +0 -0
  6. package/lib/AbreastLayout/assets/icon.svg +0 -11
  7. package/lib/AbreastLayout/assets/icon1.svg +0 -20
  8. package/lib/AbreastLayout/index.js +0 -215
  9. package/lib/AbreastLayout/index.style.js +0 -91
  10. package/lib/Ace/ace.js +0 -600
  11. package/lib/Ace/diff.js +0 -291
  12. package/lib/Ace/editorOptions.js +0 -34
  13. package/lib/Ace/index.js +0 -6
  14. package/lib/Ace/split.js +0 -462
  15. package/lib/AdaptiveLayout/index.js +0 -251
  16. package/lib/Affix/index.js +0 -2
  17. package/lib/Alert/index.js +0 -2
  18. package/lib/Anchor/index.js +0 -2
  19. package/lib/Antd5/_util/ActionButton.js +0 -117
  20. package/lib/Antd5/_util/PurePanel.js +0 -103
  21. package/lib/Antd5/_util/aria-data-attrs.js +0 -1
  22. package/lib/Antd5/_util/capitalize.js +0 -7
  23. package/lib/Antd5/_util/colors.js +0 -26
  24. package/lib/Antd5/_util/easings.js +0 -10
  25. package/lib/Antd5/_util/extendsObject.js +0 -26
  26. package/lib/Antd5/_util/gapSize.js +0 -10
  27. package/lib/Antd5/_util/getAllowClear.js +0 -16
  28. package/lib/Antd5/_util/getRenderPropValue.js +0 -6
  29. package/lib/Antd5/_util/getScroll.js +0 -29
  30. package/lib/Antd5/_util/hooks/useClosable.js +0 -119
  31. package/lib/Antd5/_util/hooks/useForceUpdate.js +0 -15
  32. package/lib/Antd5/_util/hooks/useMultipleSelect.js +0 -47
  33. package/lib/Antd5/_util/hooks/usePatchElement.js +0 -33
  34. package/lib/Antd5/_util/hooks/useProxyImperativeHandle.js +0 -32
  35. package/lib/Antd5/_util/hooks/useSyncState.js +0 -13
  36. package/lib/Antd5/_util/hooks/useZIndex.js +0 -56
  37. package/lib/Antd5/_util/isNumeric.js +0 -4
  38. package/lib/Antd5/_util/motion.js +0 -47
  39. package/lib/Antd5/_util/placements.js +0 -182
  40. package/lib/Antd5/_util/reactNode.js +0 -13
  41. package/lib/Antd5/_util/responsiveObserver.js +0 -123
  42. package/lib/Antd5/_util/scrollTo.js +0 -34
  43. package/lib/Antd5/_util/statusUtils.js +0 -12
  44. package/lib/Antd5/_util/styleChecker.js +0 -6
  45. package/lib/Antd5/_util/throttleByAnimationFrame.js +0 -30
  46. package/lib/Antd5/_util/transButton.js +0 -63
  47. package/lib/Antd5/_util/transKeys.js +0 -18
  48. package/lib/Antd5/_util/type.js +0 -1
  49. package/lib/Antd5/_util/warning.js +0 -59
  50. package/lib/Antd5/_util/wave/WaveEffect.js +0 -160
  51. package/lib/Antd5/_util/wave/index.js +0 -63
  52. package/lib/Antd5/_util/wave/interface.js +0 -1
  53. package/lib/Antd5/_util/wave/style.js +0 -32
  54. package/lib/Antd5/_util/wave/useWave.js +0 -48
  55. package/lib/Antd5/_util/wave/util.js +0 -29
  56. package/lib/Antd5/_util/zindexContext.js +0 -6
  57. package/lib/Antd5/affix/index.js +0 -228
  58. package/lib/Antd5/affix/style/index.js +0 -20
  59. package/lib/Antd5/affix/utils.js +0 -19
  60. package/lib/Antd5/alert/Alert.js +0 -233
  61. package/lib/Antd5/alert/ErrorBoundary.js +0 -76
  62. package/lib/Antd5/alert/design/behavior-pattern.js +0 -31
  63. package/lib/Antd5/alert/index.js +0 -5
  64. package/lib/Antd5/alert/style/index.js +0 -153
  65. package/lib/Antd5/anchor/Anchor.js +0 -278
  66. package/lib/Antd5/anchor/AnchorLink.js +0 -67
  67. package/lib/Antd5/anchor/context.js +0 -3
  68. package/lib/Antd5/anchor/index.js +0 -5
  69. package/lib/Antd5/anchor/style/index.js +0 -124
  70. package/lib/Antd5/app/context.js +0 -8
  71. package/lib/Antd5/app/index.js +0 -93
  72. package/lib/Antd5/app/style/index.js +0 -24
  73. package/lib/Antd5/auto-complete/index.js +0 -112
  74. package/lib/Antd5/avatar/AvatarContext.js +0 -3
  75. package/lib/Antd5/avatar/avatar.js +0 -189
  76. package/lib/Antd5/avatar/group.js +0 -103
  77. package/lib/Antd5/avatar/index.js +0 -6
  78. package/lib/Antd5/avatar/style/index.js +0 -110
  79. package/lib/Antd5/back-top/index.js +0 -113
  80. package/lib/Antd5/back-top/style/index.js +0 -82
  81. package/lib/Antd5/badge/Ribbon.js +0 -65
  82. package/lib/Antd5/badge/ScrollNumber.js +0 -72
  83. package/lib/Antd5/badge/SingleNumber.js +0 -122
  84. package/lib/Antd5/badge/index.js +0 -189
  85. package/lib/Antd5/badge/style/index.js +0 -291
  86. package/lib/Antd5/badge/style/ribbon.js +0 -72
  87. package/lib/Antd5/breadcrumb/Breadcrumb.js +0 -157
  88. package/lib/Antd5/breadcrumb/BreadcrumbItem.js +0 -103
  89. package/lib/Antd5/breadcrumb/BreadcrumbSeparator.js +0 -16
  90. package/lib/Antd5/breadcrumb/design/behavior-pattern.js +0 -36
  91. package/lib/Antd5/breadcrumb/index.js +0 -2
  92. package/lib/Antd5/breadcrumb/style/index.js +0 -82
  93. package/lib/Antd5/breadcrumb/useItemRender.js +0 -57
  94. package/lib/Antd5/breadcrumb/useItems.js +0 -42
  95. package/lib/Antd5/button/IconWrapper.js +0 -17
  96. package/lib/Antd5/button/LoadingIcon.js +0 -87
  97. package/lib/Antd5/button/button-group.js +0 -59
  98. package/lib/Antd5/button/button.js +0 -230
  99. package/lib/Antd5/button/buttonHelpers.js +0 -68
  100. package/lib/Antd5/button/index.js +0 -3
  101. package/lib/Antd5/button/style/compactCmp.js +0 -46
  102. package/lib/Antd5/button/style/group.js +0 -52
  103. package/lib/Antd5/button/style/index.js +0 -322
  104. package/lib/Antd5/button/style/token.js +0 -61
  105. package/lib/Antd5/calendar/Header.js +0 -176
  106. package/lib/Antd5/calendar/generateCalendar.js +0 -225
  107. package/lib/Antd5/calendar/index.js +0 -5
  108. package/lib/Antd5/calendar/locale/ar_EG.js +0 -2
  109. package/lib/Antd5/calendar/locale/az_AZ.js +0 -2
  110. package/lib/Antd5/calendar/locale/bg_BG.js +0 -2
  111. package/lib/Antd5/calendar/locale/bn_BD.js +0 -2
  112. package/lib/Antd5/calendar/locale/by_BY.js +0 -2
  113. package/lib/Antd5/calendar/locale/ca_ES.js +0 -2
  114. package/lib/Antd5/calendar/locale/cs_CZ.js +0 -2
  115. package/lib/Antd5/calendar/locale/da_DK.js +0 -2
  116. package/lib/Antd5/calendar/locale/de_DE.js +0 -2
  117. package/lib/Antd5/calendar/locale/el_GR.js +0 -2
  118. package/lib/Antd5/calendar/locale/en_GB.js +0 -2
  119. package/lib/Antd5/calendar/locale/en_US.js +0 -2
  120. package/lib/Antd5/calendar/locale/es_ES.js +0 -2
  121. package/lib/Antd5/calendar/locale/et_EE.js +0 -2
  122. package/lib/Antd5/calendar/locale/eu_ES.js +0 -2
  123. package/lib/Antd5/calendar/locale/fa_IR.js +0 -2
  124. package/lib/Antd5/calendar/locale/fi_FI.js +0 -2
  125. package/lib/Antd5/calendar/locale/fr_BE.js +0 -2
  126. package/lib/Antd5/calendar/locale/fr_CA.js +0 -2
  127. package/lib/Antd5/calendar/locale/fr_FR.js +0 -2
  128. package/lib/Antd5/calendar/locale/ga_IE.js +0 -2
  129. package/lib/Antd5/calendar/locale/gl_ES.js +0 -2
  130. package/lib/Antd5/calendar/locale/he_IL.js +0 -2
  131. package/lib/Antd5/calendar/locale/hi_IN.js +0 -2
  132. package/lib/Antd5/calendar/locale/hr_HR.js +0 -2
  133. package/lib/Antd5/calendar/locale/hu_HU.js +0 -2
  134. package/lib/Antd5/calendar/locale/id_ID.js +0 -2
  135. package/lib/Antd5/calendar/locale/is_IS.js +0 -2
  136. package/lib/Antd5/calendar/locale/it_IT.js +0 -2
  137. package/lib/Antd5/calendar/locale/ja_JP.js +0 -2
  138. package/lib/Antd5/calendar/locale/ka_GE.js +0 -2
  139. package/lib/Antd5/calendar/locale/kk_KZ.js +0 -2
  140. package/lib/Antd5/calendar/locale/km_KH.js +0 -2
  141. package/lib/Antd5/calendar/locale/kmr_IQ.js +0 -2
  142. package/lib/Antd5/calendar/locale/kn_IN.js +0 -2
  143. package/lib/Antd5/calendar/locale/ko_KR.js +0 -2
  144. package/lib/Antd5/calendar/locale/lt_LT.js +0 -2
  145. package/lib/Antd5/calendar/locale/lv_LV.js +0 -2
  146. package/lib/Antd5/calendar/locale/mk_MK.js +0 -2
  147. package/lib/Antd5/calendar/locale/ml_IN.js +0 -2
  148. package/lib/Antd5/calendar/locale/mn_MN.js +0 -2
  149. package/lib/Antd5/calendar/locale/ms_MY.js +0 -2
  150. package/lib/Antd5/calendar/locale/my_MM.js +0 -2
  151. package/lib/Antd5/calendar/locale/nb_NO.js +0 -2
  152. package/lib/Antd5/calendar/locale/nl_BE.js +0 -2
  153. package/lib/Antd5/calendar/locale/nl_NL.js +0 -2
  154. package/lib/Antd5/calendar/locale/pl_PL.js +0 -2
  155. package/lib/Antd5/calendar/locale/pt_BR.js +0 -2
  156. package/lib/Antd5/calendar/locale/pt_PT.js +0 -2
  157. package/lib/Antd5/calendar/locale/ro_RO.js +0 -2
  158. package/lib/Antd5/calendar/locale/ru_RU.js +0 -2
  159. package/lib/Antd5/calendar/locale/si_LK.js +0 -2
  160. package/lib/Antd5/calendar/locale/sk_SK.js +0 -2
  161. package/lib/Antd5/calendar/locale/sl_SI.js +0 -2
  162. package/lib/Antd5/calendar/locale/sr_RS.js +0 -2
  163. package/lib/Antd5/calendar/locale/sv_SE.js +0 -2
  164. package/lib/Antd5/calendar/locale/ta_IN.js +0 -2
  165. package/lib/Antd5/calendar/locale/th_TH.js +0 -2
  166. package/lib/Antd5/calendar/locale/tk_TK.js +0 -2
  167. package/lib/Antd5/calendar/locale/tr_TR.js +0 -2
  168. package/lib/Antd5/calendar/locale/uk_UA.js +0 -2
  169. package/lib/Antd5/calendar/locale/ur_PK.js +0 -2
  170. package/lib/Antd5/calendar/locale/uz_UZ.js +0 -2
  171. package/lib/Antd5/calendar/locale/vi_VN.js +0 -2
  172. package/lib/Antd5/calendar/locale/zh_CN.js +0 -2
  173. package/lib/Antd5/calendar/locale/zh_TW.js +0 -2
  174. package/lib/Antd5/calendar/style/index.js +0 -153
  175. package/lib/Antd5/card/Card.js +0 -201
  176. package/lib/Antd5/card/Grid.js +0 -28
  177. package/lib/Antd5/card/Meta.js +0 -46
  178. package/lib/Antd5/card/index.js +0 -10
  179. package/lib/Antd5/card/style/index.js +0 -287
  180. package/lib/Antd5/carousel/index.js +0 -120
  181. package/lib/Antd5/carousel/style/index.js +0 -310
  182. package/lib/Antd5/cascader/Panel.js +0 -68
  183. package/lib/Antd5/cascader/hooks/useBase.js +0 -12
  184. package/lib/Antd5/cascader/hooks/useCheckable.js +0 -9
  185. package/lib/Antd5/cascader/hooks/useColumnIcons.js +0 -18
  186. package/lib/Antd5/cascader/index.js +0 -264
  187. package/lib/Antd5/cascader/style/columns.js +0 -87
  188. package/lib/Antd5/cascader/style/index.js +0 -48
  189. package/lib/Antd5/cascader/style/panel.js +0 -29
  190. package/lib/Antd5/checkbox/Checkbox.js +0 -125
  191. package/lib/Antd5/checkbox/Group.js +0 -148
  192. package/lib/Antd5/checkbox/GroupContext.js +0 -3
  193. package/lib/Antd5/checkbox/index.js +0 -9
  194. package/lib/Antd5/checkbox/style/index.js +0 -159
  195. package/lib/Antd5/col/index.js +0 -2
  196. package/lib/Antd5/col/style/index.js +0 -3
  197. package/lib/Antd5/collapse/Collapse.js +0 -121
  198. package/lib/Antd5/collapse/CollapsePanel.js +0 -33
  199. package/lib/Antd5/collapse/index.js +0 -2
  200. package/lib/Antd5/collapse/style/index.js +0 -183
  201. package/lib/Antd5/color-picker/ColorPicker.js +0 -233
  202. package/lib/Antd5/color-picker/ColorPickerPanel.js +0 -64
  203. package/lib/Antd5/color-picker/color.js +0 -67
  204. package/lib/Antd5/color-picker/components/ColorAlphaInput.js +0 -45
  205. package/lib/Antd5/color-picker/components/ColorClear.js +0 -22
  206. package/lib/Antd5/color-picker/components/ColorHexInput.js +0 -47
  207. package/lib/Antd5/color-picker/components/ColorHsbInput.js +0 -76
  208. package/lib/Antd5/color-picker/components/ColorInput.js +0 -86
  209. package/lib/Antd5/color-picker/components/ColorPresets.js +0 -109
  210. package/lib/Antd5/color-picker/components/ColorRgbInput.js +0 -67
  211. package/lib/Antd5/color-picker/components/ColorSteppers.js +0 -47
  212. package/lib/Antd5/color-picker/components/ColorTrigger.js +0 -65
  213. package/lib/Antd5/color-picker/components/PanelPicker.js +0 -53
  214. package/lib/Antd5/color-picker/components/PanelPresets.js +0 -18
  215. package/lib/Antd5/color-picker/context.js +0 -7
  216. package/lib/Antd5/color-picker/hooks/useColorState.js +0 -53
  217. package/lib/Antd5/color-picker/index.js +0 -2
  218. package/lib/Antd5/color-picker/interface.js +0 -6
  219. package/lib/Antd5/color-picker/style/color-block.js +0 -36
  220. package/lib/Antd5/color-picker/style/index.js +0 -203
  221. package/lib/Antd5/color-picker/style/input.js +0 -74
  222. package/lib/Antd5/color-picker/style/picker.js +0 -64
  223. package/lib/Antd5/color-picker/style/presets.js +0 -94
  224. package/lib/Antd5/color-picker/util.js +0 -18
  225. package/lib/Antd5/config-provider/DisabledContext.js +0 -13
  226. package/lib/Antd5/config-provider/MotionWrapper.js +0 -26
  227. package/lib/Antd5/config-provider/PropWarning.js +0 -18
  228. package/lib/Antd5/config-provider/SizeContext.js +0 -13
  229. package/lib/Antd5/config-provider/context.js +0 -16
  230. package/lib/Antd5/config-provider/cssVariables.js +0 -88
  231. package/lib/Antd5/config-provider/defaultRenderEmpty.js +0 -31
  232. package/lib/Antd5/config-provider/hooks/useCSSVarCls.js +0 -19
  233. package/lib/Antd5/config-provider/hooks/useConfig.js +0 -12
  234. package/lib/Antd5/config-provider/hooks/useSize.js +0 -19
  235. package/lib/Antd5/config-provider/hooks/useTheme.js +0 -55
  236. package/lib/Antd5/config-provider/hooks/useThemeKey.js +0 -14
  237. package/lib/Antd5/config-provider/index.js +0 -432
  238. package/lib/Antd5/config-provider/style/index.js +0 -2
  239. package/lib/Antd5/date-picker/PickerButton.js +0 -15
  240. package/lib/Antd5/date-picker/design/behavior-pattern.js +0 -89
  241. package/lib/Antd5/date-picker/generatePicker/generateRangePicker.js +0 -170
  242. package/lib/Antd5/date-picker/generatePicker/generateSinglePicker.js +0 -200
  243. package/lib/Antd5/date-picker/generatePicker/index.js +0 -26
  244. package/lib/Antd5/date-picker/generatePicker/interface.js +0 -2
  245. package/lib/Antd5/date-picker/generatePicker/useComponents.js +0 -15
  246. package/lib/Antd5/date-picker/index.js +0 -27
  247. package/lib/Antd5/date-picker/locale/ar_EG.js +0 -23
  248. package/lib/Antd5/date-picker/locale/az_AZ.js +0 -16
  249. package/lib/Antd5/date-picker/locale/bg_BG.js +0 -19
  250. package/lib/Antd5/date-picker/locale/bn_BD.js +0 -26
  251. package/lib/Antd5/date-picker/locale/by_BY.js +0 -24
  252. package/lib/Antd5/date-picker/locale/ca_ES.js +0 -19
  253. package/lib/Antd5/date-picker/locale/cs_CZ.js +0 -19
  254. package/lib/Antd5/date-picker/locale/da_DK.js +0 -19
  255. package/lib/Antd5/date-picker/locale/de_DE.js +0 -21
  256. package/lib/Antd5/date-picker/locale/el_GR.js +0 -19
  257. package/lib/Antd5/date-picker/locale/en_GB.js +0 -27
  258. package/lib/Antd5/date-picker/locale/en_US.js +0 -27
  259. package/lib/Antd5/date-picker/locale/es_ES.js +0 -21
  260. package/lib/Antd5/date-picker/locale/et_EE.js +0 -19
  261. package/lib/Antd5/date-picker/locale/eu_ES.js +0 -19
  262. package/lib/Antd5/date-picker/locale/example.json +0 -55
  263. package/lib/Antd5/date-picker/locale/fa_IR.js +0 -27
  264. package/lib/Antd5/date-picker/locale/fi_FI.js +0 -19
  265. package/lib/Antd5/date-picker/locale/fr_BE.js +0 -26
  266. package/lib/Antd5/date-picker/locale/fr_CA.js +0 -26
  267. package/lib/Antd5/date-picker/locale/fr_FR.js +0 -26
  268. package/lib/Antd5/date-picker/locale/ga_IE.js +0 -26
  269. package/lib/Antd5/date-picker/locale/gl_ES.js +0 -19
  270. package/lib/Antd5/date-picker/locale/he_IL.js +0 -19
  271. package/lib/Antd5/date-picker/locale/hi_IN.js +0 -26
  272. package/lib/Antd5/date-picker/locale/hr_HR.js +0 -26
  273. package/lib/Antd5/date-picker/locale/hu_HU.js +0 -19
  274. package/lib/Antd5/date-picker/locale/id_ID.js +0 -27
  275. package/lib/Antd5/date-picker/locale/is_IS.js +0 -19
  276. package/lib/Antd5/date-picker/locale/it_IT.js +0 -19
  277. package/lib/Antd5/date-picker/locale/ja_JP.js +0 -19
  278. package/lib/Antd5/date-picker/locale/ka_GE.js +0 -23
  279. package/lib/Antd5/date-picker/locale/kk_KZ.js +0 -26
  280. package/lib/Antd5/date-picker/locale/km_KH.js +0 -26
  281. package/lib/Antd5/date-picker/locale/kmr_IQ.js +0 -19
  282. package/lib/Antd5/date-picker/locale/kn_IN.js +0 -19
  283. package/lib/Antd5/date-picker/locale/ko_KR.js +0 -19
  284. package/lib/Antd5/date-picker/locale/lt_LT.js +0 -27
  285. package/lib/Antd5/date-picker/locale/lv_LV.js +0 -19
  286. package/lib/Antd5/date-picker/locale/mk_MK.js +0 -19
  287. package/lib/Antd5/date-picker/locale/ml_IN.js +0 -26
  288. package/lib/Antd5/date-picker/locale/mn_MN.js +0 -19
  289. package/lib/Antd5/date-picker/locale/ms_MY.js +0 -19
  290. package/lib/Antd5/date-picker/locale/my_MM.js +0 -27
  291. package/lib/Antd5/date-picker/locale/nb_NO.js +0 -26
  292. package/lib/Antd5/date-picker/locale/nl_BE.js +0 -26
  293. package/lib/Antd5/date-picker/locale/nl_NL.js +0 -26
  294. package/lib/Antd5/date-picker/locale/pl_PL.js +0 -19
  295. package/lib/Antd5/date-picker/locale/pt_BR.js +0 -19
  296. package/lib/Antd5/date-picker/locale/pt_PT.js +0 -47
  297. package/lib/Antd5/date-picker/locale/ro_RO.js +0 -19
  298. package/lib/Antd5/date-picker/locale/ru_RU.js +0 -29
  299. package/lib/Antd5/date-picker/locale/si_LK.js +0 -27
  300. package/lib/Antd5/date-picker/locale/sk_SK.js +0 -19
  301. package/lib/Antd5/date-picker/locale/sl_SI.js +0 -45
  302. package/lib/Antd5/date-picker/locale/sr_RS.js +0 -26
  303. package/lib/Antd5/date-picker/locale/sv_SE.js +0 -26
  304. package/lib/Antd5/date-picker/locale/ta_IN.js +0 -27
  305. package/lib/Antd5/date-picker/locale/th_TH.js +0 -26
  306. package/lib/Antd5/date-picker/locale/tk_TK.js +0 -24
  307. package/lib/Antd5/date-picker/locale/tr_TR.js +0 -26
  308. package/lib/Antd5/date-picker/locale/uk_UA.js +0 -19
  309. package/lib/Antd5/date-picker/locale/ur_PK.js +0 -26
  310. package/lib/Antd5/date-picker/locale/uz_UZ.js +0 -26
  311. package/lib/Antd5/date-picker/locale/vi_VN.js +0 -27
  312. package/lib/Antd5/date-picker/locale/zh_CN.js +0 -29
  313. package/lib/Antd5/date-picker/locale/zh_TW.js +0 -28
  314. package/lib/Antd5/date-picker/style/index.js +0 -328
  315. package/lib/Antd5/date-picker/style/multiple.js +0 -81
  316. package/lib/Antd5/date-picker/style/panel.js +0 -448
  317. package/lib/Antd5/date-picker/style/token.js +0 -77
  318. package/lib/Antd5/date-picker/style/variants.js +0 -28
  319. package/lib/Antd5/date-picker/util.js +0 -118
  320. package/lib/Antd5/descriptions/Cell.js +0 -57
  321. package/lib/Antd5/descriptions/DescriptionsContext.js +0 -3
  322. package/lib/Antd5/descriptions/Item.js +0 -5
  323. package/lib/Antd5/descriptions/Row.js +0 -107
  324. package/lib/Antd5/descriptions/constant.js +0 -9
  325. package/lib/Antd5/descriptions/hooks/useItems.js +0 -38
  326. package/lib/Antd5/descriptions/hooks/useRow.js +0 -78
  327. package/lib/Antd5/descriptions/index.js +0 -119
  328. package/lib/Antd5/descriptions/style/index.js +0 -146
  329. package/lib/Antd5/divider/index.js +0 -85
  330. package/lib/Antd5/divider/style/index.js +0 -136
  331. package/lib/Antd5/drawer/DrawerPanel.js +0 -107
  332. package/lib/Antd5/drawer/index.js +0 -206
  333. package/lib/Antd5/drawer/style/index.js +0 -192
  334. package/lib/Antd5/drawer/style/motion.js +0 -56
  335. package/lib/Antd5/dropdown/dropdown-button.js +0 -129
  336. package/lib/Antd5/dropdown/dropdown.js +0 -255
  337. package/lib/Antd5/dropdown/index.js +0 -5
  338. package/lib/Antd5/dropdown/style/index.js +0 -220
  339. package/lib/Antd5/dropdown/style/status.js +0 -19
  340. package/lib/Antd5/empty/empty.js +0 -73
  341. package/lib/Antd5/empty/index.js +0 -83
  342. package/lib/Antd5/empty/simple.js +0 -61
  343. package/lib/Antd5/empty/style/index.js +0 -61
  344. package/lib/Antd5/flex/index.js +0 -67
  345. package/lib/Antd5/flex/interface.js +0 -1
  346. package/lib/Antd5/flex/style/index.js +0 -83
  347. package/lib/Antd5/flex/utils.js +0 -33
  348. package/lib/Antd5/float-button/BackTop.js +0 -109
  349. package/lib/Antd5/float-button/FloatButton.js +0 -105
  350. package/lib/Antd5/float-button/FloatButtonContent.js +0 -31
  351. package/lib/Antd5/float-button/FloatButtonGroup.js +0 -144
  352. package/lib/Antd5/float-button/PurePanel.js +0 -49
  353. package/lib/Antd5/float-button/context.js +0 -5
  354. package/lib/Antd5/float-button/index.js +0 -8
  355. package/lib/Antd5/float-button/interface.js +0 -1
  356. package/lib/Antd5/float-button/style/index.js +0 -294
  357. package/lib/Antd5/float-button/util.js +0 -9
  358. package/lib/Antd5/form/ErrorList.js +0 -110
  359. package/lib/Antd5/form/Form.js +0 -166
  360. package/lib/Antd5/form/FormItem/ItemHolder.js +0 -128
  361. package/lib/Antd5/form/FormItem/StatusProvider.js +0 -73
  362. package/lib/Antd5/form/FormItem/index.js +0 -310
  363. package/lib/Antd5/form/FormItemInput.js +0 -100
  364. package/lib/Antd5/form/FormItemLabel.js +0 -120
  365. package/lib/Antd5/form/FormList.js +0 -49
  366. package/lib/Antd5/form/context.js +0 -51
  367. package/lib/Antd5/form/hooks/useChildren.js +0 -8
  368. package/lib/Antd5/form/hooks/useDebounce.js +0 -22
  369. package/lib/Antd5/form/hooks/useForm.js +0 -69
  370. package/lib/Antd5/form/hooks/useFormInstance.js +0 -7
  371. package/lib/Antd5/form/hooks/useFormItemStatus.js +0 -23
  372. package/lib/Antd5/form/hooks/useFormWarning.js +0 -16
  373. package/lib/Antd5/form/hooks/useFrameState.js +0 -46
  374. package/lib/Antd5/form/hooks/useItemRef.js +0 -20
  375. package/lib/Antd5/form/hooks/useVariants.js +0 -21
  376. package/lib/Antd5/form/index.js +0 -19
  377. package/lib/Antd5/form/interface.js +0 -1
  378. package/lib/Antd5/form/style/explain.js +0 -37
  379. package/lib/Antd5/form/style/fallbackCmp.js +0 -26
  380. package/lib/Antd5/form/style/index.js +0 -318
  381. package/lib/Antd5/form/util.js +0 -39
  382. package/lib/Antd5/form/validateMessagesContext.js +0 -5
  383. package/lib/Antd5/grid/RowContext.js +0 -3
  384. package/lib/Antd5/grid/col.js +0 -103
  385. package/lib/Antd5/grid/hooks/useBreakpoint.js +0 -23
  386. package/lib/Antd5/grid/index.js +0 -11
  387. package/lib/Antd5/grid/row.js +0 -169
  388. package/lib/Antd5/grid/style/index.js +0 -153
  389. package/lib/Antd5/icon/index.js +0 -9
  390. package/lib/Antd5/image/PreviewGroup.js +0 -84
  391. package/lib/Antd5/image/index.js +0 -94
  392. package/lib/Antd5/image/style/index.js +0 -264
  393. package/lib/Antd5/index.js +0 -72
  394. package/lib/Antd5/input/Group.js +0 -57
  395. package/lib/Antd5/input/Input.js +0 -188
  396. package/lib/Antd5/input/OTP/OTPInput.js +0 -69
  397. package/lib/Antd5/input/OTP/index.js +0 -210
  398. package/lib/Antd5/input/Password.js +0 -116
  399. package/lib/Antd5/input/Search.js +0 -143
  400. package/lib/Antd5/input/TextArea.js +0 -118
  401. package/lib/Antd5/input/hooks/useRemovePasswordTimeout.js +0 -26
  402. package/lib/Antd5/input/index.js +0 -13
  403. package/lib/Antd5/input/style/index.js +0 -532
  404. package/lib/Antd5/input/style/otp.js +0 -32
  405. package/lib/Antd5/input/style/token.js +0 -46
  406. package/lib/Antd5/input/style/variants.js +0 -213
  407. package/lib/Antd5/input/utils.js +0 -4
  408. package/lib/Antd5/input-number/index.js +0 -163
  409. package/lib/Antd5/input-number/style/index.js +0 -299
  410. package/lib/Antd5/input-number/style/token.js +0 -24
  411. package/lib/Antd5/layout/Sider.js +0 -198
  412. package/lib/Antd5/layout/context.js +0 -11
  413. package/lib/Antd5/layout/hooks/useHasSider.js +0 -14
  414. package/lib/Antd5/layout/index.js +0 -9
  415. package/lib/Antd5/layout/layout.js +0 -143
  416. package/lib/Antd5/layout/style/index.js +0 -187
  417. package/lib/Antd5/layout/style/light.js +0 -24
  418. package/lib/Antd5/list/Item.js +0 -113
  419. package/lib/Antd5/list/context.js +0 -3
  420. package/lib/Antd5/list/index.js +0 -246
  421. package/lib/Antd5/list/style/index.js +0 -249
  422. package/lib/Antd5/locale/ar_EG.js +0 -114
  423. package/lib/Antd5/locale/az_AZ.js +0 -97
  424. package/lib/Antd5/locale/bg_BG.js +0 -95
  425. package/lib/Antd5/locale/bn_BD.js +0 -127
  426. package/lib/Antd5/locale/by_BY.js +0 -129
  427. package/lib/Antd5/locale/ca_ES.js +0 -122
  428. package/lib/Antd5/locale/context.js +0 -3
  429. package/lib/Antd5/locale/cs_CZ.js +0 -129
  430. package/lib/Antd5/locale/da_DK.js +0 -105
  431. package/lib/Antd5/locale/de_DE.js +0 -133
  432. package/lib/Antd5/locale/el_GR.js +0 -44
  433. package/lib/Antd5/locale/en_GB.js +0 -129
  434. package/lib/Antd5/locale/en_US.js +0 -144
  435. package/lib/Antd5/locale/es_ES.js +0 -129
  436. package/lib/Antd5/locale/et_EE.js +0 -129
  437. package/lib/Antd5/locale/eu_ES.js +0 -141
  438. package/lib/Antd5/locale/fa_IR.js +0 -138
  439. package/lib/Antd5/locale/fi_FI.js +0 -54
  440. package/lib/Antd5/locale/fr_BE.js +0 -126
  441. package/lib/Antd5/locale/fr_CA.js +0 -126
  442. package/lib/Antd5/locale/fr_FR.js +0 -131
  443. package/lib/Antd5/locale/ga_IE.js +0 -120
  444. package/lib/Antd5/locale/gl_ES.js +0 -108
  445. package/lib/Antd5/locale/he_IL.js +0 -114
  446. package/lib/Antd5/locale/hi_IN.js +0 -127
  447. package/lib/Antd5/locale/hr_HR.js +0 -126
  448. package/lib/Antd5/locale/hu_HU.js +0 -45
  449. package/lib/Antd5/locale/hy_AM.js +0 -106
  450. package/lib/Antd5/locale/id_ID.js +0 -144
  451. package/lib/Antd5/locale/index.js +0 -40
  452. package/lib/Antd5/locale/is_IS.js +0 -95
  453. package/lib/Antd5/locale/it_IT.js +0 -134
  454. package/lib/Antd5/locale/ja_JP.js +0 -144
  455. package/lib/Antd5/locale/ka_GE.js +0 -127
  456. package/lib/Antd5/locale/kk_KZ.js +0 -121
  457. package/lib/Antd5/locale/km_KH.js +0 -105
  458. package/lib/Antd5/locale/kmr_IQ.js +0 -44
  459. package/lib/Antd5/locale/kn_IN.js +0 -51
  460. package/lib/Antd5/locale/ko_KR.js +0 -141
  461. package/lib/Antd5/locale/ku_IQ.js +0 -47
  462. package/lib/Antd5/locale/lt_LT.js +0 -141
  463. package/lib/Antd5/locale/lv_LV.js +0 -44
  464. package/lib/Antd5/locale/mk_MK.js +0 -56
  465. package/lib/Antd5/locale/ml_IN.js +0 -127
  466. package/lib/Antd5/locale/mn_MN.js +0 -44
  467. package/lib/Antd5/locale/ms_MY.js +0 -61
  468. package/lib/Antd5/locale/my_MM.js +0 -136
  469. package/lib/Antd5/locale/nb_NO.js +0 -121
  470. package/lib/Antd5/locale/ne_NP.js +0 -44
  471. package/lib/Antd5/locale/nl_BE.js +0 -127
  472. package/lib/Antd5/locale/nl_NL.js +0 -127
  473. package/lib/Antd5/locale/pl_PL.js +0 -134
  474. package/lib/Antd5/locale/pt_BR.js +0 -134
  475. package/lib/Antd5/locale/pt_PT.js +0 -129
  476. package/lib/Antd5/locale/ro_RO.js +0 -127
  477. package/lib/Antd5/locale/ru_RU.js +0 -138
  478. package/lib/Antd5/locale/si_LK.js +0 -129
  479. package/lib/Antd5/locale/sk_SK.js +0 -129
  480. package/lib/Antd5/locale/sl_SI.js +0 -44
  481. package/lib/Antd5/locale/sr_RS.js +0 -127
  482. package/lib/Antd5/locale/sv_SE.js +0 -138
  483. package/lib/Antd5/locale/ta_IN.js +0 -126
  484. package/lib/Antd5/locale/th_TH.js +0 -138
  485. package/lib/Antd5/locale/tk_TK.js +0 -125
  486. package/lib/Antd5/locale/tr_TR.js +0 -125
  487. package/lib/Antd5/locale/uk_UA.js +0 -138
  488. package/lib/Antd5/locale/ur_PK.js +0 -127
  489. package/lib/Antd5/locale/useLocale.js +0 -28
  490. package/lib/Antd5/locale/uz_UZ.js +0 -143
  491. package/lib/Antd5/locale/vi_VN.js +0 -137
  492. package/lib/Antd5/locale/zh_CN.js +0 -145
  493. package/lib/Antd5/locale/zh_HK.js +0 -138
  494. package/lib/Antd5/locale/zh_TW.js +0 -139
  495. package/lib/Antd5/mentions/index.js +0 -198
  496. package/lib/Antd5/mentions/style/index.js +0 -205
  497. package/lib/Antd5/menu/MenuContext.js +0 -7
  498. package/lib/Antd5/menu/MenuDivider.js +0 -28
  499. package/lib/Antd5/menu/MenuItem.js +0 -82
  500. package/lib/Antd5/menu/OverrideContext.js +0 -39
  501. package/lib/Antd5/menu/SubMenu.js +0 -74
  502. package/lib/Antd5/menu/index.js +0 -39
  503. package/lib/Antd5/menu/interface.js +0 -1
  504. package/lib/Antd5/menu/menu.js +0 -174
  505. package/lib/Antd5/menu/style/horizontal.js +0 -38
  506. package/lib/Antd5/menu/style/index.js +0 -441
  507. package/lib/Antd5/menu/style/rtl.js +0 -23
  508. package/lib/Antd5/menu/style/theme.js +0 -158
  509. package/lib/Antd5/menu/style/vertical.js +0 -131
  510. package/lib/Antd5/message/PurePanel.js +0 -77
  511. package/lib/Antd5/message/index.js +0 -281
  512. package/lib/Antd5/message/interface.js +0 -1
  513. package/lib/Antd5/message/style/index.js +0 -128
  514. package/lib/Antd5/message/useMessage.js +0 -235
  515. package/lib/Antd5/message/util.js +0 -23
  516. package/lib/Antd5/modal/ConfirmDialog.js +0 -228
  517. package/lib/Antd5/modal/Modal.js +0 -162
  518. package/lib/Antd5/modal/PurePanel.js +0 -78
  519. package/lib/Antd5/modal/components/ConfirmCancelBtn.js +0 -32
  520. package/lib/Antd5/modal/components/ConfirmOkBtn.js +0 -33
  521. package/lib/Antd5/modal/components/NormalCancelBtn.js +0 -22
  522. package/lib/Antd5/modal/components/NormalOkBtn.js +0 -26
  523. package/lib/Antd5/modal/confirm.js +0 -169
  524. package/lib/Antd5/modal/context.js +0 -4
  525. package/lib/Antd5/modal/destroyFns.js +0 -2
  526. package/lib/Antd5/modal/index.js +0 -38
  527. package/lib/Antd5/modal/interface.js +0 -1
  528. package/lib/Antd5/modal/locale.js +0 -31
  529. package/lib/Antd5/modal/shared.js +0 -81
  530. package/lib/Antd5/modal/style/confirm.js +0 -83
  531. package/lib/Antd5/modal/style/index.js +0 -221
  532. package/lib/Antd5/modal/useModal/HookModal.js +0 -87
  533. package/lib/Antd5/modal/useModal/index.js +0 -128
  534. package/lib/Antd5/notification/PurePanel.js +0 -134
  535. package/lib/Antd5/notification/index.js +0 -215
  536. package/lib/Antd5/notification/interface.js +0 -1
  537. package/lib/Antd5/notification/style/index.js +0 -184
  538. package/lib/Antd5/notification/style/placement.js +0 -77
  539. package/lib/Antd5/notification/style/pure-panel.js +0 -18
  540. package/lib/Antd5/notification/style/stack.js +0 -81
  541. package/lib/Antd5/notification/useNotification.js +0 -201
  542. package/lib/Antd5/notification/util.js +0 -57
  543. package/lib/Antd5/pagination/Pagination.js +0 -135
  544. package/lib/Antd5/pagination/Select.js +0 -24
  545. package/lib/Antd5/pagination/design/behavior-pattern.js +0 -32
  546. package/lib/Antd5/pagination/index.js +0 -2
  547. package/lib/Antd5/pagination/style/bordered.js +0 -68
  548. package/lib/Antd5/pagination/style/index.js +0 -411
  549. package/lib/Antd5/popconfirm/PurePanel.js +0 -114
  550. package/lib/Antd5/popconfirm/index.js +0 -109
  551. package/lib/Antd5/popconfirm/style/index.js +0 -61
  552. package/lib/Antd5/popover/PurePanel.js +0 -77
  553. package/lib/Antd5/popover/index.js +0 -126
  554. package/lib/Antd5/popover/style/index.js +0 -137
  555. package/lib/Antd5/progress/Circle.js +0 -95
  556. package/lib/Antd5/progress/Line.js +0 -149
  557. package/lib/Antd5/progress/Steps.js +0 -55
  558. package/lib/Antd5/progress/design/behavior-pattern.js +0 -31
  559. package/lib/Antd5/progress/index.js +0 -2
  560. package/lib/Antd5/progress/progress.js +0 -144
  561. package/lib/Antd5/progress/style/index.js +0 -201
  562. package/lib/Antd5/progress/utils.js +0 -97
  563. package/lib/Antd5/qr-code/index.js +0 -125
  564. package/lib/Antd5/qr-code/interface.js +0 -1
  565. package/lib/Antd5/qr-code/style/index.js +0 -66
  566. package/lib/Antd5/qrcode/index.js +0 -4
  567. package/lib/Antd5/qrcode/interface.js +0 -3
  568. package/lib/Antd5/qrcode/style/index.js +0 -3
  569. package/lib/Antd5/radio/context.js +0 -6
  570. package/lib/Antd5/radio/group.js +0 -131
  571. package/lib/Antd5/radio/index.js +0 -9
  572. package/lib/Antd5/radio/interface.js +0 -1
  573. package/lib/Antd5/radio/radio.js +0 -137
  574. package/lib/Antd5/radio/radioButton.js +0 -31
  575. package/lib/Antd5/radio/style/index.js +0 -533
  576. package/lib/Antd5/rate/index.js +0 -69
  577. package/lib/Antd5/rate/style/index.js +0 -88
  578. package/lib/Antd5/result/index.js +0 -128
  579. package/lib/Antd5/result/noFound.js +0 -243
  580. package/lib/Antd5/result/serverError.js +0 -283
  581. package/lib/Antd5/result/style/index.js +0 -101
  582. package/lib/Antd5/result/unauthorized.js +0 -230
  583. package/lib/Antd5/row/index.js +0 -2
  584. package/lib/Antd5/row/style/index.js +0 -3
  585. package/lib/Antd5/segmented/index.js +0 -87
  586. package/lib/Antd5/segmented/style/index.js +0 -162
  587. package/lib/Antd5/select/index.js +0 -222
  588. package/lib/Antd5/select/mergedBuiltinPlacements.js +0 -40
  589. package/lib/Antd5/select/style/dropdown.js +0 -109
  590. package/lib/Antd5/select/style/index.js +0 -183
  591. package/lib/Antd5/select/style/multiple.js +0 -217
  592. package/lib/Antd5/select/style/single.js +0 -101
  593. package/lib/Antd5/select/style/token.js +0 -53
  594. package/lib/Antd5/select/style/variants.js +0 -126
  595. package/lib/Antd5/select/useIcons.js +0 -82
  596. package/lib/Antd5/select/useShowArrow.js +0 -9
  597. package/lib/Antd5/skeleton/Avatar.js +0 -48
  598. package/lib/Antd5/skeleton/Button.js +0 -47
  599. package/lib/Antd5/skeleton/Element.js +0 -30
  600. package/lib/Antd5/skeleton/Image.js +0 -49
  601. package/lib/Antd5/skeleton/Input.js +0 -46
  602. package/lib/Antd5/skeleton/Node.js +0 -43
  603. package/lib/Antd5/skeleton/Paragraph.js +0 -44
  604. package/lib/Antd5/skeleton/Skeleton.js +0 -153
  605. package/lib/Antd5/skeleton/Title.js +0 -23
  606. package/lib/Antd5/skeleton/index.js +0 -2
  607. package/lib/Antd5/skeleton/style/index.js +0 -247
  608. package/lib/Antd5/slider/SliderTooltip.js +0 -43
  609. package/lib/Antd5/slider/index.js +0 -236
  610. package/lib/Antd5/slider/style/index.js +0 -246
  611. package/lib/Antd5/slider/useRafLock.js +0 -32
  612. package/lib/Antd5/space/Compact.js +0 -103
  613. package/lib/Antd5/space/Item.js +0 -26
  614. package/lib/Antd5/space/context.js +0 -5
  615. package/lib/Antd5/space/index.js +0 -120
  616. package/lib/Antd5/space/style/compact.js +0 -18
  617. package/lib/Antd5/space/style/index.js +0 -79
  618. package/lib/Antd5/spin/index.js +0 -149
  619. package/lib/Antd5/spin/style/index.js +0 -206
  620. package/lib/Antd5/statistic/Countdown.js +0 -73
  621. package/lib/Antd5/statistic/Number.js +0 -47
  622. package/lib/Antd5/statistic/Statistic.js +0 -99
  623. package/lib/Antd5/statistic/index.js +0 -4
  624. package/lib/Antd5/statistic/interface.js +0 -1
  625. package/lib/Antd5/statistic/style/index.js +0 -51
  626. package/lib/Antd5/statistic/utils.js +0 -57
  627. package/lib/Antd5/steps/index.js +0 -120
  628. package/lib/Antd5/steps/style/custom-icon.js +0 -26
  629. package/lib/Antd5/steps/style/horizontal.js +0 -12
  630. package/lib/Antd5/steps/style/index.js +0 -249
  631. package/lib/Antd5/steps/style/inline.js +0 -95
  632. package/lib/Antd5/steps/style/label-placement.js +0 -46
  633. package/lib/Antd5/steps/style/nav.js +0 -109
  634. package/lib/Antd5/steps/style/progress-dot.js +0 -100
  635. package/lib/Antd5/steps/style/progress.js +0 -52
  636. package/lib/Antd5/steps/style/rtl.js +0 -25
  637. package/lib/Antd5/steps/style/small.js +0 -53
  638. package/lib/Antd5/steps/style/vertical.js +0 -55
  639. package/lib/Antd5/steps/useLegacyItems.js +0 -32
  640. package/lib/Antd5/style/compact-item-vertical.js +0 -33
  641. package/lib/Antd5/style/compact-item.js +0 -47
  642. package/lib/Antd5/style/index.js +0 -126
  643. package/lib/Antd5/style/motion/collapse.js +0 -16
  644. package/lib/Antd5/style/motion/fade.js +0 -34
  645. package/lib/Antd5/style/motion/index.js +0 -6
  646. package/lib/Antd5/style/motion/motion.js +0 -35
  647. package/lib/Antd5/style/motion/move.js +0 -133
  648. package/lib/Antd5/style/motion/slide.js +0 -137
  649. package/lib/Antd5/style/motion/zoom.js +0 -179
  650. package/lib/Antd5/style/operationUnit.js +0 -18
  651. package/lib/Antd5/style/placementArrow.js +0 -120
  652. package/lib/Antd5/style/reset.css +0 -253
  653. package/lib/Antd5/style/roundedArrow.js +0 -72
  654. package/lib/Antd5/switch/index.js +0 -97
  655. package/lib/Antd5/switch/style/index.js +0 -245
  656. package/lib/Antd5/table/Column.js +0 -7
  657. package/lib/Antd5/table/ColumnGroup.js +0 -7
  658. package/lib/Antd5/table/ExpandIcon.js +0 -28
  659. package/lib/Antd5/table/InternalTable.js +0 -451
  660. package/lib/Antd5/table/RcTable/VirtualTable.js +0 -9
  661. package/lib/Antd5/table/RcTable/index.js +0 -9
  662. package/lib/Antd5/table/Table.js +0 -34
  663. package/lib/Antd5/table/hooks/useContainerWidth.js +0 -14
  664. package/lib/Antd5/table/hooks/useFilter/FilterDropdown.js +0 -497
  665. package/lib/Antd5/table/hooks/useFilter/FilterSearch.js +0 -27
  666. package/lib/Antd5/table/hooks/useFilter/FilterWrapper.js +0 -24
  667. package/lib/Antd5/table/hooks/useFilter/index.js +0 -234
  668. package/lib/Antd5/table/hooks/useLazyKVMap.js +0 -30
  669. package/lib/Antd5/table/hooks/usePagination.js +0 -78
  670. package/lib/Antd5/table/hooks/useSelection.js +0 -578
  671. package/lib/Antd5/table/hooks/useSorter.js +0 -362
  672. package/lib/Antd5/table/hooks/useTitleColumns.js +0 -24
  673. package/lib/Antd5/table/index.js +0 -2
  674. package/lib/Antd5/table/interface.js +0 -3
  675. package/lib/Antd5/table/style/bordered.js +0 -68
  676. package/lib/Antd5/table/style/ellipsis.js +0 -24
  677. package/lib/Antd5/table/style/empty.js +0 -15
  678. package/lib/Antd5/table/style/expand.js +0 -106
  679. package/lib/Antd5/table/style/filter.js +0 -127
  680. package/lib/Antd5/table/style/fixed.js +0 -82
  681. package/lib/Antd5/table/style/index.js +0 -273
  682. package/lib/Antd5/table/style/pagination.js +0 -30
  683. package/lib/Antd5/table/style/radius.js +0 -35
  684. package/lib/Antd5/table/style/rtl.js +0 -40
  685. package/lib/Antd5/table/style/selection.js +0 -67
  686. package/lib/Antd5/table/style/size.js +0 -30
  687. package/lib/Antd5/table/style/sorter.js +0 -75
  688. package/lib/Antd5/table/style/sticky.js +0 -53
  689. package/lib/Antd5/table/style/summary.js +0 -25
  690. package/lib/Antd5/table/style/virtual.js +0 -49
  691. package/lib/Antd5/table/util.js +0 -31
  692. package/lib/Antd5/tabs/TabPane.js +0 -7
  693. package/lib/Antd5/tabs/hooks/useAnimateConfig.js +0 -40
  694. package/lib/Antd5/tabs/hooks/useLegacyItems.js +0 -43
  695. package/lib/Antd5/tabs/index.js +0 -115
  696. package/lib/Antd5/tabs/style/index.js +0 -633
  697. package/lib/Antd5/tabs/style/motion.js +0 -36
  698. package/lib/Antd5/tag/CheckableTag.js +0 -51
  699. package/lib/Antd5/tag/index.js +0 -133
  700. package/lib/Antd5/tag/style/index.js +0 -104
  701. package/lib/Antd5/tag/style/presetCmp.js +0 -34
  702. package/lib/Antd5/tag/style/statusCmp.js +0 -22
  703. package/lib/Antd5/theme/context.js +0 -15
  704. package/lib/Antd5/theme/getDesignToken.js +0 -18
  705. package/lib/Antd5/theme/index.js +0 -39
  706. package/lib/Antd5/theme/interface/alias.js +0 -1
  707. package/lib/Antd5/theme/interface/components.js +0 -1
  708. package/lib/Antd5/theme/interface/index.js +0 -1
  709. package/lib/Antd5/theme/interface/maps/colors.js +0 -1
  710. package/lib/Antd5/theme/interface/maps/font.js +0 -1
  711. package/lib/Antd5/theme/interface/maps/index.js +0 -4
  712. package/lib/Antd5/theme/interface/maps/size.js +0 -1
  713. package/lib/Antd5/theme/interface/maps/style.js +0 -1
  714. package/lib/Antd5/theme/interface/presetColors.js +0 -1
  715. package/lib/Antd5/theme/interface/seeds.js +0 -1
  716. package/lib/Antd5/theme/internal.js +0 -13
  717. package/lib/Antd5/theme/themes/ColorMap.js +0 -1
  718. package/lib/Antd5/theme/themes/compact/genCompactSizeMapToken.js +0 -16
  719. package/lib/Antd5/theme/themes/compact/index.js +0 -22
  720. package/lib/Antd5/theme/themes/dark/colorAlgorithm.js +0 -8
  721. package/lib/Antd5/theme/themes/dark/colors.js +0 -45
  722. package/lib/Antd5/theme/themes/dark/index.js +0 -32
  723. package/lib/Antd5/theme/themes/default/colorAlgorithm.js +0 -8
  724. package/lib/Antd5/theme/themes/default/colors.js +0 -43
  725. package/lib/Antd5/theme/themes/default/index.js +0 -31
  726. package/lib/Antd5/theme/themes/seed.js +0 -68
  727. package/lib/Antd5/theme/themes/shared/genColorMapToken.js +0 -85
  728. package/lib/Antd5/theme/themes/shared/genCommonMapToken.js +0 -21
  729. package/lib/Antd5/theme/themes/shared/genControlHeight.js +0 -9
  730. package/lib/Antd5/theme/themes/shared/genFontMapToken.js +0 -39
  731. package/lib/Antd5/theme/themes/shared/genFontSizes.js +0 -20
  732. package/lib/Antd5/theme/themes/shared/genRadius.js +0 -46
  733. package/lib/Antd5/theme/themes/shared/genSizeMapToken.js +0 -23
  734. package/lib/Antd5/theme/useToken.js +0 -129
  735. package/lib/Antd5/theme/util/alias.js +0 -143
  736. package/lib/Antd5/theme/util/calc/CSSCalculator.js +0 -119
  737. package/lib/Antd5/theme/util/calc/NumCalculator.js +0 -81
  738. package/lib/Antd5/theme/util/calc/calculator.js +0 -10
  739. package/lib/Antd5/theme/util/calc/index.js +0 -9
  740. package/lib/Antd5/theme/util/genComponentStyleHook.js +0 -243
  741. package/lib/Antd5/theme/util/genPresetColor.js +0 -21
  742. package/lib/Antd5/theme/util/getAlphaColor.js +0 -40
  743. package/lib/Antd5/theme/util/maxmin.js +0 -27
  744. package/lib/Antd5/theme/util/statistic.js +0 -74
  745. package/lib/Antd5/theme/util/useResetIconStyle.js +0 -39
  746. package/lib/Antd5/time-picker/index.js +0 -56
  747. package/lib/Antd5/time-picker/locale/ar_EG.js +0 -4
  748. package/lib/Antd5/time-picker/locale/az_AZ.js +0 -4
  749. package/lib/Antd5/time-picker/locale/bg_BG.js +0 -4
  750. package/lib/Antd5/time-picker/locale/bn_BD.js +0 -5
  751. package/lib/Antd5/time-picker/locale/by_BY.js +0 -5
  752. package/lib/Antd5/time-picker/locale/ca_ES.js +0 -4
  753. package/lib/Antd5/time-picker/locale/cs_CZ.js +0 -4
  754. package/lib/Antd5/time-picker/locale/da_DK.js +0 -5
  755. package/lib/Antd5/time-picker/locale/de_DE.js +0 -5
  756. package/lib/Antd5/time-picker/locale/el_GR.js +0 -4
  757. package/lib/Antd5/time-picker/locale/en_GB.js +0 -4
  758. package/lib/Antd5/time-picker/locale/en_US.js +0 -5
  759. package/lib/Antd5/time-picker/locale/es_ES.js +0 -4
  760. package/lib/Antd5/time-picker/locale/et_EE.js +0 -4
  761. package/lib/Antd5/time-picker/locale/eu_ES.js +0 -4
  762. package/lib/Antd5/time-picker/locale/fa_IR.js +0 -5
  763. package/lib/Antd5/time-picker/locale/fi_FI.js +0 -4
  764. package/lib/Antd5/time-picker/locale/fr_BE.js +0 -5
  765. package/lib/Antd5/time-picker/locale/fr_CA.js +0 -5
  766. package/lib/Antd5/time-picker/locale/fr_FR.js +0 -5
  767. package/lib/Antd5/time-picker/locale/ga_IE.js +0 -5
  768. package/lib/Antd5/time-picker/locale/gl_ES.js +0 -4
  769. package/lib/Antd5/time-picker/locale/he_IL.js +0 -4
  770. package/lib/Antd5/time-picker/locale/hi_IN.js +0 -5
  771. package/lib/Antd5/time-picker/locale/hr_HR.js +0 -5
  772. package/lib/Antd5/time-picker/locale/hu_HU.js +0 -4
  773. package/lib/Antd5/time-picker/locale/id_ID.js +0 -5
  774. package/lib/Antd5/time-picker/locale/is_IS.js +0 -4
  775. package/lib/Antd5/time-picker/locale/it_IT.js +0 -4
  776. package/lib/Antd5/time-picker/locale/ja_JP.js +0 -5
  777. package/lib/Antd5/time-picker/locale/ka_GE.js +0 -5
  778. package/lib/Antd5/time-picker/locale/kk_KZ.js +0 -5
  779. package/lib/Antd5/time-picker/locale/km_KH.js +0 -5
  780. package/lib/Antd5/time-picker/locale/kmr_IQ.js +0 -4
  781. package/lib/Antd5/time-picker/locale/kn_IN.js +0 -4
  782. package/lib/Antd5/time-picker/locale/ko_KR.js +0 -5
  783. package/lib/Antd5/time-picker/locale/lt_LT.js +0 -5
  784. package/lib/Antd5/time-picker/locale/lv_LV.js +0 -4
  785. package/lib/Antd5/time-picker/locale/mk_MK.js +0 -4
  786. package/lib/Antd5/time-picker/locale/ml_IN.js +0 -5
  787. package/lib/Antd5/time-picker/locale/mn_MN.js +0 -4
  788. package/lib/Antd5/time-picker/locale/ms_MY.js +0 -4
  789. package/lib/Antd5/time-picker/locale/my_MM.js +0 -5
  790. package/lib/Antd5/time-picker/locale/nb_NO.js +0 -5
  791. package/lib/Antd5/time-picker/locale/nl_BE.js +0 -5
  792. package/lib/Antd5/time-picker/locale/nl_NL.js +0 -5
  793. package/lib/Antd5/time-picker/locale/pl_PL.js +0 -4
  794. package/lib/Antd5/time-picker/locale/pt_BR.js +0 -4
  795. package/lib/Antd5/time-picker/locale/pt_PT.js +0 -4
  796. package/lib/Antd5/time-picker/locale/ro_RO.js +0 -4
  797. package/lib/Antd5/time-picker/locale/ru_RU.js +0 -5
  798. package/lib/Antd5/time-picker/locale/si_LK.js +0 -5
  799. package/lib/Antd5/time-picker/locale/sk_SK.js +0 -4
  800. package/lib/Antd5/time-picker/locale/sl_SI.js +0 -4
  801. package/lib/Antd5/time-picker/locale/sr_RS.js +0 -5
  802. package/lib/Antd5/time-picker/locale/sv_SE.js +0 -4
  803. package/lib/Antd5/time-picker/locale/ta_IN.js +0 -4
  804. package/lib/Antd5/time-picker/locale/th_TH.js +0 -4
  805. package/lib/Antd5/time-picker/locale/tk_TK.js +0 -5
  806. package/lib/Antd5/time-picker/locale/tr_TR.js +0 -5
  807. package/lib/Antd5/time-picker/locale/uk_UA.js +0 -4
  808. package/lib/Antd5/time-picker/locale/ur_PK.js +0 -5
  809. package/lib/Antd5/time-picker/locale/uz_UZ.js +0 -5
  810. package/lib/Antd5/time-picker/locale/vi_VN.js +0 -5
  811. package/lib/Antd5/time-picker/locale/zh_CN.js +0 -5
  812. package/lib/Antd5/time-picker/locale/zh_TW.js +0 -4
  813. package/lib/Antd5/timeline/Timeline.js +0 -65
  814. package/lib/Antd5/timeline/TimelineItem.js +0 -52
  815. package/lib/Antd5/timeline/TimelineItemList.js +0 -87
  816. package/lib/Antd5/timeline/index.js +0 -2
  817. package/lib/Antd5/timeline/style/index.js +0 -157
  818. package/lib/Antd5/timeline/useItems.js +0 -19
  819. package/lib/Antd5/tooltip/PurePanel.js +0 -55
  820. package/lib/Antd5/tooltip/index.js +0 -211
  821. package/lib/Antd5/tooltip/style/index.js +0 -104
  822. package/lib/Antd5/tooltip/util.js +0 -23
  823. package/lib/Antd5/tour/PurePanel.js +0 -78
  824. package/lib/Antd5/tour/index.js +0 -99
  825. package/lib/Antd5/tour/interface.js +0 -1
  826. package/lib/Antd5/tour/panelRender.js +0 -143
  827. package/lib/Antd5/tour/style/index.js +0 -187
  828. package/lib/Antd5/transfer/ListBody.js +0 -123
  829. package/lib/Antd5/transfer/ListItem.js +0 -72
  830. package/lib/Antd5/transfer/hooks/useData.js +0 -46
  831. package/lib/Antd5/transfer/hooks/useSelection.js +0 -59
  832. package/lib/Antd5/transfer/index.js +0 -361
  833. package/lib/Antd5/transfer/interface.js +0 -1
  834. package/lib/Antd5/transfer/list.js +0 -316
  835. package/lib/Antd5/transfer/operation.js +0 -43
  836. package/lib/Antd5/transfer/search.js +0 -32
  837. package/lib/Antd5/transfer/style/index.js +0 -264
  838. package/lib/Antd5/tree/DirectoryTree.js +0 -173
  839. package/lib/Antd5/tree/Tree.js +0 -123
  840. package/lib/Antd5/tree/index.js +0 -7
  841. package/lib/Antd5/tree/style/index.js +0 -348
  842. package/lib/Antd5/tree/utils/dictUtil.js +0 -74
  843. package/lib/Antd5/tree/utils/dropIndicator.js +0 -35
  844. package/lib/Antd5/tree/utils/iconUtil.js +0 -69
  845. package/lib/Antd5/tree-select/index.js +0 -228
  846. package/lib/Antd5/tree-select/style/index.js +0 -51
  847. package/lib/Antd5/typography/Base/CopyBtn.js +0 -43
  848. package/lib/Antd5/typography/Base/Ellipsis.js +0 -245
  849. package/lib/Antd5/typography/Base/EllipsisTooltip.js +0 -27
  850. package/lib/Antd5/typography/Base/index.js +0 -444
  851. package/lib/Antd5/typography/Base/util.js +0 -12
  852. package/lib/Antd5/typography/Editable.js +0 -119
  853. package/lib/Antd5/typography/Link.js +0 -33
  854. package/lib/Antd5/typography/Paragraph.js +0 -17
  855. package/lib/Antd5/typography/Text.js +0 -35
  856. package/lib/Antd5/typography/Title.js +0 -35
  857. package/lib/Antd5/typography/Typography.js +0 -70
  858. package/lib/Antd5/typography/hooks/useCopyClick.js +0 -95
  859. package/lib/Antd5/typography/hooks/useMergedConfig.js +0 -13
  860. package/lib/Antd5/typography/hooks/usePrevious.js +0 -9
  861. package/lib/Antd5/typography/hooks/useUpdatedEffect.js +0 -13
  862. package/lib/Antd5/typography/index.js +0 -11
  863. package/lib/Antd5/typography/style/index.js +0 -58
  864. package/lib/Antd5/typography/style/mixins.js +0 -216
  865. package/lib/Antd5/upload/Dragger.js +0 -32
  866. package/lib/Antd5/upload/Upload.js +0 -458
  867. package/lib/Antd5/upload/UploadList/ListItem.js +0 -197
  868. package/lib/Antd5/upload/UploadList/index.js +0 -250
  869. package/lib/Antd5/upload/index.js +0 -6
  870. package/lib/Antd5/upload/interface.js +0 -1
  871. package/lib/Antd5/upload/style/dragger.js +0 -51
  872. package/lib/Antd5/upload/style/index.js +0 -48
  873. package/lib/Antd5/upload/style/list.js +0 -86
  874. package/lib/Antd5/upload/style/motion.js +0 -39
  875. package/lib/Antd5/upload/style/picture.js +0 -175
  876. package/lib/Antd5/upload/style/rtl.js +0 -12
  877. package/lib/Antd5/upload/utils.js +0 -140
  878. package/lib/Antd5/version/index.js +0 -4
  879. package/lib/Antd5/version/token-meta.json +0 -1
  880. package/lib/Antd5/version/token.json +0 -1
  881. package/lib/Antd5/version/version.js +0 -1
  882. package/lib/Antd5/watermark/context.js +0 -22
  883. package/lib/Antd5/watermark/index.js +0 -253
  884. package/lib/Antd5/watermark/useClips.js +0 -118
  885. package/lib/Antd5/watermark/useRafDebounce.js +0 -21
  886. package/lib/Antd5/watermark/useWatermark.js +0 -61
  887. package/lib/Antd5/watermark/utils.js +0 -28
  888. package/lib/App/index.js +0 -2
  889. package/lib/AutoComplete/index.js +0 -2
  890. package/lib/Avatar/index.js +0 -2
  891. package/lib/BackTop/index.js +0 -2
  892. package/lib/Badge/index.js +0 -48
  893. package/lib/Badge/index.style.js +0 -65
  894. package/lib/BasicLayout/Breadcrumb.js +0 -78
  895. package/lib/BasicLayout/Nav.js +0 -37
  896. package/lib/BasicLayout/Sider.js +0 -159
  897. package/lib/BasicLayout/index.js +0 -396
  898. package/lib/BasicLayout/locale/en_US.js +0 -4
  899. package/lib/BasicLayout/locale/index.js +0 -11
  900. package/lib/BasicLayout/locale/zh_CN.js +0 -4
  901. package/lib/BasicLayout/locale/zh_TW.js +0 -4
  902. package/lib/BasicLayout/style/index.js +0 -101
  903. package/lib/BasicLayout/style/sider.js +0 -73
  904. package/lib/BasicLayout/utils.js +0 -7
  905. package/lib/Breadcrumb/index.js +0 -2
  906. package/lib/Button/index.js +0 -53
  907. package/lib/Button/index.style.js +0 -41
  908. package/lib/CWCascader/Cascader/index.js +0 -281
  909. package/lib/CWCascader/Cascader/utils/iconUtil.js +0 -81
  910. package/lib/CWCascader/Cascader/utils/motion.js +0 -13
  911. package/lib/CWCascader/index.js +0 -73
  912. package/lib/CWCascader/index.style.js +0 -42
  913. package/lib/CWCascader/rc-cascader/Cascader.js +0 -353
  914. package/lib/CWCascader/rc-cascader/OptionList/Checkbox.js +0 -21
  915. package/lib/CWCascader/rc-cascader/OptionList/Column.js +0 -274
  916. package/lib/CWCascader/rc-cascader/OptionList/index.js +0 -220
  917. package/lib/CWCascader/rc-cascader/OptionList/useActive.js +0 -33
  918. package/lib/CWCascader/rc-cascader/OptionList/useKeyboard.js +0 -172
  919. package/lib/CWCascader/rc-cascader/context.js +0 -3
  920. package/lib/CWCascader/rc-cascader/hooks/useDisplayValues.js +0 -85
  921. package/lib/CWCascader/rc-cascader/hooks/useEntities.js +0 -40
  922. package/lib/CWCascader/rc-cascader/hooks/useMissingValues.js +0 -19
  923. package/lib/CWCascader/rc-cascader/hooks/useRefFunc.js +0 -13
  924. package/lib/CWCascader/rc-cascader/hooks/useSearchConfig.js +0 -30
  925. package/lib/CWCascader/rc-cascader/hooks/useSearchOptions.js +0 -73
  926. package/lib/CWCascader/rc-cascader/index.js +0 -2
  927. package/lib/CWCascader/rc-cascader/utils/commonUtil.js +0 -54
  928. package/lib/CWCascader/rc-cascader/utils/treeUtil.js +0 -81
  929. package/lib/CWCascader/rc-cascader/utils/warningPropsUtil.js +0 -30
  930. package/lib/CWColorPicker/SketchPicker/components/common/Alpha.js +0 -132
  931. package/lib/CWColorPicker/SketchPicker/components/common/Checkboard.js +0 -40
  932. package/lib/CWColorPicker/SketchPicker/components/common/ColorWrap.js +0 -79
  933. package/lib/CWColorPicker/SketchPicker/components/common/EditableInput.js +0 -171
  934. package/lib/CWColorPicker/SketchPicker/components/common/Hue.js +0 -117
  935. package/lib/CWColorPicker/SketchPicker/components/common/Raised.js +0 -91
  936. package/lib/CWColorPicker/SketchPicker/components/common/Saturation.js +0 -138
  937. package/lib/CWColorPicker/SketchPicker/components/common/Swatch.js +0 -62
  938. package/lib/CWColorPicker/SketchPicker/components/common/index.js +0 -8
  939. package/lib/CWColorPicker/SketchPicker/components/sketch/SketchFields.js +0 -148
  940. package/lib/CWColorPicker/SketchPicker/components/sketch/SketchPresetColors.js +0 -72
  941. package/lib/CWColorPicker/SketchPicker/components/sketch/index.js +0 -160
  942. package/lib/CWColorPicker/SketchPicker/helpers/alpha.js +0 -46
  943. package/lib/CWColorPicker/SketchPicker/helpers/checkboard.js +0 -29
  944. package/lib/CWColorPicker/SketchPicker/helpers/color.js +0 -86
  945. package/lib/CWColorPicker/SketchPicker/helpers/hue.js +0 -48
  946. package/lib/CWColorPicker/SketchPicker/helpers/index.js +0 -2
  947. package/lib/CWColorPicker/SketchPicker/helpers/interaction.js +0 -54
  948. package/lib/CWColorPicker/SketchPicker/helpers/saturation.js +0 -28
  949. package/lib/CWColorPicker/index.js +0 -296
  950. package/lib/CWColorPicker/index.style.js +0 -81
  951. package/lib/CWColorPicker/utils.js +0 -15
  952. package/lib/CWMessage/CommonIcon.js +0 -20
  953. package/lib/CWMessage/MessageContent/TabList/index.js +0 -113
  954. package/lib/CWMessage/MessageContent/index.js +0 -268
  955. package/lib/CWMessage/index.js +0 -447
  956. package/lib/CWMessage/index.style.js +0 -132
  957. package/lib/CWMessage/message.svg +0 -14
  958. package/lib/CWMessage/service/index.js +0 -35
  959. package/lib/CWMessage/utils/index.js +0 -33
  960. package/lib/CWRadioTabs/index.js +0 -150
  961. package/lib/CWRadioTabs/index.style.js +0 -33
  962. package/lib/CWRangePicker/DropdownMenu/MoreHistoryList/index.js +0 -37
  963. package/lib/CWRangePicker/DropdownMenu/MoreTimeList/index.js +0 -46
  964. package/lib/CWRangePicker/DropdownMenu/index.js +0 -240
  965. package/lib/CWRangePicker/DropdownMenu/index.style.js +0 -159
  966. package/lib/CWRangePicker/Refresh/index.js +0 -161
  967. package/lib/CWRangePicker/Refresh/index.style.js +0 -37
  968. package/lib/CWRangePicker/TimeSpan/index.js +0 -96
  969. package/lib/CWRangePicker/TimeSpan/index.style.js +0 -25
  970. package/lib/CWRangePicker/assets/Calendar.js +0 -15
  971. package/lib/CWRangePicker/assets/Calendar2.js +0 -15
  972. package/lib/CWRangePicker/assets/Recover.js +0 -18
  973. package/lib/CWRangePicker/assets/Refresh1.js +0 -14
  974. package/lib/CWRangePicker/assets/Refresh2.js +0 -14
  975. package/lib/CWRangePicker/assets/Refresh3.js +0 -14
  976. package/lib/CWRangePicker/assets/live.js +0 -19
  977. package/lib/CWRangePicker/assets/more.js +0 -23
  978. package/lib/CWRangePicker/index.js +0 -742
  979. package/lib/CWRangePicker/index.style.js +0 -78
  980. package/lib/CWRangePicker/locale/en_US.js +0 -29
  981. package/lib/CWRangePicker/locale/index.js +0 -11
  982. package/lib/CWRangePicker/locale/zh_CN.js +0 -29
  983. package/lib/CWRangePicker/locale/zh_TW.js +0 -29
  984. package/lib/CWRangePicker/utils/index.js +0 -706
  985. package/lib/CWSelect/index.js +0 -2
  986. package/lib/CWTable/CWTable.js +0 -605
  987. package/lib/CWTable/header.js +0 -55
  988. package/lib/CWTable/index.js +0 -217
  989. package/lib/CWTable/index.style.js +0 -96
  990. package/lib/CWTree/assets/Drag.js +0 -23
  991. package/lib/CWTree/index.js +0 -399
  992. package/lib/CWTree/index.style.js +0 -127
  993. package/lib/CWTree/locale/en_US.js +0 -3
  994. package/lib/CWTree/locale/index.js +0 -11
  995. package/lib/CWTree/locale/zh_CN.js +0 -3
  996. package/lib/CWTree/locale/zh_TW.js +0 -3
  997. package/lib/CWTree/utils/index.js +0 -99
  998. package/lib/Calendar/index.js +0 -2
  999. package/lib/Card/index.js +0 -2
  1000. package/lib/CardSelect/index.js +0 -153
  1001. package/lib/CardSelect/index.style.js +0 -76
  1002. package/lib/Carousel/index.js +0 -2
  1003. package/lib/Cascader/index.js +0 -2
  1004. package/lib/ChangeIcon/index.js +0 -153
  1005. package/lib/ChangeIcon/index.style.js +0 -89
  1006. package/lib/Checkbox/index.js +0 -2
  1007. package/lib/CitySelect/citys.js +0 -1457
  1008. package/lib/CitySelect/index.js +0 -128
  1009. package/lib/Col/index.js +0 -2
  1010. package/lib/Collapse/index.js +0 -85
  1011. package/lib/Collapse/index.style.js +0 -120
  1012. package/lib/ColorPicker/index.js +0 -2
  1013. package/lib/ConfigProvider/ConfigProvider.js +0 -92
  1014. package/lib/ConfigProvider/Switch.js +0 -43
  1015. package/lib/ConfigProvider/customTheme.js +0 -267
  1016. package/lib/ConfigProvider/customTheme.json +0 -163
  1017. package/lib/ConfigProvider/customToken.js +0 -41
  1018. package/lib/ConfigProvider/index.js +0 -6
  1019. package/lib/ConfigProvider/intlContext.js +0 -8
  1020. package/lib/ConfigProvider/useLocale.js +0 -15
  1021. package/lib/CustomScrollBar/index.js +0 -150
  1022. package/lib/DataView/index.js +0 -72
  1023. package/lib/DataView/index.style.js +0 -34
  1024. package/lib/DatePicker/index.js +0 -2
  1025. package/lib/DemoShow/index.js +0 -15
  1026. package/lib/Descriptions/index.js +0 -2
  1027. package/lib/Divider/index.js +0 -2
  1028. package/lib/Documentation/Tocify.js +0 -114
  1029. package/lib/Documentation/index.js +0 -147
  1030. package/lib/Documentation/index.style.js +0 -180
  1031. package/lib/Drawer/index.js +0 -107
  1032. package/lib/Drawer/index.style.js +0 -93
  1033. package/lib/Dropdown/DropdownButton.js +0 -20
  1034. package/lib/Dropdown/index.js +0 -39
  1035. package/lib/Dropdown/index.style.js +0 -22
  1036. package/lib/EchartsArea/index.js +0 -113
  1037. package/lib/EchartsBar/index.js +0 -212
  1038. package/lib/EchartsBarRow/index.js +0 -86
  1039. package/lib/EchartsBase/index.js +0 -217
  1040. package/lib/EchartsLine/index.js +0 -173
  1041. package/lib/EchartsPie/index.js +0 -121
  1042. package/lib/EchartsRing/index.js +0 -102
  1043. package/lib/Empty/index.js +0 -70
  1044. package/lib/Empty/index.style.js +0 -36
  1045. package/lib/ErrorBoundary/ErrorPage.js +0 -35
  1046. package/lib/ErrorBoundary/assets/images/No-data.png +0 -0
  1047. package/lib/ErrorBoundary/history.js +0 -81
  1048. package/lib/ErrorBoundary/index.js +0 -93
  1049. package/lib/ErrorBoundary/index.styles.js +0 -48
  1050. package/lib/Exception/images/error.svg +0 -58
  1051. package/lib/Exception/index.js +0 -99
  1052. package/lib/Exception/index.style.js +0 -37
  1053. package/lib/FilterDropDown/DragList.js +0 -106
  1054. package/lib/FilterDropDown/assets/DragSvg.js +0 -33
  1055. package/lib/FilterDropDown/assets/ShowSvgIcon.js +0 -14
  1056. package/lib/FilterDropDown/index.js +0 -271
  1057. package/lib/FilterDropDown/index.style.js +0 -83
  1058. package/lib/Flex/index.js +0 -2
  1059. package/lib/FloatButton/index.js +0 -2
  1060. package/lib/Flow/BasicLayout/Chain.js +0 -112
  1061. package/lib/Flow/BasicLayout/config.js +0 -21
  1062. package/lib/Flow/BasicLayout/util.js +0 -106
  1063. package/lib/Flow/Flow.js +0 -183
  1064. package/lib/Flow/commons/initCommands.js +0 -150
  1065. package/lib/Flow/components/PluginWrapper.js +0 -25
  1066. package/lib/Flow/index.js +0 -7
  1067. package/lib/Flow/layouts/callChain.js +0 -121
  1068. package/lib/Flow/layouts/index.js +0 -4
  1069. package/lib/Flow/plugins/CommandLifeCycle.js +0 -215
  1070. package/lib/Flow/plugins/InitSideBarPlugin.js +0 -81
  1071. package/lib/Flow/plugins/InitToolBarPlugin.js +0 -99
  1072. package/lib/Flow/shape/index.js +0 -4
  1073. package/lib/Flow/shape/nodes/baseNode.js +0 -99
  1074. package/lib/Flow/shape/nodes/index.js +0 -4
  1075. package/lib/Flow/tools/index.js +0 -22
  1076. package/lib/Flow/types/index.js +0 -1
  1077. package/lib/Form/FormItem.js +0 -79
  1078. package/lib/Form/consts.js +0 -2
  1079. package/lib/Form/context.js +0 -3
  1080. package/lib/Form/hook/useForm3.js +0 -117
  1081. package/lib/Form/index.js +0 -77
  1082. package/lib/Form/index.style.js +0 -56
  1083. package/lib/FormItemWrapper/index.js +0 -52
  1084. package/lib/FormItemWrapper/index.style.js +0 -32
  1085. package/lib/GlobalTabs/index.js +0 -49
  1086. package/lib/GlobalTabs/index.style.js +0 -31
  1087. package/lib/Grid/index.js +0 -2
  1088. package/lib/Header/CommonDropMenu.js +0 -90
  1089. package/lib/Header/CommonIcon.js +0 -26
  1090. package/lib/Header/Document/icon.svg +0 -14
  1091. package/lib/Header/Document/index.js +0 -29
  1092. package/lib/Header/LocaleSwitcher.js +0 -41
  1093. package/lib/Header/Message/index.js +0 -21
  1094. package/lib/Header/TopNavigationMenu/index.js +0 -73
  1095. package/lib/Header/TopNavigationMenu/index.style.js +0 -47
  1096. package/lib/Header/UserSetting/TenantList.js +0 -26
  1097. package/lib/Header/UserSetting/TenantTree.js +0 -33
  1098. package/lib/Header/UserSetting/index.js +0 -202
  1099. package/lib/Header/UserSetting/index.style.js +0 -60
  1100. package/lib/Header/UserSetting/utils.js +0 -30
  1101. package/lib/Header/assets/home.svg +0 -13
  1102. package/lib/Header/assets/logo.svg +0 -20
  1103. package/lib/Header/index.js +0 -338
  1104. package/lib/Header/index.style.js +0 -153
  1105. package/lib/Icon/index.js +0 -23
  1106. package/lib/Icon/utils.js +0 -20
  1107. package/lib/IconSelect/components/CustomImg/index.js +0 -84
  1108. package/lib/IconSelect/components/SearchIcon/index.js +0 -98
  1109. package/lib/IconSelect/constants/icon.js +0 -13291
  1110. package/lib/IconSelect/index.js +0 -144
  1111. package/lib/IconSelect/index.style.js +0 -75
  1112. package/lib/Image/index.js +0 -2
  1113. package/lib/Input/InputComponent.js +0 -71
  1114. package/lib/Input/index.js +0 -93
  1115. package/lib/Input/index.style.js +0 -23
  1116. package/lib/InputNumber/index.js +0 -27
  1117. package/lib/Joyride/List.js +0 -85
  1118. package/lib/Joyride/img/finishImg.png +0 -0
  1119. package/lib/Joyride/img/welcomeImg.png +0 -0
  1120. package/lib/Joyride/index.js +0 -448
  1121. package/lib/Joyride/style/index.style.js +0 -67
  1122. package/lib/Joyride/style/list.style.js +0 -115
  1123. package/lib/Layout/index.js +0 -2
  1124. package/lib/LayoutWrapper/Footer.js +0 -31
  1125. package/lib/LayoutWrapper/Header.js +0 -59
  1126. package/lib/LayoutWrapper/LeftArrow.js +0 -17
  1127. package/lib/LayoutWrapper/assets/left-arrow.svg +0 -21
  1128. package/lib/LayoutWrapper/index.js +0 -196
  1129. package/lib/LayoutWrapper/style/footer.js +0 -25
  1130. package/lib/LayoutWrapper/style/header.js +0 -46
  1131. package/lib/LayoutWrapper/style/index.js +0 -58
  1132. package/lib/LeftNavigation/index.js +0 -80
  1133. package/lib/LeftNavigation/index.style.js +0 -34
  1134. package/lib/List/index.js +0 -2
  1135. package/lib/Mentions/index.js +0 -2
  1136. package/lib/Menu/index.js +0 -2
  1137. package/lib/Modal/Modal.js +0 -176
  1138. package/lib/Modal/assets/Close.js +0 -22
  1139. package/lib/Modal/confirmGlobalStyle.js +0 -37
  1140. package/lib/Modal/custom-backup/entiretyDrag.js +0 -142
  1141. package/lib/Modal/custom-backup/index.less +0 -76
  1142. package/lib/Modal/index.js +0 -274
  1143. package/lib/Modal/index.style.js +0 -53
  1144. package/lib/ModuleFederation/ErrorBoundary/index.js +0 -52
  1145. package/lib/ModuleFederation/index.js +0 -10
  1146. package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +0 -185
  1147. package/lib/ModuleFederation/react-dynamic-remote-component/attach-script.js +0 -42
  1148. package/lib/ModuleFederation/react-dynamic-remote-component/index.js +0 -1
  1149. package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +0 -44
  1150. package/lib/ModuleFederation/react-dynamic-remote-component/loading-script.js +0 -35
  1151. package/lib/ModuleFederation/react-dynamic-remote-component/suspend.js +0 -28
  1152. package/lib/ModuleFederation/react-dynamic-remote-component/utils.js +0 -7
  1153. package/lib/ModuleTitle/index.js +0 -30
  1154. package/lib/ModuleTitle/index.style.js +0 -34
  1155. package/lib/Overview/index.js +0 -2
  1156. package/lib/Pagination/index.js +0 -363
  1157. package/lib/Pagination/index.style.js +0 -137
  1158. package/lib/Popconfirm/index.js +0 -2
  1159. package/lib/Popover/index.js +0 -2
  1160. package/lib/Progress/index.js +0 -2
  1161. package/lib/QrCode/index.js +0 -2
  1162. package/lib/QuickRangePicker/index.js +0 -149
  1163. package/lib/QuickRangePicker/index.style.js +0 -45
  1164. package/lib/QuickTransfer/Drag.js +0 -56
  1165. package/lib/QuickTransfer/DragList.js +0 -114
  1166. package/lib/QuickTransfer/NoDrag.js +0 -33
  1167. package/lib/QuickTransfer/NotDragList.js +0 -41
  1168. package/lib/QuickTransfer/assets/DragSvg.js +0 -14
  1169. package/lib/QuickTransfer/assets/LockSvg.js +0 -15
  1170. package/lib/QuickTransfer/index.js +0 -938
  1171. package/lib/QuickTransfer/index.style.js +0 -185
  1172. package/lib/QuickTransfer/utils.js +0 -291
  1173. package/lib/Radio/index.js +0 -2
  1174. package/lib/RangePicker/index.js +0 -2
  1175. package/lib/Rate/index.js +0 -2
  1176. package/lib/Result/index.js +0 -2
  1177. package/lib/Row/index.js +0 -2
  1178. package/lib/ScrollLoad/index.js +0 -134
  1179. package/lib/SearchBar/OutSearch.js +0 -107
  1180. package/lib/SearchBar/index.js +0 -680
  1181. package/lib/SearchBar/index.style.js +0 -91
  1182. package/lib/SearchBar/locale/en_US.js +0 -6
  1183. package/lib/SearchBar/locale/index.js +0 -11
  1184. package/lib/SearchBar/locale/zh_CN.js +0 -6
  1185. package/lib/SearchBar/locale/zh_TW.js +0 -6
  1186. package/lib/Segmented/index.js +0 -2
  1187. package/lib/Select/index.js +0 -2
  1188. package/lib/SiderMenu/index.js +0 -215
  1189. package/lib/SiderMenu/index.style.js +0 -23
  1190. package/lib/SimpleCard/index.js +0 -121
  1191. package/lib/SimpleCard/index.style.js +0 -76
  1192. package/lib/SimplePagination/index.js +0 -188
  1193. package/lib/SimplePagination/index.style.js +0 -105
  1194. package/lib/SingleSpa/import-html/index.js +0 -51
  1195. package/lib/SingleSpa/import-html/process-tpl.js +0 -189
  1196. package/lib/SingleSpa/import-html/utils.js +0 -147
  1197. package/lib/SingleSpa/index.js +0 -131
  1198. package/lib/SingleSpa/singleSpa/single-spa.dev.js +0 -1505
  1199. package/lib/SingleSpa/system/amd.js +0 -153
  1200. package/lib/SingleSpa/system/index.js +0 -11
  1201. package/lib/SingleSpa/system/system.js +0 -771
  1202. package/lib/SingleSpa/system/systemjs-css.js +0 -96
  1203. package/lib/SingleSpa/utils.js +0 -73
  1204. package/lib/Skeleton/index.js +0 -2
  1205. package/lib/Slider/assets/slider.png +0 -0
  1206. package/lib/Slider/index.js +0 -32
  1207. package/lib/Slider/index.style.js +0 -116
  1208. package/lib/Space/index.js +0 -2
  1209. package/lib/Spin/index.js +0 -2
  1210. package/lib/Statistic/index.js +0 -2
  1211. package/lib/Steps/index.js +0 -2
  1212. package/lib/Switch/index.js +0 -2
  1213. package/lib/Table/index.js +0 -2
  1214. package/lib/Tabs/index.js +0 -52
  1215. package/lib/Tabs/index.style.js +0 -58
  1216. package/lib/Tag/CheckableTag.js +0 -53
  1217. package/lib/Tag/assets/LeftBottomCorner.js +0 -22
  1218. package/lib/Tag/assets/LeftTopCorner.js +0 -22
  1219. package/lib/Tag/assets/RightBottomCorner.js +0 -22
  1220. package/lib/Tag/assets/RightTopCorner.js +0 -14
  1221. package/lib/Tag/index.js +0 -109
  1222. package/lib/Tag/index.style.js +0 -156
  1223. package/lib/Theme/index.js +0 -2
  1224. package/lib/ThemeProvider/Switcher.js +0 -25
  1225. package/lib/ThemeProvider/index.js +0 -5
  1226. package/lib/ThemeProvider/main.js +0 -185
  1227. package/lib/ThemeProvider/utils.js +0 -60
  1228. package/lib/TimePicker/index.js +0 -2
  1229. package/lib/Timeline/index.js +0 -2
  1230. package/lib/Tooltip/index.js +0 -54
  1231. package/lib/Tooltip/index.style.js +0 -23
  1232. package/lib/TooltipText/ResizeObserverManager.js +0 -56
  1233. package/lib/TooltipText/index.js +0 -138
  1234. package/lib/TooltipText/index.style.js +0 -46
  1235. package/lib/Tour/index.js +0 -2
  1236. package/lib/Transfer/index.js +0 -2
  1237. package/lib/Tree/index.js +0 -2
  1238. package/lib/TreeSelect/index.js +0 -2
  1239. package/lib/Typography/index.js +0 -2
  1240. package/lib/Upload/index.js +0 -2
  1241. package/lib/WangEditor/editor4.js +0 -652
  1242. package/lib/WangEditor/index.js +0 -298
  1243. package/lib/WangEditor/index.style.js +0 -203
  1244. package/lib/WangEditor/locale/index.js +0 -62
  1245. package/lib/WangEditor/release/wangEditor.js +0 -5390
  1246. package/lib/WangEditor/resizeable.js +0 -112
  1247. package/lib/WangEditor/usePreview.js +0 -39
  1248. package/lib/WangEditor/wangEditor.js +0 -4627
  1249. package/lib/Watermark/index.js +0 -2
  1250. package/lib/antd-style/context/ThemeModeContext.js +0 -11
  1251. package/lib/antd-style/context/index.js +0 -1
  1252. package/lib/antd-style/core/CacheManager.js +0 -56
  1253. package/lib/antd-style/core/createCSS.js +0 -42
  1254. package/lib/antd-style/core/createEmotion.js +0 -1
  1255. package/lib/antd-style/core/createSerializeStyles.js +0 -11
  1256. package/lib/antd-style/core/index.js +0 -5
  1257. package/lib/antd-style/core/insertStyles.js +0 -35
  1258. package/lib/antd-style/factories/createEmotionContext.js +0 -4
  1259. package/lib/antd-style/factories/createGlobalStyle.js +0 -28
  1260. package/lib/antd-style/factories/createStyish.js +0 -14
  1261. package/lib/antd-style/factories/createStyleProvider/index.js +0 -69
  1262. package/lib/antd-style/factories/createStyledThemeProvider.js +0 -16
  1263. package/lib/antd-style/factories/createStyles/index.js +0 -114
  1264. package/lib/antd-style/factories/createStyles/response.js +0 -43
  1265. package/lib/antd-style/factories/createStyles/types.js +0 -1
  1266. package/lib/antd-style/factories/createThemeProvider/AntdProvider.js +0 -78
  1267. package/lib/antd-style/factories/createThemeProvider/ThemeSwitcher.js +0 -130
  1268. package/lib/antd-style/factories/createThemeProvider/TokenContainer.js +0 -75
  1269. package/lib/antd-style/factories/createThemeProvider/index.js +0 -77
  1270. package/lib/antd-style/factories/createThemeProvider/type.js +0 -1
  1271. package/lib/antd-style/factories/createUseTheme.js +0 -33
  1272. package/lib/antd-style/functions/createInstance.js +0 -95
  1273. package/lib/antd-style/functions/extractStaticStyle.js +0 -63
  1274. package/lib/antd-style/functions/index.js +0 -21
  1275. package/lib/antd-style/functions/setupStyled.js +0 -11
  1276. package/lib/antd-style/hooks/index.js +0 -5
  1277. package/lib/antd-style/hooks/useAntdStylish.js +0 -20
  1278. package/lib/antd-style/hooks/useAntdTheme.js +0 -18
  1279. package/lib/antd-style/hooks/useAntdToken.js +0 -6
  1280. package/lib/antd-style/hooks/useResponsive.js +0 -9
  1281. package/lib/antd-style/hooks/useThemeMode.js +0 -5
  1282. package/lib/antd-style/index.js +0 -5
  1283. package/lib/antd-style/stylish/button.js +0 -19
  1284. package/lib/antd-style/types/appearance.js +0 -1
  1285. package/lib/antd-style/types/css.js +0 -1
  1286. package/lib/antd-style/types/function.js +0 -1
  1287. package/lib/antd-style/types/genericUtils.js +0 -1
  1288. package/lib/antd-style/types/index.js +0 -8
  1289. package/lib/antd-style/types/response.js +0 -1
  1290. package/lib/antd-style/types/styleManager.js +0 -1
  1291. package/lib/antd-style/types/styled.js +0 -1
  1292. package/lib/antd-style/types/theme.js +0 -1
  1293. package/lib/antd-style/utils/convertStylish.js +0 -18
  1294. package/lib/antd-style/utils/css.js +0 -59
  1295. package/lib/antd-style/utils/css.test.js +0 -20
  1296. package/lib/antd-style/utils/index.js +0 -1
  1297. package/lib/antd-style/utils/matchBrowserPrefers.js +0 -9
  1298. package/lib/antd-style/utils/responsive.js +0 -14
  1299. package/lib/antd-style/utils/safeStartTransition.js +0 -8
  1300. package/lib/configHoc/index.js +0 -23
  1301. package/lib/index.js +0 -5
  1302. package/lib/locales/en_US.json +0 -78
  1303. package/lib/locales/index.js +0 -57
  1304. package/lib/locales/intl.js +0 -46
  1305. package/lib/locales/zh_CN.json +0 -78
  1306. package/lib/locales/zh_TW.json +0 -78
  1307. package/lib/message/index.js +0 -2
  1308. package/lib/noticeManager/event.js +0 -52
  1309. package/lib/noticeManager/globalState.js +0 -26
  1310. package/lib/noticeManager/index.js +0 -16
  1311. package/lib/notification/index.js +0 -2
  1312. package/lib/portalNoticeManager/event.js +0 -52
  1313. package/lib/portalNoticeManager/index.js +0 -14
  1314. package/lib/portalNoticeManager/usePortalDispatchNotice.js +0 -37
  1315. package/lib/portalNoticeManager/withPortalDispatchNotice.js +0 -10
  1316. package/lib/treeLoad/index.js +0 -43
  1317. package/lib/useChartTheme/index.js +0 -36
  1318. package/lib/useConfigContext/index.js +0 -6
  1319. package/lib/utils/index.js +0 -90
@@ -1,4627 +0,0 @@
1
- function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof2(o); }
2
- (function () {
3
- var global = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
4
- var factory = arguments.length > 1 ? arguments[1] : undefined;
5
- (typeof exports === "undefined" ? "undefined" : _typeof2(exports)) === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.wangEditor = factory();
6
- })(this, function () {
7
- /*
8
- poly-fill
9
- */
10
-
11
- var polyfill = function polyfill() {
12
- // Object.assign
13
- if (typeof Object.assign != "function") {
14
- Object.assign = function (target, varArgs) {
15
- // .length of function is 2
16
- if (target == null) {
17
- // TypeError if undefined or null
18
- throw new TypeError("Cannot convert undefined or null to object");
19
- }
20
- var to = Object(target);
21
- for (var index = 1; index < arguments.length; index++) {
22
- var nextSource = arguments[index];
23
- if (nextSource != null) {
24
- // Skip over if undefined or null
25
- for (var nextKey in nextSource) {
26
- // Avoid bugs when hasOwnProperty is shadowed
27
- if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
28
- to[nextKey] = nextSource[nextKey];
29
- }
30
- }
31
- }
32
- }
33
- return to;
34
- };
35
- }
36
-
37
- // IE 中兼容 Element.prototype.matches
38
- if (!Element.prototype.matches) {
39
- Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) {
40
- var matches = (this.document || this.ownerDocument).querySelectorAll(s),
41
- i = matches.length;
42
- while (--i >= 0 && matches.item(i) !== this) {}
43
- return i > -1;
44
- };
45
- }
46
- };
47
-
48
- /*
49
- DOM 操作 API
50
- */
51
-
52
- // 根据 html 代码片段创建 dom 对象
53
- function createElemByHTML(html) {
54
- var div = void 0;
55
- div = document.createElement("div");
56
- div.innerHTML = html;
57
- return div.children;
58
- }
59
-
60
- // 是否是 DOM List
61
- function isDOMList(selector) {
62
- if (!selector) {
63
- return false;
64
- }
65
- if (selector instanceof HTMLCollection || selector instanceof NodeList) {
66
- return true;
67
- }
68
- return false;
69
- }
70
-
71
- // 封装 document.querySelectorAll
72
- function querySelectorAll(selector) {
73
- var result = document.querySelectorAll(selector);
74
- if (isDOMList(result)) {
75
- return result;
76
- } else {
77
- return [result];
78
- }
79
- }
80
- // 插入链接文本内容转义处理
81
- function handleChangeContent(str) {
82
- var _str = "";
83
- for (var _index = 0; _index < str.length; _index++) {
84
- var _escape = "";
85
- switch (str.charCodeAt(_index)) {
86
- case 34:
87
- // "
88
- _escape = "&quot;";
89
- break;
90
- case 39:
91
- // '
92
- _escape = "&#x27;";
93
- break;
94
- case 60:
95
- // <
96
- _escape = "&lt;";
97
- break;
98
- case 62:
99
- // >
100
- _escape = "&gt;";
101
- break;
102
- default:
103
- _escape = str[_index];
104
- }
105
- _str += _escape;
106
- }
107
- return _str;
108
- }
109
-
110
- // 判断http地址是否合规地址
111
- function checkURL(URL) {
112
- var str = URL,
113
- Expression = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/,
114
- objExp = new RegExp(Expression);
115
- if (objExp.test(str) == true) {
116
- return true;
117
- } else {
118
- return false;
119
- }
120
- }
121
-
122
- // 记录所有的事件绑定
123
- var eventList = [];
124
-
125
- // 创建构造函数
126
- function DomElement(selector) {
127
- if (!selector) {
128
- return;
129
- }
130
-
131
- // selector 本来就是 DomElement 对象,直接返回
132
- if (selector instanceof DomElement) {
133
- return selector;
134
- }
135
- this.selector = selector;
136
- var nodeType = selector.nodeType;
137
-
138
- // 根据 selector 得出的结果(如 DOM,DOM List)
139
- var selectorResult = [];
140
- if (nodeType === 9) {
141
- // document 节点
142
- selectorResult = [selector];
143
- } else if (nodeType === 1) {
144
- // 单个 DOM 节点
145
- selectorResult = [selector];
146
- } else if (isDOMList(selector) || selector instanceof Array) {
147
- // DOM List 或者数组
148
- selectorResult = selector;
149
- } else if (typeof selector === "string") {
150
- // 字符串
151
- selector = selector.replace("/\n/mg", "").trim();
152
- if (selector.indexOf("<") === 0) {
153
- // 如 <div>
154
- selectorResult = createElemByHTML(selector);
155
- } else {
156
- // 如 #id .class
157
- selectorResult = querySelectorAll(selector);
158
- }
159
- }
160
- var length = selectorResult.length;
161
- if (!length) {
162
- // 空数组
163
- return this;
164
- }
165
-
166
- // 加入 DOM 节点
167
- var i = void 0;
168
- for (i = 0; i < length; i++) {
169
- this[i] = selectorResult[i];
170
- }
171
- this.length = length;
172
- }
173
-
174
- // 修改原型
175
- DomElement.prototype = {
176
- constructor: DomElement,
177
- // 类数组,forEach
178
- forEach: function forEach(fn) {
179
- var i = void 0;
180
- for (i = 0; i < this.length; i++) {
181
- var elem = this[i];
182
- var result = fn.call(elem, elem, i);
183
- if (result === false) {
184
- break;
185
- }
186
- }
187
- return this;
188
- },
189
- // clone
190
- clone: function clone(deep) {
191
- var cloneList = [];
192
- this.forEach(function (elem) {
193
- cloneList.push(elem.cloneNode(!!deep));
194
- });
195
- return $(cloneList);
196
- },
197
- // 获取第几个元素
198
- get: function get(index) {
199
- var length = this.length;
200
- if (index >= length) {
201
- index = index % length;
202
- }
203
- return $(this[index]);
204
- },
205
- // 第一个
206
- first: function first() {
207
- return this.get(0);
208
- },
209
- // 最后一个
210
- last: function last() {
211
- var length = this.length;
212
- return this.get(length - 1);
213
- },
214
- // 绑定事件
215
- on: function on(type, selector, fn) {
216
- // selector 不为空,证明绑定事件要加代理
217
- if (!fn) {
218
- fn = selector;
219
- selector = null;
220
- }
221
-
222
- // type 是否有多个
223
- var types = [];
224
- types = type.split(/\s+/);
225
- return this.forEach(function (elem) {
226
- types.forEach(function (type) {
227
- if (!type) {
228
- return;
229
- }
230
-
231
- // 记录下,方便后面解绑
232
- eventList.push({
233
- elem: elem,
234
- type: type,
235
- fn: fn
236
- });
237
- if (!selector) {
238
- // 无代理
239
- elem.addEventListener(type, fn);
240
- return;
241
- }
242
-
243
- // 有代理
244
- elem.addEventListener(type, function (e) {
245
- var target = e.target;
246
- if (target.matches(selector)) {
247
- fn.call(target, e);
248
- }
249
- });
250
- });
251
- });
252
- },
253
- // 取消事件绑定
254
- off: function off(type, fn) {
255
- return this.forEach(function (elem) {
256
- elem.removeEventListener(type, fn);
257
- });
258
- },
259
- // 获取/设置 属性
260
- attr: function attr(key, val) {
261
- if (val == null) {
262
- // 获取值
263
- return this[0].getAttribute(key);
264
- } else {
265
- // 设置值
266
- return this.forEach(function (elem) {
267
- elem.setAttribute(key, val);
268
- });
269
- }
270
- },
271
- // 添加 class
272
- addClass: function addClass(className) {
273
- if (!className) {
274
- return this;
275
- }
276
- return this.forEach(function (elem) {
277
- var arr = void 0;
278
- if (elem.className) {
279
- // 解析当前 className 转换为数组
280
- arr = elem.className.split(/\s/);
281
- arr = arr.filter(function (item) {
282
- return !!item.trim();
283
- });
284
- // 添加 class
285
- if (arr.indexOf(className) < 0) {
286
- arr.push(className);
287
- }
288
- // 修改 elem.class
289
- elem.className = arr.join(" ");
290
- } else {
291
- elem.className = className;
292
- }
293
- });
294
- },
295
- // 删除 class
296
- removeClass: function removeClass(className) {
297
- if (!className) {
298
- return this;
299
- }
300
- return this.forEach(function (elem) {
301
- var arr = void 0;
302
- if (elem.className) {
303
- // 解析当前 className 转换为数组
304
- arr = elem.className.split(/\s/);
305
- arr = arr.filter(function (item) {
306
- item = item.trim();
307
- // 删除 class
308
- if (!item || item === className) {
309
- return false;
310
- }
311
- return true;
312
- });
313
- // 修改 elem.class
314
- elem.className = arr.join(" ");
315
- }
316
- });
317
- },
318
- // 修改 css
319
- css: function css(key, val) {
320
- var currentStyle = key + ":" + val + ";";
321
- return this.forEach(function (elem) {
322
- var style = (elem.getAttribute("style") || "").trim();
323
- var styleArr = void 0,
324
- resultArr = [];
325
- if (style) {
326
- // 将 style 按照 ; 拆分为数组
327
- styleArr = style.split(";");
328
- styleArr.forEach(function (item) {
329
- // 对每项样式,按照 : 拆分为 key 和 value
330
- var arr = item.split(":").map(function (i) {
331
- return i.trim();
332
- });
333
- if (arr.length === 2) {
334
- resultArr.push(arr[0] + ":" + arr[1]);
335
- }
336
- });
337
- // 替换或者新增
338
- resultArr = resultArr.map(function (item) {
339
- if (item.indexOf(key) === 0) {
340
- return currentStyle;
341
- } else {
342
- return item;
343
- }
344
- });
345
- if (resultArr.indexOf(currentStyle) < 0) {
346
- resultArr.push(currentStyle);
347
- }
348
- // 结果
349
- elem.setAttribute("style", resultArr.join("; "));
350
- } else {
351
- // style 无值
352
- elem.setAttribute("style", currentStyle);
353
- }
354
- });
355
- },
356
- // 显示
357
- show: function show() {
358
- return this.css("display", "block");
359
- },
360
- // 隐藏
361
- hide: function hide() {
362
- return this.css("display", "none");
363
- },
364
- // 获取子节点
365
- children: function children() {
366
- var elem = this[0];
367
- if (!elem) {
368
- return null;
369
- }
370
- return $(elem.children);
371
- },
372
- // 获取子节点(包括文本节点)
373
- childNodes: function childNodes() {
374
- var elem = this[0];
375
- if (!elem) {
376
- return null;
377
- }
378
- return $(elem.childNodes);
379
- },
380
- // 增加子节点
381
- append: function append($children) {
382
- return this.forEach(function (elem) {
383
- $children.forEach(function (child) {
384
- elem.appendChild(child);
385
- });
386
- });
387
- },
388
- // 移除当前节点
389
- remove: function remove() {
390
- return this.forEach(function (elem) {
391
- if (elem.remove) {
392
- elem.remove();
393
- } else {
394
- var parent = elem.parentElement;
395
- parent && parent.removeChild(elem);
396
- }
397
- });
398
- },
399
- // 是否包含某个子节点
400
- isContain: function isContain($child) {
401
- var elem = this[0];
402
- var child = $child[0];
403
- return elem.contains(child);
404
- },
405
- // 尺寸数据
406
- getSizeData: function getSizeData() {
407
- var elem = this[0];
408
- return elem.getBoundingClientRect(); // 可得到 bottom height left right top width 的数据
409
- },
410
- // 封装 nodeName
411
- getNodeName: function getNodeName() {
412
- var elem = this[0];
413
- return elem.nodeName;
414
- },
415
- // 从当前元素查找
416
- find: function find(selector) {
417
- var elem = this[0];
418
- return $(elem.querySelectorAll(selector));
419
- },
420
- // 获取当前元素的 text
421
- text: function text(val) {
422
- if (!val) {
423
- // 获取 text
424
- var elem = this[0];
425
- return elem.innerHTML.replace(/<.*?>/g, function () {
426
- return "";
427
- });
428
- } else {
429
- // 设置 text
430
- return this.forEach(function (elem) {
431
- elem.innerHTML = val;
432
- });
433
- }
434
- },
435
- // 获取 html
436
- html: function html(value) {
437
- var elem = this[0];
438
- if (value == null) {
439
- return elem.innerHTML;
440
- } else {
441
- elem.innerHTML = value;
442
- return this;
443
- }
444
- },
445
- // 获取 value
446
- val: function val() {
447
- var elem = this[0];
448
- return elem.value.trim();
449
- },
450
- // focus
451
- focus: function focus() {
452
- return this.forEach(function (elem) {
453
- elem.focus();
454
- });
455
- },
456
- // parent
457
- parent: function parent() {
458
- var elem = this[0];
459
- return $(elem.parentElement);
460
- },
461
- // parentUntil 找到符合 selector 的父节点
462
- parentUntil: function parentUntil(selector, _currentElem) {
463
- var results = document.querySelectorAll(selector);
464
- var length = results.length;
465
- if (!length) {
466
- // 传入的 selector 无效
467
- return null;
468
- }
469
- var elem = _currentElem || this[0];
470
- if (elem.nodeName === "BODY") {
471
- return null;
472
- }
473
- var parent = elem.parentElement;
474
- var i = void 0;
475
- for (i = 0; i < length; i++) {
476
- if (parent === results[i]) {
477
- // 找到,并返回
478
- return $(parent);
479
- }
480
- }
481
-
482
- // 继续查找
483
- return this.parentUntil(selector, parent);
484
- },
485
- // 判断两个 elem 是否相等
486
- equal: function equal($elem) {
487
- if ($elem.nodeType === 1) {
488
- return this[0] === $elem;
489
- } else {
490
- return this[0] === $elem[0];
491
- }
492
- },
493
- // 将该元素插入到某个元素前面
494
- insertBefore: function insertBefore(selector) {
495
- var $referenceNode = $(selector);
496
- var referenceNode = $referenceNode[0];
497
- if (!referenceNode) {
498
- return this;
499
- }
500
- return this.forEach(function (elem) {
501
- var parent = referenceNode.parentNode;
502
- parent.insertBefore(elem, referenceNode);
503
- });
504
- },
505
- // 将该元素插入到某个元素后面
506
- insertAfter: function insertAfter(selector) {
507
- var $referenceNode = $(selector);
508
- var referenceNode = $referenceNode[0];
509
- if (!referenceNode) {
510
- return this;
511
- }
512
- return this.forEach(function (elem) {
513
- var parent = referenceNode.parentNode;
514
- if (parent.lastChild === referenceNode) {
515
- // 最后一个元素
516
- parent.appendChild(elem);
517
- } else {
518
- // 不是最后一个元素
519
- parent.insertBefore(elem, referenceNode.nextSibling);
520
- }
521
- });
522
- }
523
- };
524
-
525
- // new 一个对象
526
- function $(selector) {
527
- return new DomElement(selector);
528
- }
529
-
530
- // 解绑所有事件,用于销毁编辑器
531
- $.offAll = function () {
532
- eventList.forEach(function (item) {
533
- var elem = item.elem;
534
- var type = item.type;
535
- var fn = item.fn;
536
- // 解绑
537
- elem.removeEventListener(type, fn);
538
- });
539
- };
540
-
541
- /*
542
- 配置信息
543
- */
544
-
545
- var config = {
546
- // 默认菜单配置
547
- menus: ["head", "bold", "fontSize", "fontName", "italic", "underline", "strikeThrough", "foreColor", "backColor", "link", "list", "justify", "quote", "emoticon", "image", "table", "video", "code", "undo", "redo"],
548
- fontNames: ["宋体", "微软雅黑", "Arial", "Tahoma", "Verdana"],
549
- colors: ["#000000", "#eeece0", "#1c487f", "#4d80bf", "#ff0000", "#c24f4a", "#8baa4a", "#7b5ba1", "#46acc8", "#f9963b", "#ffffff"],
550
- // // 语言配置
551
- // lang: {
552
- // '设置标题': 'title',
553
- // '正文': 'p',
554
- // '链接文字': 'link text',
555
- // '链接': 'link',
556
- // '插入': 'insert',
557
- // '创建': 'init'
558
- // },
559
-
560
- // 表情
561
- emotions: [{
562
- // tab 的标题
563
- title: "emoji",
564
- // type -> 'emoji' / 'image'
565
- type: "emoji",
566
- // content -> 数组
567
- content: "😀 😃 😄 😁 😆 😅 😂 😊 😇 🙂 🙃 😉 😓 😪 😴 🙄 🤔 😬 🤐".split(/\s/)
568
- }],
569
- // 编辑区域的 z-index
570
- zIndex: 10000,
571
- // 是否开启 debug 模式(debug 模式下错误会 throw error 形式抛出)
572
- debug: false,
573
- // 插入链接时候的格式校验
574
- linkCheck: function linkCheck(text, link) {
575
- var _boolean = checkURL(link);
576
- if (_boolean) {
577
- return true;
578
- } else {
579
- return "请输入合法Url";
580
- }
581
- // text 是插入的文字
582
- // link 是插入的链接
583
- // 返回 true 即表示成功
584
- // return '校验失败' // 返回字符串即表示失败的提示信息
585
- },
586
- // 插入网络图片的校验
587
- linkImgCheck: function linkImgCheck(src) {
588
- // src 即图片的地址
589
- return true; // 返回 true 即表示成功
590
- // return '校验失败' // 返回字符串即表示失败的提示信息
591
- },
592
- // 粘贴过滤样式,默认开启
593
- pasteFilterStyle: true,
594
- // 粘贴内容时,忽略图片。默认关闭
595
- pasteIgnoreImg: false,
596
- // 对粘贴的文字进行自定义处理,返回处理后的结果。编辑器会将处理后的结果粘贴到编辑区域中。
597
- // IE 暂时不支持
598
- pasteTextHandle: function pasteTextHandle(content) {
599
- // content 即粘贴过来的内容(html 或 纯文本),可进行自定义处理然后返回
600
- return content;
601
- },
602
- // onchange 事件
603
- // onchange: function (html) {
604
- // // html 即变化之后的内容
605
- // console.log(html)
606
- // },
607
-
608
- // 是否显示添加网络图片的 tab
609
- showLinkImg: true,
610
- // 插入网络图片的回调
611
- linkImgCallback: function linkImgCallback(url) {
612
- // console.log(url) // url 即插入图片的地址
613
- },
614
- // 默认上传图片 max size: 5M
615
- uploadImgMaxSize: 5 * 1024 * 1024,
616
- // 配置一次最多上传几个图片
617
- // uploadImgMaxLength: 5,
618
-
619
- // 上传图片,是否显示 base64 格式
620
- uploadImgShowBase64: false,
621
- // 上传图片,server 地址(如果有值,则 base64 格式的配置则失效)
622
- // uploadImgServer: '/upload',
623
-
624
- // 自定义配置 filename
625
- uploadFileName: "",
626
- // 上传图片的自定义参数
627
- uploadImgParams: {
628
- // token: 'abcdef12345'
629
- },
630
- // 上传图片的自定义header
631
- uploadImgHeaders: {
632
- // 'Accept': 'text/x-json'
633
- },
634
- // 配置 XHR withCredentials
635
- withCredentials: false,
636
- // 自定义上传图片超时时间 ms
637
- uploadImgTimeout: 10000,
638
- // 上传图片 hook
639
- uploadImgHooks: {
640
- // customInsert: function (insertLinkImg, result, editor) {
641
- // console.log('customInsert')
642
- // // 图片上传并返回结果,自定义插入图片的事件,而不是编辑器自动插入图片
643
- // const data = result.data1 || []
644
- // data.forEach(link => {
645
- // insertLinkImg(link)
646
- // })
647
- // },
648
- before: function before(xhr, editor, files) {
649
- // 图片上传之前触发
650
- // 如果返回的结果是 {prevent: true, msg: 'xxxx'} 则表示用户放弃上传
651
- // return {
652
- // prevent: true,
653
- // msg: '放弃上传'
654
- // }
655
- },
656
- success: function success(xhr, editor, result) {
657
- // 图片上传并返回结果,图片插入成功之后触发
658
- },
659
- fail: function fail(xhr, editor, result) {
660
- // 图片上传并返回结果,但图片插入错误时触发
661
- },
662
- error: function error(xhr, editor) {
663
- // 图片上传出错时触发
664
- },
665
- timeout: function timeout(xhr, editor) {
666
- // 图片上传超时时触发
667
- }
668
- },
669
- // 是否上传七牛云,默认为 false
670
- qiniu: false
671
- };
672
-
673
- /*
674
- 工具
675
- */
676
-
677
- // 和 UA 相关的属性
678
- var UA = {
679
- _ua: navigator.userAgent,
680
- // 是否 webkit
681
- isWebkit: function isWebkit() {
682
- var reg = /webkit/i;
683
- return reg.test(this._ua);
684
- },
685
- // 是否 IE
686
- isIE: function isIE() {
687
- return "ActiveXObject" in window;
688
- }
689
- };
690
-
691
- // 遍历对象
692
- function objForEach(obj, fn) {
693
- var key = void 0,
694
- result = void 0;
695
- for (key in obj) {
696
- if (obj.hasOwnProperty(key)) {
697
- result = fn.call(obj, key, obj[key]);
698
- if (result === false) {
699
- break;
700
- }
701
- }
702
- }
703
- }
704
-
705
- // 遍历类数组
706
- function arrForEach(fakeArr, fn) {
707
- var i = void 0,
708
- item = void 0,
709
- result = void 0;
710
- var length = fakeArr.length || 0;
711
- for (i = 0; i < length; i++) {
712
- item = fakeArr[i];
713
- result = fn.call(fakeArr, item, i);
714
- if (result === false) {
715
- break;
716
- }
717
- }
718
- }
719
-
720
- // 获取随机数
721
- function getRandom(prefix) {
722
- return prefix + Math.random().toString().slice(2);
723
- }
724
-
725
- // 替换 html 特殊字符
726
- function replaceHtmlSymbol(html) {
727
- if (html == null) {
728
- return "";
729
- }
730
- return html.replace(/</gm, "&lt;").replace(/>/gm, "&gt;").replace(/"/gm, "&quot;").replace(/(\r\n|\r|\n)/g, "<br/>");
731
- }
732
-
733
- // 返回百分比的格式
734
-
735
- // 判断是不是 function
736
- function isFunction(fn) {
737
- return typeof fn === "function";
738
- }
739
-
740
- /*
741
- bold-menu
742
- */
743
- // 构造函数
744
- function Bold(editor) {
745
- this.editor = editor;
746
- this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-bold"></i>\n </div>');
747
- this.type = "click";
748
-
749
- // 当前是否 active 状态
750
- this._active = false;
751
- }
752
-
753
- // 原型
754
- Bold.prototype = {
755
- constructor: Bold,
756
- // 点击事件
757
- onClick: function onClick(e) {
758
- // 点击菜单将触发这里
759
-
760
- var editor = this.editor;
761
- var isSeleEmpty = editor.selection.isSelectionEmpty();
762
- if (isSeleEmpty) {
763
- // 选区是空的,插入并选中一个“空白”
764
- editor.selection.createEmptyRange();
765
- }
766
-
767
- // 执行 bold 命令
768
- editor.cmd["do"]("bold");
769
- if (isSeleEmpty) {
770
- // 需要将选取折叠起来
771
- editor.selection.collapseRange();
772
- editor.selection.restoreSelection();
773
- }
774
- },
775
- // 试图改变 active 状态
776
- tryChangeActive: function tryChangeActive(e) {
777
- var editor = this.editor;
778
- var $elem = this.$elem;
779
- if (editor.cmd.queryCommandState("bold")) {
780
- this._active = true;
781
- $elem.addClass("w-e-active");
782
- } else {
783
- this._active = false;
784
- $elem.removeClass("w-e-active");
785
- }
786
- }
787
- };
788
-
789
- /*
790
- 替换多语言
791
- */
792
-
793
- var replaceLang = function replaceLang(editor, str) {
794
- var langArgs = editor.config.langArgs || [];
795
- var result = str;
796
- langArgs.forEach(function (item) {
797
- var reg = item.reg;
798
- var val = item.val;
799
- if (reg.test(result)) {
800
- result = result.replace(reg, function () {
801
- return val;
802
- });
803
- }
804
- });
805
- return result;
806
- };
807
-
808
- /*
809
- droplist
810
- */
811
- var _emptyFn = function _emptyFn() {};
812
-
813
- // 构造函数
814
- function DropList(menu, opt) {
815
- var _this = this;
816
-
817
- // droplist 所依附的菜单
818
- var editor = menu.editor;
819
- this.menu = menu;
820
- this.opt = opt;
821
- var newClassName = editor.config.dropListPosition == "left" ? "w-e-droplist-left" : editor.config.dropListPosition == "center" ? "w-e-droplist-center" : "";
822
- // 容器
823
- var $container = $('<div class="w-e-droplist"></div>');
824
- $container.addClass(newClassName);
825
- // 标题
826
- var $title = opt.$title;
827
- var titleHtml = void 0;
828
- if ($title) {
829
- // 替换多语言
830
- titleHtml = $title.html();
831
- titleHtml = replaceLang(editor, titleHtml);
832
- $title.html(titleHtml);
833
- $title.addClass("w-e-dp-title");
834
- $container.append($title);
835
- }
836
- var list = opt.list || [];
837
- var type = opt.type || "list"; // 'list' 列表形式(如“标题”菜单) / 'inline-block' 块状形式(如“颜色”菜单)
838
- var onClick = opt.onClick || _emptyFn;
839
-
840
- // 加入 DOM 并绑定事件
841
- var $list = $('<ul class="' + (type === "list" ? "w-e-list" : "w-e-block") + '"></ul>');
842
- $container.append($list);
843
- list.forEach(function (item) {
844
- var $elem = item.$elem;
845
-
846
- // 替换多语言
847
- var elemHtml = $elem.html();
848
- elemHtml = replaceLang(editor, elemHtml);
849
- $elem.html(elemHtml);
850
- var value = item.value;
851
- var $li = $('<li class="w-e-item"></li>');
852
- if ($elem) {
853
- $li.append($elem);
854
- $list.append($li);
855
- $li.on("click", function (e) {
856
- onClick(value);
857
-
858
- // 隐藏
859
- _this.hideTimeoutId = setTimeout(function () {
860
- _this.hide();
861
- }, 0);
862
- });
863
- }
864
- });
865
-
866
- // 绑定隐藏事件
867
- $container.on("mouseleave", function (e) {
868
- _this.hideTimeoutId = setTimeout(function () {
869
- _this.hide();
870
- }, 0);
871
- });
872
-
873
- // 记录属性
874
- this.$container = $container;
875
-
876
- // 基本属性
877
- this._rendered = false;
878
- this._show = false;
879
- }
880
-
881
- // 原型
882
- DropList.prototype = {
883
- constructor: DropList,
884
- // 显示(插入DOM)
885
- show: function show() {
886
- if (this.hideTimeoutId) {
887
- // 清除之前的定时隐藏
888
- clearTimeout(this.hideTimeoutId);
889
- }
890
- var menu = this.menu;
891
- var $menuELem = menu.$elem;
892
- var $container = this.$container;
893
- if (this._show) {
894
- return;
895
- }
896
- if (this._rendered) {
897
- // 显示
898
- $container.show();
899
- } else {
900
- // 加入 DOM 之前先定位位置
901
- var menuHeight = $menuELem.getSizeData().height || 0;
902
- var width = this.opt.width || 100; // 默认为 100
903
- $container.css("margin-top", menuHeight + "px").css("width", width + "px");
904
-
905
- // 加入到 DOM
906
- $menuELem.append($container);
907
- this._rendered = true;
908
- }
909
-
910
- // 修改属性
911
- this._show = true;
912
- },
913
- // 隐藏(移除DOM)
914
- hide: function hide() {
915
- if (this.showTimeoutId) {
916
- // 清除之前的定时显示
917
- clearTimeout(this.showTimeoutId);
918
- }
919
- var $container = this.$container;
920
- if (!this._show) {
921
- return;
922
- }
923
- // 隐藏并需改属性
924
- $container.hide();
925
- this._show = false;
926
- }
927
- };
928
-
929
- /*
930
- menu - header
931
- */
932
- // 构造函数
933
- function Head(editor) {
934
- var _this = this;
935
- this.editor = editor;
936
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-header"></i></div>');
937
- this.type = "droplist";
938
-
939
- // 当前是否 active 状态
940
- this._active = false;
941
-
942
- // 初始化 droplist
943
- this.droplist = new DropList(this, {
944
- width: 100,
945
- $title: $("<p>设置标题</p>"),
946
- type: "list",
947
- // droplist 以列表形式展示
948
- list: [{
949
- $elem: $("<h1>H1</h1>"),
950
- value: "<h1>"
951
- }, {
952
- $elem: $("<h2>H2</h2>"),
953
- value: "<h2>"
954
- }, {
955
- $elem: $("<h3>H3</h3>"),
956
- value: "<h3>"
957
- }, {
958
- $elem: $("<h4>H4</h4>"),
959
- value: "<h4>"
960
- }, {
961
- $elem: $("<h5>H5</h5>"),
962
- value: "<h5>"
963
- }, {
964
- $elem: $("<p>正文</p>"),
965
- value: "<p>"
966
- }],
967
- onClick: function onClick(value) {
968
- // 注意 this 是指向当前的 Head 对象
969
- _this._command(value);
970
- }
971
- });
972
- }
973
-
974
- // 原型
975
- Head.prototype = {
976
- constructor: Head,
977
- // 执行命令
978
- _command: function _command(value) {
979
- var editor = this.editor;
980
- var $selectionElem = editor.selection.getSelectionContainerElem();
981
- if (editor.$textElem.equal($selectionElem)) {
982
- // 不能选中多行来设置标题,否则会出现问题
983
- // 例如选中的是 <p>xxx</p><p>yyy</p> 来设置标题,设置之后会成为 <h1>xxx<br>yyy</h1> 不符合预期
984
- return;
985
- }
986
- editor.cmd["do"]("formatBlock", value);
987
- },
988
- // 试图改变 active 状态
989
- tryChangeActive: function tryChangeActive(e) {
990
- var editor = this.editor;
991
- var $elem = this.$elem;
992
- var reg = /^h/i;
993
- var cmdValue = editor.cmd.queryCommandValue("formatBlock");
994
- if (reg.test(cmdValue)) {
995
- this._active = true;
996
- $elem.addClass("w-e-active");
997
- } else {
998
- this._active = false;
999
- $elem.removeClass("w-e-active");
1000
- }
1001
- }
1002
- };
1003
-
1004
- /*
1005
- menu - fontSize
1006
- */
1007
-
1008
- // 构造函数
1009
- function FontSize(editor) {
1010
- var _this = this;
1011
- this.editor = editor;
1012
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-text-heigh"></i></div>');
1013
- this.type = "droplist";
1014
-
1015
- // 当前是否 active 状态
1016
- this._active = false;
1017
-
1018
- // 初始化 droplist
1019
- this.droplist = new DropList(this, {
1020
- width: 160,
1021
- $title: $("<p>字号</p>"),
1022
- type: "list",
1023
- // droplist 以列表形式展示
1024
- list: [{
1025
- $elem: $('<span style="font-size: x-small;">x-small</span>'),
1026
- value: "1"
1027
- }, {
1028
- $elem: $('<span style="font-size: small;">small</span>'),
1029
- value: "2"
1030
- }, {
1031
- $elem: $("<span>normal</span>"),
1032
- value: "3"
1033
- }, {
1034
- $elem: $('<span style="font-size: large;">large</span>'),
1035
- value: "4"
1036
- }, {
1037
- $elem: $('<span style="font-size: x-large;">x-large</span>'),
1038
- value: "5"
1039
- }, {
1040
- $elem: $('<span style="font-size: xx-large;">xx-large</span>'),
1041
- value: "6"
1042
- }],
1043
- onClick: function onClick(value) {
1044
- // 注意 this 是指向当前的 FontSize 对象
1045
- _this._command(value);
1046
- }
1047
- });
1048
- }
1049
-
1050
- // 原型
1051
- FontSize.prototype = {
1052
- constructor: FontSize,
1053
- // 执行命令
1054
- _command: function _command(value) {
1055
- var editor = this.editor;
1056
- editor.cmd["do"]("fontSize", value);
1057
- }
1058
- };
1059
-
1060
- /*
1061
- menu - fontName
1062
- */
1063
-
1064
- // 构造函数
1065
- function FontName(editor) {
1066
- var _this = this;
1067
- this.editor = editor;
1068
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-font"></i></div>');
1069
- this.type = "droplist";
1070
-
1071
- // 当前是否 active 状态
1072
- this._active = false;
1073
-
1074
- // 获取配置的字体
1075
- var config = editor.config;
1076
- var fontNames = config.fontNames || [];
1077
-
1078
- // 初始化 droplist
1079
- this.droplist = new DropList(this, {
1080
- width: 100,
1081
- $title: $("<p>字体</p>"),
1082
- type: "list",
1083
- // droplist 以列表形式展示
1084
- list: fontNames.map(function (fontName) {
1085
- return {
1086
- $elem: $('<span style="font-family: ' + fontName + ';">' + fontName + "</span>"),
1087
- value: fontName
1088
- };
1089
- }),
1090
- onClick: function onClick(value) {
1091
- // 注意 this 是指向当前的 FontName 对象
1092
- _this._command(value);
1093
- }
1094
- });
1095
- }
1096
-
1097
- // 原型
1098
- FontName.prototype = {
1099
- constructor: FontName,
1100
- _command: function _command(value) {
1101
- var editor = this.editor;
1102
- editor.cmd["do"]("fontName", value);
1103
- }
1104
- };
1105
-
1106
- /*
1107
- panel
1108
- */
1109
-
1110
- var emptyFn = function emptyFn() {};
1111
-
1112
- // 记录已经显示 panel 的菜单
1113
- var _isCreatedPanelMenus = [];
1114
-
1115
- // 标记是否应该记录新的Panel属性值,解决重复点击同一个Panel导致的Panel容器$container丢失问题
1116
- var isRecordNewPanel = true;
1117
- // 构造函数
1118
- function Panel(menu, opt) {
1119
- this.menu = menu;
1120
- this.opt = opt;
1121
- }
1122
-
1123
- // 原型
1124
- Panel.prototype = {
1125
- constructor: Panel,
1126
- // 显示(插入DOM)
1127
- show: function show() {
1128
- var _this = this;
1129
- var menu = this.menu;
1130
- if (_isCreatedPanelMenus.indexOf(menu) >= 0) {
1131
- // 该菜单已经创建了 panel 不能再创建
1132
- // 点击同一个panel不记录
1133
- isRecordNewPanel = false;
1134
- return;
1135
- }
1136
- var editor = menu.editor;
1137
- var $body = $("body");
1138
- var $textContainerElem = editor.$textContainerElem;
1139
- var opt = this.opt;
1140
-
1141
- // panel 的容器
1142
- var $container = $('<div class="w-e-panel-container"></div>');
1143
- var width = opt.width || 300; // 默认 300px
1144
- $container.css("width", width + "px").css("margin-left", (0 - width) / 2 + "px");
1145
-
1146
- // 添加关闭按钮
1147
- var $closeBtn = $('<i class="w-e-icon-close w-e-panel-close"></i>');
1148
- $container.append($closeBtn);
1149
- $closeBtn.on("click", function () {
1150
- _this.hide();
1151
- });
1152
-
1153
- // 准备 tabs 容器
1154
- var $tabTitleContainer = $('<ul class="w-e-panel-tab-title"></ul>');
1155
- var $tabContentContainer = $('<div class="w-e-panel-tab-content"></div>');
1156
- $container.append($tabTitleContainer).append($tabContentContainer);
1157
-
1158
- // 设置高度
1159
- var height = opt.height;
1160
- if (height) {
1161
- $tabContentContainer.css("height", height + "px").css("overflow-y", "auto");
1162
- }
1163
-
1164
- // tabs
1165
- var tabs = opt.tabs || [];
1166
- var tabTitleArr = [];
1167
- var tabContentArr = [];
1168
- tabs.forEach(function (tab, tabIndex) {
1169
- if (!tab) {
1170
- return;
1171
- }
1172
- var title = tab.title || "";
1173
- var tpl = tab.tpl || "";
1174
-
1175
- // 替换多语言
1176
- title = replaceLang(editor, title);
1177
- tpl = replaceLang(editor, tpl);
1178
-
1179
- // 添加到 DOM
1180
- var $title = $('<li class="w-e-item">' + title + "</li>");
1181
- $tabTitleContainer.append($title);
1182
- var $content = $(tpl);
1183
- $tabContentContainer.append($content);
1184
-
1185
- // 记录到内存
1186
- $title._index = tabIndex;
1187
- tabTitleArr.push($title);
1188
- tabContentArr.push($content);
1189
-
1190
- // 设置 active 项
1191
- if (tabIndex === 0) {
1192
- $title._active = true;
1193
- $title.addClass("w-e-active");
1194
- } else {
1195
- $content.hide();
1196
- }
1197
-
1198
- // 绑定 tab 的事件
1199
- $title.on("click", function (e) {
1200
- if ($title._active) {
1201
- return;
1202
- }
1203
- // 隐藏所有的 tab
1204
- tabTitleArr.forEach(function ($title) {
1205
- $title._active = false;
1206
- $title.removeClass("w-e-active");
1207
- });
1208
- tabContentArr.forEach(function ($content) {
1209
- $content.hide();
1210
- });
1211
-
1212
- // 显示当前的 tab
1213
- $title._active = true;
1214
- $title.addClass("w-e-active");
1215
- $content.show();
1216
- });
1217
- });
1218
-
1219
- // 绑定关闭事件
1220
- $container.on("click", function (e) {
1221
- // 点击时阻止冒泡
1222
- e.stopPropagation();
1223
- });
1224
- $body.on("click", function (e) {
1225
- _this.hide();
1226
- });
1227
-
1228
- // 添加到 DOM
1229
- $textContainerElem.append($container);
1230
-
1231
- // 绑定 opt 的事件,只有添加到 DOM 之后才能绑定成功
1232
- tabs.forEach(function (tab, index) {
1233
- if (!tab) {
1234
- return;
1235
- }
1236
- var events = tab.events || [];
1237
- events.forEach(function (event) {
1238
- var selector = event.selector;
1239
- var type = event.type;
1240
- var fn = event.fn || emptyFn;
1241
- var $content = tabContentArr[index];
1242
- $content.find(selector).on(type, function (e) {
1243
- e.stopPropagation();
1244
- var needToHide = fn(e);
1245
- // 执行完事件之后,是否要关闭 panel
1246
- if (needToHide) {
1247
- _this.hide();
1248
- }
1249
- });
1250
- });
1251
- });
1252
-
1253
- // focus 第一个 elem
1254
- var $inputs = $container.find("input[type=text],textarea");
1255
- if ($inputs.length) {
1256
- $inputs.get(0).focus();
1257
- }
1258
-
1259
- // 添加到属性
1260
- this.$container = $container;
1261
-
1262
- // 隐藏其他 panel
1263
- this._hideOtherPanels();
1264
- // 记录该 menu 已经创建了 panel
1265
- _isCreatedPanelMenus.push(menu);
1266
- // 未重复点击同一个panel 记录
1267
- isRecordNewPanel = true;
1268
- },
1269
- // 隐藏(移除DOM)
1270
- hide: function hide() {
1271
- var menu = this.menu;
1272
- var $container = this.$container;
1273
- if ($container) {
1274
- $container.remove();
1275
- }
1276
-
1277
- // 将该 menu 记录中移除
1278
- _isCreatedPanelMenus = _isCreatedPanelMenus.filter(function (item) {
1279
- if (item === menu) {
1280
- return false;
1281
- } else {
1282
- return true;
1283
- }
1284
- });
1285
- },
1286
- // 一个 panel 展示时,隐藏其他 panel
1287
- _hideOtherPanels: function _hideOtherPanels() {
1288
- if (!_isCreatedPanelMenus.length) {
1289
- return;
1290
- }
1291
- _isCreatedPanelMenus.forEach(function (menu) {
1292
- var panel = menu.panel || {};
1293
- if (panel.hide) {
1294
- panel.hide();
1295
- }
1296
- });
1297
- }
1298
- };
1299
-
1300
- /*
1301
- menu - link
1302
- */
1303
- // 构造函数
1304
- function Link(editor) {
1305
- this.editor = editor;
1306
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-link"></i></div>');
1307
- this.type = "panel";
1308
-
1309
- // 当前是否 active 状态
1310
- this._active = false;
1311
- }
1312
-
1313
- // 原型
1314
- Link.prototype = {
1315
- constructor: Link,
1316
- // 点击事件
1317
- onClick: function onClick(e) {
1318
- var editor = this.editor;
1319
- var $linkelem = void 0;
1320
- if (this._active) {
1321
- // 当前选区在链接里面
1322
- $linkelem = editor.selection.getSelectionContainerElem();
1323
- if (!$linkelem) {
1324
- return;
1325
- }
1326
- // 将该元素都包含在选取之内,以便后面整体替换
1327
- editor.selection.createRangeByElem($linkelem);
1328
- editor.selection.restoreSelection();
1329
- // 显示 panel
1330
- this._createPanel($linkelem.text(), $linkelem.attr("href"));
1331
- } else {
1332
- // 当前选区不在链接里面
1333
- if (editor.selection.isSelectionEmpty()) {
1334
- // 选区是空的,未选中内容
1335
- this._createPanel("", "");
1336
- } else {
1337
- // 选中内容了
1338
- this._createPanel(editor.selection.getSelectionText(), "");
1339
- }
1340
- }
1341
- },
1342
- // 创建 panel
1343
- _createPanel: function _createPanel(text, link) {
1344
- var _this = this;
1345
-
1346
- // panel 中需要用到的id
1347
- var inputLinkId = getRandom("input-link");
1348
- var inputTextId = getRandom("input-text");
1349
- var btnOkId = getRandom("btn-ok");
1350
- var btnDelId = getRandom("btn-del");
1351
-
1352
- // 是否显示“删除链接”
1353
- var delBtnDisplay = this._active ? "inline-block" : "none";
1354
- // 初始化并显示 panel
1355
- var panel = new Panel(this, {
1356
- width: 300,
1357
- // panel 中可包含多个 tab
1358
- tabs: [{
1359
- // tab 的标题
1360
- title: "链接",
1361
- // 模板
1362
- tpl: '<div>\n <input id="' + inputTextId + '" type="text" class="block" value="' + text + "\" placeholder=\"\u94FE\u63A5\u6587\u5B57\"/></td>\n <input id=\"" + inputLinkId + '" type="text" class="block" value="' + link + '" placeholder="http://..."/></td>\n <div class="w-e-button-container">\n <button id="' + btnOkId + "\" class=\"right\">\u63D2\u5165</button>\n <button id=\"" + btnDelId + '" class="gray right" style="display:' + delBtnDisplay + "\">\u5220\u9664\u94FE\u63A5</button>\n </div>\n </div>",
1363
- // 事件绑定
1364
- events: [
1365
- // 插入链接
1366
- {
1367
- selector: "#" + btnOkId,
1368
- type: "click",
1369
- fn: function fn() {
1370
- // 执行插入链接
1371
- var $link = $("#" + inputLinkId);
1372
- var $text = $("#" + inputTextId);
1373
- var link = $link.val();
1374
- var text = $text.val();
1375
-
1376
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
1377
- return !_this._insertLink(text, link);
1378
- }
1379
- },
1380
- // 删除链接
1381
- {
1382
- selector: "#" + btnDelId,
1383
- type: "click",
1384
- fn: function fn() {
1385
- // 执行删除链接
1386
- _this._delLink();
1387
-
1388
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
1389
- return true;
1390
- }
1391
- }]
1392
- } // tab end
1393
- ] // tabs end
1394
- });
1395
-
1396
- // 显示 panel
1397
- panel.show();
1398
- if (isRecordNewPanel) {
1399
- // 记录属性
1400
- this.panel = panel;
1401
- }
1402
- },
1403
- // 删除当前链接
1404
- _delLink: function _delLink() {
1405
- if (!this._active) {
1406
- return;
1407
- }
1408
- var editor = this.editor;
1409
- var $selectionELem = editor.selection.getSelectionContainerElem();
1410
- if (!$selectionELem) {
1411
- return;
1412
- }
1413
- var selectionText = editor.selection.getSelectionText();
1414
- editor.cmd["do"]("insertHTML", "<span>" + selectionText + "</span>");
1415
- },
1416
- // 插入链接
1417
- _insertLink: function _insertLink(text, link) {
1418
- var editor = this.editor;
1419
- var config = editor.config;
1420
- var linkCheck = config.linkCheck;
1421
- var checkResult = true; // 默认为 true
1422
- if (linkCheck && typeof linkCheck === "function") {
1423
- checkResult = linkCheck(text, link);
1424
- }
1425
- if (checkResult === true && text != "") {
1426
- editor.cmd["do"]("insertHTML", '<a href="' + link + '" target="_blank">' + handleChangeContent(text) + "</a>");
1427
- } else if (checkResult === true && text == "") {
1428
- editor.cmd["do"]("insertHTML", '<a href="' + link + '" target="_blank">' + link + "</a>");
1429
- } else {
1430
- alert(checkResult);
1431
- return "save panel";
1432
- }
1433
- },
1434
- // 试图改变 active 状态
1435
- tryChangeActive: function tryChangeActive(e) {
1436
- var editor = this.editor;
1437
- var $elem = this.$elem;
1438
- var $selectionELem = editor.selection.getSelectionContainerElem();
1439
- if (!$selectionELem) {
1440
- return;
1441
- }
1442
- if ($selectionELem.getNodeName() === "A") {
1443
- this._active = true;
1444
- $elem.addClass("w-e-active");
1445
- } else {
1446
- this._active = false;
1447
- $elem.removeClass("w-e-active");
1448
- }
1449
- }
1450
- };
1451
-
1452
- /*
1453
- italic-menu
1454
- */
1455
- // 构造函数
1456
- function Italic(editor) {
1457
- this.editor = editor;
1458
- this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-italic"></i>\n </div>');
1459
- this.type = "click";
1460
-
1461
- // 当前是否 active 状态
1462
- this._active = false;
1463
- }
1464
-
1465
- // 原型
1466
- Italic.prototype = {
1467
- constructor: Italic,
1468
- // 点击事件
1469
- onClick: function onClick(e) {
1470
- // 点击菜单将触发这里
1471
-
1472
- var editor = this.editor;
1473
- var isSeleEmpty = editor.selection.isSelectionEmpty();
1474
- if (isSeleEmpty) {
1475
- // 选区是空的,插入并选中一个“空白”
1476
- editor.selection.createEmptyRange();
1477
- }
1478
-
1479
- // 执行 italic 命令
1480
- editor.cmd["do"]("italic");
1481
- if (isSeleEmpty) {
1482
- // 需要将选取折叠起来
1483
- editor.selection.collapseRange();
1484
- editor.selection.restoreSelection();
1485
- }
1486
- },
1487
- // 试图改变 active 状态
1488
- tryChangeActive: function tryChangeActive(e) {
1489
- var editor = this.editor;
1490
- var $elem = this.$elem;
1491
- if (editor.cmd.queryCommandState("italic")) {
1492
- this._active = true;
1493
- $elem.addClass("w-e-active");
1494
- } else {
1495
- this._active = false;
1496
- $elem.removeClass("w-e-active");
1497
- }
1498
- }
1499
- };
1500
-
1501
- /*
1502
- redo-menu
1503
- */
1504
- // 构造函数
1505
- function Redo(editor) {
1506
- this.editor = editor;
1507
- this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-redo"></i>\n </div>');
1508
- this.type = "click";
1509
-
1510
- // 当前是否 active 状态
1511
- this._active = false;
1512
- }
1513
-
1514
- // 原型
1515
- Redo.prototype = {
1516
- constructor: Redo,
1517
- // 点击事件
1518
- onClick: function onClick(e) {
1519
- // 点击菜单将触发这里
1520
-
1521
- var editor = this.editor;
1522
-
1523
- // 执行 redo 命令
1524
- editor.cmd["do"]("redo");
1525
- }
1526
- };
1527
-
1528
- /*
1529
- strikeThrough-menu
1530
- */
1531
- // 构造函数
1532
- function StrikeThrough(editor) {
1533
- this.editor = editor;
1534
- this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-strikethrough"></i>\n </div>');
1535
- this.type = "click";
1536
-
1537
- // 当前是否 active 状态
1538
- this._active = false;
1539
- }
1540
-
1541
- // 原型
1542
- StrikeThrough.prototype = {
1543
- constructor: StrikeThrough,
1544
- // 点击事件
1545
- onClick: function onClick(e) {
1546
- // 点击菜单将触发这里
1547
-
1548
- var editor = this.editor;
1549
- var isSeleEmpty = editor.selection.isSelectionEmpty();
1550
- if (isSeleEmpty) {
1551
- // 选区是空的,插入并选中一个“空白”
1552
- editor.selection.createEmptyRange();
1553
- }
1554
-
1555
- // 执行 strikeThrough 命令
1556
- editor.cmd["do"]("strikeThrough");
1557
- if (isSeleEmpty) {
1558
- // 需要将选取折叠起来
1559
- editor.selection.collapseRange();
1560
- editor.selection.restoreSelection();
1561
- }
1562
- },
1563
- // 试图改变 active 状态
1564
- tryChangeActive: function tryChangeActive(e) {
1565
- var editor = this.editor;
1566
- var $elem = this.$elem;
1567
- if (editor.cmd.queryCommandState("strikeThrough")) {
1568
- this._active = true;
1569
- $elem.addClass("w-e-active");
1570
- } else {
1571
- this._active = false;
1572
- $elem.removeClass("w-e-active");
1573
- }
1574
- }
1575
- };
1576
-
1577
- /*
1578
- underline-menu
1579
- */
1580
- // 构造函数
1581
- function Underline(editor) {
1582
- this.editor = editor;
1583
- this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-underline"></i>\n </div>');
1584
- this.type = "click";
1585
-
1586
- // 当前是否 active 状态
1587
- this._active = false;
1588
- }
1589
-
1590
- // 原型
1591
- Underline.prototype = {
1592
- constructor: Underline,
1593
- // 点击事件
1594
- onClick: function onClick(e) {
1595
- // 点击菜单将触发这里
1596
-
1597
- var editor = this.editor;
1598
- var isSeleEmpty = editor.selection.isSelectionEmpty();
1599
- if (isSeleEmpty) {
1600
- // 选区是空的,插入并选中一个“空白”
1601
- editor.selection.createEmptyRange();
1602
- }
1603
-
1604
- // 执行 underline 命令
1605
- editor.cmd["do"]("underline");
1606
- if (isSeleEmpty) {
1607
- // 需要将选取折叠起来
1608
- editor.selection.collapseRange();
1609
- editor.selection.restoreSelection();
1610
- }
1611
- },
1612
- // 试图改变 active 状态
1613
- tryChangeActive: function tryChangeActive(e) {
1614
- var editor = this.editor;
1615
- var $elem = this.$elem;
1616
- if (editor.cmd.queryCommandState("underline")) {
1617
- this._active = true;
1618
- $elem.addClass("w-e-active");
1619
- } else {
1620
- this._active = false;
1621
- $elem.removeClass("w-e-active");
1622
- }
1623
- }
1624
- };
1625
-
1626
- /*
1627
- undo-menu
1628
- */
1629
- // 构造函数
1630
- function Undo(editor) {
1631
- this.editor = editor;
1632
- this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-undo"></i>\n </div>');
1633
- this.type = "click";
1634
-
1635
- // 当前是否 active 状态
1636
- this._active = false;
1637
- }
1638
-
1639
- // 原型
1640
- Undo.prototype = {
1641
- constructor: Undo,
1642
- // 点击事件
1643
- onClick: function onClick(e) {
1644
- // 点击菜单将触发这里
1645
-
1646
- var editor = this.editor;
1647
-
1648
- // 执行 undo 命令
1649
- editor.cmd["do"]("undo");
1650
- }
1651
- };
1652
-
1653
- /*
1654
- menu - list
1655
- */
1656
- // 构造函数
1657
- function List(editor) {
1658
- var _this = this;
1659
- this.editor = editor;
1660
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-list2"></i></div>');
1661
- this.type = "droplist";
1662
-
1663
- // 当前是否 active 状态
1664
- this._active = false;
1665
-
1666
- // 初始化 droplist
1667
- this.droplist = new DropList(this, {
1668
- width: 120,
1669
- $title: $("<p>设置列表</p>"),
1670
- type: "list",
1671
- // droplist 以列表形式展示
1672
- list: [{
1673
- $elem: $('<span><i class="w-e-icon-list-numbered"></i> 有序列表</span>'),
1674
- value: "insertOrderedList"
1675
- }, {
1676
- $elem: $('<span><i class="w-e-icon-list2"></i> 无序列表</span>'),
1677
- value: "insertUnorderedList"
1678
- }],
1679
- onClick: function onClick(value) {
1680
- // 注意 this 是指向当前的 List 对象
1681
- _this._command(value);
1682
- }
1683
- });
1684
- }
1685
-
1686
- // 原型
1687
- List.prototype = {
1688
- constructor: List,
1689
- // 执行命令
1690
- _command: function _command(value) {
1691
- var editor = this.editor;
1692
- var $textElem = editor.$textElem;
1693
- editor.selection.restoreSelection();
1694
- if (editor.cmd.queryCommandState(value)) {
1695
- return;
1696
- }
1697
- editor.cmd["do"](value);
1698
-
1699
- // 验证列表是否被包裹在 <p> 之内
1700
- var $selectionElem = editor.selection.getSelectionContainerElem();
1701
- if ($selectionElem.getNodeName() === "LI") {
1702
- $selectionElem = $selectionElem.parent();
1703
- }
1704
- if (/^ol|ul$/i.test($selectionElem.getNodeName()) === false) {
1705
- return;
1706
- }
1707
- if ($selectionElem.equal($textElem)) {
1708
- // 证明是顶级标签,没有被 <p> 包裹
1709
- return;
1710
- }
1711
- var $parent = $selectionElem.parent();
1712
- if ($parent.equal($textElem)) {
1713
- // $parent 是顶级标签,不能删除
1714
- return;
1715
- }
1716
- $selectionElem.insertAfter($parent);
1717
- $parent.remove();
1718
- },
1719
- // 试图改变 active 状态
1720
- tryChangeActive: function tryChangeActive(e) {
1721
- var editor = this.editor;
1722
- var $elem = this.$elem;
1723
- if (editor.cmd.queryCommandState("insertUnOrderedList") || editor.cmd.queryCommandState("insertOrderedList")) {
1724
- this._active = true;
1725
- $elem.addClass("w-e-active");
1726
- } else {
1727
- this._active = false;
1728
- $elem.removeClass("w-e-active");
1729
- }
1730
- }
1731
- };
1732
-
1733
- /*
1734
- menu - justify
1735
- */
1736
- // 构造函数
1737
- function Justify(editor) {
1738
- var _this = this;
1739
- this.editor = editor;
1740
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-paragraph-left"></i></div>');
1741
- this.type = "droplist";
1742
-
1743
- // 当前是否 active 状态
1744
- this._active = false;
1745
-
1746
- // 初始化 droplist
1747
- this.droplist = new DropList(this, {
1748
- width: 100,
1749
- $title: $("<p>对齐方式</p>"),
1750
- type: "list",
1751
- // droplist 以列表形式展示
1752
- list: [{
1753
- $elem: $('<span><i class="w-e-icon-paragraph-left"></i> 靠左</span>'),
1754
- value: "justifyLeft"
1755
- }, {
1756
- $elem: $('<span><i class="w-e-icon-paragraph-center"></i> 居中</span>'),
1757
- value: "justifyCenter"
1758
- }, {
1759
- $elem: $('<span><i class="w-e-icon-paragraph-right"></i> 靠右</span>'),
1760
- value: "justifyRight"
1761
- }],
1762
- onClick: function onClick(value) {
1763
- // 注意 this 是指向当前的 List 对象
1764
- _this._command(value);
1765
- }
1766
- });
1767
- }
1768
-
1769
- // 原型
1770
- Justify.prototype = {
1771
- constructor: Justify,
1772
- // 执行命令
1773
- _command: function _command(value) {
1774
- var editor = this.editor;
1775
- editor.cmd["do"](value);
1776
- }
1777
- };
1778
-
1779
- /*
1780
- menu - Forecolor
1781
- */
1782
- // 构造函数
1783
- function ForeColor(editor) {
1784
- var _this = this;
1785
- this.editor = editor;
1786
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-pencil2"></i></div>');
1787
- this.type = "droplist";
1788
-
1789
- // 获取配置的颜色
1790
- var config = editor.config;
1791
- var colors = config.colors || [];
1792
-
1793
- // 当前是否 active 状态
1794
- this._active = false;
1795
-
1796
- // 初始化 droplist
1797
- this.droplist = new DropList(this, {
1798
- width: 120,
1799
- $title: $("<p>文字颜色</p>"),
1800
- type: "inline-block",
1801
- // droplist 内容以 block 形式展示
1802
- list: colors.map(function (color) {
1803
- return {
1804
- $elem: $('<i style="color:' + color + ';" class="w-e-icon-pencil2"></i>'),
1805
- value: color
1806
- };
1807
- }),
1808
- onClick: function onClick(value) {
1809
- // 注意 this 是指向当前的 ForeColor 对象
1810
- _this._command(value);
1811
- }
1812
- });
1813
- }
1814
-
1815
- // 原型
1816
- ForeColor.prototype = {
1817
- constructor: ForeColor,
1818
- // 执行命令
1819
- _command: function _command(value) {
1820
- var editor = this.editor;
1821
- editor.cmd["do"]("foreColor", value);
1822
- }
1823
- };
1824
-
1825
- /*
1826
- menu - BackColor
1827
- */
1828
- // 构造函数
1829
- function BackColor(editor) {
1830
- var _this = this;
1831
- this.editor = editor;
1832
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-paint-brush"></i></div>');
1833
- this.type = "droplist";
1834
-
1835
- // 获取配置的颜色
1836
- var config = editor.config;
1837
- var colors = config.colors || [];
1838
-
1839
- // 当前是否 active 状态
1840
- this._active = false;
1841
-
1842
- // 初始化 droplist
1843
- this.droplist = new DropList(this, {
1844
- width: 120,
1845
- $title: $("<p>背景色</p>"),
1846
- type: "inline-block",
1847
- // droplist 内容以 block 形式展示
1848
- list: colors.map(function (color) {
1849
- return {
1850
- $elem: $('<i style="color:' + color + ';" class="w-e-icon-paint-brush"></i>'),
1851
- value: color
1852
- };
1853
- }),
1854
- onClick: function onClick(value) {
1855
- // 注意 this 是指向当前的 BackColor 对象
1856
- _this._command(value);
1857
- }
1858
- });
1859
- }
1860
-
1861
- // 原型
1862
- BackColor.prototype = {
1863
- constructor: BackColor,
1864
- // 执行命令
1865
- _command: function _command(value) {
1866
- var editor = this.editor;
1867
- editor.cmd["do"]("backColor", value);
1868
- }
1869
- };
1870
-
1871
- /*
1872
- menu - quote
1873
- */
1874
- // 构造函数
1875
- function Quote(editor) {
1876
- this.editor = editor;
1877
- this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-quotes-left"></i>\n </div>');
1878
- this.type = "click";
1879
-
1880
- // 当前是否 active 状态
1881
- this._active = false;
1882
- }
1883
-
1884
- // 原型
1885
- Quote.prototype = {
1886
- constructor: Quote,
1887
- onClick: function onClick(e) {
1888
- var editor = this.editor;
1889
- var $selectionElem = editor.selection.getSelectionContainerElem();
1890
- var nodeName = $selectionElem.getNodeName();
1891
- if (!UA.isIE()) {
1892
- if (nodeName === "BLOCKQUOTE") {
1893
- // 撤销 quote
1894
- editor.cmd["do"]("formatBlock", "<P>");
1895
- } else {
1896
- // 转换为 quote
1897
- editor.cmd["do"]("formatBlock", "<BLOCKQUOTE>");
1898
- }
1899
- return;
1900
- }
1901
-
1902
- // IE 中不支持 formatBlock <BLOCKQUOTE> ,要用其他方式兼容
1903
- var content = void 0,
1904
- $targetELem = void 0;
1905
- if (nodeName === "P") {
1906
- // 将 P 转换为 quote
1907
- content = $selectionElem.text();
1908
- $targetELem = $("<blockquote>" + content + "</blockquote>");
1909
- $targetELem.insertAfter($selectionElem);
1910
- $selectionElem.remove();
1911
- return;
1912
- }
1913
- if (nodeName === "BLOCKQUOTE") {
1914
- // 撤销 quote
1915
- content = $selectionElem.text();
1916
- $targetELem = $("<p>" + content + "</p>");
1917
- $targetELem.insertAfter($selectionElem);
1918
- $selectionElem.remove();
1919
- }
1920
- },
1921
- tryChangeActive: function tryChangeActive(e) {
1922
- var editor = this.editor;
1923
- var $elem = this.$elem;
1924
- var reg = /^BLOCKQUOTE$/i;
1925
- var cmdValue = editor.cmd.queryCommandValue("formatBlock");
1926
- if (reg.test(cmdValue)) {
1927
- this._active = true;
1928
- $elem.addClass("w-e-active");
1929
- } else {
1930
- this._active = false;
1931
- $elem.removeClass("w-e-active");
1932
- }
1933
- }
1934
- };
1935
-
1936
- /*
1937
- menu - code
1938
- */
1939
- // 构造函数
1940
- function Code(editor) {
1941
- this.editor = editor;
1942
- this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-terminal"></i>\n </div>');
1943
- this.type = "panel";
1944
-
1945
- // 当前是否 active 状态
1946
- this._active = false;
1947
- }
1948
-
1949
- // 原型
1950
- Code.prototype = {
1951
- constructor: Code,
1952
- onClick: function onClick(e) {
1953
- var editor = this.editor;
1954
- var $startElem = editor.selection.getSelectionStartElem();
1955
- var $endElem = editor.selection.getSelectionEndElem();
1956
- var isSeleEmpty = editor.selection.isSelectionEmpty();
1957
- var selectionText = editor.selection.getSelectionText();
1958
- var $code = void 0;
1959
- if (!$startElem.equal($endElem)) {
1960
- // 跨元素选择,不做处理
1961
- editor.selection.restoreSelection();
1962
- return;
1963
- }
1964
- if (!isSeleEmpty) {
1965
- // 选取不是空,用 <code> 包裹即可
1966
- $code = $("<code>" + selectionText + "</code>");
1967
- editor.cmd["do"]("insertElem", $code);
1968
- editor.selection.createRangeByElem($code, false);
1969
- editor.selection.restoreSelection();
1970
- return;
1971
- }
1972
-
1973
- // 选取是空,且没有夸元素选择,则插入 <pre><code></code></prev>
1974
- if (this._active) {
1975
- // 选中状态,将编辑内容
1976
- this._createPanel($startElem.html());
1977
- } else {
1978
- // 未选中状态,将创建内容
1979
- this._createPanel();
1980
- }
1981
- },
1982
- _createPanel: function _createPanel(value) {
1983
- var _this = this;
1984
-
1985
- // value - 要编辑的内容
1986
- value = value || "";
1987
- var type = !value ? "new" : "edit";
1988
- var textId = getRandom("texxt");
1989
- var btnId = getRandom("btn");
1990
- var panel = new Panel(this, {
1991
- width: 500,
1992
- // 一个 Panel 包含多个 tab
1993
- tabs: [{
1994
- // 标题
1995
- title: "插入代码",
1996
- // 模板
1997
- tpl: '<div>\n <textarea id="' + textId + '" style="height:145px;;">' + value + '</textarea>\n <div class="w-e-button-container">\n <button id="' + btnId + "\" class=\"right\">\u63D2\u5165</button>\n </div>\n <div>",
1998
- // 事件绑定
1999
- events: [
2000
- // 插入代码
2001
- {
2002
- selector: "#" + btnId,
2003
- type: "click",
2004
- fn: function fn() {
2005
- var $text = $("#" + textId);
2006
- var text = $text.val() || $text.html();
2007
- text = replaceHtmlSymbol(text);
2008
- if (type === "new") {
2009
- // 新插入
2010
- _this._insertCode(text);
2011
- } else {
2012
- // 编辑更新
2013
- _this._updateCode(text);
2014
- }
2015
-
2016
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2017
- return true;
2018
- }
2019
- }]
2020
- } // first tab end
2021
- ] // tabs end
2022
- }); // new Panel end
2023
-
2024
- // 显示 panel
2025
- panel.show();
2026
- if (isRecordNewPanel) {
2027
- // 记录属性
2028
- this.panel = panel;
2029
- }
2030
- },
2031
- // 插入代码
2032
- _insertCode: function _insertCode(value) {
2033
- var editor = this.editor;
2034
- editor.cmd["do"]("insertHTML", "<pre><code>" + value + "</code></pre><p><br></p>");
2035
- },
2036
- // 更新代码
2037
- _updateCode: function _updateCode(value) {
2038
- var editor = this.editor;
2039
- var $selectionELem = editor.selection.getSelectionContainerElem();
2040
- if (!$selectionELem) {
2041
- return;
2042
- }
2043
- $selectionELem.html(value);
2044
- editor.selection.restoreSelection();
2045
- },
2046
- // 试图改变 active 状态
2047
- tryChangeActive: function tryChangeActive(e) {
2048
- var editor = this.editor;
2049
- var $elem = this.$elem;
2050
- var $selectionELem = editor.selection.getSelectionContainerElem();
2051
- if (!$selectionELem) {
2052
- return;
2053
- }
2054
- var $parentElem = $selectionELem.parent();
2055
- if ($selectionELem.getNodeName() === "CODE" && $parentElem.getNodeName() === "PRE") {
2056
- this._active = true;
2057
- $elem.addClass("w-e-active");
2058
- } else {
2059
- this._active = false;
2060
- $elem.removeClass("w-e-active");
2061
- }
2062
- }
2063
- };
2064
-
2065
- /*
2066
- menu - emoticon
2067
- */
2068
- // 构造函数
2069
- function Emoticon(editor) {
2070
- this.editor = editor;
2071
- this.$elem = $('<div class="w-e-menu">\n <i class="w-e-icon-happy"></i>\n </div>');
2072
- this.type = "panel";
2073
-
2074
- // 当前是否 active 状态
2075
- this._active = false;
2076
- }
2077
-
2078
- // 原型
2079
- Emoticon.prototype = {
2080
- constructor: Emoticon,
2081
- onClick: function onClick() {
2082
- this._createPanel();
2083
- },
2084
- _createPanel: function _createPanel() {
2085
- var _this = this;
2086
- var editor = this.editor;
2087
- var config = editor.config;
2088
- // 获取表情配置
2089
- var emotions = config.emotions || [];
2090
-
2091
- // 创建表情 dropPanel 的配置
2092
- var tabConfig = [];
2093
- emotions.forEach(function (emotData) {
2094
- var emotType = emotData.type;
2095
- var content = emotData.content || [];
2096
-
2097
- // 这一组表情最终拼接出来的 html
2098
- var faceHtml = "";
2099
-
2100
- // emoji 表情
2101
- if (emotType === "emoji") {
2102
- content.forEach(function (item) {
2103
- if (item) {
2104
- faceHtml += '<span class="w-e-item">' + item + "</span>";
2105
- }
2106
- });
2107
- }
2108
- // 图片表情
2109
- if (emotType === "image") {
2110
- content.forEach(function (item) {
2111
- var src = item.src;
2112
- var alt = item.alt;
2113
- if (src) {
2114
- // 加一个 data-w-e 属性,点击图片的时候不再提示编辑图片
2115
- faceHtml += '<span class="w-e-item"><img src="' + src + '" alt="' + alt + '" data-w-e="1"/></span>';
2116
- }
2117
- });
2118
- }
2119
- tabConfig.push({
2120
- title: emotData.title,
2121
- tpl: '<div class="w-e-emoticon-container">' + faceHtml + "</div>",
2122
- events: [{
2123
- selector: "span.w-e-item",
2124
- type: "click",
2125
- fn: function fn(e) {
2126
- var target = e.target;
2127
- var $target = $(target);
2128
- var nodeName = $target.getNodeName();
2129
- var insertHtml = void 0;
2130
- if (nodeName === "IMG") {
2131
- // 插入图片
2132
- insertHtml = $target.parent().html();
2133
- } else {
2134
- // 插入 emoji
2135
- insertHtml = "<span>" + $target.html() + "</span>";
2136
- }
2137
- _this._insert(insertHtml);
2138
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2139
- return true;
2140
- }
2141
- }]
2142
- });
2143
- });
2144
- var panel = new Panel(this, {
2145
- width: 300,
2146
- height: 200,
2147
- // 一个 Panel 包含多个 tab
2148
- tabs: tabConfig
2149
- });
2150
-
2151
- // 显示 panel
2152
- panel.show();
2153
- if (isRecordNewPanel) {
2154
- // 记录属性
2155
- this.panel = panel;
2156
- }
2157
- },
2158
- // 插入表情
2159
- _insert: function _insert(emotHtml) {
2160
- var editor = this.editor;
2161
- editor.cmd["do"]("insertHTML", emotHtml);
2162
- }
2163
- };
2164
-
2165
- /*
2166
- menu - table
2167
- */
2168
- // 构造函数
2169
- function Table(editor) {
2170
- this.editor = editor;
2171
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-table2"></i></div>');
2172
- this.type = "panel";
2173
-
2174
- // 当前是否 active 状态
2175
- this._active = false;
2176
- }
2177
-
2178
- // 原型
2179
- Table.prototype = {
2180
- constructor: Table,
2181
- onClick: function onClick() {
2182
- if (this._active) {
2183
- // 编辑现有表格
2184
- this._createEditPanel();
2185
- } else {
2186
- // 插入新表格
2187
- this._createInsertPanel();
2188
- }
2189
- },
2190
- // 创建插入新表格的 panel
2191
- _createInsertPanel: function _createInsertPanel() {
2192
- var _this = this;
2193
-
2194
- // 用到的 id
2195
- var btnInsertId = getRandom("btn");
2196
- var textRowNum = getRandom("row");
2197
- var textColNum = getRandom("col");
2198
- var panel = new Panel(this, {
2199
- width: 250,
2200
- // panel 包含多个 tab
2201
- tabs: [{
2202
- // 标题
2203
- title: "插入表格",
2204
- // 模板
2205
- tpl: "<div>\n <p style=\"text-align:left; padding:5px 0;\">\n \u521B\u5EFA\n <input id=\"" + textRowNum + "\" type=\"text\" value=\"5\" style=\"width:40px;text-align:center;\"/>\n \u884C\n <input id=\"" + textColNum + "\" type=\"text\" value=\"5\" style=\"width:40px;text-align:center;\"/>\n \u5217\u7684\u8868\u683C\n </p>\n <div class=\"w-e-button-container\">\n <button id=\"" + btnInsertId + "\" class=\"right\">\u63D2\u5165</button>\n </div>\n </div>",
2206
- // 事件绑定
2207
- events: [{
2208
- // 点击按钮,插入表格
2209
- selector: "#" + btnInsertId,
2210
- type: "click",
2211
- fn: function fn() {
2212
- var rowNum = parseInt($("#" + textRowNum).val());
2213
- var colNum = parseInt($("#" + textColNum).val());
2214
- if (rowNum && colNum && rowNum > 0 && colNum > 0) {
2215
- // form 数据有效
2216
- _this._insert(rowNum, colNum);
2217
- }
2218
-
2219
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2220
- return true;
2221
- }
2222
- }]
2223
- } // first tab end
2224
- ] // tabs end
2225
- }); // panel end
2226
-
2227
- // 展示 panel
2228
- panel.show();
2229
- if (isRecordNewPanel) {
2230
- // 记录属性
2231
- this.panel = panel;
2232
- }
2233
- },
2234
- // 插入表格
2235
- _insert: function _insert(rowNum, colNum) {
2236
- // 拼接 table 模板
2237
- var r = void 0,
2238
- c = void 0;
2239
- var html = '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
2240
- for (r = 0; r < rowNum; r++) {
2241
- html += "<tr>";
2242
- if (r === 0) {
2243
- for (c = 0; c < colNum; c++) {
2244
- html += "<th>&nbsp;</th>";
2245
- }
2246
- } else {
2247
- for (c = 0; c < colNum; c++) {
2248
- html += "<td>&nbsp;</td>";
2249
- }
2250
- }
2251
- html += "</tr>";
2252
- }
2253
- html += "</table><p><br></p>";
2254
-
2255
- // 执行命令
2256
- var editor = this.editor;
2257
- editor.cmd["do"]("insertHTML", html);
2258
-
2259
- // 防止 firefox 下出现 resize 的控制点
2260
- editor.cmd["do"]("enableObjectResizing", false);
2261
- editor.cmd["do"]("enableInlineTableEditing", false);
2262
- },
2263
- // 创建编辑表格的 panel
2264
- _createEditPanel: function _createEditPanel() {
2265
- var _this2 = this;
2266
-
2267
- // 可用的 id
2268
- var addRowBtnId = getRandom("add-row");
2269
- var addColBtnId = getRandom("add-col");
2270
- var delRowBtnId = getRandom("del-row");
2271
- var delColBtnId = getRandom("del-col");
2272
- var delTableBtnId = getRandom("del-table");
2273
-
2274
- // 创建 panel 对象
2275
- var panel = new Panel(this, {
2276
- width: 320,
2277
- // panel 包含多个 tab
2278
- tabs: [{
2279
- // 标题
2280
- title: "编辑表格",
2281
- // 模板
2282
- tpl: '<div>\n <div class="w-e-button-container" style="border-bottom:1px solid #f1f1f1;padding-bottom:5px;margin-bottom:5px;">\n <button id="' + addRowBtnId + "\" class=\"left\">\u589E\u52A0\u884C</button>\n <button id=\"" + delRowBtnId + "\" class=\"red left\">\u5220\u9664\u884C</button>\n <button id=\"" + addColBtnId + "\" class=\"left\">\u589E\u52A0\u5217</button>\n <button id=\"" + delColBtnId + "\" class=\"red left\">\u5220\u9664\u5217</button>\n </div>\n <div class=\"w-e-button-container\">\n <button id=\"" + delTableBtnId + "\" class=\"gray left\">\u5220\u9664\u8868\u683C</button>\n </dv>\n </div>",
2283
- // 事件绑定
2284
- events: [{
2285
- // 增加行
2286
- selector: "#" + addRowBtnId,
2287
- type: "click",
2288
- fn: function fn() {
2289
- _this2._addRow();
2290
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2291
- return true;
2292
- }
2293
- }, {
2294
- // 增加列
2295
- selector: "#" + addColBtnId,
2296
- type: "click",
2297
- fn: function fn() {
2298
- _this2._addCol();
2299
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2300
- return true;
2301
- }
2302
- }, {
2303
- // 删除行
2304
- selector: "#" + delRowBtnId,
2305
- type: "click",
2306
- fn: function fn() {
2307
- _this2._delRow();
2308
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2309
- return true;
2310
- }
2311
- }, {
2312
- // 删除列
2313
- selector: "#" + delColBtnId,
2314
- type: "click",
2315
- fn: function fn() {
2316
- _this2._delCol();
2317
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2318
- return true;
2319
- }
2320
- }, {
2321
- // 删除表格
2322
- selector: "#" + delTableBtnId,
2323
- type: "click",
2324
- fn: function fn() {
2325
- _this2._delTable();
2326
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2327
- return true;
2328
- }
2329
- }]
2330
- }]
2331
- });
2332
- // 显示 panel
2333
- panel.show();
2334
- },
2335
- // 获取选中的单元格的位置信息
2336
- _getLocationData: function _getLocationData() {
2337
- var result = {};
2338
- var editor = this.editor;
2339
- var $selectionELem = editor.selection.getSelectionContainerElem();
2340
- if (!$selectionELem) {
2341
- return;
2342
- }
2343
- var nodeName = $selectionELem.getNodeName();
2344
- if (nodeName !== "TD" && nodeName !== "TH") {
2345
- return;
2346
- }
2347
-
2348
- // 获取 td index
2349
- var $tr = $selectionELem.parent();
2350
- var $tds = $tr.children();
2351
- var tdLength = $tds.length;
2352
- $tds.forEach(function (td, index) {
2353
- if (td === $selectionELem[0]) {
2354
- // 记录并跳出循环
2355
- result.td = {
2356
- index: index,
2357
- elem: td,
2358
- length: tdLength
2359
- };
2360
- return false;
2361
- }
2362
- });
2363
-
2364
- // 获取 tr index
2365
- var $tbody = $tr.parent();
2366
- var $trs = $tbody.children();
2367
- var trLength = $trs.length;
2368
- $trs.forEach(function (tr, index) {
2369
- if (tr === $tr[0]) {
2370
- // 记录并跳出循环
2371
- result.tr = {
2372
- index: index,
2373
- elem: tr,
2374
- length: trLength
2375
- };
2376
- return false;
2377
- }
2378
- });
2379
-
2380
- // 返回结果
2381
- return result;
2382
- },
2383
- // 增加行
2384
- _addRow: function _addRow() {
2385
- // 获取当前单元格的位置信息
2386
- var locationData = this._getLocationData();
2387
- if (!locationData) {
2388
- return;
2389
- }
2390
- var trData = locationData.tr;
2391
- var $currentTr = $(trData.elem);
2392
- var tdData = locationData.td;
2393
- var tdLength = tdData.length;
2394
-
2395
- // 拼接即将插入的字符串
2396
- var newTr = document.createElement("tr");
2397
- var tpl = "",
2398
- i = void 0;
2399
- for (i = 0; i < tdLength; i++) {
2400
- tpl += "<td>&nbsp;</td>";
2401
- }
2402
- newTr.innerHTML = tpl;
2403
- // 插入
2404
- $(newTr).insertAfter($currentTr);
2405
- },
2406
- // 增加列
2407
- _addCol: function _addCol() {
2408
- // 获取当前单元格的位置信息
2409
- var locationData = this._getLocationData();
2410
- if (!locationData) {
2411
- return;
2412
- }
2413
- var trData = locationData.tr;
2414
- var tdData = locationData.td;
2415
- var tdIndex = tdData.index;
2416
- var $currentTr = $(trData.elem);
2417
- var $trParent = $currentTr.parent();
2418
- var $trs = $trParent.children();
2419
-
2420
- // 遍历所有行
2421
- $trs.forEach(function (tr) {
2422
- var $tr = $(tr);
2423
- var $tds = $tr.children();
2424
- var $currentTd = $tds.get(tdIndex);
2425
- var name = $currentTd.getNodeName().toLowerCase();
2426
-
2427
- // new 一个 td,并插入
2428
- var newTd = document.createElement(name);
2429
- $(newTd).insertAfter($currentTd);
2430
- });
2431
- },
2432
- // 删除行
2433
- _delRow: function _delRow() {
2434
- // 获取当前单元格的位置信息
2435
- var locationData = this._getLocationData();
2436
- if (!locationData) {
2437
- return;
2438
- }
2439
- var trData = locationData.tr;
2440
- var $currentTr = $(trData.elem);
2441
- $currentTr.remove();
2442
- // FIXED 删除行后不触发onchange事件
2443
- this.editor.change();
2444
- },
2445
- // 删除列
2446
- _delCol: function _delCol() {
2447
- // 获取当前单元格的位置信息
2448
- var locationData = this._getLocationData();
2449
- if (!locationData) {
2450
- return;
2451
- }
2452
- var trData = locationData.tr;
2453
- var tdData = locationData.td;
2454
- var tdIndex = tdData.index;
2455
- var $currentTr = $(trData.elem);
2456
- var $trParent = $currentTr.parent();
2457
- var $trs = $trParent.children();
2458
-
2459
- // 遍历所有行
2460
- $trs.forEach(function (tr) {
2461
- var $tr = $(tr);
2462
- var $tds = $tr.children();
2463
- var $currentTd = $tds.get(tdIndex);
2464
- // 删除
2465
- $currentTd.remove();
2466
- });
2467
- },
2468
- // 删除表格
2469
- _delTable: function _delTable() {
2470
- var editor = this.editor;
2471
- var $selectionELem = editor.selection.getSelectionContainerElem();
2472
- if (!$selectionELem) {
2473
- return;
2474
- }
2475
- var $table = $selectionELem.parentUntil("table");
2476
- if (!$table) {
2477
- return;
2478
- }
2479
- $table.remove();
2480
- },
2481
- // 试图改变 active 状态
2482
- tryChangeActive: function tryChangeActive(e) {
2483
- var editor = this.editor;
2484
- var $elem = this.$elem;
2485
- var $selectionELem = editor.selection.getSelectionContainerElem();
2486
- if (!$selectionELem) {
2487
- return;
2488
- }
2489
- var nodeName = $selectionELem.getNodeName();
2490
- if (nodeName === "TD" || nodeName === "TH") {
2491
- this._active = true;
2492
- $elem.addClass("w-e-active");
2493
- } else {
2494
- this._active = false;
2495
- $elem.removeClass("w-e-active");
2496
- }
2497
- }
2498
- };
2499
-
2500
- /*
2501
- menu - video
2502
- */
2503
- // 构造函数
2504
- function Video(editor) {
2505
- this.editor = editor;
2506
- this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-play"></i></div>');
2507
- this.type = "panel";
2508
-
2509
- // 当前是否 active 状态
2510
- this._active = false;
2511
- }
2512
-
2513
- // 原型
2514
- Video.prototype = {
2515
- constructor: Video,
2516
- onClick: function onClick() {
2517
- this._createPanel();
2518
- },
2519
- _createPanel: function _createPanel() {
2520
- var _this = this;
2521
-
2522
- // 创建 id
2523
- var textValId = getRandom("text-val");
2524
- var btnId = getRandom("btn");
2525
-
2526
- // 创建 panel
2527
- var panel = new Panel(this, {
2528
- width: 350,
2529
- // 一个 panel 多个 tab
2530
- tabs: [{
2531
- // 标题
2532
- title: "插入视频",
2533
- // 模板
2534
- tpl: '<div>\n <input id="' + textValId + "\" type=\"text\" class=\"block\" placeholder=\"\u683C\u5F0F\u5982\uFF1A<iframe src=... ></iframe>\"/>\n <div class=\"w-e-button-container\">\n <button id=\"" + btnId + "\" class=\"right\">\u63D2\u5165</button>\n </div>\n </div>",
2535
- // 事件绑定
2536
- events: [{
2537
- selector: "#" + btnId,
2538
- type: "click",
2539
- fn: function fn() {
2540
- var $text = $("#" + textValId);
2541
- var val = $text.val().trim();
2542
-
2543
- // 测试用视频地址
2544
- // <iframe height=498 width=510 src='http://player.youku.com/embed/XMjcwMzc3MzM3Mg==' frameborder=0 'allowfullscreen'></iframe>
2545
-
2546
- if (val) {
2547
- // 插入视频
2548
- _this._insert(val);
2549
- }
2550
-
2551
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2552
- return true;
2553
- }
2554
- }]
2555
- } // first tab end
2556
- ] // tabs end
2557
- }); // panel end
2558
-
2559
- // 显示 panel
2560
- panel.show();
2561
- if (isRecordNewPanel) {
2562
- // 记录属性
2563
- this.panel = panel;
2564
- }
2565
- },
2566
- // 插入视频
2567
- _insert: function _insert(val) {
2568
- var editor = this.editor;
2569
- editor.cmd["do"]("insertHTML", val + "<p><br></p>");
2570
- }
2571
- };
2572
-
2573
- /*
2574
- menu - img
2575
- */
2576
- // 构造函数
2577
- function Image(editor) {
2578
- this.editor = editor;
2579
- var imgMenuId = getRandom("w-e-img");
2580
- this.$elem = $('<div class="w-e-menu" id="' + imgMenuId + '"><i class="w-e-icon-image"></i></div>');
2581
- editor.imgMenuId = imgMenuId;
2582
- this.type = "panel";
2583
-
2584
- // 当前是否 active 状态
2585
- this._active = false;
2586
- }
2587
-
2588
- // 原型
2589
- Image.prototype = {
2590
- constructor: Image,
2591
- onClick: function onClick() {
2592
- var editor = this.editor;
2593
- var config = editor.config;
2594
- if (config.qiniu) {
2595
- return;
2596
- }
2597
- if (this._active) {
2598
- this._createEditPanel();
2599
- } else {
2600
- this._createInsertPanel();
2601
- }
2602
- },
2603
- _createEditPanel: function _createEditPanel() {
2604
- var editor = this.editor;
2605
-
2606
- // id
2607
- var width30 = getRandom("width-30");
2608
- var width50 = getRandom("width-50");
2609
- var width100 = getRandom("width-100");
2610
- var delBtn = getRandom("del-btn");
2611
-
2612
- // tab 配置
2613
- var tabsConfig = [{
2614
- title: "编辑图片",
2615
- tpl: "<div>\n <div class=\"w-e-button-container\" style=\"border-bottom:1px solid #f1f1f1;padding-bottom:5px;margin-bottom:5px;\">\n <span style=\"float:left;font-size:14px;margin:4px 5px 0 5px;color:#333;\">\u6700\u5927\u5BBD\u5EA6\uFF1A</span>\n <button id=\"" + width30 + '" class="left">30%</button>\n <button id="' + width50 + '" class="left">50%</button>\n <button id="' + width100 + '" class="left">100%</button>\n </div>\n <div class="w-e-button-container">\n <button id="' + delBtn + "\" class=\"gray left\">\u5220\u9664\u56FE\u7247</button>\n </dv>\n </div>",
2616
- events: [{
2617
- selector: "#" + width30,
2618
- type: "click",
2619
- fn: function fn() {
2620
- var $img = editor._selectedImg;
2621
- if ($img) {
2622
- $img.css("max-width", "30%");
2623
- }
2624
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2625
- return true;
2626
- }
2627
- }, {
2628
- selector: "#" + width50,
2629
- type: "click",
2630
- fn: function fn() {
2631
- var $img = editor._selectedImg;
2632
- if ($img) {
2633
- $img.css("max-width", "50%");
2634
- }
2635
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2636
- return true;
2637
- }
2638
- }, {
2639
- selector: "#" + width100,
2640
- type: "click",
2641
- fn: function fn() {
2642
- var $img = editor._selectedImg;
2643
- if ($img) {
2644
- $img.css("max-width", "100%");
2645
- }
2646
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2647
- return true;
2648
- }
2649
- }, {
2650
- selector: "#" + delBtn,
2651
- type: "click",
2652
- fn: function fn() {
2653
- var $img = editor._selectedImg;
2654
- if ($img) {
2655
- $img.remove();
2656
- }
2657
- // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭
2658
- return true;
2659
- }
2660
- }]
2661
- }];
2662
-
2663
- // 创建 panel 并显示
2664
- var panel = new Panel(this, {
2665
- width: 300,
2666
- tabs: tabsConfig
2667
- });
2668
- panel.show();
2669
- if (isRecordNewPanel) {
2670
- // 记录属性
2671
- this.panel = panel;
2672
- }
2673
- },
2674
- _createInsertPanel: function _createInsertPanel() {
2675
- var editor = this.editor;
2676
- var uploadImg = editor.uploadImg;
2677
- var config = editor.config;
2678
-
2679
- // id
2680
- var upTriggerId = getRandom("up-trigger");
2681
- var upFileId = getRandom("up-file");
2682
- var linkUrlId = getRandom("link-url");
2683
- var linkBtnId = getRandom("link-btn");
2684
-
2685
- // tabs 的配置
2686
- var tabsConfig = [{
2687
- title: "上传图片",
2688
- tpl: '<div class="w-e-up-img-container">\n <div id="' + upTriggerId + '" class="w-e-up-btn">\n <i class="w-e-icon-upload2"></i>\n </div>\n <div style="display:none;">\n <input id="' + upFileId + '" type="file" multiple="multiple" accept="image/jpg,image/jpeg,image/png,image/gif,image/bmp"/>\n </div>\n </div>',
2689
- events: [{
2690
- // 触发选择图片
2691
- selector: "#" + upTriggerId,
2692
- type: "click",
2693
- fn: function fn() {
2694
- var $file = $("#" + upFileId);
2695
- var fileElem = $file[0];
2696
- if (fileElem) {
2697
- fileElem.click();
2698
- } else {
2699
- // 返回 true 可关闭 panel
2700
- return true;
2701
- }
2702
- }
2703
- }, {
2704
- // 选择图片完毕
2705
- selector: "#" + upFileId,
2706
- type: "change",
2707
- fn: function fn() {
2708
- var $file = $("#" + upFileId);
2709
- var fileElem = $file[0];
2710
- if (!fileElem) {
2711
- // 返回 true 可关闭 panel
2712
- return true;
2713
- }
2714
-
2715
- // 获取选中的 file 对象列表
2716
- var fileList = fileElem.files;
2717
- if (fileList.length) {
2718
- uploadImg.uploadImg(fileList);
2719
- }
2720
-
2721
- // 返回 true 可关闭 panel
2722
- return true;
2723
- }
2724
- }]
2725
- },
2726
- // first tab end
2727
- {
2728
- title: "网络图片",
2729
- tpl: '<div>\n <input id="' + linkUrlId + "\" type=\"text\" class=\"block\" placeholder=\"\u56FE\u7247\u94FE\u63A5\"/></td>\n <div class=\"w-e-button-container\">\n <button id=\"" + linkBtnId + "\" class=\"right\">\u63D2\u5165</button>\n </div>\n </div>",
2730
- events: [{
2731
- selector: "#" + linkBtnId,
2732
- type: "click",
2733
- fn: function fn() {
2734
- var $linkUrl = $("#" + linkUrlId);
2735
- var url = $linkUrl.val().trim();
2736
- var url = handleChangeContent($linkUrl.val().trim());
2737
- if (url) {
2738
- uploadImg.insertLinkImg(url);
2739
- }
2740
-
2741
- // 返回 true 表示函数执行结束之后关闭 panel
2742
- return true;
2743
- }
2744
- }]
2745
- } // second tab end
2746
- ]; // tabs end
2747
-
2748
- // 判断 tabs 的显示
2749
- var tabsConfigResult = [];
2750
- if ((config.uploadImgShowBase64 || config.uploadImgServer || config.customUploadImg) && window.FileReader) {
2751
- // 显示“上传图片”
2752
- tabsConfigResult.push(tabsConfig[0]);
2753
- }
2754
- if (config.showLinkImg) {
2755
- // 显示“网络图片”
2756
- tabsConfigResult.push(tabsConfig[1]);
2757
- }
2758
-
2759
- // 创建 panel 并显示
2760
- var panel = new Panel(this, {
2761
- width: 300,
2762
- tabs: tabsConfigResult
2763
- });
2764
- panel.show();
2765
- if (isRecordNewPanel) {
2766
- // 记录属性
2767
- this.panel = panel;
2768
- }
2769
- },
2770
- // 试图改变 active 状态
2771
- tryChangeActive: function tryChangeActive(e) {
2772
- var editor = this.editor;
2773
- var $elem = this.$elem;
2774
- if (editor._selectedImg) {
2775
- this._active = true;
2776
- $elem.addClass("w-e-active");
2777
- } else {
2778
- this._active = false;
2779
- $elem.removeClass("w-e-active");
2780
- }
2781
- }
2782
- };
2783
-
2784
- /*
2785
- 所有菜单的汇总
2786
- */
2787
-
2788
- // 存储菜单的构造函数
2789
- var MenuConstructors = {};
2790
- MenuConstructors.bold = Bold;
2791
- MenuConstructors.head = Head;
2792
- MenuConstructors.fontSize = FontSize;
2793
- MenuConstructors.fontName = FontName;
2794
- MenuConstructors.link = Link;
2795
- MenuConstructors.italic = Italic;
2796
- MenuConstructors.redo = Redo;
2797
- MenuConstructors.strikeThrough = StrikeThrough;
2798
- MenuConstructors.underline = Underline;
2799
- MenuConstructors.undo = Undo;
2800
- MenuConstructors.list = List;
2801
- MenuConstructors.justify = Justify;
2802
- MenuConstructors.foreColor = ForeColor;
2803
- MenuConstructors.backColor = BackColor;
2804
- MenuConstructors.quote = Quote;
2805
- MenuConstructors.code = Code;
2806
- MenuConstructors.emoticon = Emoticon;
2807
- MenuConstructors.table = Table;
2808
- MenuConstructors.video = Video;
2809
- MenuConstructors.image = Image;
2810
-
2811
- /*
2812
- 菜单集合
2813
- */
2814
- // 构造函数
2815
- function Menus(editor) {
2816
- this.editor = editor;
2817
- this.menus = {};
2818
- }
2819
-
2820
- // 修改原型
2821
- Menus.prototype = {
2822
- constructor: Menus,
2823
- // 初始化菜单
2824
- init: function init() {
2825
- var _this = this;
2826
- var editor = this.editor;
2827
- var config = editor.config || {};
2828
- var configMenus = config.menus || []; // 获取配置中的菜单
2829
-
2830
- // 根据配置信息,创建菜单
2831
- configMenus.forEach(function (menuKey) {
2832
- var MenuConstructor = MenuConstructors[menuKey];
2833
- if (MenuConstructor && typeof MenuConstructor === "function") {
2834
- // 创建单个菜单
2835
- _this.menus[menuKey] = new MenuConstructor(editor);
2836
- }
2837
- });
2838
-
2839
- // 添加到菜单栏
2840
- this._addToToolbar();
2841
-
2842
- // 绑定事件
2843
- this._bindEvent();
2844
- },
2845
- // 添加到菜单栏
2846
- _addToToolbar: function _addToToolbar() {
2847
- var editor = this.editor;
2848
- var $toolbarElem = editor.$toolbarElem;
2849
- var menus = this.menus;
2850
- var config = editor.config;
2851
- // config.zIndex 是配置的编辑区域的 z-index,菜单的 z-index 得在其基础上 +1
2852
- var zIndex = config.zIndex + 1;
2853
- objForEach(menus, function (key, menu) {
2854
- var $elem = menu.$elem;
2855
- if ($elem) {
2856
- // 设置 z-index
2857
- $elem.css("z-index", zIndex);
2858
- $toolbarElem.append($elem);
2859
- }
2860
- });
2861
- },
2862
- // 绑定菜单 click mouseenter 事件
2863
- _bindEvent: function _bindEvent() {
2864
- var menus = this.menus;
2865
- var editor = this.editor;
2866
- objForEach(menus, function (key, menu) {
2867
- var type = menu.type;
2868
- if (!type) {
2869
- return;
2870
- }
2871
- var $elem = menu.$elem;
2872
- var droplist = menu.droplist;
2873
- var panel = menu.panel;
2874
-
2875
- // 点击类型,例如 bold
2876
- if (type === "click" && menu.onClick) {
2877
- $elem.on("click", function (e) {
2878
- if (editor.selection.getRange() == null) {
2879
- return;
2880
- }
2881
- menu.onClick(e);
2882
- });
2883
- }
2884
-
2885
- // 下拉框,例如 head
2886
- if (type === "droplist" && droplist) {
2887
- $elem.on("mouseenter", function (e) {
2888
- if (editor.selection.getRange() == null) {
2889
- return;
2890
- }
2891
- // 显示
2892
- droplist.showTimeoutId = setTimeout(function () {
2893
- droplist.show();
2894
- }, 200);
2895
- }).on("mouseleave", function (e) {
2896
- // 隐藏
2897
- droplist.hideTimeoutId = setTimeout(function () {
2898
- droplist.hide();
2899
- }, 0);
2900
- });
2901
- }
2902
-
2903
- // 弹框类型,例如 link
2904
- if (type === "panel" && menu.onClick) {
2905
- $elem.on("click", function (e) {
2906
- e.stopPropagation();
2907
- if (editor.selection.getRange() == null) {
2908
- // return;
2909
- editor.initSelection();
2910
- }
2911
- // 在自定义事件中显示 panel
2912
- menu.onClick(e);
2913
- });
2914
- }
2915
- });
2916
- },
2917
- // 尝试修改菜单状态
2918
- changeActive: function changeActive() {
2919
- var menus = this.menus;
2920
- objForEach(menus, function (key, menu) {
2921
- if (menu.tryChangeActive) {
2922
- setTimeout(function () {
2923
- menu.tryChangeActive();
2924
- }, 100);
2925
- }
2926
- });
2927
- }
2928
- };
2929
-
2930
- /*
2931
- 粘贴信息的处理
2932
- */
2933
-
2934
- // 获取粘贴的纯文本
2935
- function getPasteText(e) {
2936
- var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData;
2937
- var pasteText = void 0;
2938
- if (clipboardData == null) {
2939
- pasteText = window.clipboardData && window.clipboardData.getData("text");
2940
- } else {
2941
- pasteText = clipboardData.getData("text/plain");
2942
- }
2943
- return replaceHtmlSymbol(pasteText);
2944
- }
2945
-
2946
- // 获取粘贴的html
2947
- function getPasteHtml(e, filterStyle, ignoreImg) {
2948
- var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData;
2949
- var pasteText = void 0,
2950
- pasteHtml = void 0;
2951
- if (clipboardData == null) {
2952
- pasteText = window.clipboardData && window.clipboardData.getData("text");
2953
- } else {
2954
- pasteText = clipboardData.getData("text/plain");
2955
- pasteHtml = clipboardData.getData("text/html");
2956
- }
2957
- if (!pasteHtml && pasteText) {
2958
- pasteHtml = "<p>" + replaceHtmlSymbol(pasteText) + "</p>";
2959
- }
2960
- if (!pasteHtml) {
2961
- return;
2962
- }
2963
-
2964
- // 过滤word中状态过来的无用字符
2965
- var docSplitHtml = pasteHtml.split("</html>");
2966
- if (docSplitHtml.length === 2) {
2967
- pasteHtml = docSplitHtml[0];
2968
- }
2969
-
2970
- // 过滤无用标签
2971
- pasteHtml = pasteHtml.replace(/<(meta|script|link).+?>/gim, "");
2972
- // 去掉注释
2973
- pasteHtml = pasteHtml.replace(/<!--.*?-->/gm, "");
2974
- // 过滤 data-xxx 属性
2975
- pasteHtml = pasteHtml.replace(/\s?data-.+?=('|").+?('|")/gim, "");
2976
- if (ignoreImg) {
2977
- // 忽略图片
2978
- pasteHtml = pasteHtml.replace(/<img.+?>/gim, "");
2979
- }
2980
- if (filterStyle) {
2981
- // 过滤样式
2982
- pasteHtml = pasteHtml.replace(/\s?(class|style)=('|").*?('|")/gim, "");
2983
- } else {
2984
- // 保留样式
2985
- pasteHtml = pasteHtml.replace(/\s?class=('|").*?('|")/gim, "");
2986
- }
2987
- return pasteHtml;
2988
- }
2989
-
2990
- // 获取粘贴的图片文件
2991
- function getPasteImgs(e) {
2992
- var result = [];
2993
- var txt = getPasteText(e);
2994
- if (txt) {
2995
- // 有文字,就忽略图片
2996
- return result;
2997
- }
2998
- var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData || {};
2999
- var items = clipboardData.items;
3000
- if (!items) {
3001
- return result;
3002
- }
3003
- objForEach(items, function (key, value) {
3004
- var type = value.type;
3005
- if (/image/i.test(type)) {
3006
- result.push(value.getAsFile());
3007
- }
3008
- });
3009
- return result;
3010
- }
3011
-
3012
- /*
3013
- 编辑区域
3014
- */
3015
-
3016
- // 获取一个 elem.childNodes 的 JSON 数据
3017
- function getChildrenJSON($elem) {
3018
- var result = [];
3019
- var $children = $elem.childNodes() || []; // 注意 childNodes() 可以获取文本节点
3020
- $children.forEach(function (curElem) {
3021
- var elemResult = void 0;
3022
- var nodeType = curElem.nodeType;
3023
-
3024
- // 文本节点
3025
- if (nodeType === 3) {
3026
- elemResult = curElem.textContent;
3027
- elemResult = replaceHtmlSymbol(elemResult);
3028
- }
3029
-
3030
- // 普通 DOM 节点
3031
- if (nodeType === 1) {
3032
- elemResult = {};
3033
-
3034
- // tag
3035
- elemResult.tag = curElem.nodeName.toLowerCase();
3036
- // attr
3037
- var attrData = [];
3038
- var attrList = curElem.attributes || {};
3039
- var attrListLength = attrList.length || 0;
3040
- for (var i = 0; i < attrListLength; i++) {
3041
- var attr = attrList[i];
3042
- attrData.push({
3043
- name: attr.name,
3044
- value: attr.value
3045
- });
3046
- }
3047
- elemResult.attrs = attrData;
3048
- // children(递归)
3049
- elemResult.children = getChildrenJSON($(curElem));
3050
- }
3051
- result.push(elemResult);
3052
- });
3053
- return result;
3054
- }
3055
-
3056
- // 构造函数
3057
- function Text(editor) {
3058
- this.editor = editor;
3059
- }
3060
-
3061
- // 修改原型
3062
- Text.prototype = {
3063
- constructor: Text,
3064
- // 初始化
3065
- init: function init() {
3066
- // 绑定事件
3067
- this._bindEvent();
3068
- },
3069
- // 清空内容
3070
- clear: function clear() {
3071
- this.html("<p><br></p>");
3072
- this.editor.updateClassName();
3073
- },
3074
- // 获取 设置 html
3075
- html: function html(val, isControl) {
3076
- var editor = this.editor;
3077
- var $textElem = editor.$textElem;
3078
- var html = void 0;
3079
- if (val == null) {
3080
- html = $textElem.html();
3081
- // 未选中任何内容的时候点击“加粗”或者“斜体”等按钮,就得需要一个空的占位符 &#8203 ,这里替换掉
3082
- html = html.replace(/\u200b/gm, "");
3083
- return html;
3084
- } else {
3085
- // FIXED: 受控模式光标总是被初始化到最后
3086
- if (!this.editor.isFocus && isControl) {
3087
- // FIXED 选中删除后不触发onchange (原因:受控模式下,beforeChangeHtml初始化时候不准确)
3088
- this.editor.beforeChangeHtml = val;
3089
- $textElem.html(val);
3090
- }
3091
-
3092
- // 初始化选取,将光标定位到内容尾部
3093
- if (!isControl) {
3094
- // FIXED: 受控模式光标总是被初始化到最后
3095
- editor.initSelection();
3096
- }
3097
- }
3098
- this.editor.updateClassName();
3099
- },
3100
- // 获取 JSON
3101
- getJSON: function getJSON() {
3102
- var editor = this.editor;
3103
- var $textElem = editor.$textElem;
3104
- return getChildrenJSON($textElem);
3105
- },
3106
- // 获取 设置 text
3107
- text: function text(val) {
3108
- var editor = this.editor;
3109
- var $textElem = editor.$textElem;
3110
- var text = void 0;
3111
- if (val == null) {
3112
- text = $textElem.text();
3113
- // 未选中任何内容的时候点击“加粗”或者“斜体”等按钮,就得需要一个空的占位符 &#8203 ,这里替换掉
3114
- text = text.replace(/\u200b/gm, "");
3115
- return text;
3116
- } else {
3117
- $textElem.text("<p>" + val + "</p>");
3118
-
3119
- // 初始化选取,将光标定位到内容尾部
3120
- editor.initSelection();
3121
- }
3122
- this.editor.updateClassName();
3123
- },
3124
- // 追加内容
3125
- append: function append(html) {
3126
- var editor = this.editor;
3127
- var $textElem = editor.$textElem;
3128
- $textElem.append($(html));
3129
-
3130
- // 初始化选取,将光标定位到内容尾部
3131
- editor.initSelection();
3132
- this.editor.updateClassName();
3133
- },
3134
- // 绑定事件
3135
- _bindEvent: function _bindEvent() {
3136
- // 实时保存选取
3137
- this._saveRangeRealTime();
3138
-
3139
- // 按回车建时的特殊处理
3140
- this._enterKeyHandle();
3141
-
3142
- // 清空时保留 <p><br></p>
3143
- this._clearHandle();
3144
-
3145
- // 粘贴事件(粘贴文字,粘贴图片)
3146
- this._pasteHandle();
3147
-
3148
- // tab 特殊处理
3149
- this._tabHandle();
3150
-
3151
- // img 点击
3152
- this._imgHandle();
3153
-
3154
- // 拖拽事件
3155
- this._dragHandle();
3156
- },
3157
- // 实时保存选取
3158
- _saveRangeRealTime: function _saveRangeRealTime() {
3159
- var editor = this.editor;
3160
- var $textElem = editor.$textElem;
3161
-
3162
- // 保存当前的选区
3163
- function saveRange(e) {
3164
- // 随时保存选区
3165
- editor.selection.saveRange();
3166
- // 更新按钮 ative 状态
3167
- editor.menus.changeActive();
3168
- }
3169
- // 按键后保存
3170
- $textElem.on("keyup", saveRange);
3171
- $textElem.on("mousedown", function (e) {
3172
- // mousedown 状态下,鼠标滑动到编辑区域外面,也需要保存选区
3173
- $textElem.on("mouseleave", saveRange);
3174
- });
3175
- $textElem.on("mouseup", function (e) {
3176
- saveRange();
3177
- // 在编辑器区域之内完成点击,取消鼠标滑动到编辑区外面的事件
3178
- $textElem.off("mouseleave", saveRange);
3179
- });
3180
- },
3181
- // 按回车键时的特殊处理
3182
- _enterKeyHandle: function _enterKeyHandle() {
3183
- var editor = this.editor;
3184
- var $textElem = editor.$textElem;
3185
- function insertEmptyP($selectionElem) {
3186
- var $p = $("<p><br></p>");
3187
- $p.insertBefore($selectionElem);
3188
- editor.selection.createRangeByElem($p, true);
3189
- editor.selection.restoreSelection();
3190
- $selectionElem.remove();
3191
- }
3192
-
3193
- // 将回车之后生成的非 <p> 的顶级标签,改为 <p>
3194
- function pHandle(e) {
3195
- var $selectionElem = editor.selection.getSelectionContainerElem();
3196
- var $parentElem = $selectionElem.parent();
3197
- if ($parentElem.html() === "<code><br></code>") {
3198
- // 回车之前光标所在一个 <p><code>.....</code></p> ,忽然回车生成一个空的 <p><code><br></code></p>
3199
- // 而且继续回车跳不出去,因此只能特殊处理
3200
- insertEmptyP($selectionElem);
3201
- return;
3202
- }
3203
- if (!$parentElem.equal($textElem)) {
3204
- // 不是顶级标签
3205
- return;
3206
- }
3207
- var nodeName = $selectionElem.getNodeName();
3208
- if (nodeName === "P") {
3209
- // 当前的标签是 P ,不用做处理
3210
- return;
3211
- }
3212
- if ($selectionElem.text()) {
3213
- // 有内容,不做处理
3214
- return;
3215
- }
3216
-
3217
- // 插入 <p> ,并将选取定位到 <p>,删除当前标签
3218
- insertEmptyP($selectionElem);
3219
- }
3220
- $textElem.on("keyup", function (e) {
3221
- if (e.keyCode !== 13) {
3222
- // 不是回车键
3223
- return;
3224
- }
3225
- // 将回车之后生成的非 <p> 的顶级标签,改为 <p>
3226
- pHandle(e);
3227
- });
3228
-
3229
- // <pre><code></code></pre> 回车时 特殊处理
3230
- function codeHandle(e) {
3231
- var $selectionElem = editor.selection.getSelectionContainerElem();
3232
- if (!$selectionElem) {
3233
- return;
3234
- }
3235
- var $parentElem = $selectionElem.parent();
3236
- var selectionNodeName = $selectionElem.getNodeName();
3237
- var parentNodeName = $parentElem.getNodeName();
3238
- if (selectionNodeName !== "CODE" || parentNodeName !== "PRE") {
3239
- // 不符合要求 忽略
3240
- return;
3241
- }
3242
- if (!editor.cmd.queryCommandSupported("insertHTML")) {
3243
- // 必须原生支持 insertHTML 命令
3244
- return;
3245
- }
3246
-
3247
- // 处理:光标定位到代码末尾,联系点击两次回车,即跳出代码块
3248
- if (editor._willBreakCode === true) {
3249
- // 此时可以跳出代码块
3250
- // 插入 <p> ,并将选取定位到 <p>
3251
- var $p = $("<p><br></p>");
3252
- $p.insertAfter($parentElem);
3253
- editor.selection.createRangeByElem($p, true);
3254
- editor.selection.restoreSelection();
3255
-
3256
- // 修改状态
3257
- editor._willBreakCode = false;
3258
- e.preventDefault();
3259
- return;
3260
- }
3261
- var _startOffset = editor.selection.getRange().startOffset;
3262
-
3263
- // 处理:回车时,不能插入 <br> 而是插入 \n ,因为是在 pre 标签里面
3264
- editor.cmd["do"]("insertHTML", "\n");
3265
- editor.selection.saveRange();
3266
- if (editor.selection.getRange().startOffset === _startOffset) {
3267
- // 没起作用,再来一遍
3268
- editor.cmd["do"]("insertHTML", "\n");
3269
- }
3270
- var codeLength = $selectionElem.html().length;
3271
- if (editor.selection.getRange().startOffset + 1 === codeLength) {
3272
- // 说明光标在代码最后的位置,执行了回车操作
3273
- // 记录下来,以便下次回车时候跳出 code
3274
- editor._willBreakCode = true;
3275
- }
3276
-
3277
- // 阻止默认行为
3278
- e.preventDefault();
3279
- }
3280
- $textElem.on("keydown", function (e) {
3281
- // FIXED 通过选中内容点击删除达到的聚焦效果不触发聚焦事件
3282
- if (e.keyCode === 8 && !editor.isFocus) {
3283
- editor.isFocus = true;
3284
- editor.onfocus();
3285
- }
3286
- if (e.keyCode !== 13) {
3287
- // 不是回车键
3288
- // 取消即将跳转代码块的记录
3289
- editor._willBreakCode = false;
3290
- return;
3291
- }
3292
- // <pre><code></code></pre> 回车时 特殊处理
3293
- codeHandle(e);
3294
- });
3295
- },
3296
- // 清空时保留 <p><br></p>
3297
- _clearHandle: function _clearHandle() {
3298
- var editor = this.editor;
3299
- var $textElem = editor.$textElem;
3300
- $textElem.on("keydown", function (e) {
3301
- if (e.keyCode !== 8) {
3302
- return;
3303
- }
3304
- var txtHtml = $textElem.html().toLowerCase().trim();
3305
- if (txtHtml === "<p><br></p>") {
3306
- // 最后剩下一个空行,就不再删除了
3307
- e.preventDefault();
3308
- return;
3309
- }
3310
- });
3311
- $textElem.on("keyup", function (e) {
3312
- if (e.keyCode !== 8) {
3313
- return;
3314
- }
3315
- var $p = void 0;
3316
- var txtHtml = $textElem.html().toLowerCase().trim();
3317
-
3318
- // firefox 时用 txtHtml === '<br>' 判断,其他用 !txtHtml 判断
3319
- if (!txtHtml || txtHtml === "<br>") {
3320
- // 内容空了
3321
- $p = $("<p><br/></p>");
3322
- $textElem.html(""); // 一定要先清空,否则在 firefox 下有问题
3323
- $textElem.append($p);
3324
- editor.selection.createRangeByElem($p, false, true);
3325
- editor.selection.restoreSelection();
3326
- }
3327
- });
3328
- },
3329
- // 粘贴事件(粘贴文字 粘贴图片)
3330
- _pasteHandle: function _pasteHandle() {
3331
- var editor = this.editor;
3332
- var config = editor.config;
3333
- var pasteFilterStyle = config.pasteFilterStyle;
3334
- var pasteTextHandle = config.pasteTextHandle;
3335
- var ignoreImg = config.pasteIgnoreImg;
3336
- var $textElem = editor.$textElem;
3337
-
3338
- // 粘贴图片、文本的事件,每次只能执行一个
3339
- // 判断该次粘贴事件是否可以执行
3340
- var pasteTime = 0;
3341
- function canDo() {
3342
- var now = Date.now();
3343
- var flag = false;
3344
- if (now - pasteTime >= 100) {
3345
- // 间隔大于 100 ms ,可以执行
3346
- flag = true;
3347
- }
3348
- pasteTime = now;
3349
- return flag;
3350
- }
3351
- function resetTime() {
3352
- pasteTime = 0;
3353
- }
3354
-
3355
- // 粘贴文字
3356
- $textElem.on("paste", function (e) {
3357
- if (UA.isIE()) {
3358
- return;
3359
- } else {
3360
- // 阻止默认行为,使用 execCommand 的粘贴命令
3361
- e.preventDefault();
3362
- }
3363
-
3364
- // 粘贴图片和文本,只能同时使用一个
3365
- if (!canDo()) {
3366
- return;
3367
- }
3368
-
3369
- // 获取粘贴的文字
3370
- var pasteHtml = getPasteHtml(e, pasteFilterStyle, ignoreImg);
3371
- var pasteText = getPasteText(e);
3372
- pasteText = pasteText.replace(/\n/gm, "<br>");
3373
- var $selectionElem = editor.selection.getSelectionContainerElem();
3374
- if (!$selectionElem) {
3375
- return;
3376
- }
3377
- var nodeName = $selectionElem.getNodeName();
3378
-
3379
- // code 中只能粘贴纯文本
3380
- if (nodeName === "CODE" || nodeName === "PRE") {
3381
- if (pasteTextHandle && isFunction(pasteTextHandle)) {
3382
- // 用户自定义过滤处理粘贴内容
3383
- pasteText = "" + (pasteTextHandle(pasteText) || "");
3384
- }
3385
- editor.cmd["do"]("insertHTML", "<p>" + pasteText + "</p>");
3386
- return;
3387
- }
3388
-
3389
- // 先放开注释,有问题再追查 ————
3390
- // // 表格中忽略,可能会出现异常问题
3391
- // if (nodeName === 'TD' || nodeName === 'TH') {
3392
- // return
3393
- // }
3394
-
3395
- if (!pasteHtml) {
3396
- // 没有内容,可继续执行下面的图片粘贴
3397
- resetTime();
3398
- return;
3399
- }
3400
- try {
3401
- // firefox 中,获取的 pasteHtml 可能是没有 <ul> 包裹的 <li>
3402
- // 因此执行 insertHTML 会报错
3403
- if (pasteTextHandle && isFunction(pasteTextHandle)) {
3404
- // 用户自定义过滤处理粘贴内容
3405
- pasteHtml = "" + (pasteTextHandle(pasteHtml) || "");
3406
- }
3407
- editor.cmd["do"]("insertHTML", pasteHtml);
3408
- } catch (ex) {
3409
- // 此时使用 pasteText 来兼容一下
3410
- if (pasteTextHandle && isFunction(pasteTextHandle)) {
3411
- // 用户自定义过滤处理粘贴内容
3412
- pasteText = "" + (pasteTextHandle(pasteText) || "");
3413
- }
3414
- editor.cmd["do"]("insertHTML", "<p>" + pasteText + "</p>");
3415
- }
3416
- });
3417
-
3418
- // 粘贴图片
3419
- $textElem.on("paste", function (e) {
3420
- if (UA.isIE()) {
3421
- return;
3422
- } else {
3423
- e.preventDefault();
3424
- }
3425
-
3426
- // 粘贴图片和文本,只能同时使用一个
3427
- if (!canDo()) {
3428
- return;
3429
- }
3430
-
3431
- // 获取粘贴的图片
3432
- var pasteFiles = getPasteImgs(e);
3433
- if (!pasteFiles || !pasteFiles.length) {
3434
- return;
3435
- }
3436
-
3437
- // 获取当前的元素
3438
- var $selectionElem = editor.selection.getSelectionContainerElem();
3439
- if (!$selectionElem) {
3440
- return;
3441
- }
3442
- var nodeName = $selectionElem.getNodeName();
3443
-
3444
- // code 中粘贴忽略
3445
- if (nodeName === "CODE" || nodeName === "PRE") {
3446
- return;
3447
- }
3448
-
3449
- // 上传图片
3450
- var uploadImg = editor.uploadImg;
3451
- uploadImg.uploadImg(pasteFiles);
3452
- });
3453
- },
3454
- // tab 特殊处理
3455
- _tabHandle: function _tabHandle() {
3456
- var editor = this.editor;
3457
- var $textElem = editor.$textElem;
3458
- $textElem.on("keydown", function (e) {
3459
- if (e.keyCode !== 9) {
3460
- return;
3461
- }
3462
- if (!editor.cmd.queryCommandSupported("insertHTML")) {
3463
- // 必须原生支持 insertHTML 命令
3464
- return;
3465
- }
3466
- var $selectionElem = editor.selection.getSelectionContainerElem();
3467
- if (!$selectionElem) {
3468
- return;
3469
- }
3470
- var $parentElem = $selectionElem.parent();
3471
- var selectionNodeName = $selectionElem.getNodeName();
3472
- var parentNodeName = $parentElem.getNodeName();
3473
- if (selectionNodeName === "CODE" && parentNodeName === "PRE") {
3474
- // <pre><code> 里面
3475
- editor.cmd["do"]("insertHTML", " ");
3476
- } else {
3477
- // 普通文字
3478
- editor.cmd["do"]("insertHTML", "&nbsp;&nbsp;&nbsp;&nbsp;");
3479
- }
3480
- e.preventDefault();
3481
- });
3482
- },
3483
- // img 点击
3484
- _imgHandle: function _imgHandle() {
3485
- var editor = this.editor;
3486
- var $textElem = editor.$textElem;
3487
-
3488
- // 为图片增加 selected 样式
3489
- $textElem.on("click", "img", function (e) {
3490
- var img = this;
3491
- var $img = $(img);
3492
- if ($img.attr("data-w-e") === "1") {
3493
- // 是表情图片,忽略
3494
- return;
3495
- }
3496
-
3497
- // 记录当前点击过的图片
3498
- editor._selectedImg = $img;
3499
-
3500
- // 修改选区并 restore ,防止用户此时点击退格键,会删除其他内容
3501
- editor.selection.createRangeByElem($img);
3502
- editor.selection.restoreSelection();
3503
- });
3504
-
3505
- // 去掉图片的 selected 样式
3506
- $textElem.on("click keyup", function (e) {
3507
- if (e.target.matches("img")) {
3508
- // 点击的是图片,忽略
3509
- return;
3510
- }
3511
- // 删除记录
3512
- editor._selectedImg = null;
3513
- });
3514
- },
3515
- // 拖拽事件
3516
- _dragHandle: function _dragHandle() {
3517
- var editor = this.editor;
3518
-
3519
- // 禁用 document 拖拽事件
3520
- var $document = $(document);
3521
- $document.on("dragleave drop dragenter dragover", function (e) {
3522
- e.preventDefault();
3523
- });
3524
-
3525
- // 添加编辑区域拖拽事件
3526
- var $textElem = editor.$textElem;
3527
- $textElem.on("drop", function (e) {
3528
- e.preventDefault();
3529
- var files = e.dataTransfer && e.dataTransfer.files;
3530
- if (!files || !files.length) {
3531
- return;
3532
- }
3533
-
3534
- // 上传图片
3535
- var uploadImg = editor.uploadImg;
3536
- uploadImg.uploadImg(files);
3537
- });
3538
- }
3539
- };
3540
-
3541
- /*
3542
- 命令,封装 document.execCommand
3543
- */
3544
-
3545
- // 构造函数
3546
- function Command(editor) {
3547
- this.editor = editor;
3548
- }
3549
-
3550
- // 修改原型
3551
- Command.prototype = {
3552
- constructor: Command,
3553
- // 执行命令
3554
- "do": function _do(name, value) {
3555
- var editor = this.editor;
3556
-
3557
- // 使用 styleWithCSS
3558
- if (!editor._useStyleWithCSS) {
3559
- document.execCommand("styleWithCSS", null, true);
3560
- editor._useStyleWithCSS = true;
3561
- }
3562
-
3563
- // 如果无选区,忽略
3564
- if (!editor.selection.getRange()) {
3565
- return;
3566
- }
3567
-
3568
- // 恢复选取
3569
- editor.selection.restoreSelection();
3570
-
3571
- // 执行
3572
- var _name = "_" + name;
3573
- if (this[_name]) {
3574
- // 有自定义事件
3575
- this[_name](value);
3576
- } else {
3577
- // 默认 command
3578
- this._execCommand(name, value);
3579
- }
3580
-
3581
- // 修改菜单状态
3582
- editor.menus.changeActive();
3583
-
3584
- // 最后,恢复选取保证光标在原来的位置闪烁
3585
- editor.selection.saveRange();
3586
- editor.selection.restoreSelection();
3587
-
3588
- // FIXED: 受控模式光标总是被初始化到最后
3589
- editor.isFocus = true; // 更新聚焦状态
3590
-
3591
- // 触发 onchange
3592
- editor.change && editor.change();
3593
- },
3594
- // 自定义 insertHTML 事件
3595
- _insertHTML: function _insertHTML(html) {
3596
- var editor = this.editor;
3597
- var range = editor.selection.getRange();
3598
- if (this.queryCommandSupported("insertHTML")) {
3599
- // W3C
3600
- this._execCommand("insertHTML", html);
3601
- } else if (range.insertNode) {
3602
- // IE
3603
- range.deleteContents();
3604
- range.insertNode($(html)[0]);
3605
- } else if (range.pasteHTML) {
3606
- // IE <= 10
3607
- range.pasteHTML(html);
3608
- }
3609
- },
3610
- // 插入 elem
3611
- _insertElem: function _insertElem($elem) {
3612
- var editor = this.editor;
3613
- var range = editor.selection.getRange();
3614
- if (range.insertNode) {
3615
- range.deleteContents();
3616
- range.insertNode($elem[0]);
3617
- }
3618
- },
3619
- // 封装 execCommand
3620
- _execCommand: function _execCommand(name, value) {
3621
- document.execCommand(name, false, value);
3622
- },
3623
- // 封装 document.queryCommandValue
3624
- queryCommandValue: function queryCommandValue(name) {
3625
- return document.queryCommandValue(name);
3626
- },
3627
- // 封装 document.queryCommandState
3628
- queryCommandState: function queryCommandState(name) {
3629
- return document.queryCommandState(name);
3630
- },
3631
- // 封装 document.queryCommandSupported
3632
- queryCommandSupported: function queryCommandSupported(name) {
3633
- return document.queryCommandSupported(name);
3634
- }
3635
- };
3636
-
3637
- /*
3638
- selection range API
3639
- */
3640
-
3641
- // 构造函数
3642
- function API(editor) {
3643
- this.editor = editor;
3644
- this._currentRange = null;
3645
- }
3646
-
3647
- // 修改原型
3648
- API.prototype = {
3649
- constructor: API,
3650
- // 获取 range 对象
3651
- getRange: function getRange() {
3652
- return this._currentRange;
3653
- },
3654
- // 保存选区
3655
- saveRange: function saveRange(_range) {
3656
- if (_range) {
3657
- // 保存已有选区
3658
- this._currentRange = _range;
3659
- return;
3660
- }
3661
-
3662
- // 获取当前的选区
3663
- var selection = window.getSelection();
3664
- if (selection.rangeCount === 0) {
3665
- return;
3666
- }
3667
- var range = selection.getRangeAt(0);
3668
-
3669
- // 判断选区内容是否在编辑内容之内
3670
- var $containerElem = this.getSelectionContainerElem(range);
3671
- if (!$containerElem) {
3672
- return;
3673
- }
3674
-
3675
- // 判断选区内容是否在不可编辑区域之内
3676
- if ($containerElem.attr("contenteditable") === "false" || $containerElem.parentUntil("[contenteditable=false]")) {
3677
- return;
3678
- }
3679
- var editor = this.editor;
3680
- var $textElem = editor.$textElem;
3681
- if ($textElem.isContain($containerElem)) {
3682
- // 是编辑内容之内的
3683
- this._currentRange = range;
3684
- }
3685
- },
3686
- // 折叠选区
3687
- collapseRange: function collapseRange(toStart) {
3688
- if (toStart == null) {
3689
- // 默认为 false
3690
- toStart = false;
3691
- }
3692
- var range = this._currentRange;
3693
- if (range) {
3694
- range.collapse(toStart);
3695
- }
3696
- },
3697
- // 选中区域的文字
3698
- getSelectionText: function getSelectionText() {
3699
- var range = this._currentRange;
3700
- if (range) {
3701
- return this._currentRange.toString();
3702
- } else {
3703
- return "";
3704
- }
3705
- },
3706
- // 选区的 $Elem
3707
- getSelectionContainerElem: function getSelectionContainerElem(range) {
3708
- range = range || this._currentRange;
3709
- var elem = void 0;
3710
- if (range) {
3711
- elem = range.commonAncestorContainer;
3712
- return $(elem.nodeType === 1 ? elem : elem.parentNode);
3713
- }
3714
- },
3715
- getSelectionStartElem: function getSelectionStartElem(range) {
3716
- range = range || this._currentRange;
3717
- var elem = void 0;
3718
- if (range) {
3719
- elem = range.startContainer;
3720
- return $(elem.nodeType === 1 ? elem : elem.parentNode);
3721
- }
3722
- },
3723
- getSelectionEndElem: function getSelectionEndElem(range) {
3724
- range = range || this._currentRange;
3725
- var elem = void 0;
3726
- if (range) {
3727
- elem = range.endContainer;
3728
- return $(elem.nodeType === 1 ? elem : elem.parentNode);
3729
- }
3730
- },
3731
- // 选区是否为空
3732
- isSelectionEmpty: function isSelectionEmpty() {
3733
- var range = this._currentRange;
3734
- if (range && range.startContainer) {
3735
- if (range.startContainer === range.endContainer) {
3736
- if (range.startOffset === range.endOffset) {
3737
- return true;
3738
- }
3739
- }
3740
- }
3741
- return false;
3742
- },
3743
- // 恢复选区
3744
- restoreSelection: function restoreSelection() {
3745
- var selection = window.getSelection();
3746
- selection.removeAllRanges();
3747
- selection.addRange(this._currentRange);
3748
- },
3749
- // 创建一个空白(即 &#8203 字符)选区
3750
- createEmptyRange: function createEmptyRange() {
3751
- var editor = this.editor;
3752
- var range = this.getRange();
3753
- var $elem = void 0;
3754
- if (!range) {
3755
- // 当前无 range
3756
- return;
3757
- }
3758
- if (!this.isSelectionEmpty()) {
3759
- // 当前选区必须没有内容才可以
3760
- return;
3761
- }
3762
- try {
3763
- // 目前只支持 webkit 内核
3764
- if (UA.isWebkit()) {
3765
- // 插入 &#8203
3766
- editor.cmd["do"]("insertHTML", "&#8203;");
3767
- // 修改 offset 位置
3768
- range.setEnd(range.endContainer, range.endOffset + 1);
3769
- // 存储
3770
- this.saveRange(range);
3771
- } else {
3772
- $elem = $("<strong>&#8203;</strong>");
3773
- editor.cmd["do"]("insertElem", $elem);
3774
- this.createRangeByElem($elem, true);
3775
- }
3776
- } catch (ex) {
3777
- // 部分情况下会报错,兼容一下
3778
- }
3779
- },
3780
- // 根据 $Elem 设置选区
3781
- createRangeByElem: function createRangeByElem($elem, toStart, isContent) {
3782
- // $elem - 经过封装的 elem
3783
- // toStart - true 开始位置,false 结束位置
3784
- // isContent - 是否选中Elem的内容
3785
- if (!$elem.length) {
3786
- return;
3787
- }
3788
- var elem = $elem[0];
3789
- var range = document.createRange();
3790
- if (isContent) {
3791
- range.selectNodeContents(elem);
3792
- } else {
3793
- range.selectNode(elem);
3794
- }
3795
- if (typeof toStart === "boolean") {
3796
- range.collapse(toStart);
3797
- }
3798
-
3799
- // 存储 range
3800
- this.saveRange(range);
3801
- }
3802
- };
3803
-
3804
- /*
3805
- 上传进度条
3806
- */
3807
-
3808
- function Progress(editor) {
3809
- this.editor = editor;
3810
- this._time = 0;
3811
- this._isShow = false;
3812
- this._isRender = false;
3813
- this._timeoutId = 0;
3814
- this.$textContainer = editor.$textContainerElem;
3815
- this.$bar = $('<div class="w-e-progress"></div>');
3816
- }
3817
- Progress.prototype = {
3818
- constructor: Progress,
3819
- show: function show(progress) {
3820
- var _this = this;
3821
-
3822
- // 状态处理
3823
- if (this._isShow) {
3824
- return;
3825
- }
3826
- this._isShow = true;
3827
-
3828
- // 渲染
3829
- var $bar = this.$bar;
3830
- if (!this._isRender) {
3831
- var $textContainer = this.$textContainer;
3832
- $textContainer.append($bar);
3833
- } else {
3834
- this._isRender = true;
3835
- }
3836
-
3837
- // 改变进度(节流,100ms 渲染一次)
3838
- if (Date.now() - this._time > 100) {
3839
- if (progress <= 1) {
3840
- $bar.css("width", progress * 100 + "%");
3841
- this._time = Date.now();
3842
- }
3843
- }
3844
-
3845
- // 隐藏
3846
- var timeoutId = this._timeoutId;
3847
- if (timeoutId) {
3848
- clearTimeout(timeoutId);
3849
- }
3850
- timeoutId = setTimeout(function () {
3851
- _this._hide();
3852
- }, 500);
3853
- },
3854
- _hide: function _hide() {
3855
- var $bar = this.$bar;
3856
- $bar.remove();
3857
-
3858
- // 修改状态
3859
- this._time = 0;
3860
- this._isShow = false;
3861
- this._isRender = false;
3862
- }
3863
- };
3864
- var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
3865
- return _typeof2(obj);
3866
- } : function (obj) {
3867
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
3868
- };
3869
-
3870
- /*
3871
- 上传图片
3872
- */
3873
-
3874
- // 构造函数
3875
- function UploadImg(editor) {
3876
- this.editor = editor;
3877
- }
3878
-
3879
- // 原型
3880
- UploadImg.prototype = {
3881
- constructor: UploadImg,
3882
- // 根据 debug 弹出不同的信息
3883
- _alert: function _alert(alertInfo, debugInfo) {
3884
- var editor = this.editor;
3885
- var debug = editor.config.debug;
3886
- var customAlert = editor.config.customAlert;
3887
- if (debug) {
3888
- throw new Error("wangEditor: " + (debugInfo || alertInfo));
3889
- } else {
3890
- if (customAlert && typeof customAlert === "function") {
3891
- customAlert(alertInfo);
3892
- } else {
3893
- alert(alertInfo);
3894
- }
3895
- }
3896
- },
3897
- // 根据链接插入图片
3898
- insertLinkImg: function insertLinkImg(link) {
3899
- var _this2 = this;
3900
- if (!link) {
3901
- return;
3902
- }
3903
- var editor = this.editor;
3904
- var config = editor.config;
3905
-
3906
- // 校验格式
3907
- var linkImgCheck = config.linkImgCheck;
3908
- var checkResult = void 0;
3909
- if (linkImgCheck && typeof linkImgCheck === "function") {
3910
- checkResult = linkImgCheck(link);
3911
- if (typeof checkResult === "string") {
3912
- // 校验失败,提示信息
3913
- alert(checkResult);
3914
- return;
3915
- }
3916
- }
3917
- editor.cmd["do"]("insertHTML", '<img src="' + handleChangeContent(link) + '" style="max-width:100%;"/>');
3918
-
3919
- // 验证图片 url 是否有效,无效的话给出提示
3920
- var img = document.createElement("img");
3921
- img.onload = function () {
3922
- var callback = config.linkImgCallback;
3923
- if (callback && typeof callback === "function") {
3924
- callback(link);
3925
- }
3926
- img = null;
3927
- };
3928
- img.onerror = function () {
3929
- img = null;
3930
- // 无法成功下载图片
3931
- _this2._alert("插入图片错误", "wangEditor: \u63D2\u5165\u56FE\u7247\u51FA\u9519\uFF0C\u56FE\u7247\u94FE\u63A5\u662F \"" + link + "\"\uFF0C\u4E0B\u8F7D\u8BE5\u94FE\u63A5\u5931\u8D25");
3932
- return;
3933
- };
3934
- img.onabort = function () {
3935
- img = null;
3936
- };
3937
- img.src = link;
3938
- },
3939
- // 上传图片
3940
- uploadImg: function uploadImg(files) {
3941
- var _this3 = this;
3942
- if (!files || !files.length) {
3943
- return;
3944
- }
3945
-
3946
- // ------------------------------ 获取配置信息 ------------------------------
3947
- var editor = this.editor;
3948
- var config = editor.config;
3949
- var uploadImgServer = config.uploadImgServer;
3950
- var uploadImgShowBase64 = config.uploadImgShowBase64;
3951
- var maxSize = config.uploadImgMaxSize;
3952
- var maxSizeM = maxSize / 1024 / 1024;
3953
- var maxLength = config.uploadImgMaxLength || 10000;
3954
- var uploadFileName = config.uploadFileName || "";
3955
- var uploadImgParams = config.uploadImgParams || {};
3956
- var uploadImgParamsWithUrl = config.uploadImgParamsWithUrl;
3957
- var uploadImgHeaders = config.uploadImgHeaders || {};
3958
- var hooks = config.uploadImgHooks || {};
3959
- var timeout = config.uploadImgTimeout || 3000;
3960
- var withCredentials = config.withCredentials;
3961
- if (withCredentials == null) {
3962
- withCredentials = false;
3963
- }
3964
- var customUploadImg = config.customUploadImg;
3965
- if (!customUploadImg) {
3966
- // 没有 customUploadImg 的情况下,需要如下两个配置才能继续进行图片上传
3967
- if (!uploadImgServer && !uploadImgShowBase64) {
3968
- return;
3969
- }
3970
- }
3971
-
3972
- // ------------------------------ 验证文件信息 ------------------------------
3973
- var resultFiles = [];
3974
- var errInfo = [];
3975
- arrForEach(files, function (file) {
3976
- var name = file.name;
3977
- var size = file.size;
3978
-
3979
- // chrome 低版本 name === undefined
3980
- if (!name || !size) {
3981
- return;
3982
- }
3983
- if (/\.(jpg|jpeg|png|bmp|gif|webp)$/i.test(name) === false) {
3984
- // 后缀名不合法,不是图片
3985
- errInfo.push("\u3010" + name + "\u3011\u4E0D\u662F\u56FE\u7247");
3986
- return;
3987
- }
3988
- if (maxSize < size) {
3989
- // 上传图片过大
3990
- errInfo.push("\u3010" + name + "\u3011\u5927\u4E8E " + maxSizeM + "M");
3991
- return;
3992
- }
3993
-
3994
- // 验证通过的加入结果列表
3995
- resultFiles.push(file);
3996
- });
3997
- // 抛出验证信息
3998
- if (errInfo.length) {
3999
- this._alert("图片验证未通过: \n" + errInfo.join("\n"));
4000
- return;
4001
- }
4002
- if (resultFiles.length > maxLength) {
4003
- this._alert("一次最多上传" + maxLength + "张图片");
4004
- return;
4005
- }
4006
-
4007
- // ------------------------------ 自定义上传 ------------------------------
4008
- if (customUploadImg && typeof customUploadImg === "function") {
4009
- customUploadImg(resultFiles, this.insertLinkImg.bind(this));
4010
-
4011
- // 阻止以下代码执行
4012
- return;
4013
- }
4014
-
4015
- // 添加图片数据
4016
- var formdata = new FormData();
4017
- arrForEach(resultFiles, function (file) {
4018
- var name = uploadFileName || file.name;
4019
- formdata.append(name, file);
4020
- });
4021
-
4022
- // ------------------------------ 上传图片 ------------------------------
4023
- if (uploadImgServer && typeof uploadImgServer === "string") {
4024
- // 添加参数
4025
- var uploadImgServerArr = uploadImgServer.split("#");
4026
- uploadImgServer = uploadImgServerArr[0];
4027
- var uploadImgServerHash = uploadImgServerArr[1] || "";
4028
- objForEach(uploadImgParams, function (key, val) {
4029
- // 因使用者反应,自定义参数不能默认 encode ,由 v3.1.1 版本开始注释掉
4030
- // val = encodeURIComponent(val)
4031
-
4032
- // 第一,将参数拼接到 url 中
4033
- if (uploadImgParamsWithUrl) {
4034
- if (uploadImgServer.indexOf("?") > 0) {
4035
- uploadImgServer += "&";
4036
- } else {
4037
- uploadImgServer += "?";
4038
- }
4039
- uploadImgServer = uploadImgServer + key + "=" + val;
4040
- }
4041
-
4042
- // 第二,将参数添加到 formdata 中
4043
- formdata.append(key, val);
4044
- });
4045
- if (uploadImgServerHash) {
4046
- uploadImgServer += "#" + uploadImgServerHash;
4047
- }
4048
-
4049
- // 定义 xhr
4050
- var xhr = new XMLHttpRequest();
4051
- xhr.open("POST", uploadImgServer);
4052
-
4053
- // 设置超时
4054
- xhr.timeout = timeout;
4055
- xhr.ontimeout = function () {
4056
- // hook - timeout
4057
- if (hooks.timeout && typeof hooks.timeout === "function") {
4058
- hooks.timeout(xhr, editor);
4059
- }
4060
- _this3._alert("上传图片超时");
4061
- };
4062
-
4063
- // 监控 progress
4064
- if (xhr.upload) {
4065
- xhr.upload.onprogress = function (e) {
4066
- var percent = void 0;
4067
- // 进度条
4068
- var progressBar = new Progress(editor);
4069
- if (e.lengthComputable) {
4070
- percent = e.loaded / e.total;
4071
- progressBar.show(percent);
4072
- }
4073
- };
4074
- }
4075
-
4076
- // 返回数据
4077
- xhr.onreadystatechange = function () {
4078
- var result = void 0;
4079
- if (xhr.readyState === 4) {
4080
- if (xhr.status < 200 || xhr.status >= 300) {
4081
- // hook - error
4082
- if (hooks.error && typeof hooks.error === "function") {
4083
- hooks.error(xhr, editor);
4084
- }
4085
-
4086
- // xhr 返回状态错误
4087
- _this3._alert("上传图片发生错误", "\u4E0A\u4F20\u56FE\u7247\u53D1\u751F\u9519\u8BEF\uFF0C\u670D\u52A1\u5668\u8FD4\u56DE\u72B6\u6001\u662F " + xhr.status);
4088
- return;
4089
- }
4090
- result = xhr.responseText;
4091
- if ((typeof result === "undefined" ? "undefined" : _typeof(result)) !== "object") {
4092
- try {
4093
- result = JSON.parse(result);
4094
- } catch (ex) {
4095
- // hook - fail
4096
- if (hooks.fail && typeof hooks.fail === "function") {
4097
- hooks.fail(xhr, editor, result);
4098
- }
4099
- _this3._alert("上传图片失败", "上传图片返回结果错误,返回结果是: " + result);
4100
- return;
4101
- }
4102
- }
4103
- if (!hooks.customInsert && result.errno != "0") {
4104
- // hook - fail
4105
- if (hooks.fail && typeof hooks.fail === "function") {
4106
- hooks.fail(xhr, editor, result);
4107
- }
4108
-
4109
- // 数据错误
4110
- _this3._alert("上传图片失败", "上传图片返回结果错误,返回结果 errno=" + result.errno);
4111
- } else {
4112
- if (hooks.customInsert && typeof hooks.customInsert === "function") {
4113
- // 使用者自定义插入方法
4114
- hooks.customInsert(_this3.insertLinkImg.bind(_this3), result, editor);
4115
- } else {
4116
- // 将图片插入编辑器
4117
- var data = result.data || [];
4118
- data.forEach(function (link) {
4119
- _this3.insertLinkImg(link);
4120
- });
4121
- }
4122
-
4123
- // hook - success
4124
- if (hooks.success && typeof hooks.success === "function") {
4125
- hooks.success(xhr, editor, result);
4126
- }
4127
- }
4128
- }
4129
- };
4130
-
4131
- // hook - before
4132
- if (hooks.before && typeof hooks.before === "function") {
4133
- var beforeResult = hooks.before(xhr, editor, resultFiles);
4134
- if (beforeResult && (typeof beforeResult === "undefined" ? "undefined" : _typeof(beforeResult)) === "object") {
4135
- if (beforeResult.prevent) {
4136
- // 如果返回的结果是 {prevent: true, msg: 'xxxx'} 则表示用户放弃上传
4137
- this._alert(beforeResult.msg);
4138
- return;
4139
- }
4140
- }
4141
- }
4142
-
4143
- // 自定义 headers
4144
- objForEach(uploadImgHeaders, function (key, val) {
4145
- xhr.setRequestHeader(key, val);
4146
- });
4147
-
4148
- // 跨域传 cookie
4149
- xhr.withCredentials = withCredentials;
4150
-
4151
- // 发送请求
4152
- xhr.send(formdata);
4153
-
4154
- // 注意,要 return 。不去操作接下来的 base64 显示方式
4155
- return;
4156
- }
4157
-
4158
- // ------------------------------ 显示 base64 格式 ------------------------------
4159
- if (uploadImgShowBase64) {
4160
- arrForEach(files, function (file) {
4161
- var _this = _this3;
4162
- var reader = new FileReader();
4163
- reader.readAsDataURL(file);
4164
- reader.onload = function () {
4165
- _this.insertLinkImg(this.result);
4166
- };
4167
- });
4168
- }
4169
- }
4170
- };
4171
-
4172
- /*
4173
- 编辑器构造函数
4174
- */
4175
-
4176
- // id,累加
4177
- var editorId = 1;
4178
-
4179
- // 构造函数
4180
- function Editor(toolbarSelector, textSelector) {
4181
- if (toolbarSelector == null) {
4182
- // 没有传入任何参数,报错
4183
- throw new Error("错误:初始化编辑器时候未传入任何参数,请查阅文档");
4184
- }
4185
- // id,用以区分单个页面不同的编辑器对象
4186
- this.id = "wangEditor-" + editorId++;
4187
- this.toolbarSelector = toolbarSelector;
4188
- this.textSelector = textSelector;
4189
-
4190
- // 自定义配置
4191
- this.customConfig = {};
4192
- }
4193
-
4194
- // 修改原型
4195
- Editor.prototype = {
4196
- constructor: Editor,
4197
- // 初始化配置
4198
- _initConfig: function _initConfig() {
4199
- // _config 是默认配置,this.customConfig 是用户自定义配置,将它们 merge 之后再赋值
4200
- var target = {};
4201
- this.config = Object.assign(target, config, this.customConfig);
4202
-
4203
- // 将语言配置,生成正则表达式
4204
- var langConfig = this.config.lang || {};
4205
- var langArgs = [];
4206
- objForEach(langConfig, function (key, val) {
4207
- // key 即需要生成正则表达式的规则,如“插入链接”
4208
- // val 即需要被替换成的语言,如“insert link”
4209
- langArgs.push({
4210
- reg: new RegExp(key, "img"),
4211
- val: val
4212
- });
4213
- });
4214
- this.config.langArgs = langArgs;
4215
- },
4216
- // 动态更新类名
4217
- updateClassName: function updateClassName() {
4218
- if (!this.config.placeholder) {
4219
- return;
4220
- }
4221
- var currentDom = this.$textElem[0];
4222
- if (currentDom.innerHTML === "<p><br></p>") {
4223
- this.$textElem.addClass("w-e-show-placeholder");
4224
- } else {
4225
- this.$textElem.removeClass("w-e-show-placeholder");
4226
- }
4227
- },
4228
- // 初始化 DOM
4229
- _initDom: function _initDom() {
4230
- var _this = this;
4231
- var toolbarSelector = this.toolbarSelector;
4232
- var $toolbarSelector = $(toolbarSelector);
4233
- var textSelector = this.textSelector;
4234
- var config$$1 = this.config;
4235
- var zIndex = config$$1.zIndex;
4236
-
4237
- // 定义变量
4238
- var $toolbarElem = void 0,
4239
- $textContainerElem = void 0,
4240
- $textElem = void 0,
4241
- $children = void 0,
4242
- $toolTip = void 0;
4243
- if (textSelector == null) {
4244
- // 只传入一个参数,即是容器的选择器或元素,toolbar 和 text 的元素自行创建
4245
- $toolbarElem = $("<div></div>");
4246
- $textContainerElem = $("<div></div>");
4247
-
4248
- // 将编辑器区域原有的内容,暂存起来
4249
- $children = $toolbarSelector.children();
4250
-
4251
- // 添加到 DOM 结构中
4252
- $toolbarSelector.append($toolbarElem).append($textContainerElem);
4253
-
4254
- // 自行创建的,需要配置默认的样式
4255
- $toolbarElem.css("background-color", "#f1f1f1").css("border", "1px solid #ccc").css("flex-wrap", "wrap");
4256
- $textContainerElem.css("border", "1px solid #ccc").css("border-top", "none").css("height", "300px");
4257
- } else {
4258
- // toolbar 和 text 的选择器都有值,记录属性
4259
- $toolbarElem = $toolbarSelector;
4260
- $textContainerElem = $(textSelector);
4261
- // 将编辑器区域原有的内容,暂存起来
4262
- $children = $textContainerElem.children();
4263
- }
4264
-
4265
- // 编辑区域
4266
- $textElem = $("<div></div>");
4267
- $textElem.attr("contenteditable", "true").css("width", "100%").css("height", "100%");
4268
-
4269
- // 初始化编辑区域内容
4270
- if ($children && $children.length) {
4271
- $textElem.append($children);
4272
- } else {
4273
- $textElem.append($("<p><br></p>"));
4274
- }
4275
-
4276
- // 编辑区域加入DOM
4277
- $textContainerElem.append($textElem);
4278
-
4279
- // 设置通用的 class
4280
- $toolbarElem.addClass("w-e-toolbar");
4281
- $textContainerElem.addClass("w-e-text-container");
4282
- $textContainerElem.css("z-index", zIndex);
4283
- $textElem.addClass("w-e-text");
4284
-
4285
- // 添加 ID
4286
- var toolbarElemId = getRandom("toolbar-elem");
4287
- $toolbarElem.attr("id", toolbarElemId);
4288
- var textElemId = getRandom("text-elem");
4289
- $textElem.attr("id", textElemId);
4290
- $textContainerElem.attr("id", this.id);
4291
-
4292
- // 添加 placeholder
4293
- $textElem.attr("placeholder", this.config.placeholder);
4294
-
4295
- // 记录属性
4296
- this.$toolbarElem = $toolbarElem;
4297
- this.$textContainerElem = $textContainerElem;
4298
- this.$textElem = $textElem;
4299
- this.toolbarElemId = toolbarElemId;
4300
- this.textElemId = textElemId;
4301
-
4302
- // 更新类名 placeholder
4303
- this.updateClassName();
4304
-
4305
- // 记录输入法的开始和结束
4306
- var compositionEnd = true;
4307
- $textContainerElem.on("compositionstart", function () {
4308
- // 输入法开始输入
4309
- compositionEnd = false;
4310
- });
4311
- $textContainerElem.on("compositionend", function () {
4312
- // 输入法结束输入
4313
- compositionEnd = true;
4314
-
4315
- // FIXED: 中文输入使用鼠标点击不触发onchange事件
4316
- _this.change && _this.change();
4317
- });
4318
-
4319
- // 绑定 onchange
4320
- $textContainerElem.on("click keyup", function () {
4321
- // 输入法结束才出发 onchange
4322
- compositionEnd && _this.change && _this.change();
4323
- });
4324
- $toolbarElem.on("click", function () {
4325
- this.change && this.change();
4326
- });
4327
-
4328
- //绑定 onfocus 与 onblur 事件
4329
- if (config$$1.onfocus || config$$1.onblur) {
4330
- // 当前编辑器是否是焦点状态
4331
- this.isFocus = false;
4332
- var tab$focus = false;
4333
- $(document).on("keydown", function (e) {
4334
- if (e.type === "keydown") {
4335
- tab$focus = e.keyCode == "9" ? true : false;
4336
- }
4337
- });
4338
- $(document).on("click focusin", function (e) {
4339
- var _e$target;
4340
- if (tab$focus && e.type == "focusin" && !(e !== null && e !== void 0 && (_e$target = e.target) !== null && _e$target !== void 0 && (_e$target = _e$target.className) !== null && _e$target !== void 0 && _e$target.includes("w-e-text"))) {
4341
- tab$focus = false;
4342
- return;
4343
- }
4344
- if (!tab$focus && e.type == "focusin") {
4345
- return;
4346
- }
4347
- if (_this.isFocus) {
4348
- tab$focus = false;
4349
- }
4350
- //判断当前点击元素是否在编辑器内
4351
- var isChild = $textElem.isContain($(e.target));
4352
-
4353
- //判断当前点击元素是否为工具栏
4354
- var isToolbar = $toolbarElem.isContain($(e.target));
4355
- var isMenu = $toolbarElem[0] == e.target ? true : false;
4356
- if (!isChild) {
4357
- //若为选择工具栏中的功能,则不视为成blur操作
4358
- if (isToolbar && !isMenu) {
4359
- return;
4360
- }
4361
- if (_this.isFocus) {
4362
- _this.onblur && _this.onblur();
4363
- }
4364
- _this.isFocus = false;
4365
- } else {
4366
- // 判断是否是tab聚焦,防止其他聚焦事件走进来
4367
- if (tab$focus) {
4368
- var $children = $textElem.children();
4369
- if ($children.length) {
4370
- var $last = $children.last();
4371
- // disabled状态不初始化光标
4372
- if (_this.config.disabled) {
4373
- return;
4374
- }
4375
- _this.selection.createRangeByElem($last, false, true);
4376
- _this.selection.restoreSelection();
4377
- }
4378
- }
4379
- if (!_this.isFocus) {
4380
- _this.onfocus && _this.onfocus();
4381
- }
4382
- _this.isFocus = true;
4383
-
4384
- // a标签还需要做一些特殊的操作,不可编辑状态下直接在新的标签页中打开链接,可编辑状态下弹出toolTip
4385
- if (e.target.tagName === "A" && !e.target.classList.contains("knowledgeLinkDiv")) {
4386
- var disabled = _this.$textElem[0].getAttribute("contenteditable");
4387
- if (disabled === "false") {
4388
- return;
4389
- }
4390
- if (_this.toolTipVisible && _this.prevSelecteLink === e.target) return;
4391
- if (_this.$toolTip && _this.$toolTip.length) {
4392
- _this.toolTipVisible = false;
4393
- var parentNode = _this.$toolTip[0].parentNode;
4394
- if (parentNode) {
4395
- parentNode.removeChild(_this.$toolTip[0]);
4396
- }
4397
- }
4398
- var currSelectedNodeRect = e.target.getBoundingClientRect();
4399
- var rect = document.querySelector("#" + _this.id).getBoundingClientRect();
4400
- var offsetX = (currSelectedNodeRect.x || currSelectedNodeRect.left) - (rect.x || rect.left) - 35 + currSelectedNodeRect.width / 2;
4401
- var offsetY = (currSelectedNodeRect.y || currSelectedNodeRect.top) - (rect.y || rect.top) - 32 - 22;
4402
- var classDownData = "w-e-tooltip-down";
4403
- var classUpData = "w-e-tooltip-up";
4404
- if (offsetX < 0) {
4405
- offsetX = 0;
4406
- classDownData = "w-e-tooltip-down-left";
4407
- classUpData = "w-e-tooltip-up-left";
4408
- }
4409
- if (offsetX > rect.width - 2 - 86 && rect.width) {
4410
- offsetX = rect.width - 2 - 86;
4411
- classDownData = "w-e-tooltip-down-right";
4412
- classUpData = "w-e-tooltip-up-right";
4413
- }
4414
- if (offsetY < 0) {
4415
- offsetY = (currSelectedNodeRect.y || currSelectedNodeRect.top) - (rect.y || rect.top) + 22;
4416
- $toolTip = $('<div class="w-e-tooltip ' + classDownData + '" style="top: ' + offsetY + "px; left: " + offsetX + 'px; z-index:10001; "><div class="w-e-tooltip-item-wrapper "><span>查看链接</span></div><div class="w-e-tooltip-item-wrapper "><span>取消链接</span></div></div>');
4417
- } else {
4418
- $toolTip = $('<div class="w-e-tooltip ' + classUpData + '" style="top: ' + offsetY + "px; left: " + offsetX + 'px; z-index:10001; "><div class="w-e-tooltip-item-wrapper "><span>查看链接</span></div><div class="w-e-tooltip-item-wrapper "><span>取消链接</span></div></div>');
4419
- }
4420
- _this.$textContainerElem[0].appendChild($toolTip[0]);
4421
- _this.$toolTip = $toolTip;
4422
- _this.toolTipVisible = true;
4423
- _this.prevSelecteLink = e.target;
4424
- $($toolTip.find("span")[0]).on("click", function () {
4425
- window.open(e.target.href);
4426
- });
4427
- $($toolTip.find("span")[1]).on("click", function () {
4428
- var text = e.target.innerText;
4429
- e.target.parentNode.removeChild(e.target);
4430
- _this.cmd["do"]("insertHTML", "<span>" + handleChangeContent(text) + "</span>");
4431
- _this.change && _this.change();
4432
- _this.toolTipVisible = false;
4433
- var parentNode = _this.$toolTip[0].parentNode;
4434
- if (parentNode) {
4435
- parentNode.removeChild(_this.$toolTip[0]);
4436
- }
4437
- _this.txt.html(_this.txt.html());
4438
- });
4439
- } else {
4440
- if (!_this.$toolTip || !_this.$toolTip.length) return;
4441
- _this.toolTipVisible = false;
4442
- // eslint-disable-next-line no-redeclare
4443
- var parentNode = _this.$toolTip[0].parentNode;
4444
- if (parentNode) {
4445
- parentNode.removeChild(_this.$toolTip[0]);
4446
- }
4447
- }
4448
- }
4449
- });
4450
- }
4451
- },
4452
- // 封装 command
4453
- _initCommand: function _initCommand() {
4454
- this.cmd = new Command(this);
4455
- },
4456
- // 封装 selection range API
4457
- _initSelectionAPI: function _initSelectionAPI() {
4458
- this.selection = new API(this);
4459
- },
4460
- // 添加图片上传
4461
- _initUploadImg: function _initUploadImg() {
4462
- this.uploadImg = new UploadImg(this);
4463
- },
4464
- // 初始化菜单
4465
- _initMenus: function _initMenus() {
4466
- this.menus = new Menus(this);
4467
- this.menus.init();
4468
- },
4469
- // 添加 text 区域
4470
- _initText: function _initText() {
4471
- this.txt = new Text(this);
4472
- this.txt.init();
4473
- },
4474
- // 初始化选区,将光标定位到内容尾部
4475
- initSelection: function initSelection(newLine, autoFocus) {
4476
- var $textElem = this.$textElem;
4477
- var $children = $textElem.children();
4478
- if (!$children.length) {
4479
- // 如果编辑器区域无内容,添加一个空行,重新设置选区
4480
- $textElem.append($("<p><br></p>"));
4481
- this.initSelection();
4482
- return;
4483
- }
4484
- var $last = $children.last();
4485
- if (newLine) {
4486
- // 新增一个空行
4487
- var html = $last.html().toLowerCase();
4488
- var nodeName = $last.getNodeName();
4489
- if (html !== "<br>" && html !== "<br/>" || nodeName !== "P") {
4490
- // 最后一个元素不是 <p><br></p>,添加一个空行,重新设置选区
4491
- $textElem.append($("<p><br></p>"));
4492
- this.initSelection();
4493
- return;
4494
- }
4495
- }
4496
-
4497
- // disabled状态不初始化光标
4498
- // FIXED 受控模式且每次初始化会丢失光标
4499
- if (this.config.disabled) {
4500
- return;
4501
- }
4502
-
4503
- // FIXED 初始化自动获取焦点后光标在最前面
4504
- if (autoFocus === false) {
4505
- return;
4506
- }
4507
- this.selection.createRangeByElem($last, false, true);
4508
- this.selection.restoreSelection();
4509
- },
4510
- // 绑定事件
4511
- _bindEvent: function _bindEvent() {
4512
- // -------- 绑定 onchange 事件 --------
4513
- var onChangeTimeoutId = 0;
4514
- this.beforeChangeHtml = this.txt.html();
4515
- var config$$1 = this.config;
4516
-
4517
- // onchange 触发延迟时间
4518
- var onchangeTimeout = config$$1.onchangeTimeout;
4519
- onchangeTimeout = parseInt(onchangeTimeout, 10);
4520
- if (!onchangeTimeout || onchangeTimeout <= 0) {
4521
- onchangeTimeout = 200;
4522
- }
4523
- var onchange = config$$1.onchange;
4524
- if (onchange && typeof onchange === "function") {
4525
- // 触发 change 的有三个场景:
4526
- // 1. $textContainerElem.on('click keyup')
4527
- // 2. $toolbarElem.on('click')
4528
- // 3. editor.cmd.do()
4529
- this.change = function () {
4530
- var _this4 = this;
4531
- // 判断是否有变化
4532
- var currentHtml = this.txt.html();
4533
- if (currentHtml.length === this.beforeChangeHtml.length) {
4534
- // 需要比较每一个字符
4535
- if (currentHtml === this.beforeChangeHtml) {
4536
- return;
4537
- }
4538
- }
4539
-
4540
- // 执行,使用节流
4541
- if (onChangeTimeoutId) {
4542
- clearTimeout(onChangeTimeoutId);
4543
- }
4544
- onChangeTimeoutId = setTimeout(function () {
4545
- // 触发配置的 onchange 函数
4546
- onchange(currentHtml);
4547
- _this4.beforeChangeHtml = currentHtml;
4548
- }, onchangeTimeout);
4549
- this.updateClassName();
4550
- };
4551
- }
4552
-
4553
- // -------- 绑定 onblur 事件 --------
4554
- var onblur = config$$1.onblur;
4555
- if (onblur && typeof onblur === "function") {
4556
- this.onblur = function () {
4557
- var currentHtml = this.txt.html();
4558
- onblur(currentHtml);
4559
- };
4560
- }
4561
-
4562
- // -------- 绑定 onfocus 事件 --------
4563
- var onfocus = config$$1.onfocus;
4564
- if (onfocus && typeof onfocus === "function") {
4565
- this.onfocus = function () {
4566
- onfocus();
4567
- };
4568
- }
4569
- },
4570
- // 创建编辑器
4571
- create: function create() {
4572
- // 初始化配置信息
4573
- this._initConfig();
4574
-
4575
- // 初始化 DOM
4576
- this._initDom();
4577
-
4578
- // 封装 command API
4579
- this._initCommand();
4580
-
4581
- // 封装 selection range API
4582
- this._initSelectionAPI();
4583
-
4584
- // 添加 text
4585
- this._initText();
4586
-
4587
- // 初始化菜单
4588
- this._initMenus();
4589
-
4590
- // 添加 图片上传
4591
- this._initUploadImg();
4592
-
4593
- // 初始化选区,将光标定位到内容尾部
4594
- this.initSelection(true, this.config.autoFocus);
4595
-
4596
- // 绑定事件
4597
- this._bindEvent();
4598
- },
4599
- // 解绑所有事件(暂时不对外开放)
4600
- _offAllEvent: function _offAllEvent() {
4601
- $.offAll();
4602
- }
4603
- };
4604
-
4605
- // 检验是否浏览器环境
4606
- try {
4607
- document;
4608
- } catch (ex) {
4609
- throw new Error("请在浏览器环境下运行");
4610
- }
4611
-
4612
- // polyfill
4613
- polyfill();
4614
-
4615
- // 这里的 `inlinecss` 将被替换成 css 代码的内容,详情可去 ./gulpfile.js 中搜索 `inlinecss` 关键字
4616
- var inlinecss = '.w-e-toolbar,.w-e-text-container,.w-e-menu-panel { padding: 0; margin: 0; box-sizing: border-box;}.w-e-toolbar *,.w-e-text-container *,.w-e-menu-panel * { padding: 0; margin: 0; box-sizing: border-box;}.w-e-clear-fix:after { content: ""; display: table; clear: both;}.w-e-toolbar .w-e-droplist { position: absolute; left: 0; top: 0; background-color: #fff; border: 1px solid #f1f1f1; border-right-color: #ccc; border-bottom-color: #ccc;}.w-e-droplist.w-e-droplist-left{transform: translateX(calc(-100% + 16px));}.w-e-droplist.w-e-droplist-center{transform: translateX(-50%);}.w-e-toolbar .w-e-droplist .w-e-dp-title { text-align: center; color: #999; line-height: 2; border-bottom: 1px solid #f1f1f1; font-size: 13px;}.w-e-toolbar .w-e-droplist ul.w-e-list { list-style: none; line-height: 1;}.w-e-toolbar .w-e-droplist ul.w-e-list li.w-e-item { color: #333; padding: 5px 0;}.w-e-toolbar .w-e-droplist ul.w-e-list li.w-e-item:hover { background-color: #f1f1f1;}.w-e-toolbar .w-e-droplist ul.w-e-block { list-style: none; text-align: left; padding: 5px;}.w-e-toolbar .w-e-droplist ul.w-e-block li.w-e-item { display: inline-block; *display: inline; *zoom: 1; padding: 3px 5px;}.w-e-toolbar .w-e-droplist ul.w-e-block li.w-e-item:hover { background-color: #f1f1f1;}@font-face { font-family: \'w-e-icon\'; src: url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAABhQAAsAAAAAGAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIPBGNtYXAAAAFoAAABBAAAAQQrSf4BZ2FzcAAAAmwAAAAIAAAACAAAABBnbHlmAAACdAAAEvAAABLwfpUWUWhlYWQAABVkAAAANgAAADYQp00kaGhlYQAAFZwAAAAkAAAAJAfEA+FobXR4AAAVwAAAAIQAAACEeAcD7GxvY2EAABZEAAAARAAAAERBSEX+bWF4cAAAFogAAAAgAAAAIAAsALZuYW1lAAAWqAAAAYYAAAGGmUoJ+3Bvc3QAABgwAAAAIAAAACAAAwAAAAMD3gGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA8fwDwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEAOgAAAA2ACAABAAWAAEAIOkG6Q3pEulH6Wbpd+m56bvpxunL6d/qDepc6l/qZepo6nHqefAN8BTxIPHc8fz//f//AAAAAAAg6QbpDekS6UfpZel36bnpu+nG6cvp3+oN6lzqX+pi6mjqcep38A3wFPEg8dzx/P/9//8AAf/jFv4W+Bb0FsAWoxaTFlIWURZHFkMWMBYDFbUVsxWxFa8VpxWiEA8QCQ7+DkMOJAADAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACAAD/wAQAA8AABAATAAABNwEnAQMuAScTNwEjAQMlATUBBwGAgAHAQP5Anxc7MmOAAYDA/oDAAoABgP6ATgFAQAHAQP5A/p0yOxcBEU4BgP6A/YDAAYDA/oCAAAQAAAAABAADgAAQACEALQA0AAABOAExETgBMSE4ATEROAExITUhIgYVERQWMyEyNjURNCYjBxQGIyImNTQ2MzIWEyE1EwEzNwPA/IADgPyAGiYmGgOAGiYmGoA4KCg4OCgoOED9AOABAEDgA0D9AAMAQCYa/QAaJiYaAwAaJuAoODgoKDg4/biAAYD+wMAAAAIAAABABAADQAA4ADwAAAEmJy4BJyYjIgcOAQcGBwYHDgEHBhUUFx4BFxYXFhceARcWMzI3PgE3Njc2Nz4BNzY1NCcuAScmJwERDQED1TY4OXY8PT8/PTx2OTg2CwcICwMDAwMLCAcLNjg5djw9Pz89PHY5ODYLBwgLAwMDAwsIBwv9qwFA/sADIAgGBggCAgICCAYGCCkqKlktLi8vLi1ZKiopCAYGCAICAgIIBgYIKSoqWS0uLy8uLVkqKin94AGAwMAAAAAAAgDA/8ADQAPAABsAJwAAASIHDgEHBhUUFx4BFxYxMDc+ATc2NTQnLgEnJgMiJjU0NjMyFhUUBgIAQjs6VxkZMjJ4MjIyMngyMhkZVzo7QlBwcFBQcHADwBkZVzo7Qnh9fcxBQUFBzH19eEI7OlcZGf4AcFBQcHBQUHAAAAEAAAAABAADgAArAAABIgcOAQcGBycRISc+ATMyFx4BFxYVFAcOAQcGBxc2Nz4BNzY1NCcuAScmIwIANTIyXCkpI5YBgJA1i1BQRUZpHh4JCSIYGB5VKCAgLQwMKCiLXl1qA4AKCycbHCOW/oCQNDweHmlGRVArKClJICEaYCMrK2I2NjlqXV6LKCgAAQAAAAAEAAOAACoAABMUFx4BFxYXNyYnLgEnJjU0Nz4BNzYzMhYXByERByYnLgEnJiMiBw4BBwYADAwtICAoVR4YGCIJCR4eaUZFUFCLNZABgJYjKSlcMjI1al1eiygoAYA5NjZiKysjYBohIEkpKCtQRUZpHh48NJABgJYjHBsnCwooKIteXQAAAAACAAAAQAQBAwAAJgBNAAATMhceARcWFRQHDgEHBiMiJy4BJyY1JzQ3PgE3NjMVIgYHDgEHPgEhMhceARcWFRQHDgEHBiMiJy4BJyY1JzQ3PgE3NjMVIgYHDgEHPgHhLikpPRESEhE9KSkuLikpPRESASMjelJRXUB1LQkQBwgSAkkuKSk9ERISET0pKS4uKSk9ERIBIyN6UlFdQHUtCRAHCBICABIRPSkpLi4pKT0REhIRPSkpLiBdUVJ6IyOAMC4IEwoCARIRPSkpLi4pKT0REhIRPSkpLiBdUVJ6IyOAMC4IEwoCAQAABgBA/8AEAAPAAAMABwALABEAHQApAAAlIRUhESEVIREhFSEnESM1IzUTFTMVIzU3NSM1MxUVESM1MzUjNTM1IzUBgAKA/YACgP2AAoD9gMBAQECAwICAwMCAgICAgIACAIACAIDA/wDAQP3yMkCSPDJAku7+wEBAQEBAAAYAAP/ABAADwAADAAcACwAXACMALwAAASEVIREhFSERIRUhATQ2MzIWFRQGIyImETQ2MzIWFRQGIyImETQ2MzIWFRQGIyImAYACgP2AAoD9gAKA/YD+gEs1NUtLNTVLSzU1S0s1NUtLNTVLSzU1SwOAgP8AgP8AgANANUtLNTVLS/61NUtLNTVLS/61NUtLNTVLSwADAAAAAAQAA6AAAwANABQAADchFSElFSE1EyEVITUhJQkBIxEjEQAEAPwABAD8AIABAAEAAQD9YAEgASDggEBAwEBAAQCAgMABIP7g/wABAAAAAAACAB7/zAPiA7QAMwBkAAABIiYnJicmNDc2PwE+ATMyFhcWFxYUBwYPAQYiJyY0PwE2NCcuASMiBg8BBhQXFhQHDgEjAyImJyYnJjQ3Nj8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFxYUBwYPAQ4BIwG4ChMIIxISEhIjwCNZMTFZIyMSEhISI1gPLA8PD1gpKRQzHBwzFMApKQ8PCBMKuDFZIyMSEhISI1gPLA8PD1gpKRQzHBwzFMApKQ8PDysQIxISEhIjwCNZMQFECAckLS1eLS0kwCIlJSIkLS1eLS0kVxAQDysPWCl0KRQVFRTAKXQpDysQBwj+iCUiJC0tXi0tJFcQEA8rD1gpdCkUFRUUwCl0KQ8rEA8PJC0tXi0tJMAiJQAAAAAFAAD/wAQAA8AAGwA3AFMAXwBrAAAFMjc+ATc2NTQnLgEnJiMiBw4BBwYVFBceARcWEzIXHgEXFhUUBw4BBwYjIicuAScmNTQ3PgE3NhMyNz4BNzY3BgcOAQcGIyInLgEnJicWFx4BFxYnNDYzMhYVFAYjIiYlNDYzMhYVFAYjIiYCAGpdXosoKCgoi15dampdXosoKCgoi15dalZMTHEgISEgcUxMVlZMTHEgISEgcUxMVisrKlEmJiMFHBtWODc/Pzc4VhscBSMmJlEqK9UlGxslJRsbJQGAJRsbJSUbGyVAKCiLXl1qal1eiygoKCiLXl1qal1eiygoA6AhIHFMTFZWTExxICEhIHFMTFZWTExxICH+CQYGFRAQFEM6OlYYGRkYVjo6QxQQEBUGBvcoODgoKDg4KCg4OCgoODgAAAMAAP/ABAADwAAbADcAQwAAASIHDgEHBhUUFx4BFxYzMjc+ATc2NTQnLgEnJgMiJy4BJyY1NDc+ATc2MzIXHgEXFhUUBw4BBwYTBycHFwcXNxc3JzcCAGpdXosoKCgoi15dampdXosoKCgoi15dalZMTHEgISEgcUxMVlZMTHEgISEgcUxMSqCgYKCgYKCgYKCgA8AoKIteXWpqXV6LKCgoKIteXWpqXV6LKCj8YCEgcUxMVlZMTHEgISEgcUxMVlZMTHEgIQKgoKBgoKBgoKBgoKAAAQBl/8ADmwPAACkAAAEiJiMiBw4BBwYVFBYzLgE1NDY3MAcGAgcGBxUhEzM3IzceATMyNjcOAQMgRGhGcVNUbRobSUgGDWVKEBBLPDxZAT1sxizXNC1VJi5QGB09A7AQHh1hPj9BTTsLJjeZbwN9fv7Fj5AjGQIAgPYJDzdrCQcAAAAAAgAAAAAEAAOAAAkAFwAAJTMHJzMRIzcXIyURJyMRMxUhNTMRIwcRA4CAoKCAgKCggP8AQMCA/oCAwEDAwMACAMDAwP8AgP1AQEACwIABAAADAMAAAANAA4AAFgAfACgAAAE+ATU0Jy4BJyYjIREhMjc+ATc2NTQmATMyFhUUBisBEyMRMzIWFRQGAsQcIBQURi4vNf7AAYA1Ly5GFBRE/oRlKjw8KWafn58sPj4B2yJULzUvLkYUFPyAFBRGLi81RnQBRks1NUv+gAEASzU1SwAAAAACAMAAAANAA4AAHwAjAAABMxEUBw4BBwYjIicuAScmNREzERQWFx4BMzI2Nz4BNQEhFSECwIAZGVc6O0JCOzpXGRmAGxgcSSgoSRwYG/4AAoD9gAOA/mA8NDVOFhcXFk41NDwBoP5gHjgXGBsbGBc4Hv6ggAAAAAABAIAAAAOAA4AACwAAARUjATMVITUzASM1A4CA/sCA/kCAAUCAA4BA/QBAQAMAQAABAAAAAAQAA4AAPQAAARUjHgEVFAYHDgEjIiYnLgE1MxQWMzI2NTQmIyE1IS4BJy4BNTQ2Nz4BMzIWFx4BFSM0JiMiBhUUFjMyFhcEAOsVFjUwLHE+PnEsMDWAck5OcnJO/gABLAIEATA1NTAscT4+cSwwNYByTk5yck47bisBwEAdQSI1YiQhJCQhJGI1NExMNDRMQAEDASRiNTViJCEkJCEkYjU0TEw0NEwhHwAAAAcAAP/ABAADwAADAAcACwAPABMAGwAjAAATMxUjNzMVIyUzFSM3MxUjJTMVIwMTIRMzEyETAQMhAyMDIQMAgIDAwMABAICAwMDAAQCAgBAQ/QAQIBACgBD9QBADABAgEP2AEAHAQEBAQEBAQEBAAkD+QAHA/oABgPwAAYD+gAFA/sAAAAoAAAAABAADgAADAAcACwAPABMAFwAbAB8AIwAnAAATESERATUhFR0BITUBFSE1IxUhNREhFSElIRUhETUhFQEhFSEhNSEVAAQA/YABAP8AAQD/AED/AAEA/wACgAEA/wABAPyAAQD/AAKAAQADgPyAA4D9wMDAQMDAAgDAwMDA/wDAwMABAMDA/sDAwMAAAAUAAAAABAADgAADAAcACwAPABMAABMhFSEVIRUhESEVIREhFSERIRUhAAQA/AACgP2AAoD9gAQA/AAEAPwAA4CAQID/AIABQID/AIAAAAAABQAAAAAEAAOAAAMABwALAA8AEwAAEyEVIRchFSERIRUhAyEVIREhFSEABAD8AMACgP2AAoD9gMAEAPwABAD8AAOAgECA/wCAAUCA/wCAAAAFAAAAAAQAA4AAAwAHAAsADwATAAATIRUhBSEVIREhFSEBIRUhESEVIQAEAPwAAYACgP2AAoD9gP6ABAD8AAQA/AADgIBAgP8AgAFAgP8AgAAAAAABAD8APwLmAuYALAAAJRQPAQYjIi8BBwYjIi8BJjU0PwEnJjU0PwE2MzIfATc2MzIfARYVFA8BFxYVAuYQThAXFxCoqBAXFhBOEBCoqBAQThAWFxCoqBAXFxBOEBCoqBDDFhBOEBCoqBAQThAWFxCoqBAXFxBOEBCoqBAQThAXFxCoqBAXAAAABgAAAAADJQNuABQAKAA8AE0AVQCCAAABERQHBisBIicmNRE0NzY7ATIXFhUzERQHBisBIicmNRE0NzY7ATIXFhcRFAcGKwEiJyY1ETQ3NjsBMhcWExEhERQXFhcWMyEyNzY3NjUBIScmJyMGBwUVFAcGKwERFAcGIyEiJyY1ESMiJyY9ATQ3NjsBNzY3NjsBMhcWHwEzMhcWFQElBgUIJAgFBgYFCCQIBQaSBQUIJQgFBQUFCCUIBQWSBQUIJQgFBQUFCCUIBQVJ/gAEBAUEAgHbAgQEBAT+gAEAGwQGtQYEAfcGBQg3Ghsm/iUmGxs3CAUFBQUIsSgIFxYXtxcWFgkosAgFBgIS/rcIBQUFBQgBSQgFBgYFCP63CAUFBQUIAUkIBQYGBQj+twgFBQUFCAFJCAUGBgX+WwId/eMNCwoFBQUFCgsNAmZDBQICBVUkCAYF/eMwIiMhIi8CIAUGCCQIBQVgFQ8PDw8VYAUFCAACAAcASQO3Aq8AGgAuAAAJAQYjIi8BJjU0PwEnJjU0PwE2MzIXARYVFAcBFRQHBiMhIicmPQE0NzYzITIXFgFO/vYGBwgFHQYG4eEGBh0FCAcGAQoGBgJpBQUI/dsIBQUFBQgCJQgFBQGF/vYGBhwGCAcG4OEGBwcGHQUF/vUFCAcG/vslCAUFBQUIJQgFBQUFAAAAAQAjAAAD3QNuALMAACUiJyYjIgcGIyInJjU0NzY3Njc2NzY9ATQnJiMhIgcGHQEUFxYXFjMWFxYVFAcGIyInJiMiBwYjIicmNTQ3Njc2NzY3Nj0BETQ1NDU0JzQnJicmJyYnJicmIyInJjU0NzYzMhcWMzI3NjMyFxYVFAcGIwYHBgcGHQEUFxYzITI3Nj0BNCcmJyYnJjU0NzYzMhcWMzI3NjMyFxYVFAcGByIHBgcGFREUFxYXFhcyFxYVFAcGIwPBGTMyGhkyMxkNCAcJCg0MERAKEgEHFf5+FgcBFQkSEw4ODAsHBw4bNTUaGDExGA0HBwkJCwwQDwkSAQIBAgMEBAUIEhENDQoLBwcOGjU1GhgwMRgOBwcJCgwNEBAIFAEHDwGQDgcBFAoXFw8OBwcOGTMyGRkxMRkOBwcKCg0NEBEIFBQJEREODQoLBwcOAAICAgIMCw8RCQkBAQMDBQxE4AwFAwMFDNRRDQYBAgEICBIPDA0CAgICDAwOEQgJAQIDAwUNRSEB0AINDQgIDg4KCgsLBwcDBgEBCAgSDwwNAgICAg0MDxEICAECAQYMULYMBwEBBwy2UAwGAQEGBxYPDA0CAgICDQwPEQgIAQECBg1P/eZEDAYCAgEJCBEPDA0AAAIAAP+3A/8DtwATADkAAAEyFxYVFAcCBwYjIicmNTQ3ATYzARYXFh8BFgcGIyInJicmJyY1FhcWFxYXFjMyNzY3Njc2NzY3NjcDmygeHhq+TDdFSDQ0NQFtISn9+BcmJy8BAkxMe0c2NiEhEBEEExQQEBIRCRcIDxITFRUdHR4eKQO3GxooJDP+mUY0NTRJSTABSx/9sSsfHw0oek1MGhsuLzo6RAMPDgsLCgoWJRsaEREKCwQEAgABAAAAAAAA9evv618PPPUACwQAAAAAANbEBFgAAAAA1sQEWAAA/7cEAQPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAD//wQBAAEAAAAAAAAAAAAAAAAAAAAhBAAAAAAAAAAAAAAAAgAAAAQAAAAEAAAABAAAAAQAAMAEAAAABAAAAAQAAAAEAABABAAAAAQAAAAEAAAeBAAAAAQAAAAEAABlBAAAAAQAAMAEAADABAAAgAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAMlAD8DJQAAA74ABwQAACMD/wAAAAAAAAAKABQAHgBMAJQA+AE2AXwBwgI2AnQCvgLoA34EHgSIBMoE8gU0BXAFiAXgBiIGagaSBroG5AcoB+AIKgkcCXgAAQAAACEAtAAKAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format(\'truetype\'); font-weight: normal; font-style: normal;}[class^="w-e-icon-"],[class*=" w-e-icon-"] { /* use !important to prevent issues with browser extensions that change fonts */ font-family: \'w-e-icon\' !important; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; /* Better Font Rendering =========== */ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;}.w-e-icon-close:before { content: "\\f00d";}.w-e-icon-upload2:before { content: "\\e9c6";}.w-e-icon-trash-o:before { content: "\\f014";}.w-e-icon-header:before { content: "\\f1dc";}.w-e-icon-pencil2:before { content: "\\e906";}.w-e-icon-paint-brush:before { content: "\\f1fc";}.w-e-icon-image:before { content: "\\e90d";}.w-e-icon-play:before { content: "\\e912";}.w-e-icon-location:before { content: "\\e947";}.w-e-icon-undo:before { content: "\\e965";}.w-e-icon-redo:before { content: "\\e966";}.w-e-icon-quotes-left:before { content: "\\e977";}.w-e-icon-list-numbered:before { content: "\\e9b9";}.w-e-icon-list2:before { content: "\\e9bb";}.w-e-icon-link:before { content: "\\e9cb";}.w-e-icon-happy:before { content: "\\e9df";}.w-e-icon-bold:before { content: "\\ea62";}.w-e-icon-underline:before { content: "\\ea63";}.w-e-icon-italic:before { content: "\\ea64";}.w-e-icon-strikethrough:before { content: "\\ea65";}.w-e-icon-table2:before { content: "\\ea71";}.w-e-icon-paragraph-left:before { content: "\\ea77";}.w-e-icon-paragraph-center:before { content: "\\ea78";}.w-e-icon-paragraph-right:before { content: "\\ea79";}.w-e-icon-terminal:before { content: "\\f120";}.w-e-icon-page-break:before { content: "\\ea68";}.w-e-icon-cancel-circle:before { content: "\\ea0d";}.w-e-icon-font:before { content: "\\ea5c";}.w-e-icon-text-heigh:before { content: "\\ea5f";}.w-e-toolbar { display: -webkit-box; display: -ms-flexbox; display: flex; padding: 0 5px; /* flex-wrap: wrap; */ /* 单个菜单 */}.w-e-toolbar .w-e-menu { position: relative; text-align: center; padding: 5px 10px; cursor: pointer;}.w-e-toolbar .w-e-menu i { color: #999;}.w-e-toolbar .w-e-menu:hover i { color: #333;}.w-e-toolbar .w-e-active i { color: #1e88e5;}.w-e-toolbar .w-e-active:hover i { color: #1e88e5;}.w-e-text-container .w-e-panel-container { position: absolute; top: 0; left: 50%; border: 1px solid #ccc; border-top: 0; box-shadow: 1px 1px 2px #ccc; color: #333; background-color: #fff; /* 为 emotion panel 定制的样式 */ /* 上传图片的 panel 定制样式 */}.w-e-text-container .w-e-panel-container .w-e-panel-close { position: absolute; right: 0; top: 0; padding: 5px; margin: 2px 5px 0 0; cursor: pointer; color: #999;}.w-e-text-container .w-e-panel-container .w-e-panel-close:hover { color: #333;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-title { list-style: none; display: -webkit-box; display: -ms-flexbox; display: flex; font-size: 14px; margin: 2px 10px 0 10px; border-bottom: 1px solid #f1f1f1;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-title .w-e-item { padding: 3px 5px; color: #999; cursor: pointer; margin: 0 3px; position: relative; top: 1px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-title .w-e-active { color: #333; border-bottom: 1px solid #333; cursor: default; font-weight: 700;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content { padding: 10px 15px 10px 15px; font-size: 16px; /* 输入框的样式 */ /* 按钮的样式 */}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input:focus,.w-e-text-container .w-e-panel-container .w-e-panel-tab-content textarea:focus,.w-e-text-container .w-e-panel-container .w-e-panel-tab-content button:focus { outline: none;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content textarea { width: 100%; border: 1px solid #ccc; padding: 5px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content textarea:focus { border-color: #1e88e5;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text] { border: none; border-bottom: 1px solid #ccc; font-size: 14px; height: 20px; color: #333; text-align: left;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text].small { width: 30px; text-align: center;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text].block { display: block; width: 100%; margin: 10px 0;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text]:focus { border-bottom: 2px solid #1e88e5;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button { font-size: 14px; color: #1e88e5; border: none; padding: 5px 10px; background-color: #fff; cursor: pointer; border-radius: 3px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.left { float: left; margin-right: 10px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.right { float: right; margin-left: 10px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.gray { color: #999;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.red { color: #c24f4a;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button:hover { background-color: #f1f1f1;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container:after { content: ""; display: table; clear: both;}.w-e-text-container .w-e-panel-container .w-e-emoticon-container .w-e-item { cursor: pointer; font-size: 18px; padding: 0 3px; display: inline-block; *display: inline; *zoom: 1;}.w-e-text-container .w-e-panel-container .w-e-up-img-container { text-align: center;}.w-e-text-container .w-e-panel-container .w-e-up-img-container .w-e-up-btn { display: inline-block; *display: inline; *zoom: 1; color: #999; cursor: pointer; font-size: 60px; line-height: 1;}.w-e-text-container .w-e-panel-container .w-e-up-img-container .w-e-up-btn:hover { color: #333;}.w-e-text-container { position: relative;}.w-e-text-container .w-e-progress { position: absolute; background-color: #1e88e5; bottom: 0; left: 0; height: 1px;}.w-e-text { padding: 0 10px; overflow-y: scroll;}.w-e-text p,.w-e-text h1,.w-e-text h2,.w-e-text h3,.w-e-text h4,.w-e-text h5,.w-e-text table,.w-e-text pre { margin: 10px 0; line-height: 1.5;}.w-e-text ul,.w-e-text ol { margin: 10px 0 10px 20px;}.w-e-text blockquote { display: block; border-left: 8px solid #d0e5f2; padding: 5px 10px; margin: 10px 0; line-height: 1.4; font-size: 100%; background-color: #f1f1f1;}.w-e-text code { display: inline-block; *display: inline; *zoom: 1; background-color: #f1f1f1; border-radius: 3px; padding: 3px 5px; margin: 0 3px;}.w-e-text pre code { display: block;}.w-e-text table { border-top: 1px solid #ccc; border-left: 1px solid #ccc;}.w-e-text table td,.w-e-text table th { border-bottom: 1px solid #ccc; border-right: 1px solid #ccc; padding: 3px 5px;}.w-e-text table th { border-bottom: 2px solid #ccc; text-align: center;}.w-e-text:focus { outline: none;}.w-e-text img { cursor: pointer; display: block;}.w-e-text img:hover { box-shadow: 0 0 5px #333;}';
4617
-
4618
- // 将 css 代码添加到 <style> 中
4619
- var style = document.createElement("style");
4620
- style.type = "text/css";
4621
- style.innerHTML = inlinecss;
4622
- document.getElementsByTagName("HEAD").item(0).appendChild(style);
4623
-
4624
- // 返回
4625
- var index = window.wangEditor || Editor;
4626
- return index;
4627
- });