@atlaskit/editor-core 187.20.0 → 187.21.0

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 (78) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/plugins/annotation/commands/index.js +13 -1
  3. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +9 -2
  4. package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +4 -0
  5. package/dist/cjs/plugins/annotation/pm-plugins/types.js +1 -0
  6. package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +2 -0
  7. package/dist/cjs/plugins/annotation/utils.js +1 -1
  8. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +28 -10
  9. package/dist/cjs/plugins/media/styles.js +1 -1
  10. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +25 -5
  11. package/dist/cjs/plugins/media/utils/media-single.js +21 -2
  12. package/dist/cjs/version-wrapper.js +1 -1
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/plugins/annotation/commands/index.js +9 -0
  15. package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +10 -3
  16. package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +5 -0
  17. package/dist/es2019/plugins/annotation/pm-plugins/types.js +1 -0
  18. package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +3 -1
  19. package/dist/es2019/plugins/annotation/utils.js +1 -1
  20. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +21 -3
  21. package/dist/es2019/plugins/media/styles.js +8 -2
  22. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +22 -3
  23. package/dist/es2019/plugins/media/utils/media-single.js +21 -2
  24. package/dist/es2019/version-wrapper.js +1 -1
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/plugins/annotation/commands/index.js +11 -0
  27. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +10 -3
  28. package/dist/esm/plugins/annotation/pm-plugins/reducer.js +4 -0
  29. package/dist/esm/plugins/annotation/pm-plugins/types.js +1 -0
  30. package/dist/esm/plugins/annotation/ui/InlineCommentView.js +3 -1
  31. package/dist/esm/plugins/annotation/utils.js +1 -1
  32. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +21 -3
  33. package/dist/esm/plugins/media/styles.js +1 -1
  34. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +25 -5
  35. package/dist/esm/plugins/media/utils/media-single.js +20 -2
  36. package/dist/esm/version-wrapper.js +1 -1
  37. package/dist/esm/version.json +1 -1
  38. package/dist/types/actions/index.d.ts +2 -3
  39. package/dist/types/plugins/annotation/commands/index.d.ts +1 -0
  40. package/dist/types/plugins/annotation/pm-plugins/types.d.ts +7 -1
  41. package/dist/types/plugins/annotation/types.d.ts +4 -0
  42. package/dist/types/plugins/annotation/update-provider.d.ts +1 -1
  43. package/dist/types/plugins/collab-edit/actions.d.ts +1 -1
  44. package/dist/types/plugins/collab-edit/events/handlers.d.ts +2 -2
  45. package/dist/types/plugins/collab-edit/events/initialize.d.ts +1 -1
  46. package/dist/types/plugins/collab-edit/events/send-transaction.d.ts +1 -1
  47. package/dist/types/plugins/collab-edit/index.d.ts +1 -1
  48. package/dist/types/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
  49. package/dist/types/plugins/collab-edit/participants.d.ts +1 -1
  50. package/dist/types/plugins/collab-edit/plugin.d.ts +5 -6
  51. package/dist/types/plugins/collab-edit/types.d.ts +1 -2
  52. package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +2 -2
  53. package/dist/types/plugins/collab-edit/utils.d.ts +1 -2
  54. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +6 -1
  55. package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -1
  56. package/dist/types/plugins/media/utils/media-single.d.ts +2 -1
  57. package/dist/types-ts4.5/actions/index.d.ts +2 -3
  58. package/dist/types-ts4.5/plugins/annotation/commands/index.d.ts +1 -0
  59. package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +7 -1
  60. package/dist/types-ts4.5/plugins/annotation/types.d.ts +4 -0
  61. package/dist/types-ts4.5/plugins/annotation/update-provider.d.ts +1 -1
  62. package/dist/types-ts4.5/plugins/collab-edit/actions.d.ts +1 -1
  63. package/dist/types-ts4.5/plugins/collab-edit/events/handlers.d.ts +2 -2
  64. package/dist/types-ts4.5/plugins/collab-edit/events/initialize.d.ts +1 -1
  65. package/dist/types-ts4.5/plugins/collab-edit/events/send-transaction.d.ts +1 -1
  66. package/dist/types-ts4.5/plugins/collab-edit/index.d.ts +1 -1
  67. package/dist/types-ts4.5/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
  68. package/dist/types-ts4.5/plugins/collab-edit/participants.d.ts +1 -1
  69. package/dist/types-ts4.5/plugins/collab-edit/plugin.d.ts +5 -6
  70. package/dist/types-ts4.5/plugins/collab-edit/types.d.ts +1 -2
  71. package/dist/types-ts4.5/plugins/collab-edit/ui/to-avatar.d.ts +2 -2
  72. package/dist/types-ts4.5/plugins/collab-edit/utils.d.ts +1 -2
  73. package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +6 -1
  74. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -1
  75. package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +2 -1
  76. package/package.json +3 -3
  77. package/report.api.md +8 -2
  78. package/tmp/api-report-tmp.d.ts +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`560ce4c7a2b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/560ce4c7a2b) - Pass annotations list to inline comment component
8
+
9
+ ## 187.20.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`24f092238be`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24f092238be) - NO-ISSUE Switch collab type imports in editor-core to editor-common
14
+ - [`469b5c12303`](https://bitbucket.org/atlassian/atlassian-frontend/commits/469b5c12303) - NO-ISSUE Move CollabEventLocalStepData to editor-common
15
+ - [`c2cd174b721`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2cd174b721) - - Add layout calculation in full width editor
16
+ - Prevent scroll bar for wrapped layout in small viewport
17
+ - Limit resizing for nested node with wrapped layout
18
+ - Update size state for full-width layout to avoid flicker when first resizing
19
+ - [`da58165fe10`](https://bitbucket.org/atlassian/atlassian-frontend/commits/da58165fe10) - [ux] ED-19440 - Adds dark mode icons for bullet list, numbered list, quote, status and table
20
+
3
21
  ## 187.20.0
4
22
 
5
23
  ### Minor Changes
@@ -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.updateMouseState = exports.updateInlineCommentResolvedState = exports.setInlineCommentsVisibility = exports.setInlineCommentDraftState = exports.removeInlineCommentNearSelection = exports.createAnnotation = exports.closeComponent = exports.clearDirtyMark = exports.addInlineComment = void 0;
7
+ exports.updateMouseState = exports.updateInlineCommentResolvedState = exports.setSelectedAnnotation = exports.setInlineCommentsVisibility = exports.setInlineCommentDraftState = exports.removeInlineCommentNearSelection = exports.createAnnotation = exports.closeComponent = exports.clearDirtyMark = exports.addInlineComment = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _pluginFactory = require("../pm-plugins/plugin-factory");
@@ -113,6 +113,18 @@ var updateMouseState = function updateMouseState(mouseData) {
113
113
  });
114
114
  };
115
115
  exports.updateMouseState = updateMouseState;
116
+ var setSelectedAnnotation = function setSelectedAnnotation(id) {
117
+ return (0, _pluginFactory.createCommand)({
118
+ type: _types.ACTIONS.SET_SELECTED_ANNOTATION,
119
+ data: {
120
+ selectedAnnotations: [{
121
+ id: id,
122
+ type: _adfSchema.AnnotationTypes.INLINE_COMMENT
123
+ }]
124
+ }
125
+ });
126
+ };
127
+ exports.setSelectedAnnotation = setSelectedAnnotation;
116
128
  var createAnnotation = function createAnnotation(id) {
117
129
  var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.AnnotationTypes.INLINE_COMMENT;
118
130
  return function (state, dispatch) {
@@ -154,9 +154,16 @@ var inlineCommentPlugin = function inlineCommentPlugin(options) {
154
154
  var setVisibility = function setVisibility(isVisible) {
155
155
  return onSetVisibility(editorView)(isVisible);
156
156
  };
157
+ var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
158
+ if (!annotationId) {
159
+ (0, _commands.closeComponent)()(editorView.state, editorView.dispatch);
160
+ } else {
161
+ (0, _commands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
162
+ }
163
+ };
157
164
  var updateSubscriber = provider.updateSubscriber;
158
165
  if (updateSubscriber) {
159
- updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility);
166
+ updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility).on('setselectedannotation', setSelectedAnnotationFn);
160
167
  }
161
168
  editorView.root.addEventListener('mouseup', mouseUp);
162
169
  return {
@@ -172,7 +179,7 @@ var inlineCommentPlugin = function inlineCommentPlugin(options) {
172
179
  destroy: function destroy() {
173
180
  editorView.root.removeEventListener('mouseup', mouseUp);
174
181
  if (updateSubscriber) {
175
- updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility);
182
+ updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility).off('setselectedannotation', setSelectedAnnotationFn);
176
183
  }
177
184
  }
178
185
  };
@@ -48,6 +48,10 @@ var _default = function _default(pluginState, action) {
48
48
  return _objectSpread(_objectSpread({}, isVisible ? pluginState : getNewDraftState(pluginState, false)), {}, {
49
49
  isVisible: isVisible
50
50
  });
51
+ case _types.ACTIONS.SET_SELECTED_ANNOTATION:
52
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
53
+ selectedAnnotations: (0, _toConsumableArray2.default)(action.data.selectedAnnotations)
54
+ });
51
55
  default:
52
56
  return pluginState;
53
57
  }
@@ -12,6 +12,7 @@ var ACTIONS = /*#__PURE__*/function (ACTIONS) {
12
12
  ACTIONS[ACTIONS["ADD_INLINE_COMMENT"] = 4] = "ADD_INLINE_COMMENT";
13
13
  ACTIONS[ACTIONS["INLINE_COMMENT_SET_VISIBLE"] = 5] = "INLINE_COMMENT_SET_VISIBLE";
14
14
  ACTIONS[ACTIONS["CLOSE_COMPONENT"] = 6] = "CLOSE_COMPONENT";
15
+ ACTIONS[ACTIONS["SET_SELECTED_ANNOTATION"] = 7] = "SET_SELECTED_ANNOTATION";
15
16
  return ACTIONS;
16
17
  }({});
17
18
  exports.ACTIONS = ACTIONS;
@@ -46,6 +46,7 @@ function InlineCommentView(_ref) {
46
46
  bookmark = _ref2.bookmark,
47
47
  selectedAnnotations = _ref2.selectedAnnotations,
48
48
  annotations = _ref2.annotations;
49
+ var annotationsList = (0, _utils2.getAllAnnotations)(editorView.state.doc);
49
50
  var selection = (0, _utils2.getSelectionPositions)(state, inlineCommentState);
50
51
  var position = findPosForDOM(selection);
51
52
  var dom;
@@ -134,6 +135,7 @@ function InlineCommentView(_ref) {
134
135
  key: (0, _utils2.getAnnotationViewKey)(activeAnnotations),
135
136
  onViewed: onAnnotationViewed
136
137
  }, /*#__PURE__*/_react.default.createElement(ViewComponent, {
138
+ annotationsList: annotationsList,
137
139
  annotations: activeAnnotations,
138
140
  dom: dom,
139
141
  onDelete: function onDelete(id) {
@@ -77,7 +77,7 @@ var getAllAnnotations = function getAllAnnotations(doc) {
77
77
  node.marks.filter(function (mark) {
78
78
  return mark.type.name === 'annotation';
79
79
  })
80
- // filter out annotations with invalid attribues as they cause errors when interacting with them
80
+ // filter out annotations with invalid attributes as they cause errors when interacting with them
81
81
  .filter(validateAnnotationMark).forEach(function (m) {
82
82
  return allAnnotationIds.add(m.attrs.id);
83
83
  });
@@ -24,6 +24,7 @@ var _ui = require("@atlaskit/editor-common/ui");
24
24
  var _utils = require("@atlaskit/editor-common/utils");
25
25
  var _nodes = require("../../../utils/nodes");
26
26
  var _utils2 = require("../../../utils");
27
+ var _mediaSingle = require("../utils/media-single");
27
28
  var _ResizableMediaSingleNext = _interopRequireDefault(require("../ui/ResizableMediaSingle/ResizableMediaSingleNext"));
28
29
  var _ResizableMediaSingle = _interopRequireDefault(require("../ui/ResizableMediaSingle"));
29
30
  var _main = require("../pm-plugins/main");
@@ -39,7 +40,7 @@ var _CaptionPlaceholder = _interopRequireDefault(require("../ui/CaptionPlacehold
39
40
  var _state = require("@atlaskit/editor-prosemirror/state");
40
41
  var _captions = require("../commands/captions");
41
42
  var _hooks = require("@atlaskit/editor-common/hooks");
42
- var _mediaSingle = require("@atlaskit/editor-common/media-single");
43
+ var _mediaSingle2 = require("@atlaskit/editor-common/media-single");
43
44
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
44
45
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
45
46
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -254,13 +255,12 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
254
255
  * Get parent width for a nested media single node
255
256
  * @param view Editor view
256
257
  * @param pos node position
257
- * @param includeMoreParentNodeTypes should consider table and list as parent nodes(only true for new experience)
258
258
  */
259
259
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLineLength", function (view, pos, includeMoreParentNodeTypes) {
260
260
  if (typeof pos !== 'number') {
261
261
  return null;
262
262
  }
263
- if ((0, _utils.isRichMediaInsideOfBlockNode)(view, pos, includeMoreParentNodeTypes)) {
263
+ if ((0, _utils.isRichMediaInsideOfBlockNode)(view, pos)) {
264
264
  var $pos = view.state.doc.resolve(pos);
265
265
  var domNode = view.nodeDOM($pos.pos);
266
266
  if ($pos.nodeAfter && _utils.floatingLayouts.indexOf($pos.nodeAfter.attrs.layout) > -1 && domNode && domNode.parentElement) {
@@ -272,6 +272,21 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
272
272
  }
273
273
  return null;
274
274
  });
275
+ /**
276
+ * Get parent width for a nested media single node for new experience
277
+ * @param view Editor view
278
+ * @param pos node position
279
+ */
280
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLineLengthNext", function (view, pos) {
281
+ if (typeof pos !== 'number') {
282
+ return null;
283
+ }
284
+ var $pos = view.state.doc.resolve(pos);
285
+ if ($pos && $pos.parent.type.name !== 'doc') {
286
+ return (0, _mediaSingle.getParentWidthForNestedMediaSingleNode)($pos, view);
287
+ }
288
+ return null;
289
+ });
275
290
  return _this;
276
291
  }
277
292
  (0, _createClass2.default)(MediaSingleNode, [{
@@ -361,19 +376,19 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
361
376
  stateWidth = _this$state.width,
362
377
  stateHeight = _this$state.height;
363
378
  if (width === null) {
364
- width = stateWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH;
379
+ width = stateWidth || _mediaSingle2.DEFAULT_IMAGE_WIDTH;
365
380
  }
366
381
  if (height === null) {
367
- height = stateHeight || _mediaSingle.DEFAULT_IMAGE_HEIGHT;
382
+ height = stateHeight || _mediaSingle2.DEFAULT_IMAGE_HEIGHT;
368
383
  }
369
384
  }
370
385
  if (!width || !height) {
371
- width = _mediaSingle.DEFAULT_IMAGE_WIDTH;
372
- height = _mediaSingle.DEFAULT_IMAGE_HEIGHT;
386
+ width = _mediaSingle2.DEFAULT_IMAGE_WIDTH;
387
+ height = _mediaSingle2.DEFAULT_IMAGE_HEIGHT;
373
388
  }
374
389
  var isSelected = selected();
375
390
  var contentWidthForLegacyExperience = this.getLineLength(view, getPos()) || lineLength;
376
- var contentWidth = this.getLineLength(view, getPos(), true) || lineLength;
391
+ var contentWidth = this.getLineLengthNext(view, getPos()) || lineLength;
377
392
  var mediaSingleProps = {
378
393
  layout: layout,
379
394
  width: width,
@@ -383,7 +398,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
383
398
  pctWidth: mediaSingleWidthAttribute,
384
399
  fullWidthMode: fullWidthMode,
385
400
  hasFallbackContainer: false,
386
- mediaSingleWidth: (0, _mediaSingle.calcMediaSinglePixelWidth)({
401
+ mediaSingleWidth: (0, _mediaSingle2.calcMediaSinglePixelWidth)({
387
402
  width: mediaSingleWidthAttribute,
388
403
  widthType: widthType,
389
404
  origWidth: width,
@@ -392,7 +407,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
392
407
  // thus we use the legecy value (exclude table as container node)
393
408
  contentWidth: contentWidthForLegacyExperience,
394
409
  containerWidth: containerWidth,
395
- gutterOffset: _mediaSingle.MEDIA_SINGLE_GUTTER_SIZE
410
+ gutterOffset: _mediaSingle2.MEDIA_SINGLE_GUTTER_SIZE
396
411
  })
397
412
  };
398
413
  var resizableMediaSingleProps = _objectSpread({
@@ -510,6 +525,9 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
510
525
  // see also: https://github.com/ProseMirror/prosemirror/issues/884
511
526
  domRef.contentEditable = 'true';
512
527
  }
528
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience')) {
529
+ domRef.classList.add('media-extended-resize-experience');
530
+ }
513
531
  return domRef;
514
532
  }
515
533
  }, {
@@ -12,7 +12,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _colors = require("@atlaskit/theme/colors");
13
13
  var _mediaCard = require("@atlaskit/media-card");
14
14
  var _templateObject;
15
- var mediaStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: 12px;\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: 12px;\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s, box-shadow 0s;\n }\n /* Danger when nested node or common */\n .danger {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* Media single video player */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* New file experience */\n .", " .", " {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n /* Media resize handlers */\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n /* Smart cards */\n div div .media-card-frame,\n .inlineCardView-content-wrap > span > a {\n background-color: ", "; /* R75 with 50% opactiy */\n transition: background-color 0s;\n }\n\n div div .media-card-frame::after {\n box-shadow: none;\n }\n }\n"])), _styles.mediaSingleSharedStyle, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPadding, _editorSharedStyles.akEditorMediaResizeHandlerPadding, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-border, ".concat(_colors.N60, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-border-focused, ".concat(_colors.B200, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), _editorSharedStyles.akEditorSelectedBorderBoldSize, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _styles.richMediaClassName, _mediaCard.fileCardImageViewSelector, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), _styles.richMediaClassName, _mediaCard.inlinePlayerClassName, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), _styles.richMediaClassName, _mediaCard.newFileExperienceClassName, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), "var(--ds-icon-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), "var(--ds-blanket-danger, rgb(255, 189, 173, 0.5))");
15
+ var mediaStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .media-extended-resize-experience[layout^='wrap-'] {\n // override 'overflow: auto' when viewport <= 410 set by mediaSingleSharedStyle\n // to prevent scroll bar\n overflow: visible !important;\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: ", ";\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: ", ";\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s, box-shadow 0s;\n }\n /* Danger when nested node or common */\n .danger {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* Media single video player */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* New file experience */\n .", " .", " {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n /* Media resize handlers */\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n /* Smart cards */\n div div .media-card-frame,\n .inlineCardView-content-wrap > span > a {\n background-color: ", "; /* R75 with 50% opactiy */\n transition: background-color 0s;\n }\n\n div div .media-card-frame::after {\n box-shadow: none;\n }\n }\n"])), _styles.mediaSingleSharedStyle, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, "var(--ds-space-150, 12px)", _editorSharedStyles.akEditorMediaResizeHandlerPadding, "var(--ds-space-150, 12px)", _editorSharedStyles.akEditorMediaResizeHandlerPadding, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-border, ".concat(_colors.N60, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-border-focused, ".concat(_colors.B200, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), _editorSharedStyles.akEditorSelectedBorderBoldSize, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _styles.richMediaClassName, _mediaCard.fileCardImageViewSelector, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), _styles.richMediaClassName, _mediaCard.inlinePlayerClassName, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), _styles.richMediaClassName, _mediaCard.newFileExperienceClassName, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), "var(--ds-icon-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), "var(--ds-blanket-danger, rgb(255, 189, 173, 0.5))");
16
16
 
17
17
  /* `left: unset` above is to work around Chrome bug where rendering a div with
18
18
  * that style applied inside a container that has a scroll, causes any svgs on
@@ -79,12 +79,13 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
79
79
  layout = _this$props2.layout,
80
80
  state = _this$props2.view.state,
81
81
  containerWidth = _this$props2.containerWidth,
82
- lineLength = _this$props2.lineLength;
82
+ lineLength = _this$props2.lineLength,
83
+ fullWidthMode = _this$props2.fullWidthMode;
83
84
  var newPct = (0, _ui.calcPctFromPx)(newWidth, _this.props.lineLength) * 100;
84
85
  _this.setState({
85
86
  resizedPctWidth: newPct
86
87
  });
87
- var newLayout = (0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) ? layout : _this.calcUnwrappedLayout(newWidth, containerWidth, lineLength);
88
+ var newLayout = (0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) ? layout : _this.calcUnwrappedLayout(newWidth, containerWidth, lineLength, fullWidthMode);
88
89
  if (newPct <= 100) {
89
90
  if (_this.wrappedLayout && (stop ? newPct !== 100 : true)) {
90
91
  newLayout = layout;
@@ -100,7 +101,13 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
100
101
  };
101
102
  }
102
103
  });
103
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calcUnwrappedLayout", function (width, containerWidth, contentWidth) {
104
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calcUnwrappedLayout", function (width, containerWidth, contentWidth, fullWidthMode) {
105
+ if (fullWidthMode) {
106
+ if (width < contentWidth) {
107
+ return 'center';
108
+ }
109
+ return 'full-width';
110
+ }
104
111
  if (width <= contentWidth) {
105
112
  return 'center';
106
113
  }
@@ -290,6 +297,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
290
297
  }, {
291
298
  key: "componentDidUpdate",
292
299
  value: function componentDidUpdate(prevProps) {
300
+ var _this2 = this;
293
301
  var offsetLeft = (0, _mediaSingle.calculateOffsetLeft)(this.insideInlineLike, this.insideLayout, this.props.view.dom, this.wrapper);
294
302
  if (offsetLeft !== this.state.offsetLeft && offsetLeft >= 0) {
295
303
  this.setState({
@@ -315,6 +323,18 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
315
323
  }
316
324
  });
317
325
  }
326
+ if (this.props.layout === 'full-width' && !this.isNestedNode() && prevProps.containerWidth !== this.props.containerWidth) {
327
+ // To achieve edge-to-edge for full-width, we need to update its width according to containerWidth
328
+ // Update state to allow resizer to get most up-to-date width to avoid jumping when start resizing
329
+ this.setState(function (prevState) {
330
+ return {
331
+ size: {
332
+ width: (0, _mediaSingle.calcMediaSingleMaxWidth)(_this2.props.containerWidth),
333
+ height: prevState.size.height
334
+ }
335
+ };
336
+ });
337
+ }
318
338
  return true;
319
339
  }
320
340
 
@@ -474,7 +494,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
474
494
  }, {
475
495
  key: "render",
476
496
  value: function render() {
477
- var _this2 = this;
497
+ var _this3 = this;
478
498
  var _this$props8 = this.props,
479
499
  origWidth = _this$props8.width,
480
500
  layout = _this$props8.layout,
@@ -491,7 +511,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
491
511
  _ui.handleSides.forEach(function (side) {
492
512
  var oppositeSide = side === 'left' ? 'right' : 'left';
493
513
  enable[side] = _utils2.nonWrappedLayouts.concat("wrap-".concat(oppositeSide)).concat("align-".concat(_ui.imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
494
- if (side === 'left' && _this2.insideInlineLike) {
514
+ if (side === 'left' && _this3.insideInlineLike) {
495
515
  enable[side] = false;
496
516
  }
497
517
  });
@@ -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.insertMediaSingleNode = exports.insertMediaAsMediaSingle = exports.createMediaSingleNode = void 0;
7
+ exports.insertMediaSingleNode = exports.insertMediaAsMediaSingle = exports.getParentWidthForNestedMediaSingleNode = exports.createMediaSingleNode = void 0;
8
8
  exports.isCaptionNode = isCaptionNode;
9
9
  exports.isMediaSingle = void 0;
10
10
  exports.transformSliceForMedia = transformSliceForMedia;
@@ -223,4 +223,23 @@ function isCaptionNode(editorView) {
223
223
  return true;
224
224
  }
225
225
  return false;
226
- }
226
+ }
227
+ var getParentWidthForNestedMediaSingleNode = function getParentWidthForNestedMediaSingleNode(resolvedPos, view) {
228
+ var domNode = view.nodeDOM(resolvedPos.pos);
229
+ if (resolvedPos.nodeAfter && _utils3.floatingLayouts.includes(resolvedPos.nodeAfter.attrs.layout) && domNode && domNode.parentElement) {
230
+ var _view$state$schema$no = view.state.schema.nodes,
231
+ tableCell = _view$state$schema$no.tableCell,
232
+ tableHeader = _view$state$schema$no.tableHeader;
233
+ if ([tableCell, tableHeader].includes(resolvedPos.parent.type)) {
234
+ // since table has constant padding, use hardcoded constant instead of query the dom
235
+ var tablePadding = 8;
236
+ return domNode.parentElement.offsetWidth - tablePadding * 2;
237
+ }
238
+ return domNode.parentElement.offsetWidth;
239
+ }
240
+ if (domNode instanceof HTMLElement) {
241
+ return domNode.offsetWidth;
242
+ }
243
+ return null;
244
+ };
245
+ exports.getParentWidthForNestedMediaSingleNode = getParentWidthForNestedMediaSingleNode;
@@ -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.20.0";
9
+ var version = "187.21.0";
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.20.0",
3
+ "version": "187.21.0",
4
4
  "sideEffects": false
5
5
  }
@@ -91,6 +91,15 @@ export const updateMouseState = mouseData => createCommand({
91
91
  mouseData
92
92
  }
93
93
  });
94
+ export const setSelectedAnnotation = id => createCommand({
95
+ type: ACTIONS.SET_SELECTED_ANNOTATION,
96
+ data: {
97
+ selectedAnnotations: [{
98
+ id,
99
+ type: AnnotationTypes.INLINE_COMMENT
100
+ }]
101
+ }
102
+ });
94
103
  export const createAnnotation = (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
95
104
  // don't try to add if there are is no temp highlight bookmarked
96
105
  const {
@@ -3,7 +3,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { AnnotationTypes } from '@atlaskit/adf-schema';
5
5
  import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
6
- import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility } from '../commands';
6
+ import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility, setSelectedAnnotation, closeComponent } from '../commands';
7
7
  import { getAllAnnotations, inlineCommentPluginKey, getPluginState } from '../utils';
8
8
  import { createPluginState } from './plugin-factory';
9
9
  const fetchProviderStates = async (provider, annotationIds) => {
@@ -97,11 +97,18 @@ export const inlineCommentPlugin = options => {
97
97
  const unResolve = annotationId => onUnResolve(editorView.state, editorView.dispatch)(annotationId);
98
98
  const mouseUp = event => onMouseUp(editorView.state, editorView.dispatch)(event);
99
99
  const setVisibility = isVisible => onSetVisibility(editorView)(isVisible);
100
+ const setSelectedAnnotationFn = annotationId => {
101
+ if (!annotationId) {
102
+ closeComponent()(editorView.state, editorView.dispatch);
103
+ } else {
104
+ setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
105
+ }
106
+ };
100
107
  const {
101
108
  updateSubscriber
102
109
  } = provider;
103
110
  if (updateSubscriber) {
104
- updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility);
111
+ updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility).on('setselectedannotation', setSelectedAnnotationFn);
105
112
  }
106
113
  editorView.root.addEventListener('mouseup', mouseUp);
107
114
  return {
@@ -118,7 +125,7 @@ export const inlineCommentPlugin = options => {
118
125
  destroy() {
119
126
  editorView.root.removeEventListener('mouseup', mouseUp);
120
127
  if (updateSubscriber) {
121
- updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility);
128
+ updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility).off('setselectedannotation', setSelectedAnnotationFn);
122
129
  }
123
130
  }
124
131
  };
@@ -51,6 +51,11 @@ export default ((pluginState, action) => {
51
51
  ...(isVisible ? pluginState : getNewDraftState(pluginState, false)),
52
52
  isVisible
53
53
  };
54
+ case ACTIONS.SET_SELECTED_ANNOTATION:
55
+ return {
56
+ ...pluginState,
57
+ selectedAnnotations: [...action.data.selectedAnnotations]
58
+ };
54
59
  default:
55
60
  return pluginState;
56
61
  }
@@ -6,5 +6,6 @@ export let ACTIONS = /*#__PURE__*/function (ACTIONS) {
6
6
  ACTIONS[ACTIONS["ADD_INLINE_COMMENT"] = 4] = "ADD_INLINE_COMMENT";
7
7
  ACTIONS[ACTIONS["INLINE_COMMENT_SET_VISIBLE"] = 5] = "INLINE_COMMENT_SET_VISIBLE";
8
8
  ACTIONS[ACTIONS["CLOSE_COMPONENT"] = 6] = "CLOSE_COMPONENT";
9
+ ACTIONS[ACTIONS["SET_SELECTED_ANNOTATION"] = 7] = "SET_SELECTED_ANNOTATION";
9
10
  return ACTIONS;
10
11
  }({});
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
3
3
  import { AnnotationViewWrapper } from './AnnotationViewWrapper';
4
4
  import { AnnotationTestIds } from '../types';
5
- import { getAnnotationViewKey, getSelectionPositions, getPluginState } from '../utils';
5
+ import { getAnnotationViewKey, getSelectionPositions, getPluginState, getAllAnnotations } from '../utils';
6
6
  import { removeInlineCommentNearSelection, updateInlineCommentResolvedState, setInlineCommentDraftState, createAnnotation, closeComponent } from '../commands';
7
7
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '../../analytics';
8
8
  import { CONTENT_COMPONENT } from '../../analytics/types';
@@ -46,6 +46,7 @@ export function InlineCommentView({
46
46
  selectedAnnotations,
47
47
  annotations
48
48
  } = inlineCommentState || {};
49
+ const annotationsList = getAllAnnotations(editorView.state.doc);
49
50
  const selection = getSelectionPositions(state, inlineCommentState);
50
51
  const position = findPosForDOM(selection);
51
52
  let dom;
@@ -132,6 +133,7 @@ export function InlineCommentView({
132
133
  key: getAnnotationViewKey(activeAnnotations),
133
134
  onViewed: onAnnotationViewed
134
135
  }, /*#__PURE__*/React.createElement(ViewComponent, {
136
+ annotationsList: annotationsList,
135
137
  annotations: activeAnnotations,
136
138
  dom: dom,
137
139
  onDelete: id => removeInlineCommentNearSelection(id)(state, dispatch),
@@ -52,7 +52,7 @@ export const getAllAnnotations = doc => {
52
52
  const allAnnotationIds = new Set();
53
53
  doc.descendants(node => {
54
54
  node.marks.filter(mark => mark.type.name === 'annotation')
55
- // filter out annotations with invalid attribues as they cause errors when interacting with them
55
+ // filter out annotations with invalid attributes as they cause errors when interacting with them
56
56
  .filter(validateAnnotationMark).forEach(m => allAnnotationIds.add(m.attrs.id));
57
57
  return true;
58
58
  });
@@ -8,6 +8,7 @@ import { MediaSingle } from '@atlaskit/editor-common/ui';
8
8
  import { browser, floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
9
9
  import { isNodeSelectedOrInRange } from '../../../utils/nodes';
10
10
  import { setNodeSelection, setTextSelection } from '../../../utils';
11
+ import { getParentWidthForNestedMediaSingleNode } from '../utils/media-single';
11
12
  import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
12
13
  import ResizableMediaSingle from '../ui/ResizableMediaSingle';
13
14
  import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
@@ -180,13 +181,12 @@ export default class MediaSingleNode extends Component {
180
181
  * Get parent width for a nested media single node
181
182
  * @param view Editor view
182
183
  * @param pos node position
183
- * @param includeMoreParentNodeTypes should consider table and list as parent nodes(only true for new experience)
184
184
  */
185
185
  _defineProperty(this, "getLineLength", (view, pos, includeMoreParentNodeTypes) => {
186
186
  if (typeof pos !== 'number') {
187
187
  return null;
188
188
  }
189
- if (isRichMediaInsideOfBlockNode(view, pos, includeMoreParentNodeTypes)) {
189
+ if (isRichMediaInsideOfBlockNode(view, pos)) {
190
190
  const $pos = view.state.doc.resolve(pos);
191
191
  const domNode = view.nodeDOM($pos.pos);
192
192
  if ($pos.nodeAfter && floatingLayouts.indexOf($pos.nodeAfter.attrs.layout) > -1 && domNode && domNode.parentElement) {
@@ -198,6 +198,21 @@ export default class MediaSingleNode extends Component {
198
198
  }
199
199
  return null;
200
200
  });
201
+ /**
202
+ * Get parent width for a nested media single node for new experience
203
+ * @param view Editor view
204
+ * @param pos node position
205
+ */
206
+ _defineProperty(this, "getLineLengthNext", (view, pos) => {
207
+ if (typeof pos !== 'number') {
208
+ return null;
209
+ }
210
+ const $pos = view.state.doc.resolve(pos);
211
+ if ($pos && $pos.parent.type.name !== 'doc') {
212
+ return getParentWidthForNestedMediaSingleNode($pos, view);
213
+ }
214
+ return null;
215
+ });
201
216
  }
202
217
  UNSAFE_componentWillReceiveProps(nextProps) {
203
218
  if (nextProps.mediaProvider !== this.props.mediaProvider) {
@@ -280,7 +295,7 @@ export default class MediaSingleNode extends Component {
280
295
  }
281
296
  const isSelected = selected();
282
297
  const contentWidthForLegacyExperience = this.getLineLength(view, getPos()) || lineLength;
283
- const contentWidth = this.getLineLength(view, getPos(), true) || lineLength;
298
+ const contentWidth = this.getLineLengthNext(view, getPos()) || lineLength;
284
299
  const mediaSingleProps = {
285
300
  layout,
286
301
  width,
@@ -411,6 +426,9 @@ class MediaSingleNodeView extends ReactNodeView {
411
426
  // see also: https://github.com/ProseMirror/prosemirror/issues/884
412
427
  domRef.contentEditable = 'true';
413
428
  }
429
+ if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
430
+ domRef.classList.add('media-extended-resize-experience');
431
+ }
414
432
  return domRef;
415
433
  }
416
434
  getContentDOM() {
@@ -11,6 +11,12 @@ export const mediaStyles = css`
11
11
  transform: translateX(-50%);
12
12
  }
13
13
 
14
+ .media-extended-resize-experience[layout^='wrap-'] {
15
+ // override 'overflow: auto' when viewport <= 410 set by mediaSingleSharedStyle
16
+ // to prevent scroll bar
17
+ overflow: visible !important;
18
+ }
19
+
14
20
  & [layout^='wrap-'] + [layout^='wrap-'] {
15
21
  clear: none;
16
22
  & + p,
@@ -72,13 +78,13 @@ export const mediaStyles = css`
72
78
 
73
79
  .richMedia-resize-handle-right {
74
80
  align-items: flex-end;
75
- padding-right: 12px;
81
+ padding-right: ${"var(--ds-space-150, 12px)"};
76
82
  margin-right: -${akEditorMediaResizeHandlerPadding}px;
77
83
  }
78
84
 
79
85
  .richMedia-resize-handle-left {
80
86
  align-items: flex-start;
81
- padding-left: 12px;
87
+ padding-left: ${"var(--ds-space-150, 12px)"};
82
88
  margin-left: -${akEditorMediaResizeHandlerPadding}px;
83
89
  }
84
90