@atlaskit/editor-core 188.9.0 → 188.9.5

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 (207) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/labs/next/presets/default.js +2 -2
  3. package/dist/cjs/plugins/index.js +0 -7
  4. package/dist/cjs/plugins/insert-block/index.js +4 -6
  5. package/dist/cjs/plugins/tasks-and-decisions/index.js +4 -3
  6. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
  7. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -13
  8. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +15 -7
  9. package/dist/cjs/version-wrapper.js +1 -1
  10. package/dist/es2019/labs/next/presets/default.js +1 -1
  11. package/dist/es2019/plugins/index.js +0 -1
  12. package/dist/es2019/plugins/insert-block/index.js +4 -6
  13. package/dist/es2019/plugins/tasks-and-decisions/index.js +4 -3
  14. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
  15. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +43 -10
  16. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +13 -6
  17. package/dist/es2019/version-wrapper.js +1 -1
  18. package/dist/esm/labs/next/presets/default.js +1 -1
  19. package/dist/esm/plugins/index.js +0 -1
  20. package/dist/esm/plugins/insert-block/index.js +4 -6
  21. package/dist/esm/plugins/tasks-and-decisions/index.js +4 -3
  22. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
  23. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -12
  24. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +14 -7
  25. package/dist/esm/version-wrapper.js +1 -1
  26. package/dist/types/labs/next/presets/default.d.ts +43 -43
  27. package/dist/types/plugins/index.d.ts +0 -1
  28. package/dist/types/plugins/insert-block/types.d.ts +2 -0
  29. package/dist/types/plugins/tasks-and-decisions/index.d.ts +2 -5
  30. package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
  31. package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
  32. package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
  33. package/dist/types/plugins/tasks-and-decisions/types.d.ts +6 -1
  34. package/dist/types-ts4.5/labs/next/presets/default.d.ts +43 -43
  35. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  36. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +2 -0
  37. package/dist/types-ts4.5/plugins/tasks-and-decisions/index.d.ts +2 -5
  38. package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
  39. package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
  40. package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
  41. package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +8 -1
  42. package/package.json +10 -8
  43. package/dist/cjs/plugins/type-ahead/api.js +0 -215
  44. package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -205
  45. package/dist/cjs/plugins/type-ahead/commands/update-list-items.js +0 -23
  46. package/dist/cjs/plugins/type-ahead/commands/update-query.js +0 -27
  47. package/dist/cjs/plugins/type-ahead/commands/update-selected-index.js +0 -27
  48. package/dist/cjs/plugins/type-ahead/constants.js +0 -15
  49. package/dist/cjs/plugins/type-ahead/index.js +0 -14
  50. package/dist/cjs/plugins/type-ahead/insert-utils.js +0 -107
  51. package/dist/cjs/plugins/type-ahead/messages.js +0 -79
  52. package/dist/cjs/plugins/type-ahead/plugin.js +0 -382
  53. package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +0 -16
  54. package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +0 -148
  55. package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +0 -36
  56. package/dist/cjs/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -22
  57. package/dist/cjs/plugins/type-ahead/pm-plugins/key.js +0 -8
  58. package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +0 -110
  59. package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +0 -158
  60. package/dist/cjs/plugins/type-ahead/pm-plugins/utils.js +0 -18
  61. package/dist/cjs/plugins/type-ahead/stats-modifier.js +0 -42
  62. package/dist/cjs/plugins/type-ahead/transforms/close-type-ahead.js +0 -13
  63. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -75
  64. package/dist/cjs/plugins/type-ahead/transforms/set-selection-before-query.js +0 -18
  65. package/dist/cjs/plugins/type-ahead/types.js +0 -5
  66. package/dist/cjs/plugins/type-ahead/ui/AssistiveText.js +0 -120
  67. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +0 -400
  68. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +0 -285
  69. package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +0 -179
  70. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +0 -230
  71. package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -127
  72. package/dist/cjs/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -109
  73. package/dist/cjs/plugins/type-ahead/ui/hooks/use-load-items.js +0 -50
  74. package/dist/cjs/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -41
  75. package/dist/cjs/plugins/type-ahead/utils.js +0 -130
  76. package/dist/es2019/plugins/type-ahead/api.js +0 -205
  77. package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -204
  78. package/dist/es2019/plugins/type-ahead/commands/update-list-items.js +0 -17
  79. package/dist/es2019/plugins/type-ahead/commands/update-query.js +0 -21
  80. package/dist/es2019/plugins/type-ahead/commands/update-selected-index.js +0 -21
  81. package/dist/es2019/plugins/type-ahead/constants.js +0 -9
  82. package/dist/es2019/plugins/type-ahead/index.js +0 -3
  83. package/dist/es2019/plugins/type-ahead/insert-utils.js +0 -106
  84. package/dist/es2019/plugins/type-ahead/messages.js +0 -73
  85. package/dist/es2019/plugins/type-ahead/plugin.js +0 -381
  86. package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +0 -10
  87. package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +0 -148
  88. package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
  89. package/dist/es2019/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
  90. package/dist/es2019/plugins/type-ahead/pm-plugins/key.js +0 -2
  91. package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +0 -106
  92. package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +0 -160
  93. package/dist/es2019/plugins/type-ahead/pm-plugins/utils.js +0 -12
  94. package/dist/es2019/plugins/type-ahead/stats-modifier.js +0 -33
  95. package/dist/es2019/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
  96. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -71
  97. package/dist/es2019/plugins/type-ahead/transforms/set-selection-before-query.js +0 -10
  98. package/dist/es2019/plugins/type-ahead/types.js +0 -1
  99. package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +0 -88
  100. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +0 -393
  101. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +0 -273
  102. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +0 -214
  103. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +0 -233
  104. package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -109
  105. package/dist/es2019/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -112
  106. package/dist/es2019/plugins/type-ahead/ui/hooks/use-load-items.js +0 -41
  107. package/dist/es2019/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -38
  108. package/dist/es2019/plugins/type-ahead/utils.js +0 -126
  109. package/dist/esm/plugins/type-ahead/api.js +0 -209
  110. package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -198
  111. package/dist/esm/plugins/type-ahead/commands/update-list-items.js +0 -17
  112. package/dist/esm/plugins/type-ahead/commands/update-query.js +0 -21
  113. package/dist/esm/plugins/type-ahead/commands/update-selected-index.js +0 -21
  114. package/dist/esm/plugins/type-ahead/constants.js +0 -9
  115. package/dist/esm/plugins/type-ahead/index.js +0 -3
  116. package/dist/esm/plugins/type-ahead/insert-utils.js +0 -101
  117. package/dist/esm/plugins/type-ahead/messages.js +0 -73
  118. package/dist/esm/plugins/type-ahead/plugin.js +0 -374
  119. package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +0 -10
  120. package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +0 -141
  121. package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
  122. package/dist/esm/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
  123. package/dist/esm/plugins/type-ahead/pm-plugins/key.js +0 -2
  124. package/dist/esm/plugins/type-ahead/pm-plugins/main.js +0 -104
  125. package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +0 -151
  126. package/dist/esm/plugins/type-ahead/pm-plugins/utils.js +0 -12
  127. package/dist/esm/plugins/type-ahead/stats-modifier.js +0 -35
  128. package/dist/esm/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
  129. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -69
  130. package/dist/esm/plugins/type-ahead/transforms/set-selection-before-query.js +0 -12
  131. package/dist/esm/plugins/type-ahead/types.js +0 -1
  132. package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +0 -115
  133. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +0 -390
  134. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +0 -276
  135. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +0 -169
  136. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +0 -220
  137. package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -117
  138. package/dist/esm/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -103
  139. package/dist/esm/plugins/type-ahead/ui/hooks/use-load-items.js +0 -43
  140. package/dist/esm/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -35
  141. package/dist/esm/plugins/type-ahead/utils.js +0 -124
  142. package/dist/types/plugins/type-ahead/api.d.ts +0 -61
  143. package/dist/types/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
  144. package/dist/types/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
  145. package/dist/types/plugins/type-ahead/commands/update-query.d.ts +0 -2
  146. package/dist/types/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
  147. package/dist/types/plugins/type-ahead/constants.d.ts +0 -8
  148. package/dist/types/plugins/type-ahead/index.d.ts +0 -4
  149. package/dist/types/plugins/type-ahead/insert-utils.d.ts +0 -18
  150. package/dist/types/plugins/type-ahead/messages.d.ts +0 -72
  151. package/dist/types/plugins/type-ahead/plugin.d.ts +0 -10
  152. package/dist/types/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
  153. package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
  154. package/dist/types/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
  155. package/dist/types/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
  156. package/dist/types/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
  157. package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
  158. package/dist/types/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
  159. package/dist/types/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
  160. package/dist/types/plugins/type-ahead/stats-modifier.d.ts +0 -20
  161. package/dist/types/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
  162. package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
  163. package/dist/types/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
  164. package/dist/types/plugins/type-ahead/types.d.ts +0 -109
  165. package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
  166. package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
  167. package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
  168. package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
  169. package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
  170. package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
  171. package/dist/types/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -3
  172. package/dist/types/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
  173. package/dist/types/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
  174. package/dist/types/plugins/type-ahead/utils.d.ts +0 -27
  175. package/dist/types-ts4.5/plugins/type-ahead/api.d.ts +0 -61
  176. package/dist/types-ts4.5/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
  177. package/dist/types-ts4.5/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
  178. package/dist/types-ts4.5/plugins/type-ahead/commands/update-query.d.ts +0 -2
  179. package/dist/types-ts4.5/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
  180. package/dist/types-ts4.5/plugins/type-ahead/constants.d.ts +0 -8
  181. package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +0 -4
  182. package/dist/types-ts4.5/plugins/type-ahead/insert-utils.d.ts +0 -18
  183. package/dist/types-ts4.5/plugins/type-ahead/messages.d.ts +0 -72
  184. package/dist/types-ts4.5/plugins/type-ahead/plugin.d.ts +0 -10
  185. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
  186. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
  187. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
  188. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
  189. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
  190. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
  191. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
  192. package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
  193. package/dist/types-ts4.5/plugins/type-ahead/stats-modifier.d.ts +0 -20
  194. package/dist/types-ts4.5/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
  195. package/dist/types-ts4.5/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
  196. package/dist/types-ts4.5/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
  197. package/dist/types-ts4.5/plugins/type-ahead/types.d.ts +0 -111
  198. package/dist/types-ts4.5/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
  199. package/dist/types-ts4.5/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
  200. package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
  201. package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
  202. package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
  203. package/dist/types-ts4.5/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
  204. package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -7
  205. package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
  206. package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
  207. package/dist/types-ts4.5/plugins/type-ahead/utils.d.ts +0 -27
@@ -1,374 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- /**
3
- *
4
- * Revamped typeahead using decorations instead of the `typeAheadQuery` mark
5
- *
6
- * https://product-fabric.atlassian.net/wiki/spaces/E/pages/2992177582/Technical+TypeAhead+Data+Flow
7
- *
8
- *
9
- */
10
- import React from 'react';
11
- import { typeAheadQuery } from '@atlaskit/adf-schema';
12
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
13
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
14
- import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
15
- import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
16
- import { insertTypeAheadItem } from './commands/insert-type-ahead-item';
17
- import { updateSelectedIndex } from './commands/update-selected-index';
18
- import { inputRulePlugin } from './pm-plugins/input-rules';
19
- import { createPlugin as createInsertItemPlugin } from './pm-plugins/insert-item-plugin';
20
- import { pluginKey as typeAheadPluginKey } from './pm-plugins/key';
21
- import { createPlugin } from './pm-plugins/main';
22
- import { StatsModifier } from './stats-modifier';
23
- import { closeTypeAhead } from './transforms/close-type-ahead';
24
- import { openTypeAheadAtCursor } from './transforms/open-typeahead-at-cursor';
25
- import { useItemInsert } from './ui/hooks/use-item-insert';
26
- import { TypeAheadPopup } from './ui/TypeAheadPopup';
27
- import { findHandler, getPluginState, getTypeAheadHandler, getTypeAheadQuery, isTypeAheadAllowed, isTypeAheadOpen } from './utils';
28
- var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
29
- var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
30
- var editorView = _ref.editorView,
31
- popupMountRef = _ref.popupMountRef,
32
- typeAheadState = _ref.typeAheadState,
33
- fireAnalyticsCallback = _ref.fireAnalyticsCallback;
34
- var isOpen = typeAheadState.decorationSet.find().length > 0;
35
- var triggerHandler = typeAheadState.triggerHandler,
36
- items = typeAheadState.items,
37
- selectedIndex = typeAheadState.selectedIndex,
38
- decorationElement = typeAheadState.decorationElement,
39
- decorationSet = typeAheadState.decorationSet,
40
- query = typeAheadState.query;
41
- var _useItemInsert = useItemInsert(triggerHandler, editorView, items),
42
- _useItemInsert2 = _slicedToArray(_useItemInsert, 3),
43
- onItemInsert = _useItemInsert2[0],
44
- onTextInsert = _useItemInsert2[1],
45
- onItemMatch = _useItemInsert2[2];
46
- var setSelectedItem = React.useCallback(function (_ref2) {
47
- var nextIndex = _ref2.index;
48
- queueMicrotask(function () {
49
- updateSelectedIndex(nextIndex)(editorView.state, editorView.dispatch);
50
- });
51
- }, [editorView]);
52
- var insertItem = React.useCallback(function () {
53
- var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SelectItemMode.SELECTED;
54
- var index = arguments.length > 1 ? arguments[1] : undefined;
55
- queueMicrotask(function () {
56
- onItemInsert({
57
- mode: mode,
58
- index: index,
59
- query: query
60
- });
61
- });
62
- }, [onItemInsert, query]);
63
- var cancel = React.useCallback(function (_ref3) {
64
- var setSelectionAt = _ref3.setSelectionAt,
65
- addPrefixTrigger = _ref3.addPrefixTrigger,
66
- forceFocusOnEditor = _ref3.forceFocusOnEditor;
67
- var fullQuery = addPrefixTrigger ? "".concat(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger).concat(query) : query;
68
- onTextInsert({
69
- forceFocusOnEditor: forceFocusOnEditor,
70
- setSelectionAt: setSelectionAt,
71
- text: fullQuery
72
- });
73
- }, [triggerHandler, onTextInsert, query]);
74
- React.useEffect(function () {
75
- if (!isOpen || !query) {
76
- return;
77
- }
78
- var isLastCharSpace = query[query.length - 1] === ' ';
79
- if (!isLastCharSpace) {
80
- return;
81
- }
82
- var result = onItemMatch({
83
- mode: SelectItemMode.SPACE,
84
- query: query.trim()
85
- });
86
- if (!result) {
87
- return;
88
- }
89
- }, [isOpen, query, onItemMatch]);
90
- if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || items.length === 0) {
91
- return null;
92
- }
93
- return /*#__PURE__*/React.createElement(TypeAheadPopup, {
94
- editorView: editorView,
95
- popupsMountPoint: (_popupMountRef$curren = popupMountRef.current) === null || _popupMountRef$curren === void 0 ? void 0 : _popupMountRef$curren.popupsMountPoint,
96
- popupsBoundariesElement: (_popupMountRef$curren2 = popupMountRef.current) === null || _popupMountRef$curren2 === void 0 ? void 0 : _popupMountRef$curren2.popupsBoundariesElement,
97
- popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
98
- anchorElement: decorationElement,
99
- triggerHandler: triggerHandler,
100
- fireAnalyticsCallback: fireAnalyticsCallback,
101
- items: items,
102
- selectedIndex: selectedIndex,
103
- setSelectedItem: setSelectedItem,
104
- onItemInsert: insertItem,
105
- decorationSet: decorationSet,
106
- isEmptyQuery: !query,
107
- cancel: cancel
108
- });
109
- });
110
- var createOpenAtTransaction = function createOpenAtTransaction(editorAnalyticsAPI) {
111
- return function (props) {
112
- return function (tr) {
113
- var triggerHandler = props.triggerHandler,
114
- inputMethod = props.inputMethod;
115
- openTypeAheadAtCursor({
116
- triggerHandler: triggerHandler,
117
- inputMethod: inputMethod
118
- })({
119
- tr: tr
120
- });
121
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
122
- action: ACTION.INVOKED,
123
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
124
- actionSubjectId: triggerHandler.id,
125
- attributes: {
126
- inputMethod: inputMethod
127
- },
128
- eventType: EVENT_TYPE.UI
129
- })(tr);
130
- return true;
131
- };
132
- };
133
- };
134
- var createOpenTypeAhead = function createOpenTypeAhead(editorViewRef, editorAnalyticsAPI) {
135
- return function (props) {
136
- if (!editorViewRef.current) {
137
- return false;
138
- }
139
- var view = editorViewRef.current;
140
- var tr = view.state.tr;
141
- createOpenAtTransaction(editorAnalyticsAPI)(props)(tr);
142
- view.dispatch(tr);
143
- return true;
144
- };
145
- };
146
- var createInsertTypeAheadItem = function createInsertTypeAheadItem(editorViewRef) {
147
- return function (props) {
148
- if (!editorViewRef.current) {
149
- return false;
150
- }
151
- var view = editorViewRef.current;
152
- var triggerHandler = props.triggerHandler,
153
- contentItem = props.contentItem,
154
- query = props.query,
155
- sourceListItem = props.sourceListItem,
156
- mode = props.mode;
157
- insertTypeAheadItem(view)({
158
- handler: triggerHandler,
159
- item: contentItem,
160
- mode: mode || SelectItemMode.SELECTED,
161
- query: query,
162
- sourceListItem: sourceListItem
163
- });
164
- return true;
165
- };
166
- };
167
- var createFindHandlerByTrigger = function createFindHandlerByTrigger(editorViewRef) {
168
- return function (trigger) {
169
- if (!editorViewRef.current) {
170
- return null;
171
- }
172
- var view = editorViewRef.current;
173
- return findHandler(trigger, view.state);
174
- };
175
- };
176
- var createCloseTypeAhead = function createCloseTypeAhead(editorViewRef) {
177
- return function (options) {
178
- if (!editorViewRef.current) {
179
- return false;
180
- }
181
- var view = editorViewRef.current;
182
- var currentQuery = getTypeAheadQuery(view.state) || '';
183
- var state = view.state;
184
- var tr = state.tr;
185
- if (options.attachCommand) {
186
- var fakeDispatch = function fakeDispatch(customTr) {
187
- tr = customTr;
188
- };
189
- options.attachCommand(state, fakeDispatch);
190
- }
191
- closeTypeAhead(tr);
192
- if (options.insertCurrentQueryAsRawText && currentQuery && currentQuery.length > 0) {
193
- var handler = getTypeAheadHandler(state);
194
- if (!handler) {
195
- return false;
196
- }
197
- var text = handler.trigger.concat(currentQuery);
198
- tr.replaceSelectionWith(state.schema.text(text));
199
- }
200
- view.dispatch(tr);
201
- if (!view.hasFocus()) {
202
- view.focus();
203
- }
204
- return true;
205
- };
206
- };
207
-
208
- /**
209
- *
210
- * Revamped typeahead using decorations instead of the `typeAheadQuery` mark
211
- *
212
- * https://product-fabric.atlassian.net/wiki/spaces/E/pages/2992177582/Technical+TypeAhead+Data+Flow
213
- *
214
- *
215
- */
216
- export var typeAheadPlugin = function typeAheadPlugin(_ref4) {
217
- var _api$analytics, _api$analytics2;
218
- var options = _ref4.config,
219
- api = _ref4.api;
220
- var fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
221
- var popupMountRef = {
222
- current: null
223
- };
224
- var editorViewRef = {
225
- current: null
226
- };
227
- return {
228
- name: 'typeAhead',
229
- marks: function marks() {
230
- // We need to keep this to make sure
231
- // All documents with typeahead marks will be loaded normally
232
- return [{
233
- name: 'typeAheadQuery',
234
- mark: typeAheadQuery
235
- }];
236
- },
237
- pmPlugins: function pmPlugins() {
238
- var typeAhead = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
239
- return [{
240
- name: 'typeAhead',
241
- plugin: function plugin(_ref5) {
242
- var dispatch = _ref5.dispatch,
243
- getIntl = _ref5.getIntl;
244
- return createPlugin({
245
- getIntl: getIntl,
246
- popupMountRef: popupMountRef,
247
- reactDispatch: dispatch,
248
- typeAheadHandlers: typeAhead,
249
- createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
250
- });
251
- }
252
- }, {
253
- name: 'typeAheadEditorViewRef',
254
- plugin: function plugin() {
255
- return new SafePlugin({
256
- view: function view(_view) {
257
- editorViewRef.current = _view;
258
- return {
259
- destroy: function destroy() {
260
- editorViewRef.current = null;
261
- }
262
- };
263
- }
264
- });
265
- }
266
- }, {
267
- name: 'typeAheadInsertItem',
268
- plugin: createInsertItemPlugin
269
- }, {
270
- name: 'typeAheadInputRule',
271
- plugin: function plugin(_ref6) {
272
- var schema = _ref6.schema,
273
- featureFlags = _ref6.featureFlags;
274
- return inputRulePlugin(schema, typeAhead, featureFlags);
275
- }
276
- }];
277
- },
278
- getSharedState: function getSharedState(editorState) {
279
- if (!editorState) {
280
- return {
281
- query: '',
282
- isOpen: false,
283
- isAllowed: false,
284
- currentHandler: undefined
285
- };
286
- }
287
- var isOpen = isTypeAheadOpen(editorState);
288
- return {
289
- query: getTypeAheadQuery(editorState) || '',
290
- currentHandler: getTypeAheadHandler(editorState),
291
- isOpen: isOpen,
292
- isAllowed: !isOpen
293
- };
294
- },
295
- actions: {
296
- isOpen: isTypeAheadOpen,
297
- isAllowed: isTypeAheadAllowed,
298
- open: createOpenTypeAhead(editorViewRef, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
299
- openAtTransaction: createOpenAtTransaction(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
300
- findHandlerByTrigger: createFindHandlerByTrigger(editorViewRef),
301
- insert: createInsertTypeAheadItem(editorViewRef),
302
- close: createCloseTypeAhead(editorViewRef)
303
- },
304
- contentComponent: function contentComponent(_ref7) {
305
- var editorView = _ref7.editorView,
306
- containerElement = _ref7.containerElement,
307
- popupsMountPoint = _ref7.popupsMountPoint,
308
- popupsBoundariesElement = _ref7.popupsBoundariesElement,
309
- popupsScrollableElement = _ref7.popupsScrollableElement,
310
- wrapperElement = _ref7.wrapperElement;
311
- popupMountRef.current = {
312
- popupsMountPoint: popupsMountPoint || wrapperElement || undefined,
313
- popupsBoundariesElement: popupsBoundariesElement,
314
- popupsScrollableElement: popupsScrollableElement || containerElement || undefined
315
- };
316
- return /*#__PURE__*/React.createElement(WithPluginState, {
317
- plugins: {
318
- typeAheadState: typeAheadPluginKey
319
- },
320
- render: function render(_ref8) {
321
- var typeAheadState = _ref8.typeAheadState;
322
- if (!typeAheadState) {
323
- return null;
324
- }
325
- return /*#__PURE__*/React.createElement(TypeAheadMenu, {
326
- editorView: editorView,
327
- popupMountRef: popupMountRef,
328
- typeAheadState: typeAheadState,
329
- fireAnalyticsCallback: fireAnalyticsCallback
330
- });
331
- }
332
- });
333
- },
334
- onEditorViewStateUpdated: function onEditorViewStateUpdated(_ref9) {
335
- var originalTransaction = _ref9.originalTransaction,
336
- oldEditorState = _ref9.oldEditorState,
337
- newEditorState = _ref9.newEditorState;
338
- var oldPluginState = getPluginState(oldEditorState);
339
- var newPluginState = getPluginState(newEditorState);
340
- if (!oldPluginState || !newPluginState) {
341
- return;
342
- }
343
- var oldTriggerHandler = oldPluginState.triggerHandler;
344
- var newTriggerHandler = newPluginState.triggerHandler;
345
- var isANewHandler = oldTriggerHandler !== newTriggerHandler;
346
- if (oldTriggerHandler !== null && oldTriggerHandler !== void 0 && oldTriggerHandler.dismiss && isANewHandler) {
347
- var typeAheadMessage = originalTransaction.getMeta(typeAheadPluginKey);
348
- var wasItemInserted = typeAheadMessage && typeAheadMessage.action === 'INSERT_RAW_QUERY';
349
- oldTriggerHandler.dismiss({
350
- editorState: newEditorState,
351
- query: oldPluginState.query,
352
- stats: (oldPluginState.stats || new StatsModifier()).serialize(),
353
- wasItemInserted: wasItemInserted
354
- });
355
- }
356
- if (newTriggerHandler !== null && newTriggerHandler !== void 0 && newTriggerHandler.onOpen && isANewHandler) {
357
- newTriggerHandler.onOpen(newEditorState);
358
- }
359
- if (newTriggerHandler && isANewHandler && options !== null && options !== void 0 && options.createAnalyticsEvent) {
360
- fireAnalyticsCallback({
361
- payload: {
362
- action: ACTION.INVOKED,
363
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
364
- actionSubjectId: newTriggerHandler.id || 'not_set',
365
- attributes: {
366
- inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
367
- },
368
- eventType: EVENT_TYPE.UI
369
- }
370
- });
371
- }
372
- }
373
- };
374
- };
@@ -1,10 +0,0 @@
1
- export var ACTIONS = /*#__PURE__*/function (ACTIONS) {
2
- ACTIONS["OPEN_TYPEAHEAD_AT_CURSOR"] = "OPEN_TYPEAHEAD_AT_CURSOR";
3
- ACTIONS["CLOSE_TYPE_AHEAD"] = "CLOSE_TYPE_AHEAD";
4
- ACTIONS["CHANGE_QUERY"] = "CHANGE_QUERY";
5
- ACTIONS["INSERT_ITEM"] = "INSERT_ITEM";
6
- ACTIONS["INSERT_RAW_QUERY"] = "INSERT_RAW_QUERY";
7
- ACTIONS["UPDATE_LIST_ITEMS"] = "UPDATE_LIST_ITEMS";
8
- ACTIONS["UPDATE_SELECTED_INDEX"] = "UPDATE_SELECTED_INDEX";
9
- return ACTIONS;
10
- }({});
@@ -1,141 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import uuid from 'uuid';
4
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
5
- import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
6
- import { B400 } from '@atlaskit/theme/colors';
7
- import { keyName as keyNameNormalized } from 'w3c-keyname';
8
- import { IntlProvider } from 'react-intl-next';
9
- import { redo, undo } from '@atlaskit/editor-prosemirror/history';
10
- import { TYPE_AHEAD_DECORATION_KEY, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE } from '../constants';
11
- import { WrapperTypeAhead } from '../ui/WrapperTypeAhead';
12
- import { StatsModifier } from '../stats-modifier';
13
- import { getTypeAheadQuery } from '../utils';
14
- import { closeTypeAhead } from '../transforms/close-type-ahead';
15
- export var factoryDecorations = function factoryDecorations(_ref) {
16
- var intl = _ref.intl,
17
- popupMountRef = _ref.popupMountRef,
18
- createAnalyticsEvent = _ref.createAnalyticsEvent;
19
- var createDecorations = function createDecorations(tr, _ref2) {
20
- var triggerHandler = _ref2.triggerHandler,
21
- inputMethod = _ref2.inputMethod,
22
- reopenQuery = _ref2.reopenQuery;
23
- var selection = tr.selection;
24
- if (!(selection instanceof TextSelection) || !selection.$cursor) {
25
- return {
26
- decorationSet: DecorationSet.empty,
27
- stats: null,
28
- decorationElement: null
29
- };
30
- }
31
- var decorationId = "decoration_id_".concat(TYPE_AHEAD_DECORATION_KEY, "_").concat(uuid());
32
- var $cursor = selection.$cursor;
33
- var typeaheadComponent = document.createElement('mark');
34
- var stats = new StatsModifier();
35
- var shouldFocusCursorInsideQuery = true;
36
- var deco = Decoration.widget($cursor.pos, function (editorView, getDecorationPosition) {
37
- var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
38
- typeaheadComponent.setAttribute('id', decorationId);
39
- typeaheadComponent.setAttribute('role', 'search');
40
- typeaheadComponent.dataset.typeAheadQuery = 'true';
41
- typeaheadComponent.dataset.trigger = triggerHandler.trigger;
42
-
43
- // This line below seems weird,
44
- // we need that cuz the clickAreaHelper
45
- // will try to hijack any click event coming
46
- // from the inside of the Editor
47
- // packages/editor/editor-core/src/ui/Addon/click-area-helper.ts
48
- typeaheadComponent.dataset.editorPopup = 'true';
49
- typeaheadComponent.dataset.typeAhead = TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE;
50
- typeaheadComponent.style.color = "var(--ds-text-accent-blue, ".concat(B400, ")");
51
- typeaheadComponent.style.backgroundColor = 'transparent';
52
- var onUndoRedo = function onUndoRedo(inputType) {
53
- if (!['historyUndo', 'historyRedo'].includes(inputType)) {
54
- return false;
55
- }
56
- var hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
57
- var currentQuery = getTypeAheadQuery(editorView.state);
58
- if (hasReopenQuery || (currentQuery === null || currentQuery === void 0 ? void 0 : currentQuery.length) === 0) {
59
- var command = inputType === 'historyUndo' ? undo : redo;
60
- var _tr = editorView.state.tr;
61
- var fakeDispatch = function fakeDispatch(customTr) {
62
- _tr = customTr;
63
- };
64
- var result = command(editorView.state, fakeDispatch);
65
- if (result) {
66
- closeTypeAhead(_tr);
67
- editorView.dispatch(_tr);
68
- editorView.focus();
69
- }
70
- return result;
71
- }
72
- return false;
73
- };
74
- ReactDOM.render( /*#__PURE__*/React.createElement(IntlProvider, {
75
- locale: intl.locale || 'en',
76
- messages: intl.messages,
77
- formats: intl.formats
78
- }, /*#__PURE__*/React.createElement(WrapperTypeAhead, {
79
- triggerHandler: triggerHandler,
80
- editorView: editorView,
81
- anchorElement: typeaheadComponent,
82
- createAnalyticsEvent: createAnalyticsEvent,
83
- inputMethod: inputMethod,
84
- getDecorationPosition: getDecorationPosition,
85
- shouldFocusCursorInsideQuery: shouldFocusCursorInsideQuery,
86
- popupsMountPoint: (_popupMountRef$curren = popupMountRef.current) === null || _popupMountRef$curren === void 0 ? void 0 : _popupMountRef$curren.popupsMountPoint,
87
- popupsBoundariesElement: (_popupMountRef$curren2 = popupMountRef.current) === null || _popupMountRef$curren2 === void 0 ? void 0 : _popupMountRef$curren2.popupsBoundariesElement,
88
- popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
89
- onUndoRedo: onUndoRedo,
90
- reopenQuery: reopenQuery
91
- })), typeaheadComponent);
92
- shouldFocusCursorInsideQuery = false;
93
- return typeaheadComponent;
94
- }, {
95
- isTypeAheadDecoration: true,
96
- key: decorationId,
97
- side: 0,
98
- stopEvent: function stopEvent(e) {
99
- var key = keyNameNormalized(e);
100
- var sel = document.getSelection();
101
- if ('ArrowLeft' === key && (sel === null || sel === void 0 ? void 0 : sel.anchorOffset) === 0) {
102
- return false;
103
- }
104
- return true;
105
- },
106
- ignoreSelection: false
107
- });
108
- return {
109
- decorationSet: DecorationSet.create(tr.doc, [deco]),
110
- decorationElement: typeaheadComponent,
111
- stats: stats
112
- };
113
- };
114
- var removeDecorations = function removeDecorations(decorationSet) {
115
- if (!decorationSet || decorationSet === DecorationSet.empty) {
116
- return false;
117
- }
118
- var typeAheadDecorations = decorationSet.find(undefined, undefined, function (spec) {
119
- return spec.isTypeAheadDecoration;
120
- });
121
- if (!typeAheadDecorations || typeAheadDecorations.length === 0) {
122
- return false;
123
- }
124
- typeAheadDecorations.forEach(function (_ref3) {
125
- var spec = _ref3.spec;
126
- if (!spec.key) {
127
- return;
128
- }
129
- var decoElement = document.querySelector("#".concat(spec.key));
130
- if (!decoElement) {
131
- return;
132
- }
133
- ReactDOM.unmountComponentAtNode(decoElement);
134
- });
135
- return true;
136
- };
137
- return {
138
- createDecorations: createDecorations,
139
- removeDecorations: removeDecorations
140
- };
141
- };
@@ -1,29 +0,0 @@
1
- import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
2
- import { openTypeAheadAtCursor } from '../transforms/open-typeahead-at-cursor';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- export function inputRulePlugin(schema, typeAheads, featureFlags) {
5
- if (!typeAheads || typeAheads.length === 0) {
6
- return;
7
- }
8
- var rules = typeAheads.reduce(function (acc, typeAhead) {
9
- var trigger = typeAhead.customRegex || typeAhead.trigger;
10
- if (!trigger) {
11
- return acc;
12
- }
13
- var regex = new RegExp("(^|[.!?\\s".concat(leafNodeReplacementCharacter, "])(").concat(trigger, ")$"));
14
- acc.push(createRule(regex, function (state, match) {
15
- return openTypeAheadAtCursor({
16
- triggerHandler: typeAhead,
17
- inputMethod: INPUT_METHOD.KEYBOARD
18
- })({
19
- tr: state.tr
20
- });
21
- }));
22
- return acc;
23
- }, []);
24
- var plugin = createPlugin('type-ahead', rules, {
25
- allowInsertTextOnDocument: false
26
- });
27
- return plugin;
28
- }
29
- export default inputRulePlugin;
@@ -1,16 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { ACTIONS } from './actions';
3
- import { isInsertionTransaction } from './utils';
4
- export function createPlugin() {
5
- return new SafePlugin({
6
- appendTransaction: function appendTransaction(transactions, _oldState, newState) {
7
- var insertItemCallback = isInsertionTransaction(transactions, ACTIONS.INSERT_ITEM);
8
- if (insertItemCallback) {
9
- var tr = insertItemCallback(newState);
10
- if (tr) {
11
- return tr;
12
- }
13
- }
14
- }
15
- });
16
- }
@@ -1,2 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- export var pluginKey = new PluginKey('typeAheadPlugin');
@@ -1,104 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
- import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
4
- import { TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE } from '../constants';
5
- import { ACTIONS } from './actions';
6
- import { pluginKey } from './key';
7
- import { closest } from '@atlaskit/editor-common/utils';
8
- import { createReducer } from './reducer';
9
- import { factoryDecorations } from './decorations';
10
- import { isInsertionTransaction } from './utils';
11
- var hasValidTypeAheadStep = function hasValidTypeAheadStep(tr) {
12
- var steps = tr.steps.filter(function (step) {
13
- return step instanceof InsertTypeAheadStep;
14
- });
15
-
16
- // There are some cases, like collab rebase, where the steps are re-applied
17
- // We should not re open the type-ahead for those cases
18
- if (steps.length === 1) {
19
- return steps[0];
20
- }
21
- return null;
22
- };
23
- export function createPlugin(_ref) {
24
- var reactDispatch = _ref.reactDispatch,
25
- popupMountRef = _ref.popupMountRef,
26
- createAnalyticsEvent = _ref.createAnalyticsEvent,
27
- typeAheadHandlers = _ref.typeAheadHandlers,
28
- getIntl = _ref.getIntl;
29
- var intl = getIntl();
30
- var _factoryDecorations = factoryDecorations({
31
- intl: intl,
32
- popupMountRef: popupMountRef,
33
- createAnalyticsEvent: createAnalyticsEvent
34
- }),
35
- createDecorations = _factoryDecorations.createDecorations,
36
- removeDecorations = _factoryDecorations.removeDecorations;
37
- var reducer = createReducer({
38
- createDecorations: createDecorations,
39
- removeDecorations: removeDecorations,
40
- typeAheadHandlers: typeAheadHandlers,
41
- popupMountRef: popupMountRef
42
- });
43
- return new SafePlugin({
44
- key: pluginKey,
45
- state: {
46
- init: function init() {
47
- return {
48
- typeAheadHandlers: typeAheadHandlers,
49
- query: '',
50
- decorationSet: DecorationSet.empty,
51
- decorationElement: null,
52
- items: [],
53
- selectedIndex: -1,
54
- stats: null,
55
- inputMethod: null
56
- };
57
- },
58
- apply: function apply(tr, currentPluginState, oldEditorState, state) {
59
- var customStep = hasValidTypeAheadStep(tr);
60
- var nextPluginState = reducer(tr, currentPluginState, customStep);
61
- if (currentPluginState !== nextPluginState) {
62
- reactDispatch(pluginKey, nextPluginState);
63
- }
64
- return nextPluginState;
65
- }
66
- },
67
- appendTransaction: function appendTransaction(transactions, _oldState, newState) {
68
- var insertItemCallback = isInsertionTransaction(transactions, ACTIONS.INSERT_RAW_QUERY);
69
- if (insertItemCallback) {
70
- var tr = insertItemCallback(newState);
71
- if (tr) {
72
- return tr;
73
- }
74
- }
75
- },
76
- view: function view() {
77
- return {
78
- update: function update(editorView) {}
79
- };
80
- },
81
- props: {
82
- decorations: function decorations(state) {
83
- var _pluginKey$getState;
84
- return (_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet;
85
- },
86
- handleDOMEvents: {
87
- compositionend: function compositionend(view, event) {
88
- return false;
89
- },
90
- click: function click(view, event) {
91
- var target = event.target;
92
- // ProseMirror view listen to any click event inside of it
93
- // When this event is coming from the typeahead
94
- // we should tell to ProseMirror to sit down and relax
95
- // cuz we know what we are doing (I hope)
96
- if (target instanceof HTMLElement && closest(target, "[data-type-ahead=".concat(TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, "]"))) {
97
- return true;
98
- }
99
- return false;
100
- }
101
- }
102
- }
103
- });
104
- }