@atlaskit/editor-core 187.16.1 → 187.17.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 (69) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/create-editor/ReactEditorViewInternal.js +5 -1
  3. package/dist/cjs/plugins/base/index.js +0 -8
  4. package/dist/cjs/plugins/better-type-history/index.js +34 -0
  5. package/dist/cjs/plugins/{base/pm-plugins/better-type-history.js → better-type-history/pm-plugins/main.js} +4 -5
  6. package/dist/cjs/plugins/better-type-history/pm-plugins/plugin-key.js +9 -0
  7. package/dist/cjs/plugins/index.js +7 -0
  8. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +34 -42
  9. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
  10. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -14
  11. package/dist/cjs/plugins/paste/pm-plugins/main.js +7 -7
  12. package/dist/cjs/version-wrapper.js +1 -1
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/create-editor/ReactEditorViewInternal.js +3 -1
  15. package/dist/es2019/plugins/base/index.js +0 -7
  16. package/dist/es2019/plugins/better-type-history/index.js +24 -0
  17. package/dist/es2019/plugins/{base/pm-plugins/better-type-history.js → better-type-history/pm-plugins/main.js} +1 -2
  18. package/dist/es2019/plugins/better-type-history/pm-plugins/plugin-key.js +2 -0
  19. package/dist/es2019/plugins/index.js +1 -0
  20. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -11
  21. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -2
  22. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +2 -14
  23. package/dist/es2019/plugins/paste/pm-plugins/main.js +7 -7
  24. package/dist/es2019/version-wrapper.js +1 -1
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/create-editor/ReactEditorViewInternal.js +5 -1
  27. package/dist/esm/plugins/base/index.js +0 -8
  28. package/dist/esm/plugins/better-type-history/index.js +26 -0
  29. package/dist/esm/plugins/{base/pm-plugins/better-type-history.js → better-type-history/pm-plugins/main.js} +1 -2
  30. package/dist/esm/plugins/better-type-history/pm-plugins/plugin-key.js +2 -0
  31. package/dist/esm/plugins/index.js +1 -0
  32. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +34 -42
  33. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +2 -2
  34. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +3 -13
  35. package/dist/esm/plugins/paste/pm-plugins/main.js +7 -7
  36. package/dist/esm/version-wrapper.js +1 -1
  37. package/dist/esm/version.json +1 -1
  38. package/dist/types/create-editor/ReactEditorViewInternal.d.ts +1 -0
  39. package/dist/types/plugins/better-type-history/index.d.ts +13 -0
  40. package/dist/types/plugins/{base/pm-plugins/better-type-history.d.ts → better-type-history/pm-plugins/main.d.ts} +0 -2
  41. package/dist/types/plugins/better-type-history/pm-plugins/plugin-key.d.ts +2 -0
  42. package/dist/types/plugins/index.d.ts +1 -0
  43. package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +2 -7
  44. package/dist/types/plugins/paste/index.d.ts +4 -2
  45. package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +1 -0
  46. package/dist/types-ts4.5/plugins/better-type-history/index.d.ts +13 -0
  47. package/dist/types-ts4.5/plugins/{base/pm-plugins/better-type-history.d.ts → better-type-history/pm-plugins/main.d.ts} +0 -2
  48. package/dist/types-ts4.5/plugins/better-type-history/pm-plugins/plugin-key.d.ts +2 -0
  49. package/dist/types-ts4.5/plugins/index.d.ts +1 -0
  50. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +2 -7
  51. package/dist/types-ts4.5/plugins/paste/index.d.ts +4 -2
  52. package/package.json +4 -4
  53. package/report.api.md +3 -1
  54. package/tmp/api-report-tmp.d.ts +3 -1
  55. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +0 -15
  56. package/dist/cjs/ui/Resizer/ResizeLabel/index.js +0 -20
  57. package/dist/cjs/ui/Resizer/ResizeLabel/styles.js +0 -17
  58. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +0 -8
  59. package/dist/es2019/ui/Resizer/ResizeLabel/index.js +0 -12
  60. package/dist/es2019/ui/Resizer/ResizeLabel/styles.js +0 -25
  61. package/dist/esm/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +0 -8
  62. package/dist/esm/ui/Resizer/ResizeLabel/index.js +0 -12
  63. package/dist/esm/ui/Resizer/ResizeLabel/styles.js +0 -7
  64. package/dist/types/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +0 -7
  65. package/dist/types/ui/Resizer/ResizeLabel/index.d.ts +0 -8
  66. package/dist/types/ui/Resizer/ResizeLabel/styles.d.ts +0 -3
  67. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +0 -7
  68. package/dist/types-ts4.5/ui/Resizer/ResizeLabel/index.d.ts +0 -8
  69. package/dist/types-ts4.5/ui/Resizer/ResizeLabel/styles.d.ts +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.17.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9d2794a7753`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d2794a7753) - Add `executeCommand` to `pluginInjectionAPI` which should be used to dispatch a `PluginCommand` - from the `commands` property of a plugin.
8
+ - Updated dependencies
9
+
10
+ ## 187.17.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`fb3dab2b017`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fb3dab2b017) - Decouple `better-type-history` plugin from `base` plugin
15
+
16
+ ### Patch Changes
17
+
18
+ - [`93a1fd7ce1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/93a1fd7ce1e) - Removed ResizeLabel
19
+
3
20
  ## 187.16.1
4
21
 
5
22
  ### Patch Changes
@@ -110,6 +110,9 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
110
110
  var _this$view;
111
111
  return (_this$view = _this.view) === null || _this$view === void 0 ? void 0 : _this$view.state;
112
112
  });
113
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getEditorView", function () {
114
+ return _this.view;
115
+ });
113
116
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatFullWidthAppearance", function (appearance) {
114
117
  if (appearance === 'full-width') {
115
118
  return _analytics.FULL_WIDTH_MODE.FULL_WIDTH;
@@ -530,7 +533,8 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
530
533
  });
531
534
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "editor", _this.createEditor(_this.props.editorProps.assistiveLabel));
532
535
  _this.pluginInjectionAPI = new _preset.EditorPluginInjectionAPI({
533
- getEditorState: _this.getEditorState
536
+ getEditorState: _this.getEditorState,
537
+ getEditorView: _this.getEditorView
534
538
  });
535
539
  _this.eventDispatcher = new _eventDispatcher.EventDispatcher();
536
540
  _this.dispatch = (0, _eventDispatcher.createDispatch)(_this.eventDispatcher);
@@ -17,7 +17,6 @@ var _disableSpellChecking = _interopRequireDefault(require("./pm-plugins/disable
17
17
  var _contextIdentifier = _interopRequireDefault(require("./pm-plugins/context-identifier"));
18
18
  var _newlinePreserveMarks = _interopRequireDefault(require("./pm-plugins/newline-preserve-marks"));
19
19
  var _inlineCursorTarget = _interopRequireDefault(require("./pm-plugins/inline-cursor-target"));
20
- var _betterTypeHistory = _interopRequireDefault(require("./pm-plugins/better-type-history"));
21
20
  var _scrollGutter = _interopRequireDefault(require("./pm-plugins/scroll-gutter"));
22
21
  var _keymaps = require("@atlaskit/editor-common/keymaps");
23
22
  var _frozenEditor = _interopRequireDefault(require("./pm-plugins/frozen-editor"));
@@ -97,13 +96,6 @@ var basePlugin = function basePlugin(options, api) {
97
96
  providerFactory = _ref4.providerFactory;
98
97
  return (0, _contextIdentifier.default)(dispatch, providerFactory);
99
98
  }
100
- }, {
101
- name: 'betterTypeHistory',
102
- plugin: function plugin(_ref5) {
103
- var dispatch = _ref5.dispatch,
104
- providerFactory = _ref5.providerFactory;
105
- return (0, _betterTypeHistory.default)();
106
- }
107
99
  });
108
100
  if (options && options.allowScrollGutter) {
109
101
  plugins.push({
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _main = _interopRequireDefault(require("./pm-plugins/main"));
9
+ var _pluginKey = require("./pm-plugins/plugin-key");
10
+ /**
11
+ * This plugin is aiming to improve undo behaviour for some of our more custom applications, very specific text
12
+ * paste events, splitting blocks of text, new lines.
13
+ */
14
+ var betterTypeHistory = function betterTypeHistory() {
15
+ return {
16
+ name: 'betterTypeHistory',
17
+ actions: {
18
+ flagPasteEvent: function flagPasteEvent(tr) {
19
+ tr.setMeta(_pluginKey.pluginKey, true);
20
+ return tr;
21
+ }
22
+ },
23
+ pmPlugins: function pmPlugins() {
24
+ return [{
25
+ name: 'betterTypeHistory',
26
+ plugin: function plugin() {
27
+ return (0, _main.default)();
28
+ }
29
+ }];
30
+ }
31
+ };
32
+ };
33
+ var _default = betterTypeHistory;
34
+ exports.default = _default;
@@ -3,13 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.pluginKey = exports.default = void 0;
6
+ exports.default = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _model = require("@atlaskit/editor-prosemirror/model");
10
10
  var _history = require("@atlaskit/editor-prosemirror/history");
11
11
  var _transform = require("@atlaskit/editor-prosemirror/transform");
12
12
  var _step = require("../../../utils/step");
13
+ var _pluginKey = require("./plugin-key");
13
14
  var getEnterKeyboardActionStep = function getEnterKeyboardActionStep(trs) {
14
15
  var firstTr = trs.length === 1 && trs[0];
15
16
  if (!firstTr || !firstTr.docChanged || !firstTr.isGeneric || !(firstTr.selection instanceof _state.TextSelection)) {
@@ -38,14 +39,12 @@ var isSliceAddingNewlineChar = function isSliceAddingNewlineChar(slice, schema)
38
39
  var newLine = _model.Fragment.from(schema.text('\n'));
39
40
  return slice.content.eq(newLine);
40
41
  };
41
- var pluginKey = new _state.PluginKey('betterTypeHistoryPlugin');
42
- exports.pluginKey = pluginKey;
43
42
  var _default = function _default() {
44
43
  return new _safePlugin.SafePlugin({
45
- key: pluginKey,
44
+ key: _pluginKey.pluginKey,
46
45
  appendTransaction: function appendTransaction(transactions, oldState, newState) {
47
46
  var hasHandlePasteMeta = transactions.find(function (tran) {
48
- return tran.getMeta(pluginKey);
47
+ return tran.getMeta(_pluginKey.pluginKey);
49
48
  });
50
49
  if (hasHandlePasteMeta) {
51
50
  return (0, _history.closeHistory)(newState.tr);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pluginKey = void 0;
7
+ var _state = require("@atlaskit/editor-prosemirror/state");
8
+ var pluginKey = new _state.PluginKey('betterTypeHistoryPlugin');
9
+ exports.pluginKey = pluginKey;
@@ -41,6 +41,12 @@ Object.defineProperty(exports, "beforePrimaryToolbarPlugin", {
41
41
  return _beforePrimaryToolbar.default;
42
42
  }
43
43
  });
44
+ Object.defineProperty(exports, "betterTypeHistoryPlugin", {
45
+ enumerable: true,
46
+ get: function get() {
47
+ return _betterTypeHistory.default;
48
+ }
49
+ });
44
50
  Object.defineProperty(exports, "blockPluginStateKey", {
45
51
  enumerable: true,
46
52
  get: function get() {
@@ -379,6 +385,7 @@ Object.defineProperty(exports, "viewUpdateSubscriptionPlugin", {
379
385
  });
380
386
  var _base = _interopRequireDefault(require("./base"));
381
387
  var _blockType = _interopRequireWildcard(require("./block-type"));
388
+ var _betterTypeHistory = _interopRequireDefault(require("./better-type-history"));
382
389
  var _clearMarksOnChangeToEmptyDocument = _interopRequireDefault(require("./clear-marks-on-change-to-empty-document"));
383
390
  var _codeBlock = _interopRequireDefault(require("./code-block"));
384
391
  var _collabEdit = _interopRequireDefault(require("./collab-edit"));
@@ -19,7 +19,6 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
19
19
  var _reactIntlNext = require("react-intl-next");
20
20
  var _picker = require("@atlaskit/emoji/picker");
21
21
  var _ui = require("@atlaskit/editor-common/ui");
22
- var _preset = require("@atlaskit/editor-common/preset");
23
22
  var _ToolbarButton = _interopRequireDefault(require("../../../../ui/ToolbarButton"));
24
23
  var _styles = require("@atlaskit/editor-common/styles");
25
24
  var _actions = require("../../../date/actions");
@@ -172,22 +171,15 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
172
171
  }
173
172
  });
174
173
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleLinkPanel", function (inputMethod) {
175
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
176
- var _this$props = _this.props,
177
- editorView = _this$props.editorView,
178
- pluginInjectionApi = _this$props.pluginInjectionApi;
179
- var state = editorView.state,
180
- dispatch = editorView.dispatch;
181
-
182
- // We should update this to use `pluginInjectionApi.executeCommand` once available
183
- (0, _preset.pluginCommandToPMCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.hyperlink) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.commands.showLinkToolbar(inputMethod))(state, dispatch);
184
- return true;
174
+ var _pluginInjectionApi$e, _pluginInjectionApi$d, _pluginInjectionApi$d2;
175
+ var pluginInjectionApi = _this.props.pluginInjectionApi;
176
+ return (_pluginInjectionApi$e = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.executeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.hyperlink) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$e !== void 0 ? _pluginInjectionApi$e : false;
185
177
  });
186
178
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertMention", function (inputMethod) {
187
179
  var _pluginInjectionApi$d3;
188
- var _this$props2 = _this.props,
189
- editorView = _this$props2.editorView,
190
- pluginInjectionApi = _this$props2.pluginInjectionApi;
180
+ var _this$props = _this.props,
181
+ editorView = _this$props.editorView,
182
+ pluginInjectionApi = _this$props.pluginInjectionApi;
191
183
  if (!editorView) {
192
184
  return true;
193
185
  }
@@ -200,9 +192,9 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
200
192
  });
201
193
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertTable", function (inputMethod) {
202
194
  var _pluginInjectionApi$d4, _pluginInjectionApi$d5, _pluginInjectionApi$d6, _pluginInjectionApi$d7;
203
- var _this$props3 = _this.props,
204
- pluginInjectionApi = _this$props3.pluginInjectionApi,
205
- editorView = _this$props3.editorView;
195
+ var _this$props2 = _this.props,
196
+ pluginInjectionApi = _this$props2.pluginInjectionApi,
197
+ editorView = _this$props2.editorView;
206
198
  var state = editorView.state,
207
199
  dispatch = editorView.dispatch;
208
200
  return (_pluginInjectionApi$d4 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies.table) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : (_pluginInjectionApi$d6 = (_pluginInjectionApi$d7 = _pluginInjectionApi$d5.actions).insertTable) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.call(_pluginInjectionApi$d7, {
@@ -236,9 +228,9 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
236
228
  return true;
237
229
  });
238
230
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openMediaPicker", function (inputMethod) {
239
- var _this$props4 = _this.props,
240
- onShowMediaPicker = _this$props4.onShowMediaPicker,
241
- dispatchAnalyticsEvent = _this$props4.dispatchAnalyticsEvent;
231
+ var _this$props3 = _this.props,
232
+ onShowMediaPicker = _this$props3.onShowMediaPicker,
233
+ dispatchAnalyticsEvent = _this$props3.dispatchAnalyticsEvent;
242
234
  if (onShowMediaPicker) {
243
235
  onShowMediaPicker();
244
236
  if (dispatchAnalyticsEvent) {
@@ -265,11 +257,11 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
265
257
  };
266
258
  });
267
259
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertHorizontalRule", function (inputMethod) {
268
- var _this$props5 = _this.props,
269
- _this$props5$editorVi = _this$props5.editorView,
270
- state = _this$props5$editorVi.state,
271
- dispatch = _this$props5$editorVi.dispatch,
272
- featureFlags = _this$props5.featureFlags;
260
+ var _this$props4 = _this.props,
261
+ _this$props4$editorVi = _this$props4.editorView,
262
+ state = _this$props4$editorVi.state,
263
+ dispatch = _this$props4$editorVi.dispatch,
264
+ featureFlags = _this$props4.featureFlags;
273
265
  return (0, _commands4.insertHorizontalRule)(inputMethod, featureFlags)(state, dispatch);
274
266
  });
275
267
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
@@ -280,9 +272,9 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
280
272
  });
281
273
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertBlockType", function (itemName) {
282
274
  return function () {
283
- var _this$props6 = _this.props,
284
- editorView = _this$props6.editorView,
285
- onInsertBlockType = _this$props6.onInsertBlockType;
275
+ var _this$props5 = _this.props,
276
+ editorView = _this$props5.editorView,
277
+ onInsertBlockType = _this$props5.onInsertBlockType;
286
278
  var state = editorView.state,
287
279
  dispatch = editorView.dispatch;
288
280
  onInsertBlockType(itemName)(state, dispatch);
@@ -301,11 +293,11 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
301
293
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref2) {
302
294
  var item = _ref2.item,
303
295
  inputMethod = _ref2.inputMethod;
304
- var _this$props7 = _this.props,
305
- editorView = _this$props7.editorView,
306
- editorActions = _this$props7.editorActions,
307
- handleImageUpload = _this$props7.handleImageUpload,
308
- expandEnabled = _this$props7.expandEnabled;
296
+ var _this$props6 = _this.props,
297
+ editorView = _this$props6.editorView,
298
+ editorActions = _this$props6.editorActions,
299
+ handleImageUpload = _this$props6.handleImageUpload,
300
+ expandEnabled = _this$props6.expandEnabled;
309
301
 
310
302
  // need to do this before inserting nodes so scrollIntoView works properly
311
303
  if (!editorView.hasFocus()) {
@@ -421,12 +413,12 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
421
413
  key: "renderPopup",
422
414
  value: function renderPopup() {
423
415
  var emojiPickerOpen = this.state.emojiPickerOpen;
424
- var _this$props8 = this.props,
425
- popupsMountPoint = _this$props8.popupsMountPoint,
426
- popupsBoundariesElement = _this$props8.popupsBoundariesElement,
427
- popupsScrollableElement = _this$props8.popupsScrollableElement,
428
- emojiProvider = _this$props8.emojiProvider,
429
- replacePlusMenuWithElementBrowser = _this$props8.replacePlusMenuWithElementBrowser;
416
+ var _this$props7 = this.props,
417
+ popupsMountPoint = _this$props7.popupsMountPoint,
418
+ popupsBoundariesElement = _this$props7.popupsBoundariesElement,
419
+ popupsScrollableElement = _this$props7.popupsScrollableElement,
420
+ emojiProvider = _this$props7.emojiProvider,
421
+ replacePlusMenuWithElementBrowser = _this$props7.replacePlusMenuWithElementBrowser;
430
422
  var dropdownEmoji = this.state.dropdownItems.some(function (_ref4) {
431
423
  var name = _ref4.value.name;
432
424
  return name === 'emoji';
@@ -462,9 +454,9 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
462
454
  buttons = _this$state.buttons,
463
455
  dropdownItems = _this$state.dropdownItems,
464
456
  emojiPickerOpen = _this$state.emojiPickerOpen;
465
- var _this$props9 = this.props,
466
- isDisabled = _this$props9.isDisabled,
467
- isReducedSpacing = _this$props9.isReducedSpacing;
457
+ var _this$props8 = this.props,
458
+ isDisabled = _this$props8.isDisabled,
459
+ isReducedSpacing = _this$props8.isReducedSpacing;
468
460
  if (buttons.length === 0 && dropdownItems.length === 0) {
469
461
  return null;
470
462
  }
@@ -395,7 +395,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
395
395
  gutterOffset: _mediaSingle.MEDIA_SINGLE_GUTTER_SIZE
396
396
  })
397
397
  };
398
- var ResizableMediaSingleProps = _objectSpread({
398
+ var resizableMediaSingleProps = _objectSpread({
399
399
  view: view,
400
400
  getPos: getPos,
401
401
  updateSize: this.updateSize,
@@ -429,7 +429,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
429
429
  ref: this.captionPlaceHolderRef,
430
430
  onClick: this.clickPlaceholder
431
431
  }));
432
- return canResize ? (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? (0, _react.jsx)(_ResizableMediaSingleNext.default, ResizableMediaSingleProps, MediaChildren) : (0, _react.jsx)(_ResizableMediaSingle.default, (0, _extends2.default)({}, ResizableMediaSingleProps, {
432
+ return canResize ? (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? (0, _react.jsx)(_ResizableMediaSingleNext.default, resizableMediaSingleProps, MediaChildren) : (0, _react.jsx)(_ResizableMediaSingle.default, (0, _extends2.default)({}, resizableMediaSingleProps, {
433
433
  lineLength: contentWidthForLegacyExperience
434
434
  }), MediaChildren) : (0, _react.jsx)(_ui.MediaSingle, mediaSingleProps, MediaChildren);
435
435
  }
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.resizerNextTestId = exports.default = exports.UnwrappedResizableMediaSingleNext = void 0;
7
+ exports.resizerNextTestId = exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -24,9 +24,6 @@ var _utils2 = require("@atlaskit/editor-common/utils");
24
24
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
25
25
  var _styled = require("./styled");
26
26
  var _resizer = require("@atlaskit/editor-common/resizer");
27
- var _ResizeLabel = _interopRequireDefault(require("../../../../ui/Resizer/ResizeLabel"));
28
- var _reactIntlNext = require("react-intl-next");
29
- var _resizableMediaSingleMessages = require("./resizable-media-single-messages");
30
27
  var _analytics = require("@atlaskit/editor-common/analytics");
31
28
  var _classnames = _interopRequireDefault(require("classnames"));
32
29
  var _styles = require("@atlaskit/editor-common/styles");
@@ -474,7 +471,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
474
471
  fullWidthMode = _this$props8.fullWidthMode,
475
472
  selected = _this$props8.selected,
476
473
  children = _this$props8.children,
477
- intl = _this$props8.intl,
478
474
  lineLength = _this$props8.lineLength;
479
475
  var _this$state = this.state,
480
476
  isResizing = _this$state.isResizing,
@@ -495,8 +491,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
495
491
  'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
496
492
  });
497
493
  var resizerNextClassName = (0, _classnames.default)(className, _styles.resizerStyles);
498
- var showSizeGuide = selected || isResizing;
499
- var label = layout === 'full-width' ? intl.formatMessage(_resizableMediaSingleMessages.messages.fullWidthImage) : "".concat(this.state.size.width, " x ").concat(this.state.size.height);
500
494
  var maxWidth = this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
501
495
  return (0, _react2.jsx)("div", {
502
496
  ref: this.saveWrapper,
@@ -522,14 +516,10 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
522
516
  snap: this.state.snaps,
523
517
  resizeRatio: _utils2.nonWrappedLayouts.includes(layout) ? 2 : 1,
524
518
  "data-testid": resizerNextTestId
525
- }, showSizeGuide && (0, _react2.jsx)(_ResizeLabel.default, {
526
- label: label,
527
- containerWidth: this.state.size.width
528
- }), children));
519
+ }, children));
529
520
  }
530
521
  }]);
531
522
  return ResizableMediaSingleNext;
532
- }(_react.default.Component); // for testing purpose
533
- exports.UnwrappedResizableMediaSingleNext = ResizableMediaSingleNext;
534
- var _default = (0, _reactIntlNext.injectIntl)(ResizableMediaSingleNext);
523
+ }(_react.default.Component);
524
+ var _default = ResizableMediaSingleNext;
535
525
  exports.default = _default;
@@ -36,7 +36,6 @@ var _transforms = require("../../list/transforms");
36
36
  var _paste = require("@atlaskit/editor-common/paste");
37
37
  var _utils5 = require("../../tasks-and-decisions/utils");
38
38
  var _utils6 = require("../../annotation/utils");
39
- var _betterTypeHistory = require("../../base/pm-plugins/better-type-history");
40
39
  var _clipboardTextSerializer = require("./clipboard-text-serializer");
41
40
  var _tinyMCE = require("../util/tinyMCE");
42
41
  var _utils7 = require("@atlaskit/editor-tables/utils");
@@ -212,8 +211,9 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
212
211
  });
213
212
  return tableExists;
214
213
  });
215
- if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns) {
216
- tr.setMeta(_betterTypeHistory.pluginKey, true);
214
+ if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns && pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.dependencies.betterTypeHistory) {
215
+ var _pluginInjectionApi$d;
216
+ 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);
217
217
  }
218
218
  (0, _card.addLinkMetadata)(view.state.selection, tr, {
219
219
  action: isPlainText ? _analytics2.ACTION.PASTED_AS_PLAIN : _analytics2.ACTION.PASTED,
@@ -241,14 +241,14 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
241
241
  // force a "paste as plain text" action by clearing the markdownSlice.
242
242
  markdownSlice = !((_markdownSlice = markdownSlice) !== null && _markdownSlice !== void 0 && _markdownSlice.size) ? undefined : markdownSlice;
243
243
  if (markdownSlice) {
244
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
244
+ var _pluginInjectionApi$d2, _pluginInjectionApi$d3;
245
245
  // linkify text prior to converting to macro
246
246
  if ((0, _analytics.handlePasteLinkOnSelectedTextWithAnalytics)(view, event, markdownSlice, _analytics2.PasteTypes.markdown)(state, dispatch)) {
247
247
  return true;
248
248
  }
249
249
 
250
250
  // run macro autoconvert prior to other conversions
251
- if ((0, _handlers.handleMacroAutoConvert)(text, markdownSlice, 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, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
251
+ if ((0, _handlers.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)) {
252
252
  // TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
253
253
  (0, _analytics.sendPasteAnalyticsEvent)(view, event, markdownSlice, {
254
254
  type: _analytics2.PasteTypes.markdown
@@ -313,7 +313,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
313
313
 
314
314
  // finally, handle rich-text copy-paste
315
315
  if (isRichText) {
316
- var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
316
+ var _pluginInjectionApi$d4, _pluginInjectionApi$d5;
317
317
  // linkify the text where possible
318
318
  slice = (0, _utils.linkifyContent)(state.schema)(slice);
319
319
  if ((0, _analytics.handlePasteLinkOnSelectedTextWithAnalytics)(view, event, slice, _analytics2.PasteTypes.richText)(state, dispatch)) {
@@ -321,7 +321,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
321
321
  }
322
322
 
323
323
  // run macro autoconvert prior to other conversions
324
- if ((0, _handlers.handleMacroAutoConvert)(text, 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, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
324
+ if ((0, _handlers.handleMacroAutoConvert)(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.actions) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
325
325
  // TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
326
326
  (0, _analytics.sendPasteAnalyticsEvent)(view, event, slice, {
327
327
  type: _analytics2.PasteTypes.richText
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.16.1";
9
+ var version = "187.17.1";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.16.1",
3
+ "version": "187.17.1",
4
4
  "sideEffects": false
5
5
  }
@@ -107,6 +107,7 @@ export class ReactEditorView extends React.Component {
107
107
  var _this$view;
108
108
  return (_this$view = this.view) === null || _this$view === void 0 ? void 0 : _this$view.state;
109
109
  });
110
+ _defineProperty(this, "getEditorView", () => this.view);
110
111
  _defineProperty(this, "formatFullWidthAppearance", appearance => {
111
112
  if (appearance === 'full-width') {
112
113
  return FULL_WIDTH_MODE.FULL_WIDTH;
@@ -528,7 +529,8 @@ export class ReactEditorView extends React.Component {
528
529
  });
529
530
  _defineProperty(this, "editor", this.createEditor(this.props.editorProps.assistiveLabel));
530
531
  this.pluginInjectionAPI = new EditorPluginInjectionAPI({
531
- getEditorState: this.getEditorState
532
+ getEditorState: this.getEditorState,
533
+ getEditorView: this.getEditorView
532
534
  });
533
535
  this.eventDispatcher = new EventDispatcher();
534
536
  this.dispatch = createDispatch(this.eventDispatcher);
@@ -9,7 +9,6 @@ import disableSpellcheckingPlugin from './pm-plugins/disable-spell-checking';
9
9
  import contextIdentifierPlugin from './pm-plugins/context-identifier';
10
10
  import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
11
11
  import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
12
- import betterTypeHistoryPlugin from './pm-plugins/better-type-history';
13
12
  import scrollGutter from './pm-plugins/scroll-gutter';
14
13
  import { keymap } from '@atlaskit/editor-common/keymaps';
15
14
  import frozenEditor from './pm-plugins/frozen-editor';
@@ -75,12 +74,6 @@ const basePlugin = (options, api) => {
75
74
  dispatch,
76
75
  providerFactory
77
76
  }) => contextIdentifierPlugin(dispatch, providerFactory)
78
- }, {
79
- name: 'betterTypeHistory',
80
- plugin: ({
81
- dispatch,
82
- providerFactory
83
- }) => betterTypeHistoryPlugin()
84
77
  });
85
78
  if (options && options.allowScrollGutter) {
86
79
  plugins.push({
@@ -0,0 +1,24 @@
1
+ import createPlugin from './pm-plugins/main';
2
+ import { pluginKey } from './pm-plugins/plugin-key';
3
+ /**
4
+ * This plugin is aiming to improve undo behaviour for some of our more custom applications, very specific text
5
+ * paste events, splitting blocks of text, new lines.
6
+ */
7
+ const betterTypeHistory = () => {
8
+ return {
9
+ name: 'betterTypeHistory',
10
+ actions: {
11
+ flagPasteEvent(tr) {
12
+ tr.setMeta(pluginKey, true);
13
+ return tr;
14
+ }
15
+ },
16
+ pmPlugins() {
17
+ return [{
18
+ name: 'betterTypeHistory',
19
+ plugin: () => createPlugin()
20
+ }];
21
+ }
22
+ };
23
+ };
24
+ export default betterTypeHistory;
@@ -3,8 +3,8 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
4
4
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
5
5
  import { ReplaceStep, ReplaceAroundStep } from '@atlaskit/editor-prosemirror/transform';
6
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
6
  import { extractSliceFromStep } from '../../../utils/step';
7
+ import { pluginKey } from './plugin-key';
8
8
  const getEnterKeyboardActionStep = trs => {
9
9
  const firstTr = trs.length === 1 && trs[0];
10
10
  if (!firstTr || !firstTr.docChanged || !firstTr.isGeneric || !(firstTr.selection instanceof TextSelection)) {
@@ -33,7 +33,6 @@ const isSliceAddingNewlineChar = (slice, schema) => {
33
33
  const newLine = Fragment.from(schema.text('\n'));
34
34
  return slice.content.eq(newLine);
35
35
  };
36
- export const pluginKey = new PluginKey('betterTypeHistoryPlugin');
37
36
  export default (() => {
38
37
  return new SafePlugin({
39
38
  key: pluginKey,
@@ -0,0 +1,2 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export const pluginKey = new PluginKey('betterTypeHistoryPlugin');
@@ -1,6 +1,7 @@
1
1
  export { default as basePlugin } from './base';
2
2
  export { default as blockTypePlugin } from './block-type';
3
3
  export { pluginKey as blockPluginStateKey } from './block-type';
4
+ export { default as betterTypeHistoryPlugin } from './better-type-history';
4
5
  export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-marks-on-change-to-empty-document';
5
6
  export { default as codeBlockPlugin } from './code-block';
6
7
  export { default as collabEditPlugin } from './collab-edit';
@@ -6,7 +6,6 @@ import ReactDOM from 'react-dom';
6
6
  import { injectIntl } from 'react-intl-next';
7
7
  import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
8
8
  import { Popup } from '@atlaskit/editor-common/ui';
9
- import { pluginCommandToPMCommand } from '@atlaskit/editor-common/preset';
10
9
  import ToolbarButton from '../../../../ui/ToolbarButton';
11
10
  import { separatorStyles, buttonGroupStyle, wrapperStyle } from '@atlaskit/editor-common/styles';
12
11
  import { insertDate } from '../../../date/actions';
@@ -153,19 +152,11 @@ export class ToolbarInsertBlock extends React.PureComponent {
153
152
  }
154
153
  });
155
154
  _defineProperty(this, "toggleLinkPanel", inputMethod => {
156
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
155
+ var _pluginInjectionApi$e, _pluginInjectionApi$d, _pluginInjectionApi$d2;
157
156
  const {
158
- editorView,
159
157
  pluginInjectionApi
160
158
  } = this.props;
161
- const {
162
- state,
163
- dispatch
164
- } = editorView;
165
-
166
- // We should update this to use `pluginInjectionApi.executeCommand` once available
167
- pluginCommandToPMCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.hyperlink) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.commands.showLinkToolbar(inputMethod))(state, dispatch);
168
- return true;
159
+ return (_pluginInjectionApi$e = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.executeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.hyperlink) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$e !== void 0 ? _pluginInjectionApi$e : false;
169
160
  });
170
161
  _defineProperty(this, "insertMention", inputMethod => {
171
162
  var _pluginInjectionApi$d3;
@@ -302,7 +302,7 @@ export default class MediaSingleNode extends Component {
302
302
  gutterOffset: MEDIA_SINGLE_GUTTER_SIZE
303
303
  })
304
304
  };
305
- const ResizableMediaSingleProps = {
305
+ const resizableMediaSingleProps = {
306
306
  view: view,
307
307
  getPos: getPos,
308
308
  updateSize: this.updateSize,
@@ -339,7 +339,7 @@ export default class MediaSingleNode extends Component {
339
339
  ref: this.captionPlaceHolderRef,
340
340
  onClick: this.clickPlaceholder
341
341
  }));
342
- return canResize ? getBooleanFF('platform.editor.media.extended-resize-experience') ? jsx(ResizableMediaSingleNext, ResizableMediaSingleProps, MediaChildren) : jsx(ResizableMediaSingle, _extends({}, ResizableMediaSingleProps, {
342
+ return canResize ? getBooleanFF('platform.editor.media.extended-resize-experience') ? jsx(ResizableMediaSingleNext, resizableMediaSingleProps, MediaChildren) : jsx(ResizableMediaSingle, _extends({}, resizableMediaSingleProps, {
343
343
  lineLength: contentWidthForLegacyExperience
344
344
  }), MediaChildren) : jsx(MediaSingle, mediaSingleProps, MediaChildren);
345
345
  }