@unicom-cloud/ui 0.8.112 → 0.8.113

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 (413) hide show
  1. package/Affix.js +1 -1
  2. package/Alert.js +1 -1
  3. package/AutoComplete.js +1 -1
  4. package/BackTop.js +1 -1
  5. package/Badge.js +1 -1
  6. package/Breadcrumb.js +2 -2
  7. package/Button.js +1 -1
  8. package/Calendar.js +1 -1
  9. package/Card.js +1 -1
  10. package/Carousel.js +1 -1
  11. package/Cascader.js +1 -1
  12. package/Checkbox.js +1 -1
  13. package/ColorPicker.js +1 -1
  14. package/Comment.js +1 -1
  15. package/ConfigProvider.js +1 -1
  16. package/Copy.js +3 -47
  17. package/Countdown.js +16 -50
  18. package/DatePicker.js +1 -1
  19. package/Descriptions.js +1 -1
  20. package/Details.js +14 -50
  21. package/Development.js +1 -1
  22. package/Divider.js +1 -1
  23. package/Draggable.js +1 -1
  24. package/Dropdown.js +1 -1
  25. package/Empty.js +1 -1
  26. package/Flex.js +15 -51
  27. package/Form.js +1 -1
  28. package/Icon.js +1 -1
  29. package/IconHover.js +1 -1
  30. package/Image.js +1 -1
  31. package/InputNumber.js +1 -1
  32. package/Layout.js +1 -1
  33. package/Link.js +1 -1
  34. package/LiquidFill.js +16 -51
  35. package/List.js +1 -1
  36. package/Loading.js +14 -50
  37. package/Marquee.js +23 -46
  38. package/Mentions.js +1 -1
  39. package/Menu.js +1 -1
  40. package/Message.js +1 -1
  41. package/Modal.js +1 -1
  42. package/Notice.js +13 -49
  43. package/Notification.js +1 -1
  44. package/OverflowEllipsis.js +1 -1
  45. package/PageHeader.js +1 -1
  46. package/Popconfirm.js +1 -1
  47. package/Popover.js +1 -1
  48. package/Progress.js +1 -1
  49. package/QrCode.js +14 -51
  50. package/Radio.js +1 -1
  51. package/Rate.js +1 -1
  52. package/ResizeBox.js +1 -1
  53. package/Result.js +1 -1
  54. package/RichText.js +12 -13
  55. package/Segmented.js +15 -50
  56. package/Skeleton.js +1 -1
  57. package/Slider.js +1 -1
  58. package/Space.js +15 -51
  59. package/Spin.js +1 -1
  60. package/Statistic.js +1 -1
  61. package/Steps.js +1 -1
  62. package/Switch.js +1 -1
  63. package/Table.js +1 -1
  64. package/Tabs.js +1 -1
  65. package/Tag.js +1 -1
  66. package/Tooltip.js +1 -1
  67. package/Tour.js +17 -53
  68. package/Transfer.js +1 -1
  69. package/Tree.js +1 -1
  70. package/TreeSelect.js +1 -1
  71. package/Trigger.js +1 -1
  72. package/affix/index.js +1 -1
  73. package/alert/index.js +1 -1
  74. package/anchor/Anchor.js +2 -2
  75. package/anchor/Link.js +1 -1
  76. package/app/App.js +2 -2
  77. package/auto-complete/index.js +1 -1
  78. package/avatar/Avatar.js +1 -1
  79. package/avatar/Group.js +1 -1
  80. package/back-top/index.js +1 -1
  81. package/badge/index.js +1 -1
  82. package/breadcrumb/index.js +2 -2
  83. package/button/Group.js +1 -1
  84. package/button/index.js +1 -1
  85. package/calendar/index.js +2 -2
  86. package/card/Grid.js +1 -1
  87. package/card/Meta.js +1 -1
  88. package/card/index.js +1 -1
  89. package/carousel/Arrow.js +1 -1
  90. package/carousel/Indicator.js +1 -1
  91. package/carousel/index.js +1 -1
  92. package/cascader/Cascader.js +3 -3
  93. package/cascader/index.js +1 -1
  94. package/cascader/util.js +1 -1
  95. package/checkbox/Checkbox.js +2 -2
  96. package/checkbox/Group.js +2 -2
  97. package/checkbox/GroupBlock.js +2 -2
  98. package/checkbox/index.js +2 -2
  99. package/chunk/{0BhDjhcd.js → 3t4FwEoB.js} +1 -1
  100. package/chunk/{KPBMJlOB.js → BHAu6wbC.js} +1 -1
  101. package/chunk/{DhAvt6tJ.js → Bcl7dWlJ.js} +2 -2
  102. package/chunk/{CrOzsnI0.js → Bl3hZtxi.js} +1 -1
  103. package/chunk/{BfVlSL8A.js → Bzx5BueA.js} +3 -3
  104. package/chunk/CVMFAeSw.js +39 -0
  105. package/chunk/{C1vY8016.js → CYDaUML7.js} +77 -108
  106. package/chunk/{CYssV-zz.js → CbXCgtzv.js} +65 -99
  107. package/chunk/ClNkxEcR.js +154 -0
  108. package/chunk/{DfUcAhyT.js → CwLSam2p.js} +2 -2
  109. package/chunk/Cy26_CKq.js +33 -0
  110. package/chunk/{BiZSULcr.js → D0dVE1v1.js} +317 -350
  111. package/chunk/{CtCFA4ht.js → DA5AMZwY.js} +3 -3
  112. package/chunk/{DfbO4QTS.js → DB0hUIM1.js} +1 -1
  113. package/chunk/{DMv8Hn4u.js → De8RLlOK.js} +1 -1
  114. package/chunk/{C3kH2ES3.js → DrYaod6k.js} +1 -1
  115. package/chunk/{CylbdYce.js → DzlfiVe2.js} +1 -1
  116. package/chunk/gJsdBcpG.js +10 -0
  117. package/chunk/{Cx92e1S8.js → yWKJUe_w.js} +3 -3
  118. package/collapse/Collapse.js +1 -1
  119. package/collapse/Item.js +1 -1
  120. package/color-picker/ControlBar.js +1 -1
  121. package/color-picker/InputAlpha.js +1 -1
  122. package/color-picker/InputHex.js +1 -1
  123. package/color-picker/InputRgb.js +1 -1
  124. package/color-picker/Palette.js +1 -1
  125. package/color-picker/Panel.js +2 -2
  126. package/color-picker/index.js +1 -1
  127. package/comment/index.js +1 -1
  128. package/config-provider/ConfigProvider.js +1 -1
  129. package/config-provider/context.js +1 -1
  130. package/config-provider/index.js +2 -2
  131. package/copy/index.js +22 -66
  132. package/countdown/index.js +41 -75
  133. package/date-picker/Picker.js +1 -1
  134. package/date-picker/RangePicker.js +2 -2
  135. package/date-picker/index.js +1 -1
  136. package/descriptions/index.js +1 -1
  137. package/details/index.js +46 -82
  138. package/development/index.js +1 -1
  139. package/divider/index.js +1 -1
  140. package/draggable/index.js +1 -1
  141. package/drawer/Drawer.js +1 -1
  142. package/dropdown/Button.js +1 -1
  143. package/dropdown/index.js +1 -1
  144. package/empty/index.js +1 -1
  145. package/flex/index.js +37 -71
  146. package/form/Form.js +2 -2
  147. package/form/FormItem.js +1 -1
  148. package/form/index.js +1 -1
  149. package/grid/Grid.js +1 -1
  150. package/grid/Item.js +1 -1
  151. package/hooks/index.js +6 -6
  152. package/hooks/useId.js +1 -1
  153. package/hooks/useResizeObserver.js +7 -50
  154. package/hooks/useStateWithPromise.js +1 -1
  155. package/hooks/useWindowSize.js +1 -1
  156. package/icon/index.js +1 -1
  157. package/icon-hover/index.js +1 -1
  158. package/icons/file.js +1 -1
  159. package/image/Image.js +2 -2
  160. package/image/ImagePreview.js +17 -52
  161. package/image/ImagePreviewArrow.js +1 -1
  162. package/image/ImagePreviewGroup.js +1 -1
  163. package/image/index.js +1 -1
  164. package/index.js +379 -378
  165. package/input/Button.js +1 -1
  166. package/input/Group.js +1 -1
  167. package/input/Input.js +1 -1
  168. package/input/InputElement.js +1 -1
  169. package/input/Password.js +1 -1
  170. package/input/Search.js +1 -1
  171. package/input/Textarea.js +1 -1
  172. package/input-number/index.js +1 -1
  173. package/input-tag/InputTag.js +1 -1
  174. package/layout/Content.js +1 -1
  175. package/layout/Footer.js +1 -1
  176. package/layout/Header.js +1 -1
  177. package/layout/Sider.js +1 -1
  178. package/layout/index.js +1 -1
  179. package/link/index.js +1 -1
  180. package/liquid-fill/index.js +56 -91
  181. package/list/Item.js +1 -1
  182. package/list/Meta.js +1 -1
  183. package/list/index.js +1 -1
  184. package/loading/index.js +26 -62
  185. package/marquee/index.js +70 -93
  186. package/marquee-/index.js +73 -96
  187. package/mentions/index.js +1 -1
  188. package/menu/Menu.js +3 -3
  189. package/menu/OverflowWrap.js +1 -1
  190. package/menu/index.js +2 -2
  191. package/message/index.js +1 -1
  192. package/message/useMessage.js +1 -1
  193. package/modal/Confirm.js +2 -2
  194. package/modal/Modal.js +2 -2
  195. package/modal/index.js +2 -2
  196. package/notice/index.js +13 -49
  197. package/notification/index.js +1 -1
  198. package/notification/useNotification.js +1 -1
  199. package/overflow-ellipsis/OverflowItem.js +1 -1
  200. package/overflow-ellipsis/index.js +1 -1
  201. package/package.json +1 -1
  202. package/page-header/index.js +1 -1
  203. package/pagination/PageItem.js +1 -1
  204. package/pagination/PageJumper.js +1 -1
  205. package/pagination/PageOption.js +1 -1
  206. package/pagination/Pagination.js +1 -1
  207. package/picker/Input.js +1 -1
  208. package/picker/InputRange.js +1 -1
  209. package/popconfirm/index.js +1 -1
  210. package/popover/index.js +1 -1
  211. package/progress/CircleProgress.js +1 -1
  212. package/progress/index.js +1 -1
  213. package/qr-code/index.js +26 -63
  214. package/radio/Group.js +2 -2
  215. package/radio/GroupBlock.js +2 -2
  216. package/radio/Radio.js +2 -2
  217. package/radio/index.js +2 -2
  218. package/rate/index.js +1 -1
  219. package/resize-box/ResizeTrigger.js +1 -1
  220. package/resize-box/Split.js +1 -1
  221. package/resize-box/SplitGroup.js +1 -1
  222. package/resize-box/index.js +1 -1
  223. package/result/index.js +1 -1
  224. package/rich-text/index.js +6332 -77
  225. package/rich-text/lib/diff/index.d.ts +21 -0
  226. package/row-col/Col-.js +1 -1
  227. package/row-col/Col.js +1 -1
  228. package/row-col/Row.js +1 -1
  229. package/segmented/index.js +118 -153
  230. package/select/Option.js +44 -41
  231. package/select/Select.js +10 -12
  232. package/select-view/Core.js +1 -1
  233. package/skeleton/index.js +1 -1
  234. package/slider/Button.js +1 -1
  235. package/slider/index.js +1 -1
  236. package/space/index.js +23 -59
  237. package/spin/DotLoading.js +1 -1
  238. package/spin/index.js +1 -1
  239. package/splitter/Panel.js +1 -1
  240. package/splitter/SplitBar.js +2 -2
  241. package/splitter/Splitter.js +2 -2
  242. package/statistic/index.js +1 -1
  243. package/steps/index.js +1 -1
  244. package/style.css +1 -1
  245. package/switch/index.js +1 -1
  246. package/table/Table.js +14 -53
  247. package/table/index.js +77 -120
  248. package/tabs/Tab.js +3 -3
  249. package/tabs/TabContent.js +2 -2
  250. package/tabs/TabPane.js +1 -1
  251. package/tabs/index.js +2 -2
  252. package/tag/index.js +1 -1
  253. package/time-picker/Picker.js +1 -1
  254. package/time-picker/TimePicker.js +1 -1
  255. package/timeline/Item.js +1 -1
  256. package/timeline/Timeline.js +1 -1
  257. package/tooltip/index.js +1 -1
  258. package/tour/index.js +80 -116
  259. package/transfer/Item.js +2 -2
  260. package/transfer/List.js +2 -2
  261. package/transfer/index.js +1 -1
  262. package/tree/Animation.js +2 -2
  263. package/tree/Node.js +3 -3
  264. package/tree/NodeList.js +1 -1
  265. package/tree/Tree.js +2 -2
  266. package/tree/index.js +1 -1
  267. package/tree-select/Select.js +3 -3
  268. package/tree-select/index.js +1 -1
  269. package/trigger/index.js +1 -1
  270. package/types/common/hooks/src/use-theme/index.d.ts +2 -2
  271. package/types/common/hooks/useStateWithPromise.d.ts +1 -1
  272. package/types/common/utils/dom.d.ts +12 -0
  273. package/types/pc/carousel/interface.d.ts +2 -2
  274. package/types/pc/color-picker/Panel.d.ts +1 -1
  275. package/types/pc/date-picker/RangePicker.d.ts +1 -1
  276. package/types/pc/index.d.ts +1 -1
  277. package/types/pc/list/interface.d.ts +2 -2
  278. package/types/pc/menu/context.d.ts +1 -1
  279. package/types/pc/rich-text/index.d.ts +7 -4
  280. package/types/pc/rich-text/interface.d.ts +3 -2
  281. package/types/pc/rich-text/{core → lib/core}/editor.d.ts +1 -1
  282. package/types/pc/rich-text/{core → lib/core}/rich.d.ts +3 -7
  283. package/types/pc/rich-text/{core → lib/core}/selection.d.ts +1 -0
  284. package/types/pc/rich-text/{core.d.ts → lib/core.d.ts} +1 -1
  285. package/types/pc/rich-text/lib/delta/AttributeMap.d.ts +15 -0
  286. package/types/pc/rich-text/lib/delta/Op.d.ts +13 -0
  287. package/types/pc/rich-text/lib/delta/OpIterator.d.ts +14 -0
  288. package/types/pc/rich-text/lib/delta/index.d.ts +53 -0
  289. package/types/pc/rich-text/lib/diff/index.d.ts +40 -0
  290. package/types/pc/rich-text/{formats → lib/formats}/bold.d.ts +1 -1
  291. package/types/pc/rich-text/{formats → lib/formats}/font.d.ts +1 -1
  292. package/types/pc/rich-text/lib/formats/hr.d.ts +5 -0
  293. package/types/pc/rich-text/lib/formats/image-resize/index.d.ts +27 -0
  294. package/types/pc/rich-text/lib/formats/image-resize/modules/BaseModule.d.ts +10 -0
  295. package/types/pc/rich-text/lib/formats/image-resize/modules/DisplaySize.d.ts +5 -0
  296. package/types/pc/rich-text/lib/formats/image-resize/modules/Resize.d.ts +13 -0
  297. package/types/pc/rich-text/lib/formats/image-resize/options.d.ts +7 -0
  298. package/types/pc/rich-text/lib/formats/liOl.d.ts +10 -0
  299. package/types/pc/rich-text/lib/formats/liUl.d.ts +10 -0
  300. package/types/pc/rich-text/lib/formats/lineHeight.d.ts +3 -0
  301. package/types/pc/rich-text/{formats → lib/formats}/list.d.ts +1 -0
  302. package/types/pc/rich-text/{formats → lib/formats}/table.d.ts +3 -3
  303. package/types/pc/rich-text/{modules → lib/modules}/clipboard.d.ts +2 -2
  304. package/types/pc/rich-text/{modules → lib/modules}/history.d.ts +1 -1
  305. package/types/pc/rich-text/{modules → lib/modules}/keyboard.d.ts +1 -1
  306. package/types/pc/rich-text/{modules → lib/modules}/syntax.d.ts +2 -2
  307. package/types/pc/rich-text/{modules → lib/modules}/tableEmbed.d.ts +3 -3
  308. package/types/pc/rich-text/{modules → lib/modules}/toolbar.d.ts +1 -1
  309. package/types/pc/rich-text/{parchment → lib/parchment}/attributor/attributor.d.ts +3 -3
  310. package/types/pc/rich-text/{parchment → lib/parchment}/attributor/style.d.ts +2 -2
  311. package/types/pc/rich-text/{ui → lib/ui}/icons.d.ts +5 -1
  312. package/types/pc/rich-text/{ui → lib/ui}/picker.d.ts +1 -0
  313. package/types/pc/tabs/hook/useDomSize.d.ts +2 -2
  314. package/types/pc/tabs/hook/useHeaderScroll.d.ts +2 -2
  315. package/types/pc/tree-select/hook/useStateValue.d.ts +2 -2
  316. package/types/pc/utils/date.d.ts +1 -0
  317. package/types/pc/utils/index.d.ts +2 -2
  318. package/typography/Base.js +1 -1
  319. package/typography/Ellipsis.js +70 -114
  320. package/typography/Operations.js +29 -74
  321. package/typography/Paragraph.js +1 -1
  322. package/typography/Typography.js +1 -1
  323. package/upload/TriggerNode.js +1 -1
  324. package/upload/Upload.js +1 -1
  325. package/utils/contextHolder.js +1 -1
  326. package/utils/date.js +1 -0
  327. package/utils/index.js +70 -70
  328. package/verification-code/VerificationCode.js +1 -1
  329. package/version/index.js +1 -1
  330. package/virtual-list/VirtualList.js +218 -217
  331. package/watermark/Watermark.js +1 -1
  332. package/chunk/BCmfDFV4.js +0 -4237
  333. package/chunk/BG6j6Ct7.js +0 -30
  334. package/chunk/C5CbL5ku.js +0 -56
  335. package/chunk/DsuIQH0F.js +0 -200
  336. package/chunk/vP3qfmKM.js +0 -84
  337. package/rich-text/core.js +0 -11
  338. package/rich-text/rich.js +0 -1347
  339. package/types/common/utils/index.d.ts +0 -47
  340. package/types/common/utils/keyboardCode.d.ts +0 -4
  341. package/types/common/utils/math.d.ts +0 -1
  342. package/types/common/utils/reactTransitionGroup.d.ts +0 -1
  343. package/types/common/utils/uuid.d.ts +0 -1
  344. package/types/common/utils/validate.d.ts +0 -1
  345. package/types/pc/rich-text/delta/AttributeMap.d.ts +0 -10
  346. package/types/pc/rich-text/delta/Op.d.ts +0 -11
  347. package/types/pc/rich-text/delta/OpIterator.d.ts +0 -13
  348. package/types/pc/rich-text/delta/index.d.ts +0 -45
  349. package/types/common/hooks/src/utils/{index.d.ts → is.d.ts} +0 -0
  350. package/types/pc/rich-text/{blots → lib/blots}/block.d.ts +0 -0
  351. package/types/pc/rich-text/{blots → lib/blots}/break.d.ts +0 -0
  352. package/types/pc/rich-text/{blots → lib/blots}/container.d.ts +0 -0
  353. package/types/pc/rich-text/{blots → lib/blots}/cursor.d.ts +0 -0
  354. package/types/pc/rich-text/{blots → lib/blots}/embed.d.ts +0 -0
  355. package/types/pc/rich-text/{blots → lib/blots}/inline.d.ts +0 -0
  356. package/types/pc/rich-text/{blots → lib/blots}/scroll.d.ts +0 -0
  357. package/types/pc/rich-text/{blots → lib/blots}/text.d.ts +0 -0
  358. package/types/pc/rich-text/{core → lib/core}/composition.d.ts +0 -0
  359. package/types/pc/rich-text/{core → lib/core}/emitter.d.ts +0 -0
  360. package/types/pc/rich-text/{core → lib/core}/instances.d.ts +0 -0
  361. package/types/pc/rich-text/{core → lib/core}/logger.d.ts +0 -0
  362. package/types/pc/rich-text/{core → lib/core}/module.d.ts +0 -0
  363. package/types/pc/rich-text/{core → lib/core}/theme.d.ts +0 -0
  364. package/types/pc/rich-text/{core → lib/core}/utils/createRegistryWithFormats.d.ts +0 -0
  365. package/types/pc/rich-text/{core → lib/core}/utils/scrollRectIntoView.d.ts +0 -0
  366. package/types/pc/rich-text/{formats → lib/formats}/align.d.ts +0 -0
  367. package/types/pc/rich-text/{formats → lib/formats}/background.d.ts +0 -0
  368. package/types/pc/rich-text/{formats → lib/formats}/blockquote.d.ts +0 -0
  369. package/types/pc/rich-text/{formats → lib/formats}/code.d.ts +0 -0
  370. package/types/pc/rich-text/{formats → lib/formats}/color.d.ts +0 -0
  371. package/types/pc/rich-text/{formats → lib/formats}/direction.d.ts +0 -0
  372. package/types/pc/rich-text/{formats → lib/formats}/formula.d.ts +0 -0
  373. package/types/pc/rich-text/{formats → lib/formats}/header.d.ts +0 -0
  374. package/types/pc/rich-text/{formats → lib/formats}/image.d.ts +0 -0
  375. package/types/pc/rich-text/{formats → lib/formats}/indent.d.ts +0 -0
  376. package/types/pc/rich-text/{formats → lib/formats}/italic.d.ts +0 -0
  377. package/types/pc/rich-text/{formats → lib/formats}/link.d.ts +0 -0
  378. package/types/pc/rich-text/{formats → lib/formats}/script.d.ts +0 -0
  379. package/types/pc/rich-text/{formats → lib/formats}/size.d.ts +0 -0
  380. package/types/pc/rich-text/{formats → lib/formats}/strike.d.ts +0 -0
  381. package/types/pc/rich-text/{formats → lib/formats}/underline.d.ts +0 -0
  382. package/types/pc/rich-text/{formats → lib/formats}/video.d.ts +0 -0
  383. package/types/pc/rich-text/{rich.d.ts → lib/index.d.ts} +0 -0
  384. package/types/pc/rich-text/{modules → lib/modules}/input.d.ts +0 -0
  385. package/types/pc/rich-text/{modules → lib/modules}/normalizeExternalHTML/index.d.ts +0 -0
  386. package/types/pc/rich-text/{modules → lib/modules}/normalizeExternalHTML/normalizers/googleDocs.d.ts +0 -0
  387. package/types/pc/rich-text/{modules → lib/modules}/normalizeExternalHTML/normalizers/msWord.d.ts +0 -0
  388. package/types/pc/rich-text/{modules → lib/modules}/table.d.ts +0 -0
  389. package/types/pc/rich-text/{modules → lib/modules}/uiNode.d.ts +0 -0
  390. package/types/pc/rich-text/{modules → lib/modules}/uploader.d.ts +0 -0
  391. package/types/pc/rich-text/{parchment → lib/parchment}/attributor/class.d.ts +0 -0
  392. package/types/pc/rich-text/{parchment → lib/parchment}/attributor/store.d.ts +0 -0
  393. package/types/pc/rich-text/{parchment → lib/parchment}/blot/abstract/blot.d.ts +0 -0
  394. package/types/pc/rich-text/{parchment → lib/parchment}/blot/abstract/container.d.ts +0 -0
  395. package/types/pc/rich-text/{parchment → lib/parchment}/blot/abstract/leaf.d.ts +0 -0
  396. package/types/pc/rich-text/{parchment → lib/parchment}/blot/abstract/parent.d.ts +0 -0
  397. package/types/pc/rich-text/{parchment → lib/parchment}/blot/abstract/shadow.d.ts +0 -0
  398. package/types/pc/rich-text/{parchment → lib/parchment}/blot/block.d.ts +0 -0
  399. package/types/pc/rich-text/{parchment → lib/parchment}/blot/embed.d.ts +0 -0
  400. package/types/pc/rich-text/{parchment → lib/parchment}/blot/inline.d.ts +0 -0
  401. package/types/pc/rich-text/{parchment → lib/parchment}/blot/scroll.d.ts +0 -0
  402. package/types/pc/rich-text/{parchment → lib/parchment}/blot/text.d.ts +0 -0
  403. package/types/pc/rich-text/{parchment → lib/parchment}/collection/linked-list.d.ts +0 -0
  404. package/types/pc/rich-text/{parchment → lib/parchment}/collection/linked-node.d.ts +0 -0
  405. package/types/pc/rich-text/{parchment → lib/parchment}/error.d.ts +0 -0
  406. package/types/pc/rich-text/{parchment → lib/parchment}/index.d.ts +1 -1
  407. /package/types/pc/rich-text/{parchment → lib/parchment}/registry.d.ts +0 -0
  408. /package/types/pc/rich-text/{parchment → lib/parchment}/scope.d.ts +0 -0
  409. /package/types/pc/rich-text/{themes → lib/themes}/base.d.ts +0 -0
  410. /package/types/pc/rich-text/{themes → lib/themes}/pqb.d.ts +0 -0
  411. /package/types/pc/rich-text/{ui → lib/ui}/color-picker.d.ts +0 -0
  412. /package/types/pc/rich-text/{ui → lib/ui}/icon-picker.d.ts +0 -0
  413. /package/types/pc/rich-text/{ui → lib/ui}/tooltip.d.ts +0 -0
package/rich-text/rich.js DELETED
@@ -1,1347 +0,0 @@
1
- import { S as M, C as G, B as N, b as T, R as n, c as w, E as ht, d as W, e as dt, f as ut, T as pt, g as ft, h as m, i as bt, j as xt, D as A, k as X, M as H, t as gt, n as mt, l as K, m as p, a as yt, o as vt, F as kt, p as At, q as Q, r as J, s as wt, u as Y, v as tt, w as et, x as qt, y as Et, z as st, G as St, H as Lt } from "../chunk/BCmfDFV4.js";
2
- import { A as De, O as Pe, I as Fe, P as ze } from "../chunk/BCmfDFV4.js";
3
- import { RICH_TEXT_CLASS_NAME_PREFIX as o } from "./constant.js";
4
- import it from "lodash/merge";
5
- import { names as Nt } from "@unicom-cloud/utils/tinycolor";
6
- import * as Tt from "@unicom-cloud/utils/ui-color";
7
- class It extends G {
8
- add(t, e) {
9
- let s = 0;
10
- if (e === "+1" || e === "-1") {
11
- const i = this.value(t) || 0;
12
- s = e === "+1" ? i + 1 : i - 1;
13
- } else typeof e == "number" && (s = e);
14
- return s === 0 ? (this.remove(t), !0) : super.add(t, s.toString());
15
- }
16
- canAdd(t, e) {
17
- return super.canAdd(t, e) || super.canAdd(t, parseInt(e, 10));
18
- }
19
- value(t) {
20
- return parseInt(super.value(t), 10) || void 0;
21
- }
22
- }
23
- const Ct = new It(
24
- "indent",
25
- `${o}-indent`,
26
- {
27
- scope: M.BLOCK,
28
- whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
29
- }
30
- );
31
- class $t extends N {
32
- static {
33
- this.blotName = "blockquote";
34
- }
35
- static {
36
- this.tagName = "blockquote";
37
- }
38
- }
39
- class Rt extends N {
40
- static {
41
- this.blotName = "header";
42
- }
43
- static {
44
- this.tagName = ["H1", "H2", "H3", "H4", "H5", "H6"];
45
- }
46
- static formats(t) {
47
- return this.tagName.indexOf(t.tagName) + 1;
48
- }
49
- }
50
- class q extends T {
51
- }
52
- q.blotName = "list-container";
53
- q.tagName = "OL";
54
- class E extends N {
55
- static create(t) {
56
- const e = super.create();
57
- return e.setAttribute("data-list", t), e;
58
- }
59
- static formats(t) {
60
- return t.getAttribute("data-list") || void 0;
61
- }
62
- static register() {
63
- n.register(q);
64
- }
65
- constructor(t, e) {
66
- super(t, e);
67
- const s = e.ownerDocument.createElement("span"), i = (r) => {
68
- if (!t.isEnabled()) return;
69
- const a = this.statics.formats(e, t);
70
- a === "checked" ? (this.format("list", "unchecked"), r.preventDefault()) : a === "unchecked" && (this.format("list", "checked"), r.preventDefault());
71
- };
72
- s.addEventListener("mousedown", i), s.addEventListener("touchstart", i), this.attachUI(s);
73
- }
74
- format(t, e) {
75
- t === this.statics.blotName && e ? this.domNode.setAttribute("data-list", e) : super.format(t, e);
76
- }
77
- }
78
- E.blotName = "list";
79
- E.tagName = "LI";
80
- q.allowedChildren = [E];
81
- E.requiredContainer = q;
82
- class B extends w {
83
- static {
84
- this.blotName = "bold";
85
- }
86
- static {
87
- this.tagName = ["STRONG", "B"];
88
- }
89
- static create() {
90
- return super.create();
91
- }
92
- static formats() {
93
- return !0;
94
- }
95
- optimize(t) {
96
- super.optimize(t), this.domNode.tagName !== this.statics.tagName[0] && this.replaceWith(this.statics.blotName);
97
- }
98
- }
99
- class Mt extends B {
100
- static {
101
- this.blotName = "italic";
102
- }
103
- static {
104
- this.tagName = ["EM", "I"];
105
- }
106
- }
107
- class S extends w {
108
- static {
109
- this.blotName = "link";
110
- }
111
- static {
112
- this.tagName = "A";
113
- }
114
- static {
115
- this.SANITIZED_URL = "about:blank";
116
- }
117
- static {
118
- this.PROTOCOL_WHITELIST = ["http", "https", "mailto", "tel", "sms"];
119
- }
120
- static create(t) {
121
- const e = super.create(t);
122
- return e.setAttribute("href", this.sanitize(t)), e.setAttribute("rel", "noopener noreferrer"), e.setAttribute("target", "_blank"), e;
123
- }
124
- static formats(t) {
125
- return t.getAttribute("href");
126
- }
127
- static sanitize(t) {
128
- return rt(t, this.PROTOCOL_WHITELIST) ? t : this.SANITIZED_URL;
129
- }
130
- format(t, e) {
131
- t !== this.statics.blotName || !e ? super.format(t, e) : this.domNode.setAttribute("href", this.constructor.sanitize(e));
132
- }
133
- }
134
- function rt(l, t) {
135
- const e = document.createElement("a");
136
- e.href = l;
137
- const s = e.href.slice(0, e.href.indexOf(":"));
138
- return t.indexOf(s) > -1;
139
- }
140
- class Ht extends w {
141
- static {
142
- this.blotName = "script";
143
- }
144
- static {
145
- this.tagName = ["SUB", "SUP"];
146
- }
147
- static create(t) {
148
- return t === "super" ? document.createElement("sup") : t === "sub" ? document.createElement("sub") : super.create(t);
149
- }
150
- static formats(t) {
151
- if (t.tagName === "SUB") return "sub";
152
- if (t.tagName === "SUP") return "super";
153
- }
154
- }
155
- class Bt extends B {
156
- static {
157
- this.blotName = "strike";
158
- }
159
- static {
160
- this.tagName = ["S", "STRIKE"];
161
- }
162
- }
163
- class Ot extends w {
164
- static {
165
- this.blotName = "underline";
166
- }
167
- static {
168
- this.tagName = "U";
169
- }
170
- }
171
- class Vt extends ht {
172
- static {
173
- this.blotName = "formula";
174
- }
175
- static {
176
- this.className = `${o}-formula`;
177
- }
178
- static {
179
- this.tagName = "SPAN";
180
- }
181
- static create(t) {
182
- if (window.katex == null)
183
- throw new Error("Formula module requires KaTeX.");
184
- const e = super.create(t);
185
- return typeof t == "string" && (window.katex.render(t, e, {
186
- throwOnError: !1,
187
- errorColor: "#f00"
188
- }), e.setAttribute("data-value", t)), e;
189
- }
190
- static value(t) {
191
- return t.getAttribute("data-value");
192
- }
193
- html() {
194
- const { formula: t } = this.value();
195
- return `<span>${t}</span>`;
196
- }
197
- }
198
- const Z = ["alt", "height", "width"];
199
- class Ut extends W {
200
- static {
201
- this.blotName = "image";
202
- }
203
- static {
204
- this.tagName = "IMG";
205
- }
206
- static create(t) {
207
- const e = super.create(t);
208
- return typeof t == "string" && e.setAttribute("src", this.sanitize(t)), e;
209
- }
210
- static formats(t) {
211
- return Z.reduce(
212
- (e, s) => (t.hasAttribute(s) && (e[s] = t.getAttribute(s)), e),
213
- {}
214
- );
215
- }
216
- static match(t) {
217
- return /\.(jpe?g|gif|png)$/.test(t) || /^data:image\/.+;base64/.test(t);
218
- }
219
- static sanitize(t) {
220
- return rt(t, ["http", "https", "data"]) ? t : "//:0";
221
- }
222
- static value(t) {
223
- return t.getAttribute("src");
224
- }
225
- format(t, e) {
226
- Z.indexOf(t) > -1 ? e ? this.domNode.setAttribute(t, e) : this.domNode.removeAttribute(t) : super.format(t, e);
227
- }
228
- }
229
- const D = ["height", "width"];
230
- class Zt extends dt {
231
- static {
232
- this.blotName = "video";
233
- }
234
- static {
235
- this.className = `${o}-video`;
236
- }
237
- static {
238
- this.tagName = "IFRAME";
239
- }
240
- static create(t) {
241
- const e = super.create(t);
242
- return e.setAttribute("frameborder", "0"), e.setAttribute("allowfullscreen", "true"), e.setAttribute("src", this.sanitize(t)), e;
243
- }
244
- static formats(t) {
245
- return D.reduce(
246
- (e, s) => (t.hasAttribute(s) && (e[s] = t.getAttribute(s)), e),
247
- {}
248
- );
249
- }
250
- static sanitize(t) {
251
- return S.sanitize(t);
252
- }
253
- static value(t) {
254
- return t.getAttribute("src");
255
- }
256
- format(t, e) {
257
- D.indexOf(t) > -1 ? e ? this.domNode.setAttribute(t, e) : this.domNode.removeAttribute(t) : super.format(t, e);
258
- }
259
- html() {
260
- const { video: t } = this.value();
261
- return `<a href="${t}">${t}</a>`;
262
- }
263
- }
264
- const v = new G("code-token", "hljs", {
265
- scope: M.INLINE
266
- });
267
- class f extends w {
268
- static formats(t, e) {
269
- for (; t != null && t !== e.domNode; ) {
270
- if (t.classList && t.classList.contains(m.className))
271
- return super.formats(t, e);
272
- t = t.parentNode;
273
- }
274
- }
275
- constructor(t, e, s) {
276
- super(t, e, s), v.add(this.domNode, s);
277
- }
278
- format(t, e) {
279
- t !== f.blotName ? super.format(t, e) : e ? v.add(this.domNode, e) : (v.remove(this.domNode), this.domNode.classList.remove(this.statics.className));
280
- }
281
- optimize(...t) {
282
- super.optimize(...t), v.value(this.domNode) || this.unwrap();
283
- }
284
- }
285
- f.blotName = "code-token";
286
- f.className = `${o}-token`;
287
- class h extends m {
288
- static create(t) {
289
- const e = super.create(t);
290
- return typeof t == "string" && e.setAttribute("data-language", t), e;
291
- }
292
- static formats(t) {
293
- return t.getAttribute("data-language") || "plain";
294
- }
295
- static register() {
296
- }
297
- // Syntax module will register
298
- format(t, e) {
299
- t === this.statics.blotName && e ? this.domNode.setAttribute("data-language", e) : super.format(t, e);
300
- }
301
- replaceWith(t, e) {
302
- return this.formatAt(0, this.length(), f.blotName, !1), super.replaceWith(t, e);
303
- }
304
- }
305
- class k extends bt {
306
- attach() {
307
- super.attach(), this.forceNext = !1, this.scroll.emitMount(this);
308
- }
309
- format(t, e) {
310
- t === h.blotName && (this.forceNext = !0, this.children.forEach((s) => {
311
- s.format(t, e);
312
- }));
313
- }
314
- formatAt(t, e, s, i) {
315
- s === h.blotName && (this.forceNext = !0), super.formatAt(t, e, s, i);
316
- }
317
- highlight(t, e = !1) {
318
- if (this.children.head == null) return;
319
- const i = `${Array.from(this.domNode.childNodes).filter(
320
- (a) => a !== this.uiNode
321
- ).map((a) => a.textContent).join(`
322
- `)}
323
- `, r = h.formats(this.children.head.domNode);
324
- if (e || this.forceNext || this.cachedText !== i) {
325
- if (i.trim().length > 0 || this.cachedText == null) {
326
- const a = this.children.reduce((u, x) => u.concat(xt(x, !1)), new A()), c = t(i, r);
327
- a.diff(c).reduce((u, { retain: x, attributes: C }) => x ? (C && Object.keys(C).forEach(($) => {
328
- [h.blotName, f.blotName].includes($) && this.formatAt(u, x, $, C[$]);
329
- }), u + x) : u, 0);
330
- }
331
- this.cachedText = i, this.forceNext = !1;
332
- }
333
- }
334
- html(t, e) {
335
- const [s] = this.children.find(t);
336
- return `<pre data-language="${s ? h.formats(s.domNode) : "plain"}">
337
- ${X(
338
- this.code(t, e)
339
- )}
340
- </pre>`;
341
- }
342
- optimize(t) {
343
- if (super.optimize(t), this.parent != null && this.children.head != null && this.uiNode != null) {
344
- const e = h.formats(this.children.head.domNode);
345
- e !== this.uiNode.value && (this.uiNode.value = e);
346
- }
347
- }
348
- }
349
- k.allowedChildren = [h];
350
- h.requiredContainer = k;
351
- h.allowedChildren = [f, ut, pt, ft];
352
- const Dt = (l, t, e) => {
353
- if (typeof l.versionString == "string") {
354
- const s = l.versionString.split(".")[0];
355
- if (parseInt(s, 10) >= 11)
356
- return l.highlight(e, { language: t }).value;
357
- }
358
- return l.highlight(t, e).value;
359
- };
360
- class lt extends H {
361
- static register() {
362
- n.register(f, !0), n.register(h, !0), n.register(k, !0);
363
- }
364
- constructor(t, e) {
365
- if (super(t, e), this.options.hljs == null)
366
- throw new Error(
367
- "Syntax module requires highlight.js. Please include the library on the page before Rich."
368
- );
369
- this.languages = this.options.languages.reduce(
370
- (s, { key: i }) => (s[i] = !0, s),
371
- {}
372
- ), this.highlightBlot = this.highlightBlot.bind(this), this.initListener(), this.initTimer();
373
- }
374
- initListener() {
375
- this.rich.on(n.events.SCROLL_BLOT_MOUNT, (t) => {
376
- if (!(t instanceof k)) return;
377
- const e = this.rich.root.ownerDocument.createElement("select");
378
- this.options.languages.forEach(({ key: s, label: i }) => {
379
- const r = e.ownerDocument.createElement("option");
380
- r.textContent = i, r.setAttribute("value", s), e.appendChild(r);
381
- }), e.addEventListener("change", () => {
382
- t.format(h.blotName, e.value), this.rich.root.focus(), this.highlight(t, !0);
383
- }), t.uiNode == null && (t.attachUI(e), t.children.head && (e.value = h.formats(t.children.head.domNode)));
384
- });
385
- }
386
- initTimer() {
387
- let t = null;
388
- this.rich.on(n.events.SCROLL_OPTIMIZE, () => {
389
- t && clearTimeout(t), t = setTimeout(() => {
390
- this.highlight(), t = null;
391
- }, this.options.interval);
392
- });
393
- }
394
- highlight(t = null, e = !1) {
395
- if (this.rich.selection.composing) return;
396
- this.rich.update(n.sources.USER);
397
- const s = this.rich.getSelection();
398
- (t == null ? this.rich.scroll.descendants(k) : [t]).forEach((r) => {
399
- r.highlight(this.highlightBlot, e);
400
- }), this.rich.update(n.sources.SILENT), s != null && this.rich.setSelection(s, n.sources.SILENT);
401
- }
402
- highlightBlot(t, e = "plain") {
403
- if (e = this.languages[e] ? e : "plain", e === "plain")
404
- return X(t).split(`
405
- `).reduce((i, r, a) => (a !== 0 && i.insert(`
406
- `, { [m.blotName]: e }), i.insert(r)), new A());
407
- const s = this.rich.root.ownerDocument.createElement("div");
408
- return s.classList.add(m.className), s.innerHTML = Dt(this.options.hljs, e, t), gt(
409
- this.rich.scroll,
410
- s,
411
- [
412
- (i, r) => {
413
- const a = v.value(i);
414
- return a ? r.compose(
415
- new A().retain(r.length(), {
416
- [f.blotName]: a
417
- })
418
- ) : r;
419
- }
420
- ],
421
- [
422
- (i, r) => i.data.split(`
423
- `).reduce((a, c, u) => (u !== 0 && a.insert(`
424
- `, { [m.blotName]: e }), a.insert(c)), r)
425
- ],
426
- /* @__PURE__ */ new WeakMap()
427
- );
428
- }
429
- }
430
- lt.DEFAULTS = {
431
- hljs: window.hljs,
432
- interval: 1e3,
433
- languages: [
434
- { key: "plain", label: "Plain" },
435
- { key: "bash", label: "Bash" },
436
- { key: "cpp", label: "C++" },
437
- { key: "cs", label: "C#" },
438
- { key: "css", label: "CSS" },
439
- { key: "diff", label: "Diff" },
440
- { key: "xml", label: "HTML/XML" },
441
- { key: "java", label: "Java" },
442
- { key: "javascript", label: "JavaScript" },
443
- { key: "markdown", label: "Markdown" },
444
- { key: "php", label: "PHP" },
445
- { key: "python", label: "Python" },
446
- { key: "ruby", label: "Ruby" },
447
- { key: "sql", label: "SQL" }
448
- ]
449
- };
450
- class d extends N {
451
- static {
452
- this.blotName = "table";
453
- }
454
- static {
455
- this.tagName = "TD";
456
- }
457
- static create(t) {
458
- const e = super.create();
459
- return t ? e.setAttribute("data-row", t) : e.setAttribute("data-row", O()), e;
460
- }
461
- static formats(t) {
462
- if (t.hasAttribute("data-row"))
463
- return t.getAttribute("data-row");
464
- }
465
- cellOffset() {
466
- return this.parent ? this.parent.children.indexOf(this) : -1;
467
- }
468
- format(t, e) {
469
- t === d.blotName && e ? this.domNode.setAttribute("data-row", e) : super.format(t, e);
470
- }
471
- row() {
472
- return this.parent;
473
- }
474
- rowOffset() {
475
- return this.row() ? this.row().rowOffset() : -1;
476
- }
477
- table() {
478
- return this.row() && this.row().table();
479
- }
480
- }
481
- class g extends T {
482
- static {
483
- this.blotName = "table-row";
484
- }
485
- static {
486
- this.tagName = "TR";
487
- }
488
- checkMerge() {
489
- if (super.checkMerge() && this.next.children.head != null) {
490
- const t = this.children.head.formats(), e = this.children.tail.formats(), s = this.next.children.head.formats(), i = this.next.children.tail.formats();
491
- return t.table === e.table && t.table === s.table && t.table === i.table;
492
- }
493
- return !1;
494
- }
495
- optimize(t) {
496
- super.optimize(t), this.children.forEach((e) => {
497
- if (e.next == null) return;
498
- const s = e.formats(), i = e.next.formats();
499
- if (s.table !== i.table) {
500
- const r = this.splitAfter(e);
501
- r && r.optimize(), this.prev && this.prev.optimize();
502
- }
503
- });
504
- }
505
- rowOffset() {
506
- return this.parent ? this.parent.children.indexOf(this) : -1;
507
- }
508
- table() {
509
- return this.parent && this.parent.parent;
510
- }
511
- }
512
- class b extends T {
513
- static {
514
- this.blotName = "table-body";
515
- }
516
- static {
517
- this.tagName = "TBODY";
518
- }
519
- }
520
- class L extends T {
521
- static {
522
- this.blotName = "table-container";
523
- }
524
- static {
525
- this.tagName = "TABLE";
526
- }
527
- balanceCells() {
528
- const t = this.descendants(g), e = t.reduce((s, i) => Math.max(i.children.length, s), 0);
529
- t.forEach((s) => {
530
- new Array(e - s.children.length).fill(0).forEach(() => {
531
- let i;
532
- s.children.head != null && (i = d.formats(s.children.head.domNode));
533
- const r = this.scroll.create(d.blotName, i);
534
- s.appendChild(r), r.optimize();
535
- });
536
- });
537
- }
538
- cells(t) {
539
- return this.rows().map((e) => e.children.at(t));
540
- }
541
- deleteColumn(t) {
542
- const [e] = this.descendant(b);
543
- e == null || e.children.head == null || e.children.forEach((s) => {
544
- const i = s.children.at(t);
545
- i?.remove();
546
- });
547
- }
548
- insertColumn(t) {
549
- const [e] = this.descendant(b);
550
- e == null || e.children.head == null || e.children.forEach((s) => {
551
- const i = s.children.at(t), r = d.formats(s.children.head.domNode), a = this.scroll.create(d.blotName, r);
552
- s.insertBefore(a, i);
553
- });
554
- }
555
- insertRow(t) {
556
- const [e] = this.descendant(b);
557
- if (e == null || e.children.head == null) return;
558
- const s = O(), i = this.scroll.create(g.blotName);
559
- e.children.head.children.forEach(() => {
560
- const a = this.scroll.create(d.blotName, s);
561
- i.appendChild(a);
562
- });
563
- const r = e.children.at(t);
564
- e.insertBefore(i, r);
565
- }
566
- rows() {
567
- const t = this.children.head;
568
- return t == null ? [] : t.children.map((e) => e);
569
- }
570
- }
571
- L.allowedChildren = [b];
572
- b.requiredContainer = L;
573
- b.allowedChildren = [g];
574
- g.requiredContainer = b;
575
- g.allowedChildren = [d];
576
- d.requiredContainer = g;
577
- function O() {
578
- return `row-${Math.random().toString(36).slice(2, 6)}`;
579
- }
580
- class Pt extends H {
581
- static register() {
582
- n.register(d), n.register(g), n.register(b), n.register(L);
583
- }
584
- constructor(...t) {
585
- super(...t), this.listenBalanceCells();
586
- }
587
- balanceTables() {
588
- this.rich.scroll.descendants(L).forEach((t) => {
589
- t.balanceCells();
590
- });
591
- }
592
- deleteColumn() {
593
- const [t, , e] = this.getTable();
594
- e != null && (t.deleteColumn(e.cellOffset()), this.rich.update(n.sources.USER));
595
- }
596
- deleteRow() {
597
- const [, t] = this.getTable();
598
- t != null && (t.remove(), this.rich.update(n.sources.USER));
599
- }
600
- deleteTable() {
601
- const [t] = this.getTable();
602
- if (t == null) return;
603
- const e = t.offset();
604
- t.remove(), this.rich.update(n.sources.USER), this.rich.setSelection(e, n.sources.SILENT);
605
- }
606
- getTable(t = this.rich.getSelection()) {
607
- if (t == null) return [null, null, null, -1];
608
- const [e, s] = this.rich.getLine(t.index);
609
- if (e == null || e.statics.blotName !== d.blotName)
610
- return [null, null, null, -1];
611
- const i = e.parent;
612
- return [i.parent.parent, i, e, s];
613
- }
614
- insertColumn(t) {
615
- const e = this.rich.getSelection();
616
- if (!e) return;
617
- const [s, i, r] = this.getTable(e);
618
- if (r == null) return;
619
- const a = r.cellOffset();
620
- s.insertColumn(a + t), this.rich.update(n.sources.USER);
621
- let c = i.rowOffset();
622
- t === 0 && (c += 1), this.rich.setSelection(
623
- e.index + c,
624
- e.length,
625
- n.sources.SILENT
626
- );
627
- }
628
- insertColumnLeft() {
629
- this.insertColumn(0);
630
- }
631
- insertColumnRight() {
632
- this.insertColumn(1);
633
- }
634
- insertRow(t) {
635
- const e = this.rich.getSelection();
636
- if (!e) return;
637
- const [s, i, r] = this.getTable(e);
638
- if (r == null) return;
639
- const a = i.rowOffset();
640
- s.insertRow(a + t), this.rich.update(n.sources.USER), t > 0 ? this.rich.setSelection(e, n.sources.SILENT) : this.rich.setSelection(
641
- e.index + i.children.length,
642
- e.length,
643
- n.sources.SILENT
644
- );
645
- }
646
- insertRowAbove() {
647
- this.insertRow(0);
648
- }
649
- insertRowBelow() {
650
- this.insertRow(1);
651
- }
652
- insertTable(t, e) {
653
- const s = this.rich.getSelection();
654
- if (s == null) return;
655
- const i = new Array(t).fill(0).reduce((r) => {
656
- const a = new Array(e).fill(`
657
- `).join("");
658
- return r.insert(a, { table: O() });
659
- }, new A().retain(s.index));
660
- this.rich.updateContents(i, n.sources.USER), this.rich.setSelection(s.index, n.sources.SILENT), this.balanceTables();
661
- }
662
- listenBalanceCells() {
663
- this.rich.on(n.events.SCROLL_OPTIMIZE, (t) => {
664
- t.some((e) => ["TD", "TR", "TBODY", "TABLE"].includes(
665
- e.target.tagName
666
- ) ? (this.rich.once(n.events.TEXT_CHANGE, (s, i, r) => {
667
- r === n.sources.USER && this.balanceTables();
668
- }), !0) : !1);
669
- });
670
- }
671
- }
672
- const P = mt("rich:toolbar");
673
- class V extends H {
674
- constructor(t, e) {
675
- if (super(t, e), Array.isArray(this.options.container) ? (this.container = document.createElement("div"), this.container.setAttribute("role", "toolbar"), Ft(this.container, this.options.container), t.container?.parentNode?.insertBefore(this.container, t.container)) : typeof this.options.container == "string" ? this.container = document.querySelector(this.options.container) : this.container = this.options.container, !(this.container instanceof HTMLElement)) {
676
- P.error("Container required for toolbar", this.options);
677
- return;
678
- }
679
- this.container.classList.add(`${o}-toolbar`), this.controls = [], this.handlers = {}, this.options.handlers && Object.keys(this.options.handlers).forEach((s) => {
680
- const i = this.options.handlers?.[s];
681
- i && this.addHandler(s, i);
682
- }), Array.from(this.container.querySelectorAll("button, select")).forEach(
683
- (s) => {
684
- this.attach(s);
685
- }
686
- ), this.rich.on(n.events.EDITOR_CHANGE, () => {
687
- const [s] = this.rich.selection.getRange();
688
- this.update(s);
689
- });
690
- }
691
- addHandler(t, e) {
692
- this.handlers[t] = e;
693
- }
694
- attach(t) {
695
- let e = Array.from(t.classList).find((i) => i.indexOf(`${o}-`) === 0);
696
- if (!e) return;
697
- if (e = e.slice(`${o}-`.length), t.tagName === "BUTTON" && t.setAttribute("type", "button"), this.handlers[e] == null && this.rich.scroll.query(e) == null) {
698
- P.warn("ignoring attaching to nonexistent format", e, t);
699
- return;
700
- }
701
- const s = t.tagName === "SELECT" ? "change" : "click";
702
- t.addEventListener(s, (i) => {
703
- let r;
704
- if (t.tagName === "SELECT") {
705
- if (t.selectedIndex < 0)
706
- return;
707
- const c = t.options[t.selectedIndex];
708
- c.hasAttribute("selected") ? r = !1 : r = c.value || !1;
709
- } else
710
- t.classList.contains(`${o}-active`) ? r = !1 : r = t.value || !t.hasAttribute("value"), i.preventDefault();
711
- this.rich.focus();
712
- const [a] = this.rich.selection.getRange();
713
- if (this.handlers[e] != null)
714
- this.handlers[e].call(this, r);
715
- else if (this.rich.scroll.query(e).prototype instanceof W) {
716
- if (r = prompt(`Enter ${e}`), !r) return;
717
- this.rich.updateContents(
718
- new A().retain(a.index).delete(a.length).insert({ [e]: r }),
719
- n.sources.USER
720
- );
721
- } else
722
- this.rich.format(e, r, n.sources.USER);
723
- this.update(a);
724
- }), this.controls.push([e, t]);
725
- }
726
- update(t) {
727
- const e = t == null ? {} : this.rich.getFormat(t);
728
- this.controls.forEach((s) => {
729
- const [i, r] = s;
730
- if (r.tagName === "SELECT") {
731
- let a = null;
732
- if (t == null)
733
- a = null;
734
- else if (e[i] == null)
735
- a = r.querySelector("option[selected]");
736
- else if (!Array.isArray(e[i])) {
737
- let c = e[i];
738
- typeof c == "string" && (c = c.replace(/"/g, '\\"')), a = r.querySelector(`option[value="${c}" i]`);
739
- }
740
- a == null ? (r.value = "", r.selectedIndex = -1) : a.selected = !0;
741
- } else if (t == null)
742
- r.classList.remove(`${o}-active`), r.setAttribute("aria-pressed", "false");
743
- else if (r.hasAttribute("value")) {
744
- const a = e[i], c = a === r.getAttribute("value") || a != null && a.toString() === r.getAttribute("value") || a == null && !r.getAttribute("value");
745
- r.classList.toggle(
746
- `${o}-active`,
747
- c
748
- ), r.setAttribute("aria-pressed", c.toString());
749
- } else {
750
- const a = e[i] != null;
751
- r.classList.toggle(
752
- `${o}-active`,
753
- a
754
- ), r.setAttribute("aria-pressed", a.toString());
755
- }
756
- });
757
- }
758
- }
759
- V.DEFAULTS = {};
760
- function F(l, t, e) {
761
- const s = document.createElement("button");
762
- s.setAttribute("type", "button"), s.classList.add(`${o}-${t}`), s.setAttribute("aria-pressed", "false"), e != null ? (s.value = e, s.setAttribute("aria-label", `${t}: ${e}`)) : s.setAttribute("aria-label", t), l.appendChild(s);
763
- }
764
- function Ft(l, t) {
765
- Array.isArray(t[0]) || (t = [t]), t.forEach((e) => {
766
- const s = document.createElement("span");
767
- s.classList.add(`${o}-formats`), e.forEach((i) => {
768
- if (typeof i == "string")
769
- F(s, i);
770
- else {
771
- const r = Object.keys(i)[0], a = i[r];
772
- Array.isArray(a) ? zt(s, r, a) : F(s, r, a);
773
- }
774
- }), l.appendChild(s);
775
- });
776
- }
777
- function zt(l, t, e) {
778
- const s = document.createElement("select");
779
- s.classList.add(`${o}-${t}`), e.forEach((i) => {
780
- const r = document.createElement("option");
781
- i !== !1 ? r.setAttribute("value", String(i)) : r.setAttribute("selected", "selected"), s.appendChild(r);
782
- }), l.appendChild(s);
783
- }
784
- V.DEFAULTS = {
785
- container: null,
786
- handlers: {
787
- clean() {
788
- const l = this.rich.getSelection();
789
- if (l != null)
790
- if (l.length === 0) {
791
- const t = this.rich.getFormat();
792
- Object.keys(t).forEach((e) => {
793
- this.rich.scroll.query(e, M.INLINE) != null && this.rich.format(e, !1, n.sources.USER);
794
- });
795
- } else
796
- this.rich.removeFormat(l.index, l.length, n.sources.USER);
797
- },
798
- direction(l) {
799
- const { align: t } = this.rich.getFormat();
800
- l === "rtl" && t == null ? this.rich.format("align", "right", n.sources.USER) : !l && t === "right" && this.rich.format("align", !1, n.sources.USER), this.rich.format("direction", l, n.sources.USER);
801
- },
802
- indent(l) {
803
- const t = this.rich.getSelection(), e = this.rich.getFormat(t), s = parseInt(e.indent || 0, 10);
804
- if (l === "+1" || l === "-1") {
805
- let i = l === "+1" ? 1 : -1;
806
- e.direction === "rtl" && (i *= -1), this.rich.format("indent", s + i, n.sources.USER);
807
- }
808
- },
809
- link(l) {
810
- l === !0 && (l = prompt("Enter link URL:")), this.rich.format("link", l, n.sources.USER);
811
- },
812
- list(l) {
813
- const t = this.rich.getSelection(), e = this.rich.getFormat(t);
814
- l === "check" ? e.list === "checked" || e.list === "unchecked" ? this.rich.format("list", !1, n.sources.USER) : this.rich.format("list", "unchecked", n.sources.USER) : this.rich.format("list", l, n.sources.USER);
815
- },
816
- redo() {
817
- this.rich.history.redo();
818
- },
819
- undo() {
820
- this.rich.history.undo();
821
- }
822
- }
823
- };
824
- const jt = '<svg viewbox="0 0 18 18"><polygon class="pqb-rich-text-stroke" points="7 11 9 13 11 11 7 11"></polygon><polygon class="pqb-rich-text-stroke" points="7 7 9 5 11 7 7 7"></polygon></svg>';
825
- let z = 0;
826
- function j(l, t) {
827
- l.setAttribute(
828
- t,
829
- `${l.getAttribute(t) !== "true"}`
830
- );
831
- }
832
- class I {
833
- constructor(t) {
834
- this.select = t, this.container = document.createElement("span"), this.buildPicker(), this.select.style.display = "none", this.select.parentNode.insertBefore(this.container, this.select), this.label.addEventListener("mousedown", () => {
835
- this.togglePicker();
836
- }), this.label.addEventListener("keydown", (e) => {
837
- switch (e.key) {
838
- case "Enter":
839
- this.togglePicker();
840
- break;
841
- case "Escape":
842
- this.escape(), e.preventDefault();
843
- break;
844
- }
845
- }), this.select.addEventListener("change", this.update.bind(this));
846
- }
847
- togglePicker() {
848
- this.container.classList.toggle(`${o}-expanded`), j(this.label, "aria-expanded"), j(this.options, "aria-hidden");
849
- }
850
- buildItem(t) {
851
- const e = document.createElement("span");
852
- e.tabIndex = "0", e.setAttribute("role", "button"), e.classList.add(`${o}-picker-item`);
853
- const s = t.getAttribute("value");
854
- return s && e.setAttribute("data-value", s), t.textContent && e.setAttribute("data-label", t.textContent), e.addEventListener("click", () => {
855
- this.selectItem(e, !0);
856
- }), e.addEventListener("keydown", (i) => {
857
- switch (i.key) {
858
- case "Enter":
859
- this.selectItem(e, !0), i.preventDefault();
860
- break;
861
- case "Escape":
862
- this.escape(), i.preventDefault();
863
- break;
864
- }
865
- }), e;
866
- }
867
- buildLabel() {
868
- const t = document.createElement("span");
869
- return t.classList.add(`${o}-picker-label`), t.innerHTML = jt, t.tabIndex = "0", t.setAttribute("role", "button"), t.setAttribute("aria-expanded", "false"), this.container.appendChild(t), t;
870
- }
871
- buildOptions() {
872
- const t = document.createElement("span");
873
- t.classList.add(`${o}-picker-options`), t.setAttribute("aria-hidden", "true"), t.tabIndex = "-1", t.id = `${o}-picker-options-${z}`, z += 1, this.label.setAttribute("aria-controls", t.id), this.options = t, Array.from(this.select.options).forEach((e) => {
874
- const s = this.buildItem(e);
875
- t.appendChild(s), e.selected === !0 && this.selectItem(s);
876
- }), this.container.appendChild(t);
877
- }
878
- buildPicker() {
879
- Array.from(this.select.attributes).forEach((t) => {
880
- this.container.setAttribute(t.name, t.value);
881
- }), this.container.classList.add(`${o}-picker`), this.label = this.buildLabel(), this.buildOptions();
882
- }
883
- escape() {
884
- this.close(), setTimeout(() => this.label.focus(), 1);
885
- }
886
- close() {
887
- this.container.classList.remove(`${o}-expanded`), this.label.setAttribute("aria-expanded", "false"), this.options.setAttribute("aria-hidden", "true");
888
- }
889
- selectItem(t, e = !1) {
890
- const s = this.container.querySelector(
891
- `.${o}-selected`
892
- );
893
- t !== s && (s?.classList.remove(`${o}-selected`), t != null && (t.classList.add(`${o}-selected`), this.select.selectedIndex = Array.from(t.parentNode.children).indexOf(
894
- t
895
- ), t.hasAttribute("data-value") ? this.label.setAttribute("data-value", t.getAttribute("data-value")) : this.label.removeAttribute("data-value"), t.hasAttribute("data-label") ? this.label.setAttribute("data-label", t.getAttribute("data-label")) : this.label.removeAttribute("data-label"), e && (this.select.dispatchEvent(new Event("change")), this.close())));
896
- }
897
- update() {
898
- let t;
899
- if (this.select.selectedIndex > -1) {
900
- const r = this.container.querySelector(
901
- `.${o}-picker-options`
902
- ).children[this.select.selectedIndex];
903
- t = this.select.options[this.select.selectedIndex], this.selectItem(r);
904
- } else
905
- this.selectItem(null);
906
- const e = t != null && t !== this.select.querySelector("option[selected]");
907
- this.label.classList.toggle(
908
- `${o}-active`,
909
- e
910
- );
911
- }
912
- }
913
- class ot extends I {
914
- constructor(t, e) {
915
- super(t), this.label.innerHTML = e, this.container.classList.add(`${o}-color-picker`), Array.from(
916
- this.container.querySelectorAll(
917
- `.${o}-picker-item`
918
- )
919
- ).slice(0, 7).forEach((s) => {
920
- s.classList.add(`${o}-primary`);
921
- });
922
- }
923
- buildItem(t) {
924
- const e = super.buildItem(t);
925
- return e.style.backgroundColor = t.getAttribute("value") || "", e;
926
- }
927
- selectItem(t, e) {
928
- super.selectItem(t, e);
929
- const s = this.label.querySelector(
930
- `.${o}-color-label`
931
- ), i = t && t.getAttribute("data-value") || "";
932
- s && (s.tagName === "line" ? s.style.stroke = i : s.style.fill = i);
933
- }
934
- }
935
- class at extends I {
936
- constructor(t, e) {
937
- super(t), this.container.classList.add(`${o}-icon-picker`), Array.from(
938
- this.container.querySelectorAll(
939
- `.${o}-picker-item`
940
- )
941
- ).forEach((s) => {
942
- s.innerHTML = e[s.getAttribute("data-value") || ""];
943
- }), this.defaultItem = this.container.querySelector(
944
- `.${o}-selected`
945
- ), this.selectItem(this.defaultItem);
946
- }
947
- selectItem(t, e) {
948
- super.selectItem(t, e);
949
- const s = t || this.defaultItem;
950
- if (s != null) {
951
- if (this.label.innerHTML === s.innerHTML) return;
952
- this.label.innerHTML = s.innerHTML;
953
- }
954
- }
955
- }
956
- const _t = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="15" x2="3" y1="9" y2="9"></line><line class="pqb-rich-text-stroke" x1="14" x2="4" y1="14" y2="14"></line><line class="pqb-rich-text-stroke" x1="12" x2="6" y1="4" y2="4"></line></svg>', Gt = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="15" x2="3" y1="9" y2="9"></line><line class="pqb-rich-text-stroke" x1="15" x2="3" y1="14" y2="14"></line><line class="pqb-rich-text-stroke" x1="15" x2="3" y1="4" y2="4"></line></svg>', Wt = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="3" x2="15" y1="9" y2="9"></line><line class="pqb-rich-text-stroke" x1="3" x2="13" y1="14" y2="14"></line><line class="pqb-rich-text-stroke" x1="3" x2="9" y1="4" y2="4"></line></svg>', Xt = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="15" x2="3" y1="9" y2="9"></line><line class="pqb-rich-text-stroke" x1="15" x2="5" y1="14" y2="14"></line><line class="pqb-rich-text-stroke" x1="15" x2="9" y1="4" y2="4"></line></svg>', Kt = '<svg viewbox="0 0 18 18"><g class="pqb-rich-text-fill pqb-rich-text-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"></polygon><rect height="1" width="1" x="4" y="4"></rect><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"></polygon><rect height="1" width="1" x="2" y="6"></rect><rect height="1" width="1" x="3" y="5"></rect><rect height="1" width="1" x="4" y="7"></rect><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"></polygon><rect height="1" width="1" x="2" y="12"></rect><rect height="1" width="1" x="2" y="9"></rect><rect height="1" width="1" x="2" y="15"></rect><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"></polygon><rect height="1" width="1" x="3" y="8"></rect><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"></path><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"></path><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"></path><rect height="1" width="1" x="12" y="2"></rect><rect height="1" width="1" x="11" y="3"></rect><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"></path><rect height="1" width="1" x="2" y="3"></rect><rect height="1" width="1" x="6" y="2"></rect><rect height="1" width="1" x="3" y="2"></rect><rect height="1" width="1" x="5" y="3"></rect><rect height="1" width="1" x="9" y="2"></rect><rect height="1" width="1" x="15" y="14"></rect><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"></polygon><rect height="1" width="1" x="13" y="7"></rect><rect height="1" width="1" x="15" y="5"></rect><rect height="1" width="1" x="14" y="6"></rect><rect height="1" width="1" x="15" y="8"></rect><rect height="1" width="1" x="14" y="9"></rect><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"></path><rect height="1" width="1" x="14" y="3"></rect><polygon points="12 6.868 12 6 11.62 6 12 6.868"></polygon><rect height="1" width="1" x="15" y="2"></rect><rect height="1" width="1" x="12" y="5"></rect><rect height="1" width="1" x="13" y="4"></rect><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"></polygon><rect height="1" width="1" x="9" y="14"></rect><rect height="1" width="1" x="8" y="15"></rect><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"></path><rect height="1" width="1" x="5" y="15"></rect><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"></path><rect height="1" width="1" x="11" y="15"></rect><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"></path><rect height="1" width="1" x="14" y="15"></rect><rect height="1" width="1" x="15" y="11"></rect></g><polyline class="pqb-rich-text-stroke" points="5.5 13 9 5 12.5 13"></polyline><line class="pqb-rich-text-stroke" x1="11.63" x2="6.38" y1="11" y2="11"></line></svg>', Qt = '<svg viewbox="0 0 18 18"><rect class="pqb-rich-text-fill pqb-rich-text-stroke" height="3" width="3" x="4" y="5"></rect><rect class="pqb-rich-text-fill pqb-rich-text-stroke" height="3" width="3" x="11" y="5"></rect><path class="pqb-rich-text-even pqb-rich-text-fill pqb-rich-text-stroke" d="M7,8c0,4.031-3,5-3,5"></path><path class="pqb-rich-text-even pqb-rich-text-fill pqb-rich-text-stroke" d="M14,8c0,4.031-3,5-3,5"></path></svg>', Jt = '<svg viewbox="0 0 18 18"><path class="pqb-rich-text-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"></path><path class="pqb-rich-text-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"></path></svg>', Yt = '<svg class="" viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="5" x2="13" y1="3" y2="3"></line><line class="pqb-rich-text-stroke" x1="6" x2="9.35" y1="12" y2="3"></line><line class="pqb-rich-text-stroke" x1="11" x2="15" y1="11" y2="15"></line><line class="pqb-rich-text-stroke" x1="15" x2="11" y1="11" y2="15"></line><rect class="pqb-rich-text-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"></rect></svg>', _ = '<svg viewbox="0 0 18 18"><polyline class="pqb-rich-text-even pqb-rich-text-stroke" points="5 7 3 9 5 11"></polyline><polyline class="pqb-rich-text-even pqb-rich-text-stroke" points="13 7 15 9 13 11"></polyline><line class="pqb-rich-text-stroke" x1="10" x2="8" y1="5" y2="13"></line></svg>', te = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-color-label pqb-rich-text-stroke pqb-rich-text-transparent" x1="3" x2="15" y1="15" y2="15"></line><polyline class="pqb-rich-text-stroke" points="5.5 11 9 3 12.5 11"></polyline><line class="pqb-rich-text-stroke" x1="11.63" x2="6.38" y1="9" y2="9"></line></svg>', ee = '<svg viewbox="0 0 18 18"><polygon class="pqb-rich-text-stroke pqb-rich-text-fill" points="3 11 5 9 3 7 3 11"></polygon><line class="pqb-rich-text-stroke pqb-rich-text-fill" x1="15" x2="11" y1="4" y2="4"></line><path class="pqb-rich-text-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"></path><rect class="pqb-rich-text-fill" height="11" width="1" x="11" y="4"></rect><rect class="pqb-rich-text-fill" height="11" width="1" x="13" y="4"></rect></svg>', se = '<svg viewbox="0 0 18 18"><polygon class="pqb-rich-text-stroke pqb-rich-text-fill" points="15 12 13 10 15 8 15 12"></polygon><line class="pqb-rich-text-stroke pqb-rich-text-fill" x1="9" x2="5" y1="4" y2="4"></line><path class="pqb-rich-text-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"></path><rect class="pqb-rich-text-fill" height="11" width="1" x="5" y="4"></rect><rect class="pqb-rich-text-fill" height="11" width="1" x="7" y="4"></rect></svg>', ie = '<svg viewbox="0 0 18 18"><path class="pqb-rich-text-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"></path><rect class="pqb-rich-text-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"></rect><path class="pqb-rich-text-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"></path></svg>', re = '<svg viewBox="0 0 18 18"><path class="pqb-rich-text-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>', le = '<svg viewBox="0 0 18 18"><path class="pqb-rich-text-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>', oe = '<svg viewBox="0 0 18 18"><path class="pqb-rich-text-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>', ae = '<svg viewBox="0 0 18 18"><path class="pqb-rich-text-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>', ne = '<svg viewBox="0 0 18 18"><path class="pqb-rich-text-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>', ce = '<svg viewBox="0 0 18 18"><path class="pqb-rich-text-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>', he = '<svg viewbox="0 0 18 18"><rect class="pqb-rich-text-stroke" height="10" width="12" x="3" y="4"></rect><circle class="pqb-rich-text-fill" cx="6" cy="7" r="1"></circle><polyline class="pqb-rich-text-even pqb-rich-text-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline></svg>', de = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="3" x2="15" y1="14" y2="14"></line><line class="pqb-rich-text-stroke" x1="3" x2="15" y1="4" y2="4"></line><line class="pqb-rich-text-stroke" x1="9" x2="15" y1="9" y2="9"></line><polyline class="pqb-rich-text-fill pqb-rich-text-stroke" points="3 7 3 11 5 9 3 7"></polyline></svg>', ue = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="7" x2="13" y1="4" y2="4"></line><line class="pqb-rich-text-stroke" x1="5" x2="11" y1="14" y2="14"></line><line class="pqb-rich-text-stroke" x1="8" x2="10" y1="14" y2="4"></line></svg>', pe = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="7" x2="11" y1="7" y2="11"></line><path class="pqb-rich-text-even pqb-rich-text-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"></path><path class="pqb-rich-text-even pqb-rich-text-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"></path></svg>', fe = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="6" x2="15" y1="4" y2="4"></line><line class="pqb-rich-text-stroke" x1="6" x2="15" y1="9" y2="9"></line><line class="pqb-rich-text-stroke" x1="6" x2="15" y1="14" y2="14"></line><line class="pqb-rich-text-stroke" x1="3" x2="3" y1="4" y2="4"></line><line class="pqb-rich-text-stroke" x1="3" x2="3" y1="9" y2="9"></line><line class="pqb-rich-text-stroke" x1="3" x2="3" y1="14" y2="14"></line></svg>', be = '<svg class="" viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="9" x2="15" y1="4" y2="4"></line><polyline class="pqb-rich-text-stroke" points="3 4 4 5 6 3"></polyline><line class="pqb-rich-text-stroke" x1="9" x2="15" y1="14" y2="14"></line><polyline class="pqb-rich-text-stroke" points="3 14 4 15 6 13"></polyline><line class="pqb-rich-text-stroke" x1="9" x2="15" y1="9" y2="9"></line><polyline class="pqb-rich-text-stroke" points="3 9 4 10 6 8"></polyline></svg>', xe = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="7" x2="15" y1="4" y2="4"></line><line class="pqb-rich-text-stroke" x1="7" x2="15" y1="9" y2="9"></line><line class="pqb-rich-text-stroke" x1="7" x2="15" y1="14" y2="14"></line><line class="pqb-rich-text-stroke pqb-rich-text-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"></line><path class="pqb-rich-text-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"></path><path class="pqb-rich-text-stroke pqb-rich-text-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"></path><path class="pqb-rich-text-stroke pqb-rich-text-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"></path></svg>', ge = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke" x1="3" x2="15" y1="14" y2="14"></line><line class="pqb-rich-text-stroke" x1="3" x2="15" y1="4" y2="4"></line><line class="pqb-rich-text-stroke" x1="9" x2="15" y1="9" y2="9"></line><polyline class="pqb-rich-text-stroke" points="5 7 5 11 3 9 5 7"></polyline></svg>', me = '<svg viewbox="0 0 18 18"><polygon class="pqb-rich-text-fill pqb-rich-text-stroke" points="12 10 14 12 16 10 12 10"></polygon><path class="pqb-rich-text-stroke" d="M9.91,13.91A4.6,4.6,0,0,1,9,14a5,5,0,1,1,5-5"></path></svg>', ye = '<svg viewbox="0 0 18 18"><line class="pqb-rich-text-stroke pqb-rich-text-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"></line><path class="pqb-rich-text-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"></path><path class="pqb-rich-text-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"></path></svg>', ve = '<svg viewbox="0 0 18 18"><path class="pqb-rich-text-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="pqb-rich-text-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>', ke = '<svg viewbox="0 0 18 18"><path class="pqb-rich-text-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="pqb-rich-text-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>', Ae = '<svg viewbox="0 0 18 18"><rect class="pqb-rich-text-stroke" height="12" width="12" x="3" y="3"></rect><rect class="pqb-rich-text-fill" height="2" width="3" x="5" y="5"></rect><rect class="pqb-rich-text-fill" height="2" width="4" x="9" y="5"></rect><g class="pqb-rich-text-fill pqb-rich-text-transparent"><rect height="2" width="3" x="5" y="8"></rect><rect height="2" width="4" x="9" y="8"></rect><rect height="2" width="3" x="5" y="11"></rect><rect height="2" width="4" x="9" y="11"></rect></g></svg>', we = '<svg viewbox="0 0 18 18"><path class="pqb-rich-text-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"></path><rect class="pqb-rich-text-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"></rect></svg>', qe = '<svg viewbox="0 0 18 18"><polygon class="pqb-rich-text-fill pqb-rich-text-stroke" points="6 10 4 12 2 10 6 10"></polygon><path class="pqb-rich-text-stroke" d="M8.09,13.91A4.6,4.6,0,0,0,9,14,5,5,0,1,0,4,9"></path></svg>', Ee = '<svg viewbox="0 0 18 18"><rect class="pqb-rich-text-stroke" height="12" width="12" x="3" y="3"></rect><rect class="pqb-rich-text-fill" height="12" width="1" x="5" y="3"></rect><rect class="pqb-rich-text-fill" height="12" width="1" x="12" y="3"></rect><rect class="pqb-rich-text-fill" height="2" width="8" x="5" y="8"></rect><rect class="pqb-rich-text-fill" height="1" width="3" x="3" y="5"></rect><rect class="pqb-rich-text-fill" height="1" width="3" x="3" y="7"></rect><rect class="pqb-rich-text-fill" height="1" width="3" x="3" y="10"></rect><rect class="pqb-rich-text-fill" height="1" width="3" x="3" y="12"></rect><rect class="pqb-rich-text-fill" height="1" width="3" x="12" y="5"></rect><rect class="pqb-rich-text-fill" height="1" width="3" x="12" y="7"></rect><rect class="pqb-rich-text-fill" height="1" width="3" x="12" y="10"></rect><rect class="pqb-rich-text-fill" height="1" width="3" x="12" y="12"></rect></svg>', R = {
957
- align: {
958
- "": Wt,
959
- // left: alignLeftIcon,
960
- center: _t,
961
- right: Xt,
962
- justify: Gt
963
- },
964
- background: Kt,
965
- blockquote: Qt,
966
- bold: Jt,
967
- clean: Yt,
968
- code: _,
969
- "code-block": _,
970
- color: te,
971
- direction: {
972
- "": ee,
973
- // ltr: directionLeftToRightIcon,
974
- rtl: se
975
- },
976
- formula: ie,
977
- header: {
978
- 1: ce,
979
- 2: re,
980
- 3: le,
981
- 4: oe,
982
- 5: ae,
983
- 6: ne
984
- },
985
- italic: ue,
986
- image: he,
987
- indent: {
988
- "+1": de,
989
- "-1": ge
990
- },
991
- link: pe,
992
- list: {
993
- bullet: fe,
994
- check: be,
995
- ordered: xe
996
- },
997
- script: {
998
- sub: ve,
999
- super: ke
1000
- },
1001
- strike: ye,
1002
- table: Ae,
1003
- underline: we,
1004
- video: Ee,
1005
- redo: me,
1006
- undo: qe
1007
- }, Se = (l) => {
1008
- const { overflowY: t } = getComputedStyle(l, null);
1009
- return t !== "visible" && t !== "clip";
1010
- };
1011
- class nt {
1012
- static {
1013
- this.TEMPLATE = "";
1014
- }
1015
- constructor(t, e) {
1016
- this.rich = t, this.root = t.addContainer(
1017
- `${o}-tooltip`
1018
- ), this.root.innerHTML = this.constructor.TEMPLATE;
1019
- const s = getComputedStyle(this.root).position === "fixed";
1020
- this.boundsContainer = document.body, s ? this.boundsContainer = document.body : this.boundsContainer = e || this.boundsContainer, Se(this.rich.root) && this.rich.root.addEventListener("scroll", () => {
1021
- this.root.style.marginTop = `${-1 * this.rich.root.scrollTop}px`;
1022
- }), this.hide();
1023
- }
1024
- hide() {
1025
- this.root.classList.add(`${o}-hidden`);
1026
- }
1027
- position(t) {
1028
- const e = this.rich.container.getBoundingClientRect(), s = this.boundsContainer.getBoundingClientRect(), i = this.root.getBoundingClientRect(), r = t.left + t.width / 2 - this.root.offsetWidth / 2 + e.left, a = t.bottom + this.rich.root.scrollTop + e.top;
1029
- this.root.style.left = `${r}px`, this.root.style.top = `${a}px`, this.root.classList.remove(`${o}-flip`);
1030
- let c = 0;
1031
- if (i.right > s.right && (c = s.right - i.right, this.root.style.left = `${r + c}px`), i.left < s.left && (c = s.left - i.left, this.root.style.left = `${r + c}px`), i.bottom > s.bottom) {
1032
- const u = i.bottom - i.top, x = t.bottom - t.top + u;
1033
- this.root.style.top = `${a - x}px`, this.root.classList.add(`${o}-flip`);
1034
- }
1035
- return c;
1036
- }
1037
- show() {
1038
- this.root.classList.remove(`${o}-editing`), this.root.classList.remove(`${o}-hidden`);
1039
- }
1040
- edit(t = "link", e = null) {
1041
- }
1042
- }
1043
- const Le = [!1, "center", "right", "justify"], Ne = [].concat(Tt.colors.map((l) => l.value)).concat(Object.values(Nt)).map((l) => l.toLowerCase()), Te = [!1, "serif", "monospace"], Ie = ["1", "2", "3", !1], Ce = ["small", !1, "large", "huge"];
1044
- class U extends K {
1045
- constructor(t, e) {
1046
- super(t, e);
1047
- const s = (i) => {
1048
- if (!document.body.contains(t.root)) {
1049
- document.body.removeEventListener("click", s);
1050
- return;
1051
- }
1052
- this.tooltip != null && !this.tooltip.root.contains(i.target) && document.activeElement !== this.tooltip.textbox && !this.rich.hasFocus() && this.tooltip.hide(), this.pickers != null && this.pickers.forEach((r) => {
1053
- r.container.contains(i.target) || r.close();
1054
- });
1055
- };
1056
- t.emitter.listenDOM("click", document.body, s);
1057
- }
1058
- extendToolbar(t) {
1059
- }
1060
- addModule(t) {
1061
- const e = super.addModule(t);
1062
- return t === "toolbar" && this.extendToolbar(e), e;
1063
- }
1064
- buildButtons(t, e) {
1065
- Array.from(t).forEach((s) => {
1066
- (s.getAttribute("class") || "").split(/\s+/).forEach((r) => {
1067
- if (r.startsWith(`${o}-`) && (r = r.slice(`${o}-`.length), e[r] != null))
1068
- if (r === "direction")
1069
- s.innerHTML = e[r][""] + e[r].rtl;
1070
- else if (typeof e[r] == "string")
1071
- s.innerHTML = e[r];
1072
- else {
1073
- const a = s.value || "";
1074
- a != null && e[r][a] && (s.innerHTML = e[r][a]);
1075
- }
1076
- });
1077
- });
1078
- }
1079
- buildPickers(t, e) {
1080
- this.pickers = Array.from(t).map((i) => {
1081
- if (i.classList.contains(`${o}-align`) && (i.querySelector("option") == null && y(i, Le), typeof e.align == "object"))
1082
- return new at(i, e.align);
1083
- if (i.classList.contains(
1084
- `${o}-background`
1085
- ) || i.classList.contains(`${o}-color`)) {
1086
- const r = i.classList.contains(
1087
- `${o}-background`
1088
- ) ? "background" : "color";
1089
- return i.querySelector("option") == null && y(
1090
- i,
1091
- Ne,
1092
- r === "background" ? "#ffffff" : "#000000"
1093
- ), new ot(i, e[r]);
1094
- }
1095
- return i.querySelector("option") == null && (i.classList.contains(`${o}-font`) ? y(i, Te) : i.classList.contains(`${o}-header`) ? y(i, Ie) : i.classList.contains(`${o}-size`) && y(i, Ce)), new I(i);
1096
- });
1097
- const s = () => {
1098
- this.pickers.forEach((i) => {
1099
- i.update();
1100
- });
1101
- };
1102
- this.rich.on(p.events.EDITOR_CHANGE, s);
1103
- }
1104
- }
1105
- U.DEFAULTS = it({}, K.DEFAULTS, {
1106
- modules: {
1107
- toolbar: {
1108
- handlers: {
1109
- formula() {
1110
- this.rich.theme.tooltip.edit("formula");
1111
- },
1112
- image() {
1113
- let l = this.container.querySelector(
1114
- `input.${o}-image[type=file]`
1115
- );
1116
- l == null && (l = document.createElement("input"), l.setAttribute("type", "file"), l.setAttribute(
1117
- "accept",
1118
- this.rich.uploader.options.mimetypes.join(", ")
1119
- ), l.classList.add(`${o}-image`), l.addEventListener("change", () => {
1120
- const t = this.rich.getSelection(!0);
1121
- this.rich.uploader.upload(t, l.files), l.value = "";
1122
- }), this.container.appendChild(l)), l.click();
1123
- },
1124
- video() {
1125
- this.rich.theme.tooltip.edit("video");
1126
- }
1127
- }
1128
- }
1129
- }
1130
- });
1131
- class $e extends nt {
1132
- static {
1133
- this.TEMPLATE = "";
1134
- }
1135
- constructor(t, e) {
1136
- super(t, e), this.textbox = this.root.querySelector('input[type="text"]'), this.listen();
1137
- }
1138
- listen() {
1139
- this.textbox.addEventListener("keydown", (t) => {
1140
- t.key === "Enter" ? (this.save(), t.preventDefault()) : t.key === "Escape" && (this.cancel(), t.preventDefault());
1141
- });
1142
- }
1143
- cancel() {
1144
- this.hide(), this.restoreFocus();
1145
- }
1146
- edit(t = "link", e = null) {
1147
- if (super.edit(t, e), this.root.classList.remove(`${o}-hidden`), this.root.classList.add(`${o}-editing`), this.textbox == null) return;
1148
- e != null ? this.textbox.value = e : t !== this.root.getAttribute("data-mode") && (this.textbox.value = "");
1149
- const s = this.rich.getBounds(
1150
- this.rich.selection.savedRange
1151
- );
1152
- s != null && this.position(s), this.textbox.select(), this.textbox.setAttribute(
1153
- "placeholder",
1154
- this.textbox.getAttribute(`data-${t}`) || ""
1155
- ), this.root.setAttribute("data-mode", t);
1156
- }
1157
- restoreFocus() {
1158
- this.rich.focus({ preventScroll: !0 });
1159
- }
1160
- save() {
1161
- let { value: t } = this.textbox;
1162
- switch (this.root.getAttribute("data-mode")) {
1163
- case "link": {
1164
- const { scrollTop: e } = this.rich.root;
1165
- this.linkRange ? (this.rich.formatText(
1166
- this.linkRange,
1167
- "link",
1168
- t,
1169
- p.sources.USER
1170
- ), delete this.linkRange) : (this.restoreFocus(), this.rich.format("link", t, p.sources.USER)), this.rich.root.scrollTop = e;
1171
- break;
1172
- }
1173
- case "video":
1174
- t = t;
1175
- case "formula": {
1176
- if (!t) break;
1177
- const e = this.rich.getSelection(!0);
1178
- if (e != null) {
1179
- const s = e.index + e.length;
1180
- this.rich.insertEmbed(
1181
- s,
1182
- this.root.getAttribute("data-mode"),
1183
- t,
1184
- p.sources.USER
1185
- ), this.root.getAttribute("data-mode") === "formula" && this.rich.insertText(s + 1, " ", p.sources.USER), this.rich.setSelection(s + 2, p.sources.USER);
1186
- }
1187
- break;
1188
- }
1189
- }
1190
- this.textbox.value = "", this.hide();
1191
- }
1192
- }
1193
- function y(l, t, e = !1) {
1194
- t.forEach((s) => {
1195
- const i = document.createElement("option");
1196
- s === e ? i.setAttribute("selected", "selected") : i.setAttribute("value", String(s)), l.appendChild(i);
1197
- });
1198
- }
1199
- const Re = [
1200
- [{ header: ["1", "2", "3", !1] }],
1201
- ["bold", "italic", "underline", "link"],
1202
- [{ list: "ordered" }, { list: "bullet" }],
1203
- ["clean"]
1204
- ];
1205
- class Me extends $e {
1206
- constructor() {
1207
- super(...arguments), this.preview = this.root.querySelector(`a.${o}-preview`);
1208
- }
1209
- static {
1210
- this.TEMPLATE = [
1211
- `<a class="${o}-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>`,
1212
- '<input type="text" data-formula="e=mc^2" data-link="https://xxx.com" data-video="嵌入URL">',
1213
- `<a class="${o}-action"></a>`,
1214
- `<a class="${o}-remove"></a>`
1215
- ].join("");
1216
- }
1217
- listen() {
1218
- super.listen(), this.root.querySelector(`a.${o}-action`).addEventListener("click", (t) => {
1219
- this.root.classList.contains(`${o}-editing`) ? this.save() : this.edit("link", this.preview.textContent), t.preventDefault();
1220
- }), this.root.querySelector(`a.${o}-remove`).addEventListener("click", (t) => {
1221
- if (this.linkRange != null) {
1222
- const e = this.linkRange;
1223
- this.restoreFocus(), this.rich.formatText(e, "link", !1, p.sources.USER), delete this.linkRange;
1224
- }
1225
- t.preventDefault(), this.hide();
1226
- }), this.rich.on(p.events.SELECTION_CHANGE, (t, e, s) => {
1227
- if (t != null) {
1228
- if (t.length === 0 && s === p.sources.USER) {
1229
- const [i, r] = this.rich.scroll.descendant(
1230
- S,
1231
- t.index
1232
- );
1233
- if (i != null) {
1234
- this.linkRange = new yt(t.index - r, i.length());
1235
- const a = S.formats(i.domNode);
1236
- this.preview.textContent = a, this.preview.setAttribute("href", a), this.show();
1237
- const c = this.rich.getBounds(this.linkRange);
1238
- c != null && this.position(c);
1239
- return;
1240
- }
1241
- } else
1242
- delete this.linkRange;
1243
- this.hide();
1244
- }
1245
- });
1246
- }
1247
- show() {
1248
- super.show(), this.root.removeAttribute("data-mode");
1249
- }
1250
- }
1251
- class ct extends U {
1252
- constructor(t, e) {
1253
- e.modules.toolbar != null && e.modules.toolbar.container == null && (e.modules.toolbar.container = Re), super(t, e);
1254
- }
1255
- extendToolbar(t) {
1256
- super.extendToolbar(t);
1257
- const e = t.container;
1258
- e && (this.buildButtons(e.querySelectorAll("button"), R), this.buildPickers(e.querySelectorAll("select"), R), this.tooltip = new Me(this.rich, this.options.bounds), e.querySelector(`.${o}-link`) && this.rich.keyboard.addBinding(
1259
- { key: "k", shortKey: !0 },
1260
- (s, i) => {
1261
- t.handlers.link.call(t, !i.format.link);
1262
- }
1263
- ));
1264
- }
1265
- }
1266
- ct.DEFAULTS = it({}, U.DEFAULTS, {
1267
- modules: {
1268
- toolbar: {
1269
- handlers: {
1270
- link(l) {
1271
- if (l) {
1272
- const t = this.rich.getSelection();
1273
- if (t == null || t.length === 0) return;
1274
- let e = this.rich.getText(t);
1275
- /^\S+@\S+\.\S+$/.test(e) && e.indexOf("mailto:") !== 0 && (e = `mailto:${e}`);
1276
- const { tooltip: s } = this.rich.theme;
1277
- s.edit("link", e);
1278
- } else
1279
- this.rich.format("link", !1, n.sources.USER);
1280
- }
1281
- }
1282
- }
1283
- }
1284
- });
1285
- n.register(
1286
- {
1287
- "attributors/attribute/direction": St,
1288
- "attributors/class/align": st,
1289
- "attributors/class/background": Et,
1290
- "attributors/class/color": qt,
1291
- "attributors/class/direction": et,
1292
- "attributors/class/font": tt,
1293
- "attributors/class/size": Y,
1294
- "attributors/style/align": wt,
1295
- "attributors/style/background": J,
1296
- "attributors/style/color": Q,
1297
- "attributors/style/direction": At,
1298
- "attributors/style/font": kt,
1299
- "attributors/style/size": vt
1300
- },
1301
- !0
1302
- );
1303
- n.register(
1304
- {
1305
- "formats/align": st,
1306
- "formats/direction": et,
1307
- "formats/indent": Ct,
1308
- "formats/background": J,
1309
- "formats/color": Q,
1310
- "formats/font": tt,
1311
- "formats/size": Y,
1312
- "formats/blockquote": $t,
1313
- "formats/code-block": m,
1314
- "formats/header": Rt,
1315
- "formats/list": E,
1316
- "formats/bold": B,
1317
- "formats/code": Lt,
1318
- "formats/italic": Mt,
1319
- "formats/link": S,
1320
- "formats/script": Ht,
1321
- "formats/strike": Bt,
1322
- "formats/underline": Ot,
1323
- "formats/formula": Vt,
1324
- "formats/image": Ut,
1325
- "formats/video": Zt,
1326
- "modules/syntax": lt,
1327
- "modules/table": Pt,
1328
- "modules/toolbar": V,
1329
- "themes/pqb": ct,
1330
- "ui/icons": R,
1331
- "ui/picker": I,
1332
- "ui/icon-picker": at,
1333
- "ui/color-picker": ot,
1334
- "ui/tooltip": nt
1335
- },
1336
- !0
1337
- );
1338
- export {
1339
- De as AttributeMap,
1340
- A as Delta,
1341
- H as Module,
1342
- Pe as Op,
1343
- Fe as OpIterator,
1344
- ze as Parchment,
1345
- yt as Range,
1346
- n as default
1347
- };