@atlaskit/editor-core 187.30.4 → 187.30.6

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 (29) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/plugins/media/styles.js +1 -1
  3. package/dist/cjs/plugins/media/toolbar/index.js +42 -27
  4. package/dist/cjs/plugins/media/ui/PixelEntry/index.js +33 -8
  5. package/dist/cjs/plugins/media/ui/PixelEntry/messages.js +2 -2
  6. package/dist/cjs/plugins/media/utils/media-single.js +2 -21
  7. package/dist/cjs/plugins/selection/gap-cursor/utils/place-gap-cursor.js +6 -3
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/es2019/plugins/media/styles.js +21 -1
  10. package/dist/es2019/plugins/media/toolbar/index.js +35 -20
  11. package/dist/es2019/plugins/media/ui/PixelEntry/index.js +33 -8
  12. package/dist/es2019/plugins/media/ui/PixelEntry/messages.js +2 -2
  13. package/dist/es2019/plugins/media/utils/media-single.js +2 -21
  14. package/dist/es2019/plugins/selection/gap-cursor/utils/place-gap-cursor.js +6 -3
  15. package/dist/es2019/version-wrapper.js +1 -1
  16. package/dist/esm/plugins/media/styles.js +2 -2
  17. package/dist/esm/plugins/media/toolbar/index.js +36 -21
  18. package/dist/esm/plugins/media/ui/PixelEntry/index.js +33 -8
  19. package/dist/esm/plugins/media/ui/PixelEntry/messages.js +2 -2
  20. package/dist/esm/plugins/media/utils/media-single.js +1 -19
  21. package/dist/esm/plugins/selection/gap-cursor/utils/place-gap-cursor.js +6 -3
  22. package/dist/esm/version-wrapper.js +1 -1
  23. package/dist/types/plugins/media/ui/PixelEntry/index.d.ts +1 -1
  24. package/dist/types/plugins/media/ui/PixelEntry/types.d.ts +10 -2
  25. package/dist/types/plugins/media/utils/media-single.d.ts +1 -2
  26. package/dist/types-ts4.5/plugins/media/ui/PixelEntry/index.d.ts +1 -1
  27. package/dist/types-ts4.5/plugins/media/ui/PixelEntry/types.d.ts +10 -2
  28. package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +1 -2
  29. package/package.json +4 -4
@@ -15,6 +15,8 @@ export const PixelEntry = ({
15
15
  mediaHeight,
16
16
  onSubmit,
17
17
  validate,
18
+ minWidth,
19
+ maxWidth,
18
20
  intl: {
19
21
  formatMessage
20
22
  },
@@ -39,18 +41,33 @@ export const PixelEntry = ({
39
41
  // Handle submit when user presses enter in form
40
42
  const handleOnSubmit = data => {
41
43
  if (onSubmit) {
42
- if (data.inputWidth === '') {
43
- return;
44
+ let widthToBeSumitted = data.inputWidth;
45
+ let isInvalidInput = false;
46
+ if (data.inputWidth < minWidth) {
47
+ widthToBeSumitted = minWidth;
48
+ isInvalidInput = true;
49
+ }
50
+ if (data.inputWidth > maxWidth) {
51
+ widthToBeSumitted = maxWidth;
52
+ isInvalidInput = true;
53
+ }
54
+
55
+ // If user keeps submitting an invalid input, node width attribute will be updated with the same value
56
+ // and won't upadte the state in useEffect (since width is the same)
57
+ // Thus, we set the state here to always display the correct dimension
58
+ if (isInvalidInput) {
59
+ setComputedWidth(widthToBeSumitted);
60
+ setComputedHeight(Math.round(ratioWidth * widthToBeSumitted));
44
61
  }
45
62
  onSubmit({
46
- width: data.inputWidth
63
+ width: widthToBeSumitted
47
64
  });
48
65
  }
49
66
  };
50
67
 
51
68
  // Syncronous validation returning undefined for valid and string for invalid
52
69
  const handleValidateWidth = useCallback(value => {
53
- if (!value || !validate) {
70
+ if (!validate || value === undefined) {
54
71
  return;
55
72
  }
56
73
  if (validate) {
@@ -67,16 +84,20 @@ export const PixelEntry = ({
67
84
  case 'inputWidth':
68
85
  {
69
86
  setComputedWidth(newInputValue);
70
- if (!isNaN(value)) {
87
+ if (newInputValue) {
71
88
  setComputedHeight(Math.round(ratioWidth * value));
89
+ } else {
90
+ setComputedHeight('');
72
91
  }
73
92
  break;
74
93
  }
75
94
  case 'inputHeight':
76
95
  {
77
96
  setComputedHeight(newInputValue);
78
- if (!isNaN(value)) {
97
+ if (newInputValue) {
79
98
  setComputedWidth(Math.round(ratioHeight * value));
99
+ } else {
100
+ setComputedWidth('');
80
101
  }
81
102
  break;
82
103
  }
@@ -110,7 +131,9 @@ export const PixelEntry = ({
110
131
  fieldProps
111
132
  }) => jsx(Tooltip, {
112
133
  hideTooltipOnMouseDown: true,
113
- content: formatMessage(messages.inputWidthTooltip),
134
+ content: formatMessage(messages.inputWidthTooltip, {
135
+ maxWidth
136
+ }),
114
137
  position: "top"
115
138
  }, jsx(Textfield, _extends({}, fieldProps, {
116
139
  css: [pixelSizingWidthInput, pixelSizingInput],
@@ -118,7 +141,9 @@ export const PixelEntry = ({
118
141
  isCompact: true,
119
142
  onChange: handleOnChange('inputWidth'),
120
143
  pattern: "\\d*",
121
- "aria-label": formatMessage(messages.inputWidthAriaLabel)
144
+ "aria-label": formatMessage(messages.inputWidthAriaLabel, {
145
+ maxWidth
146
+ })
122
147
  })))), jsx("span", {
123
148
  css: pixelSizingLabel
124
149
  }, "x"), jsx(Field, {
@@ -7,12 +7,12 @@ export const messages = defineMessages({
7
7
  },
8
8
  inputWidthTooltip: {
9
9
  id: 'fabric.editor.media.pixelEntry.inputWidthTooltip',
10
- defaultMessage: 'Width',
10
+ defaultMessage: 'Max width {maxWidth}px',
11
11
  description: 'The tooltip displayed ontop of the width input'
12
12
  },
13
13
  inputWidthAriaLabel: {
14
14
  id: 'fabric.editor.media.pixelEntry.inputWidthAriaLabel',
15
- defaultMessage: 'width input',
15
+ defaultMessage: 'Max width {maxWidth}px',
16
16
  description: 'The width input aria label'
17
17
  },
18
18
  inputHeightTooltip: {
@@ -2,7 +2,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
2
2
  import { safeInsert as pmSafeInsert, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
3
  import { checkNodeDown } from '../../../utils';
4
4
  import { getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
5
- import { isEmptyParagraph, floatingLayouts } from '@atlaskit/editor-common/utils';
5
+ import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
6
6
  import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
7
7
  import { mapSlice } from '../../../utils/slice';
8
8
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
@@ -217,23 +217,4 @@ export function isCaptionNode(editorView) {
217
217
  }
218
218
  return false;
219
219
  }
220
- export const isVideo = fileType => !!fileType && fileType.includes('video');
221
- export const getParentWidthForNestedMediaSingleNode = (resolvedPos, view) => {
222
- const domNode = view.nodeDOM(resolvedPos.pos);
223
- if (resolvedPos.nodeAfter && floatingLayouts.includes(resolvedPos.nodeAfter.attrs.layout) && domNode && domNode.parentElement) {
224
- const {
225
- tableCell,
226
- tableHeader
227
- } = view.state.schema.nodes;
228
- if ([tableCell, tableHeader].includes(resolvedPos.parent.type)) {
229
- // since table has constant padding, use hardcoded constant instead of query the dom
230
- const tablePadding = 8;
231
- return domNode.parentElement.offsetWidth - tablePadding * 2;
232
- }
233
- return domNode.parentElement.offsetWidth;
234
- }
235
- if (domNode instanceof HTMLElement) {
236
- return domNode.offsetWidth;
237
- }
238
- return null;
239
- };
220
+ export const isVideo = fileType => !!fileType && fileType.includes('video');
@@ -8,7 +8,10 @@ import { Side } from '../selection';
8
8
  */
9
9
  const nestedCases = {
10
10
  'tableView-content-wrap': 'table',
11
- 'mediaSingleView-content-wrap': '.rich-media-item'
11
+ 'mediaSingleView-content-wrap': '.rich-media-item',
12
+ 'bodiedExtensionView-content-wrap': '.extension-container',
13
+ 'embedCardView-content-wrap': '.rich-media-item',
14
+ 'datasourceView-content-wrap': '.datasourceView-content-inner-wrap'
12
15
  };
13
16
  const computeNestedStyle = dom => {
14
17
  const foundKey = Object.keys(nestedCases).find(className => dom.classList.contains(className));
@@ -71,12 +74,12 @@ export const toDOM = (view, getPos) => {
71
74
  const style = computeNestedStyle(dom) || window.getComputedStyle(dom);
72
75
  const gapCursor = element.firstChild;
73
76
  gapCursor.style.height = `${measureHeight(style)}px`;
77
+ const layoutMode = node && getLayoutModeFromTargetNode(node);
74
78
 
75
79
  // TODO remove this table specific piece. need to figure out margin collapsing logic
76
- if (nodeStart !== 0 || node && node.type.name === 'table') {
80
+ if (nodeStart !== 0 || layoutMode || (node === null || node === void 0 ? void 0 : node.type.name) === 'table') {
77
81
  gapCursor.style.marginTop = style.getPropertyValue('margin-top');
78
82
  }
79
- const layoutMode = node && getLayoutModeFromTargetNode(node);
80
83
  if (layoutMode) {
81
84
  gapCursor.setAttribute('layout', layoutMode);
82
85
  gapCursor.style.width = `${measureWidth(style)}px`;
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.30.4";
2
+ export const version = "187.30.6";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -3,9 +3,9 @@ var _templateObject;
3
3
  import { css } from '@emotion/react';
4
4
  import { mediaSingleSharedStyle, richMediaClassName } from '@atlaskit/editor-common/styles';
5
5
  import { akEditorDeleteBorder, akEditorDeleteBackground, akEditorSelectedBorderBoldSize, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorSelectedNodeClassName, akEditorDeleteIconColor } from '@atlaskit/editor-shared-styles';
6
- import { N60, B200 } from '@atlaskit/theme/colors';
6
+ import { N60, B200, Y500 } from '@atlaskit/theme/colors';
7
7
  import { fileCardImageViewSelector, inlinePlayerClassName, newFileExperienceClassName } from '@atlaskit/media-card';
8
- export var mediaStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])), mediaSingleSharedStyle, richMediaClassName, richMediaClassName, richMediaClassName, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPaddingWide, "var(--ds-space-150, 12px)", akEditorMediaResizeHandlerPadding, "var(--ds-space-150, 12px)", akEditorMediaResizeHandlerPadding, richMediaClassName, richMediaClassName, "var(--ds-border, ".concat(N60, ")"), akEditorSelectedNodeClassName, akEditorSelectedNodeClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, "var(--ds-border-focused, ".concat(B200, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), akEditorSelectedBorderBoldSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), richMediaClassName, fileCardImageViewSelector, "var(--ds-border-danger, ".concat(akEditorDeleteIconColor, ")"), richMediaClassName, inlinePlayerClassName, "var(--ds-border-danger, ".concat(akEditorDeleteIconColor, ")"), richMediaClassName, newFileExperienceClassName, "var(--ds-border-danger, ".concat(akEditorDeleteIconColor, ")"), "var(--ds-icon-danger, ".concat(akEditorDeleteIconColor, ")"), "var(--ds-blanket-danger, rgb(255, 189, 173, 0.5))");
8
+ export var mediaStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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\n .warning {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n\n .", " .", "::after {\n border: 1px solid ", ";\n }\n\n .", " .", " {\n box-shadow: 0 0 0 1px ", " !important;\n }\n\n .resizer-handle-left::after,\n .resizer-handle-right::after {\n background: ", " !important;\n }\n }\n"])), mediaSingleSharedStyle, richMediaClassName, richMediaClassName, richMediaClassName, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPaddingWide, "var(--ds-space-150, 12px)", akEditorMediaResizeHandlerPadding, "var(--ds-space-150, 12px)", akEditorMediaResizeHandlerPadding, richMediaClassName, richMediaClassName, "var(--ds-border, ".concat(N60, ")"), akEditorSelectedNodeClassName, akEditorSelectedNodeClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, "var(--ds-border-focused, ".concat(B200, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), akEditorSelectedBorderBoldSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), richMediaClassName, fileCardImageViewSelector, "var(--ds-border-danger, ".concat(akEditorDeleteIconColor, ")"), richMediaClassName, inlinePlayerClassName, "var(--ds-border-danger, ".concat(akEditorDeleteIconColor, ")"), richMediaClassName, newFileExperienceClassName, "var(--ds-border-danger, ".concat(akEditorDeleteIconColor, ")"), "var(--ds-icon-danger, ".concat(akEditorDeleteIconColor, ")"), "var(--ds-blanket-danger, rgb(255, 189, 173, 0.5))", richMediaClassName, fileCardImageViewSelector, "var(--ds-border-warning, ".concat(Y500, ")"), richMediaClassName, inlinePlayerClassName, "var(--ds-border-warning, ".concat(Y500, ")"), richMediaClassName, newFileExperienceClassName, "var(--ds-border-warning, ".concat(Y500, ")"), "var(--ds-icon-warning, ".concat(Y500, ")"));
9
9
 
10
10
  /* `left: unset` above is to work around Chrome bug where rendering a div with
11
11
  * that style applied inside a container that has a scroll, causes any svgs on
@@ -23,13 +23,14 @@ import { cardMessages } from '@atlaskit/editor-common/messages';
23
23
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
24
24
  import { FilePreviewItem } from './filePreviewItem';
25
25
  import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode } from './utils';
26
+ import { isVideo } from '../utils/media-single';
26
27
  import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
27
28
  import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
28
29
  import ImageBorderItem from '../ui/ImageBorder';
29
30
  import { currentMediaNodeBorderMark } from '../utils/current-media-node';
30
31
  import { shouldShowImageBorder } from './imageBorder';
31
32
  import { PixelEntry } from '../ui/PixelEntry';
32
- import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_GUTTER_SIZE, calcMediaSinglePixelWidth, getMaxWidthForNestedNode } from '@atlaskit/editor-common/media-single';
33
+ import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, MEDIA_SINGLE_GUTTER_SIZE, calcMediaSinglePixelWidth, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
33
34
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
34
35
  var remove = function remove(state, dispatch) {
35
36
  if (dispatch) {
@@ -191,7 +192,7 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
191
192
  return items;
192
193
  };
193
194
  var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
194
- var _pluginInjectionApi$d8;
195
+ var _pluginInjectionApi$d;
195
196
  var mediaSingle = state.schema.nodes.mediaSingle;
196
197
  var allowResizing = options.allowResizing,
197
198
  allowLinking = options.allowLinking,
@@ -199,6 +200,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
199
200
  allowResizingInTables = options.allowResizingInTables,
200
201
  allowAltTextOnImages = options.allowAltTextOnImages;
201
202
  var toolbarButtons = [];
203
+ var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
204
+ hoverDecoration = _ref.hoverDecoration;
202
205
  if (shouldShowImageBorder(state)) {
203
206
  toolbarButtons.push({
204
207
  type: 'custom',
@@ -212,12 +215,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
212
215
  var borderMark = currentMediaNodeBorderMark(state);
213
216
  return /*#__PURE__*/React.createElement(ImageBorderItem, {
214
217
  toggleBorder: function toggleBorder() {
215
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
216
- toggleBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions)(state, dispatch);
218
+ var _pluginInjectionApi$d2, _pluginInjectionApi$d3;
219
+ toggleBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions)(state, dispatch);
217
220
  },
218
221
  setBorder: function setBorder(attrs) {
219
- var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
220
- setBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.analytics) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions)(attrs)(state, dispatch);
222
+ var _pluginInjectionApi$d4, _pluginInjectionApi$d5;
223
+ setBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.analytics) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions)(attrs)(state, dispatch);
221
224
  },
222
225
  showSomewhatSemanticTooltips: getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().useSomewhatSemanticTextColorNames,
223
226
  borderMark: borderMark,
@@ -230,7 +233,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
230
233
  });
231
234
  }
232
235
  if (allowAdvancedToolBarOptions) {
233
- var _pluginInjectionApi$d5;
236
+ var _pluginInjectionApi$d6;
234
237
  var widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width;
235
238
  var isChangingLayoutDisabled = false;
236
239
  if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
@@ -244,7 +247,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
244
247
  }
245
248
  }
246
249
  }
247
- var layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
250
+ var layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
248
251
  toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
249
252
  if (layoutButtons.length) {
250
253
  toolbarButtons.push({
@@ -265,11 +268,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
265
268
  var state = editorView.state,
266
269
  dispatch = editorView.dispatch;
267
270
  var selectedMediaSingleNode = getSelectedMediaSingle(state);
268
- var contentWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt2 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt2 === void 0 ? void 0 : _widthPlugin$sharedSt2.lineLength) || akEditorDefaultLayoutWidth;
269
- var containerWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt3 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt3 === void 0 ? void 0 : _widthPlugin$sharedSt3.width) || akEditorFullWidthLayoutWidth;
270
271
  if (!selectedMediaSingleNode) {
271
272
  return null;
272
273
  }
274
+ var contentWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt2 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt2 === void 0 ? void 0 : _widthPlugin$sharedSt2.lineLength) || akEditorDefaultLayoutWidth;
275
+ var containerWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt3 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt3 === void 0 ? void 0 : _widthPlugin$sharedSt3.width) || akEditorFullWidthLayoutWidth;
273
276
  var selectedMediaNode = selectedMediaSingleNode.node.content.firstChild;
274
277
  if (!selectedMediaNode) {
275
278
  return null;
@@ -281,6 +284,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
281
284
  var _selectedMediaNode$at = selectedMediaNode.attrs,
282
285
  mediaWidth = _selectedMediaNode$at.width,
283
286
  mediaHeight = _selectedMediaNode$at.height;
287
+ var maxWidthForNestedNode = getMaxWidthForNestedNodeNext(editorView, selectedMediaSingleNode.pos);
288
+ var maxWidth = maxWidthForNestedNode || akEditorFullWidthLayoutWidth;
289
+ var isVideoFile = isVideo(selectedMediaNode.attrs.__fileMimeType);
290
+ var minWidth = calcMinWidth(isVideoFile, maxWidthForNestedNode || contentWidth);
284
291
  var isLegacy = widthType !== 'pixel';
285
292
  var pixelWidth = calcMediaSinglePixelWidth({
286
293
  width: singleMediaWidth,
@@ -297,14 +304,24 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
297
304
  showMigration: !pluginState.isResizing && isLegacy,
298
305
  mediaWidth: mediaWidth || DEFAULT_IMAGE_WIDTH,
299
306
  mediaHeight: mediaHeight || DEFAULT_IMAGE_HEIGHT,
307
+ minWidth: minWidth,
308
+ maxWidth: maxWidth,
300
309
  validate: function validate(value) {
301
- if (value !== '' && !isNaN(value) && value >= MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH && value <= akEditorFullWidthLayoutWidth) {
302
- return true;
310
+ if (value && (value < minWidth || value > maxWidth)) {
311
+ hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true, 'warning')(editorView.state, dispatch, editorView);
312
+ } else {
313
+ // remove decoration when:
314
+ // input is within min-max range or
315
+ // input is empty
316
+ hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false)(editorView.state, dispatch, editorView);
317
+ }
318
+ if (value === '') {
319
+ return false;
303
320
  }
304
- return false;
321
+ return true;
305
322
  },
306
- onSubmit: function onSubmit(_ref) {
307
- var width = _ref.width;
323
+ onSubmit: function onSubmit(_ref2) {
324
+ var width = _ref2.width;
308
325
  var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
309
326
  width: width,
310
327
  widthType: 'pixel'
@@ -349,10 +366,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
349
366
  };
350
367
  var openLink = function openLink() {
351
368
  if (editorView) {
352
- var _pluginInjectionApi$d6;
369
+ var _pluginInjectionApi$d7;
353
370
  var tr = editorView.state.tr,
354
371
  dispatch = editorView.dispatch;
355
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.actions.attachAnalyticsEvent({
372
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.actions.attachAnalyticsEvent({
356
373
  eventType: EVENT_TYPE.TRACK,
357
374
  action: ACTION.VISITED,
358
375
  actionSubject: ACTION_SUBJECT.MEDIA,
@@ -378,13 +395,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
378
395
  }
379
396
  }
380
397
  if (allowAltTextOnImages) {
381
- var _pluginInjectionApi$d7;
382
- toolbarButtons.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.actions), {
398
+ var _pluginInjectionApi$d8;
399
+ toolbarButtons.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d8 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.actions), {
383
400
  type: 'separator'
384
401
  });
385
402
  }
386
- var _ref2 = (_pluginInjectionApi$d8 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d8 !== void 0 ? _pluginInjectionApi$d8 : {},
387
- hoverDecoration = _ref2.hoverDecoration;
388
403
  var removeButton = {
389
404
  id: 'editor.media.delete',
390
405
  type: 'button',
@@ -16,6 +16,8 @@ export var PixelEntry = function PixelEntry(_ref) {
16
16
  mediaHeight = _ref.mediaHeight,
17
17
  onSubmit = _ref.onSubmit,
18
18
  validate = _ref.validate,
19
+ minWidth = _ref.minWidth,
20
+ maxWidth = _ref.maxWidth,
19
21
  formatMessage = _ref.intl.formatMessage,
20
22
  showMigration = _ref.showMigration,
21
23
  onMigrate = _ref.onMigrate;
@@ -43,18 +45,33 @@ export var PixelEntry = function PixelEntry(_ref) {
43
45
  // Handle submit when user presses enter in form
44
46
  var handleOnSubmit = function handleOnSubmit(data) {
45
47
  if (onSubmit) {
46
- if (data.inputWidth === '') {
47
- return;
48
+ var widthToBeSumitted = data.inputWidth;
49
+ var isInvalidInput = false;
50
+ if (data.inputWidth < minWidth) {
51
+ widthToBeSumitted = minWidth;
52
+ isInvalidInput = true;
53
+ }
54
+ if (data.inputWidth > maxWidth) {
55
+ widthToBeSumitted = maxWidth;
56
+ isInvalidInput = true;
57
+ }
58
+
59
+ // If user keeps submitting an invalid input, node width attribute will be updated with the same value
60
+ // and won't upadte the state in useEffect (since width is the same)
61
+ // Thus, we set the state here to always display the correct dimension
62
+ if (isInvalidInput) {
63
+ setComputedWidth(widthToBeSumitted);
64
+ setComputedHeight(Math.round(ratioWidth * widthToBeSumitted));
48
65
  }
49
66
  onSubmit({
50
- width: data.inputWidth
67
+ width: widthToBeSumitted
51
68
  });
52
69
  }
53
70
  };
54
71
 
55
72
  // Syncronous validation returning undefined for valid and string for invalid
56
73
  var handleValidateWidth = useCallback(function (value) {
57
- if (!value || !validate) {
74
+ if (!validate || value === undefined) {
58
75
  return;
59
76
  }
60
77
  if (validate) {
@@ -72,16 +89,20 @@ export var PixelEntry = function PixelEntry(_ref) {
72
89
  case 'inputWidth':
73
90
  {
74
91
  setComputedWidth(newInputValue);
75
- if (!isNaN(value)) {
92
+ if (newInputValue) {
76
93
  setComputedHeight(Math.round(ratioWidth * value));
94
+ } else {
95
+ setComputedHeight('');
77
96
  }
78
97
  break;
79
98
  }
80
99
  case 'inputHeight':
81
100
  {
82
101
  setComputedHeight(newInputValue);
83
- if (!isNaN(value)) {
102
+ if (newInputValue) {
84
103
  setComputedWidth(Math.round(ratioHeight * value));
104
+ } else {
105
+ setComputedWidth('');
85
106
  }
86
107
  break;
87
108
  }
@@ -115,7 +136,9 @@ export var PixelEntry = function PixelEntry(_ref) {
115
136
  var fieldProps = _ref3.fieldProps;
116
137
  return jsx(Tooltip, {
117
138
  hideTooltipOnMouseDown: true,
118
- content: formatMessage(messages.inputWidthTooltip),
139
+ content: formatMessage(messages.inputWidthTooltip, {
140
+ maxWidth: maxWidth
141
+ }),
119
142
  position: "top"
120
143
  }, jsx(Textfield, _extends({}, fieldProps, {
121
144
  css: [pixelSizingWidthInput, pixelSizingInput],
@@ -123,7 +146,9 @@ export var PixelEntry = function PixelEntry(_ref) {
123
146
  isCompact: true,
124
147
  onChange: handleOnChange('inputWidth'),
125
148
  pattern: "\\d*",
126
- "aria-label": formatMessage(messages.inputWidthAriaLabel)
149
+ "aria-label": formatMessage(messages.inputWidthAriaLabel, {
150
+ maxWidth: maxWidth
151
+ })
127
152
  })));
128
153
  }), jsx("span", {
129
154
  css: pixelSizingLabel
@@ -7,12 +7,12 @@ export var messages = defineMessages({
7
7
  },
8
8
  inputWidthTooltip: {
9
9
  id: 'fabric.editor.media.pixelEntry.inputWidthTooltip',
10
- defaultMessage: 'Width',
10
+ defaultMessage: 'Max width {maxWidth}px',
11
11
  description: 'The tooltip displayed ontop of the width input'
12
12
  },
13
13
  inputWidthAriaLabel: {
14
14
  id: 'fabric.editor.media.pixelEntry.inputWidthAriaLabel',
15
- defaultMessage: 'width input',
15
+ defaultMessage: 'Max width {maxWidth}px',
16
16
  description: 'The width input aria label'
17
17
  },
18
18
  inputHeightTooltip: {
@@ -5,7 +5,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
5
5
  import { safeInsert as pmSafeInsert, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { checkNodeDown } from '../../../utils';
7
7
  import { getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
8
- import { isEmptyParagraph, floatingLayouts } from '@atlaskit/editor-common/utils';
8
+ import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
9
9
  import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
10
10
  import { mapSlice } from '../../../utils/slice';
11
11
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
@@ -210,22 +210,4 @@ export function isCaptionNode(editorView) {
210
210
  }
211
211
  export var isVideo = function isVideo(fileType) {
212
212
  return !!fileType && fileType.includes('video');
213
- };
214
- export var getParentWidthForNestedMediaSingleNode = function getParentWidthForNestedMediaSingleNode(resolvedPos, view) {
215
- var domNode = view.nodeDOM(resolvedPos.pos);
216
- if (resolvedPos.nodeAfter && floatingLayouts.includes(resolvedPos.nodeAfter.attrs.layout) && domNode && domNode.parentElement) {
217
- var _view$state$schema$no = view.state.schema.nodes,
218
- tableCell = _view$state$schema$no.tableCell,
219
- tableHeader = _view$state$schema$no.tableHeader;
220
- if ([tableCell, tableHeader].includes(resolvedPos.parent.type)) {
221
- // since table has constant padding, use hardcoded constant instead of query the dom
222
- var tablePadding = 8;
223
- return domNode.parentElement.offsetWidth - tablePadding * 2;
224
- }
225
- return domNode.parentElement.offsetWidth;
226
- }
227
- if (domNode instanceof HTMLElement) {
228
- return domNode.offsetWidth;
229
- }
230
- return null;
231
213
  };
@@ -9,7 +9,10 @@ import { Side } from '../selection';
9
9
  */
10
10
  var nestedCases = {
11
11
  'tableView-content-wrap': 'table',
12
- 'mediaSingleView-content-wrap': '.rich-media-item'
12
+ 'mediaSingleView-content-wrap': '.rich-media-item',
13
+ 'bodiedExtensionView-content-wrap': '.extension-container',
14
+ 'embedCardView-content-wrap': '.rich-media-item',
15
+ 'datasourceView-content-wrap': '.datasourceView-content-inner-wrap'
13
16
  };
14
17
  var computeNestedStyle = function computeNestedStyle(dom) {
15
18
  var foundKey = Object.keys(nestedCases).find(function (className) {
@@ -74,12 +77,12 @@ export var toDOM = function toDOM(view, getPos) {
74
77
  var style = computeNestedStyle(dom) || window.getComputedStyle(dom);
75
78
  var gapCursor = element.firstChild;
76
79
  gapCursor.style.height = "".concat(measureHeight(style), "px");
80
+ var layoutMode = node && getLayoutModeFromTargetNode(node);
77
81
 
78
82
  // TODO remove this table specific piece. need to figure out margin collapsing logic
79
- if (nodeStart !== 0 || node && node.type.name === 'table') {
83
+ if (nodeStart !== 0 || layoutMode || (node === null || node === void 0 ? void 0 : node.type.name) === 'table') {
80
84
  gapCursor.style.marginTop = style.getPropertyValue('margin-top');
81
85
  }
82
- var layoutMode = node && getLayoutModeFromTargetNode(node);
83
86
  if (layoutMode) {
84
87
  gapCursor.setAttribute('layout', layoutMode);
85
88
  gapCursor.style.width = "".concat(measureWidth(style), "px");
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.30.4";
2
+ export var version = "187.30.6";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,4 +1,4 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import type { PixelEntryProps } from './types';
4
- export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, validate, intl: { formatMessage }, showMigration, onMigrate, }: PixelEntryProps) => jsx.JSX.Element;
4
+ export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, validate, minWidth, maxWidth, intl: { formatMessage }, showMigration, onMigrate, }: PixelEntryProps) => jsx.JSX.Element;
@@ -16,6 +16,14 @@ export type PixelEntryProps = {
16
16
  * The original media height used to calculate the width
17
17
  */
18
18
  mediaHeight: number;
19
+ /**
20
+ * The minimum acceptable width input
21
+ */
22
+ minWidth: number;
23
+ /**
24
+ * The maximum acceptable width input
25
+ */
26
+ maxWidth: number;
19
27
  /**
20
28
  * show migration button to convert to pixels for legacy image resize experience
21
29
  */
@@ -35,8 +43,8 @@ export type PixelEntryProps = {
35
43
  onMigrate?: () => void;
36
44
  };
37
45
  export type PixelEntryFormValues = {
38
- inputWidth: number | '';
39
- inputHeight: number | '';
46
+ inputWidth: number;
47
+ inputHeight: number;
40
48
  };
41
49
  export type PixelEntryFormData = {
42
50
  width: number;
@@ -1,4 +1,4 @@
1
- import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
1
+ import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import { Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
@@ -20,4 +20,3 @@ export declare const createMediaSingleNode: (schema: Schema, collection: string,
20
20
  export declare function transformSliceForMedia(slice: Slice, schema: Schema): (selection: Selection) => Slice;
21
21
  export declare function isCaptionNode(editorView: EditorView): boolean;
22
22
  export declare const isVideo: (fileType?: string) => boolean;
23
- export declare const getParentWidthForNestedMediaSingleNode: (resolvedPos: ResolvedPos, view: EditorView) => number | null;
@@ -1,4 +1,4 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import type { PixelEntryProps } from './types';
4
- export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, validate, intl: { formatMessage }, showMigration, onMigrate, }: PixelEntryProps) => jsx.JSX.Element;
4
+ export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, validate, minWidth, maxWidth, intl: { formatMessage }, showMigration, onMigrate, }: PixelEntryProps) => jsx.JSX.Element;
@@ -16,6 +16,14 @@ export type PixelEntryProps = {
16
16
  * The original media height used to calculate the width
17
17
  */
18
18
  mediaHeight: number;
19
+ /**
20
+ * The minimum acceptable width input
21
+ */
22
+ minWidth: number;
23
+ /**
24
+ * The maximum acceptable width input
25
+ */
26
+ maxWidth: number;
19
27
  /**
20
28
  * show migration button to convert to pixels for legacy image resize experience
21
29
  */
@@ -35,8 +43,8 @@ export type PixelEntryProps = {
35
43
  onMigrate?: () => void;
36
44
  };
37
45
  export type PixelEntryFormValues = {
38
- inputWidth: number | '';
39
- inputHeight: number | '';
46
+ inputWidth: number;
47
+ inputHeight: number;
40
48
  };
41
49
  export type PixelEntryFormData = {
42
50
  width: number;
@@ -1,4 +1,4 @@
1
- import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
1
+ import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import { Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
@@ -20,4 +20,3 @@ export declare const createMediaSingleNode: (schema: Schema, collection: string,
20
20
  export declare function transformSliceForMedia(slice: Slice, schema: Schema): (selection: Selection) => Slice;
21
21
  export declare function isCaptionNode(editorView: EditorView): boolean;
22
22
  export declare const isVideo: (fileType?: string) => boolean;
23
- export declare const getParentWidthForNestedMediaSingleNode: (resolvedPos: ResolvedPos, view: EditorView) => number | null;