@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,151 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
- import { InsertTypeAheadStep, InsertTypeAheadStages } from '@atlaskit/adf-schema/steps';
6
- import { ACTIONS } from './actions';
7
- import { pluginKey } from './key';
8
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
9
- import { isTypeAheadHandler } from '../utils';
10
- var shouldForceOpen = function shouldForceOpen(step) {
11
- if (!(step instanceof InsertTypeAheadStep)) {
12
- return false;
13
- }
14
- var isDeletionRawQueryOperation = step.isInsertionStep() && step.stage === InsertTypeAheadStages.DELETING_RAW_QUERY;
15
- var isUndoingInsertionItem = step.isUndoingStep() && step.stage === InsertTypeAheadStages.INSERTING_ITEM;
16
- return isDeletionRawQueryOperation || isUndoingInsertionItem;
17
- };
18
- var shouldForceClose = function shouldForceClose(step) {
19
- if (!(step instanceof InsertTypeAheadStep)) {
20
- return false;
21
- }
22
- var isInsertingItem = step.isInsertionStep() && step.stage === InsertTypeAheadStages.INSERTING_ITEM;
23
- var isUndoingDeletionRawQuery = step.isUndoingStep() && step.stage === InsertTypeAheadStages.DELETING_RAW_QUERY;
24
- return isInsertingItem || isUndoingDeletionRawQuery;
25
- };
26
- var createFindHandler = function createFindHandler(typeAheadHandlers) {
27
- return function (step) {
28
- if (!(step instanceof InsertTypeAheadStep)) {
29
- return null;
30
- }
31
- var handler = typeAheadHandlers.find(function (h) {
32
- return h.trigger === step.trigger;
33
- });
34
- return handler || null;
35
- };
36
- };
37
- export var createReducer = function createReducer(_ref) {
38
- var typeAheadHandlers = _ref.typeAheadHandlers,
39
- removeDecorations = _ref.removeDecorations,
40
- createDecorations = _ref.createDecorations;
41
- var findHandler = createFindHandler(typeAheadHandlers);
42
- var openMenu = function openMenu(currentPluginState, _ref2) {
43
- var tr = _ref2.tr,
44
- triggerHandler = _ref2.triggerHandler,
45
- inputMethod = _ref2.inputMethod,
46
- reopenQuery = _ref2.reopenQuery,
47
- selectedIndex = _ref2.selectedIndex;
48
- removeDecorations(currentPluginState.decorationSet);
49
- var _createDecorations = createDecorations(tr, {
50
- triggerHandler: triggerHandler,
51
- inputMethod: inputMethod,
52
- reopenQuery: reopenQuery
53
- }),
54
- decorationSet = _createDecorations.decorationSet,
55
- decorationElement = _createDecorations.decorationElement,
56
- stats = _createDecorations.stats;
57
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
58
- stats: stats,
59
- decorationSet: decorationSet,
60
- triggerHandler: triggerHandler,
61
- decorationElement: decorationElement,
62
- inputMethod: inputMethod,
63
- selectedIndex: typeof selectedIndex === 'number' ? selectedIndex : -1,
64
- items: [],
65
- query: reopenQuery || ''
66
- });
67
- };
68
- var closeMenu = function closeMenu(currentPluginState) {
69
- removeDecorations(currentPluginState.decorationSet);
70
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
71
- inputMethod: null,
72
- query: '',
73
- decorationElement: null,
74
- decorationSet: DecorationSet.empty,
75
- stats: null,
76
- triggerHandler: undefined,
77
- items: []
78
- });
79
- };
80
- return function (tr, currentPluginState, typeAheadStepOverride) {
81
- var meta = tr.getMeta(pluginKey) || {};
82
-
83
- // This code below controls when we should force
84
- // the menu to open or close during undo/redo operations
85
- var overrideHandler = findHandler(typeAheadStepOverride);
86
- if (typeAheadStepOverride && overrideHandler && shouldForceOpen(typeAheadStepOverride)) {
87
- return openMenu(currentPluginState, {
88
- tr: tr,
89
- triggerHandler: overrideHandler,
90
- inputMethod: INPUT_METHOD.KEYBOARD,
91
- reopenQuery: typeAheadStepOverride.query,
92
- selectedIndex: typeAheadStepOverride.selectedIndex
93
- });
94
- } else if (shouldForceClose(typeAheadStepOverride)) {
95
- return closeMenu(currentPluginState);
96
- }
97
- var _ref3 = meta || {},
98
- action = _ref3.action,
99
- params = _ref3.params;
100
- var shouldOpenMenu = action === ACTIONS.OPEN_TYPEAHEAD_AT_CURSOR && isTypeAheadHandler(params === null || params === void 0 ? void 0 : params.triggerHandler);
101
- var selectionChanged = tr.selectionSet && (tr.isGeneric || Boolean(tr.getMeta('pointer')));
102
- var shouldCloseMenu = [ACTIONS.CLOSE_TYPE_AHEAD, ACTIONS.INSERT_ITEM].includes(action) || selectionChanged;
103
- var shouldUpdateQuery = action === ACTIONS.CHANGE_QUERY;
104
- var shouldUpdateListItems = action === ACTIONS.UPDATE_LIST_ITEMS;
105
- var shouldUpdateSelectedIndex = action === ACTIONS.UPDATE_SELECTED_INDEX;
106
- if (shouldOpenMenu) {
107
- return openMenu(currentPluginState, {
108
- tr: tr,
109
- triggerHandler: params.triggerHandler,
110
- inputMethod: params.inputMethod
111
- });
112
- } else if (shouldCloseMenu) {
113
- return closeMenu(currentPluginState);
114
- } else if (shouldUpdateQuery) {
115
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
116
- query: params.query
117
- });
118
- } else if (shouldUpdateListItems) {
119
- var items = params.items;
120
- var selectedIndex = currentPluginState.selectedIndex;
121
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
122
- items: items,
123
- selectedIndex: Math.max(selectedIndex >= items.length ? items.length - 1 : selectedIndex, -1)
124
- });
125
- } else if (shouldUpdateSelectedIndex) {
126
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
127
- selectedIndex: params.selectedIndex
128
- });
129
- }
130
- if (tr.docChanged) {
131
- var decorationSet = currentPluginState.decorationSet;
132
- var onRemove = function onRemove() {
133
- // Make sure we are unmounting the component
134
- // from the react tree when this decoration is removed
135
- removeDecorations(currentPluginState.decorationSet);
136
- };
137
- var mappedDecorationSet = decorationSet.map(tr.mapping, tr.doc, {
138
- onRemove: onRemove
139
- });
140
-
141
- // return same pluginState if decorationSet did not change
142
- if (mappedDecorationSet === currentPluginState.decorationSet) {
143
- return currentPluginState;
144
- }
145
- return _objectSpread(_objectSpread({}, currentPluginState), {}, {
146
- decorationSet: mappedDecorationSet
147
- });
148
- }
149
- return currentPluginState;
150
- };
151
- };
@@ -1,12 +0,0 @@
1
- import { pluginKey } from './key';
2
- export var isInsertionTransaction = function isInsertionTransaction(transactions, action) {
3
- var _tr$getMeta2;
4
- var tr = transactions.find(function (tr) {
5
- var _tr$getMeta;
6
- return ((_tr$getMeta = tr.getMeta(pluginKey)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.action) === action;
7
- });
8
- if (!tr) {
9
- return null;
10
- }
11
- return (_tr$getMeta2 = tr.getMeta(pluginKey)) === null || _tr$getMeta2 === void 0 ? void 0 : _tr$getMeta2.params;
12
- };
@@ -1,35 +0,0 @@
1
- import _createClass from "@babel/runtime/helpers/createClass";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- export var StatsModifier = /*#__PURE__*/_createClass(function StatsModifier() {
5
- var _this = this;
6
- _classCallCheck(this, StatsModifier);
7
- _defineProperty(this, "startedAt", 0);
8
- _defineProperty(this, "endedAt", 0);
9
- _defineProperty(this, "keyCount", {
10
- arrowUp: 0,
11
- arrowDown: 0
12
- });
13
- _defineProperty(this, "increaseArrowUp", function () {
14
- _this.keyCount.arrowUp += 1;
15
- });
16
- _defineProperty(this, "increaseArrowDown", function () {
17
- _this.keyCount.arrowDown += 1;
18
- });
19
- _defineProperty(this, "serialize", function () {
20
- var _this$keyCount, _this$keyCount2;
21
- return {
22
- startedAt: _this.startedAt,
23
- endedAt: performance.now(),
24
- keyCount: {
25
- arrowUp: ((_this$keyCount = _this.keyCount) === null || _this$keyCount === void 0 ? void 0 : _this$keyCount.arrowUp) || 0,
26
- arrowDown: ((_this$keyCount2 = _this.keyCount) === null || _this$keyCount2 === void 0 ? void 0 : _this$keyCount2.arrowDown) || 0
27
- }
28
- };
29
- });
30
- this.startedAt = performance.now();
31
- this.keyCount = {
32
- arrowUp: 0,
33
- arrowDown: 0
34
- };
35
- });
@@ -1,7 +0,0 @@
1
- import { pluginKey } from '../pm-plugins/key';
2
- import { ACTIONS } from '../pm-plugins/actions';
3
- export var closeTypeAhead = function closeTypeAhead(tr) {
4
- return tr.setMeta(pluginKey, {
5
- action: ACTIONS.CLOSE_TYPE_AHEAD
6
- });
7
- };
@@ -1,69 +0,0 @@
1
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { GapCursorSelection } from '@atlaskit/editor-common/selection';
3
- import { pluginKey } from '../pm-plugins/key';
4
- import { ACTIONS } from '../pm-plugins/actions';
5
- export var openTypeAhead = function openTypeAhead(props) {
6
- return function (tr) {
7
- var triggerHandler = props.triggerHandler,
8
- inputMethod = props.inputMethod,
9
- query = props.query;
10
- tr.setMeta(pluginKey, {
11
- action: ACTIONS.OPEN_TYPEAHEAD_AT_CURSOR,
12
- params: {
13
- triggerHandler: triggerHandler,
14
- inputMethod: inputMethod,
15
- query: query
16
- }
17
- });
18
- };
19
- };
20
- export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
21
- var triggerHandler = _ref.triggerHandler,
22
- inputMethod = _ref.inputMethod,
23
- query = _ref.query;
24
- return function (_ref2) {
25
- var tr = _ref2.tr;
26
- openTypeAhead({
27
- triggerHandler: triggerHandler,
28
- inputMethod: inputMethod,
29
- query: query
30
- })(tr);
31
- var selection = tr.selection;
32
- if (!(selection instanceof TextSelection || selection instanceof GapCursorSelection)) {
33
- return tr;
34
- }
35
- if (selection instanceof GapCursorSelection) {
36
- // Create space for the typeahead menu in gap cursor
37
- tr.insertText(' ');
38
- // delete 1 pos before wherever selection is now - that will delete the empty space
39
- tr.delete(tr.selection.from - 1, tr.selection.from);
40
- } else {
41
- var _selection$$head, _selection$$head$pare, _selection$$head$pare2;
42
- if (!selection.$cursor) {
43
- tr.deleteSelection();
44
- return tr;
45
- }
46
-
47
- // Search & Destroy placeholder
48
- var cursorPos = selection.$cursor.pos;
49
- var nodeAtCursor = tr.doc.nodeAt(cursorPos);
50
- var isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
51
- if (nodeAtCursor && isPlaceholderAtCursorPosition) {
52
- tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
53
- }
54
-
55
- // ME-2375 remove the superfluous '@' inserted before decoration
56
- // by composition (https://github.com/ProseMirror/prosemirror/issues/903)
57
- //
58
- // Update:
59
- // Now also handles any use case with superfluous typeahead triggers (ie. '@', ':', '/')
60
- // being inserted due to composition by checking if we have the trigger
61
- // directly before the typeahead. This should not happen unless it has
62
- // been eroneously added because we require whitespace/newline for typeahead.
63
- if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head = _selection$$head.parent) !== null && _selection$$head !== void 0 && _selection$$head.textContent) && (_selection$$head$pare = (_selection$$head$pare2 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.call(_selection$$head$pare2, triggerHandler.trigger)) {
64
- tr.delete(cursorPos - 1, cursorPos);
65
- }
66
- }
67
- return tr;
68
- };
69
- };
@@ -1,12 +0,0 @@
1
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- export var setSelectionBeforeQuery = function setSelectionBeforeQuery(rawText) {
3
- return function (tr) {
4
- var currentPosition = tr.selection.$from.pos;
5
- var positionBeforeRawText = Math.max(currentPosition - rawText.length, 0);
6
- var resolvedPositionBeforeText = tr.doc.resolve(positionBeforeRawText);
7
- var nextSelection = TextSelection.findFrom(resolvedPositionBeforeText, -1, true);
8
- if (nextSelection) {
9
- tr.setSelection(nextSelection);
10
- }
11
- };
12
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,115 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
- /** @jsx jsx */
11
-
12
- import debounce from 'lodash/debounce';
13
- import React from 'react';
14
- import { css, jsx } from '@emotion/react';
15
- var statusDebounceMillis = 1400;
16
- var assitiveTextStyles = css({
17
- border: 0,
18
- clip: 'rect(0 0 0 0)',
19
- height: '1px',
20
- marginbottom: '-1px',
21
- marginright: '-1px',
22
- overflow: 'hidden',
23
- padding: 0,
24
- position: 'absolute',
25
- whitespace: 'nowrap',
26
- width: '1px'
27
- });
28
- var AssistveTextComponent = /*#__PURE__*/function (_React$Component) {
29
- _inherits(AssistveTextComponent, _React$Component);
30
- var _super = _createSuper(AssistveTextComponent);
31
- function AssistveTextComponent() {
32
- var _this;
33
- _classCallCheck(this, AssistveTextComponent);
34
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
35
- args[_key] = arguments[_key];
36
- }
37
- _this = _super.call.apply(_super, [this].concat(args));
38
- _defineProperty(_assertThisInitialized(_this), "state", {
39
- bump: false,
40
- //when the same text needs to be read again, Hence it needs to be toggled between __status--A and __status--B
41
- debounced: false,
42
- silenced: false
43
- });
44
- return _this;
45
- }
46
- _createClass(AssistveTextComponent, [{
47
- key: "componentWillMount",
48
- value: function componentWillMount() {
49
- var _this2 = this;
50
- this.debounceStatusUpdate = debounce(function () {
51
- if (!_this2.state.debounced) {
52
- var shouldSilence = !_this2.props.isInFocus;
53
- _this2.setState(function (_ref) {
54
- var bump = _ref.bump;
55
- return {
56
- bump: !bump,
57
- debounced: true,
58
- silenced: shouldSilence
59
- };
60
- });
61
- }
62
- }, statusDebounceMillis);
63
- }
64
- }, {
65
- key: "componentWillUnmount",
66
- value: function componentWillUnmount() {
67
- this.debounceStatusUpdate.cancel();
68
- }
69
- }, {
70
- key: "componentWillReceiveProps",
71
- value: function componentWillReceiveProps() {
72
- this.setState(function (_ref2) {
73
- var bump = _ref2.bump;
74
- return {
75
- bump: !bump,
76
- debounced: false
77
- };
78
- });
79
- }
80
- }, {
81
- key: "render",
82
- value: function render() {
83
- var _this$props = this.props,
84
- assistiveText = _this$props.assistiveText,
85
- id = _this$props.id;
86
- var _this$state = this.state,
87
- bump = _this$state.bump,
88
- debounced = _this$state.debounced,
89
- silenced = _this$state.silenced;
90
- this.debounceStatusUpdate();
91
- return jsx("div", {
92
- css: assitiveTextStyles
93
- }, jsx("div", {
94
- id: id + '__status--A',
95
- role: "status",
96
- "aria-atomic": "true",
97
- "aria-live": "polite"
98
- }, "".concat(!silenced && debounced && bump ? assistiveText : '')), jsx("div", {
99
- id: id + '__status--B',
100
- role: "status",
101
- "aria-atomic": "true",
102
- "aria-live": "polite"
103
- }, "".concat(!silenced && debounced && !bump ? assistiveText : '')));
104
- }
105
- }]);
106
- return AssistveTextComponent;
107
- }(React.Component);
108
- _defineProperty(AssistveTextComponent, "defaultProps", {
109
- statusDebounceMillis: 1400,
110
- debounce: true,
111
- assistiveText: '',
112
- isInFocus: false,
113
- id: ''
114
- });
115
- export var AssistiveText = AssistveTextComponent;