@atlaskit/editor-core 187.8.11 → 187.9.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 (73) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/plugins/floating-toolbar/index.js +1 -3
  3. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +33 -23
  4. package/dist/cjs/plugins/media/toolbar/index.js +16 -2
  5. package/dist/cjs/plugins/media/toolbar/utils.js +7 -2
  6. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +574 -0
  7. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/guidelines.js +117 -0
  8. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +15 -0
  9. package/dist/cjs/ui/ElementBrowser/components/ElementSearch.js +5 -3
  10. package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
  11. package/dist/cjs/ui/Resizer/ResizeLabel/index.js +20 -0
  12. package/dist/cjs/ui/Resizer/ResizeLabel/styles.js +17 -0
  13. package/dist/cjs/version-wrapper.js +1 -1
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/es2019/plugins/floating-toolbar/index.js +1 -1
  16. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +34 -23
  17. package/dist/es2019/plugins/media/toolbar/index.js +19 -3
  18. package/dist/es2019/plugins/media/toolbar/utils.js +7 -1
  19. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +493 -0
  20. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/guidelines.js +108 -0
  21. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +8 -0
  22. package/dist/es2019/ui/ElementBrowser/components/ElementSearch.js +5 -3
  23. package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +9 -6
  24. package/dist/es2019/ui/Resizer/ResizeLabel/index.js +12 -0
  25. package/dist/es2019/ui/Resizer/ResizeLabel/styles.js +25 -0
  26. package/dist/es2019/version-wrapper.js +1 -1
  27. package/dist/es2019/version.json +1 -1
  28. package/dist/esm/plugins/floating-toolbar/index.js +1 -3
  29. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +33 -23
  30. package/dist/esm/plugins/media/toolbar/index.js +17 -3
  31. package/dist/esm/plugins/media/toolbar/utils.js +5 -1
  32. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +564 -0
  33. package/dist/esm/plugins/media/ui/ResizableMediaSingle/guidelines.js +108 -0
  34. package/dist/esm/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +8 -0
  35. package/dist/esm/ui/ElementBrowser/components/ElementSearch.js +5 -3
  36. package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
  37. package/dist/esm/ui/Resizer/ResizeLabel/index.js +12 -0
  38. package/dist/esm/ui/Resizer/ResizeLabel/styles.js +7 -0
  39. package/dist/esm/version-wrapper.js +1 -1
  40. package/dist/esm/version.json +1 -1
  41. package/dist/types/labs/next/presets/universal.d.ts +1 -2
  42. package/dist/types/plugins/floating-toolbar/index.d.ts +3 -1
  43. package/dist/types/plugins/media/index.d.ts +2 -0
  44. package/dist/types/plugins/media/nodeviews/styles.d.ts +1 -1
  45. package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -1
  46. package/dist/types/plugins/media/toolbar/utils.d.ts +1 -0
  47. package/dist/types/plugins/media/types.d.ts +1 -0
  48. package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +61 -0
  49. package/dist/types/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +4 -0
  50. package/dist/types/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +7 -0
  51. package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -0
  52. package/dist/types/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
  53. package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
  54. package/dist/types/ui/Resizer/ResizeLabel/index.d.ts +8 -0
  55. package/dist/types/ui/Resizer/ResizeLabel/styles.d.ts +3 -0
  56. package/dist/types-ts4.5/labs/next/presets/universal.d.ts +1 -2
  57. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
  58. package/dist/types-ts4.5/plugins/media/index.d.ts +2 -0
  59. package/dist/types-ts4.5/plugins/media/nodeviews/styles.d.ts +1 -1
  60. package/dist/types-ts4.5/plugins/media/pm-plugins/main.d.ts +1 -1
  61. package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +1 -0
  62. package/dist/types-ts4.5/plugins/media/types.d.ts +1 -0
  63. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +61 -0
  64. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +4 -0
  65. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +7 -0
  66. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -0
  67. package/dist/types-ts4.5/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
  68. package/dist/types-ts4.5/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
  69. package/dist/types-ts4.5/ui/Resizer/ResizeLabel/index.d.ts +8 -0
  70. package/dist/types-ts4.5/ui/Resizer/ResizeLabel/styles.d.ts +3 -0
  71. package/package.json +2 -2
  72. package/report.api.md +7 -4
  73. package/tmp/api-report-tmp.d.ts +5 -1
@@ -49,7 +49,8 @@ const baseSidebarStyles = css`
49
49
  const mobileSideBar = css`
50
50
  ${baseSidebarStyles};
51
51
  flex: 0 0 ${INLINE_SIDEBAR_HEIGHT};
52
- padding: 12px 12px 0 12px;
52
+ padding: ${"var(--ds-space-150, 12px)"} ${"var(--ds-space-150, 12px)"} 0
53
+ ${"var(--ds-space-150, 12px)"};
53
54
  `;
54
55
  const mobileSideBarShowCategories = css`
55
56
  flex: 0 0 auto;
@@ -111,6 +112,7 @@ function StatelessElementBrowser(props) {
111
112
  const {
112
113
  items,
113
114
  onSelectItem,
115
+ onInsertItem,
114
116
  viewMoreItem
115
117
  } = props;
116
118
  const {
@@ -160,10 +162,11 @@ function StatelessElementBrowser(props) {
160
162
  if (e.key !== 'Enter') {
161
163
  return;
162
164
  }
163
- if (onSelectItem && selectedItem != null) {
164
- onSelectItem(selectedItem);
165
+ if (onInsertItem && selectedItem != null) {
166
+ onInsertItem(selectedItem);
165
167
  }
166
- }, [onSelectItem, selectedItem]);
168
+ e.preventDefault();
169
+ }, [onInsertItem, selectedItem]);
167
170
 
168
171
  /**
169
172
  * On arrow key selection and clicks the selectedItemIndex will change.
@@ -225,13 +228,13 @@ function MobileBrowser({
225
228
  }) {
226
229
  return jsx("div", {
227
230
  css: mobileElementBrowserContainer,
228
- onKeyPress: onKeyPress,
229
231
  onKeyDown: onKeyDown,
230
232
  "data-testid": "mobile__element-browser"
231
233
  }, jsx("div", {
232
234
  css: showCategories ? [mobileSideBar, mobileSideBarShowCategories] : mobileSideBar
233
235
  }, showSearch && jsx(ElementSearch, {
234
236
  onSearch: onSearch,
237
+ onKeyDown: onKeyPress,
235
238
  mode: mode,
236
239
  focus: focusOnSearch,
237
240
  onClick: setFocusOnSearch,
@@ -305,13 +308,13 @@ function DesktopBrowser({
305
308
  createAnalyticsEvent: createAnalyticsEvent
306
309
  }))), jsx("div", {
307
310
  css: mainContent,
308
- onKeyPress: onKeyPress,
309
311
  onKeyDown: onKeyDown,
310
312
  "data-testid": "main-content"
311
313
  }, showSearch && jsx("div", {
312
314
  css: searchContainer
313
315
  }, jsx(ElementSearch, {
314
316
  onSearch: onSearch,
317
+ onKeyDown: onKeyPress,
315
318
  mode: mode,
316
319
  focus: focusOnSearch,
317
320
  onClick: setFocusOnSearch,
@@ -0,0 +1,12 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { wrapper, text, smallText } from './styles';
4
+ const ResizeLabelBreakoutWidth = 110;
5
+ const ResizeLabel = props => {
6
+ return jsx("div", {
7
+ css: wrapper
8
+ }, jsx("span", {
9
+ css: [text, props.containerWidth < ResizeLabelBreakoutWidth && smallText]
10
+ }, props.label));
11
+ };
12
+ export default ResizeLabel;
@@ -0,0 +1,25 @@
1
+ import { css } from '@emotion/react';
2
+ import { B300 } from '@atlaskit/theme/colors';
3
+ export const wrapper = css`
4
+ font-size: ${"var(--ds-font-size-100, 14px)"};
5
+ width: 100%;
6
+ text-align: center;
7
+ position: absolute;
8
+ transform: translateY(-125%);
9
+ top: 0;
10
+ `;
11
+ export const text = css`
12
+ display: inline-block;
13
+ border-radius: 6px;
14
+ min-width: 75px;
15
+ background-color: ${`var(--ds-text-accent-blue, ${B300})`};
16
+ color: ${"var(--ds-text-inverse, white)"};
17
+ padding: ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-200, 16px)"};
18
+ letter-spacing: 0.5px;
19
+ `;
20
+ export const smallText = css`
21
+ letter-spacing: -0.5px;
22
+ font-size: ${"var(--ds-font-size-050, 8px)"};
23
+ min-width: 27px;
24
+ padding: ${"var(--ds-space-0, 0px)"} ${"var(--ds-space-025, 2px)"};
25
+ `;
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.8.11";
2
+ export const version = "187.9.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.8.11",
3
+ "version": "187.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -323,9 +323,7 @@ function floatingToolbarPluginFactory(options) {
323
323
  return relevantConfig;
324
324
  };
325
325
  var apply = function apply(tr, pluginState) {
326
- var newPluginState = {
327
- getConfigWithNodeInfo: getConfigWithNodeInfo
328
- };
326
+ var newPluginState = _objectSpread({}, pluginState);
329
327
  dispatch(pluginKey, newPluginState);
330
328
  return newPluginState;
331
329
  };
@@ -1,5 +1,4 @@
1
1
  import _get from "@babel/runtime/helpers/get";
2
- import _extends from "@babel/runtime/helpers/extends";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -21,6 +20,7 @@ import { MediaSingle, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaski
21
20
  import { browser, floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
22
21
  import { isNodeSelectedOrInRange } from '../../../utils/nodes';
23
22
  import { setNodeSelection, setTextSelection } from '../../../utils';
23
+ import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
24
24
  import ResizableMediaSingle from '../ui/ResizableMediaSingle';
25
25
  import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
26
26
  import { MediaNodeUpdater } from './mediaNodeUpdater';
@@ -35,6 +35,8 @@ import CaptionPlaceholder from '../ui/CaptionPlaceholder';
35
35
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
36
36
  import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
37
37
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
38
+ import { getMediaSinglePixelWidth } from '@atlaskit/editor-common/media-single';
39
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
38
40
  var MediaSingleNode = /*#__PURE__*/function (_Component) {
39
41
  _inherits(MediaSingleNode, _Component);
40
42
  var _super = _createSuper(MediaSingleNode);
@@ -199,7 +201,8 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
199
201
  }
200
202
  var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, _this.props.node.attrs), {}, {
201
203
  layout: layout,
202
- width: width
204
+ width: width,
205
+ widthType: 'pixel'
203
206
  }));
204
207
  tr.setMeta('scrollIntoView', false);
205
208
  /**
@@ -311,12 +314,19 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
311
314
  mediaOptions = _this$props2.mediaOptions,
312
315
  fullWidthMode = _this$props2.fullWidthMode,
313
316
  state = _this$props2.view.state,
314
- view = _this$props2.view;
317
+ view = _this$props2.view,
318
+ pluginInjectionApi = _this$props2.pluginInjectionApi,
319
+ containerWidth = _this$props2.width,
320
+ lineLength = _this$props2.lineLength,
321
+ dispatchAnalyticsEvent = _this$props2.dispatchAnalyticsEvent;
315
322
  var _ref4 = node.attrs,
316
323
  layout = _ref4.layout,
317
- mediaSingleWidth = _ref4.width;
324
+ widthType = _ref4.widthType,
325
+ mediaSingleWidthAttribute = _ref4.width;
318
326
  var childNode = node.firstChild;
319
327
  var attrs = childNode.attrs;
328
+
329
+ // original width and height of child media node (scaled)
320
330
  var width = attrs.width,
321
331
  height = attrs.height;
322
332
  if (attrs.type === 'external') {
@@ -343,16 +353,29 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
343
353
  width = DEFAULT_IMAGE_WIDTH;
344
354
  height = DEFAULT_IMAGE_HEIGHT;
345
355
  }
356
+ var isSelected = selected();
346
357
  var mediaSingleProps = {
347
358
  layout: layout,
348
359
  width: width,
349
360
  height: height,
350
- containerWidth: this.props.width,
351
- lineLength: this.props.lineLength,
352
- pctWidth: mediaSingleWidth,
361
+ containerWidth: containerWidth,
362
+ lineLength: this.getLineLength(view, getPos()) || lineLength,
363
+ pctWidth: mediaSingleWidthAttribute,
353
364
  fullWidthMode: fullWidthMode,
354
- hasFallbackContainer: false
365
+ hasFallbackContainer: false,
366
+ mediaSingleWidth: mediaSingleWidthAttribute && getMediaSinglePixelWidth(mediaSingleWidthAttribute, lineLength, widthType)
355
367
  };
368
+ var ResizableMediaSingleProps = _objectSpread({
369
+ view: view,
370
+ getPos: getPos,
371
+ updateSize: this.updateSize,
372
+ gridSize: 12,
373
+ viewMediaClientConfig: this.state.viewMediaClientConfig,
374
+ allowBreakoutSnapPoints: mediaOptions && mediaOptions.allowBreakoutSnapPoints,
375
+ selected: isSelected,
376
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
377
+ pluginInjectionApi: pluginInjectionApi
378
+ }, mediaSingleProps);
356
379
  var canResize = !!this.props.mediaOptions.allowResizing;
357
380
  if (!this.props.mediaOptions.allowResizingInTables) {
358
381
  // If resizing not allowed in tables, check parents for tables
@@ -364,12 +387,10 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
364
387
  canResize = canResize && !disabledNode;
365
388
  }
366
389
  }
367
- var lineLength = this.getLineLength(view, getPos()) || this.props.lineLength;
368
- var isSelected = selected();
369
390
  var shouldShowPlaceholder = getMediaFeatureFlag('captions', mediaOptions.featureFlags) && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
370
391
  var MediaChildren = jsx("figure", {
371
392
  ref: this.mediaSingleWrapperRef,
372
- css: figureWrapper,
393
+ css: [figureWrapper],
373
394
  className: MediaSingleNodeSelector,
374
395
  onClick: this.onMediaSingleClicked
375
396
  }, jsx("div", {
@@ -378,18 +399,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
378
399
  ref: this.captionPlaceHolderRef,
379
400
  onClick: this.clickPlaceholder
380
401
  }));
381
- return canResize ? jsx(ResizableMediaSingle, _extends({}, mediaSingleProps, {
382
- lineLength: lineLength,
383
- view: this.props.view,
384
- getPos: getPos,
385
- updateSize: this.updateSize,
386
- gridSize: 12,
387
- viewMediaClientConfig: this.state.viewMediaClientConfig,
388
- allowBreakoutSnapPoints: mediaOptions && mediaOptions.allowBreakoutSnapPoints,
389
- selected: isSelected,
390
- dispatchAnalyticsEvent: this.props.dispatchAnalyticsEvent,
391
- pluginInjectionApi: this.props.pluginInjectionApi
392
- }), MediaChildren) : jsx(MediaSingle, mediaSingleProps, MediaChildren);
402
+ return canResize ? getBooleanFF('platform.editor.media.extended-resize-experience') ? jsx(ResizableMediaSingleNext, ResizableMediaSingleProps, MediaChildren) : jsx(ResizableMediaSingle, ResizableMediaSingleProps, MediaChildren) : jsx(MediaSingle, mediaSingleProps, MediaChildren);
393
403
  }
394
404
  }]);
395
405
  return MediaSingleNode;
@@ -20,8 +20,9 @@ import { LinkToolbarAppearance } from './linking-toolbar-appearance';
20
20
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
21
21
  import { messages } from '@atlaskit/media-ui';
22
22
  import { cardMessages } from '@atlaskit/editor-common/messages';
23
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
23
24
  import { FilePreviewItem } from './filePreviewItem';
24
- import { downloadMedia, removeMediaGroupNode } from './utils';
25
+ import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode } from './utils';
25
26
  import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
26
27
  import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
27
28
  import ImageBorderItem from '../ui/ImageBorder';
@@ -225,7 +226,20 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
225
226
  }
226
227
  if (allowAdvancedToolBarOptions) {
227
228
  var _pluginInjectionApi$d;
228
- var layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions, allowResizing, allowResizingInTables);
229
+ var widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width;
230
+ var isChangingLayoutDisabled = false;
231
+ if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
232
+ var _widthPlugin$sharedSt;
233
+ var contentWidth = widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt === void 0 ? void 0 : _widthPlugin$sharedSt.lineLength;
234
+ var selectedNode = getSelectedMediaSingle(state);
235
+ if (selectedNode && contentWidth) {
236
+ var width = selectedNode.node.attrs.width;
237
+ if (width >= contentWidth) {
238
+ isChangingLayoutDisabled = true;
239
+ }
240
+ }
241
+ }
242
+ var layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
229
243
  toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
230
244
  if (layoutButtons.length) {
231
245
  toolbarButtons.push({
@@ -327,7 +341,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
327
341
  var mediaLinkingState = getMediaLinkingState(state);
328
342
  var _ref2 = (_pluginInjectionApi$d4 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d4 !== void 0 ? _pluginInjectionApi$d4 : {},
329
343
  hoverDecoration = _ref2.hoverDecoration;
330
- if (!mediaPluginState) {
344
+ if (!mediaPluginState || mediaPluginState.isResizing) {
331
345
  return;
332
346
  }
333
347
  var nodeType = allowMediaInline ? [mediaInline, mediaSingle, media] : [mediaSingle];
@@ -1,7 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { getMediaClient } from '@atlaskit/media-client';
4
- import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
4
+ import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
5
  export var getSelectedMediaContainerNodeAttrs = function getSelectedMediaContainerNodeAttrs(mediaPluginState) {
6
6
  var selectedNode = mediaPluginState.selectedMediaContainerNode();
7
7
  if (selectedNode && selectedNode.attrs) {
@@ -58,4 +58,8 @@ export var removeMediaGroupNode = function removeMediaGroupNode(state) {
58
58
  tr = removeSelectedNode(tr);
59
59
  }
60
60
  return tr;
61
+ };
62
+ export var getSelectedMediaSingle = function getSelectedMediaSingle(state) {
63
+ var mediaSingle = state.schema.nodes.mediaSingle;
64
+ return findSelectedNodeOfType(mediaSingle)(state.selection) || findParentNodeOfType(mediaSingle)(state.selection);
61
65
  };