@atlaskit/editor-core 187.31.7 → 187.32.1

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 (210) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -1
  3. package/dist/cjs/plugins/analytics/plugin.js +14 -12
  4. package/dist/cjs/plugins/annotation/index.js +15 -13
  5. package/dist/cjs/plugins/avatar-group/index.js +16 -14
  6. package/dist/cjs/plugins/base/plugin.js +12 -10
  7. package/dist/cjs/plugins/before-primaryToolbar/index.js +3 -2
  8. package/dist/cjs/plugins/block-type/index.js +32 -30
  9. package/dist/cjs/plugins/breakout/index.js +10 -8
  10. package/dist/cjs/plugins/caption/index.js +7 -6
  11. package/dist/cjs/plugins/caption/pm-plugins/main.js +2 -2
  12. package/dist/cjs/plugins/code-bidi-warning/index.js +2 -4
  13. package/dist/cjs/plugins/code-block/index.js +14 -11
  14. package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +2 -2
  15. package/dist/cjs/plugins/collab-edit/index.js +16 -14
  16. package/dist/cjs/plugins/collab-edit/plugin.js +5 -5
  17. package/dist/cjs/plugins/date/index.js +18 -17
  18. package/dist/cjs/plugins/emoji/index.js +35 -33
  19. package/dist/cjs/plugins/expand/index.js +14 -13
  20. package/dist/cjs/plugins/extension/index.js +16 -15
  21. package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
  22. package/dist/cjs/plugins/feedback-dialog/index.js +5 -4
  23. package/dist/cjs/plugins/find-replace/index.js +17 -15
  24. package/dist/cjs/plugins/floating-toolbar/index.js +31 -30
  25. package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +29 -24
  26. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -5
  27. package/dist/cjs/plugins/help-dialog/index.js +18 -17
  28. package/dist/cjs/plugins/insert-block/index.js +52 -51
  29. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
  30. package/dist/cjs/plugins/layout/index.js +15 -14
  31. package/dist/cjs/plugins/max-content-size/index.js +4 -3
  32. package/dist/cjs/plugins/media/index.js +49 -47
  33. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
  34. package/dist/cjs/plugins/media/pm-plugins/main.js +7 -7
  35. package/dist/cjs/plugins/media/toolbar/index.js +29 -24
  36. package/dist/cjs/plugins/media/toolbar/linking.js +4 -4
  37. package/dist/cjs/plugins/media/toolbar/utils.js +22 -2
  38. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
  39. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
  40. package/dist/cjs/plugins/media/utils/media-single.js +19 -4
  41. package/dist/cjs/plugins/mentions/index.js +17 -15
  42. package/dist/cjs/plugins/panel/index.js +13 -12
  43. package/dist/cjs/plugins/paste/index.js +13 -10
  44. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +8 -8
  45. package/dist/cjs/plugins/paste/pm-plugins/main.js +10 -10
  46. package/dist/cjs/plugins/placeholder/index.js +9 -7
  47. package/dist/cjs/plugins/placeholder-text/index.js +23 -16
  48. package/dist/cjs/plugins/quick-insert/index.js +13 -12
  49. package/dist/cjs/plugins/rule/index.js +8 -7
  50. package/dist/cjs/plugins/save-on-enter/index.js +4 -3
  51. package/dist/cjs/plugins/selection/index.js +5 -4
  52. package/dist/cjs/plugins/status/index.js +20 -14
  53. package/dist/cjs/plugins/submit-editor/index.js +4 -3
  54. package/dist/cjs/plugins/tasks-and-decisions/index.js +6 -5
  55. package/dist/cjs/plugins/text-color/index.js +17 -15
  56. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +31 -26
  57. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
  58. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
  59. package/dist/cjs/plugins/type-ahead/index.js +21 -20
  60. package/dist/cjs/ui/ElementBrowser/InsertMenu.js +11 -11
  61. package/dist/cjs/ui/ToolbarFeedback/index.js +1 -1
  62. package/dist/cjs/use-preset.js +2 -2
  63. package/dist/cjs/version-wrapper.js +1 -1
  64. package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -1
  65. package/dist/es2019/plugins/analytics/plugin.js +11 -8
  66. package/dist/es2019/plugins/annotation/index.js +4 -1
  67. package/dist/es2019/plugins/avatar-group/index.js +8 -5
  68. package/dist/es2019/plugins/base/plugin.js +6 -3
  69. package/dist/es2019/plugins/before-primaryToolbar/index.js +4 -2
  70. package/dist/es2019/plugins/block-type/index.js +14 -11
  71. package/dist/es2019/plugins/breakout/index.js +6 -3
  72. package/dist/es2019/plugins/caption/index.js +3 -1
  73. package/dist/es2019/plugins/caption/pm-plugins/main.js +2 -2
  74. package/dist/es2019/plugins/code-bidi-warning/index.js +2 -4
  75. package/dist/es2019/plugins/code-block/index.js +15 -9
  76. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +2 -2
  77. package/dist/es2019/plugins/collab-edit/index.js +9 -6
  78. package/dist/es2019/plugins/collab-edit/plugin.js +5 -5
  79. package/dist/es2019/plugins/date/index.js +6 -3
  80. package/dist/es2019/plugins/emoji/index.js +16 -13
  81. package/dist/es2019/plugins/expand/index.js +7 -4
  82. package/dist/es2019/plugins/extension/index.js +11 -8
  83. package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
  84. package/dist/es2019/plugins/feedback-dialog/index.js +4 -2
  85. package/dist/es2019/plugins/find-replace/index.js +8 -5
  86. package/dist/es2019/plugins/floating-toolbar/index.js +6 -4
  87. package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +9 -4
  88. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +4 -4
  89. package/dist/es2019/plugins/help-dialog/index.js +9 -6
  90. package/dist/es2019/plugins/insert-block/index.js +12 -9
  91. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
  92. package/dist/es2019/plugins/layout/index.js +8 -5
  93. package/dist/es2019/plugins/max-content-size/index.js +3 -1
  94. package/dist/es2019/plugins/media/index.js +14 -10
  95. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -2
  96. package/dist/es2019/plugins/media/pm-plugins/main.js +7 -7
  97. package/dist/es2019/plugins/media/toolbar/index.js +29 -25
  98. package/dist/es2019/plugins/media/toolbar/linking.js +4 -4
  99. package/dist/es2019/plugins/media/toolbar/utils.js +18 -0
  100. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
  101. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
  102. package/dist/es2019/plugins/media/utils/media-single.js +22 -4
  103. package/dist/es2019/plugins/mentions/index.js +9 -6
  104. package/dist/es2019/plugins/panel/index.js +5 -2
  105. package/dist/es2019/plugins/paste/index.js +9 -5
  106. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +8 -8
  107. package/dist/es2019/plugins/paste/pm-plugins/main.js +10 -10
  108. package/dist/es2019/plugins/placeholder/index.js +10 -7
  109. package/dist/es2019/plugins/placeholder-text/index.js +12 -4
  110. package/dist/es2019/plugins/quick-insert/index.js +3 -1
  111. package/dist/es2019/plugins/rule/index.js +5 -3
  112. package/dist/es2019/plugins/save-on-enter/index.js +3 -1
  113. package/dist/es2019/plugins/selection/index.js +3 -1
  114. package/dist/es2019/plugins/status/index.js +11 -3
  115. package/dist/es2019/plugins/submit-editor/index.js +3 -1
  116. package/dist/es2019/plugins/tasks-and-decisions/index.js +6 -4
  117. package/dist/es2019/plugins/text-color/index.js +6 -3
  118. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +9 -5
  119. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
  120. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
  121. package/dist/es2019/plugins/type-ahead/index.js +3 -1
  122. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +11 -11
  123. package/dist/es2019/ui/ToolbarFeedback/index.js +1 -1
  124. package/dist/es2019/use-preset.js +2 -2
  125. package/dist/es2019/version-wrapper.js +1 -1
  126. package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -1
  127. package/dist/esm/plugins/analytics/plugin.js +14 -12
  128. package/dist/esm/plugins/annotation/index.js +15 -13
  129. package/dist/esm/plugins/avatar-group/index.js +16 -14
  130. package/dist/esm/plugins/base/plugin.js +12 -10
  131. package/dist/esm/plugins/before-primaryToolbar/index.js +3 -2
  132. package/dist/esm/plugins/block-type/index.js +32 -30
  133. package/dist/esm/plugins/breakout/index.js +10 -8
  134. package/dist/esm/plugins/caption/index.js +7 -6
  135. package/dist/esm/plugins/caption/pm-plugins/main.js +2 -2
  136. package/dist/esm/plugins/code-bidi-warning/index.js +2 -4
  137. package/dist/esm/plugins/code-block/index.js +14 -11
  138. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +2 -2
  139. package/dist/esm/plugins/collab-edit/index.js +16 -14
  140. package/dist/esm/plugins/collab-edit/plugin.js +5 -5
  141. package/dist/esm/plugins/date/index.js +18 -17
  142. package/dist/esm/plugins/emoji/index.js +35 -33
  143. package/dist/esm/plugins/expand/index.js +14 -13
  144. package/dist/esm/plugins/extension/index.js +16 -15
  145. package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
  146. package/dist/esm/plugins/feedback-dialog/index.js +5 -4
  147. package/dist/esm/plugins/find-replace/index.js +17 -15
  148. package/dist/esm/plugins/floating-toolbar/index.js +31 -30
  149. package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +28 -23
  150. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +4 -4
  151. package/dist/esm/plugins/help-dialog/index.js +18 -17
  152. package/dist/esm/plugins/insert-block/index.js +52 -51
  153. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
  154. package/dist/esm/plugins/layout/index.js +15 -14
  155. package/dist/esm/plugins/max-content-size/index.js +4 -3
  156. package/dist/esm/plugins/media/index.js +49 -47
  157. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +2 -2
  158. package/dist/esm/plugins/media/pm-plugins/main.js +7 -7
  159. package/dist/esm/plugins/media/toolbar/index.js +30 -25
  160. package/dist/esm/plugins/media/toolbar/linking.js +4 -4
  161. package/dist/esm/plugins/media/toolbar/utils.js +19 -0
  162. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
  163. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
  164. package/dist/esm/plugins/media/utils/media-single.js +19 -4
  165. package/dist/esm/plugins/mentions/index.js +17 -15
  166. package/dist/esm/plugins/panel/index.js +13 -12
  167. package/dist/esm/plugins/paste/index.js +13 -10
  168. package/dist/esm/plugins/paste/pm-plugins/analytics.js +8 -8
  169. package/dist/esm/plugins/paste/pm-plugins/main.js +10 -10
  170. package/dist/esm/plugins/placeholder/index.js +9 -7
  171. package/dist/esm/plugins/placeholder-text/index.js +23 -16
  172. package/dist/esm/plugins/quick-insert/index.js +13 -12
  173. package/dist/esm/plugins/rule/index.js +8 -7
  174. package/dist/esm/plugins/save-on-enter/index.js +4 -3
  175. package/dist/esm/plugins/selection/index.js +5 -4
  176. package/dist/esm/plugins/status/index.js +20 -14
  177. package/dist/esm/plugins/submit-editor/index.js +4 -3
  178. package/dist/esm/plugins/tasks-and-decisions/index.js +6 -5
  179. package/dist/esm/plugins/text-color/index.js +17 -15
  180. package/dist/esm/plugins/toolbar-lists-indentation/index.js +31 -26
  181. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
  182. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
  183. package/dist/esm/plugins/type-ahead/index.js +21 -20
  184. package/dist/esm/ui/ElementBrowser/InsertMenu.js +11 -11
  185. package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
  186. package/dist/esm/use-preset.js +2 -2
  187. package/dist/esm/version-wrapper.js +1 -1
  188. package/dist/types/labs/next/presets/default.d.ts +62 -618
  189. package/dist/types/plugins/avatar-group/index.d.ts +1 -1
  190. package/dist/types/plugins/before-primaryToolbar/index.d.ts +1 -1
  191. package/dist/types/plugins/caption/index.d.ts +1 -1
  192. package/dist/types/plugins/floating-toolbar/ui/ScrollButtons.d.ts +3 -3
  193. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -2
  194. package/dist/types/plugins/media/toolbar/utils.d.ts +2 -1
  195. package/dist/types/plugins/media/types.d.ts +1 -0
  196. package/dist/types/plugins/selection/index.d.ts +2 -2
  197. package/dist/types/plugins/text-color/index.d.ts +3 -2
  198. package/dist/types/use-preset.d.ts +2 -2
  199. package/dist/types-ts4.5/labs/next/presets/default.d.ts +96 -716
  200. package/dist/types-ts4.5/plugins/avatar-group/index.d.ts +1 -1
  201. package/dist/types-ts4.5/plugins/before-primaryToolbar/index.d.ts +1 -1
  202. package/dist/types-ts4.5/plugins/caption/index.d.ts +1 -1
  203. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ScrollButtons.d.ts +3 -3
  204. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -2
  205. package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +2 -1
  206. package/dist/types-ts4.5/plugins/media/types.d.ts +1 -0
  207. package/dist/types-ts4.5/plugins/selection/index.d.ts +2 -2
  208. package/dist/types-ts4.5/plugins/text-color/index.d.ts +3 -2
  209. package/dist/types-ts4.5/use-preset.d.ts +2 -2
  210. package/package.json +3 -3
@@ -18,12 +18,14 @@ var getSharedState = function getSharedState(editorState) {
18
18
  }
19
19
  return mentionPluginKey.getState(editorState);
20
20
  };
21
- var mentionsPlugin = function mentionsPlugin(options, api) {
21
+ var mentionsPlugin = function mentionsPlugin(_ref) {
22
+ var options = _ref.config,
23
+ api = _ref.api;
22
24
  var sessionId = uuid();
23
25
  var fireEvent = function fireEvent(payload) {
24
- var _api$dependencies$ana, _api$dependencies$ana2;
25
- var _ref = (_api$dependencies$ana = api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.sharedState.currentState()) !== null && _api$dependencies$ana !== void 0 ? _api$dependencies$ana : {},
26
- createAnalyticsEvent = _ref.createAnalyticsEvent;
26
+ var _api$analytics$shared, _api$analytics;
27
+ var _ref2 = (_api$analytics$shared = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.sharedState.currentState()) !== null && _api$analytics$shared !== void 0 ? _api$analytics$shared : {},
28
+ createAnalyticsEvent = _ref2.createAnalyticsEvent;
27
29
  if (!createAnalyticsEvent) {
28
30
  return;
29
31
  }
@@ -54,17 +56,17 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
54
56
  }
55
57
  }];
56
58
  },
57
- secondaryToolbarComponent: function secondaryToolbarComponent(_ref2) {
58
- var editorView = _ref2.editorView,
59
- disabled = _ref2.disabled;
59
+ secondaryToolbarComponent: function secondaryToolbarComponent(_ref3) {
60
+ var editorView = _ref3.editorView,
61
+ disabled = _ref3.disabled;
60
62
  return /*#__PURE__*/React.createElement(WithPluginState, {
61
63
  editorView: editorView,
62
64
  plugins: {
63
65
  mentionState: mentionPluginKey
64
66
  },
65
- render: function render(_ref3) {
66
- var _ref3$mentionState = _ref3.mentionState,
67
- mentionState = _ref3$mentionState === void 0 ? {} : _ref3$mentionState;
67
+ render: function render(_ref4) {
68
+ var _ref4$mentionState = _ref4.mentionState,
69
+ mentionState = _ref4$mentionState === void 0 ? {} : _ref4$mentionState;
68
70
  return !mentionState.mentionProvider ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
69
71
  editorView: editorView,
70
72
  isDisabled: disabled || isTypeAheadAllowed(editorView.state)
@@ -74,8 +76,8 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
74
76
  },
75
77
  getSharedState: getSharedState,
76
78
  pluginsOptions: {
77
- quickInsert: function quickInsert(_ref4) {
78
- var formatMessage = _ref4.formatMessage;
79
+ quickInsert: function quickInsert(_ref5) {
80
+ var formatMessage = _ref5.formatMessage;
79
81
  return [{
80
82
  id: 'mention',
81
83
  title: formatMessage(messages.mention),
@@ -87,19 +89,19 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
87
89
  return /*#__PURE__*/React.createElement(IconMention, null);
88
90
  },
89
91
  action: function action(insert, state) {
90
- var _api$dependencies$ana3;
92
+ var _api$analytics2;
91
93
  var tr = insert(undefined);
92
94
  var pluginState = getSharedState(state);
93
95
  if (pluginState && pluginState.canInsertMention === false) {
94
96
  return false;
95
97
  }
96
- api === null || api === void 0 ? void 0 : api.dependencies.typeAhead.commands.openTypeAheadAtCursor({
98
+ api === null || api === void 0 ? void 0 : api.typeAhead.commands.openTypeAheadAtCursor({
97
99
  triggerHandler: typeAhead,
98
100
  inputMethod: INPUT_METHOD.QUICK_INSERT
99
101
  })({
100
102
  tr: tr
101
103
  });
102
- api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions.attachAnalyticsEvent({
104
+ api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
103
105
  action: ACTION.INVOKED,
104
106
  actionSubject: ACTION_SUBJECT.TYPEAHEAD,
105
107
  actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_MENTION,
@@ -12,9 +12,10 @@ import { T50 } from '@atlaskit/theme/colors';
12
12
  // Insertions via the drop down menu
13
13
  // tslint-ignore-next-line
14
14
  import { createWrapSelectionTransaction } from '../block-type/commands/block-type';
15
- var panelPlugin = function panelPlugin() {
16
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
- var api = arguments.length > 1 ? arguments[1] : undefined;
15
+ var panelPlugin = function panelPlugin(_ref) {
16
+ var _ref$config = _ref.config,
17
+ options = _ref$config === void 0 ? {} : _ref$config,
18
+ api = _ref.api;
18
19
  return {
19
20
  name: 'panel',
20
21
  nodes: function nodes() {
@@ -27,9 +28,9 @@ var panelPlugin = function panelPlugin() {
27
28
  pmPlugins: function pmPlugins() {
28
29
  return [{
29
30
  name: 'panel',
30
- plugin: function plugin(_ref) {
31
- var providerFactory = _ref.providerFactory,
32
- dispatch = _ref.dispatch;
31
+ plugin: function plugin(_ref2) {
32
+ var providerFactory = _ref2.providerFactory,
33
+ dispatch = _ref2.dispatch;
33
34
  return createPlugin(dispatch, providerFactory, options);
34
35
  }
35
36
  }, {
@@ -40,8 +41,8 @@ var panelPlugin = function panelPlugin() {
40
41
  }];
41
42
  },
42
43
  pluginsOptions: {
43
- quickInsert: function quickInsert(_ref2) {
44
- var formatMessage = _ref2.formatMessage;
44
+ quickInsert: function quickInsert(_ref3) {
45
+ var formatMessage = _ref3.formatMessage;
45
46
  var quickInsertOptions = [{
46
47
  id: 'infopanel',
47
48
  title: formatMessage(messages.infoPanel),
@@ -153,7 +154,7 @@ var panelPlugin = function panelPlugin() {
153
154
  return quickInsertOptions;
154
155
  },
155
156
  floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
156
- return getToolbarConfig(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
157
+ return getToolbarConfig(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration);
157
158
  }
158
159
  }
159
160
  };
@@ -171,9 +172,9 @@ var panelPlugin = function panelPlugin() {
171
172
  * applyTransaction(tr);
172
173
  * }
173
174
  */
174
- function createPanelAction(_ref3) {
175
- var state = _ref3.state,
176
- attributes = _ref3.attributes;
175
+ function createPanelAction(_ref4) {
176
+ var state = _ref4.state,
177
+ attributes = _ref4.attributes;
177
178
  var tr = createWrapSelectionTransaction({
178
179
  state: state,
179
180
  type: state.schema.nodes.panel,
@@ -1,19 +1,22 @@
1
1
  import { createPlugin } from './pm-plugins/main';
2
- var pastePlugin = function pastePlugin(_ref, api) {
3
- var _api$dependencies, _api$dependencies$fea;
4
- var cardOptions = _ref.cardOptions,
5
- sanitizePrivateContent = _ref.sanitizePrivateContent;
6
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
2
+ var pastePlugin = function pastePlugin(_ref) {
3
+ var _api$featureFlags;
4
+ var config = _ref.config,
5
+ api = _ref.api;
6
+ var _ref2 = config !== null && config !== void 0 ? config : {},
7
+ cardOptions = _ref2.cardOptions,
8
+ sanitizePrivateContent = _ref2.sanitizePrivateContent;
9
+ var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
7
10
  return {
8
11
  name: 'paste',
9
12
  pmPlugins: function pmPlugins() {
10
13
  return [{
11
14
  name: 'paste',
12
- plugin: function plugin(_ref2) {
13
- var schema = _ref2.schema,
14
- providerFactory = _ref2.providerFactory,
15
- dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
16
- dispatch = _ref2.dispatch;
15
+ plugin: function plugin(_ref3) {
16
+ var schema = _ref3.schema,
17
+ providerFactory = _ref3.providerFactory,
18
+ dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
19
+ dispatch = _ref3.dispatch;
17
20
  return createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, cardOptions, sanitizePrivateContent, providerFactory);
18
21
  }
19
22
  }];
@@ -224,10 +224,10 @@ export var handlePasteAsPlainTextWithAnalytics = function handlePasteAsPlainText
224
224
  }))(handlePasteAsPlainText(slice, event));
225
225
  };
226
226
  export var handlePasteIntoTaskAndDecisionWithAnalytics = function handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, type, pluginInjectionApi) {
227
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
227
+ var _pluginInjectionApi$c, _pluginInjectionApi$c2;
228
228
  return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
229
229
  type: type
230
- }))(handlePasteIntoTaskOrDecisionOrPanel(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.actions) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.queueCardsFromChangedTr));
230
+ }))(handlePasteIntoTaskOrDecisionOrPanel(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr));
231
231
  };
232
232
  export var handlePasteIntoCaptionWithAnalytics = function handlePasteIntoCaptionWithAnalytics(view, event, slice, type) {
233
233
  return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
@@ -245,22 +245,22 @@ export var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalyt
245
245
  }))(handleMediaSingle(INPUT_METHOD.CLIPBOARD, editorAnalyticsAPI)(slice));
246
246
  };
247
247
  export var handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi) {
248
- var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
248
+ var _pluginInjectionApi$c3, _pluginInjectionApi$c4;
249
249
  return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
250
250
  type: type
251
- }))(handlePastePreservingMarks(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.actions) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.queueCardsFromChangedTr));
251
+ }))(handlePastePreservingMarks(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : (_pluginInjectionApi$c4 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.queueCardsFromChangedTr));
252
252
  };
253
253
  export var handleMarkdownWithAnalytics = function handleMarkdownWithAnalytics(view, event, slice, pluginInjectionApi) {
254
- var _pluginInjectionApi$d5, _pluginInjectionApi$d6;
254
+ var _pluginInjectionApi$c5, _pluginInjectionApi$c6;
255
255
  return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
256
256
  type: PasteTypes.markdown
257
- }))(handleMarkdown(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : (_pluginInjectionApi$d6 = _pluginInjectionApi$d5.actions) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.queueCardsFromChangedTr));
257
+ }))(handleMarkdown(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.card) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : (_pluginInjectionApi$c6 = _pluginInjectionApi$c5.actions) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.queueCardsFromChangedTr));
258
258
  };
259
259
  export var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, event, slice, pluginInjectionApi) {
260
- var _pluginInjectionApi$d7, _pluginInjectionApi$d8;
260
+ var _pluginInjectionApi$c7, _pluginInjectionApi$c8;
261
261
  return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
262
262
  type: PasteTypes.richText
263
- }))(handleRichText(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : (_pluginInjectionApi$d8 = _pluginInjectionApi$d7.actions) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.queueCardsFromChangedTr));
263
+ }))(handleRichText(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c7 = pluginInjectionApi.card) === null || _pluginInjectionApi$c7 === void 0 ? void 0 : (_pluginInjectionApi$c8 = _pluginInjectionApi$c7.actions) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : _pluginInjectionApi$c8.queueCardsFromChangedTr));
264
264
  };
265
265
  function injectAnalyticsPayloadBeforeCommand(createPayloadByTransaction) {
266
266
  return function (mainCommand) {
@@ -102,7 +102,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
102
102
  }
103
103
  },
104
104
  handlePaste: function handlePaste(view, rawEvent, slice) {
105
- var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$d4, _pluginInjectionApi$d5;
105
+ var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$a;
106
106
  var event = rawEvent;
107
107
  if (!event.clipboardData) {
108
108
  return false;
@@ -197,9 +197,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
197
197
  });
198
198
  return tableExists;
199
199
  });
200
- if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns && pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.dependencies.betterTypeHistory) {
201
- var _pluginInjectionApi$d;
202
- tr = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.betterTypeHistory) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.flagPasteEvent(tr);
200
+ if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns && pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.betterTypeHistory) {
201
+ var _pluginInjectionApi$b;
202
+ tr = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$b = pluginInjectionApi.betterTypeHistory) === null || _pluginInjectionApi$b === void 0 ? void 0 : _pluginInjectionApi$b.actions.flagPasteEvent(tr);
203
203
  }
204
204
  addLinkMetadata(view.state.selection, tr, {
205
205
  action: isPlainText ? ACTION.PASTED_AS_PLAIN : ACTION.PASTED,
@@ -227,14 +227,14 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
227
227
  // force a "paste as plain text" action by clearing the markdownSlice.
228
228
  markdownSlice = !((_markdownSlice = markdownSlice) !== null && _markdownSlice !== void 0 && _markdownSlice.size) ? undefined : markdownSlice;
229
229
  if (markdownSlice) {
230
- var _pluginInjectionApi$d2, _pluginInjectionApi$d3;
230
+ var _pluginInjectionApi$c, _pluginInjectionApi$c2;
231
231
  // linkify text prior to converting to macro
232
232
  if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, markdownSlice, PasteTypes.markdown)(state, dispatch)) {
233
233
  return true;
234
234
  }
235
235
 
236
236
  // run macro autoconvert prior to other conversions
237
- if (handleMacroAutoConvert(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.actions) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
237
+ if (handleMacroAutoConvert(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
238
238
  // TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
239
239
  sendPasteAnalyticsEvent(view, event, markdownSlice, {
240
240
  type: PasteTypes.markdown
@@ -266,7 +266,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
266
266
  if (handleCodeBlockWithAnalytics(view, event, slice, text)(state, dispatch)) {
267
267
  return true;
268
268
  }
269
- if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.analytics) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions)(state, dispatch, view)) {
269
+ if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch, view)) {
270
270
  return true;
271
271
  }
272
272
  if (handleSelectedTableWithAnalytics(view, event, slice)(state, dispatch)) {
@@ -299,7 +299,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
299
299
 
300
300
  // finally, handle rich-text copy-paste
301
301
  if (isRichText) {
302
- var _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
302
+ var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$l;
303
303
  // linkify the text where possible
304
304
  slice = linkifyContent(state.schema)(slice);
305
305
  if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
@@ -307,7 +307,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
307
307
  }
308
308
 
309
309
  // run macro autoconvert prior to other conversions
310
- if (handleMacroAutoConvert(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : (_pluginInjectionApi$d7 = _pluginInjectionApi$d6.actions) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
310
+ if (handleMacroAutoConvert(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : (_pluginInjectionApi$c4 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
311
311
  // TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
312
312
  sendPasteAnalyticsEvent(view, event, slice, {
313
313
  type: PasteTypes.richText
@@ -364,7 +364,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
364
364
  if (handlePasteIntoCaptionWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
365
365
  return true;
366
366
  }
367
- if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d8 = pluginInjectionApi.dependencies.list) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.actions.findRootParentListNode)(state, dispatch)) {
367
+ if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
368
368
  return true;
369
369
  }
370
370
  if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
@@ -73,13 +73,13 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
73
73
  key: pluginKey,
74
74
  state: {
75
75
  init: function init(_, state) {
76
- var _api$dependencies$foc, _api$dependencies$foc2;
77
- return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$dependencies$foc = api.dependencies.focus) === null || _api$dependencies$foc === void 0 ? void 0 : (_api$dependencies$foc2 = _api$dependencies$foc.sharedState.currentState()) === null || _api$dependencies$foc2 === void 0 ? void 0 : _api$dependencies$foc2.hasFocus), state, defaultPlaceholderText, bracketPlaceholderText);
76
+ var _api$focus, _api$focus$sharedStat;
77
+ return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$focus = api.focus) === null || _api$focus === void 0 ? void 0 : (_api$focus$sharedStat = _api$focus.sharedState.currentState()) === null || _api$focus$sharedStat === void 0 ? void 0 : _api$focus$sharedStat.hasFocus), state, defaultPlaceholderText, bracketPlaceholderText);
78
78
  },
79
79
  apply: function apply(tr, _oldPluginState, _oldEditorState, newEditorState) {
80
- var _api$dependencies$foc3, _api$dependencies$foc4;
80
+ var _api$focus2, _api$focus2$sharedSta;
81
81
  var meta = tr.getMeta(pluginKey);
82
- var isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$dependencies$foc3 = api.dependencies.focus) === null || _api$dependencies$foc3 === void 0 ? void 0 : (_api$dependencies$foc4 = _api$dependencies$foc3.sharedState.currentState()) === null || _api$dependencies$foc4 === void 0 ? void 0 : _api$dependencies$foc4.hasFocus);
82
+ var isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$focus2 = api.focus) === null || _api$focus2 === void 0 ? void 0 : (_api$focus2$sharedSta = _api$focus2.sharedState.currentState()) === null || _api$focus2$sharedSta === void 0 ? void 0 : _api$focus2$sharedSta.hasFocus);
83
83
  if (meta) {
84
84
  if (meta.removePlaceholder) {
85
85
  return emptyPlaceholder;
@@ -93,12 +93,12 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
93
93
  },
94
94
  props: {
95
95
  decorations: function decorations(editorState) {
96
- var _api$dependencies$com;
96
+ var _api$composition;
97
97
  var _getPlaceholderState = getPlaceholderState(editorState),
98
98
  hasPlaceholder = _getPlaceholderState.hasPlaceholder,
99
99
  placeholderText = _getPlaceholderState.placeholderText,
100
100
  pos = _getPlaceholderState.pos;
101
- var compositionPluginState = api === null || api === void 0 ? void 0 : (_api$dependencies$com = api.dependencies.composition) === null || _api$dependencies$com === void 0 ? void 0 : _api$dependencies$com.sharedState.currentState();
101
+ var compositionPluginState = api === null || api === void 0 ? void 0 : (_api$composition = api.composition) === null || _api$composition === void 0 ? void 0 : _api$composition.sharedState.currentState();
102
102
  if (hasPlaceholder && placeholderText && pos !== undefined && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
103
103
  return createPlaceholderDecoration(editorState, placeholderText, pos);
104
104
  }
@@ -107,7 +107,9 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
107
107
  }
108
108
  });
109
109
  }
110
- var placeholderPlugin = function placeholderPlugin(options, api) {
110
+ var placeholderPlugin = function placeholderPlugin(_ref) {
111
+ var options = _ref.config,
112
+ api = _ref.api;
111
113
  return {
112
114
  name: 'placeholder',
113
115
  pmPlugins: function pmPlugins() {
@@ -123,7 +123,8 @@ export function createPlugin(dispatch, options) {
123
123
  }
124
124
  });
125
125
  }
126
- var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(options) {
126
+ var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(_ref) {
127
+ var options = _ref.config;
127
128
  return {
128
129
  name: 'placeholderText',
129
130
  nodes: function nodes() {
@@ -135,16 +136,16 @@ var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(options) {
135
136
  pmPlugins: function pmPlugins() {
136
137
  return [{
137
138
  name: 'placeholderText',
138
- plugin: function plugin(_ref) {
139
- var dispatch = _ref.dispatch;
139
+ plugin: function plugin(_ref2) {
140
+ var dispatch = _ref2.dispatch;
140
141
  return createPlugin(dispatch, options);
141
142
  }
142
143
  }];
143
144
  },
144
- contentComponent: function contentComponent(_ref2) {
145
- var editorView = _ref2.editorView,
146
- popupsMountPoint = _ref2.popupsMountPoint,
147
- popupsBoundariesElement = _ref2.popupsBoundariesElement;
145
+ contentComponent: function contentComponent(_ref3) {
146
+ var editorView = _ref3.editorView,
147
+ popupsMountPoint = _ref3.popupsMountPoint,
148
+ popupsBoundariesElement = _ref3.popupsBoundariesElement;
148
149
  var insertPlaceholderText = function insertPlaceholderText(value) {
149
150
  return insertPlaceholderTextAtSelection(value)(editorView.state, editorView.dispatch);
150
151
  };
@@ -164,9 +165,9 @@ var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(options) {
164
165
  plugins: {
165
166
  placeholderTextState: pluginKey
166
167
  },
167
- render: function render(_ref3) {
168
- var _ref3$placeholderText = _ref3.placeholderTextState,
169
- placeholderTextState = _ref3$placeholderText === void 0 ? {} : _ref3$placeholderText;
168
+ render: function render(_ref4) {
169
+ var _ref4$placeholderText = _ref4.placeholderTextState,
170
+ placeholderTextState = _ref4$placeholderText === void 0 ? {} : _ref4$placeholderText;
170
171
  if (placeholderTextState.showInsertPanelAt) {
171
172
  return /*#__PURE__*/React.createElement(PlaceholderFloatingToolbar, {
172
173
  editorViewDOM: editorView.dom,
@@ -191,8 +192,8 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
191
192
  return plugin;
192
193
  }
193
194
  plugin.pluginsOptions = {
194
- quickInsert: function quickInsert(_ref4) {
195
- var formatMessage = _ref4.formatMessage;
195
+ quickInsert: function quickInsert(_ref5) {
196
+ var formatMessage = _ref5.formatMessage;
196
197
  return [{
197
198
  id: 'placeholderText',
198
199
  title: formatMessage(messages.placeholderText),
@@ -205,12 +206,12 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
205
206
  });
206
207
  },
207
208
  action: function action(insert, state) {
208
- var _api$dependencies$ana;
209
+ var _api$analytics;
209
210
  var tr = state.tr;
210
211
  tr.setMeta(pluginKey, {
211
212
  showInsertPanelAt: tr.selection.anchor
212
213
  });
213
- api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions.attachAnalyticsEvent({
214
+ api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
214
215
  action: ACTION.INSERTED,
215
216
  actionSubject: ACTION_SUBJECT.DOCUMENT,
216
217
  actionSubjectId: ACTION_SUBJECT_ID.PLACEHOLDER_TEXT,
@@ -226,7 +227,13 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
226
227
  };
227
228
  return plugin;
228
229
  };
229
- var placeholderTextPlugin = function placeholderTextPlugin(options, api) {
230
- return decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options, api);
230
+ var placeholderTextPlugin = function placeholderTextPlugin(_ref6) {
231
+ var _ref6$config = _ref6.config,
232
+ options = _ref6$config === void 0 ? {} : _ref6$config,
233
+ api = _ref6.api;
234
+ return decorateWithPluginOptions(basePlaceholderTextPlugin({
235
+ config: options,
236
+ api: api
237
+ }), options, api);
231
238
  };
232
239
  export default placeholderTextPlugin;
@@ -11,17 +11,18 @@ import { search } from './search';
11
11
  import ModalElementBrowser from './ui/ModalElementBrowser';
12
12
  import { openElementBrowserModal, insertItem } from './commands';
13
13
  import { memoProcessQuickInsertItems, getQuickInsertSuggestions } from '@atlaskit/editor-common/quick-insert';
14
- var quickInsertPlugin = function quickInsertPlugin(options) {
14
+ var quickInsertPlugin = function quickInsertPlugin(_ref) {
15
+ var options = _ref.config;
15
16
  return {
16
17
  name: 'quickInsert',
17
18
  pmPlugins: function pmPlugins(defaultItems) {
18
19
  return [{
19
20
  name: 'quickInsert',
20
21
  // It's important that this plugin is above TypeAheadPlugin
21
- plugin: function plugin(_ref) {
22
- var providerFactory = _ref.providerFactory,
23
- getIntl = _ref.getIntl,
24
- dispatch = _ref.dispatch;
22
+ plugin: function plugin(_ref2) {
23
+ var providerFactory = _ref2.providerFactory,
24
+ getIntl = _ref2.getIntl,
25
+ dispatch = _ref2.dispatch;
25
26
  return quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, options === null || options === void 0 ? void 0 : options.emptyStateHandler);
26
27
  }
27
28
  }];
@@ -31,9 +32,9 @@ var quickInsertPlugin = function quickInsertPlugin(options) {
31
32
  id: TypeAheadAvailableNodes.QUICK_INSERT,
32
33
  trigger: '/',
33
34
  headless: options === null || options === void 0 ? void 0 : options.headless,
34
- getItems: function getItems(_ref2) {
35
- var query = _ref2.query,
36
- editorState = _ref2.editorState;
35
+ getItems: function getItems(_ref3) {
36
+ var query = _ref3.query,
37
+ editorState = _ref3.editorState;
37
38
  var quickInsertState = pluginKey.getState(editorState);
38
39
  return Promise.resolve(getQuickInsertSuggestions({
39
40
  searchOptions: {
@@ -49,8 +50,8 @@ var quickInsertPlugin = function quickInsertPlugin(options) {
49
50
  }
50
51
  }
51
52
  },
52
- contentComponent: function contentComponent(_ref3) {
53
- var editorView = _ref3.editorView;
53
+ contentComponent: function contentComponent(_ref4) {
54
+ var editorView = _ref4.editorView;
54
55
  if (options !== null && options !== void 0 && options.enableElementBrowser) {
55
56
  return /*#__PURE__*/React.createElement(ModalElementBrowser, {
56
57
  editorView: editorView,
@@ -134,7 +135,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
134
135
  },
135
136
  view: function view(editorView) {
136
137
  var providerHandler = /*#__PURE__*/function () {
137
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, providerPromise) {
138
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, providerPromise) {
138
139
  var provider, providedItems;
139
140
  return _regeneratorRuntime.wrap(function _callee$(_context) {
140
141
  while (1) switch (_context.prev = _context.next) {
@@ -170,7 +171,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
170
171
  }, _callee, null, [[1, 11]]);
171
172
  }));
172
173
  return function providerHandler(_x, _x2) {
173
- return _ref4.apply(this, arguments);
174
+ return _ref5.apply(this, arguments);
174
175
  };
175
176
  }();
176
177
  providerFactory.subscribe('quickInsertProvider', providerHandler);
@@ -5,9 +5,10 @@ import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
5
5
  import { IconDivider } from '@atlaskit/editor-common/quick-insert';
6
6
  import inputRulePlugin from './pm-plugins/input-rule';
7
7
  import keymapPlugin from './pm-plugins/keymap';
8
- var rulePlugin = function rulePlugin(_, api) {
9
- var _api$dependencies, _api$dependencies$fea;
10
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
8
+ var rulePlugin = function rulePlugin(_ref) {
9
+ var _api$featureFlags;
10
+ var api = _ref.api;
11
+ var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
11
12
  return {
12
13
  name: 'rule',
13
14
  nodes: function nodes() {
@@ -19,8 +20,8 @@ var rulePlugin = function rulePlugin(_, api) {
19
20
  pmPlugins: function pmPlugins() {
20
21
  return [{
21
22
  name: 'ruleInputRule',
22
- plugin: function plugin(_ref) {
23
- var schema = _ref.schema;
23
+ plugin: function plugin(_ref2) {
24
+ var schema = _ref2.schema;
24
25
  return inputRulePlugin(schema, featureFlags);
25
26
  }
26
27
  }, {
@@ -31,8 +32,8 @@ var rulePlugin = function rulePlugin(_, api) {
31
32
  }];
32
33
  },
33
34
  pluginsOptions: {
34
- quickInsert: function quickInsert(_ref2) {
35
- var formatMessage = _ref2.formatMessage;
35
+ quickInsert: function quickInsert(_ref3) {
36
+ var formatMessage = _ref3.formatMessage;
36
37
  return [{
37
38
  id: 'rule',
38
39
  title: formatMessage(messages.horizontalRule),
@@ -45,14 +45,15 @@ var analyticsPayload = function analyticsPayload(state) {
45
45
  }
46
46
  };
47
47
  };
48
- var saveOnEnterPlugin = function saveOnEnterPlugin(onSave) {
48
+ var saveOnEnterPlugin = function saveOnEnterPlugin(_ref2) {
49
+ var onSave = _ref2.config;
49
50
  return {
50
51
  name: 'saveOnEnter',
51
52
  pmPlugins: function pmPlugins() {
52
53
  return [{
53
54
  name: 'saveOnEnter',
54
- plugin: function plugin(_ref2) {
55
- var dispatch = _ref2.dispatch;
55
+ plugin: function plugin(_ref3) {
56
+ var dispatch = _ref3.dispatch;
56
57
  return createPlugin(dispatch, onSave);
57
58
  }
58
59
  }];
@@ -2,15 +2,16 @@ import { createPlugin } from './pm-plugins/selection-main';
2
2
  import selectionKeymapPlugin from './pm-plugins/keymap';
3
3
  import gapCursorPlugin from './pm-plugins/gap-cursor-main';
4
4
  import gapCursorKeymapPlugin from './pm-plugins/gap-cursor-keymap';
5
- export var selectionPlugin = function selectionPlugin(options) {
5
+ export var selectionPlugin = function selectionPlugin(_ref) {
6
+ var options = _ref.config;
6
7
  return {
7
8
  name: 'selection',
8
9
  pmPlugins: function pmPlugins() {
9
10
  return [{
10
11
  name: 'selection',
11
- plugin: function plugin(_ref) {
12
- var dispatch = _ref.dispatch,
13
- dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
12
+ plugin: function plugin(_ref2) {
13
+ var dispatch = _ref2.dispatch,
14
+ dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent;
14
15
  return createPlugin(dispatch, dispatchAnalyticsEvent, options);
15
16
  }
16
17
  }, {