@atlaskit/editor-core 188.8.0 → 188.9.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 (290) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/composable-editor/editor-internal.js +2 -2
  3. package/dist/cjs/create-editor/ReactEditorView.js +796 -8
  4. package/dist/cjs/labs/next/presets/default.js +2 -2
  5. package/dist/cjs/labs/next/presets/universal.js +7 -4
  6. package/dist/cjs/plugins/index.js +0 -28
  7. package/dist/cjs/plugins/insert-block/index.js +4 -6
  8. package/dist/cjs/plugins/tasks-and-decisions/index.js +4 -3
  9. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
  10. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -13
  11. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +15 -7
  12. package/dist/cjs/version-wrapper.js +1 -1
  13. package/dist/es2019/composable-editor/editor-internal.js +1 -1
  14. package/dist/es2019/create-editor/ReactEditorView.js +753 -2
  15. package/dist/es2019/labs/next/presets/default.js +1 -1
  16. package/dist/es2019/labs/next/presets/universal.js +4 -1
  17. package/dist/es2019/plugins/index.js +0 -4
  18. package/dist/es2019/plugins/insert-block/index.js +4 -6
  19. package/dist/es2019/plugins/tasks-and-decisions/index.js +4 -3
  20. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
  21. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +43 -10
  22. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +13 -6
  23. package/dist/es2019/version-wrapper.js +1 -1
  24. package/dist/esm/composable-editor/editor-internal.js +1 -1
  25. package/dist/esm/create-editor/ReactEditorView.js +797 -8
  26. package/dist/esm/labs/next/presets/default.js +1 -1
  27. package/dist/esm/labs/next/presets/universal.js +4 -1
  28. package/dist/esm/plugins/index.js +0 -4
  29. package/dist/esm/plugins/insert-block/index.js +4 -6
  30. package/dist/esm/plugins/tasks-and-decisions/index.js +4 -3
  31. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
  32. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -12
  33. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +14 -7
  34. package/dist/esm/version-wrapper.js +1 -1
  35. package/dist/types/create-editor/ReactEditorView.d.ts +119 -5
  36. package/dist/types/labs/next/presets/default.d.ts +43 -43
  37. package/dist/types/plugins/index.d.ts +0 -4
  38. package/dist/types/plugins/insert-block/types.d.ts +3 -1
  39. package/dist/types/plugins/tasks-and-decisions/index.d.ts +2 -5
  40. package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
  41. package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
  42. package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
  43. package/dist/types/plugins/tasks-and-decisions/types.d.ts +6 -1
  44. package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
  45. package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +119 -5
  46. package/dist/types-ts4.5/labs/next/presets/default.d.ts +43 -43
  47. package/dist/types-ts4.5/plugins/index.d.ts +0 -4
  48. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
  49. package/dist/types-ts4.5/plugins/tasks-and-decisions/index.d.ts +2 -5
  50. package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
  51. package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
  52. package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
  53. package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +8 -1
  54. package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
  55. package/package.json +7 -7
  56. package/dist/cjs/create-editor/ReactEditorViewInternal.js +0 -812
  57. package/dist/cjs/create-editor/ReactEditorViewNext.js +0 -15
  58. package/dist/cjs/plugins/save-on-enter/index.js +0 -70
  59. package/dist/cjs/plugins/scroll-into-view/index.js +0 -55
  60. package/dist/cjs/plugins/status/actions.js +0 -158
  61. package/dist/cjs/plugins/status/analytics.js +0 -31
  62. package/dist/cjs/plugins/status/index.js +0 -143
  63. package/dist/cjs/plugins/status/keymap.js +0 -22
  64. package/dist/cjs/plugins/status/nodeviews/status.js +0 -58
  65. package/dist/cjs/plugins/status/plugin-key.js +0 -9
  66. package/dist/cjs/plugins/status/plugin.js +0 -133
  67. package/dist/cjs/plugins/status/types.js +0 -5
  68. package/dist/cjs/plugins/status/ui/statusPicker.js +0 -314
  69. package/dist/cjs/plugins/status/utils.js +0 -22
  70. package/dist/cjs/plugins/type-ahead/api.js +0 -215
  71. package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -205
  72. package/dist/cjs/plugins/type-ahead/commands/update-list-items.js +0 -23
  73. package/dist/cjs/plugins/type-ahead/commands/update-query.js +0 -27
  74. package/dist/cjs/plugins/type-ahead/commands/update-selected-index.js +0 -27
  75. package/dist/cjs/plugins/type-ahead/constants.js +0 -15
  76. package/dist/cjs/plugins/type-ahead/index.js +0 -14
  77. package/dist/cjs/plugins/type-ahead/insert-utils.js +0 -107
  78. package/dist/cjs/plugins/type-ahead/messages.js +0 -79
  79. package/dist/cjs/plugins/type-ahead/plugin.js +0 -382
  80. package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +0 -16
  81. package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +0 -148
  82. package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +0 -36
  83. package/dist/cjs/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -22
  84. package/dist/cjs/plugins/type-ahead/pm-plugins/key.js +0 -8
  85. package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +0 -110
  86. package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +0 -158
  87. package/dist/cjs/plugins/type-ahead/pm-plugins/utils.js +0 -18
  88. package/dist/cjs/plugins/type-ahead/stats-modifier.js +0 -42
  89. package/dist/cjs/plugins/type-ahead/transforms/close-type-ahead.js +0 -13
  90. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -75
  91. package/dist/cjs/plugins/type-ahead/transforms/set-selection-before-query.js +0 -18
  92. package/dist/cjs/plugins/type-ahead/types.js +0 -5
  93. package/dist/cjs/plugins/type-ahead/ui/AssistiveText.js +0 -120
  94. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +0 -400
  95. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +0 -285
  96. package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +0 -179
  97. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +0 -230
  98. package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -127
  99. package/dist/cjs/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -109
  100. package/dist/cjs/plugins/type-ahead/ui/hooks/use-load-items.js +0 -50
  101. package/dist/cjs/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -41
  102. package/dist/cjs/plugins/type-ahead/utils.js +0 -130
  103. package/dist/es2019/create-editor/ReactEditorViewInternal.js +0 -753
  104. package/dist/es2019/create-editor/ReactEditorViewNext.js +0 -7
  105. package/dist/es2019/plugins/save-on-enter/index.js +0 -63
  106. package/dist/es2019/plugins/scroll-into-view/index.js +0 -44
  107. package/dist/es2019/plugins/status/actions.js +0 -144
  108. package/dist/es2019/plugins/status/analytics.js +0 -18
  109. package/dist/es2019/plugins/status/index.js +0 -135
  110. package/dist/es2019/plugins/status/keymap.js +0 -13
  111. package/dist/es2019/plugins/status/nodeviews/status.js +0 -60
  112. package/dist/es2019/plugins/status/plugin-key.js +0 -3
  113. package/dist/es2019/plugins/status/plugin.js +0 -113
  114. package/dist/es2019/plugins/status/types.js +0 -1
  115. package/dist/es2019/plugins/status/ui/statusPicker.js +0 -293
  116. package/dist/es2019/plugins/status/utils.js +0 -12
  117. package/dist/es2019/plugins/type-ahead/api.js +0 -205
  118. package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -204
  119. package/dist/es2019/plugins/type-ahead/commands/update-list-items.js +0 -17
  120. package/dist/es2019/plugins/type-ahead/commands/update-query.js +0 -21
  121. package/dist/es2019/plugins/type-ahead/commands/update-selected-index.js +0 -21
  122. package/dist/es2019/plugins/type-ahead/constants.js +0 -9
  123. package/dist/es2019/plugins/type-ahead/index.js +0 -3
  124. package/dist/es2019/plugins/type-ahead/insert-utils.js +0 -106
  125. package/dist/es2019/plugins/type-ahead/messages.js +0 -73
  126. package/dist/es2019/plugins/type-ahead/plugin.js +0 -381
  127. package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +0 -10
  128. package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +0 -148
  129. package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
  130. package/dist/es2019/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
  131. package/dist/es2019/plugins/type-ahead/pm-plugins/key.js +0 -2
  132. package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +0 -106
  133. package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +0 -160
  134. package/dist/es2019/plugins/type-ahead/pm-plugins/utils.js +0 -12
  135. package/dist/es2019/plugins/type-ahead/stats-modifier.js +0 -33
  136. package/dist/es2019/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
  137. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -71
  138. package/dist/es2019/plugins/type-ahead/transforms/set-selection-before-query.js +0 -10
  139. package/dist/es2019/plugins/type-ahead/types.js +0 -1
  140. package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +0 -88
  141. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +0 -393
  142. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +0 -273
  143. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +0 -214
  144. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +0 -233
  145. package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -109
  146. package/dist/es2019/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -112
  147. package/dist/es2019/plugins/type-ahead/ui/hooks/use-load-items.js +0 -41
  148. package/dist/es2019/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -38
  149. package/dist/es2019/plugins/type-ahead/utils.js +0 -126
  150. package/dist/esm/create-editor/ReactEditorViewInternal.js +0 -806
  151. package/dist/esm/create-editor/ReactEditorViewNext.js +0 -7
  152. package/dist/esm/plugins/save-on-enter/index.js +0 -63
  153. package/dist/esm/plugins/scroll-into-view/index.js +0 -50
  154. package/dist/esm/plugins/status/actions.js +0 -151
  155. package/dist/esm/plugins/status/analytics.js +0 -24
  156. package/dist/esm/plugins/status/index.js +0 -136
  157. package/dist/esm/plugins/status/keymap.js +0 -15
  158. package/dist/esm/plugins/status/nodeviews/status.js +0 -51
  159. package/dist/esm/plugins/status/plugin-key.js +0 -3
  160. package/dist/esm/plugins/status/plugin.js +0 -115
  161. package/dist/esm/plugins/status/types.js +0 -1
  162. package/dist/esm/plugins/status/ui/statusPicker.js +0 -308
  163. package/dist/esm/plugins/status/utils.js +0 -16
  164. package/dist/esm/plugins/type-ahead/api.js +0 -209
  165. package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -198
  166. package/dist/esm/plugins/type-ahead/commands/update-list-items.js +0 -17
  167. package/dist/esm/plugins/type-ahead/commands/update-query.js +0 -21
  168. package/dist/esm/plugins/type-ahead/commands/update-selected-index.js +0 -21
  169. package/dist/esm/plugins/type-ahead/constants.js +0 -9
  170. package/dist/esm/plugins/type-ahead/index.js +0 -3
  171. package/dist/esm/plugins/type-ahead/insert-utils.js +0 -101
  172. package/dist/esm/plugins/type-ahead/messages.js +0 -73
  173. package/dist/esm/plugins/type-ahead/plugin.js +0 -374
  174. package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +0 -10
  175. package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +0 -141
  176. package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
  177. package/dist/esm/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
  178. package/dist/esm/plugins/type-ahead/pm-plugins/key.js +0 -2
  179. package/dist/esm/plugins/type-ahead/pm-plugins/main.js +0 -104
  180. package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +0 -151
  181. package/dist/esm/plugins/type-ahead/pm-plugins/utils.js +0 -12
  182. package/dist/esm/plugins/type-ahead/stats-modifier.js +0 -35
  183. package/dist/esm/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
  184. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -69
  185. package/dist/esm/plugins/type-ahead/transforms/set-selection-before-query.js +0 -12
  186. package/dist/esm/plugins/type-ahead/types.js +0 -1
  187. package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +0 -115
  188. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +0 -390
  189. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +0 -276
  190. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +0 -169
  191. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +0 -220
  192. package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -117
  193. package/dist/esm/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -103
  194. package/dist/esm/plugins/type-ahead/ui/hooks/use-load-items.js +0 -43
  195. package/dist/esm/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -35
  196. package/dist/esm/plugins/type-ahead/utils.js +0 -124
  197. package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -119
  198. package/dist/types/create-editor/ReactEditorViewNext.d.ts +0 -8
  199. package/dist/types/plugins/save-on-enter/index.d.ts +0 -10
  200. package/dist/types/plugins/scroll-into-view/index.d.ts +0 -14
  201. package/dist/types/plugins/status/actions.d.ts +0 -16
  202. package/dist/types/plugins/status/analytics.d.ts +0 -4
  203. package/dist/types/plugins/status/index.d.ts +0 -15
  204. package/dist/types/plugins/status/keymap.d.ts +0 -3
  205. package/dist/types/plugins/status/nodeviews/status.d.ts +0 -25
  206. package/dist/types/plugins/status/plugin-key.d.ts +0 -4
  207. package/dist/types/plugins/status/plugin.d.ts +0 -7
  208. package/dist/types/plugins/status/types.d.ts +0 -18
  209. package/dist/types/plugins/status/ui/statusPicker.d.ts +0 -63
  210. package/dist/types/plugins/status/utils.d.ts +0 -5
  211. package/dist/types/plugins/type-ahead/api.d.ts +0 -61
  212. package/dist/types/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
  213. package/dist/types/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
  214. package/dist/types/plugins/type-ahead/commands/update-query.d.ts +0 -2
  215. package/dist/types/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
  216. package/dist/types/plugins/type-ahead/constants.d.ts +0 -8
  217. package/dist/types/plugins/type-ahead/index.d.ts +0 -4
  218. package/dist/types/plugins/type-ahead/insert-utils.d.ts +0 -18
  219. package/dist/types/plugins/type-ahead/messages.d.ts +0 -72
  220. package/dist/types/plugins/type-ahead/plugin.d.ts +0 -10
  221. package/dist/types/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
  222. package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
  223. package/dist/types/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
  224. package/dist/types/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
  225. package/dist/types/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
  226. package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
  227. package/dist/types/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
  228. package/dist/types/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
  229. package/dist/types/plugins/type-ahead/stats-modifier.d.ts +0 -20
  230. package/dist/types/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
  231. package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
  232. package/dist/types/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
  233. package/dist/types/plugins/type-ahead/types.d.ts +0 -109
  234. package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
  235. package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
  236. package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
  237. package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
  238. package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
  239. package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
  240. package/dist/types/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -3
  241. package/dist/types/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
  242. package/dist/types/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
  243. package/dist/types/plugins/type-ahead/utils.d.ts +0 -27
  244. package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -119
  245. package/dist/types-ts4.5/create-editor/ReactEditorViewNext.d.ts +0 -8
  246. package/dist/types-ts4.5/plugins/save-on-enter/index.d.ts +0 -10
  247. package/dist/types-ts4.5/plugins/scroll-into-view/index.d.ts +0 -14
  248. package/dist/types-ts4.5/plugins/status/actions.d.ts +0 -16
  249. package/dist/types-ts4.5/plugins/status/analytics.d.ts +0 -4
  250. package/dist/types-ts4.5/plugins/status/index.d.ts +0 -17
  251. package/dist/types-ts4.5/plugins/status/keymap.d.ts +0 -3
  252. package/dist/types-ts4.5/plugins/status/nodeviews/status.d.ts +0 -25
  253. package/dist/types-ts4.5/plugins/status/plugin-key.d.ts +0 -4
  254. package/dist/types-ts4.5/plugins/status/plugin.d.ts +0 -7
  255. package/dist/types-ts4.5/plugins/status/types.d.ts +0 -18
  256. package/dist/types-ts4.5/plugins/status/ui/statusPicker.d.ts +0 -63
  257. package/dist/types-ts4.5/plugins/status/utils.d.ts +0 -5
  258. package/dist/types-ts4.5/plugins/type-ahead/api.d.ts +0 -61
  259. package/dist/types-ts4.5/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
  260. package/dist/types-ts4.5/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
  261. package/dist/types-ts4.5/plugins/type-ahead/commands/update-query.d.ts +0 -2
  262. package/dist/types-ts4.5/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
  263. package/dist/types-ts4.5/plugins/type-ahead/constants.d.ts +0 -8
  264. package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +0 -4
  265. package/dist/types-ts4.5/plugins/type-ahead/insert-utils.d.ts +0 -18
  266. package/dist/types-ts4.5/plugins/type-ahead/messages.d.ts +0 -72
  267. package/dist/types-ts4.5/plugins/type-ahead/plugin.d.ts +0 -10
  268. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
  269. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
  270. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
  271. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
  272. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
  273. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
  274. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
  275. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
  276. package/dist/types-ts4.5/plugins/type-ahead/stats-modifier.d.ts +0 -20
  277. package/dist/types-ts4.5/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
  278. package/dist/types-ts4.5/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
  279. package/dist/types-ts4.5/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
  280. package/dist/types-ts4.5/plugins/type-ahead/types.d.ts +0 -111
  281. package/dist/types-ts4.5/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
  282. package/dist/types-ts4.5/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
  283. package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
  284. package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
  285. package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
  286. package/dist/types-ts4.5/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
  287. package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -7
  288. package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
  289. package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
  290. package/dist/types-ts4.5/plugins/type-ahead/utils.d.ts +0 -27
@@ -1,133 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- Object.defineProperty(exports, "pluginKey", {
9
- enumerable: true,
10
- get: function get() {
11
- return _pluginKey.pluginKey;
12
- }
13
- });
14
- Object.defineProperty(exports, "pluginKeyName", {
15
- enumerable: true,
16
- get: function get() {
17
- return _pluginKey.pluginKeyName;
18
- }
19
- });
20
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
- var _state = require("@atlaskit/editor-prosemirror/state");
22
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
23
- var _utils = require("@atlaskit/editor-common/utils");
24
- var _reactNodeView = require("@atlaskit/editor-common/react-node-view");
25
- var _status = require("./nodeviews/status");
26
- var _pluginKey = require("./plugin-key");
27
- var _utils2 = require("./utils");
28
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
- var createPlugin = function createPlugin(pmPluginFactoryParams, options) {
31
- return new _safePlugin.SafePlugin({
32
- state: {
33
- init: function init() {
34
- return {
35
- isNew: false,
36
- showStatusPickerAt: null
37
- };
38
- },
39
- apply: function apply(tr, state, oldEditorState) {
40
- var meta = tr.getMeta(_pluginKey.pluginKey);
41
- if (meta) {
42
- var newState = _objectSpread(_objectSpread({}, state), meta);
43
- pmPluginFactoryParams.dispatch(_pluginKey.pluginKey, newState);
44
- return newState;
45
- }
46
- if (tr.docChanged && state.showStatusPickerAt) {
47
- var _tr$mapping$mapResult = tr.mapping.mapResult(state.showStatusPickerAt),
48
- pos = _tr$mapping$mapResult.pos,
49
- deleted = _tr$mapping$mapResult.deleted;
50
- var showStatusPickerAt = deleted ? null : pos;
51
- var _newState = _objectSpread(_objectSpread({}, state), {}, {
52
- showStatusPickerAt: showStatusPickerAt
53
- });
54
- if (_newState.showStatusPickerAt !== state.showStatusPickerAt) {
55
- pmPluginFactoryParams.dispatch(_pluginKey.pluginKey, _newState);
56
- return _newState;
57
- }
58
- }
59
- if (tr.selectionSet) {
60
- // Change in selection, while status picker was open, update state, if required.
61
- var selectionFrom = tr.selection.from;
62
- var nodeAtSelection = tr.doc.nodeAt(selectionFrom);
63
- var _showStatusPickerAt = null;
64
- if (nodeAtSelection && nodeAtSelection.type === oldEditorState.schema.nodes.status && tr.selection instanceof _state.NodeSelection) {
65
- _showStatusPickerAt = selectionFrom;
66
- }
67
- if (_showStatusPickerAt !== state.showStatusPickerAt) {
68
- var _newState2 = _objectSpread(_objectSpread({}, state), {}, {
69
- isNew: false,
70
- showStatusPickerAt: _showStatusPickerAt
71
- });
72
- pmPluginFactoryParams.dispatch(_pluginKey.pluginKey, _newState2);
73
- return _newState2;
74
- }
75
- }
76
- return state;
77
- }
78
- },
79
- filterTransaction: function filterTransaction(tr, state) {
80
- // if it is a selection change transaction, and selection changes from node to text
81
- if (tr.selectionSet && !tr.steps.length && tr.isGeneric && tr.selection instanceof _state.TextSelection && state.selection instanceof _state.NodeSelection) {
82
- var _ref = _pluginKey.pluginKey.getState(state) || {},
83
- isNew = _ref.isNew,
84
- showStatusPickerAt = _ref.showStatusPickerAt;
85
- var nodeAtSelection = tr.doc.nodeAt(tr.selection.from);
86
- // prevent changing node selection to text selection on dom change right after inserting status
87
- // if newly selected status is selected with status picker opened
88
- if (isNew && showStatusPickerAt && nodeAtSelection && nodeAtSelection.type === state.schema.nodes.status) {
89
- return false;
90
- }
91
- }
92
- return true;
93
- },
94
- appendTransaction: function appendTransaction(transactions, oldEditorState, newEditorState) {
95
- var changed = false;
96
- var tr = newEditorState.tr;
97
-
98
- /**
99
- * When user start creating status, and, when users navigates away
100
- * while empty, then we want to remove empty ("set a status") status.
101
- * But when transaction to add empty status happens from undo/redo
102
- * we don't want to remove it.
103
- */
104
- if (transactions.find(function (tr) {
105
- return tr.selectionSet && !tr.getMeta(_utils.pmHistoryPluginKey);
106
- })) {
107
- var oldStatus = (0, _utils2.mayGetStatusAtSelection)(oldEditorState.selection);
108
- var newStatus = (0, _utils2.mayGetStatusAtSelection)(newEditorState.selection);
109
- if (oldStatus && (newStatus && oldStatus.localId !== newStatus.localId || !newStatus)) {
110
- if ((0, _utils2.isEmptyStatus)(oldStatus)) {
111
- var pos = oldEditorState.selection.from;
112
- tr.delete(tr.mapping.map(pos), tr.mapping.map(pos + 1));
113
- changed = true;
114
- }
115
- }
116
- }
117
- return changed ? tr : undefined;
118
- },
119
- key: _pluginKey.pluginKey,
120
- props: {
121
- nodeViews: {
122
- status: (0, _reactNodeView.getInlineNodeViewProducer)({
123
- pmPluginFactoryParams: pmPluginFactoryParams,
124
- Component: _status.StatusNodeView,
125
- extraComponentProps: {
126
- options: options
127
- }
128
- })
129
- }
130
- }
131
- });
132
- };
133
- var _default = exports.default = createPlugin;
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,314 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.closingMethods = exports.StatusPickerWithoutAnalytcs = exports.InputMethod = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
16
- var _react = _interopRequireDefault(require("react"));
17
- var _react2 = require("@emotion/react");
18
- var _analyticsNext = require("@atlaskit/analytics-next");
19
- var _ui = require("@atlaskit/editor-common/ui");
20
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
21
- var _picker = require("@atlaskit/status/picker");
22
- var _constants = require("@atlaskit/theme/constants");
23
- var _colors = require("@atlaskit/theme/colors");
24
- var _uiReact = require("@atlaskit/editor-common/ui-react");
25
- var _actions = require("../actions");
26
- var _analytics = require("../analytics");
27
- var _templateObject;
28
- /** @jsx jsx */
29
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
30
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
31
- var PopupWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_ui.Popup);
32
- var InputMethod = exports.InputMethod = /*#__PURE__*/function (InputMethod) {
33
- InputMethod["blur"] = "blur";
34
- InputMethod["escKey"] = "escKey";
35
- InputMethod["enterKey"] = "enterKey";
36
- return InputMethod;
37
- }({});
38
- var closingMethods = exports.closingMethods = /*#__PURE__*/function (closingMethods) {
39
- closingMethods["ArrowLeft"] = "arrowLeft";
40
- closingMethods["ArrowRight"] = "arrowRight";
41
- return closingMethods;
42
- }({});
43
- var pickerContainer = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n padding: ", " 0;\n border-radius: ", "px;\n box-shadow: ", ";\n :focus {\n outline: none;\n }\n input {\n text-transform: uppercase;\n }\n"])), "var(--ds-surface-overlay, ".concat(_colors.N0, ")"), "var(--ds-space-100, 8px)", (0, _constants.borderRadius)(), "var(--ds-shadow-overlay, 0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25))");
44
- var StatusPickerWithoutAnalytcs = exports.StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
45
- (0, _inherits2.default)(StatusPickerWithoutAnalytcs, _React$Component);
46
- var _super = _createSuper(StatusPickerWithoutAnalytcs);
47
- function StatusPickerWithoutAnalytcs(props) {
48
- var _this;
49
- (0, _classCallCheck2.default)(this, StatusPickerWithoutAnalytcs);
50
- _this = _super.call(this, props);
51
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClickOutside", function (event) {
52
- event.preventDefault();
53
- _this.inputMethod = InputMethod.blur;
54
- var selectedText = window.getSelection();
55
- if (!selectedText) {
56
- _this.props.closeStatusPicker();
57
- }
58
- });
59
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEscapeKeydown", function (event) {
60
- event.preventDefault();
61
- _this.inputMethod = InputMethod.escKey;
62
- _this.props.onEnter(_this.state);
63
- });
64
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleTabPress", function (event) {
65
- var colorButtons = event.currentTarget.querySelectorAll('button');
66
- var inputField = event.currentTarget.querySelector('input');
67
- var isInputFocussed = document.activeElement === inputField;
68
- var isButtonFocussed = Array.from(colorButtons).some(function (buttonElement) {
69
- var _document;
70
- return ((_document = document) === null || _document === void 0 ? void 0 : _document.activeElement) === buttonElement;
71
- });
72
- if (event !== null && event !== void 0 && event.shiftKey) {
73
- /* shift + tab */
74
- if (isInputFocussed) {
75
- colorButtons[0].focus();
76
- event.preventDefault();
77
- }
78
- /* After the user presses shift + tab the color-palette component updates tab index for the first color to be 0.
79
- To correctly set focus to the input field instead of the first color button we need to set focus manually
80
- */
81
- if (isButtonFocussed) {
82
- inputField === null || inputField === void 0 || inputField.focus();
83
- event.preventDefault();
84
- }
85
- } else {
86
- /* tab */
87
- if (isButtonFocussed) {
88
- inputField === null || inputField === void 0 || inputField.focus();
89
- event.preventDefault();
90
- }
91
- }
92
- });
93
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleArrow", function (event, closingMethod) {
94
- var _document2;
95
- if (((_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement) === _this.popupBodyWrapper.current) {
96
- var _this$popupBodyWrappe;
97
- event.preventDefault();
98
- (_this$popupBodyWrappe = _this.popupBodyWrapper) === null || _this$popupBodyWrappe === void 0 || (_this$popupBodyWrappe = _this$popupBodyWrappe.current) === null || _this$popupBodyWrappe === void 0 || _this$popupBodyWrappe.blur();
99
- _this.props.closeStatusPicker({
100
- closingMethod: closingMethod
101
- });
102
- }
103
- });
104
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (event) {
105
- var isTabPressed = event.key === 'Tab';
106
- if (isTabPressed) {
107
- return _this.handleTabPress(event);
108
- }
109
- if (event.key in closingMethods) {
110
- return _this.handleArrow(event, closingMethods[event.key]);
111
- }
112
- });
113
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onColorHover", function (color) {
114
- _this.createStatusAnalyticsAndFireFunc({
115
- action: 'hovered',
116
- actionSubject: 'statusColorPicker',
117
- attributes: {
118
- color: color,
119
- localId: _this.state.localId,
120
- state: (0, _analytics.analyticsState)(_this.props.isNew)
121
- }
122
- });
123
- });
124
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onColorClick", function (color) {
125
- var _this$state = _this.state,
126
- text = _this$state.text,
127
- localId = _this$state.localId;
128
- if (color === _this.state.color) {
129
- _this.createStatusAnalyticsAndFireFunc({
130
- action: 'clicked',
131
- actionSubject: 'statusColorPicker',
132
- attributes: {
133
- color: color,
134
- localId: localId,
135
- state: (0, _analytics.analyticsState)(_this.props.isNew)
136
- }
137
- });
138
- // closes status box and commits colour
139
- _this.onEnter();
140
- } else {
141
- _this.setState({
142
- color: color
143
- });
144
- _this.props.onSelect({
145
- text: text,
146
- color: color,
147
- localId: localId
148
- });
149
- }
150
- });
151
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onTextChanged", function (text) {
152
- var _this$state2 = _this.state,
153
- color = _this$state2.color,
154
- localId = _this$state2.localId;
155
- _this.setState({
156
- text: text
157
- });
158
- _this.props.onTextChanged({
159
- text: text,
160
- color: color,
161
- localId: localId
162
- }, !!_this.props.isNew);
163
- });
164
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onEnter", function () {
165
- _this.inputMethod = InputMethod.enterKey;
166
- _this.props.onEnter(_this.state);
167
- });
168
- // cancel bubbling to fix clickOutside logic:
169
- // popup re-renders its content before the click event bubbles up to the document
170
- // therefore click target element would be different from the popup content
171
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handlePopupClick", function (event) {
172
- return event.nativeEvent.stopImmediatePropagation();
173
- });
174
- _this.state = _this.extractStateFromProps(props);
175
- _this.createStatusAnalyticsAndFireFunc = (0, _analytics.createStatusAnalyticsAndFire)(props.createAnalyticsEvent);
176
- _this.popupBodyWrapper = /*#__PURE__*/_react.default.createRef();
177
- return _this;
178
- }
179
- (0, _createClass2.default)(StatusPickerWithoutAnalytcs, [{
180
- key: "fireStatusPopupOpenedAnalytics",
181
- value: function fireStatusPopupOpenedAnalytics(state) {
182
- var color = state.color,
183
- text = state.text,
184
- localId = state.localId,
185
- isNew = state.isNew;
186
- this.startTime = Date.now();
187
- this.createStatusAnalyticsAndFireFunc({
188
- action: 'opened',
189
- actionSubject: 'statusPopup',
190
- attributes: {
191
- textLength: text ? text.length : 0,
192
- selectedColor: color,
193
- localId: localId,
194
- state: (0, _analytics.analyticsState)(isNew)
195
- }
196
- });
197
- }
198
- }, {
199
- key: "fireStatusPopupClosedAnalytics",
200
- value: function fireStatusPopupClosedAnalytics(state) {
201
- var color = state.color,
202
- text = state.text,
203
- localId = state.localId,
204
- isNew = state.isNew;
205
- this.createStatusAnalyticsAndFireFunc({
206
- action: 'closed',
207
- actionSubject: 'statusPopup',
208
- attributes: {
209
- inputMethod: this.inputMethod,
210
- duration: Date.now() - this.startTime,
211
- textLength: text ? text.length : 0,
212
- selectedColor: color,
213
- localId: localId,
214
- state: (0, _analytics.analyticsState)(isNew)
215
- }
216
- });
217
- }
218
- }, {
219
- key: "reset",
220
- value: function reset() {
221
- this.startTime = Date.now();
222
- this.inputMethod = InputMethod.blur;
223
- }
224
- }, {
225
- key: "componentDidMount",
226
- value: function componentDidMount() {
227
- var _this2 = this;
228
- this.reset();
229
- this.fireStatusPopupOpenedAnalytics(this.state);
230
- if (typeof this.props.isNew === 'boolean' && this.props.isNew === false) {
231
- // Wrapper should be focused only if status already exists otherwise input field will receive focus
232
- this.focusTimeout = requestAnimationFrame(function () {
233
- var _this2$popupBodyWrapp;
234
- // Defer to prevent editor scrolling to top. See https://product-fabric.atlassian.net/browse/DTR-1952
235
- (_this2$popupBodyWrapp = _this2.popupBodyWrapper) === null || _this2$popupBodyWrapp === void 0 || (_this2$popupBodyWrapp = _this2$popupBodyWrapp.current) === null || _this2$popupBodyWrapp === void 0 || _this2$popupBodyWrapp.focus();
236
- });
237
- }
238
- }
239
- }, {
240
- key: "componentWillUnmount",
241
- value: function componentWillUnmount() {
242
- this.focusTimeout && cancelAnimationFrame(this.focusTimeout);
243
- this.fireStatusPopupClosedAnalytics(this.state);
244
- this.startTime = 0;
245
- }
246
- }, {
247
- key: "componentDidUpdate",
248
- value: function componentDidUpdate(prevProps, prevState, _snapshot) {
249
- var element = this.props.target;
250
- if (prevProps.target !== element) {
251
- var newState = this.extractStateFromProps(this.props);
252
- this.setState(newState);
253
- this.fireStatusPopupClosedAnalytics(prevState);
254
- this.reset();
255
- this.fireStatusPopupOpenedAnalytics(newState);
256
- }
257
- }
258
- }, {
259
- key: "extractStateFromProps",
260
- value: function extractStateFromProps(props) {
261
- var defaultColor = props.defaultColor,
262
- defaultText = props.defaultText,
263
- defaultLocalId = props.defaultLocalId,
264
- isNew = props.isNew;
265
- return {
266
- color: defaultColor || _actions.DEFAULT_STATUS.color,
267
- text: defaultText || _actions.DEFAULT_STATUS.text,
268
- localId: defaultLocalId,
269
- isNew: isNew
270
- };
271
- }
272
- }, {
273
- key: "render",
274
- value: function render() {
275
- var _this$props = this.props,
276
- isNew = _this$props.isNew,
277
- target = _this$props.target,
278
- mountTo = _this$props.mountTo,
279
- boundariesElement = _this$props.boundariesElement,
280
- scrollableElement = _this$props.scrollableElement;
281
- var _this$state3 = this.state,
282
- color = _this$state3.color,
283
- text = _this$state3.text;
284
- return target && (0, _react2.jsx)(PopupWithListeners, {
285
- target: target,
286
- offset: [0, 8],
287
- handleClickOutside: this.handleClickOutside,
288
- handleEscapeKeydown: this.handleEscapeKeydown,
289
- zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
290
- fitHeight: 40,
291
- mountTo: mountTo,
292
- boundariesElement: boundariesElement,
293
- scrollableElement: scrollableElement,
294
- closeOnTab: false
295
- }, (0, _react2.jsx)("div", {
296
- css: pickerContainer,
297
- tabIndex: -1,
298
- ref: this.popupBodyWrapper,
299
- onClick: this.handlePopupClick,
300
- onKeyDown: this.onKeyDown
301
- }, (0, _react2.jsx)(_picker.StatusPicker, {
302
- autoFocus: isNew,
303
- selectedColor: color,
304
- text: text,
305
- onColorClick: this.onColorClick,
306
- onColorHover: this.onColorHover,
307
- onTextChanged: this.onTextChanged,
308
- onEnter: this.onEnter
309
- })));
310
- }
311
- }]);
312
- return StatusPickerWithoutAnalytcs;
313
- }(_react.default.Component);
314
- var _default = exports.default = (0, _analyticsNext.withAnalyticsEvents)()(StatusPickerWithoutAnalytcs);
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setNodeSelectionNearPos = exports.mayGetStatusAtSelection = exports.isEmptyStatus = void 0;
7
- var _state = require("@atlaskit/editor-prosemirror/state");
8
- var mayGetStatusAtSelection = exports.mayGetStatusAtSelection = function mayGetStatusAtSelection(selection) {
9
- if (selection && selection instanceof _state.NodeSelection) {
10
- var nodeSelection = selection;
11
- if (nodeSelection.node.type.name === 'status') {
12
- return selection.node.attrs || null;
13
- }
14
- }
15
- return null;
16
- };
17
- var isEmptyStatus = exports.isEmptyStatus = function isEmptyStatus(node) {
18
- return node && (node.text && node.text.trim().length === 0 || node.text === '');
19
- };
20
- var setNodeSelectionNearPos = exports.setNodeSelectionNearPos = function setNodeSelectionNearPos(tr, pos) {
21
- return tr.setSelection(_state.NodeSelection.create(tr.doc, tr.mapping.map(pos)));
22
- };
@@ -1,215 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createTypeAheadTools = void 0;
7
- var _typeAhead = require("@atlaskit/editor-common/type-ahead");
8
- var _utils = require("./utils");
9
- var _analytics = require("@atlaskit/editor-common/analytics");
10
- var _openTypeaheadAtCursor = require("./transforms/open-typeahead-at-cursor");
11
- var _closeTypeAhead = require("./transforms/close-type-ahead");
12
- var _updateQuery = require("./commands/update-query");
13
- var _insertTypeAheadItem = require("./commands/insert-type-ahead-item");
14
- var open = function open(_ref) {
15
- var editorView = _ref.editorView;
16
- return function (itemType) {
17
- return function (inputMethod) {
18
- var state = editorView.state;
19
- var handler = (0, _utils.findHandler)(itemType, state);
20
- if (!handler) {
21
- return false;
22
- }
23
- var tr = state.tr;
24
- (0, _openTypeaheadAtCursor.openTypeAheadAtCursor)({
25
- triggerHandler: handler,
26
- inputMethod: inputMethod
27
- })({
28
- tr: tr
29
- });
30
- editorView.dispatch(tr);
31
- return true;
32
- };
33
- };
34
- };
35
- var defaultCloseOptions = {
36
- insertCurrentQueryAsRawText: false
37
- };
38
- var close = function close(_ref2) {
39
- var editorView = _ref2.editorView;
40
- return function () {
41
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultCloseOptions;
42
- var state = editorView.state;
43
- var currentQuery = (0, _utils.getTypeAheadQuery)(editorView.state);
44
- var tr = state.tr;
45
- if (options.attachCommand) {
46
- var fakeDispatch = function fakeDispatch(customTr) {
47
- tr = customTr;
48
- };
49
- options.attachCommand(state, fakeDispatch);
50
- }
51
- (0, _closeTypeAhead.closeTypeAhead)(tr);
52
- if (options.insertCurrentQueryAsRawText && currentQuery && currentQuery.length > 0) {
53
- var handler = (0, _utils.getTypeAheadHandler)(state);
54
- var text = handler.trigger.concat(currentQuery);
55
- tr.replaceSelectionWith(state.schema.text(text));
56
- }
57
- editorView.dispatch(tr);
58
- if (!editorView.hasFocus()) {
59
- editorView.focus();
60
- }
61
- return true;
62
- };
63
- };
64
- var search = function search(_ref3) {
65
- var editorView = _ref3.editorView;
66
- return function (itemType) {
67
- return function () {
68
- var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
69
- var state = editorView.state;
70
- var handler = (0, _utils.findHandler)(itemType, state);
71
- if (!handler) {
72
- throw new Error("Handler not found, did you load the ".concat(itemType, " plugin properly"));
73
- }
74
- open({
75
- editorView: editorView
76
- })(itemType)(_analytics.INPUT_METHOD.KEYBOARD);
77
- (0, _updateQuery.updateQuery)(query)(editorView.state, editorView.dispatch);
78
- var lastQuery = {
79
- current: query
80
- };
81
- var last = handler.getItems({
82
- query: query,
83
- editorState: state
84
- }).then(function (items) {
85
- if (!handler.forceSelect) {
86
- return items;
87
- }
88
- var forceSelectedItem = handler.forceSelect({
89
- items: items,
90
- query: query,
91
- editorState: state
92
- });
93
- if (!forceSelectedItem) {
94
- return items;
95
- }
96
- (0, _insertTypeAheadItem.insertTypeAheadItem)(editorView)({
97
- handler: handler,
98
- item: forceSelectedItem,
99
- query: query,
100
- mode: _typeAhead.SelectItemMode.SELECTED,
101
- sourceListItem: items
102
- });
103
- });
104
- var results = {
105
- last: last
106
- };
107
- return {
108
- type: function type(appendValue) {
109
- if (!appendValue) {
110
- return;
111
- }
112
- lastQuery.current += appendValue;
113
- (0, _updateQuery.updateQuery)(lastQuery.current)(editorView.state, editorView.dispatch);
114
- var promise = handler.getItems({
115
- query: lastQuery.current,
116
- editorState: state
117
- });
118
- results.last = promise;
119
- return promise;
120
- },
121
- result: function result() {
122
- return results.last;
123
- },
124
- close: close({
125
- editorView: editorView
126
- }),
127
- insert: function insert(_ref4) {
128
- var index = _ref4.index,
129
- mode = _ref4.mode;
130
- return results.last.then(function (result) {
131
- var item = result ? result[index] : null;
132
- if (result && item) {
133
- (0, _insertTypeAheadItem.insertTypeAheadItem)(editorView)({
134
- handler: handler,
135
- item: item,
136
- query: query,
137
- mode: mode || _typeAhead.SelectItemMode.SELECTED,
138
- sourceListItem: result
139
- });
140
- }
141
- });
142
- }
143
- };
144
- };
145
- };
146
- };
147
- var insertItem = function insertItem(_ref5) {
148
- var editorView = _ref5.editorView;
149
- return function (itemType) {
150
- return function (_ref6) {
151
- var contentItem = _ref6.contentItem,
152
- query = _ref6.query,
153
- sourceListItem = _ref6.sourceListItem;
154
- var state = editorView.state;
155
- var handler = (0, _utils.findHandler)(itemType, state);
156
- if (!handler) {
157
- return false;
158
- }
159
- (0, _insertTypeAheadItem.insertTypeAheadItem)(editorView)({
160
- handler: handler,
161
- item: contentItem,
162
- mode: _typeAhead.SelectItemMode.SELECTED,
163
- query: query,
164
- sourceListItem: sourceListItem
165
- });
166
- return true;
167
- };
168
- };
169
- };
170
- var isOpen = function isOpen(_ref7) {
171
- var editorView = _ref7.editorView;
172
- return function () {
173
- if (!(0, _utils.isTypeAheadOpen)(editorView.state)) {
174
- return false;
175
- }
176
- var handler = (0, _utils.getTypeAheadHandler)(editorView.state);
177
- if (!handler) {
178
- return false;
179
- }
180
- return handler;
181
- };
182
- };
183
- var currentQuery = function currentQuery(_ref8) {
184
- var editorView = _ref8.editorView;
185
- return function () {
186
- return (0, _utils.getTypeAheadQuery)(editorView.state);
187
- };
188
- };
189
-
190
- /**
191
- * Please do not use it. Ping #help-editor and talk to the Lego team before use it.
192
- *
193
- * @private
194
- * @deprecated
195
- *
196
- */
197
- var createTypeAheadTools = exports.createTypeAheadTools = function createTypeAheadTools(editorView) {
198
- var props = {
199
- editorView: editorView
200
- };
201
- return {
202
- isOpen: isOpen(props),
203
- currentQuery: currentQuery(props),
204
- close: close(props),
205
- openMention: open(props)(_typeAhead.TypeAheadAvailableNodes.MENTION),
206
- searchMention: search(props)(_typeAhead.TypeAheadAvailableNodes.MENTION),
207
- openQuickInsert: open(props)(_typeAhead.TypeAheadAvailableNodes.QUICK_INSERT),
208
- searchQuickInsert: search(props)(_typeAhead.TypeAheadAvailableNodes.QUICK_INSERT),
209
- openEmoji: open(props)(_typeAhead.TypeAheadAvailableNodes.EMOJI),
210
- searchEmoji: search(props)(_typeAhead.TypeAheadAvailableNodes.EMOJI),
211
- insertItemMention: insertItem(props)(_typeAhead.TypeAheadAvailableNodes.MENTION),
212
- insertItemEmoji: insertItem(props)(_typeAhead.TypeAheadAvailableNodes.EMOJI),
213
- insertItemQuickInsert: insertItem(props)(_typeAhead.TypeAheadAvailableNodes.QUICK_INSERT)
214
- };
215
- };