@titaui/pc 1.10.4 → 1.10.6-3.beta-2

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 (302) hide show
  1. package/.eslintrc.js +2 -2
  2. package/.prettierignore +1 -1
  3. package/lib/components/book-demo/utils.js +4 -0
  4. package/lib/components/button/default-button/index.css +10 -4
  5. package/lib/components/button/default-button/index.js +13 -2
  6. package/lib/components/change-okr-modal/index.js +108 -87
  7. package/lib/components/checkbox/index.css +1 -0
  8. package/lib/components/communication/CommunicationRecord.js +22 -16
  9. package/lib/components/communication/index.css +50 -10
  10. package/lib/components/communication/index.js +86 -30
  11. package/lib/components/communication/style.js +8 -6
  12. package/lib/components/create-okr-modal/fields/o-new-name.js +31 -21
  13. package/lib/components/create-okr-modal/fields/okr-parent.js +1 -5
  14. package/lib/components/create-okr-modal/kr-items/krDatas.js +16 -16
  15. package/lib/components/{dynamic/components/dangerous-html → dangerous-html}/index.js +0 -0
  16. package/lib/components/dialog/index.css +4 -1
  17. package/lib/components/dialog/index.js +1 -1
  18. package/lib/components/dialog-confirm/index.css +1 -1
  19. package/lib/components/drawer-manager/index.js +6 -1
  20. package/lib/components/dynamic/components/first-level-tabs/index.css +12 -2
  21. package/lib/components/dynamic/components/first-level-tabs/index.js +19 -6
  22. package/lib/components/dynamic/components/obj-status/index.css +3 -19
  23. package/lib/components/dynamic/components/obj-status/index.js +7 -8
  24. package/lib/components/dynamic/components/obj-status/utils.js +37 -0
  25. package/lib/components/dynamic/components/percent/index.css +1 -1
  26. package/lib/components/dynamic/components/title/index.css +21 -22
  27. package/lib/components/dynamic/components/title/index.js +20 -8
  28. package/lib/components/dynamic/constant.js +12 -2
  29. package/lib/components/dynamic/dynamic-item/components/feed-operate/index.css +71 -0
  30. package/lib/components/dynamic/dynamic-item/components/feed-operate/index.js +112 -0
  31. package/lib/components/dynamic/dynamic-item/components/header/index.css +8 -7
  32. package/lib/components/dynamic/dynamic-item/components/header/index.js +13 -7
  33. package/lib/components/dynamic/dynamic-item/dynamic-align/img/dynamic-align-kr.png +0 -0
  34. package/lib/components/dynamic/dynamic-item/dynamic-align/img/dynamic-align-o.png +0 -0
  35. package/lib/components/dynamic/dynamic-item/dynamic-align/img/dynamic-align.png +0 -0
  36. package/lib/components/dynamic/dynamic-item/dynamic-align/index.css +44 -27
  37. package/lib/components/dynamic/dynamic-item/dynamic-align/index.js +43 -31
  38. package/lib/components/dynamic/dynamic-item/dynamic-announcement/index.css +5 -33
  39. package/lib/components/dynamic/dynamic-item/dynamic-announcement/index.js +6 -32
  40. package/lib/components/dynamic/dynamic-item/dynamic-assessment/index.css +58 -18
  41. package/lib/components/dynamic/dynamic-item/dynamic-assessment/index.js +31 -21
  42. package/lib/components/dynamic/dynamic-item/dynamic-chart/index.css +4 -0
  43. package/lib/components/dynamic/dynamic-item/dynamic-chart/index.js +102 -0
  44. package/lib/components/dynamic/dynamic-item/dynamic-chart/utils.js +61 -0
  45. package/lib/components/dynamic/dynamic-item/dynamic-create-o/index.css +56 -44
  46. package/lib/components/dynamic/dynamic-item/dynamic-create-o/index.js +52 -44
  47. package/lib/components/dynamic/dynamic-item/dynamic-kr/index.css +39 -27
  48. package/lib/components/dynamic/dynamic-item/dynamic-kr/index.js +25 -29
  49. package/lib/components/dynamic/dynamic-item/dynamic-learning/img/dynamic-share-course.png +0 -0
  50. package/lib/components/dynamic/dynamic-item/{dynamic-share-to-dynamic → dynamic-learning}/img/jiantou-right@3x.png +0 -0
  51. package/lib/components/dynamic/dynamic-item/{dynamic-share-to-dynamic → dynamic-learning}/img/user-photo.png +0 -0
  52. package/lib/components/dynamic/dynamic-item/{dynamic-share-to-dynamic → dynamic-learning}/index.css +10 -18
  53. package/lib/components/dynamic/dynamic-item/{dynamic-share-to-dynamic → dynamic-learning}/index.js +15 -30
  54. package/lib/components/dynamic/dynamic-item/dynamic-milestone/constant.js +9 -2
  55. package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.css +31 -14
  56. package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.js +14 -25
  57. package/lib/components/dynamic/dynamic-item/dynamic-okrs-communication/index.css +25 -40
  58. package/lib/components/dynamic/dynamic-item/dynamic-okrs-communication/index.js +10 -29
  59. package/lib/components/dynamic/dynamic-item/dynamic-plan-communication/index.css +25 -40
  60. package/lib/components/dynamic/dynamic-item/dynamic-plan-communication/index.js +13 -30
  61. package/lib/components/dynamic/dynamic-item/dynamic-progress/index.css +13 -55
  62. package/lib/components/dynamic/dynamic-item/dynamic-progress/index.js +33 -80
  63. package/lib/components/dynamic/dynamic-item/dynamic-progress/utils.js +72 -0
  64. package/lib/components/dynamic/dynamic-item/dynamic-project/index.css +35 -28
  65. package/lib/components/dynamic/dynamic-item/dynamic-project/index.js +13 -24
  66. package/lib/components/dynamic/dynamic-item/dynamic-relative/img/dynamic-rela-kr.png +0 -0
  67. package/lib/components/dynamic/dynamic-item/dynamic-relative/img/dynamic-rela-o.png +0 -0
  68. package/lib/components/dynamic/dynamic-item/dynamic-relative/img/dynamic-rela-project.png +0 -0
  69. package/lib/components/dynamic/dynamic-item/dynamic-relative/img/dynamic-rela-task.png +0 -0
  70. package/lib/components/dynamic/dynamic-item/dynamic-relative/img/dynamic-rela.svg +23 -0
  71. package/lib/components/dynamic/dynamic-item/dynamic-relative/index.css +56 -31
  72. package/lib/components/dynamic/dynamic-item/dynamic-relative/index.js +78 -34
  73. package/lib/components/dynamic/dynamic-item/{dynamic-replay → dynamic-reply}/index.css +29 -32
  74. package/lib/components/dynamic/dynamic-item/{dynamic-replay → dynamic-reply}/index.js +12 -18
  75. package/lib/components/dynamic/dynamic-item/dynamic-report/index.css +20 -22
  76. package/lib/components/dynamic/dynamic-item/dynamic-report/index.js +42 -29
  77. package/lib/components/dynamic/dynamic-item/dynamic-reward/img/reward.png +0 -0
  78. package/lib/components/dynamic/dynamic-item/dynamic-reward/index.css +8 -3
  79. package/lib/components/dynamic/dynamic-item/dynamic-reward/index.js +23 -66
  80. package/lib/components/dynamic/dynamic-item/dynamic-reward/utils.js +28 -0
  81. package/lib/components/dynamic/dynamic-item/dynamic-share/index.css +8 -19
  82. package/lib/components/dynamic/dynamic-item/dynamic-share/index.js +59 -36
  83. package/lib/components/dynamic/dynamic-item/dynamic-task/index.css +32 -28
  84. package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +11 -25
  85. package/lib/components/dynamic/dynamic-item/index.css +59 -4
  86. package/lib/components/dynamic/dynamic-item/index.js +148 -17
  87. package/lib/components/dynamic/dynamic-like-ranking/item.js +1 -1
  88. package/lib/components/dynamic/dynamic-list/index.js +2 -1
  89. package/lib/components/dynamic/dynamic-topping/item.js +8 -4
  90. package/lib/components/dynamic/dynamic.js +1 -1
  91. package/lib/components/dynamic/img/dynamic-operate.png +0 -0
  92. package/lib/components/dynamic/img/dynamic-point.svg +13 -0
  93. package/lib/components/dynamic/img/dynamic-reward-hover.svg +1 -0
  94. package/lib/components/dynamic/img/dynamic-reward-normal.svg +1 -0
  95. package/lib/components/dynamic/util.js +41 -81
  96. package/lib/components/e-status-dropdown/index.css +3 -0
  97. package/lib/components/e-status-dropdown/index.js +94 -0
  98. package/lib/components/file-list/components/single-file/index.css +14 -12
  99. package/lib/components/file-list/components/single-file/index.js +1 -1
  100. package/lib/components/file-list/index.css +1 -0
  101. package/lib/components/follower-visitor/index.js +6 -4
  102. package/lib/components/grid-layout/okr-progress/index.js +20 -30
  103. package/lib/components/help-card/image/not-try.png +0 -0
  104. package/lib/components/help-card/image/try.png +0 -0
  105. package/lib/components/help-card/index.css +31 -2
  106. package/lib/components/help-card/index.js +54 -17
  107. package/lib/components/invite-people/img/invite-people.svg +62 -0
  108. package/lib/components/invite-people/index.css +1 -1
  109. package/lib/components/mblog/context.js +3 -1
  110. package/lib/components/mblog/index.css +7 -0
  111. package/lib/components/mblog/index.js +45 -9
  112. package/lib/components/mblog/style.js +4 -4
  113. package/lib/components/menus/export-modules/demo-menus/index.js +2 -2
  114. package/lib/components/menus/export-modules/demo-menus/menu-highlight.js +25 -1
  115. package/lib/components/menus/export-modules/demo-menus/menus.js +60 -11
  116. package/lib/components/menus/export-modules/manage-menus/constant.js +1 -1
  117. package/lib/components/menus/export-modules/manage-menus/index.css +3 -0
  118. package/lib/components/menus/images/okr-gongsi.svg +17 -0
  119. package/lib/components/nav-top/components/menu/index.css +24 -0
  120. package/lib/components/nav-top/components/menu/index.js +9 -1
  121. package/lib/components/nav-top/components/user-message/components/reply/index.js +9 -8
  122. package/lib/components/nav-top/components/user-message/components/reply/reply-item.js +15 -5
  123. package/lib/components/nav-top/components/user-message/index.css +4 -3
  124. package/lib/components/nav-top/components/user-message/index.js +33 -6
  125. package/lib/components/nav-top/request.apis.js +8 -2
  126. package/lib/components/nav-top/useGlobalValue.js +14 -0
  127. package/lib/components/okr-detail/components/header/o-score.js +4 -6
  128. package/lib/components/okr-detail/components/okr-tree/tree-node/e-kr-node/index.css +1 -1
  129. package/lib/components/okr-detail/components/okr-tree/tree-node/e-kr-node/index.js +27 -13
  130. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-empty.js +7 -4
  131. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-project.js +8 -1
  132. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-task.js +7 -3
  133. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/index.css +20 -1
  134. package/lib/components/okr-detail/e-list/index.js +23 -7
  135. package/lib/components/okr-detail/e-list/util.js +7 -2
  136. package/lib/components/okr-detail/index.js +2 -0
  137. package/lib/components/okr-detail/okr-list/index.js +1 -5
  138. package/lib/components/okr-flow/export-modal/index.js +3 -3
  139. package/lib/components/okr-progress-detail/index.js +5 -1
  140. package/lib/components/okr-progress-modal/helper.js +20 -27
  141. package/lib/components/okr-share/common-painter/openDataPainter.js +34 -27
  142. package/lib/components/okrcase-library/okrcases-components/submitOkr-dialog.js +40 -36
  143. package/lib/components/open-data-painter/index.js +5 -1
  144. package/lib/components/progress/circle-progress/index.css +1 -0
  145. package/lib/components/progress/circle-progress/index.js +8 -3
  146. package/lib/components/rich-editor/basic/schema.js +47 -0
  147. package/lib/components/rich-editor/consts/events.js +12 -0
  148. package/lib/components/rich-editor/enums.js +42 -0
  149. package/lib/components/rich-editor/index.js +58 -0
  150. package/lib/components/rich-editor/keymap.js +119 -0
  151. package/lib/components/rich-editor/keymaps/index.js +241 -0
  152. package/lib/components/rich-editor/models/controller.js +18 -0
  153. package/lib/components/rich-editor/models/editor.js +47 -0
  154. package/lib/components/rich-editor/models/plugin.js +20 -0
  155. package/lib/components/rich-editor/models/schema.js +121 -0
  156. package/lib/components/rich-editor/plugins/block/block-quote/commond.js +27 -0
  157. package/lib/components/rich-editor/plugins/block/block-quote/index.js +128 -0
  158. package/lib/components/rich-editor/plugins/block/heading/commonds.js +31 -0
  159. package/lib/components/rich-editor/plugins/block/heading/index.js +190 -0
  160. package/lib/components/rich-editor/plugins/block/index.js +57 -0
  161. package/lib/components/rich-editor/plugins/block/lists/actions/conversions.js +172 -0
  162. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list-items-selected.js +163 -0
  163. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list.js +59 -0
  164. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-forward.js +74 -0
  165. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/index.js +45 -0
  166. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +104 -0
  167. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +92 -0
  168. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +89 -0
  169. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-paragraph-with-list.js +48 -0
  170. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-sibling-list-items.js +61 -0
  171. package/lib/components/rich-editor/plugins/block/lists/actions/merge-lists.js +34 -0
  172. package/lib/components/rich-editor/plugins/block/lists/actions/outdent-list-items-selected.js +289 -0
  173. package/lib/components/rich-editor/plugins/block/lists/actions/wrap-and-join-lists.js +180 -0
  174. package/lib/components/rich-editor/plugins/block/lists/baseCommand.js +328 -0
  175. package/lib/components/rich-editor/plugins/block/lists/commond/indent-list.js +60 -0
  176. package/lib/components/rich-editor/plugins/block/lists/commond/index.js +396 -0
  177. package/lib/components/rich-editor/plugins/block/lists/commond/join-list-item-forward.js +45 -0
  178. package/lib/components/rich-editor/plugins/block/lists/commond/listBackspace.js +302 -0
  179. package/lib/components/rich-editor/plugins/block/lists/commond/outdent-list.js +43 -0
  180. package/lib/components/rich-editor/plugins/block/lists/index.js +224 -0
  181. package/lib/components/rich-editor/plugins/block/lists/messages.js +38 -0
  182. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/input-rule.js +152 -0
  183. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/keymap.js +33 -0
  184. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/main.js +94 -0
  185. package/lib/components/rich-editor/plugins/block/lists/styles.js +15 -0
  186. package/lib/components/rich-editor/plugins/block/lists/transforms.js +347 -0
  187. package/lib/components/rich-editor/plugins/block/lists/utils/analytics.js +48 -0
  188. package/lib/components/rich-editor/plugins/block/lists/utils/find.js +126 -0
  189. package/lib/components/rich-editor/plugins/block/lists/utils/indentation.js +87 -0
  190. package/lib/components/rich-editor/plugins/block/lists/utils/node.js +144 -0
  191. package/lib/components/rich-editor/plugins/block/lists/utils/replace-content.js +31 -0
  192. package/lib/components/rich-editor/plugins/block/lists/utils/selection.js +201 -0
  193. package/lib/components/rich-editor/plugins/block/lists/utils.js +52 -0
  194. package/lib/components/rich-editor/plugins/block/paragraph/index.js +91 -0
  195. package/lib/components/rich-editor/plugins/core/index.js +90 -0
  196. package/lib/components/rich-editor/plugins/core/pm-plugins/focus-handler.js +67 -0
  197. package/lib/components/rich-editor/plugins/core/pm-plugins/keymap.js +29 -0
  198. package/lib/components/rich-editor/plugins/core/pm-plugins/reactNodeView.js +80 -0
  199. package/lib/components/rich-editor/plugins/extension/alignment/commond.js +24 -0
  200. package/lib/components/rich-editor/plugins/extension/alignment/index.js +113 -0
  201. package/lib/components/rich-editor/plugins/extension/alignment/utils.js +19 -0
  202. package/lib/components/rich-editor/plugins/extension/index.js +18 -0
  203. package/lib/components/rich-editor/plugins/extension/placeholder/index.js +126 -0
  204. package/lib/components/rich-editor/plugins/extension/placeholder/styles.js +19 -0
  205. package/lib/components/rich-editor/plugins/index.js +44 -0
  206. package/lib/components/rich-editor/plugins/inline/color/commond.js +128 -0
  207. package/lib/components/rich-editor/plugins/inline/color/consts.js +43 -0
  208. package/lib/components/rich-editor/plugins/inline/color/index.css +61 -0
  209. package/lib/components/rich-editor/plugins/inline/color/index.js +217 -0
  210. package/lib/components/rich-editor/plugins/inline/color/selector.js +252 -0
  211. package/lib/components/rich-editor/plugins/inline/color/util.js +25 -0
  212. package/lib/components/rich-editor/plugins/inline/delete-line/index.js +149 -0
  213. package/lib/components/rich-editor/plugins/inline/em/index.js +93 -0
  214. package/lib/components/rich-editor/plugins/inline/index.js +83 -0
  215. package/lib/components/rich-editor/plugins/inline/link/commands.js +256 -0
  216. package/lib/components/rich-editor/plugins/inline/link/index.js +149 -0
  217. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/fake-cursor-for-toolbar.js +77 -0
  218. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/main.js +293 -0
  219. package/lib/components/rich-editor/plugins/inline/link/ui/index.css +84 -0
  220. package/lib/components/rich-editor/plugins/inline/link/ui/linkEditor.js +150 -0
  221. package/lib/components/rich-editor/plugins/inline/link/ui/linkToolbar.js +101 -0
  222. package/lib/components/rich-editor/plugins/inline/link/ui/toolbarBtn.js +117 -0
  223. package/lib/components/rich-editor/plugins/inline/link/utils.js +33 -0
  224. package/lib/components/rich-editor/plugins/inline/strong/index.js +139 -0
  225. package/lib/components/rich-editor/plugins/inline/under-line/index.js +147 -0
  226. package/lib/components/rich-editor/plugins/util.js +284 -0
  227. package/lib/components/rich-editor/react/reactNodeView.js +383 -0
  228. package/lib/components/rich-editor/react/uiProvider.js +185 -0
  229. package/lib/components/rich-editor/schemas/basic.js +309 -0
  230. package/lib/components/rich-editor/schemas/index.js +19 -0
  231. package/lib/components/rich-editor/schemas/list.js +342 -0
  232. package/lib/components/rich-editor/types/commond.js +5 -0
  233. package/lib/components/rich-editor/types/index.js +18 -0
  234. package/lib/components/rich-editor/ui/Popup/index.js +247 -0
  235. package/lib/components/rich-editor/ui/Popup/utils.js +399 -0
  236. package/lib/components/rich-editor/ui/editor/index.css +178 -0
  237. package/lib/components/rich-editor/ui/editor/index.js +153 -0
  238. package/lib/components/rich-editor/ui/normal-toolbar/index.css +34 -0
  239. package/lib/components/rich-editor/ui/normal-toolbar/index.js +109 -0
  240. package/lib/components/rich-editor/utils/browser.js +35 -0
  241. package/lib/components/rich-editor/utils/commands.js +266 -0
  242. package/lib/components/rich-editor/utils/document.js +211 -0
  243. package/lib/components/rich-editor/utils/event.js +79 -0
  244. package/lib/components/rich-editor/utils/helpers.js +16 -0
  245. package/lib/components/rich-editor/utils/mark.js +168 -0
  246. package/lib/components/rich-editor/utils/slice.js +85 -0
  247. package/lib/components/rich-editor/utils/toolbar.js +228 -0
  248. package/lib/components/search-key-handle/index.js +7 -2
  249. package/lib/components/superset-charts/components/chart/index.js +54 -0
  250. package/lib/components/superset-charts/fetch-assets-and-append/append-assets.js +106 -0
  251. package/lib/components/superset-charts/fetch-assets-and-append/get-assets-with-cache.js +131 -0
  252. package/lib/components/superset-charts/fetch-assets-and-append/index.js +79 -0
  253. package/lib/components/superset-charts/index.js +13 -0
  254. package/lib/components/superset-charts/interface.js +5 -0
  255. package/lib/components/superset-charts/utils/axios.js +94 -0
  256. package/lib/components/toast/index.js +5 -17
  257. package/lib/components/upload/index.js +4 -2
  258. package/lib/components/upload/util.js +2 -0
  259. package/lib/components/user-selector/empty/index.css +6 -6
  260. package/lib/components/user-selector/selected-panel/index.css +3 -3
  261. package/lib/components/video-modal/components/video-box/index.css +240 -0
  262. package/lib/components/video-modal/components/video-box/index.js +334 -0
  263. package/lib/components/video-modal/img/bigFaqi.png +0 -0
  264. package/lib/components/video-modal/img/close.png +0 -0
  265. package/lib/components/video-modal/img/full.svg +21 -0
  266. package/lib/components/video-modal/img/muted.svg +14 -0
  267. package/lib/components/video-modal/img/not-muted.svg +22 -0
  268. package/lib/components/video-modal/img/pause.svg +13 -0
  269. package/lib/components/video-modal/img/play.svg +18 -0
  270. package/lib/components/video-modal/img/small.svg +22 -0
  271. package/lib/components/video-modal/index.css +83 -0
  272. package/lib/components/video-modal/index.js +182 -0
  273. package/lib/components/video-modal/utils.js +25 -0
  274. package/lib/components/weekly-report/common-painter/openDataPainter.js +5 -1
  275. package/lib/hooks/useGlobalState.js +63 -0
  276. package/lib/index.js +40 -0
  277. package/lib/pages/aha2021/img/canceled.svg +13 -0
  278. package/lib/pages/aha2021/img/not-try.png +0 -0
  279. package/lib/pages/aha2021/img/try.png +0 -0
  280. package/lib/pages/aha2021/index.css +52 -0
  281. package/lib/pages/aha2021/index.js +73 -14
  282. package/lib/pages/new-okr-list/header/index.js +2 -1
  283. package/lib/pages/new-okr-list/index.js +3 -3
  284. package/lib/pages/okr-map/export-modules/share-okr-page/header/index.js +0 -5
  285. package/lib/pages/pay/image/success.png +0 -0
  286. package/lib/pages/pay/index.css +79 -0
  287. package/lib/pages/pay/index.js +66 -0
  288. package/lib/utils/bs-global.js +13 -9
  289. package/lib/utils/helpers.js +7 -1
  290. package/lib/utils/open-data.js +2 -1
  291. package/lib/utils/tools.js +11 -2
  292. package/package.json +120 -101
  293. package/lib/components/dynamic/dynamic-item/dynamic-align/img/dynamic-align.svg +0 -22
  294. package/lib/components/dynamic/dynamic-item/dynamic-align/img/dynamic-relative.svg +0 -22
  295. package/lib/components/dynamic/dynamic-item/dynamic-milestone/img/dynamic-milestone.png +0 -0
  296. package/lib/components/dynamic/dynamic-item/dynamic-okrs-communication/img/okrs-icon.png +0 -0
  297. package/lib/components/dynamic/dynamic-item/dynamic-plan-communication/img/plan-icon.png +0 -0
  298. package/lib/components/dynamic/dynamic-item/dynamic-project/img/dynamic-project.png +0 -0
  299. package/lib/components/dynamic/dynamic-item/dynamic-relative/img/dynamic-relative.svg +0 -22
  300. package/lib/components/dynamic/dynamic-item/dynamic-share-to-dynamic/img/guanlian.png +0 -0
  301. package/lib/components/dynamic/dynamic-item/dynamic-task/img/task-icon.png +0 -0
  302. package/lib/components/invite-people/img/invite-people.png +0 -0
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _prosemirrorState = require("prosemirror-state");
13
+
14
+ var _prosemirrorView = require("prosemirror-view");
15
+
16
+ var _prosemirrorModel = require("prosemirror-model");
17
+
18
+ var _schema = _interopRequireDefault(require("../../basic/schema"));
19
+
20
+ var _editor = _interopRequireDefault(require("../../models/editor"));
21
+
22
+ var _util = require("../../plugins/util");
23
+
24
+ var _event = require("../../utils/event");
25
+
26
+ var _events = require("../../consts/events");
27
+
28
+ var _plugins = require("../../plugins");
29
+
30
+ require("./index.css");
31
+
32
+ var _classnames = _interopRequireDefault(require("classnames"));
33
+
34
+ var _placeholder = _interopRequireDefault(require("../../plugins/extension/placeholder"));
35
+
36
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
37
+
38
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
+
40
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
+
42
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
43
+
44
+ var preCls = 'tita-rich-editor';
45
+ var defaultPlugins = [new _plugins.HeadingPlugin(), new _plugins.StrongPlugin(), new _plugins.ColorPlugin(), new _plugins.UnderLinePlugin(), new _plugins.DeleteLinePlugin(), new _plugins.ListPlugin(), new _plugins.AlignmentPlugin(), new _plugins.BlockquotePlugin(), new _plugins.LinkPlugin(), new _placeholder["default"]()];
46
+
47
+ function RichEditor(_ref, ref) {
48
+ var _ref$plugins = _ref.plugins,
49
+ plugins = _ref$plugins === void 0 ? defaultPlugins : _ref$plugins,
50
+ onInit = _ref.onInit,
51
+ _ref$editable = _ref.editable,
52
+ _editable = _ref$editable === void 0 ? true : _ref$editable,
53
+ defaultState = _ref.defaultState,
54
+ onChange = _ref.onChange,
55
+ placeholder = _ref.placeholder;
56
+
57
+ var container = (0, _react.useRef)();
58
+ var dataRef = (0, _react.useRef)({});
59
+ (0, _react.useEffect)(function () {
60
+ var dispatcher = new _event.EventDispatcher();
61
+
62
+ var _applyPlugins = (0, _util.applyPlugins)(plugins, _schema["default"], dispatcher, {
63
+ placeholder: placeholder
64
+ }),
65
+ nativePlugins = _applyPlugins.nativePlugins,
66
+ nodes = _applyPlugins.nodes,
67
+ marks = _applyPlugins.marks,
68
+ controllers = _applyPlugins.controllers;
69
+
70
+ var pluginedSchema = new _prosemirrorModel.Schema({
71
+ nodes: nodes,
72
+ marks: marks
73
+ });
74
+ var stateConf = {
75
+ schema: pluginedSchema,
76
+ plugins: nativePlugins
77
+ };
78
+
79
+ var state = _prosemirrorState.EditorState.create(stateConf); // debugger
80
+
81
+
82
+ if (defaultState) {
83
+ try {
84
+ var jsonState = typeof defaultState == 'string' ? JSON.parse(defaultState) : defaultState;
85
+ state = _prosemirrorState.EditorState.fromJSON(stateConf, jsonState);
86
+ } catch (e) {
87
+ console.log(e);
88
+ }
89
+ }
90
+
91
+ var pmEditor = new _prosemirrorView.EditorView(container.current, {
92
+ state: state,
93
+ editable: function editable() {
94
+ return _editable;
95
+ },
96
+ dispatchTransaction: function dispatchTransaction(tr) {
97
+ var _this$state$applyTran = this.state.applyTransaction(tr),
98
+ state = _this$state$applyTran.state;
99
+
100
+ this.updateState(state);
101
+ dispatcher.emit(_events.EDITOR_STATE_CHANGE, state);
102
+
103
+ if (tr.docChanged) {
104
+ onChange === null || onChange === void 0 ? void 0 : onChange(state);
105
+ }
106
+ }
107
+ });
108
+ dataRef.current.editor = new _editor["default"]({
109
+ view: pmEditor,
110
+ controllers: controllers,
111
+ dispatcher: dispatcher
112
+ }); // window.editor = dataRef.current.editor
113
+
114
+ onInit === null || onInit === void 0 ? void 0 : onInit(dataRef.current.editor);
115
+ return function () {
116
+ return dataRef.current.editor.destroy();
117
+ };
118
+ }, []);
119
+ var handleClick = (0, _react.useCallback)(function (e) {
120
+ var _dataRef$current$edit, _dataRef$current$edit2;
121
+
122
+ if (e.target != e.currentTarget) return;
123
+ var view = (_dataRef$current$edit = dataRef.current.editor) === null || _dataRef$current$edit === void 0 ? void 0 : _dataRef$current$edit.view;
124
+ if (!view) return;
125
+ var tr = view.state.tr;
126
+
127
+ var selection = _prosemirrorState.TextSelection.atEnd(view.state.doc);
128
+
129
+ view.dispatch(tr.setSelection(selection));
130
+ view.focus();
131
+ (_dataRef$current$edit2 = dataRef.current.editor) === null || _dataRef$current$edit2 === void 0 ? void 0 : _dataRef$current$edit2.view.focus();
132
+ }, []);
133
+ (0, _react.useImperativeHandle)(ref, function () {
134
+ return {
135
+ getState: function getState() {
136
+ return dataRef.current.editor.state.toJSON();
137
+ }
138
+ };
139
+ }, []);
140
+ return /*#__PURE__*/_react["default"].createElement("div", {
141
+ ref: container,
142
+ className: (0, _classnames["default"])(preCls, _defineProperty({}, preCls + '--disabled', !_editable)),
143
+ style: {
144
+ backgroundColor: "#FFF"
145
+ },
146
+ spellCheck: false,
147
+ onMouseUp: handleClick
148
+ });
149
+ }
150
+
151
+ var _default = /*#__PURE__*/(0, _react.forwardRef)(RichEditor);
152
+
153
+ exports["default"] = _default;
@@ -0,0 +1,34 @@
1
+ .tita-rich-editor-normal-toolbar {
2
+ display: flex;
3
+ align-items: center;
4
+ padding: 12px 0;
5
+ }
6
+
7
+ .tita-rich-editor-normal-toolbar-item {
8
+ width: 32px;
9
+ height: 32px;
10
+ margin: 0 2px;
11
+ font-size: 16px;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ border-radius: 4px;
16
+ cursor: pointer;
17
+ overflow: hidden;
18
+ }
19
+
20
+ .tita-rich-editor-normal-toolbar-item:not(.tita-rich-editor-normal-toolbar-item--disabled):hover {
21
+ background-color: #f0f4fa;
22
+ }
23
+
24
+ .tita-rich-editor-normal-toolbar-item--active {
25
+ background: #f0f4fa;
26
+ }
27
+
28
+ .tita-rich-editor-normal-toolbar-item--disabled {
29
+ color: #bfc7d5;
30
+ }
31
+
32
+ .tita-rich-editor-normal-toolbar-item--disabled:hover {
33
+ cursor: not-allowed;
34
+ }
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ var _tooltip = _interopRequireDefault(require("../../../tooltip"));
15
+
16
+ require("./index.css");
17
+
18
+ var _events = require("../../consts/events");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
+
28
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
+
30
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
31
+
32
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
33
+
34
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
35
+
36
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
37
+
38
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
+
40
+ var preCls = 'tita-rich-editor-normal-toolbar';
41
+
42
+ function MenuItem(_ref) {
43
+ var _config$active, _config$disabled, _classNames;
44
+
45
+ var editor = _ref.editor,
46
+ config = _ref.config;
47
+
48
+ var _useState = (0, _react.useState)(editor.state),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ state = _useState2[0],
51
+ setState = _useState2[1];
52
+
53
+ var handleClickItem = (0, _react.useCallback)(function () {
54
+ var _config$handler;
55
+
56
+ (_config$handler = config.handler) === null || _config$handler === void 0 ? void 0 : _config$handler.call(config, editor);
57
+ }, []);
58
+ (0, _react.useEffect)(function () {
59
+ editor.on(_events.EDITOR_STATE_CHANGE, setState);
60
+ }, []);
61
+ var itemClass = (0, _classnames["default"])(preCls + '-item', (_classNames = {}, _defineProperty(_classNames, preCls + '-item--active', (_config$active = config.active) === null || _config$active === void 0 ? void 0 : _config$active.call(config, state)), _defineProperty(_classNames, preCls + '-item--disabled', (_config$disabled = config.disabled) === null || _config$disabled === void 0 ? void 0 : _config$disabled.call(config, state)), _classNames));
62
+
63
+ if (config.renderMenu) {
64
+ return /*#__PURE__*/_react["default"].createElement("div", {
65
+ className: itemClass
66
+ }, config.renderMenu(editor, config));
67
+ }
68
+
69
+ return /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
70
+ overlay: config.title,
71
+ placement: "top"
72
+ }, /*#__PURE__*/_react["default"].createElement("div", {
73
+ className: itemClass,
74
+ onClick: handleClickItem
75
+ }, /*#__PURE__*/_react["default"].createElement("span", {
76
+ className: config === null || config === void 0 ? void 0 : config.icon
77
+ })));
78
+ }
79
+
80
+ function RichEditorToolBar(_ref2) {
81
+ var editor = _ref2.editor;
82
+ var toolbars = (0, _react.useMemo)(function () {
83
+ var res = [];
84
+ editor === null || editor === void 0 ? void 0 : editor.controllers.forEach(function (controller) {
85
+ if (Array.isArray(controller.toolbar)) {
86
+ res = res.concat(controller.toolbar);
87
+ } else {
88
+ controller.toolbar && res.push(controller.toolbar);
89
+ }
90
+ });
91
+ return res;
92
+ }, [editor === null || editor === void 0 ? void 0 : editor.controllers]);
93
+ var handleMouseDown = (0, _react.useCallback)(function () {
94
+ editor === null || editor === void 0 ? void 0 : editor.emit(_events.TOOLBAR_MOUSE_DOWN);
95
+ }, [editor]);
96
+ if (!editor) return null;
97
+ return /*#__PURE__*/_react["default"].createElement("div", {
98
+ className: preCls,
99
+ onMouseDown: handleMouseDown
100
+ }, toolbars.map(function (config) {
101
+ return /*#__PURE__*/_react["default"].createElement(MenuItem, {
102
+ editor: editor,
103
+ config: config
104
+ });
105
+ }));
106
+ }
107
+
108
+ var _default = RichEditorToolBar;
109
+ exports["default"] = _default;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var result = {
8
+ mac: false,
9
+ ie: false,
10
+ ie_version: 0,
11
+ gecko: false,
12
+ chrome: false,
13
+ chrome_version: 0,
14
+ android: false,
15
+ ios: false,
16
+ webkit: false
17
+ };
18
+
19
+ if (typeof navigator !== 'undefined') {
20
+ var ieEdge = /Edge\/(\d+)/.exec(navigator.userAgent);
21
+ var ieUpTo10 = /MSIE \d/.test(navigator.userAgent);
22
+ var ie11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
23
+ result.mac = /Mac/.test(navigator.platform);
24
+ var ie = result.ie = !!(ieUpTo10 || ie11up || ieEdge);
25
+ result.ie_version = ieUpTo10 ? document.documentMode || 6 : ie11up ? +ie11up[1] : ieEdge ? +ieEdge[1] : null;
26
+ result.gecko = !ie && /gecko\/\d/i.test(navigator.userAgent);
27
+ result.chrome = !ie && /Chrome\//.test(navigator.userAgent);
28
+ result.chrome_version = parseInt((navigator.userAgent.match(/Chrome\/(\d{2})/) || [])[1], 10);
29
+ result.android = /Android \d/.test(navigator.userAgent);
30
+ result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
31
+ result.webkit = !ie && !!document.documentElement && 'WebkitAppearance' in document.documentElement.style;
32
+ }
33
+
34
+ var _default = result;
35
+ exports["default"] = _default;
@@ -0,0 +1,266 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.chainTransactions = chainTransactions;
7
+ exports.filter = exports.clearNodes = void 0;
8
+ exports.findCutBefore = findCutBefore;
9
+ exports.selectNode = exports.isFirstChildOfParent = exports.isEmptySelectionAtStart = exports.isEmptySelectionAtEnd = exports.insertContentDeleteRange = void 0;
10
+ exports.setAlignment = setAlignment;
11
+ exports.setHeadLine = setHeadLine;
12
+ exports.walkPrevNode = exports.walkNextNode = void 0;
13
+
14
+ var _prosemirrorCommands = require("prosemirror-commands");
15
+
16
+ var _prosemirrorState = require("prosemirror-state");
17
+
18
+ var _prosemirrorTransform = require("prosemirror-transform");
19
+
20
+ var _schemas = _interopRequireDefault(require("../schemas"));
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
+
24
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
+
26
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
27
+
28
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
29
+
30
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
31
+
32
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
33
+
34
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
35
+
36
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
+
38
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
39
+
40
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
+
42
+ function chainTransactions() {
43
+ for (var _len = arguments.length, commands = new Array(_len), _key = 0; _key < _len; _key++) {
44
+ commands[_key] = arguments[_key];
45
+ }
46
+
47
+ return function (state, dispatch) {
48
+ var dispatcher = function dispatcher(tr) {
49
+ state = state.apply(tr);
50
+ dispatch(tr);
51
+ };
52
+
53
+ var last = commands.pop();
54
+ var reduced = commands.reduce(function (result, command) {
55
+ return result || command(state, dispatcher);
56
+ }, false);
57
+ return reduced && last !== undefined && last(state, dispatch);
58
+ };
59
+ }
60
+
61
+ function setHeadLine(state, dispatchTransiction, level) {
62
+ var $from = state.selection.$from;
63
+ var node = $from.node();
64
+
65
+ if (node.type === _schemas["default"].nodes.heading && level === node.attrs.level) {
66
+ return (0, _prosemirrorCommands.setBlockType)(_schemas["default"].nodes.paragraph, node.attrs)(state, dispatchTransiction);
67
+ }
68
+
69
+ return chainTransactions(clearNodes(), (0, _prosemirrorCommands.setBlockType)(_schemas["default"].nodes.heading, _objectSpread(_objectSpread({}, node.attrs), {}, {
70
+ level: level
71
+ })))(state, dispatchTransiction);
72
+ }
73
+
74
+ function setAlignment(state, dispatchTransiction, alignment) {
75
+ var $from = state.selection.$from;
76
+ var node = $from.node();
77
+ return (0, _prosemirrorCommands.setBlockType)(node.type, _objectSpread(_objectSpread({}, node.attrs), {}, {
78
+ textAlign: alignment
79
+ }))(state, dispatchTransiction);
80
+ }
81
+
82
+ var clearNodes = function clearNodes() {
83
+ return function (state, dispatch) {
84
+ var tr = state.tr;
85
+ var selection = tr.selection;
86
+ var ranges = selection.ranges;
87
+ ranges.forEach(function (range) {
88
+ state.doc.nodesBetween(range.$from.pos, range.$to.pos, function (node, pos) {
89
+ if (node.type.isText) {
90
+ return;
91
+ }
92
+
93
+ var $fromPos = tr.doc.resolve(tr.mapping.map(pos));
94
+ var $toPos = tr.doc.resolve(tr.mapping.map(pos + node.nodeSize));
95
+ var nodeRange = $fromPos.blockRange($toPos);
96
+
97
+ if (!nodeRange) {
98
+ return;
99
+ }
100
+
101
+ var targetLiftDepth = (0, _prosemirrorTransform.liftTarget)(nodeRange);
102
+
103
+ if (node.type.isTextblock && dispatch) {
104
+ var _$fromPos$parent$cont = $fromPos.parent.contentMatchAt($fromPos.index()),
105
+ defaultType = _$fromPos$parent$cont.defaultType;
106
+
107
+ tr.setNodeMarkup(nodeRange.start, defaultType);
108
+ }
109
+
110
+ if ((targetLiftDepth || targetLiftDepth === 0) && dispatch) {
111
+ tr.lift(nodeRange, targetLiftDepth);
112
+ }
113
+ });
114
+ });
115
+ tr.docChanged && dispatch(tr);
116
+ return true;
117
+ };
118
+ };
119
+
120
+ exports.clearNodes = clearNodes;
121
+
122
+ var filter = function filter(predicates, cmd) {
123
+ return function (state, dispatch, view) {
124
+ if (!Array.isArray(predicates)) {
125
+ predicates = [predicates];
126
+ }
127
+
128
+ if (predicates.some(function (pred) {
129
+ return !pred(state, view);
130
+ })) {
131
+ return false;
132
+ }
133
+
134
+ return cmd(state, dispatch, view) || false;
135
+ };
136
+ };
137
+
138
+ exports.filter = filter;
139
+
140
+ var isFirstChildOfParent = function isFirstChildOfParent(state) {
141
+ var $from = state.selection.$from;
142
+ return $from.depth > 1 ? // ? (state.selection instanceof GapCursorSelection &&
143
+ // $from.parentOffset === 0) ||
144
+ $from.index($from.depth - 1) === 0 : true;
145
+ };
146
+
147
+ exports.isFirstChildOfParent = isFirstChildOfParent;
148
+
149
+ function findCutBefore($pos) {
150
+ // parent is non-isolating, so we can look across this boundary
151
+ if (!$pos.parent.type.spec.isolating) {
152
+ // search up the tree from the pos's *parent*
153
+ for (var i = $pos.depth - 1; i >= 0; i--) {
154
+ // starting from the inner most node's parent, find out
155
+ // if we're not its first child
156
+ if ($pos.index(i) > 0) {
157
+ return $pos.doc.resolve($pos.before(i + 1));
158
+ }
159
+
160
+ if ($pos.node(i).type.spec.isolating) {
161
+ break;
162
+ }
163
+ }
164
+ }
165
+
166
+ return null;
167
+ }
168
+
169
+ var isEmptySelectionAtStart = function isEmptySelectionAtStart(state) {
170
+ var _state$selection = state.selection,
171
+ empty = _state$selection.empty,
172
+ $from = _state$selection.$from;
173
+ return empty && $from.parentOffset === 0;
174
+ };
175
+
176
+ exports.isEmptySelectionAtStart = isEmptySelectionAtStart;
177
+
178
+ var isEmptySelectionAtEnd = function isEmptySelectionAtEnd(state) {
179
+ var _state$selection2 = state.selection,
180
+ empty = _state$selection2.empty,
181
+ $from = _state$selection2.$from;
182
+ return empty && $from.end() === $from.pos;
183
+ };
184
+
185
+ exports.isEmptySelectionAtEnd = isEmptySelectionAtEnd;
186
+
187
+ /**
188
+ * Walk backwards from a position until we encounter the (inside) end of
189
+ * the previous node, or reach the start of the document.
190
+ *
191
+ * @param $startPos Position to start walking from.
192
+ */
193
+ var walkPrevNode = function walkPrevNode($startPos) {
194
+ var $pos = $startPos;
195
+
196
+ while ($pos.pos > 0 && ($pos.pos === $startPos.pos || $pos.parentOffset < $pos.parent.nodeSize - 2)) {
197
+ $pos = $pos.doc.resolve($pos.pos - 1);
198
+ }
199
+
200
+ return {
201
+ $pos: $pos,
202
+ foundNode: $pos.pos > 0
203
+ };
204
+ };
205
+
206
+ exports.walkPrevNode = walkPrevNode;
207
+
208
+ var walkNextNode = function walkNextNode($startPos) {
209
+ var $pos = $startPos; // invariant 1: don't walk past the end of the document
210
+ // invariant 2: we are at the beginning or
211
+ // we haven't walked to the start of *any* node
212
+ // parentOffset includes textOffset.
213
+
214
+ while ($pos.pos < $pos.doc.nodeSize - 2 && ($pos.pos === $startPos.pos || $pos.parentOffset > 0)) {
215
+ $pos = $pos.doc.resolve($pos.pos + 1);
216
+ }
217
+
218
+ return {
219
+ $pos: $pos,
220
+ foundNode: $pos.pos < $pos.doc.nodeSize - 2
221
+ };
222
+ };
223
+ /**
224
+ * Insert content, delete a range and create a new selection
225
+ * This function automatically handles the mapping of positions for insertion and deletion.
226
+ * The new selection is handled as a function since it may not always be necessary to resolve a position to the transactions mapping
227
+ *
228
+ * @param getSelectionResolvedPos get the resolved position to create a new selection
229
+ * @param insertions content to insert at the specified position
230
+ * @param deletions the ranges to delete
231
+ */
232
+
233
+
234
+ exports.walkNextNode = walkNextNode;
235
+
236
+ var insertContentDeleteRange = function insertContentDeleteRange(tr, getSelectionResolvedPos, insertions, deletions) {
237
+ insertions.forEach(function (contentInsert) {
238
+ var _contentInsert = _slicedToArray(contentInsert, 2),
239
+ content = _contentInsert[0],
240
+ pos = _contentInsert[1];
241
+
242
+ tr.insert(tr.mapping.map(pos), content);
243
+ });
244
+ deletions.forEach(function (deleteRange) {
245
+ var _deleteRange = _slicedToArray(deleteRange, 2),
246
+ firstPos = _deleteRange[0],
247
+ lastPos = _deleteRange[1];
248
+
249
+ tr["delete"](tr.mapping.map(firstPos), tr.mapping.map(lastPos));
250
+ });
251
+ tr.setSelection(new _prosemirrorState.TextSelection(getSelectionResolvedPos(tr)));
252
+ };
253
+
254
+ exports.insertContentDeleteRange = insertContentDeleteRange;
255
+
256
+ var selectNode = function selectNode(pos) {
257
+ return function (state, dispatch) {
258
+ if (dispatch) {
259
+ dispatch(state.tr.setSelection(new _prosemirrorState.NodeSelection(state.doc.resolve(pos))));
260
+ }
261
+
262
+ return true;
263
+ };
264
+ };
265
+
266
+ exports.selectNode = selectNode;