@atlaskit/editor-core 187.32.1 → 187.32.3

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 (74) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/labs/next/presets/universal.js +2 -1
  3. package/dist/cjs/plugins/index.js +0 -7
  4. package/dist/cjs/plugins/media/toolbar/index.js +2 -9
  5. package/dist/cjs/plugins/media/ui/PixelEntry/index.js +14 -25
  6. package/dist/cjs/plugins/media/utils/media-single.js +1 -1
  7. package/dist/cjs/ui/ContentStyles/index.js +13 -12
  8. package/dist/cjs/ui/styles.js +3 -5
  9. package/dist/cjs/version-wrapper.js +1 -1
  10. package/dist/es2019/labs/next/presets/universal.js +2 -1
  11. package/dist/es2019/plugins/index.js +0 -1
  12. package/dist/es2019/plugins/media/toolbar/index.js +2 -9
  13. package/dist/es2019/plugins/media/ui/PixelEntry/index.js +14 -25
  14. package/dist/es2019/plugins/media/utils/media-single.js +2 -2
  15. package/dist/es2019/ui/ContentStyles/index.js +25 -3
  16. package/dist/es2019/ui/styles.js +0 -3
  17. package/dist/es2019/version-wrapper.js +1 -1
  18. package/dist/esm/labs/next/presets/universal.js +2 -1
  19. package/dist/esm/plugins/index.js +0 -1
  20. package/dist/esm/plugins/media/toolbar/index.js +2 -9
  21. package/dist/esm/plugins/media/ui/PixelEntry/index.js +14 -25
  22. package/dist/esm/plugins/media/utils/media-single.js +2 -2
  23. package/dist/esm/ui/ContentStyles/index.js +6 -5
  24. package/dist/esm/ui/styles.js +2 -3
  25. package/dist/esm/version-wrapper.js +1 -1
  26. package/dist/types/plugins/index.d.ts +0 -1
  27. package/dist/types/plugins/media/ui/PixelEntry/index.d.ts +1 -1
  28. package/dist/types/plugins/media/ui/PixelEntry/types.d.ts +7 -2
  29. package/dist/types/ui/styles.d.ts +0 -1
  30. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  31. package/dist/types-ts4.5/plugins/media/ui/PixelEntry/index.d.ts +1 -1
  32. package/dist/types-ts4.5/plugins/media/ui/PixelEntry/types.d.ts +7 -2
  33. package/dist/types-ts4.5/ui/styles.d.ts +0 -1
  34. package/package.json +2 -2
  35. package/dist/cjs/plugins/emoji/commands/insert-emoji.js +0 -47
  36. package/dist/cjs/plugins/emoji/index.js +0 -409
  37. package/dist/cjs/plugins/emoji/messages.js +0 -15
  38. package/dist/cjs/plugins/emoji/nodeviews/emoji.js +0 -34
  39. package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -235
  40. package/dist/cjs/plugins/emoji/styles.js +0 -14
  41. package/dist/cjs/plugins/emoji/types.js +0 -5
  42. package/dist/cjs/plugins/emoji/ui/Emoji/index.js +0 -16
  43. package/dist/es2019/plugins/emoji/commands/insert-emoji.js +0 -40
  44. package/dist/es2019/plugins/emoji/index.js +0 -381
  45. package/dist/es2019/plugins/emoji/messages.js +0 -8
  46. package/dist/es2019/plugins/emoji/nodeviews/emoji.js +0 -29
  47. package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -169
  48. package/dist/es2019/plugins/emoji/styles.js +0 -25
  49. package/dist/es2019/plugins/emoji/types.js +0 -1
  50. package/dist/es2019/plugins/emoji/ui/Emoji/index.js +0 -9
  51. package/dist/esm/plugins/emoji/commands/insert-emoji.js +0 -39
  52. package/dist/esm/plugins/emoji/index.js +0 -391
  53. package/dist/esm/plugins/emoji/messages.js +0 -8
  54. package/dist/esm/plugins/emoji/nodeviews/emoji.js +0 -27
  55. package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +0 -225
  56. package/dist/esm/plugins/emoji/styles.js +0 -6
  57. package/dist/esm/plugins/emoji/types.js +0 -1
  58. package/dist/esm/plugins/emoji/ui/Emoji/index.js +0 -9
  59. package/dist/types/plugins/emoji/commands/insert-emoji.d.ts +0 -4
  60. package/dist/types/plugins/emoji/index.d.ts +0 -40
  61. package/dist/types/plugins/emoji/messages.d.ts +0 -7
  62. package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +0 -7
  63. package/dist/types/plugins/emoji/pm-plugins/ascii-input-rules.d.ts +0 -10
  64. package/dist/types/plugins/emoji/styles.d.ts +0 -1
  65. package/dist/types/plugins/emoji/types.d.ts +0 -1
  66. package/dist/types/plugins/emoji/ui/Emoji/index.d.ts +0 -4
  67. package/dist/types-ts4.5/plugins/emoji/commands/insert-emoji.d.ts +0 -4
  68. package/dist/types-ts4.5/plugins/emoji/index.d.ts +0 -40
  69. package/dist/types-ts4.5/plugins/emoji/messages.d.ts +0 -7
  70. package/dist/types-ts4.5/plugins/emoji/nodeviews/emoji.d.ts +0 -7
  71. package/dist/types-ts4.5/plugins/emoji/pm-plugins/ascii-input-rules.d.ts +0 -10
  72. package/dist/types-ts4.5/plugins/emoji/styles.d.ts +0 -1
  73. package/dist/types-ts4.5/plugins/emoji/types.d.ts +0 -1
  74. package/dist/types-ts4.5/plugins/emoji/ui/Emoji/index.d.ts +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.32.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`113fcc02759`](https://bitbucket.org/atlassian/atlassian-frontend/commits/113fcc02759) - ED-19433 Extract Emoji Plugin to its own package
8
+ - Updated dependencies
9
+
10
+ ## 187.32.2
11
+
12
+ ### Patch Changes
13
+
14
+ - [`eab48233583`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eab48233583) - Calculate parent content width properly when inserting a nested media single node
15
+
3
16
  ## 187.32.1
4
17
 
5
18
  ### Patch Changes
@@ -9,6 +9,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _api = require("../../../selection-api/api");
11
11
  var _plugins = require("../../../plugins");
12
+ var _editorPluginEmoji = require("@atlaskit/editor-plugin-emoji");
12
13
  var _editorPluginList = require("@atlaskit/editor-plugin-list");
13
14
  var _editorPluginImageUpload = require("@atlaskit/editor-plugin-image-upload");
14
15
  var _editorPluginGuideline = require("@atlaskit/editor-plugin-guideline");
@@ -139,7 +140,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
139
140
  }]);
140
141
  }
141
142
  return builder;
142
- }).maybeAdd(_plugins.emojiPlugin, function (plugin, builder) {
143
+ }).maybeAdd(_editorPluginEmoji.emojiPlugin, function (plugin, builder) {
143
144
  if (props.emojiProvider) {
144
145
  return builder.add(plugin);
145
146
  }
@@ -131,12 +131,6 @@ Object.defineProperty(exports, "datePlugin", {
131
131
  return _date.default;
132
132
  }
133
133
  });
134
- Object.defineProperty(exports, "emojiPlugin", {
135
- enumerable: true,
136
- get: function get() {
137
- return _emoji.emojiPlugin;
138
- }
139
- });
140
134
  Object.defineProperty(exports, "expandPlugin", {
141
135
  enumerable: true,
142
136
  get: function get() {
@@ -366,7 +360,6 @@ var _clearMarksOnChangeToEmptyDocument = _interopRequireDefault(require("./clear
366
360
  var _codeBlock = _interopRequireDefault(require("./code-block"));
367
361
  var _collabEdit = _interopRequireDefault(require("./collab-edit"));
368
362
  var _date = _interopRequireDefault(require("./date"));
369
- var _emoji = require("./emoji");
370
363
  var _extension = _interopRequireDefault(require("./extension"));
371
364
  var _fakeTextCursor = _interopRequireDefault(require("./fake-text-cursor"));
372
365
  var _helpDialog = _interopRequireDefault(require("./help-dialog"));
@@ -304,19 +304,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
304
304
  mediaHeight: mediaHeight || _mediaSingle2.DEFAULT_IMAGE_HEIGHT,
305
305
  minWidth: minWidth,
306
306
  maxWidth: maxWidth,
307
- validate: function validate(value) {
308
- if (value && (value < minWidth || value > maxWidth)) {
307
+ onChange: function onChange(valid) {
308
+ if (valid) {
309
309
  hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true, 'warning')(editorView.state, dispatch, editorView);
310
310
  } else {
311
- // remove decoration when:
312
- // input is within min-max range or
313
- // input is empty
314
311
  hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false)(editorView.state, dispatch, editorView);
315
312
  }
316
- if (value === '') {
317
- return false;
318
- }
319
- return true;
320
313
  },
321
314
  onSubmit: function onSubmit(_ref2) {
322
315
  var width = _ref2.width;
@@ -26,9 +26,9 @@ var PixelEntry = function PixelEntry(_ref) {
26
26
  mediaWidth = _ref.mediaWidth,
27
27
  mediaHeight = _ref.mediaHeight,
28
28
  onSubmit = _ref.onSubmit,
29
- validate = _ref.validate,
30
29
  minWidth = _ref.minWidth,
31
30
  maxWidth = _ref.maxWidth,
31
+ onChange = _ref.onChange,
32
32
  formatMessage = _ref.intl.formatMessage,
33
33
  showMigration = _ref.showMigration,
34
34
  onMigrate = _ref.onMigrate;
@@ -55,6 +55,9 @@ var PixelEntry = function PixelEntry(_ref) {
55
55
 
56
56
  // Handle submit when user presses enter in form
57
57
  var handleOnSubmit = function handleOnSubmit(data) {
58
+ if (data.inputWidth === '' || data.inputHeight === '') {
59
+ return;
60
+ }
58
61
  if (onSubmit) {
59
62
  var widthToBeSumitted = data.inputWidth;
60
63
  var isInvalidInput = false;
@@ -80,46 +83,33 @@ var PixelEntry = function PixelEntry(_ref) {
80
83
  }
81
84
  };
82
85
 
83
- // Syncronous validation returning undefined for valid and string for invalid
84
- var handleValidateWidth = (0, _react2.useCallback)(function (value) {
85
- if (!validate || value === undefined) {
86
- return;
87
- }
88
- if (validate) {
89
- return validate(value) === true ? undefined : formatMessage(_messages.messages.validationFailedMessage);
90
- }
91
- return;
92
- }, [validate, formatMessage]);
93
-
94
86
  // Handle updating computed fields based on
95
87
  var handleOnChange = (0, _react2.useCallback)(function (type) {
96
88
  return function (event) {
97
89
  var value = parseInt(event.currentTarget.value);
98
- var newInputValue = isNaN(value) ? '' : parseInt(event.currentTarget.value);
90
+ var newInputValue = isNaN(value) ? '' : value;
91
+ var newWidth = '';
99
92
  switch (type) {
100
93
  case 'inputWidth':
101
94
  {
95
+ newWidth = newInputValue;
102
96
  setComputedWidth(newInputValue);
103
- if (newInputValue) {
104
- setComputedHeight(Math.round(ratioWidth * value));
105
- } else {
106
- setComputedHeight('');
107
- }
97
+ var newHeight = newInputValue !== '' ? Math.round(ratioWidth * newInputValue) : '';
98
+ setComputedHeight(newHeight);
108
99
  break;
109
100
  }
110
101
  case 'inputHeight':
111
102
  {
112
103
  setComputedHeight(newInputValue);
113
- if (newInputValue) {
114
- setComputedWidth(Math.round(ratioHeight * value));
115
- } else {
116
- setComputedWidth('');
117
- }
104
+ newWidth = newInputValue !== '' ? Math.round(ratioHeight * newInputValue) : '';
105
+ setComputedWidth(newWidth);
118
106
  break;
119
107
  }
120
108
  }
109
+ var isInvalidInputValid = newWidth !== '' && (newWidth < minWidth || newWidth > maxWidth);
110
+ onChange && onChange(isInvalidInputValid);
121
111
  };
122
- }, [ratioHeight, ratioWidth]);
112
+ }, [minWidth, maxWidth, onChange, ratioWidth, ratioHeight]);
123
113
  if (showMigration) {
124
114
  return (0, _react.jsx)(_tooltip.default, {
125
115
  content: formatMessage(_messages.messages.migrationButtonTooltip)
@@ -141,7 +131,6 @@ var PixelEntry = function PixelEntry(_ref) {
141
131
  }, (0, _react.jsx)(_form.Field, {
142
132
  key: "inputWidth",
143
133
  name: "inputWidth",
144
- validate: handleValidateWidth,
145
134
  defaultValue: computedWidth
146
135
  }, function (_ref3) {
147
136
  var fieldProps = _ref3.fieldProps;
@@ -103,7 +103,7 @@ var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inp
103
103
 
104
104
  // add undefined as fallback as we don't want media single width to have upper limit as 0
105
105
  // if widthPluginState.width is 0, default 760 will be used
106
- var contentWidth = (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
106
+ var contentWidth = (0, _mediaSingle.getMaxWidthForNestedNodeNext)(view, state.selection.$from.pos, true) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
107
107
  var node = createMediaSingleNode(state.schema, collection, contentWidth, mediaState.status !== 'error' && isVideo(mediaState.fileMimeType) ? _mediaSingle.MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : _mediaSingle.MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, alignLeftOnInsert)(mediaState);
108
108
  var fileExtension;
109
109
  if (mediaState.fileName) {
@@ -23,28 +23,29 @@ var _styles9 = require("../../plugins/layout/styles");
23
23
  var _styles10 = require("../../plugins/panel/styles");
24
24
  var _styles11 = require("../../plugins/fake-text-cursor/styles");
25
25
  var _styles12 = require("../../plugins/mentions/styles");
26
- var _styles13 = require("../../plugins/emoji/styles");
27
- var _styles14 = require("../../plugins/placeholder-text/styles");
28
- var _styles15 = require("../../plugins/extension/ui/styles");
29
- var _styles16 = require("../../plugins/expand/ui/styles");
26
+ var _styles13 = require("../../plugins/placeholder-text/styles");
27
+ var _styles14 = require("../../plugins/extension/ui/styles");
28
+ var _styles15 = require("../../plugins/expand/ui/styles");
30
29
  var _style = require("../../plugins/media/pm-plugins/alt-text/style");
31
- var _styles17 = require("../../plugins/find-replace/styles");
32
- var _styles18 = require("../../plugins/tasks-and-decisions/styles");
33
- var _styles19 = require("../../plugins/status/styles");
34
- var _styles20 = require("../../plugins/date/styles");
30
+ var _styles16 = require("../../plugins/find-replace/styles");
31
+ var _styles17 = require("../../plugins/tasks-and-decisions/styles");
32
+ var _styles18 = require("../../plugins/status/styles");
33
+ var _styles19 = require("../../plugins/date/styles");
35
34
  var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
36
35
  var _utils = require("@atlaskit/editor-common/utils");
37
- var _templateObject, _templateObject2, _templateObject3;
36
+ var _emoji = require("@atlaskit/editor-common/emoji");
37
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
38
38
  /** @jsx jsx */
39
39
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
40
40
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
41
  var linkStyles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", "\n }\n"])), _styles.linkSharedStyle);
42
42
  exports.linkStyles = linkStyles;
43
- var listsStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin: 4px 0 0 0;\n }\n\n // In SSR the above rule will apply to all p tags because first-child would be a style tag.\n // The following rule resets the first p tag back to its original margin\n // defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n > style:first-child + p {\n margin-top: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n }\n"])), _editorSharedStyles.blockNodesVerticalMargin, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
43
+ var listsStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin: ", " 0 0 0;\n }\n\n // In SSR the above rule will apply to all p tags because first-child would be a style tag.\n // The following rule resets the first p tag back to its original margin\n // defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n > style:first-child + p {\n margin-top: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n }\n"])), "var(--ds-space-050, 4px)", _editorSharedStyles.blockNodesVerticalMargin, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
44
+ var emojiStyles = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), _emoji.EmojiSharedCssClassName.EMOJI_CONTAINER, _emoji.EmojiSharedCssClassName.EMOJI_NODE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, _editorSharedStyles.akEditorSelectedNodeClassName, _emoji.EmojiSharedCssClassName.EMOJI_SPRITE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.BoxShadow]));
44
45
  var contentStyles = function contentStyles(props) {
45
- return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
46
+ return (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
46
47
  theme: props.theme
47
- }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles14.placeholderTextStyles, _styles4.placeholderStyles, (0, _styles6.codeBlockStyles)(props), (0, _styles5.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, (0, _styles7.ruleStyles)(props), _styles8.mediaStyles, (0, _styles9.layoutStyles)(props), _styles2.telepointerStyle, _styles3.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles10.panelStyles)(props), _styles11.fakeCursorStyles, _styles12.mentionsStyles, _styles13.emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles15.extensionStyles, (0, _styles16.expandStyles)(props), _styles17.findReplaceStyles, _styles18.taskDecisionStyles, _styles19.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _styles20.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
48
+ }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles13.placeholderTextStyles, _styles4.placeholderStyles, (0, _styles6.codeBlockStyles)(props), (0, _styles5.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, (0, _styles7.ruleStyles)(props), _styles8.mediaStyles, (0, _styles9.layoutStyles)(props), _styles2.telepointerStyle, _styles3.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles10.panelStyles)(props), _styles11.fakeCursorStyles, _styles12.mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles14.extensionStyles, (0, _styles15.expandStyles)(props), _styles16.findReplaceStyles, _styles17.taskDecisionStyles, _styles18.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _styles19.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
48
49
  };
49
50
  var createEditorContentStyle = function createEditorContentStyle(styles) {
50
51
  return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
@@ -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.expandIconWrapperStyle = exports.clickSelectWrapperStyle = void 0;
7
+ exports.expandIconWrapperStyle = void 0;
8
8
  Object.defineProperty(exports, "scrollbarStyles", {
9
9
  enumerable: true,
10
10
  get: function get() {
@@ -21,8 +21,6 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
21
21
  var _react = require("@emotion/react");
22
22
  var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
23
23
  var _scrollbar = require("@atlaskit/editor-shared-styles/scrollbar");
24
- var _templateObject, _templateObject2;
24
+ var _templateObject;
25
25
  var expandIconWrapperStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin-left: -8px;\n"])));
26
- exports.expandIconWrapperStyle = expandIconWrapperStyle;
27
- var clickSelectWrapperStyle = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n user-select: all;\n"])));
28
- exports.clickSelectWrapperStyle = clickSelectWrapperStyle;
26
+ exports.expandIconWrapperStyle = expandIconWrapperStyle;
@@ -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.32.1";
9
+ var version = "187.32.3";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,6 @@
1
1
  import { createEditorSelectionAPI } from '../../../selection-api/api';
2
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
2
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
3
+ import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
3
4
  import { listPlugin } from '@atlaskit/editor-plugin-list';
4
5
  import { imageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
5
6
  import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
@@ -6,7 +6,6 @@ export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-mark
6
6
  export { default as codeBlockPlugin } from './code-block';
7
7
  export { default as collabEditPlugin } from './collab-edit';
8
8
  export { default as datePlugin } from './date';
9
- export { emojiPlugin } from './emoji';
10
9
  export { default as extensionPlugin } from './extension';
11
10
  export { default as fakeTextCursorPlugin } from './fake-text-cursor';
12
11
  export { default as helpDialogPlugin } from './help-dialog';
@@ -310,19 +310,12 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
310
310
  mediaHeight: mediaHeight || DEFAULT_IMAGE_HEIGHT,
311
311
  minWidth: minWidth,
312
312
  maxWidth: maxWidth,
313
- validate: value => {
314
- if (value && (value < minWidth || value > maxWidth)) {
313
+ onChange: valid => {
314
+ if (valid) {
315
315
  hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true, 'warning')(editorView.state, dispatch, editorView);
316
316
  } else {
317
- // remove decoration when:
318
- // input is within min-max range or
319
- // input is empty
320
317
  hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false)(editorView.state, dispatch, editorView);
321
318
  }
322
- if (value === '') {
323
- return false;
324
- }
325
- return true;
326
319
  },
327
320
  onSubmit: ({
328
321
  width
@@ -14,9 +14,9 @@ export const PixelEntry = ({
14
14
  mediaWidth,
15
15
  mediaHeight,
16
16
  onSubmit,
17
- validate,
18
17
  minWidth,
19
18
  maxWidth,
19
+ onChange,
20
20
  intl: {
21
21
  formatMessage
22
22
  },
@@ -40,6 +40,9 @@ export const PixelEntry = ({
40
40
 
41
41
  // Handle submit when user presses enter in form
42
42
  const handleOnSubmit = data => {
43
+ if (data.inputWidth === '' || data.inputHeight === '') {
44
+ return;
45
+ }
43
46
  if (onSubmit) {
44
47
  let widthToBeSumitted = data.inputWidth;
45
48
  let isInvalidInput = false;
@@ -65,44 +68,31 @@ export const PixelEntry = ({
65
68
  }
66
69
  };
67
70
 
68
- // Syncronous validation returning undefined for valid and string for invalid
69
- const handleValidateWidth = useCallback(value => {
70
- if (!validate || value === undefined) {
71
- return;
72
- }
73
- if (validate) {
74
- return validate(value) === true ? undefined : formatMessage(messages.validationFailedMessage);
75
- }
76
- return;
77
- }, [validate, formatMessage]);
78
-
79
71
  // Handle updating computed fields based on
80
72
  const handleOnChange = useCallback(type => event => {
81
73
  const value = parseInt(event.currentTarget.value);
82
- const newInputValue = isNaN(value) ? '' : parseInt(event.currentTarget.value);
74
+ const newInputValue = isNaN(value) ? '' : value;
75
+ let newWidth = '';
83
76
  switch (type) {
84
77
  case 'inputWidth':
85
78
  {
79
+ newWidth = newInputValue;
86
80
  setComputedWidth(newInputValue);
87
- if (newInputValue) {
88
- setComputedHeight(Math.round(ratioWidth * value));
89
- } else {
90
- setComputedHeight('');
91
- }
81
+ const newHeight = newInputValue !== '' ? Math.round(ratioWidth * newInputValue) : '';
82
+ setComputedHeight(newHeight);
92
83
  break;
93
84
  }
94
85
  case 'inputHeight':
95
86
  {
96
87
  setComputedHeight(newInputValue);
97
- if (newInputValue) {
98
- setComputedWidth(Math.round(ratioHeight * value));
99
- } else {
100
- setComputedWidth('');
101
- }
88
+ newWidth = newInputValue !== '' ? Math.round(ratioHeight * newInputValue) : '';
89
+ setComputedWidth(newWidth);
102
90
  break;
103
91
  }
104
92
  }
105
- }, [ratioHeight, ratioWidth]);
93
+ const isInvalidInputValid = newWidth !== '' && (newWidth < minWidth || newWidth > maxWidth);
94
+ onChange && onChange(isInvalidInputValid);
95
+ }, [minWidth, maxWidth, onChange, ratioWidth, ratioHeight]);
106
96
  if (showMigration) {
107
97
  return jsx(Tooltip, {
108
98
  content: formatMessage(messages.migrationButtonTooltip)
@@ -125,7 +115,6 @@ export const PixelEntry = ({
125
115
  }, jsx(Field, {
126
116
  key: "inputWidth",
127
117
  name: "inputWidth",
128
- validate: handleValidateWidth,
129
118
  defaultValue: computedWidth
130
119
  }, ({
131
120
  fieldProps
@@ -1,7 +1,7 @@
1
1
  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
- import { getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
4
+ import { getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
5
5
  import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
6
6
  import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
7
7
  import { mapSlice } from '../../../utils/slice';
@@ -93,7 +93,7 @@ export const insertMediaSingleNode = (view, mediaState, inputMethod, collection,
93
93
 
94
94
  // add undefined as fallback as we don't want media single width to have upper limit as 0
95
95
  // if widthPluginState.width is 0, default 760 will be used
96
- const contentWidth = (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
96
+ const contentWidth = getMaxWidthForNestedNodeNext(view, state.selection.$from.pos, true) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
97
97
  const node = createMediaSingleNode(state.schema, collection, contentWidth, mediaState.status !== 'error' && isVideo(mediaState.fileMimeType) ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, alignLeftOnInsert)(mediaState);
98
98
  let fileExtension;
99
99
  if (mediaState.fileName) {
@@ -2,7 +2,7 @@
2
2
  import React, { useMemo } from 'react';
3
3
  import { jsx, css, useTheme } from '@emotion/react';
4
4
  import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles, smartCardStyles, embedCardStyles, codeBlockInListSafariFix, unsupportedStyles } from '@atlaskit/editor-common/styles';
5
- import { blockNodesVerticalMargin, editorFontSize } from '@atlaskit/editor-shared-styles';
5
+ import { akEditorSelectedNodeClassName, blockNodesVerticalMargin, editorFontSize, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
6
6
  import { telepointerStyle } from '../../plugins/collab-edit/styles';
7
7
  import { gapCursorStyles } from '../../plugins/selection/gap-cursor/styles';
8
8
  import { tableStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
@@ -15,7 +15,6 @@ import { layoutStyles } from '../../plugins/layout/styles';
15
15
  import { panelStyles } from '../../plugins/panel/styles';
16
16
  import { fakeCursorStyles } from '../../plugins/fake-text-cursor/styles';
17
17
  import { mentionsStyles } from '../../plugins/mentions/styles';
18
- import { emojiStyles } from '../../plugins/emoji/styles';
19
18
  import { placeholderTextStyles } from '../../plugins/placeholder-text/styles';
20
19
  import { extensionStyles } from '../../plugins/extension/ui/styles';
21
20
  import { expandStyles } from '../../plugins/expand/ui/styles';
@@ -27,6 +26,7 @@ import { dateStyles } from '../../plugins/date/styles';
27
26
  import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
28
27
  import { linkSharedStyle, codeMarkSharedStyles } from '@atlaskit/editor-common/styles';
29
28
  import { browser } from '@atlaskit/editor-common/utils';
29
+ import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
30
30
  export const linkStyles = css`
31
31
  .ProseMirror {
32
32
  ${linkSharedStyle}
@@ -38,7 +38,7 @@ const listsStyles = css`
38
38
  position: relative;
39
39
 
40
40
  > p:not(:first-child) {
41
- margin: 4px 0 0 0;
41
+ margin: ${"var(--ds-space-050, 4px)"} 0 0 0;
42
42
  }
43
43
 
44
44
  // In SSR the above rule will apply to all p tags because first-child would be a style tag.
@@ -54,6 +54,28 @@ const listsStyles = css`
54
54
  }
55
55
  }
56
56
  `;
57
+ const emojiStyles = css`
58
+ .${EmojiSharedCssClassName.EMOJI_CONTAINER} {
59
+ display: inline-block;
60
+
61
+ .${EmojiSharedCssClassName.EMOJI_NODE} {
62
+ cursor: pointer;
63
+
64
+ &.${EmojiSharedCssClassName.EMOJI_IMAGE} > span {
65
+ /** needed for selection style to cover custom emoji image properly */
66
+ display: flex;
67
+ }
68
+ }
69
+
70
+ &.${akEditorSelectedNodeClassName} {
71
+ .${EmojiSharedCssClassName.EMOJI_SPRITE},
72
+ .${EmojiSharedCssClassName.EMOJI_IMAGE} {
73
+ border-radius: 2px;
74
+ ${getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow])}
75
+ }
76
+ }
77
+ }
78
+ `;
57
79
  const contentStyles = props => css`
58
80
  .ProseMirror {
59
81
  outline: none;
@@ -3,7 +3,4 @@ export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
3
3
  export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
4
4
  export const expandIconWrapperStyle = css`
5
5
  margin-left: -8px;
6
- `;
7
- export const clickSelectWrapperStyle = css`
8
- user-select: all;
9
6
  `;
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.32.1";
2
+ export const version = "187.32.3";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -3,7 +3,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  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; }
4
4
  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) { _defineProperty(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; }
5
5
  import { createEditorSelectionAPI } from '../../../selection-api/api';
6
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
6
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
7
+ import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
7
8
  import { listPlugin } from '@atlaskit/editor-plugin-list';
8
9
  import { imageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
9
10
  import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
@@ -6,7 +6,6 @@ export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-mark
6
6
  export { default as codeBlockPlugin } from './code-block';
7
7
  export { default as collabEditPlugin } from './collab-edit';
8
8
  export { default as datePlugin } from './date';
9
- export { emojiPlugin } from './emoji';
10
9
  export { default as extensionPlugin } from './extension';
11
10
  export { default as fakeTextCursorPlugin } from './fake-text-cursor';
12
11
  export { default as helpDialogPlugin } from './help-dialog';
@@ -297,19 +297,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
297
297
  mediaHeight: mediaHeight || DEFAULT_IMAGE_HEIGHT,
298
298
  minWidth: minWidth,
299
299
  maxWidth: maxWidth,
300
- validate: function validate(value) {
301
- if (value && (value < minWidth || value > maxWidth)) {
300
+ onChange: function onChange(valid) {
301
+ if (valid) {
302
302
  hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true, 'warning')(editorView.state, dispatch, editorView);
303
303
  } else {
304
- // remove decoration when:
305
- // input is within min-max range or
306
- // input is empty
307
304
  hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false)(editorView.state, dispatch, editorView);
308
305
  }
309
- if (value === '') {
310
- return false;
311
- }
312
- return true;
313
306
  },
314
307
  onSubmit: function onSubmit(_ref2) {
315
308
  var width = _ref2.width;
@@ -15,9 +15,9 @@ export var PixelEntry = function PixelEntry(_ref) {
15
15
  mediaWidth = _ref.mediaWidth,
16
16
  mediaHeight = _ref.mediaHeight,
17
17
  onSubmit = _ref.onSubmit,
18
- validate = _ref.validate,
19
18
  minWidth = _ref.minWidth,
20
19
  maxWidth = _ref.maxWidth,
20
+ onChange = _ref.onChange,
21
21
  formatMessage = _ref.intl.formatMessage,
22
22
  showMigration = _ref.showMigration,
23
23
  onMigrate = _ref.onMigrate;
@@ -44,6 +44,9 @@ export var PixelEntry = function PixelEntry(_ref) {
44
44
 
45
45
  // Handle submit when user presses enter in form
46
46
  var handleOnSubmit = function handleOnSubmit(data) {
47
+ if (data.inputWidth === '' || data.inputHeight === '') {
48
+ return;
49
+ }
47
50
  if (onSubmit) {
48
51
  var widthToBeSumitted = data.inputWidth;
49
52
  var isInvalidInput = false;
@@ -69,46 +72,33 @@ export var PixelEntry = function PixelEntry(_ref) {
69
72
  }
70
73
  };
71
74
 
72
- // Syncronous validation returning undefined for valid and string for invalid
73
- var handleValidateWidth = useCallback(function (value) {
74
- if (!validate || value === undefined) {
75
- return;
76
- }
77
- if (validate) {
78
- return validate(value) === true ? undefined : formatMessage(messages.validationFailedMessage);
79
- }
80
- return;
81
- }, [validate, formatMessage]);
82
-
83
75
  // Handle updating computed fields based on
84
76
  var handleOnChange = useCallback(function (type) {
85
77
  return function (event) {
86
78
  var value = parseInt(event.currentTarget.value);
87
- var newInputValue = isNaN(value) ? '' : parseInt(event.currentTarget.value);
79
+ var newInputValue = isNaN(value) ? '' : value;
80
+ var newWidth = '';
88
81
  switch (type) {
89
82
  case 'inputWidth':
90
83
  {
84
+ newWidth = newInputValue;
91
85
  setComputedWidth(newInputValue);
92
- if (newInputValue) {
93
- setComputedHeight(Math.round(ratioWidth * value));
94
- } else {
95
- setComputedHeight('');
96
- }
86
+ var newHeight = newInputValue !== '' ? Math.round(ratioWidth * newInputValue) : '';
87
+ setComputedHeight(newHeight);
97
88
  break;
98
89
  }
99
90
  case 'inputHeight':
100
91
  {
101
92
  setComputedHeight(newInputValue);
102
- if (newInputValue) {
103
- setComputedWidth(Math.round(ratioHeight * value));
104
- } else {
105
- setComputedWidth('');
106
- }
93
+ newWidth = newInputValue !== '' ? Math.round(ratioHeight * newInputValue) : '';
94
+ setComputedWidth(newWidth);
107
95
  break;
108
96
  }
109
97
  }
98
+ var isInvalidInputValid = newWidth !== '' && (newWidth < minWidth || newWidth > maxWidth);
99
+ onChange && onChange(isInvalidInputValid);
110
100
  };
111
- }, [ratioHeight, ratioWidth]);
101
+ }, [minWidth, maxWidth, onChange, ratioWidth, ratioHeight]);
112
102
  if (showMigration) {
113
103
  return jsx(Tooltip, {
114
104
  content: formatMessage(messages.migrationButtonTooltip)
@@ -130,7 +120,6 @@ export var PixelEntry = function PixelEntry(_ref) {
130
120
  }, jsx(Field, {
131
121
  key: "inputWidth",
132
122
  name: "inputWidth",
133
- validate: handleValidateWidth,
134
123
  defaultValue: computedWidth
135
124
  }, function (_ref3) {
136
125
  var fieldProps = _ref3.fieldProps;