@atlaskit/editor-core 187.44.2 → 187.44.4

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 (94) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/plugins/expand/pm-plugins/keymap.js +2 -2
  3. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +3 -1
  4. package/dist/cjs/plugins/media/pm-plugins/keymap-media-single.js +2 -2
  5. package/dist/cjs/plugins/media/pm-plugins/main.js +1 -2
  6. package/dist/cjs/plugins/media/toolbar/index.js +2 -2
  7. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.js +4 -5
  8. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +17 -24
  9. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +17 -24
  10. package/dist/cjs/plugins/media/utils/media-common.js +7 -8
  11. package/dist/cjs/plugins/media/utils/media-files.js +6 -6
  12. package/dist/cjs/plugins/media/utils/media-single.js +2 -2
  13. package/dist/cjs/plugins/placeholder-text/index.js +1 -1
  14. package/dist/cjs/plugins/selection/commands.js +2 -3
  15. package/dist/cjs/plugins/selection/gap-cursor/actions.js +10 -11
  16. package/dist/cjs/plugins/selection/gap-cursor/utils.js +3 -3
  17. package/dist/cjs/plugins/selection/plugin-factory.js +5 -5
  18. package/dist/cjs/plugins/selection/pm-plugins/keymap.js +1 -1
  19. package/dist/cjs/plugins/selection/utils.js +1 -2
  20. package/dist/cjs/utils/commands.js +2 -22
  21. package/dist/cjs/utils/document.js +0 -20
  22. package/dist/cjs/utils/index.js +0 -6
  23. package/dist/cjs/version-wrapper.js +1 -1
  24. package/dist/es2019/plugins/expand/pm-plugins/keymap.js +1 -1
  25. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +4 -2
  26. package/dist/es2019/plugins/media/pm-plugins/keymap-media-single.js +1 -1
  27. package/dist/es2019/plugins/media/pm-plugins/main.js +1 -2
  28. package/dist/es2019/plugins/media/toolbar/index.js +3 -3
  29. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.js +2 -2
  30. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -16
  31. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +5 -16
  32. package/dist/es2019/plugins/media/utils/media-common.js +1 -2
  33. package/dist/es2019/plugins/media/utils/media-files.js +1 -1
  34. package/dist/es2019/plugins/media/utils/media-single.js +1 -1
  35. package/dist/es2019/plugins/placeholder-text/index.js +1 -1
  36. package/dist/es2019/plugins/selection/commands.js +1 -2
  37. package/dist/es2019/plugins/selection/gap-cursor/actions.js +2 -4
  38. package/dist/es2019/plugins/selection/gap-cursor/utils.js +2 -2
  39. package/dist/es2019/plugins/selection/plugin-factory.js +1 -1
  40. package/dist/es2019/plugins/selection/pm-plugins/keymap.js +1 -1
  41. package/dist/es2019/plugins/selection/utils.js +1 -3
  42. package/dist/es2019/utils/commands.js +1 -19
  43. package/dist/es2019/utils/document.js +0 -18
  44. package/dist/es2019/utils/index.js +1 -1
  45. package/dist/es2019/version-wrapper.js +1 -1
  46. package/dist/esm/plugins/expand/pm-plugins/keymap.js +1 -1
  47. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +4 -2
  48. package/dist/esm/plugins/media/pm-plugins/keymap-media-single.js +1 -1
  49. package/dist/esm/plugins/media/pm-plugins/main.js +1 -2
  50. package/dist/esm/plugins/media/toolbar/index.js +3 -3
  51. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.js +2 -2
  52. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +17 -24
  53. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +17 -24
  54. package/dist/esm/plugins/media/utils/media-common.js +1 -2
  55. package/dist/esm/plugins/media/utils/media-files.js +1 -1
  56. package/dist/esm/plugins/media/utils/media-single.js +1 -1
  57. package/dist/esm/plugins/placeholder-text/index.js +1 -1
  58. package/dist/esm/plugins/selection/commands.js +1 -2
  59. package/dist/esm/plugins/selection/gap-cursor/actions.js +2 -4
  60. package/dist/esm/plugins/selection/gap-cursor/utils.js +2 -2
  61. package/dist/esm/plugins/selection/plugin-factory.js +1 -1
  62. package/dist/esm/plugins/selection/pm-plugins/keymap.js +1 -1
  63. package/dist/esm/plugins/selection/utils.js +1 -3
  64. package/dist/esm/utils/commands.js +1 -21
  65. package/dist/esm/utils/document.js +0 -20
  66. package/dist/esm/utils/index.js +1 -1
  67. package/dist/esm/version-wrapper.js +1 -1
  68. package/dist/types/plugins/media/ui/CaptionPlaceholder/index.d.ts +0 -1
  69. package/dist/types/plugins/media/utils/media-files.d.ts +1 -2
  70. package/dist/types/plugins/selection/commands.d.ts +2 -2
  71. package/dist/types/plugins/selection/gap-cursor/actions.d.ts +1 -1
  72. package/dist/types/plugins/selection/pm-plugins/selection-main.d.ts +1 -1
  73. package/dist/types/utils/commands.d.ts +2 -12
  74. package/dist/types/utils/document.d.ts +0 -4
  75. package/dist/types/utils/index.d.ts +1 -1
  76. package/dist/types-ts4.5/plugins/media/ui/CaptionPlaceholder/index.d.ts +0 -1
  77. package/dist/types-ts4.5/plugins/media/utils/media-files.d.ts +1 -2
  78. package/dist/types-ts4.5/plugins/selection/commands.d.ts +2 -2
  79. package/dist/types-ts4.5/plugins/selection/gap-cursor/actions.d.ts +1 -1
  80. package/dist/types-ts4.5/plugins/selection/pm-plugins/selection-main.d.ts +1 -1
  81. package/dist/types-ts4.5/utils/commands.d.ts +2 -12
  82. package/dist/types-ts4.5/utils/document.d.ts +0 -4
  83. package/dist/types-ts4.5/utils/index.d.ts +1 -1
  84. package/package.json +2 -2
  85. package/dist/cjs/utils/prosemirror/position.js +0 -42
  86. package/dist/cjs/utils/table.js +0 -28
  87. package/dist/es2019/utils/prosemirror/position.js +0 -1
  88. package/dist/es2019/utils/table.js +0 -22
  89. package/dist/esm/utils/prosemirror/position.js +0 -1
  90. package/dist/esm/utils/table.js +0 -22
  91. package/dist/types/utils/prosemirror/position.d.ts +0 -1
  92. package/dist/types/utils/table.d.ts +0 -2
  93. package/dist/types-ts4.5/utils/prosemirror/position.d.ts +0 -1
  94. package/dist/types-ts4.5/utils/table.d.ts +0 -2
@@ -14,7 +14,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
14
14
  import React from 'react';
15
15
  import { jsx } from '@emotion/react';
16
16
  import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
17
- import { getMediaClient } from '@atlaskit/media-client';
18
17
  import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
19
18
  import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/utils';
20
19
  import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
@@ -29,6 +28,7 @@ import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
29
28
  import throttle from 'lodash/throttle';
30
29
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
31
30
  import { ResizableMediaMigrationNotification } from './ResizableMediaMigrationNotification';
31
+ import { checkMediaType } from '../../utils/check-media-type';
32
32
  export var resizerNextTestId = 'mediaSingle.resizerNext.testid';
33
33
  var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
34
34
  _inherits(ResizableMediaSingleNext, _React$Component);
@@ -418,7 +418,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
418
418
  key: "checkVideoFile",
419
419
  value: function () {
420
420
  var _checkVideoFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(viewMediaClientConfig) {
421
- var mediaNode, mediaClient, state;
421
+ var mediaNode, mediaType, isVideoFile;
422
422
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
423
423
  while (1) switch (_context2.prev = _context2.next) {
424
424
  case 0:
@@ -429,38 +429,31 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
429
429
  return _context2.abrupt("return");
430
430
  case 2:
431
431
  mediaNode = this.props.view.state.doc.nodeAt(this.pos + 1);
432
- if (!(!mediaNode || !mediaNode.attrs.id)) {
433
- _context2.next = 5;
432
+ if (!mediaNode) {
433
+ _context2.next = 9;
434
434
  break;
435
435
  }
436
- return _context2.abrupt("return");
437
- case 5:
438
- mediaClient = getMediaClient(viewMediaClientConfig);
439
- _context2.prev = 6;
440
- _context2.next = 9;
441
- return mediaClient.file.getCurrentState(mediaNode.attrs.id, {
442
- collectionName: mediaNode.attrs.collection
443
- });
436
+ _context2.next = 6;
437
+ return checkMediaType(mediaNode, viewMediaClientConfig);
438
+ case 6:
439
+ _context2.t0 = _context2.sent;
440
+ _context2.next = 10;
441
+ break;
444
442
  case 9:
445
- state = _context2.sent;
446
- if (state && state.status !== 'error' && state.mediaType === 'image') {
443
+ _context2.t0 = undefined;
444
+ case 10:
445
+ mediaType = _context2.t0;
446
+ isVideoFile = mediaType !== 'external' && mediaType !== 'image';
447
+ if (this.state.isVideoFile !== isVideoFile) {
447
448
  this.setState({
448
- isVideoFile: false
449
+ isVideoFile: isVideoFile
449
450
  });
450
451
  }
451
- _context2.next = 16;
452
- break;
453
452
  case 13:
454
- _context2.prev = 13;
455
- _context2.t0 = _context2["catch"](6);
456
- this.setState({
457
- isVideoFile: false
458
- });
459
- case 16:
460
453
  case "end":
461
454
  return _context2.stop();
462
455
  }
463
- }, _callee2, this, [[6, 13]]);
456
+ }, _callee2, this);
464
457
  }));
465
458
  function checkVideoFile(_x) {
466
459
  return _checkVideoFile.apply(this, arguments);
@@ -14,12 +14,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
14
14
  import React from 'react';
15
15
  import { jsx } from '@emotion/react';
16
16
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
17
- import { getMediaClient } from '@atlaskit/media-client';
18
17
  import { calcPctFromPx, calcColumnsFromPx, wrappedLayouts, Resizer, calcMediaPxWidth, snapTo, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
19
18
  import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
20
19
  import { wrapperStyle } from './styled';
21
20
  import { calculateOffsetLeft } from '@atlaskit/editor-common/media-single';
22
21
  import { calculateSnapPoints } from '@atlaskit/editor-common/utils';
22
+ import { checkMediaType } from '../../utils/check-media-type';
23
23
  var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
24
24
  _inherits(ResizableMediaSingle, _React$Component);
25
25
  var _super = _createSuper(ResizableMediaSingle);
@@ -223,7 +223,7 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
223
223
  key: "checkVideoFile",
224
224
  value: function () {
225
225
  var _checkVideoFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(viewMediaClientConfig) {
226
- var $pos, mediaNode, mediaClient, state;
226
+ var $pos, mediaNode, mediaType, isVideoFile;
227
227
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
228
228
  while (1) switch (_context2.prev = _context2.next) {
229
229
  case 0:
@@ -235,38 +235,31 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
235
235
  return _context2.abrupt("return");
236
236
  case 3:
237
237
  mediaNode = this.props.view.state.doc.nodeAt($pos.pos + 1);
238
- if (!(!mediaNode || !mediaNode.attrs.id)) {
239
- _context2.next = 6;
238
+ if (!mediaNode) {
239
+ _context2.next = 10;
240
240
  break;
241
241
  }
242
- return _context2.abrupt("return");
243
- case 6:
244
- mediaClient = getMediaClient(viewMediaClientConfig);
245
- _context2.prev = 7;
246
- _context2.next = 10;
247
- return mediaClient.file.getCurrentState(mediaNode.attrs.id, {
248
- collectionName: mediaNode.attrs.collection
249
- });
242
+ _context2.next = 7;
243
+ return checkMediaType(mediaNode, viewMediaClientConfig);
244
+ case 7:
245
+ _context2.t0 = _context2.sent;
246
+ _context2.next = 11;
247
+ break;
250
248
  case 10:
251
- state = _context2.sent;
252
- if (state && state.status !== 'error' && state.mediaType === 'image') {
249
+ _context2.t0 = undefined;
250
+ case 11:
251
+ mediaType = _context2.t0;
252
+ isVideoFile = mediaType !== 'external' && mediaType !== 'image';
253
+ if (this.state.isVideoFile !== isVideoFile) {
253
254
  this.setState({
254
- isVideoFile: false
255
+ isVideoFile: isVideoFile
255
256
  });
256
257
  }
257
- _context2.next = 17;
258
- break;
259
258
  case 14:
260
- _context2.prev = 14;
261
- _context2.t0 = _context2["catch"](7);
262
- this.setState({
263
- isVideoFile: false
264
- });
265
- case 17:
266
259
  case "end":
267
260
  return _context2.stop();
268
261
  }
269
- }, _callee2, this, [[7, 14]]);
262
+ }, _callee2, this);
270
263
  }));
271
264
  function checkVideoFile(_x) {
272
265
  return _checkVideoFile.apply(this, arguments);
@@ -6,8 +6,7 @@ import { isTemporary } from '../../../utils';
6
6
  import { mapSlice } from '../../../utils/slice';
7
7
  import { walkUpTreeUntil, removeNestedEmptyEls, unwrap } from '../../../utils/dom';
8
8
  import { isImage } from './is-image';
9
- import { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, endPositionOfParent, startPositionOfParent } from '../../../utils/prosemirror/position';
10
- import { GapCursorSelection } from '@atlaskit/editor-common/selection';
9
+ import { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, endPositionOfParent, startPositionOfParent, GapCursorSelection } from '@atlaskit/editor-common/selection';
11
10
  import { isMediaBlobUrl } from '@atlaskit/media-client';
12
11
  export var isMediaBlobUrlFromAttrs = function isMediaBlobUrlFromAttrs(attrs) {
13
12
  return !!(attrs && attrs.type === 'external' && isMediaBlobUrl(attrs.url));
@@ -3,7 +3,7 @@ import { setNodeSelection, setTextSelection, insideTableCell, isInListItem, find
3
3
  import { isInLayoutColumn, isSupportedInParent } from '@atlaskit/editor-common/utils';
4
4
  import { posOfPrecedingMediaGroup, posOfMediaGroupNearby, posOfParentMediaGroup, isSelectionNonMediaBlockNode, isInsidePotentialEmptyParagraph, copyOptionalAttrsFromMediaState } from './media-common';
5
5
  import { canInsert, safeInsert, hasParentNode } from '@atlaskit/editor-prosemirror/utils';
6
- import { atTheBeginningOfBlock, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '../../../utils/prosemirror/position';
6
+ import { atTheBeginningOfBlock, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '@atlaskit/editor-common/selection';
7
7
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
8
8
  export var canInsertMediaInline = function canInsertMediaInline(state) {
9
9
  var node = state.schema.nodes.mediaInline.create({});
@@ -11,7 +11,7 @@ import { mapSlice } from '../../../utils/slice';
11
11
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
12
12
  import { safeInsert, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
13
13
  import { isImage } from './is-image';
14
- import { atTheBeginningOfBlock } from '../../../utils/prosemirror/position';
14
+ import { atTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
15
15
  import { getRandomHex } from '@atlaskit/media-common';
16
16
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
17
17
  var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension) {
@@ -4,7 +4,7 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
4
4
  import { placeholder } from '@atlaskit/adf-schema';
5
5
  import MediaServicesTextIcon from '@atlaskit/icon/glyph/media-services/text';
6
6
  import WithPluginState from '../../ui/WithPluginState';
7
- import { isNodeEmpty } from '../../utils';
7
+ import { isNodeEmpty } from '@atlaskit/editor-common/utils';
8
8
  import { FakeTextCursorSelection } from '../fake-text-cursor/cursor';
9
9
  import PlaceholderFloatingToolbar from './ui/PlaceholderFloatingToolbar';
10
10
  import { hidePlaceholderFloatingToolbar, insertPlaceholderTextAtSelection } from './actions';
@@ -1,8 +1,7 @@
1
1
  import { NodeSelection, TextSelection, Selection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { GapCursorSelection, Side } from './gap-cursor-selection';
3
3
  import { isIgnored as isIgnoredByGapCursor } from '../selection/gap-cursor/utils/is-ignored';
4
- import { isNodeEmpty } from '../../utils/document';
5
- import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
4
+ import { isNodeEmpty, isEmptyParagraph } from '@atlaskit/editor-common/utils';
6
5
  import { SelectionActionTypes } from './actions';
7
6
  import { createCommand, getPluginState } from './plugin-factory';
8
7
  import { isSelectableContainerNode, isSelectionAtEndOfParentNode, findSelectableContainerParent, isSelectionAtStartOfParentNode, findSelectableContainerBefore, findSelectableContainerAfter, findFirstChildNodeToSelect, findLastChildNodeToSelect } from './utils';
@@ -1,14 +1,12 @@
1
1
  import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { findDomRefAtPos, findPositionOfNodeBefore, removeNodeBefore } from '@atlaskit/editor-prosemirror/utils';
3
- import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
4
3
  import { Direction, isBackward, isForward } from './direction';
5
4
  import { GapCursorSelection, Side } from './selection';
6
5
  import { isTextBlockNearPos } from './utils';
7
6
  import { isValidTargetNode } from './utils/is-valid-target-node';
8
- import { atTheBeginningOfDoc, atTheEndOfDoc } from '../../../utils/prosemirror/position';
7
+ import { atTheBeginningOfDoc, atTheEndOfDoc } from '@atlaskit/editor-common/selection';
9
8
  import { gapCursorPluginKey } from '../pm-plugins/gap-cursor-plugin-key';
10
- import { isPositionNearTableRow } from '../../../utils/table';
11
- import { isMediaNode, isNodeBeforeMediaNode } from '@atlaskit/editor-common/utils';
9
+ import { ZERO_WIDTH_SPACE, isMediaNode, isNodeBeforeMediaNode, isPositionNearTableRow } from '@atlaskit/editor-common/utils';
12
10
  export var shouldSkipGapCursor = function shouldSkipGapCursor(direction, state, $pos) {
13
11
  var _$pos$nodeBefore;
14
12
  var doc = state.doc,
@@ -1,6 +1,6 @@
1
1
  import { TableSharedCssClassName, UnsupportedSharedCssClassName } from '@atlaskit/editor-common/styles';
2
2
  import { Side } from './selection';
3
- import { CAPTION_PLACEHOLDER_ID } from '../../media/ui/CaptionPlaceholder';
3
+ import { CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
4
4
  export var isLeftCursor = function isLeftCursor(side) {
5
5
  return side === Side.LEFT;
6
6
  };
@@ -113,7 +113,7 @@ export var isIgnoredClick = function isIgnoredClick(elem) {
113
113
  return false;
114
114
  };
115
115
 
116
- /*
116
+ /*
117
117
  Calculates custom style for breakout mode
118
118
  Mainly to handle table width to include the numbered column width as well
119
119
  */
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
6
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
7
- import { pluginFactory } from '../../utils/plugin-state-factory';
7
+ import { pluginFactory } from '@atlaskit/editor-common/utils';
8
8
  import { reducer } from './reducer';
9
9
  import { selectionPluginKey } from './types';
10
10
  import { getDecorations, isSelectableContainerNode } from './utils';
@@ -1,5 +1,5 @@
1
1
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
2
- import { bindKeymapWithCommand, moveRight, moveLeft } from '../../../keymaps';
2
+ import { bindKeymapWithCommand, moveRight, moveLeft } from '@atlaskit/editor-common/keymaps';
3
3
  import { arrowRight, arrowLeft } from '../commands';
4
4
  function keymapPlugin() {
5
5
  var list = {};
@@ -2,12 +2,10 @@ import { NodeSelection, TextSelection, Selection, AllSelection } from '@atlaskit
2
2
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
3
  import { flatten, findParentNode } from '@atlaskit/editor-prosemirror/utils';
4
4
  import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
5
- import { isSelectionAtStartOfNode, isSelectionAtEndOfNode } from '@atlaskit/editor-common/selection';
6
- import { selectNode } from '../../utils/commands';
5
+ import { isSelectionAtStartOfNode, isSelectionAtEndOfNode, getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, selectNode } from '@atlaskit/editor-common/selection';
7
6
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
8
7
  import { isIgnored as isIgnoredByGapCursor } from '../selection/gap-cursor/utils/is-ignored';
9
8
  import { selectionPluginKey } from './types';
10
- import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload } from '@atlaskit/editor-common/selection';
11
9
  export function createSelectionClickHandler(nodes, isValidTarget, options) {
12
10
  return function handleClickOn(view, pos, node, nodePos, event, direct) {
13
11
  if (options.useLongPressSelection) {
@@ -1,4 +1,3 @@
1
- import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
2
1
  /**
3
2
  * Creates a filter that checks if the node at a given number of parents above the current
4
3
  * selection is of the correct node type.
@@ -24,23 +23,4 @@ var withScrollIntoView = function withScrollIntoView(command) {
24
23
  }, view);
25
24
  };
26
25
  };
27
-
28
- /**
29
- * Insert content, delete a range and create a new selection
30
- * This function automatically handles the mapping of positions for insertion and deletion.
31
- * The new selection is handled as a function since it may not always be necessary to resolve a position to the transactions mapping
32
- *
33
- * @param getSelectionResolvedPos get the resolved position to create a new selection
34
- * @param insertions content to insert at the specified position
35
- * @param deletions the ranges to delete
36
- */
37
-
38
- var selectNode = function selectNode(pos) {
39
- return function (state, dispatch) {
40
- if (dispatch) {
41
- dispatch(state.tr.setSelection(new NodeSelection(state.doc.resolve(pos))));
42
- }
43
- return true;
44
- };
45
- };
46
- export { isNthParentOfType, withScrollIntoView, selectNode };
26
+ export { isNthParentOfType, withScrollIntoView };
@@ -3,26 +3,6 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
3
  import { getBreakoutMode } from './node-width';
4
4
  import { processRawValue, hasDocAsParent, getStepRange, isEmptyParagraph } from '@atlaskit/editor-common/utils';
5
5
  export { findFarthestParentNode } from '@atlaskit/editor-common/utils';
6
-
7
- /**
8
- * Checks if a node has any content. Ignores node that only contain empty block nodes.
9
- */
10
- export function isNodeEmpty(node) {
11
- if (node && node.textContent) {
12
- return false;
13
- }
14
- if (!node || !node.childCount || node.childCount === 1 && isEmptyParagraph(node.firstChild)) {
15
- return true;
16
- }
17
- var block = [];
18
- var nonBlock = [];
19
- node.forEach(function (child) {
20
- child.isInline ? nonBlock.push(child) : block.push(child);
21
- });
22
- return !nonBlock.length && !block.filter(function (childNode) {
23
- return !!childNode.childCount && !(childNode.childCount === 1 && isEmptyParagraph(childNode.firstChild)) || childNode.isAtom;
24
- }).length;
25
- }
26
6
  export function isInEmptyLine(state) {
27
7
  var selection = state.selection;
28
8
  var _ref = selection,
@@ -4,7 +4,7 @@ import { FakeTextCursorSelection } from '../plugins/fake-text-cursor/cursor';
4
4
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
5
  export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem } from '@atlaskit/editor-common/utils';
6
6
  export { insideTable } from '@atlaskit/editor-common/core-utils';
7
- export { isNodeEmpty, findFarthestParentNode, nodesBetweenChanged, getNodesCount } from './document';
7
+ export { findFarthestParentNode, nodesBetweenChanged, getNodesCount } from './document';
8
8
  export { isParagraph, isText, isLinkMark } from './nodes';
9
9
  export { setNodeSelection, setTextSelection } from './selection';
10
10
  export { default as measurements } from './performance/measure-enum';
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.44.2";
2
+ export var version = "187.44.4";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,6 +1,5 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- export declare const CAPTION_PLACEHOLDER_ID = "caption-placeholder";
4
3
  declare const _default: React.ForwardRefExoticComponent<{
5
4
  onClick: () => void;
6
5
  } & React.RefAttributes<HTMLSpanElement>>;
@@ -1,8 +1,7 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { MediaState } from '../types';
4
- import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
5
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ import type { InputMethodInsertMedia, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
6
5
  export interface Range {
7
6
  start: number;
8
7
  end: number;
@@ -1,8 +1,8 @@
1
1
  import { Selection } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
- import type { Command } from '../../types';
3
+ import type { Command } from '@atlaskit/editor-common/types';
4
4
  import { RelativeSelectionPos } from './types';
5
- export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => import("@atlaskit/editor-common/types").Command;
5
+ export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => Command;
6
6
  export declare const arrowRight: Command;
7
7
  export declare const arrowLeft: Command;
8
8
  export declare const setSelectionInsideAtNodeEnd: (selectionRelativeToNode: RelativeSelectionPos, node: PmNode, from: number, to: number) => Command;
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
2
2
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
3
  import { Direction } from './direction';
4
4
  import { Side } from './selection';
5
- import type { Command } from '../../../types';
5
+ import type { Command } from '@atlaskit/editor-common/types';
6
6
  export type DirectionString = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
7
7
  export declare const shouldSkipGapCursor: (direction: Direction, state: EditorState, $pos: ResolvedPos) => boolean;
8
8
  export declare const arrow: (dir: Direction, endOfTextblock?: ((dir: DirectionString, state?: EditorState) => boolean) | undefined) => Command;
@@ -1,7 +1,7 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { Dispatch } from '../../../event-dispatcher';
4
- import type { DispatchAnalyticsEvent } from '../../analytics';
4
+ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
5
5
  import type { SelectionPluginOptions, SelectionPluginState } from '../types';
6
6
  export declare const getInitialState: (state: EditorState) => SelectionPluginState;
7
7
  export declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, options?: SelectionPluginOptions) => SafePlugin<SelectionPluginState>;
@@ -1,6 +1,6 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types';
3
+ import type { HigherOrderCommand } from '@atlaskit/editor-common/types';
4
4
  /**
5
5
  * Creates a filter that checks if the node at a given number of parents above the current
6
6
  * selection is of the correct node type.
@@ -11,14 +11,4 @@ import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types'
11
11
  */
12
12
  declare const isNthParentOfType: (nodeType: string, depthAway: number) => (state: EditorState, view?: EditorView) => boolean;
13
13
  declare const withScrollIntoView: HigherOrderCommand;
14
- /**
15
- * Insert content, delete a range and create a new selection
16
- * This function automatically handles the mapping of positions for insertion and deletion.
17
- * The new selection is handled as a function since it may not always be necessary to resolve a position to the transactions mapping
18
- *
19
- * @param getSelectionResolvedPos get the resolved position to create a new selection
20
- * @param insertions content to insert at the specified position
21
- * @param deletions the ranges to delete
22
- */
23
- declare const selectNode: (pos: number) => Command;
24
- export { isNthParentOfType, withScrollIntoView, selectNode };
14
+ export { isNthParentOfType, withScrollIntoView };
@@ -6,10 +6,6 @@ import type { Transformer, ReplaceRawValue } from '@atlaskit/editor-common/types
6
6
  import type { DispatchAnalyticsEvent } from '../plugins/analytics/types/dispatch-analytics-event';
7
7
  import type { BreakoutMarkAttrs } from '@atlaskit/adf-schema';
8
8
  export { findFarthestParentNode } from '@atlaskit/editor-common/utils';
9
- /**
10
- * Checks if a node has any content. Ignores node that only contain empty block nodes.
11
- */
12
- export declare function isNodeEmpty(node?: Node): boolean;
13
9
  export declare function isInEmptyLine(state: EditorState): boolean;
14
10
  export declare function processRawFragmentValue(schema: Schema, value?: ReplaceRawValue[], providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Fragment | undefined;
15
11
  export type ChangedFn = (node: Node, pos: number, parent: Node | null, index: number) => boolean | void;
@@ -3,7 +3,7 @@ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state'
3
3
  import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
4
4
  export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem, } from '@atlaskit/editor-common/utils';
5
5
  export { insideTable } from '@atlaskit/editor-common/core-utils';
6
- export { isNodeEmpty, findFarthestParentNode, nodesBetweenChanged, getNodesCount, } from './document';
6
+ export { findFarthestParentNode, nodesBetweenChanged, getNodesCount, } from './document';
7
7
  export { isParagraph, isText, isLinkMark } from './nodes';
8
8
  export { setNodeSelection, setTextSelection } from './selection';
9
9
  export type { JSONDocNode };
@@ -1,6 +1,5 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- export declare const CAPTION_PLACEHOLDER_ID = "caption-placeholder";
4
3
  declare const _default: React.ForwardRefExoticComponent<{
5
4
  onClick: () => void;
6
5
  } & React.RefAttributes<HTMLSpanElement>>;
@@ -1,8 +1,7 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { MediaState } from '../types';
4
- import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
5
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ import type { InputMethodInsertMedia, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
6
5
  export interface Range {
7
6
  start: number;
8
7
  end: number;
@@ -1,8 +1,8 @@
1
1
  import { Selection } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
- import type { Command } from '../../types';
3
+ import type { Command } from '@atlaskit/editor-common/types';
4
4
  import { RelativeSelectionPos } from './types';
5
- export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => import("@atlaskit/editor-common/types").Command;
5
+ export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => Command;
6
6
  export declare const arrowRight: Command;
7
7
  export declare const arrowLeft: Command;
8
8
  export declare const setSelectionInsideAtNodeEnd: (selectionRelativeToNode: RelativeSelectionPos, node: PmNode, from: number, to: number) => Command;
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
2
2
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
3
  import { Direction } from './direction';
4
4
  import { Side } from './selection';
5
- import type { Command } from '../../../types';
5
+ import type { Command } from '@atlaskit/editor-common/types';
6
6
  export type DirectionString = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
7
7
  export declare const shouldSkipGapCursor: (direction: Direction, state: EditorState, $pos: ResolvedPos) => boolean;
8
8
  export declare const arrow: (dir: Direction, endOfTextblock?: ((dir: DirectionString, state?: EditorState) => boolean) | undefined) => Command;
@@ -1,7 +1,7 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { Dispatch } from '../../../event-dispatcher';
4
- import type { DispatchAnalyticsEvent } from '../../analytics';
4
+ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
5
5
  import type { SelectionPluginOptions, SelectionPluginState } from '../types';
6
6
  export declare const getInitialState: (state: EditorState) => SelectionPluginState;
7
7
  export declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, options?: SelectionPluginOptions) => SafePlugin<SelectionPluginState>;
@@ -1,6 +1,6 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types';
3
+ import type { HigherOrderCommand } from '@atlaskit/editor-common/types';
4
4
  /**
5
5
  * Creates a filter that checks if the node at a given number of parents above the current
6
6
  * selection is of the correct node type.
@@ -11,14 +11,4 @@ import type { Command, HigherOrderCommand } from '@atlaskit/editor-common/types'
11
11
  */
12
12
  declare const isNthParentOfType: (nodeType: string, depthAway: number) => (state: EditorState, view?: EditorView) => boolean;
13
13
  declare const withScrollIntoView: HigherOrderCommand;
14
- /**
15
- * Insert content, delete a range and create a new selection
16
- * This function automatically handles the mapping of positions for insertion and deletion.
17
- * The new selection is handled as a function since it may not always be necessary to resolve a position to the transactions mapping
18
- *
19
- * @param getSelectionResolvedPos get the resolved position to create a new selection
20
- * @param insertions content to insert at the specified position
21
- * @param deletions the ranges to delete
22
- */
23
- declare const selectNode: (pos: number) => Command;
24
- export { isNthParentOfType, withScrollIntoView, selectNode };
14
+ export { isNthParentOfType, withScrollIntoView };
@@ -6,10 +6,6 @@ import type { Transformer, ReplaceRawValue } from '@atlaskit/editor-common/types
6
6
  import type { DispatchAnalyticsEvent } from '../plugins/analytics/types/dispatch-analytics-event';
7
7
  import type { BreakoutMarkAttrs } from '@atlaskit/adf-schema';
8
8
  export { findFarthestParentNode } from '@atlaskit/editor-common/utils';
9
- /**
10
- * Checks if a node has any content. Ignores node that only contain empty block nodes.
11
- */
12
- export declare function isNodeEmpty(node?: Node): boolean;
13
9
  export declare function isInEmptyLine(state: EditorState): boolean;
14
10
  export declare function processRawFragmentValue(schema: Schema, value?: ReplaceRawValue[], providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Fragment | undefined;
15
11
  export type ChangedFn = (node: Node, pos: number, parent: Node | null, index: number) => boolean | void;
@@ -3,7 +3,7 @@ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state'
3
3
  import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
4
4
  export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem, } from '@atlaskit/editor-common/utils';
5
5
  export { insideTable } from '@atlaskit/editor-common/core-utils';
6
- export { isNodeEmpty, findFarthestParentNode, nodesBetweenChanged, getNodesCount, } from './document';
6
+ export { findFarthestParentNode, nodesBetweenChanged, getNodesCount, } from './document';
7
7
  export { isParagraph, isText, isLinkMark } from './nodes';
8
8
  export { setNodeSelection, setTextSelection } from './selection';
9
9
  export type { JSONDocNode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.44.2",
3
+ "version": "187.44.4",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/code": "^14.6.0",
56
56
  "@atlaskit/date": "^0.10.0",
57
57
  "@atlaskit/datetime-picker": "^12.10.0",
58
- "@atlaskit/editor-common": "^75.2.0",
58
+ "@atlaskit/editor-common": "^75.3.0",
59
59
  "@atlaskit/editor-json-transformer": "^8.10.0",
60
60
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
61
61
  "@atlaskit/editor-palette": "1.5.1",
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "atTheBeginningOfBlock", {
7
- enumerable: true,
8
- get: function get() {
9
- return _selection.atTheBeginningOfBlock;
10
- }
11
- });
12
- Object.defineProperty(exports, "atTheBeginningOfDoc", {
13
- enumerable: true,
14
- get: function get() {
15
- return _selection.atTheBeginningOfDoc;
16
- }
17
- });
18
- Object.defineProperty(exports, "atTheEndOfBlock", {
19
- enumerable: true,
20
- get: function get() {
21
- return _selection.atTheEndOfBlock;
22
- }
23
- });
24
- Object.defineProperty(exports, "atTheEndOfDoc", {
25
- enumerable: true,
26
- get: function get() {
27
- return _selection.atTheEndOfDoc;
28
- }
29
- });
30
- Object.defineProperty(exports, "endPositionOfParent", {
31
- enumerable: true,
32
- get: function get() {
33
- return _selection.endPositionOfParent;
34
- }
35
- });
36
- Object.defineProperty(exports, "startPositionOfParent", {
37
- enumerable: true,
38
- get: function get() {
39
- return _selection.startPositionOfParent;
40
- }
41
- });
42
- var _selection = require("@atlaskit/editor-common/selection");