@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,179 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.itemIcon = exports.TypeAheadListItem = exports.ITEM_PADDING = exports.ICON_WIDTH = exports.ICON_HEIGHT = void 0;
9
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _react2 = require("@emotion/react");
12
- var _colors = require("@atlaskit/theme/colors");
13
- var _components = require("@atlaskit/theme/components");
14
- var _constants = require("@atlaskit/theme/constants");
15
- var _menu = require("@atlaskit/menu");
16
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
17
- var _quickInsert = require("@atlaskit/editor-common/quick-insert");
18
- var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
19
- var _typeAhead = require("@atlaskit/editor-common/type-ahead");
20
- var _reactIntlNext = require("react-intl-next");
21
- var _messages = require("../messages");
22
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
23
- /** @jsx jsx */
24
- 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); }
25
- 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; }
26
- var ICON_HEIGHT = exports.ICON_HEIGHT = 40;
27
- var ICON_WIDTH = exports.ICON_WIDTH = 40;
28
- var ITEM_PADDING = exports.ITEM_PADDING = 12;
29
- var itemIcon = exports.itemIcon = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: ", "px;\n height: ", "px;\n overflow: hidden;\n border: 1px solid ", "; /* N60 at 50% */\n border-radius: ", "px;\n box-sizing: border-box;\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n div {\n width: ", "px;\n height: ", "px;\n }\n"])), ICON_WIDTH, ICON_HEIGHT, "var(--ds-border, rgba(223, 225, 229, 0.5))", (0, _constants.borderRadius)(), ICON_WIDTH, ICON_HEIGHT);
30
- var itemBody = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n"])));
31
- var itemText = function itemText(theme) {
32
- return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n white-space: initial;\n color: ", ";\n .item-title {\n line-height: 1.4;\n }\n .item-description {\n font-size: ", ";\n color: ", ";\n margin-top: 3px;\n }\n"])), (0, _components.themed)({
33
- light: "var(--ds-text, ".concat(_colors.N800, ")"),
34
- dark: "var(--ds-text, ".concat(_colors.DN600, ")")
35
- })(theme), (0, _editorSharedStyles.relativeFontSizeToBase16)(12), "var(--ds-text-subtlest, ".concat(_colors.N200, ")"));
36
- };
37
- var itemAfter = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n"])));
38
- var customRenderItemDivStyle = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n &:focus {\n box-shadow: inset 2px 0px 0px ", ";\n background-color: ", ";\n outline: none;\n }\n"])), "var(--ds-border-focused, ".concat(_colors.B400, ")"), "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30, ")"));
39
-
40
- /**
41
- * This CSS emulates the desired behaviour with :focus-visible for firefox.
42
- * Firefox unfortunately does not register keyboard focus if user mouseDown and drag a typeahead item
43
- * resulting in focus-visible style not drawn.
44
- */
45
- var selectionFrame = {
46
- '& > button:focus': {
47
- boxShadow: "inset 2px 0px 0px ".concat("var(--ds-border-focused, ".concat(_colors.B400, ")"), ";"),
48
- backgroundColor: "".concat("var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30, ")")),
49
- outline: 'none',
50
- '&:active': {
51
- boxShadow: 'none'
52
- }
53
- },
54
- '& > button:hover': {
55
- backgroundColor: 'inherit',
56
- outline: 'none'
57
- }
58
- };
59
- var selectedStyle = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n box-shadow: inset 2px 0px 0px ", ";\n"])), "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30, ")"), "var(--ds-border-focused, ".concat(_colors.B400, ")"));
60
- var FallbackIcon = /*#__PURE__*/_react.default.memo(function (_ref) {
61
- var label = _ref.label;
62
- return (0, _react2.jsx)(_quickInsert.IconFallback, null);
63
- });
64
- var noop = function noop() {};
65
- var AssistiveText = function AssistiveText(_ref2) {
66
- var title = _ref2.title,
67
- description = _ref2.description,
68
- shortcut = _ref2.shortcut;
69
- var intl = (0, _reactIntlNext.useIntl)();
70
- var descriptionText = description ? " ".concat(intl.formatMessage(_messages.typeAheadListMessages.descriptionLabel), " ").concat(description, ".") : '';
71
- var shortcutText = shortcut ? " ".concat(intl.formatMessage(_messages.typeAheadListMessages.shortcutLabel), " ").concat(shortcut, ".") : '';
72
- return (0, _react2.jsx)("span", {
73
- className: "assistive"
74
- }, "".concat(title, ". ").concat(descriptionText, " ").concat(shortcutText));
75
- };
76
- var TypeAheadListItem = exports.TypeAheadListItem = function TypeAheadListItem(_ref3) {
77
- var item = _ref3.item,
78
- itemsLength = _ref3.itemsLength,
79
- selectedIndex = _ref3.selectedIndex,
80
- onItemClick = _ref3.onItemClick,
81
- itemIndex = _ref3.itemIndex,
82
- ariaLabel = _ref3.ariaLabel;
83
- /**
84
- * To select and highlight the first Item when no item is selected
85
- * However selectedIndex remains -1, So that user does not skip the first item when down arrow key is used from typeahead query(inputQuery.tsx)
86
- */
87
- var isSelected = itemIndex === selectedIndex || selectedIndex === -1 && itemIndex === 0;
88
- var icon = item.icon,
89
- title = item.title,
90
- customRenderItem = item.render;
91
- var elementIcon = (0, _react.useMemo)(function () {
92
- return (0, _react2.jsx)("div", {
93
- css: itemIcon
94
- }, icon ? icon() : (0, _react2.jsx)(FallbackIcon, {
95
- label: title
96
- }));
97
- }, [icon, title]);
98
- var insertSelectedItem = (0, _react.useCallback)(function () {
99
- onItemClick(_typeAhead.SelectItemMode.SELECTED, itemIndex);
100
- }, [onItemClick, itemIndex]);
101
- var customItemRef = /*#__PURE__*/_react.default.createRef();
102
- var buttonItemRef = /*#__PURE__*/_react.default.createRef();
103
- var shouldUpdateFocus = selectedIndex === itemIndex;
104
- (0, _react.useLayoutEffect)(function () {
105
- if (shouldUpdateFocus) {
106
- var _customItemRef$curren;
107
- customItemRef === null || customItemRef === void 0 || (_customItemRef$curren = customItemRef.current) === null || _customItemRef$curren === void 0 || _customItemRef$curren.focus();
108
- }
109
- }, [customItemRef, shouldUpdateFocus]);
110
- (0, _react.useLayoutEffect)(function () {
111
- if (shouldUpdateFocus) {
112
- var _buttonItemRef$curren;
113
- buttonItemRef === null || buttonItemRef === void 0 || (_buttonItemRef$curren = buttonItemRef.current) === null || _buttonItemRef$curren === void 0 || _buttonItemRef$curren.focus();
114
- }
115
- }, [buttonItemRef, shouldUpdateFocus]);
116
- var customItem = (0, _react.useMemo)(function () {
117
- if (!customRenderItem) {
118
- return null;
119
- }
120
- var Comp = customRenderItem;
121
- var listItemClasses = [customRenderItemDivStyle, isSelected && selectedStyle];
122
- return (0, _react2.jsx)("div", {
123
- "aria-selected": isSelected,
124
- role: "option",
125
- "aria-label": ariaLabel,
126
- "aria-setsize": itemsLength,
127
- "aria-posinset": itemIndex,
128
- tabIndex: 0,
129
- css: listItemClasses,
130
- className: "ak-typeahead-item ".concat(isSelected ? 'typeahead-selected-item' : '')
131
- //CSS classes added for test cases purpose
132
- ,
133
- ref: customItemRef
134
- }, (0, _react2.jsx)("div", {
135
- "aria-hidden": true
136
- }, (0, _react2.jsx)(Comp, {
137
- onClick: insertSelectedItem,
138
- isSelected: false //The selection styles are handled in the parent div instead. Hence isSelected is made false always.
139
- ,
140
- onHover: noop
141
- })));
142
- }, [customRenderItem, isSelected, ariaLabel, itemsLength, customItemRef, insertSelectedItem, itemIndex]);
143
- if (customItem) {
144
- return customItem;
145
- }
146
- var listItemClasses = [selectionFrame, isSelected && selectedStyle];
147
- return (0, _react2.jsx)("span", {
148
- css: listItemClasses
149
- }, (0, _react2.jsx)(_menu.ButtonItem, {
150
- onClick: insertSelectedItem,
151
- iconBefore: elementIcon,
152
- isSelected: isSelected,
153
- "aria-selected": isSelected,
154
- "aria-label": title,
155
- "aria-setsize": itemsLength,
156
- "aria-posinset": itemIndex,
157
- role: "option",
158
- ref: buttonItemRef,
159
- css: listItemClasses
160
- }, (0, _react2.jsx)("div", {
161
- "aria-hidden": true
162
- }, (0, _react2.jsx)("div", {
163
- css: itemText
164
- }, (0, _react2.jsx)("div", {
165
- css: itemBody
166
- }, (0, _react2.jsx)("div", {
167
- className: "item-title"
168
- }, item.title), (0, _react2.jsx)("div", {
169
- css: itemAfter
170
- }, item.keyshortcut && (0, _react2.jsx)("div", {
171
- css: _shortcut.shortcutStyle
172
- }, item.keyshortcut))), (0, _react2.jsx)("div", {
173
- className: "item-description"
174
- }, item.description))), (0, _react2.jsx)(AssistiveText, {
175
- title: item.title,
176
- description: item.description,
177
- shortcut: item.keyshortcut
178
- })));
179
- };
@@ -1,230 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.TypeAheadPopup = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
- var _react = _interopRequireWildcard(require("react"));
12
- var _react2 = require("@emotion/react");
13
- var _rafSchd = _interopRequireDefault(require("raf-schd"));
14
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
- var _ui = require("@atlaskit/editor-common/ui");
16
- var _constants = require("@atlaskit/theme/constants");
17
- var _colors = require("@atlaskit/theme/colors");
18
- var _analytics = require("@atlaskit/editor-common/analytics");
19
- var _constants2 = require("../constants");
20
- var _TypeAheadList = require("./TypeAheadList");
21
- var _TypeAheadListItem = require("./TypeAheadListItem");
22
- var _templateObject;
23
- /** @jsx jsx */
24
- 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); }
25
- 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; }
26
- var DEFAULT_TYPEAHEAD_MENU_HEIGHT = 380;
27
- var typeAheadContent = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n padding: ", " 0;\n width: 320px;\n max-height: 380px; /* ~5.5 visibile items */\n overflow-y: auto;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n position: relative;\n"])), "var(--ds-surface-overlay, ".concat(_colors.N0, ")"), (0, _constants.borderRadius)(), "var(--ds-shadow-overlay, ".concat("0 0 1px ".concat(_colors.N60A, ", 0 4px 8px -2px ").concat(_colors.N50A), ")"), "var(--ds-space-050, 4px)");
28
- var Highlight = function Highlight(_ref) {
29
- var state = _ref.state,
30
- triggerHandler = _ref.triggerHandler;
31
- if (!(triggerHandler !== null && triggerHandler !== void 0 && triggerHandler.getHighlight)) {
32
- return null;
33
- }
34
- return triggerHandler.getHighlight(state);
35
- };
36
- var OFFSET = [0, 8];
37
- var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
38
- var editorView = props.editorView,
39
- triggerHandler = props.triggerHandler,
40
- anchorElement = props.anchorElement,
41
- popupsMountPoint = props.popupsMountPoint,
42
- popupsBoundariesElement = props.popupsBoundariesElement,
43
- popupsScrollableElement = props.popupsScrollableElement,
44
- items = props.items,
45
- selectedIndex = props.selectedIndex,
46
- onItemInsert = props.onItemInsert,
47
- fireAnalyticsCallback = props.fireAnalyticsCallback,
48
- isEmptyQuery = props.isEmptyQuery,
49
- cancel = props.cancel;
50
- var ref = (0, _react.useRef)(null);
51
- var startTime = (0, _react.useMemo)(function () {
52
- return performance.now();
53
- },
54
- // In case those props changes
55
- // we need to recreate the startTime
56
- [items, isEmptyQuery, fireAnalyticsCallback, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
57
- );
58
-
59
- (0, _react.useEffect)(function () {
60
- if (!fireAnalyticsCallback) {
61
- return;
62
- }
63
- var stopTime = performance.now();
64
- var time = stopTime - startTime;
65
- fireAnalyticsCallback({
66
- payload: {
67
- action: _analytics.ACTION.RENDERED,
68
- actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
69
- eventType: _analytics.EVENT_TYPE.OPERATIONAL,
70
- attributes: {
71
- time: time,
72
- items: items.length,
73
- initial: isEmptyQuery
74
- }
75
- }
76
- });
77
- }, [startTime, items, fireAnalyticsCallback, isEmptyQuery,
78
- // In case the current triggerHandler changes
79
- // e.g: Inserting a mention using the quick insert
80
- // we need to send the event again
81
- // eslint-disable-next-line react-hooks/exhaustive-deps
82
- triggerHandler]);
83
- (0, _react.useEffect)(function () {
84
- if (!fireAnalyticsCallback) {
85
- return;
86
- }
87
- fireAnalyticsCallback({
88
- payload: {
89
- action: _analytics.ACTION.VIEWED,
90
- actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD_ITEM,
91
- eventType: _analytics.EVENT_TYPE.OPERATIONAL,
92
- attributes: {
93
- index: selectedIndex,
94
- items: items.length
95
- }
96
- }
97
- });
98
- }, [items, fireAnalyticsCallback, selectedIndex,
99
- // In case the current triggerHandler changes
100
- // e.g: Inserting a mention using the quick insert
101
- // we need to send the event again
102
- // eslint-disable-next-line react-hooks/exhaustive-deps
103
- triggerHandler]);
104
- var _useState = (0, _react.useState)(DEFAULT_TYPEAHEAD_MENU_HEIGHT),
105
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
106
- fitHeight = _useState2[0],
107
- setFitHeight = _useState2[1];
108
- var getFitHeight = (0, _react.useCallback)(function () {
109
- if (!anchorElement || !popupsMountPoint) {
110
- return;
111
- }
112
- var target = anchorElement;
113
- var _target$getBoundingCl = target.getBoundingClientRect(),
114
- targetTop = _target$getBoundingCl.top,
115
- targetHeight = _target$getBoundingCl.height;
116
- var boundariesElement = document.body;
117
- var _boundariesElement$ge = boundariesElement.getBoundingClientRect(),
118
- boundariesHeight = _boundariesElement$ge.height,
119
- boundariesTop = _boundariesElement$ge.top;
120
-
121
- // Calculating the space above and space below our decoration
122
- var spaceAbove = targetTop - (boundariesTop - boundariesElement.scrollTop);
123
- var spaceBelow = boundariesTop + boundariesHeight - (targetTop + targetHeight);
124
-
125
- // Keep default height if more than enough space
126
- if (spaceBelow >= DEFAULT_TYPEAHEAD_MENU_HEIGHT) {
127
- return setFitHeight(DEFAULT_TYPEAHEAD_MENU_HEIGHT);
128
- }
129
-
130
- // Determines whether typeahead will fit above or below decoration
131
- // and return the space available.
132
- var newFitHeight = spaceBelow >= spaceAbove ? spaceBelow : spaceAbove;
133
-
134
- // Each typeahead item has some padding
135
- // We want to leave some space at the top so first item
136
- // is not partially cropped
137
- var fitHeightWithSpace = newFitHeight - _TypeAheadListItem.ITEM_PADDING * 2;
138
-
139
- // Ensure typeahead height is max its default height
140
- var minFitHeight = Math.min(DEFAULT_TYPEAHEAD_MENU_HEIGHT, fitHeightWithSpace);
141
- return setFitHeight(minFitHeight);
142
- }, [anchorElement, popupsMountPoint]);
143
- var getFitHeightDebounced = (0, _rafSchd.default)(getFitHeight);
144
- (0, _react.useLayoutEffect)(function () {
145
- var scrollableElement = popupsScrollableElement || (0, _ui.findOverflowScrollParent)(anchorElement);
146
- getFitHeight();
147
- window.addEventListener('resize', getFitHeightDebounced);
148
- if (scrollableElement) {
149
- scrollableElement.addEventListener('scroll', getFitHeightDebounced);
150
- }
151
- return function () {
152
- window.removeEventListener('resize', getFitHeightDebounced);
153
- if (scrollableElement) {
154
- scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
155
- }
156
- };
157
- }, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight]);
158
- (0, _react.useLayoutEffect)(function () {
159
- var focusOut = function focusOut(event) {
160
- var _window$getSelection;
161
- var relatedTarget = event.relatedTarget;
162
-
163
- // Given the user is changing the focus
164
- // When the target is inside the TypeAhead Popup
165
- // Then the popup should stay open
166
- if (relatedTarget instanceof HTMLElement && relatedTarget.closest && (relatedTarget.closest(".".concat(_constants2.TYPE_AHEAD_POPUP_CONTENT_CLASS)) || relatedTarget.closest("[data-type-ahead=\"".concat(_constants2.TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, "\"]")))) {
167
- return;
168
- }
169
- if (!(((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range')) {
170
- return;
171
- }
172
- cancel({
173
- addPrefixTrigger: true,
174
- setSelectionAt: _constants2.CloseSelectionOptions.AFTER_TEXT_INSERTED,
175
- forceFocusOnEditor: false
176
- });
177
- };
178
- var element = ref.current;
179
- element === null || element === void 0 || element.addEventListener('focusout', focusOut);
180
- return function () {
181
- element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
182
- };
183
- }, [ref, cancel]);
184
-
185
- // ED-17443 When you press escape on typeahead panel, it should remove focus and close the panel
186
- // This is the expected keyboard behaviour advised by the Accessibility team
187
- (0, _react.useLayoutEffect)(function () {
188
- var escape = function escape(event) {
189
- if (event.key === 'Escape') {
190
- cancel({
191
- addPrefixTrigger: true,
192
- setSelectionAt: _constants2.CloseSelectionOptions.AFTER_TEXT_INSERTED,
193
- forceFocusOnEditor: true
194
- });
195
- }
196
- };
197
- var element = ref.current;
198
- element === null || element === void 0 || element.addEventListener('keydown', escape);
199
- return function () {
200
- element === null || element === void 0 || element.removeEventListener('keydown', escape);
201
- };
202
- }, [ref, cancel]);
203
- return (0, _react2.jsx)(_ui.Popup, {
204
- zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
205
- target: anchorElement,
206
- mountTo: popupsMountPoint,
207
- boundariesElement: popupsBoundariesElement,
208
- scrollableElement: popupsScrollableElement,
209
- fitHeight: fitHeight,
210
- fitWidth: 340,
211
- offset: OFFSET
212
- }, (0, _react2.jsx)("div", {
213
- css: typeAheadContent,
214
- tabIndex: 0,
215
- className: _constants2.TYPE_AHEAD_POPUP_CONTENT_CLASS,
216
- ref: ref
217
- }, (0, _react2.jsx)(Highlight, {
218
- state: editorView.state,
219
- triggerHandler: triggerHandler
220
- }), (0, _react2.jsx)(_TypeAheadList.TypeAheadList, {
221
- items: items,
222
- selectedIndex: selectedIndex,
223
- onItemClick: onItemInsert,
224
- fitHeight: fitHeight,
225
- editorView: editorView,
226
- decorationElement: anchorElement,
227
- triggerHandler: triggerHandler
228
- })));
229
- });
230
- TypeAheadPopup.displayName = 'TypeAheadPopup';
@@ -1,127 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.WrapperTypeAhead = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _typeAhead = require("@atlaskit/editor-common/type-ahead");
12
- var _utils = require("../utils");
13
- var _updateQuery = require("../commands/update-query");
14
- var _InputQuery = require("./InputQuery");
15
- var _useLoadItems = require("./hooks/use-load-items");
16
- var _useItemInsert3 = require("./hooks/use-item-insert");
17
- var _useOnForceSelect = require("./hooks/use-on-force-select");
18
- 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); }
19
- 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; }
20
- var WrapperTypeAhead = exports.WrapperTypeAhead = /*#__PURE__*/_react.default.memo(function (_ref) {
21
- var triggerHandler = _ref.triggerHandler,
22
- editorView = _ref.editorView,
23
- anchorElement = _ref.anchorElement,
24
- shouldFocusCursorInsideQuery = _ref.shouldFocusCursorInsideQuery,
25
- popupsMountPoint = _ref.popupsMountPoint,
26
- popupsBoundariesElement = _ref.popupsBoundariesElement,
27
- popupsScrollableElement = _ref.popupsScrollableElement,
28
- createAnalyticsEvent = _ref.createAnalyticsEvent,
29
- inputMethod = _ref.inputMethod,
30
- getDecorationPosition = _ref.getDecorationPosition,
31
- reopenQuery = _ref.reopenQuery,
32
- onUndoRedo = _ref.onUndoRedo;
33
- var _useState = (0, _react.useState)(false),
34
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
35
- closed = _useState2[0],
36
- setClosed = _useState2[1];
37
- var _useState3 = (0, _react.useState)(reopenQuery || ''),
38
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
39
- query = _useState4[0],
40
- setQuery = _useState4[1];
41
- var queryRef = (0, _react.useRef)(query);
42
- var editorViewRef = (0, _react.useRef)(editorView);
43
- var items = (0, _useLoadItems.useLoadItems)(triggerHandler, editorView, query);
44
- (0, _react.useLayoutEffect)(function () {
45
- queryRef.current = query;
46
- }, [query]);
47
- var _useItemInsert = (0, _useItemInsert3.useItemInsert)(triggerHandler, editorView, items),
48
- _useItemInsert2 = (0, _slicedToArray2.default)(_useItemInsert, 2),
49
- onItemInsert = _useItemInsert2[0],
50
- onTextInsert = _useItemInsert2[1];
51
- var selectNextItem = (0, _react.useMemo)(function () {
52
- return (0, _utils.moveSelectedIndex)({
53
- editorView: editorView,
54
- direction: 'next'
55
- });
56
- }, [editorView]);
57
- var selectPreviousItem = (0, _react.useMemo)(function () {
58
- return (0, _utils.moveSelectedIndex)({
59
- editorView: editorView,
60
- direction: 'previous'
61
- });
62
- }, [editorView]);
63
- var cancel = (0, _react.useCallback)(function (_ref2) {
64
- var setSelectionAt = _ref2.setSelectionAt,
65
- addPrefixTrigger = _ref2.addPrefixTrigger,
66
- text = _ref2.text,
67
- forceFocusOnEditor = _ref2.forceFocusOnEditor;
68
- setClosed(true);
69
- var fullquery = addPrefixTrigger ? "".concat(triggerHandler.trigger).concat(text) : text;
70
- onTextInsert({
71
- forceFocusOnEditor: forceFocusOnEditor,
72
- setSelectionAt: setSelectionAt,
73
- text: fullquery
74
- });
75
- }, [triggerHandler, onTextInsert]);
76
- var insertSelectedItem = (0, _react.useCallback)(function () {
77
- var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _typeAhead.SelectItemMode.SELECTED;
78
- var view = editorViewRef.current;
79
- var _ref3 = (0, _utils.getPluginState)(view.state),
80
- selectedIndex = _ref3.selectedIndex;
81
- setClosed(true);
82
- queueMicrotask(function () {
83
- onItemInsert({
84
- mode: mode,
85
- index: selectedIndex,
86
- query: queryRef.current
87
- });
88
- });
89
- }, [onItemInsert]);
90
- var showTypeAheadPopupList = (0, _react.useCallback)(function () {}, []);
91
- var closePopup = (0, _react.useCallback)(function () {
92
- setClosed(true);
93
- }, []);
94
- (0, _react.useEffect)(function () {
95
- var view = editorViewRef.current;
96
- var pluginState = (0, _utils.getPluginState)(view.state);
97
- if (query.length === 0 || query === (pluginState === null || pluginState === void 0 ? void 0 : pluginState.query) || !(pluginState !== null && pluginState !== void 0 && pluginState.triggerHandler)) {
98
- return;
99
- }
100
- (0, _updateQuery.updateQuery)(query)(view.state, view.dispatch);
101
- }, [query, reopenQuery]);
102
- (0, _useOnForceSelect.useOnForceSelect)({
103
- triggerHandler: triggerHandler,
104
- items: items,
105
- query: query,
106
- editorView: editorView,
107
- closePopup: closePopup
108
- });
109
- if (closed) {
110
- return null;
111
- }
112
- return /*#__PURE__*/_react.default.createElement(_InputQuery.InputQuery, {
113
- triggerQueryPrefix: triggerHandler.trigger,
114
- onQueryChange: setQuery,
115
- onItemSelect: insertSelectedItem,
116
- selectNextItem: selectNextItem,
117
- selectPreviousItem: selectPreviousItem,
118
- onQueryFocus: showTypeAheadPopupList,
119
- cancel: cancel,
120
- forceFocus: shouldFocusCursorInsideQuery,
121
- onUndoRedo: onUndoRedo,
122
- reopenQuery: reopenQuery,
123
- editorView: editorView,
124
- items: items
125
- });
126
- });
127
- WrapperTypeAhead.displayName = 'WrapperTypeAhead';
@@ -1,109 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useItemInsert = void 0;
7
- var _react = require("react");
8
- var _typeAhead = require("@atlaskit/editor-common/type-ahead");
9
- var _closeTypeAhead = require("../../transforms/close-type-ahead");
10
- var _setSelectionBeforeQuery = require("../../transforms/set-selection-before-query");
11
- var _insertTypeAheadItem = require("../../commands/insert-type-ahead-item");
12
- var _constants = require("../../constants");
13
- var insertRawQuery = function insertRawQuery(_ref) {
14
- var view = _ref.view,
15
- setSelectionAt = _ref.setSelectionAt,
16
- text = _ref.text,
17
- forceFocusOnEditor = _ref.forceFocusOnEditor;
18
- var _view$state = view.state,
19
- tr = _view$state.tr,
20
- schema = _view$state.schema;
21
- (0, _closeTypeAhead.closeTypeAhead)(tr);
22
- if (text.length > 0) {
23
- tr.replaceSelectionWith(schema.text(text));
24
- if (setSelectionAt === _constants.CloseSelectionOptions.BEFORE_TEXT_INSERTED) {
25
- (0, _setSelectionBeforeQuery.setSelectionBeforeQuery)(text)(tr);
26
- }
27
- }
28
- view.dispatch(tr);
29
- if (forceFocusOnEditor) {
30
- view.focus();
31
- }
32
- };
33
- var useItemInsert = exports.useItemInsert = function useItemInsert(triggerHandler, editorView, items) {
34
- var editorViewRef = (0, _react.useRef)(editorView);
35
- var itemsRef = (0, _react.useRef)(items);
36
- var onTextInsert = (0, _react.useCallback)(function (_ref2) {
37
- var setSelectionAt = _ref2.setSelectionAt,
38
- text = _ref2.text,
39
- forceFocusOnEditor = _ref2.forceFocusOnEditor;
40
- if (!triggerHandler) {
41
- return;
42
- }
43
- var view = editorViewRef.current;
44
- insertRawQuery({
45
- view: view,
46
- setSelectionAt: setSelectionAt,
47
- text: text,
48
- forceFocusOnEditor: forceFocusOnEditor
49
- });
50
- }, [triggerHandler]);
51
- var onItemInsert = (0, _react.useCallback)(function (_ref3) {
52
- var mode = _ref3.mode,
53
- index = _ref3.index,
54
- query = _ref3.query;
55
- var sourceListItem = itemsRef.current;
56
- if (sourceListItem.length === 0 || !triggerHandler) {
57
- var text = "".concat(triggerHandler.trigger).concat(query);
58
- onTextInsert({
59
- forceFocusOnEditor: true,
60
- setSelectionAt: _constants.CloseSelectionOptions.AFTER_TEXT_INSERTED,
61
- text: text
62
- });
63
- return;
64
- }
65
- var itemToInsert = sourceListItem[index];
66
- if (!itemToInsert) {
67
- return;
68
- }
69
- var view = editorViewRef.current;
70
- (0, _insertTypeAheadItem.insertTypeAheadItem)(view)({
71
- item: itemToInsert,
72
- handler: triggerHandler,
73
- mode: mode,
74
- query: query,
75
- sourceListItem: sourceListItem
76
- });
77
- }, [triggerHandler, onTextInsert]);
78
- var onItemMatch = (0, _react.useCallback)(function (_ref4) {
79
- var mode = _ref4.mode,
80
- query = _ref4.query;
81
- var _items = itemsRef.current;
82
- if (_items && _items.length > 1) {
83
- return false;
84
- }
85
- if (_items.length === 1) {
86
- queueMicrotask(function () {
87
- onItemInsert({
88
- mode: mode,
89
- query: query,
90
- index: 0
91
- });
92
- });
93
- } else {
94
- var text = "".concat(triggerHandler.trigger).concat(query);
95
- queueMicrotask(function () {
96
- onTextInsert({
97
- forceFocusOnEditor: true,
98
- setSelectionAt: _constants.CloseSelectionOptions.AFTER_TEXT_INSERTED,
99
- text: mode === _typeAhead.SelectItemMode.SPACE ? text.concat(' ') : text
100
- });
101
- });
102
- }
103
- return true;
104
- }, [onItemInsert, triggerHandler, onTextInsert]);
105
- (0, _react.useLayoutEffect)(function () {
106
- itemsRef.current = items;
107
- }, [items]);
108
- return [onItemInsert, onTextInsert, onItemMatch];
109
- };