@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,293 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- /** @jsx jsx */
3
-
4
- import React from 'react';
5
- import { css, jsx } from '@emotion/react';
6
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
7
- import { Popup } from '@atlaskit/editor-common/ui';
8
- import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
9
- import { StatusPicker as AkStatusPicker } from '@atlaskit/status/picker';
10
- import { borderRadius } from '@atlaskit/theme/constants';
11
- import { N0 } from '@atlaskit/theme/colors';
12
- import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
13
- import { DEFAULT_STATUS } from '../actions';
14
- import { analyticsState, createStatusAnalyticsAndFire } from '../analytics';
15
- const PopupWithListeners = withOuterListeners(Popup);
16
- export let InputMethod = /*#__PURE__*/function (InputMethod) {
17
- InputMethod["blur"] = "blur";
18
- InputMethod["escKey"] = "escKey";
19
- InputMethod["enterKey"] = "enterKey";
20
- return InputMethod;
21
- }({});
22
- export let closingMethods = /*#__PURE__*/function (closingMethods) {
23
- closingMethods["ArrowLeft"] = "arrowLeft";
24
- closingMethods["ArrowRight"] = "arrowRight";
25
- return closingMethods;
26
- }({});
27
- const pickerContainer = css`
28
- background: ${`var(--ds-surface-overlay, ${N0})`};
29
- padding: ${"var(--ds-space-100, 8px)"} 0;
30
- border-radius: ${borderRadius()}px;
31
- box-shadow: ${"var(--ds-shadow-overlay, 0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25))"};
32
- :focus {
33
- outline: none;
34
- }
35
- input {
36
- text-transform: uppercase;
37
- }
38
- `;
39
- export class StatusPickerWithoutAnalytcs extends React.Component {
40
- constructor(props) {
41
- super(props);
42
- _defineProperty(this, "handleClickOutside", event => {
43
- event.preventDefault();
44
- this.inputMethod = InputMethod.blur;
45
- const selectedText = window.getSelection();
46
- if (!selectedText) {
47
- this.props.closeStatusPicker();
48
- }
49
- });
50
- _defineProperty(this, "handleEscapeKeydown", event => {
51
- event.preventDefault();
52
- this.inputMethod = InputMethod.escKey;
53
- this.props.onEnter(this.state);
54
- });
55
- _defineProperty(this, "handleTabPress", event => {
56
- const colorButtons = event.currentTarget.querySelectorAll('button');
57
- const inputField = event.currentTarget.querySelector('input');
58
- const isInputFocussed = document.activeElement === inputField;
59
- const isButtonFocussed = Array.from(colorButtons).some(buttonElement => {
60
- var _document;
61
- return ((_document = document) === null || _document === void 0 ? void 0 : _document.activeElement) === buttonElement;
62
- });
63
- if (event !== null && event !== void 0 && event.shiftKey) {
64
- /* shift + tab */
65
- if (isInputFocussed) {
66
- colorButtons[0].focus();
67
- event.preventDefault();
68
- }
69
- /* After the user presses shift + tab the color-palette component updates tab index for the first color to be 0.
70
- To correctly set focus to the input field instead of the first color button we need to set focus manually
71
- */
72
- if (isButtonFocussed) {
73
- inputField === null || inputField === void 0 ? void 0 : inputField.focus();
74
- event.preventDefault();
75
- }
76
- } else {
77
- /* tab */
78
- if (isButtonFocussed) {
79
- inputField === null || inputField === void 0 ? void 0 : inputField.focus();
80
- event.preventDefault();
81
- }
82
- }
83
- });
84
- _defineProperty(this, "handleArrow", (event, closingMethod) => {
85
- var _document2;
86
- if (((_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement) === this.popupBodyWrapper.current) {
87
- var _this$popupBodyWrappe, _this$popupBodyWrappe2;
88
- event.preventDefault();
89
- (_this$popupBodyWrappe = this.popupBodyWrapper) === null || _this$popupBodyWrappe === void 0 ? void 0 : (_this$popupBodyWrappe2 = _this$popupBodyWrappe.current) === null || _this$popupBodyWrappe2 === void 0 ? void 0 : _this$popupBodyWrappe2.blur();
90
- this.props.closeStatusPicker({
91
- closingMethod
92
- });
93
- }
94
- });
95
- _defineProperty(this, "onKeyDown", event => {
96
- const isTabPressed = event.key === 'Tab';
97
- if (isTabPressed) {
98
- return this.handleTabPress(event);
99
- }
100
- if (event.key in closingMethods) {
101
- return this.handleArrow(event, closingMethods[event.key]);
102
- }
103
- });
104
- _defineProperty(this, "onColorHover", color => {
105
- this.createStatusAnalyticsAndFireFunc({
106
- action: 'hovered',
107
- actionSubject: 'statusColorPicker',
108
- attributes: {
109
- color,
110
- localId: this.state.localId,
111
- state: analyticsState(this.props.isNew)
112
- }
113
- });
114
- });
115
- _defineProperty(this, "onColorClick", color => {
116
- const {
117
- text,
118
- localId
119
- } = this.state;
120
- if (color === this.state.color) {
121
- this.createStatusAnalyticsAndFireFunc({
122
- action: 'clicked',
123
- actionSubject: 'statusColorPicker',
124
- attributes: {
125
- color,
126
- localId,
127
- state: analyticsState(this.props.isNew)
128
- }
129
- });
130
- // closes status box and commits colour
131
- this.onEnter();
132
- } else {
133
- this.setState({
134
- color
135
- });
136
- this.props.onSelect({
137
- text,
138
- color,
139
- localId
140
- });
141
- }
142
- });
143
- _defineProperty(this, "onTextChanged", text => {
144
- const {
145
- color,
146
- localId
147
- } = this.state;
148
- this.setState({
149
- text
150
- });
151
- this.props.onTextChanged({
152
- text,
153
- color,
154
- localId
155
- }, !!this.props.isNew);
156
- });
157
- _defineProperty(this, "onEnter", () => {
158
- this.inputMethod = InputMethod.enterKey;
159
- this.props.onEnter(this.state);
160
- });
161
- // cancel bubbling to fix clickOutside logic:
162
- // popup re-renders its content before the click event bubbles up to the document
163
- // therefore click target element would be different from the popup content
164
- _defineProperty(this, "handlePopupClick", event => event.nativeEvent.stopImmediatePropagation());
165
- this.state = this.extractStateFromProps(props);
166
- this.createStatusAnalyticsAndFireFunc = createStatusAnalyticsAndFire(props.createAnalyticsEvent);
167
- this.popupBodyWrapper = /*#__PURE__*/React.createRef();
168
- }
169
- fireStatusPopupOpenedAnalytics(state) {
170
- const {
171
- color,
172
- text,
173
- localId,
174
- isNew
175
- } = state;
176
- this.startTime = Date.now();
177
- this.createStatusAnalyticsAndFireFunc({
178
- action: 'opened',
179
- actionSubject: 'statusPopup',
180
- attributes: {
181
- textLength: text ? text.length : 0,
182
- selectedColor: color,
183
- localId,
184
- state: analyticsState(isNew)
185
- }
186
- });
187
- }
188
- fireStatusPopupClosedAnalytics(state) {
189
- const {
190
- color,
191
- text,
192
- localId,
193
- isNew
194
- } = state;
195
- this.createStatusAnalyticsAndFireFunc({
196
- action: 'closed',
197
- actionSubject: 'statusPopup',
198
- attributes: {
199
- inputMethod: this.inputMethod,
200
- duration: Date.now() - this.startTime,
201
- textLength: text ? text.length : 0,
202
- selectedColor: color,
203
- localId,
204
- state: analyticsState(isNew)
205
- }
206
- });
207
- }
208
- reset() {
209
- this.startTime = Date.now();
210
- this.inputMethod = InputMethod.blur;
211
- }
212
- componentDidMount() {
213
- this.reset();
214
- this.fireStatusPopupOpenedAnalytics(this.state);
215
- if (typeof this.props.isNew === 'boolean' && this.props.isNew === false) {
216
- // Wrapper should be focused only if status already exists otherwise input field will receive focus
217
- this.focusTimeout = requestAnimationFrame(() => {
218
- var _this$popupBodyWrappe3, _this$popupBodyWrappe4;
219
- // Defer to prevent editor scrolling to top. See https://product-fabric.atlassian.net/browse/DTR-1952
220
- (_this$popupBodyWrappe3 = this.popupBodyWrapper) === null || _this$popupBodyWrappe3 === void 0 ? void 0 : (_this$popupBodyWrappe4 = _this$popupBodyWrappe3.current) === null || _this$popupBodyWrappe4 === void 0 ? void 0 : _this$popupBodyWrappe4.focus();
221
- });
222
- }
223
- }
224
- componentWillUnmount() {
225
- this.focusTimeout && cancelAnimationFrame(this.focusTimeout);
226
- this.fireStatusPopupClosedAnalytics(this.state);
227
- this.startTime = 0;
228
- }
229
- componentDidUpdate(prevProps, prevState, _snapshot) {
230
- const element = this.props.target;
231
- if (prevProps.target !== element) {
232
- const newState = this.extractStateFromProps(this.props);
233
- this.setState(newState);
234
- this.fireStatusPopupClosedAnalytics(prevState);
235
- this.reset();
236
- this.fireStatusPopupOpenedAnalytics(newState);
237
- }
238
- }
239
- extractStateFromProps(props) {
240
- const {
241
- defaultColor,
242
- defaultText,
243
- defaultLocalId,
244
- isNew
245
- } = props;
246
- return {
247
- color: defaultColor || DEFAULT_STATUS.color,
248
- text: defaultText || DEFAULT_STATUS.text,
249
- localId: defaultLocalId,
250
- isNew
251
- };
252
- }
253
- render() {
254
- const {
255
- isNew,
256
- target,
257
- mountTo,
258
- boundariesElement,
259
- scrollableElement
260
- } = this.props;
261
- const {
262
- color,
263
- text
264
- } = this.state;
265
- return target && jsx(PopupWithListeners, {
266
- target: target,
267
- offset: [0, 8],
268
- handleClickOutside: this.handleClickOutside,
269
- handleEscapeKeydown: this.handleEscapeKeydown,
270
- zIndex: akEditorFloatingDialogZIndex,
271
- fitHeight: 40,
272
- mountTo: mountTo,
273
- boundariesElement: boundariesElement,
274
- scrollableElement: scrollableElement,
275
- closeOnTab: false
276
- }, jsx("div", {
277
- css: pickerContainer,
278
- tabIndex: -1,
279
- ref: this.popupBodyWrapper,
280
- onClick: this.handlePopupClick,
281
- onKeyDown: this.onKeyDown
282
- }, jsx(AkStatusPicker, {
283
- autoFocus: isNew,
284
- selectedColor: color,
285
- text: text,
286
- onColorClick: this.onColorClick,
287
- onColorHover: this.onColorHover,
288
- onTextChanged: this.onTextChanged,
289
- onEnter: this.onEnter
290
- })));
291
- }
292
- }
293
- export default withAnalyticsEvents()(StatusPickerWithoutAnalytcs);
@@ -1,12 +0,0 @@
1
- import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
2
- export const mayGetStatusAtSelection = selection => {
3
- if (selection && selection instanceof NodeSelection) {
4
- const nodeSelection = selection;
5
- if (nodeSelection.node.type.name === 'status') {
6
- return selection.node.attrs || null;
7
- }
8
- }
9
- return null;
10
- };
11
- export const isEmptyStatus = node => node && (node.text && node.text.trim().length === 0 || node.text === '');
12
- export const setNodeSelectionNearPos = (tr, pos) => tr.setSelection(NodeSelection.create(tr.doc, tr.mapping.map(pos)));
@@ -1,205 +0,0 @@
1
- import { TypeAheadAvailableNodes, SelectItemMode } from '@atlaskit/editor-common/type-ahead';
2
- import { findHandler, isTypeAheadOpen, getTypeAheadHandler, getTypeAheadQuery } from './utils';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { openTypeAheadAtCursor } from './transforms/open-typeahead-at-cursor';
5
- import { closeTypeAhead } from './transforms/close-type-ahead';
6
- import { updateQuery } from './commands/update-query';
7
- import { insertTypeAheadItem } from './commands/insert-type-ahead-item';
8
- const open = ({
9
- editorView
10
- }) => itemType => inputMethod => {
11
- const {
12
- state
13
- } = editorView;
14
- const handler = findHandler(itemType, state);
15
- if (!handler) {
16
- return false;
17
- }
18
- const {
19
- tr
20
- } = state;
21
- openTypeAheadAtCursor({
22
- triggerHandler: handler,
23
- inputMethod
24
- })({
25
- tr
26
- });
27
- editorView.dispatch(tr);
28
- return true;
29
- };
30
- const defaultCloseOptions = {
31
- insertCurrentQueryAsRawText: false
32
- };
33
- const close = ({
34
- editorView
35
- }) => (options = defaultCloseOptions) => {
36
- const {
37
- state
38
- } = editorView;
39
- const currentQuery = getTypeAheadQuery(editorView.state);
40
- let tr = state.tr;
41
- if (options.attachCommand) {
42
- const fakeDispatch = customTr => {
43
- tr = customTr;
44
- };
45
- options.attachCommand(state, fakeDispatch);
46
- }
47
- closeTypeAhead(tr);
48
- if (options.insertCurrentQueryAsRawText && currentQuery && currentQuery.length > 0) {
49
- const handler = getTypeAheadHandler(state);
50
- const text = handler.trigger.concat(currentQuery);
51
- tr.replaceSelectionWith(state.schema.text(text));
52
- }
53
- editorView.dispatch(tr);
54
- if (!editorView.hasFocus()) {
55
- editorView.focus();
56
- }
57
- return true;
58
- };
59
- const search = ({
60
- editorView
61
- }) => itemType => (query = '') => {
62
- const {
63
- state
64
- } = editorView;
65
- const handler = findHandler(itemType, state);
66
- if (!handler) {
67
- throw new Error(`Handler not found, did you load the ${itemType} plugin properly`);
68
- }
69
- open({
70
- editorView
71
- })(itemType)(INPUT_METHOD.KEYBOARD);
72
- updateQuery(query)(editorView.state, editorView.dispatch);
73
- const lastQuery = {
74
- current: query
75
- };
76
- const last = handler.getItems({
77
- query,
78
- editorState: state
79
- }).then(items => {
80
- if (!handler.forceSelect) {
81
- return items;
82
- }
83
- const forceSelectedItem = handler.forceSelect({
84
- items,
85
- query,
86
- editorState: state
87
- });
88
- if (!forceSelectedItem) {
89
- return items;
90
- }
91
- insertTypeAheadItem(editorView)({
92
- handler,
93
- item: forceSelectedItem,
94
- query,
95
- mode: SelectItemMode.SELECTED,
96
- sourceListItem: items
97
- });
98
- });
99
- const results = {
100
- last
101
- };
102
- return {
103
- type: appendValue => {
104
- if (!appendValue) {
105
- return;
106
- }
107
- lastQuery.current += appendValue;
108
- updateQuery(lastQuery.current)(editorView.state, editorView.dispatch);
109
- const promise = handler.getItems({
110
- query: lastQuery.current,
111
- editorState: state
112
- });
113
- results.last = promise;
114
- return promise;
115
- },
116
- result: () => results.last,
117
- close: close({
118
- editorView
119
- }),
120
- insert: ({
121
- index,
122
- mode
123
- }) => {
124
- return results.last.then(result => {
125
- const item = result ? result[index] : null;
126
- if (result && item) {
127
- insertTypeAheadItem(editorView)({
128
- handler,
129
- item,
130
- query,
131
- mode: mode || SelectItemMode.SELECTED,
132
- sourceListItem: result
133
- });
134
- }
135
- });
136
- }
137
- };
138
- };
139
- const insertItem = ({
140
- editorView
141
- }) => itemType => ({
142
- contentItem,
143
- query,
144
- sourceListItem
145
- }) => {
146
- const {
147
- state
148
- } = editorView;
149
- const handler = findHandler(itemType, state);
150
- if (!handler) {
151
- return false;
152
- }
153
- insertTypeAheadItem(editorView)({
154
- handler,
155
- item: contentItem,
156
- mode: SelectItemMode.SELECTED,
157
- query,
158
- sourceListItem
159
- });
160
- return true;
161
- };
162
- const isOpen = ({
163
- editorView
164
- }) => () => {
165
- if (!isTypeAheadOpen(editorView.state)) {
166
- return false;
167
- }
168
- const handler = getTypeAheadHandler(editorView.state);
169
- if (!handler) {
170
- return false;
171
- }
172
- return handler;
173
- };
174
- const currentQuery = ({
175
- editorView
176
- }) => () => {
177
- return getTypeAheadQuery(editorView.state);
178
- };
179
-
180
- /**
181
- * Please do not use it. Ping #help-editor and talk to the Lego team before use it.
182
- *
183
- * @private
184
- * @deprecated
185
- *
186
- */
187
- export const createTypeAheadTools = editorView => {
188
- const props = {
189
- editorView
190
- };
191
- return {
192
- isOpen: isOpen(props),
193
- currentQuery: currentQuery(props),
194
- close: close(props),
195
- openMention: open(props)(TypeAheadAvailableNodes.MENTION),
196
- searchMention: search(props)(TypeAheadAvailableNodes.MENTION),
197
- openQuickInsert: open(props)(TypeAheadAvailableNodes.QUICK_INSERT),
198
- searchQuickInsert: search(props)(TypeAheadAvailableNodes.QUICK_INSERT),
199
- openEmoji: open(props)(TypeAheadAvailableNodes.EMOJI),
200
- searchEmoji: search(props)(TypeAheadAvailableNodes.EMOJI),
201
- insertItemMention: insertItem(props)(TypeAheadAvailableNodes.MENTION),
202
- insertItemEmoji: insertItem(props)(TypeAheadAvailableNodes.EMOJI),
203
- insertItemQuickInsert: insertItem(props)(TypeAheadAvailableNodes.QUICK_INSERT)
204
- };
205
- };
@@ -1,204 +0,0 @@
1
- import { closeHistory } from '@atlaskit/editor-prosemirror/history';
2
- import { Fragment, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
4
- import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
5
- import { insertBlockNode, insertInlineNodeOrFragment } from '../insert-utils';
6
- import { ACTIONS } from '../pm-plugins/actions';
7
- import { pluginKey } from '../pm-plugins/key';
8
- import { StatsModifier } from '../stats-modifier';
9
- import { closeTypeAhead } from '../transforms/close-type-ahead';
10
- import { getPluginState } from '../utils';
11
- const validateNode = ({
12
- schema,
13
- maybeNode
14
- }) => {
15
- if (!maybeNode) {
16
- return null;
17
- }
18
- if (maybeNode instanceof PMNode || maybeNode instanceof Fragment) {
19
- return maybeNode;
20
- }
21
- if (typeof maybeNode === 'string') {
22
- return schema.text(maybeNode);
23
- }
24
- try {
25
- return PMNode.fromJSON(schema, maybeNode);
26
- } catch (e) {
27
- // eslint-disable-next-line no-console
28
- console.error(e);
29
- return null;
30
- }
31
- };
32
- const createInsertCallback = ({
33
- editorState: state,
34
- handler,
35
- query,
36
- wasInsertedBySpace,
37
- selectedIndex,
38
- textStartPosition,
39
- textInserted
40
- }) => (maybeNode, opts = {}) => {
41
- const {
42
- tr
43
- } = state;
44
- const position = {
45
- start: textStartPosition,
46
- end: textStartPosition + (wasInsertedBySpace ? textInserted.length : 0)
47
- };
48
- const node = validateNode({
49
- schema: state.schema,
50
- maybeNode
51
- });
52
- if (!node) {
53
- closeTypeAhead(tr);
54
- // In this kind of situation we need to
55
- // delete the raw text query
56
- tr.delete(position.start, position.end);
57
- return tr;
58
- }
59
- node instanceof PMNode && node.isBlock ? insertBlockNode({
60
- node,
61
- tr,
62
- position
63
- }) : insertInlineNodeOrFragment({
64
- maybeFragment: node,
65
- tr,
66
- position,
67
- selectInlineNode: Boolean(opts.selectInlineNode)
68
- });
69
- closeHistory(tr);
70
- if (wasInsertedBySpace) {
71
- return tr;
72
- }
73
- const config = {
74
- stage: InsertTypeAheadStages.INSERTING_ITEM,
75
- query,
76
- selectedIndex,
77
- trigger: handler.trigger
78
- };
79
- tr.step(new InsertTypeAheadStep(config));
80
- return tr;
81
- };
82
- const createDeleteRawTextCallback = ({
83
- trigger,
84
- selectedIndex,
85
- position,
86
- query,
87
- wasInsertedBySpace,
88
- insertItem
89
- }) => {
90
- return newState => {
91
- const tr = newState.tr;
92
- closeHistory(tr);
93
- if (!wasInsertedBySpace) {
94
- tr.delete(position.start, position.end);
95
- const config = {
96
- stage: InsertTypeAheadStages.DELETING_RAW_QUERY,
97
- selectedIndex,
98
- query,
99
- trigger
100
- };
101
- tr.step(new InsertTypeAheadStep(config));
102
- }
103
- tr.setMeta(pluginKey, {
104
- action: ACTIONS.INSERT_ITEM,
105
- params: insertItem
106
- });
107
- return tr;
108
- };
109
- };
110
- export const insertTypeAheadItem = view => ({
111
- item,
112
- handler,
113
- mode,
114
- query,
115
- sourceListItem
116
- }) => {
117
- const pluginState = getPluginState(view.state);
118
- if (!pluginState) {
119
- return;
120
- }
121
- const stats = (pluginState.stats || new StatsModifier()).serialize();
122
- const meta = {
123
- mode,
124
- query,
125
- stats,
126
- sourceListItem
127
- };
128
- const {
129
- tr
130
- } = view.state;
131
- const trigger = handler.trigger;
132
- let text = `${trigger}${query}`;
133
- if (mode === SelectItemMode.SPACE) {
134
- text = text.trim().concat(' ');
135
- }
136
-
137
- // We want to always persist selectedIndex as -1 upon selecting an item from typeahead
138
- // in order to retain exist focus behaviour when undoing
139
- const selectedIndex = -1;
140
- const wasInsertedBySpace = mode === SelectItemMode.SPACE;
141
- const {
142
- selection: {
143
- from: textStartPosition
144
- }
145
- } = tr;
146
- const insertItem = newEditorSate => {
147
- const insertCallback = createInsertCallback({
148
- editorState: newEditorSate,
149
- query,
150
- mode,
151
- handler,
152
- wasInsertedBySpace,
153
- selectedIndex,
154
- textInserted: text,
155
- textStartPosition
156
- });
157
- let wasInsertCallbackCalled = false;
158
- // Some wierd plugins doesn't call the insert item callback
159
- // For example, the link quick insert item
160
- // For those cases we need to make sure we are closing the typeahead
161
- const proxyHandler = {
162
- apply: function (target, _thisContext, argumentsList) {
163
- wasInsertCallbackCalled = true;
164
- return target(...argumentsList);
165
- }
166
- };
167
- const insertCallbackProxy = new Proxy(insertCallback, proxyHandler);
168
- const nextTr = handler.selectItem(newEditorSate, item, insertCallbackProxy, meta);
169
- if (!wasInsertCallbackCalled && nextTr) {
170
- closeHistory(nextTr);
171
-
172
- // In some cases we need to re-open the typeahead
173
- // e.g.: addign mentions from the quick insert
174
- //
175
- // Today, the QuickInsert API doesn't have a tool
176
- // to help on this. So the code below will close the typeahead
177
- // only if there is no previous metadata about typeahead in the
178
- // next transaction
179
- if (!nextTr.getMeta(pluginKey)) {
180
- closeTypeAhead(nextTr);
181
- }
182
- }
183
- return nextTr;
184
- };
185
- const position = {
186
- start: tr.selection.from,
187
- end: tr.selection.from + text.length
188
- };
189
- tr.setMeta(pluginKey, {
190
- action: ACTIONS.INSERT_RAW_QUERY,
191
- params: createDeleteRawTextCallback({
192
- wasInsertedBySpace,
193
- selectedIndex,
194
- insertItem,
195
- position,
196
- query,
197
- trigger
198
- })
199
- });
200
- tr.insertText(text);
201
- closeHistory(tr);
202
- view.dispatch(tr);
203
- view.focus();
204
- };