@atlaskit/editor-core 188.9.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 (207) hide show
  1. package/CHANGELOG.md +7 -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 +3 -5
  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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 188.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#41047](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41047) [`8f0b00d165f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8f0b00d165f) - [ED-20003] Extract TypeAhead from editor-core to its own package @atlaskit/editor-plugin-type-ahead
8
+ - Updated dependencies
9
+
3
10
  ## 188.9.0
4
11
 
5
12
  ### Minor Changes
@@ -16,7 +16,7 @@ var _editorPluginUnsupportedContent = require("@atlaskit/editor-plugin-unsupport
16
16
  var _editorPluginBase = require("@atlaskit/editor-plugin-base");
17
17
  var _editorPluginFocus = require("@atlaskit/editor-plugin-focus");
18
18
  var _editorPluginEditorDisabled = require("@atlaskit/editor-plugin-editor-disabled");
19
- var _typeAhead = _interopRequireDefault(require("../../../plugins/type-ahead"));
19
+ var _editorPluginTypeAhead = require("@atlaskit/editor-plugin-type-ahead");
20
20
  var _submitEditor = _interopRequireDefault(require("../../../plugins/submit-editor"));
21
21
  var _fakeTextCursor = _interopRequireDefault(require("../../../plugins/fake-text-cursor"));
22
22
  var _editorPluginFeatureFlags = require("@atlaskit/editor-plugin-feature-flags");
@@ -75,7 +75,7 @@ function createDefaultPreset(options) {
75
75
  return builder.add([p, options.annotationProviders]);
76
76
  }
77
77
  return builder;
78
- }).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_editorPluginTextFormatting.textFormattingPlugin, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_editorPluginQuickInsert.quickInsertPlugin, options.quickInsert]).add([_typeAhead.default, options.typeAhead || {
78
+ }).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_editorPluginTextFormatting.textFormattingPlugin, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_editorPluginQuickInsert.quickInsertPlugin, options.quickInsert]).add([_editorPluginTypeAhead.typeAheadPlugin, options.typeAhead || {
79
79
  createAnalyticsEvent: options.createAnalyticsEvent
80
80
  }]).add([_editorPluginPlaceholder.placeholderPlugin, options.placeholder]).add(_editorPluginUnsupportedContent.unsupportedContentPlugin).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_submitEditor.default, options.submitEditor]).add(_fakeTextCursor.default).add(_editorPluginCopyButton.copyButtonPlugin).add(_editorPluginFloatingToolbar.floatingToolbarPlugin).add([_editorPluginSelection.selectionPlugin, options.selection]).add([_codeBlock.default, options.codeBlock || {
81
81
  appearance: 'full-page'
@@ -233,12 +233,6 @@ Object.defineProperty(exports, "toolbarListsIndentationPlugin", {
233
233
  return _toolbarListsIndentation.default;
234
234
  }
235
235
  });
236
- Object.defineProperty(exports, "typeAheadPlugin", {
237
- enumerable: true,
238
- get: function get() {
239
- return _typeAhead.default;
240
- }
241
- });
242
236
  Object.defineProperty(exports, "undoRedoPlugin", {
243
237
  enumerable: true,
244
238
  get: function get() {
@@ -271,7 +265,6 @@ var _placeholderText = _interopRequireDefault(require("./placeholder-text"));
271
265
  var _submitEditor = _interopRequireDefault(require("./submit-editor"));
272
266
  var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions"));
273
267
  var _textColor = _interopRequireDefault(require("./text-color"));
274
- var _typeAhead = _interopRequireDefault(require("./type-ahead"));
275
268
  var _breakout = _interopRequireDefault(require("./breakout"));
276
269
  var _alignment = _interopRequireDefault(require("./alignment"));
277
270
  var _dataConsumer = _interopRequireDefault(require("./data-consumer"));
@@ -7,12 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _providerFactory = require("@atlaskit/editor-common/provider-factory");
10
- var _utils = require("../type-ahead/utils");
11
10
  var _layout = require("../layout");
12
11
  var _macro = require("../macro");
13
12
  var _WithPluginState = _interopRequireDefault(require("../../ui/WithPluginState"));
14
13
  var _ToolbarInsertBlock = _interopRequireDefault(require("./ui/ToolbarInsertBlock"));
15
- var _key = require("../type-ahead/pm-plugins/key");
16
14
  var _consts = require("@atlaskit/editor-plugin-block-type/consts");
17
15
  var _analytics = require("../analytics");
18
16
  var _pluginKey = require("../placeholder-text/plugin-key");
@@ -77,7 +75,6 @@ var insertBlockPlugin = function insertBlockPlugin(_ref) {
77
75
  // `ToolbarInsertBlockWithInjectionApi` and remove `WithPluginState`
78
76
  return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
79
77
  plugins: {
80
- typeAheadState: _key.pluginKey,
81
78
  macroState: _pluginKey2.pluginKey,
82
79
  placeholderTextState: _pluginKey.pluginKey,
83
80
  layoutState: _layout.pluginKey
@@ -138,20 +135,21 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
138
135
  layoutState = _ref4.layoutState,
139
136
  featureFlags = _ref4.featureFlags;
140
137
  var buttons = toolbarSizeToButtons(toolbarSize);
141
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media']),
138
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead']),
142
139
  dateState = _useSharedPluginState.dateState,
143
140
  hyperlinkState = _useSharedPluginState.hyperlinkState,
144
141
  imageUploadState = _useSharedPluginState.imageUploadState,
145
142
  mentionState = _useSharedPluginState.mentionState,
146
143
  emojiState = _useSharedPluginState.emojiState,
147
144
  blockTypeState = _useSharedPluginState.blockTypeState,
148
- mediaState = _useSharedPluginState.mediaState;
145
+ mediaState = _useSharedPluginState.mediaState,
146
+ typeAheadState = _useSharedPluginState.typeAheadState;
149
147
  return /*#__PURE__*/_react.default.createElement(_ToolbarInsertBlock.default, {
150
148
  pluginInjectionApi: pluginInjectionApi,
151
149
  buttons: buttons,
152
150
  isReducedSpacing: isToolbarReducedSpacing,
153
151
  isDisabled: disabled,
154
- isTypeAheadAllowed: (0, _utils.isTypeAheadAllowed)(editorView.state),
152
+ isTypeAheadAllowed: Boolean(typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed),
155
153
  editorView: editorView,
156
154
  tableSupported: !!editorView.state.schema.nodes.table,
157
155
  actionSupported: !!editorView.state.schema.nodes.taskItem,
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
10
  var _adfSchema = require("@atlaskit/adf-schema");
11
- var _analytics = require("../analytics");
11
+ var _analytics = require("@atlaskit/editor-common/analytics");
12
12
  var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
13
13
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
14
14
  var _commands = require("./commands");
@@ -39,7 +39,8 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
39
39
  _ref2$config2 = _ref2$config === void 0 ? {} : _ref2$config,
40
40
  allowNestedTasks = _ref2$config2.allowNestedTasks,
41
41
  consumeTabs = _ref2$config2.consumeTabs,
42
- useLongPressSelection = _ref2$config2.useLongPressSelection;
42
+ useLongPressSelection = _ref2$config2.useLongPressSelection,
43
+ api = _ref2.api;
43
44
  return {
44
45
  name: 'taskDecision',
45
46
  nodes: function nodes() {
@@ -65,7 +66,7 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
65
66
  providerFactory = _ref3.providerFactory,
66
67
  eventDispatcher = _ref3.eventDispatcher,
67
68
  dispatch = _ref3.dispatch;
68
- return (0, _main.createPlugin)(portalProviderAPI, eventDispatcher, providerFactory, dispatch, useLongPressSelection);
69
+ return (0, _main.createPlugin)(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, useLongPressSelection);
69
70
  }
70
71
  }, {
71
72
  name: 'tasksAndDecisionsInputRule',
@@ -13,10 +13,21 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
13
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
16
+ var _hooks = require("@atlaskit/editor-common/hooks");
16
17
  var _Decision = _interopRequireDefault(require("../ui/Decision"));
17
- var _utils = require("../../type-ahead/utils");
18
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
19
19
  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; } }
20
+ var DecisionItemWrapper = function DecisionItemWrapper(_ref) {
21
+ var api = _ref.api,
22
+ forwardRef = _ref.forwardRef,
23
+ isContentNodeEmpty = _ref.isContentNodeEmpty;
24
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['typeAhead']),
25
+ typeAheadState = _useSharedPluginState.typeAheadState;
26
+ return /*#__PURE__*/_react.default.createElement(_Decision.default, {
27
+ contentRef: forwardRef,
28
+ showPlaceholder: isContentNodeEmpty && !(typeAheadState !== null && typeAheadState !== void 0 && typeAheadState.isOpen)
29
+ });
30
+ };
20
31
  var Decision = /*#__PURE__*/function (_ReactNodeView) {
21
32
  (0, _inherits2.default)(Decision, _ReactNodeView);
22
33
  var _super = _createSuper(Decision);
@@ -29,6 +40,13 @@ var Decision = /*#__PURE__*/function (_ReactNodeView) {
29
40
  value: function isContentEmpty(node) {
30
41
  return node.content.childCount === 0;
31
42
  }
43
+ }, {
44
+ key: "initWithAPI",
45
+ value: function initWithAPI(api) {
46
+ this.init();
47
+ this.api = api;
48
+ return this;
49
+ }
32
50
  }, {
33
51
  key: "createDomRef",
34
52
  value: function createDomRef() {
@@ -50,9 +68,11 @@ var Decision = /*#__PURE__*/function (_ReactNodeView) {
50
68
  }, {
51
69
  key: "render",
52
70
  value: function render(_props, forwardRef) {
53
- return /*#__PURE__*/_react.default.createElement(_Decision.default, {
54
- contentRef: forwardRef,
55
- showPlaceholder: this.isContentEmpty(this.node) && !(0, _utils.isTypeAheadOpen)(this.view.state)
71
+ var isContentNodeEmpty = this.isContentEmpty(this.node);
72
+ return /*#__PURE__*/_react.default.createElement(DecisionItemWrapper, {
73
+ forwardRef: forwardRef,
74
+ isContentNodeEmpty: isContentNodeEmpty,
75
+ api: this.api
56
76
  });
57
77
  }
58
78
  }, {
@@ -78,9 +98,9 @@ var Decision = /*#__PURE__*/function (_ReactNodeView) {
78
98
  }]);
79
99
  return Decision;
80
100
  }(_reactNodeView.default);
81
- var decisionItemNodeView = exports.decisionItemNodeView = function decisionItemNodeView(portalProviderAPI, eventDispatcher) {
101
+ var decisionItemNodeView = exports.decisionItemNodeView = function decisionItemNodeView(portalProviderAPI, eventDispatcher, api) {
82
102
  return function (node, view, getPos) {
83
103
  var hasIntlContext = true;
84
- return new Decision(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).init();
104
+ return new Decision(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).initWithAPI(api);
85
105
  };
86
106
  };
@@ -16,15 +16,38 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
16
16
  var _react = _interopRequireDefault(require("react"));
17
17
  var _analyticsNext = require("@atlaskit/analytics-next");
18
18
  var _steps = require("@atlaskit/adf-schema/steps");
19
+ var _hooks = require("@atlaskit/editor-common/hooks");
19
20
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
20
- var _WithPluginState = _interopRequireDefault(require("../../../ui/WithPluginState"));
21
+ var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
21
22
  var _pluginKey = require("../pm-plugins/plugin-key");
22
23
  var _Task = _interopRequireDefault(require("../ui/Task"));
23
- var _utils = require("../../type-ahead/utils");
24
24
  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; }
25
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
26
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
27
27
  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; } }
28
+ //import { isTypeAheadOpen } from '../../type-ahead/utils';
29
+
30
+ var TaskItemWrapper = function TaskItemWrapper(_ref) {
31
+ var localId = _ref.localId,
32
+ forwardRef = _ref.forwardRef,
33
+ isDone = _ref.isDone,
34
+ onChange = _ref.onChange,
35
+ isFocused = _ref.isFocused,
36
+ isContentNodeEmpty = _ref.isContentNodeEmpty,
37
+ providerFactory = _ref.providerFactory,
38
+ api = _ref.api;
39
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['typeAhead']),
40
+ typeAheadState = _useSharedPluginState.typeAheadState;
41
+ return /*#__PURE__*/_react.default.createElement(_Task.default, {
42
+ taskId: localId,
43
+ contentRef: forwardRef,
44
+ isDone: isDone,
45
+ onChange: onChange,
46
+ isFocused: isFocused,
47
+ showPlaceholder: isContentNodeEmpty && !(typeAheadState !== null && typeAheadState !== void 0 && typeAheadState.isOpen),
48
+ providers: providerFactory
49
+ });
50
+ };
28
51
  var Task = /*#__PURE__*/function (_ReactNodeView) {
29
52
  (0, _inherits2.default)(Task, _ReactNodeView);
30
53
  var _super = _createSuper(Task);
@@ -95,6 +118,13 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
95
118
  return _this;
96
119
  }
97
120
  (0, _createClass2.default)(Task, [{
121
+ key: "initWithAPI",
122
+ value: function initWithAPI(api) {
123
+ this.init();
124
+ this.api = api;
125
+ return this;
126
+ }
127
+ }, {
98
128
  key: "isContentEmpty",
99
129
  value: function isContentEmpty(node) {
100
130
  return node.content.childCount === 0;
@@ -124,23 +154,25 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
124
154
  var _this$node$attrs = this.node.attrs,
125
155
  localId = _this$node$attrs.localId,
126
156
  state = _this$node$attrs.state;
157
+ var isContentNodeEmpty = this.isContentEmpty(this.node);
127
158
  return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsListener, {
128
159
  channel: "fabric-elements",
129
160
  onEvent: this.addListAnalyticsData
130
- }, /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
161
+ }, /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
131
162
  plugins: {
132
163
  taskDecisionPlugin: _pluginKey.stateKey
133
164
  },
134
- render: function render(_ref) {
135
- var taskDecisionPlugin = _ref.taskDecisionPlugin;
136
- return /*#__PURE__*/_react.default.createElement(_Task.default, {
137
- taskId: localId,
138
- contentRef: forwardRef,
165
+ render: function render(_ref2) {
166
+ var taskDecisionPlugin = _ref2.taskDecisionPlugin;
167
+ return /*#__PURE__*/_react.default.createElement(TaskItemWrapper, {
168
+ localId: localId,
169
+ forwardRef: forwardRef,
139
170
  isDone: state === 'DONE',
140
171
  onChange: _this2.handleOnChange,
141
- isFocused: (taskDecisionPlugin === null || taskDecisionPlugin === void 0 ? void 0 : taskDecisionPlugin.focusedTaskItemLocalId) === localId,
142
- showPlaceholder: _this2.isContentEmpty(_this2.node) && !(0, _utils.isTypeAheadOpen)(_this2.view.state),
143
- providers: props.providerFactory
172
+ isFocused: Boolean((taskDecisionPlugin === null || taskDecisionPlugin === void 0 ? void 0 : taskDecisionPlugin.focusedTaskItemLocalId) === localId),
173
+ isContentNodeEmpty: isContentNodeEmpty,
174
+ providerFactory: props.providerFactory,
175
+ api: _this2.api
144
176
  });
145
177
  }
146
178
  }));
@@ -169,11 +201,11 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
169
201
  }]);
170
202
  return Task;
171
203
  }(_reactNodeView.default);
172
- function taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory) {
204
+ function taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory, api) {
173
205
  return function (node, view, getPos) {
174
206
  var hasIntlContext = true;
175
207
  return new Task(node, view, getPos, portalProviderAPI, eventDispatcher, {
176
208
  providerFactory: providerFactory
177
- }, undefined, undefined, undefined, hasIntlContext).init();
209
+ }, undefined, undefined, undefined, hasIntlContext).initWithAPI(api);
178
210
  };
179
211
  }
@@ -10,7 +10,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
11
  var _state = require("@atlaskit/editor-prosemirror/state");
12
12
  var _adfSchema = require("@atlaskit/adf-schema");
13
- var _utils = require("../../../utils");
13
+ var _utils = require("@atlaskit/editor-common/utils");
14
+ var _steps = require("@atlaskit/adf-schema/steps");
14
15
  var _selection = require("@atlaskit/editor-common/selection");
15
16
  var _decisionItem = require("../nodeviews/decisionItem");
16
17
  var _taskItem = require("../nodeviews/taskItem");
@@ -20,6 +21,13 @@ var _types = require("./types");
20
21
  var _excluded = ["localId"];
21
22
  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; }
22
23
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
+ function nodesBetweenChanged(tr, f, startPos) {
25
+ var stepRange = (0, _utils.getStepRange)(tr);
26
+ if (!stepRange) {
27
+ return;
28
+ }
29
+ tr.doc.nodesBetween(stepRange.from, stepRange.to, f, startPos);
30
+ }
23
31
  var setContextIdentifierProvider = function setContextIdentifierProvider(provider) {
24
32
  return function (state, dispatch) {
25
33
  if (dispatch) {
@@ -31,13 +39,13 @@ var setContextIdentifierProvider = function setContextIdentifierProvider(provide
31
39
  return true;
32
40
  };
33
41
  };
34
- function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch) {
35
- var useLongPressSelection = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
42
+ function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api) {
43
+ var useLongPressSelection = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
36
44
  return new _safePlugin.SafePlugin({
37
45
  props: {
38
46
  nodeViews: {
39
- taskItem: (0, _taskItem.taskItemNodeViewFactory)(portalProviderAPI, eventDispatcher, providerFactory),
40
- decisionItem: (0, _decisionItem.decisionItemNodeView)(portalProviderAPI, eventDispatcher)
47
+ taskItem: (0, _taskItem.taskItemNodeViewFactory)(portalProviderAPI, eventDispatcher, providerFactory, api),
48
+ decisionItem: (0, _decisionItem.decisionItemNodeView)(portalProviderAPI, eventDispatcher, api)
41
49
  },
42
50
  handleTextInput: function handleTextInput(view, from, to, text) {
43
51
  // When a decision item is selected and the user starts typing, the entire node
@@ -227,7 +235,7 @@ function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispa
227
235
  }
228
236
 
229
237
  // Adds a unique id to a node
230
- (0, _utils.nodesBetweenChanged)(transaction, function (node, pos) {
238
+ nodesBetweenChanged(transaction, function (node, pos) {
231
239
  var _newState$schema$node = newState.schema.nodes,
232
240
  decisionList = _newState$schema$node.decisionList,
233
241
  decisionItem = _newState$schema$node.decisionItem,
@@ -238,7 +246,7 @@ function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispa
238
246
  localId = _node$attrs.localId,
239
247
  rest = (0, _objectWithoutProperties2.default)(_node$attrs, _excluded);
240
248
  if (localId === undefined || localId === null || localId === '') {
241
- tr.step(new _utils.SetAttrsStep(pos, _objectSpread({
249
+ tr.step(new _steps.SetAttrsStep(pos, _objectSpread({
242
250
  localId: _adfSchema.uuid.generate()
243
251
  }, rest)));
244
252
  modified = true;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "188.9.0";
8
+ var version = exports.version = "188.9.2";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -10,7 +10,7 @@ import { unsupportedContentPlugin } from '@atlaskit/editor-plugin-unsupported-co
10
10
  import { basePlugin } from '@atlaskit/editor-plugin-base';
11
11
  import { focusPlugin } from '@atlaskit/editor-plugin-focus';
12
12
  import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
13
- import typeAheadPlugin from '../../../plugins/type-ahead';
13
+ import { typeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
14
14
  import submitEditorPlugin from '../../../plugins/submit-editor';
15
15
  import fakeTextCursorPlugin from '../../../plugins/fake-text-cursor';
16
16
  import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
@@ -18,7 +18,6 @@ export { default as placeholderTextPlugin } from './placeholder-text';
18
18
  export { default as submitEditorPlugin } from './submit-editor';
19
19
  export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
20
20
  export { default as textColorPlugin } from './text-color';
21
- export { default as typeAheadPlugin } from './type-ahead';
22
21
  export { default as breakoutPlugin } from './breakout';
23
22
  export { default as alignmentPlugin } from './alignment';
24
23
  export { default as dataConsumerMarkPlugin } from './data-consumer';
@@ -1,11 +1,9 @@
1
1
  import React from 'react';
2
2
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
3
- import { isTypeAheadAllowed } from '../type-ahead/utils';
4
3
  import { pluginKey as layoutStateKey } from '../layout';
5
4
  import { insertMacroFromMacroBrowser } from '../macro';
6
5
  import WithPluginState from '../../ui/WithPluginState';
7
6
  import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
8
- import { pluginKey as typeAheadPluginKey } from '../type-ahead/pm-plugins/key';
9
7
  import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
10
8
  import { INPUT_METHOD } from '../analytics';
11
9
  import { pluginKey as placeholderTextStateKey } from '../placeholder-text/plugin-key';
@@ -69,7 +67,6 @@ const insertBlockPlugin = ({
69
67
  // `ToolbarInsertBlockWithInjectionApi` and remove `WithPluginState`
70
68
  return /*#__PURE__*/React.createElement(WithPluginState, {
71
69
  plugins: {
72
- typeAheadState: typeAheadPluginKey,
73
70
  macroState: macroStateKey,
74
71
  placeholderTextState: placeholderTextStateKey,
75
72
  layoutState: layoutStateKey
@@ -138,14 +135,15 @@ function ToolbarInsertBlockWithInjectionApi({
138
135
  mentionState,
139
136
  emojiState,
140
137
  blockTypeState,
141
- mediaState
142
- } = useSharedPluginState(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media']);
138
+ mediaState,
139
+ typeAheadState
140
+ } = useSharedPluginState(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead']);
143
141
  return /*#__PURE__*/React.createElement(ToolbarInsertBlock, {
144
142
  pluginInjectionApi: pluginInjectionApi,
145
143
  buttons: buttons,
146
144
  isReducedSpacing: isToolbarReducedSpacing,
147
145
  isDisabled: disabled,
148
- isTypeAheadAllowed: isTypeAheadAllowed(editorView.state),
146
+ isTypeAheadAllowed: Boolean(typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed),
149
147
  editorView: editorView,
150
148
  tableSupported: !!editorView.state.schema.nodes.table,
151
149
  actionSupported: !!editorView.state.schema.nodes.taskItem,
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
3
  import { decisionItem, decisionList, taskItem, taskList } from '@atlaskit/adf-schema';
4
- import { INPUT_METHOD } from '../analytics';
4
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { messages as insertBlockMessages } from '../insert-block/ui/ToolbarInsertBlock/messages';
6
6
  import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
7
7
  import { insertTaskDecisionAction, getListTypes } from './commands';
@@ -32,7 +32,8 @@ const tasksAndDecisionsPlugin = ({
32
32
  allowNestedTasks,
33
33
  consumeTabs,
34
34
  useLongPressSelection
35
- } = {}
35
+ } = {},
36
+ api
36
37
  }) => ({
37
38
  name: 'taskDecision',
38
39
  nodes() {
@@ -59,7 +60,7 @@ const tasksAndDecisionsPlugin = ({
59
60
  eventDispatcher,
60
61
  dispatch
61
62
  }) => {
62
- return createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, useLongPressSelection);
63
+ return createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, useLongPressSelection);
63
64
  }
64
65
  }, {
65
66
  name: 'tasksAndDecisionsInputRule',
@@ -1,11 +1,29 @@
1
1
  import React from 'react';
2
2
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
3
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
4
  import DecisionItem from '../ui/Decision';
4
- import { isTypeAheadOpen } from '../../type-ahead/utils';
5
+ const DecisionItemWrapper = ({
6
+ api,
7
+ forwardRef,
8
+ isContentNodeEmpty
9
+ }) => {
10
+ const {
11
+ typeAheadState
12
+ } = useSharedPluginState(api, ['typeAhead']);
13
+ return /*#__PURE__*/React.createElement(DecisionItem, {
14
+ contentRef: forwardRef,
15
+ showPlaceholder: isContentNodeEmpty && !(typeAheadState !== null && typeAheadState !== void 0 && typeAheadState.isOpen)
16
+ });
17
+ };
5
18
  class Decision extends ReactNodeView {
6
19
  isContentEmpty(node) {
7
20
  return node.content.childCount === 0;
8
21
  }
22
+ initWithAPI(api) {
23
+ this.init();
24
+ this.api = api;
25
+ return this;
26
+ }
9
27
  createDomRef() {
10
28
  const domRef = document.createElement('li');
11
29
  domRef.style['list-style-type'] = 'none';
@@ -21,9 +39,11 @@ class Decision extends ReactNodeView {
21
39
  };
22
40
  }
23
41
  render(_props, forwardRef) {
24
- return /*#__PURE__*/React.createElement(DecisionItem, {
25
- contentRef: forwardRef,
26
- showPlaceholder: this.isContentEmpty(this.node) && !isTypeAheadOpen(this.view.state)
42
+ const isContentNodeEmpty = this.isContentEmpty(this.node);
43
+ return /*#__PURE__*/React.createElement(DecisionItemWrapper, {
44
+ forwardRef: forwardRef,
45
+ isContentNodeEmpty: isContentNodeEmpty,
46
+ api: this.api
27
47
  });
28
48
  }
29
49
  viewShouldUpdate(nextNode) {
@@ -40,7 +60,7 @@ class Decision extends ReactNodeView {
40
60
  (_currentNode, _newNode) => !this.isContentEmpty(_newNode));
41
61
  }
42
62
  }
43
- export const decisionItemNodeView = (portalProviderAPI, eventDispatcher) => (node, view, getPos) => {
63
+ export const decisionItemNodeView = (portalProviderAPI, eventDispatcher, api) => (node, view, getPos) => {
44
64
  const hasIntlContext = true;
45
- return new Decision(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).init();
65
+ return new Decision(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).initWithAPI(api);
46
66
  };
@@ -2,11 +2,37 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { AnalyticsListener } from '@atlaskit/analytics-next';
4
4
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
5
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
6
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
6
- import WithPluginState from '../../../ui/WithPluginState';
7
+ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
7
8
  import { stateKey as taskPluginKey } from '../pm-plugins/plugin-key';
8
9
  import TaskItem from '../ui/Task';
9
- import { isTypeAheadOpen } from '../../type-ahead/utils';
10
+
11
+ //import { isTypeAheadOpen } from '../../type-ahead/utils';
12
+
13
+ const TaskItemWrapper = ({
14
+ localId,
15
+ forwardRef,
16
+ isDone,
17
+ onChange,
18
+ isFocused,
19
+ isContentNodeEmpty,
20
+ providerFactory,
21
+ api
22
+ }) => {
23
+ const {
24
+ typeAheadState
25
+ } = useSharedPluginState(api, ['typeAhead']);
26
+ return /*#__PURE__*/React.createElement(TaskItem, {
27
+ taskId: localId,
28
+ contentRef: forwardRef,
29
+ isDone: isDone,
30
+ onChange: onChange,
31
+ isFocused: isFocused,
32
+ showPlaceholder: isContentNodeEmpty && !(typeAheadState !== null && typeAheadState !== void 0 && typeAheadState.isOpen),
33
+ providers: providerFactory
34
+ });
35
+ };
10
36
  class Task extends ReactNodeView {
11
37
  constructor(...args) {
12
38
  super(...args);
@@ -73,6 +99,11 @@ class Task extends ReactNodeView {
73
99
  }
74
100
  });
75
101
  }
102
+ initWithAPI(api) {
103
+ this.init();
104
+ this.api = api;
105
+ return this;
106
+ }
76
107
  isContentEmpty(node) {
77
108
  return node.content.childCount === 0;
78
109
  }
@@ -95,6 +126,7 @@ class Task extends ReactNodeView {
95
126
  localId,
96
127
  state
97
128
  } = this.node.attrs;
129
+ const isContentNodeEmpty = this.isContentEmpty(this.node);
98
130
  return /*#__PURE__*/React.createElement(AnalyticsListener, {
99
131
  channel: "fabric-elements",
100
132
  onEvent: this.addListAnalyticsData
@@ -105,14 +137,15 @@ class Task extends ReactNodeView {
105
137
  render: ({
106
138
  taskDecisionPlugin
107
139
  }) => {
108
- return /*#__PURE__*/React.createElement(TaskItem, {
109
- taskId: localId,
110
- contentRef: forwardRef,
140
+ return /*#__PURE__*/React.createElement(TaskItemWrapper, {
141
+ localId: localId,
142
+ forwardRef: forwardRef,
111
143
  isDone: state === 'DONE',
112
144
  onChange: this.handleOnChange,
113
- isFocused: (taskDecisionPlugin === null || taskDecisionPlugin === void 0 ? void 0 : taskDecisionPlugin.focusedTaskItemLocalId) === localId,
114
- showPlaceholder: this.isContentEmpty(this.node) && !isTypeAheadOpen(this.view.state),
115
- providers: props.providerFactory
145
+ isFocused: Boolean((taskDecisionPlugin === null || taskDecisionPlugin === void 0 ? void 0 : taskDecisionPlugin.focusedTaskItemLocalId) === localId),
146
+ isContentNodeEmpty: isContentNodeEmpty,
147
+ providerFactory: props.providerFactory,
148
+ api: this.api
116
149
  });
117
150
  }
118
151
  }));
@@ -131,11 +164,11 @@ class Task extends ReactNodeView {
131
164
  !this.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state));
132
165
  }
133
166
  }
134
- export function taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory) {
167
+ export function taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory, api) {
135
168
  return (node, view, getPos) => {
136
169
  const hasIntlContext = true;
137
170
  return new Task(node, view, getPos, portalProviderAPI, eventDispatcher, {
138
171
  providerFactory
139
- }, undefined, undefined, undefined, hasIntlContext).init();
172
+ }, undefined, undefined, undefined, hasIntlContext).initWithAPI(api);
140
173
  };
141
174
  }