@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.30.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c77b39ff19f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c77b39ff19f) - [ux] [ED-19130] Fix up gap cursor positioning for breakout nodes
8
+ - [`33cb07de05f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/33cb07de05f) - change adf-schema to fixed versioning
9
+ - Updated dependencies
10
+
11
+ ## 187.30.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`ef2d5662e05`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ef2d5662e05) - [ux] Implement pixel entry input validation when submitting and render warning decoration for invalid input
16
+
3
17
  ## 187.30.4
4
18
 
5
19
  ### Patch Changes
@@ -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 .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))");
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\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"])), _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))", _styles.richMediaClassName, _mediaCard.fileCardImageViewSelector, "var(--ds-border-warning, ".concat(_colors.Y500, ")"), _styles.richMediaClassName, _mediaCard.inlinePlayerClassName, "var(--ds-border-warning, ".concat(_colors.Y500, ")"), _styles.richMediaClassName, _mediaCard.newFileExperienceClassName, "var(--ds-border-warning, ".concat(_colors.Y500, ")"), "var(--ds-icon-warning, ".concat(_colors.Y500, ")"));
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
@@ -28,13 +28,14 @@ var _messages2 = require("@atlaskit/editor-common/messages");
28
28
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
29
29
  var _filePreviewItem = require("./filePreviewItem");
30
30
  var _utils2 = require("./utils");
31
+ var _mediaSingle = require("../utils/media-single");
31
32
  var _commands = require("./commands");
32
33
  var _styles = require("../nodeviews/styles");
33
34
  var _ImageBorder = _interopRequireDefault(require("../ui/ImageBorder"));
34
35
  var _currentMediaNode = require("../utils/current-media-node");
35
36
  var _imageBorder = require("./imageBorder");
36
37
  var _PixelEntry = require("../ui/PixelEntry");
37
- var _mediaSingle = require("@atlaskit/editor-common/media-single");
38
+ var _mediaSingle2 = require("@atlaskit/editor-common/media-single");
38
39
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
39
40
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
40
41
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -198,7 +199,7 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
198
199
  return items;
199
200
  };
200
201
  var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
201
- var _pluginInjectionApi$d8;
202
+ var _pluginInjectionApi$d;
202
203
  var mediaSingle = state.schema.nodes.mediaSingle;
203
204
  var allowResizing = options.allowResizing,
204
205
  allowLinking = options.allowLinking,
@@ -206,6 +207,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
206
207
  allowResizingInTables = options.allowResizingInTables,
207
208
  allowAltTextOnImages = options.allowAltTextOnImages;
208
209
  var toolbarButtons = [];
210
+ var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
211
+ hoverDecoration = _ref.hoverDecoration;
209
212
  if ((0, _imageBorder.shouldShowImageBorder)(state)) {
210
213
  toolbarButtons.push({
211
214
  type: 'custom',
@@ -219,12 +222,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
219
222
  var borderMark = (0, _currentMediaNode.currentMediaNodeBorderMark)(state);
220
223
  return /*#__PURE__*/_react.default.createElement(_ImageBorder.default, {
221
224
  toggleBorder: function toggleBorder() {
222
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
223
- (0, _commands.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);
225
+ var _pluginInjectionApi$d2, _pluginInjectionApi$d3;
226
+ (0, _commands.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);
224
227
  },
225
228
  setBorder: function setBorder(attrs) {
226
- var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
227
- (0, _commands.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);
229
+ var _pluginInjectionApi$d4, _pluginInjectionApi$d5;
230
+ (0, _commands.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);
228
231
  },
229
232
  showSomewhatSemanticTooltips: getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().useSomewhatSemanticTextColorNames,
230
233
  borderMark: borderMark,
@@ -237,7 +240,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
237
240
  });
238
241
  }
239
242
  if (allowAdvancedToolBarOptions) {
240
- var _pluginInjectionApi$d5;
243
+ var _pluginInjectionApi$d6;
241
244
  var widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width;
242
245
  var isChangingLayoutDisabled = false;
243
246
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience')) {
@@ -251,7 +254,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
251
254
  }
252
255
  }
253
256
  }
254
- var layoutButtons = (0, _card.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);
257
+ var layoutButtons = (0, _card.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);
255
258
  toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
256
259
  if (layoutButtons.length) {
257
260
  toolbarButtons.push({
@@ -272,11 +275,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
272
275
  var state = editorView.state,
273
276
  dispatch = editorView.dispatch;
274
277
  var selectedMediaSingleNode = (0, _utils2.getSelectedMediaSingle)(state);
275
- var contentWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt2 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt2 === void 0 ? void 0 : _widthPlugin$sharedSt2.lineLength) || _editorSharedStyles.akEditorDefaultLayoutWidth;
276
- var containerWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt3 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt3 === void 0 ? void 0 : _widthPlugin$sharedSt3.width) || _editorSharedStyles.akEditorFullWidthLayoutWidth;
277
278
  if (!selectedMediaSingleNode) {
278
279
  return null;
279
280
  }
281
+ var contentWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt2 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt2 === void 0 ? void 0 : _widthPlugin$sharedSt2.lineLength) || _editorSharedStyles.akEditorDefaultLayoutWidth;
282
+ var containerWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt3 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt3 === void 0 ? void 0 : _widthPlugin$sharedSt3.width) || _editorSharedStyles.akEditorFullWidthLayoutWidth;
280
283
  var selectedMediaNode = selectedMediaSingleNode.node.content.firstChild;
281
284
  if (!selectedMediaNode) {
282
285
  return null;
@@ -288,30 +291,44 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
288
291
  var _selectedMediaNode$at = selectedMediaNode.attrs,
289
292
  mediaWidth = _selectedMediaNode$at.width,
290
293
  mediaHeight = _selectedMediaNode$at.height;
294
+ var maxWidthForNestedNode = (0, _mediaSingle2.getMaxWidthForNestedNodeNext)(editorView, selectedMediaSingleNode.pos);
295
+ var maxWidth = maxWidthForNestedNode || _editorSharedStyles.akEditorFullWidthLayoutWidth;
296
+ var isVideoFile = (0, _mediaSingle.isVideo)(selectedMediaNode.attrs.__fileMimeType);
297
+ var minWidth = (0, _mediaSingle2.calcMinWidth)(isVideoFile, maxWidthForNestedNode || contentWidth);
291
298
  var isLegacy = widthType !== 'pixel';
292
- var pixelWidth = (0, _mediaSingle.calcMediaSinglePixelWidth)({
299
+ var pixelWidth = (0, _mediaSingle2.calcMediaSinglePixelWidth)({
293
300
  width: singleMediaWidth,
294
301
  widthType: widthType,
295
- origWidth: mediaWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH,
302
+ origWidth: mediaWidth || _mediaSingle2.DEFAULT_IMAGE_WIDTH,
296
303
  layout: layout,
297
- contentWidth: (0, _mediaSingle.getMaxWidthForNestedNode)(editorView, selectedMediaSingleNode.pos) || contentWidth,
304
+ contentWidth: (0, _mediaSingle2.getMaxWidthForNestedNode)(editorView, selectedMediaSingleNode.pos) || contentWidth,
298
305
  containerWidth: containerWidth,
299
- gutterOffset: _mediaSingle.MEDIA_SINGLE_GUTTER_SIZE
306
+ gutterOffset: _mediaSingle2.MEDIA_SINGLE_GUTTER_SIZE
300
307
  });
301
308
  return /*#__PURE__*/_react.default.createElement(_PixelEntry.PixelEntry, {
302
309
  intl: intl,
303
310
  width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
304
311
  showMigration: !pluginState.isResizing && isLegacy,
305
- mediaWidth: mediaWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH,
306
- mediaHeight: mediaHeight || _mediaSingle.DEFAULT_IMAGE_HEIGHT,
312
+ mediaWidth: mediaWidth || _mediaSingle2.DEFAULT_IMAGE_WIDTH,
313
+ mediaHeight: mediaHeight || _mediaSingle2.DEFAULT_IMAGE_HEIGHT,
314
+ minWidth: minWidth,
315
+ maxWidth: maxWidth,
307
316
  validate: function validate(value) {
308
- if (value !== '' && !isNaN(value) && value >= _mediaSingle.MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH && value <= _editorSharedStyles.akEditorFullWidthLayoutWidth) {
309
- return true;
317
+ if (value && (value < minWidth || value > maxWidth)) {
318
+ hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true, 'warning')(editorView.state, dispatch, editorView);
319
+ } else {
320
+ // remove decoration when:
321
+ // input is within min-max range or
322
+ // input is empty
323
+ hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false)(editorView.state, dispatch, editorView);
324
+ }
325
+ if (value === '') {
326
+ return false;
310
327
  }
311
- return false;
328
+ return true;
312
329
  },
313
- onSubmit: function onSubmit(_ref) {
314
- var width = _ref.width;
330
+ onSubmit: function onSubmit(_ref2) {
331
+ var width = _ref2.width;
315
332
  var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
316
333
  width: width,
317
334
  widthType: 'pixel'
@@ -356,10 +373,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
356
373
  };
357
374
  var openLink = function openLink() {
358
375
  if (editorView) {
359
- var _pluginInjectionApi$d6;
376
+ var _pluginInjectionApi$d7;
360
377
  var tr = editorView.state.tr,
361
378
  dispatch = editorView.dispatch;
362
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.actions.attachAnalyticsEvent({
379
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.actions.attachAnalyticsEvent({
363
380
  eventType: _analytics.EVENT_TYPE.TRACK,
364
381
  action: _analytics.ACTION.VISITED,
365
382
  actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
@@ -385,13 +402,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
385
402
  }
386
403
  }
387
404
  if (allowAltTextOnImages) {
388
- var _pluginInjectionApi$d7;
389
- toolbarButtons.push((0, _altText2.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), {
405
+ var _pluginInjectionApi$d8;
406
+ toolbarButtons.push((0, _altText2.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), {
390
407
  type: 'separator'
391
408
  });
392
409
  }
393
- var _ref2 = (_pluginInjectionApi$d8 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d8 !== void 0 ? _pluginInjectionApi$d8 : {},
394
- hoverDecoration = _ref2.hoverDecoration;
395
410
  var removeButton = {
396
411
  id: 'editor.media.delete',
397
412
  type: 'button',
@@ -27,6 +27,8 @@ var PixelEntry = function PixelEntry(_ref) {
27
27
  mediaHeight = _ref.mediaHeight,
28
28
  onSubmit = _ref.onSubmit,
29
29
  validate = _ref.validate,
30
+ minWidth = _ref.minWidth,
31
+ maxWidth = _ref.maxWidth,
30
32
  formatMessage = _ref.intl.formatMessage,
31
33
  showMigration = _ref.showMigration,
32
34
  onMigrate = _ref.onMigrate;
@@ -54,18 +56,33 @@ var PixelEntry = function PixelEntry(_ref) {
54
56
  // Handle submit when user presses enter in form
55
57
  var handleOnSubmit = function handleOnSubmit(data) {
56
58
  if (onSubmit) {
57
- if (data.inputWidth === '') {
58
- return;
59
+ var widthToBeSumitted = data.inputWidth;
60
+ var isInvalidInput = false;
61
+ if (data.inputWidth < minWidth) {
62
+ widthToBeSumitted = minWidth;
63
+ isInvalidInput = true;
64
+ }
65
+ if (data.inputWidth > maxWidth) {
66
+ widthToBeSumitted = maxWidth;
67
+ isInvalidInput = true;
68
+ }
69
+
70
+ // If user keeps submitting an invalid input, node width attribute will be updated with the same value
71
+ // and won't upadte the state in useEffect (since width is the same)
72
+ // Thus, we set the state here to always display the correct dimension
73
+ if (isInvalidInput) {
74
+ setComputedWidth(widthToBeSumitted);
75
+ setComputedHeight(Math.round(ratioWidth * widthToBeSumitted));
59
76
  }
60
77
  onSubmit({
61
- width: data.inputWidth
78
+ width: widthToBeSumitted
62
79
  });
63
80
  }
64
81
  };
65
82
 
66
83
  // Syncronous validation returning undefined for valid and string for invalid
67
84
  var handleValidateWidth = (0, _react2.useCallback)(function (value) {
68
- if (!value || !validate) {
85
+ if (!validate || value === undefined) {
69
86
  return;
70
87
  }
71
88
  if (validate) {
@@ -83,16 +100,20 @@ var PixelEntry = function PixelEntry(_ref) {
83
100
  case 'inputWidth':
84
101
  {
85
102
  setComputedWidth(newInputValue);
86
- if (!isNaN(value)) {
103
+ if (newInputValue) {
87
104
  setComputedHeight(Math.round(ratioWidth * value));
105
+ } else {
106
+ setComputedHeight('');
88
107
  }
89
108
  break;
90
109
  }
91
110
  case 'inputHeight':
92
111
  {
93
112
  setComputedHeight(newInputValue);
94
- if (!isNaN(value)) {
113
+ if (newInputValue) {
95
114
  setComputedWidth(Math.round(ratioHeight * value));
115
+ } else {
116
+ setComputedWidth('');
96
117
  }
97
118
  break;
98
119
  }
@@ -126,7 +147,9 @@ var PixelEntry = function PixelEntry(_ref) {
126
147
  var fieldProps = _ref3.fieldProps;
127
148
  return (0, _react.jsx)(_tooltip.default, {
128
149
  hideTooltipOnMouseDown: true,
129
- content: formatMessage(_messages.messages.inputWidthTooltip),
150
+ content: formatMessage(_messages.messages.inputWidthTooltip, {
151
+ maxWidth: maxWidth
152
+ }),
130
153
  position: "top"
131
154
  }, (0, _react.jsx)(_textfield.default, (0, _extends2.default)({}, fieldProps, {
132
155
  css: [_styles.pixelSizingWidthInput, _styles.pixelSizingInput],
@@ -134,7 +157,9 @@ var PixelEntry = function PixelEntry(_ref) {
134
157
  isCompact: true,
135
158
  onChange: handleOnChange('inputWidth'),
136
159
  pattern: "\\d*",
137
- "aria-label": formatMessage(_messages.messages.inputWidthAriaLabel)
160
+ "aria-label": formatMessage(_messages.messages.inputWidthAriaLabel, {
161
+ maxWidth: maxWidth
162
+ })
138
163
  })));
139
164
  }), (0, _react.jsx)("span", {
140
165
  css: _styles.pixelSizingLabel
@@ -13,12 +13,12 @@ var messages = (0, _reactIntlNext.defineMessages)({
13
13
  },
14
14
  inputWidthTooltip: {
15
15
  id: 'fabric.editor.media.pixelEntry.inputWidthTooltip',
16
- defaultMessage: 'Width',
16
+ defaultMessage: 'Max width {maxWidth}px',
17
17
  description: 'The tooltip displayed ontop of the width input'
18
18
  },
19
19
  inputWidthAriaLabel: {
20
20
  id: 'fabric.editor.media.pixelEntry.inputWidthAriaLabel',
21
- defaultMessage: 'width input',
21
+ defaultMessage: 'Max width {maxWidth}px',
22
22
  description: 'The width input aria label'
23
23
  },
24
24
  inputHeightTooltip: {
@@ -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.getParentWidthForNestedMediaSingleNode = exports.createMediaSingleNode = void 0;
7
+ exports.insertMediaSingleNode = exports.insertMediaAsMediaSingle = exports.createMediaSingleNode = void 0;
8
8
  exports.isCaptionNode = isCaptionNode;
9
9
  exports.isVideo = exports.isMediaSingle = void 0;
10
10
  exports.transformSliceForMedia = transformSliceForMedia;
@@ -225,23 +225,4 @@ function isCaptionNode(editorView) {
225
225
  var isVideo = function isVideo(fileType) {
226
226
  return !!fileType && fileType.includes('video');
227
227
  };
228
- exports.isVideo = isVideo;
229
- var getParentWidthForNestedMediaSingleNode = function getParentWidthForNestedMediaSingleNode(resolvedPos, view) {
230
- var domNode = view.nodeDOM(resolvedPos.pos);
231
- if (resolvedPos.nodeAfter && _utils3.floatingLayouts.includes(resolvedPos.nodeAfter.attrs.layout) && domNode && domNode.parentElement) {
232
- var _view$state$schema$no = view.state.schema.nodes,
233
- tableCell = _view$state$schema$no.tableCell,
234
- tableHeader = _view$state$schema$no.tableHeader;
235
- if ([tableCell, tableHeader].includes(resolvedPos.parent.type)) {
236
- // since table has constant padding, use hardcoded constant instead of query the dom
237
- var tablePadding = 8;
238
- return domNode.parentElement.offsetWidth - tablePadding * 2;
239
- }
240
- return domNode.parentElement.offsetWidth;
241
- }
242
- if (domNode instanceof HTMLElement) {
243
- return domNode.offsetWidth;
244
- }
245
- return null;
246
- };
247
- exports.getParentWidthForNestedMediaSingleNode = getParentWidthForNestedMediaSingleNode;
228
+ exports.isVideo = isVideo;
@@ -15,7 +15,10 @@ var _selection = require("../selection");
15
15
  */
16
16
  var nestedCases = {
17
17
  'tableView-content-wrap': 'table',
18
- 'mediaSingleView-content-wrap': '.rich-media-item'
18
+ 'mediaSingleView-content-wrap': '.rich-media-item',
19
+ 'bodiedExtensionView-content-wrap': '.extension-container',
20
+ 'embedCardView-content-wrap': '.rich-media-item',
21
+ 'datasourceView-content-wrap': '.datasourceView-content-inner-wrap'
19
22
  };
20
23
  var computeNestedStyle = function computeNestedStyle(dom) {
21
24
  var foundKey = Object.keys(nestedCases).find(function (className) {
@@ -80,12 +83,12 @@ var toDOM = function toDOM(view, getPos) {
80
83
  var style = computeNestedStyle(dom) || window.getComputedStyle(dom);
81
84
  var gapCursor = element.firstChild;
82
85
  gapCursor.style.height = "".concat(measureHeight(style), "px");
86
+ var layoutMode = node && (0, _utils.getLayoutModeFromTargetNode)(node);
83
87
 
84
88
  // TODO remove this table specific piece. need to figure out margin collapsing logic
85
- if (nodeStart !== 0 || node && node.type.name === 'table') {
89
+ if (nodeStart !== 0 || layoutMode || (node === null || node === void 0 ? void 0 : node.type.name) === 'table') {
86
90
  gapCursor.style.marginTop = style.getPropertyValue('margin-top');
87
91
  }
88
- var layoutMode = node && (0, _utils.getLayoutModeFromTargetNode)(node);
89
92
  if (layoutMode) {
90
93
  gapCursor.setAttribute('layout', layoutMode);
91
94
  gapCursor.style.width = "".concat(measureWidth(style), "px");
@@ -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.30.4";
9
+ var version = "187.30.6";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,7 +1,7 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { mediaSingleSharedStyle, richMediaClassName } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorDeleteBorder, akEditorDeleteBackground, akEditorSelectedBorderBoldSize, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorSelectedNodeClassName, akEditorDeleteIconColor } from '@atlaskit/editor-shared-styles';
4
- import { N60, B200 } from '@atlaskit/theme/colors';
4
+ import { N60, B200, Y500 } from '@atlaskit/theme/colors';
5
5
  import { fileCardImageViewSelector, inlinePlayerClassName, newFileExperienceClassName } from '@atlaskit/media-card';
6
6
  export const mediaStyles = css`
7
7
  .ProseMirror {
@@ -158,6 +158,26 @@ export const mediaStyles = css`
158
158
  box-shadow: none;
159
159
  }
160
160
  }
161
+
162
+ .warning {
163
+ /* Media single */
164
+ .${richMediaClassName} .${fileCardImageViewSelector}::after {
165
+ border: 1px solid ${`var(--ds-border-warning, ${Y500})`};
166
+ }
167
+
168
+ .${richMediaClassName} .${inlinePlayerClassName}::after {
169
+ border: 1px solid ${`var(--ds-border-warning, ${Y500})`};
170
+ }
171
+
172
+ .${richMediaClassName} .${newFileExperienceClassName} {
173
+ box-shadow: 0 0 0 1px ${`var(--ds-border-warning, ${Y500})`} !important;
174
+ }
175
+
176
+ .resizer-handle-left::after,
177
+ .resizer-handle-right::after {
178
+ background: ${`var(--ds-icon-warning, ${Y500})`} !important;
179
+ }
180
+ }
161
181
  `;
162
182
 
163
183
  /* `left: unset` above is to work around Chrome bug where rendering a div with
@@ -19,13 +19,14 @@ import { cardMessages } from '@atlaskit/editor-common/messages';
19
19
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
20
20
  import { FilePreviewItem } from './filePreviewItem';
21
21
  import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode } from './utils';
22
+ import { isVideo } from '../utils/media-single';
22
23
  import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
23
24
  import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
24
25
  import ImageBorderItem from '../ui/ImageBorder';
25
26
  import { currentMediaNodeBorderMark } from '../utils/current-media-node';
26
27
  import { shouldShowImageBorder } from './imageBorder';
27
28
  import { PixelEntry } from '../ui/PixelEntry';
28
- 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';
29
+ import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, MEDIA_SINGLE_GUTTER_SIZE, calcMediaSinglePixelWidth, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
29
30
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
30
31
  const remove = (state, dispatch) => {
31
32
  if (dispatch) {
@@ -191,7 +192,7 @@ const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState, hover
191
192
  return items;
192
193
  };
193
194
  const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) => {
194
- var _pluginInjectionApi$d8;
195
+ var _pluginInjectionApi$d;
195
196
  const {
196
197
  mediaSingle
197
198
  } = state.schema.nodes;
@@ -203,6 +204,9 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
203
204
  allowAltTextOnImages
204
205
  } = options;
205
206
  let toolbarButtons = [];
207
+ const {
208
+ hoverDecoration
209
+ } = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {};
206
210
  if (shouldShowImageBorder(state)) {
207
211
  toolbarButtons.push({
208
212
  type: 'custom',
@@ -218,12 +222,12 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
218
222
  const borderMark = currentMediaNodeBorderMark(state);
219
223
  return /*#__PURE__*/React.createElement(ImageBorderItem, {
220
224
  toggleBorder: () => {
221
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
222
- 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);
225
+ var _pluginInjectionApi$d2, _pluginInjectionApi$d3;
226
+ 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);
223
227
  },
224
228
  setBorder: attrs => {
225
- var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
226
- 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);
229
+ var _pluginInjectionApi$d4, _pluginInjectionApi$d5;
230
+ 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);
227
231
  },
228
232
  showSomewhatSemanticTooltips: getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().useSomewhatSemanticTextColorNames,
229
233
  borderMark: borderMark,
@@ -236,7 +240,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
236
240
  });
237
241
  }
238
242
  if (allowAdvancedToolBarOptions) {
239
- var _pluginInjectionApi$d5;
243
+ var _pluginInjectionApi$d6;
240
244
  const widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width;
241
245
  let isChangingLayoutDisabled = false;
242
246
  if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
@@ -252,7 +256,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
252
256
  }
253
257
  }
254
258
  }
255
- const 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);
259
+ const 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);
256
260
  toolbarButtons = [...toolbarButtons, ...layoutButtons];
257
261
  if (layoutButtons.length) {
258
262
  toolbarButtons.push({
@@ -275,11 +279,11 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
275
279
  dispatch
276
280
  } = editorView;
277
281
  const selectedMediaSingleNode = getSelectedMediaSingle(state);
278
- const contentWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt2 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt2 === void 0 ? void 0 : _widthPlugin$sharedSt2.lineLength) || akEditorDefaultLayoutWidth;
279
- const containerWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt3 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt3 === void 0 ? void 0 : _widthPlugin$sharedSt3.width) || akEditorFullWidthLayoutWidth;
280
282
  if (!selectedMediaSingleNode) {
281
283
  return null;
282
284
  }
285
+ const contentWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt2 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt2 === void 0 ? void 0 : _widthPlugin$sharedSt2.lineLength) || akEditorDefaultLayoutWidth;
286
+ const containerWidth = (widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt3 = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt3 === void 0 ? void 0 : _widthPlugin$sharedSt3.width) || akEditorFullWidthLayoutWidth;
283
287
  const selectedMediaNode = selectedMediaSingleNode.node.content.firstChild;
284
288
  if (!selectedMediaNode) {
285
289
  return null;
@@ -293,6 +297,10 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
293
297
  width: mediaWidth,
294
298
  height: mediaHeight
295
299
  } = selectedMediaNode.attrs;
300
+ const maxWidthForNestedNode = getMaxWidthForNestedNodeNext(editorView, selectedMediaSingleNode.pos);
301
+ const maxWidth = maxWidthForNestedNode || akEditorFullWidthLayoutWidth;
302
+ const isVideoFile = isVideo(selectedMediaNode.attrs.__fileMimeType);
303
+ const minWidth = calcMinWidth(isVideoFile, maxWidthForNestedNode || contentWidth);
296
304
  const isLegacy = widthType !== 'pixel';
297
305
  const pixelWidth = calcMediaSinglePixelWidth({
298
306
  width: singleMediaWidth,
@@ -309,11 +317,21 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
309
317
  showMigration: !pluginState.isResizing && isLegacy,
310
318
  mediaWidth: mediaWidth || DEFAULT_IMAGE_WIDTH,
311
319
  mediaHeight: mediaHeight || DEFAULT_IMAGE_HEIGHT,
320
+ minWidth: minWidth,
321
+ maxWidth: maxWidth,
312
322
  validate: value => {
313
- if (value !== '' && !isNaN(value) && value >= MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH && value <= akEditorFullWidthLayoutWidth) {
314
- return true;
323
+ if (value && (value < minWidth || value > maxWidth)) {
324
+ hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true, 'warning')(editorView.state, dispatch, editorView);
325
+ } else {
326
+ // remove decoration when:
327
+ // input is within min-max range or
328
+ // input is empty
329
+ hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false)(editorView.state, dispatch, editorView);
330
+ }
331
+ if (value === '') {
332
+ return false;
315
333
  }
316
- return false;
334
+ return true;
317
335
  },
318
336
  onSubmit: ({
319
337
  width
@@ -366,14 +384,14 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
366
384
  };
367
385
  const openLink = () => {
368
386
  if (editorView) {
369
- var _pluginInjectionApi$d6;
387
+ var _pluginInjectionApi$d7;
370
388
  const {
371
389
  state: {
372
390
  tr
373
391
  },
374
392
  dispatch
375
393
  } = editorView;
376
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.actions.attachAnalyticsEvent({
394
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.actions.attachAnalyticsEvent({
377
395
  eventType: EVENT_TYPE.TRACK,
378
396
  action: ACTION.VISITED,
379
397
  actionSubject: ACTION_SUBJECT.MEDIA,
@@ -399,14 +417,11 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
399
417
  }
400
418
  }
401
419
  if (allowAltTextOnImages) {
402
- var _pluginInjectionApi$d7;
403
- 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), {
420
+ var _pluginInjectionApi$d8;
421
+ 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), {
404
422
  type: 'separator'
405
423
  });
406
424
  }
407
- const {
408
- hoverDecoration
409
- } = (_pluginInjectionApi$d8 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d8 !== void 0 ? _pluginInjectionApi$d8 : {};
410
425
  const removeButton = {
411
426
  id: 'editor.media.delete',
412
427
  type: 'button',