@atlaskit/editor-core 187.41.3 → 187.41.5

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 (79) hide show
  1. package/CHANGELOG.md +38 -18
  2. package/dist/cjs/create-editor/feature-flags-from-props.js +2 -3
  3. package/dist/cjs/plugins/collab-edit/ui/styles.js +2 -2
  4. package/dist/cjs/plugins/date/nodeviews/date.js +6 -1
  5. package/dist/cjs/plugins/extension/index.js +35 -9
  6. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +8 -15
  7. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +7 -18
  8. package/dist/cjs/plugins/media/styles.js +1 -1
  9. package/dist/cjs/plugins/media/toolbar/commands.js +63 -25
  10. package/dist/cjs/plugins/media/toolbar/index.js +13 -18
  11. package/dist/cjs/plugins/media/ui/ImageBorder/index.js +1 -3
  12. package/dist/cjs/plugins/media/ui/PixelEntry/index.js +6 -5
  13. package/dist/cjs/plugins/media/utils/analytics.js +1 -1
  14. package/dist/cjs/plugins/paste/handlers.js +2 -1
  15. package/dist/cjs/plugins/text-color/index.js +2 -6
  16. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +2 -5
  17. package/dist/cjs/ui/ColorPickerButton/index.js +3 -4
  18. package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +1 -11
  19. package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +1 -1
  20. package/dist/cjs/version-wrapper.js +1 -1
  21. package/dist/es2019/create-editor/feature-flags-from-props.js +2 -3
  22. package/dist/es2019/plugins/collab-edit/ui/styles.js +2 -2
  23. package/dist/es2019/plugins/date/nodeviews/date.js +6 -1
  24. package/dist/es2019/plugins/extension/index.js +30 -4
  25. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +8 -15
  26. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -15
  27. package/dist/es2019/plugins/media/styles.js +3 -5
  28. package/dist/es2019/plugins/media/toolbar/commands.js +31 -1
  29. package/dist/es2019/plugins/media/toolbar/index.js +14 -20
  30. package/dist/es2019/plugins/media/ui/ImageBorder/index.js +1 -3
  31. package/dist/es2019/plugins/media/ui/PixelEntry/index.js +6 -5
  32. package/dist/es2019/plugins/media/utils/analytics.js +1 -1
  33. package/dist/es2019/plugins/paste/handlers.js +2 -1
  34. package/dist/es2019/plugins/text-color/index.js +2 -6
  35. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +2 -7
  36. package/dist/es2019/ui/ColorPickerButton/index.js +2 -3
  37. package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +1 -11
  38. package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +1 -1
  39. package/dist/es2019/version-wrapper.js +1 -1
  40. package/dist/esm/create-editor/feature-flags-from-props.js +2 -3
  41. package/dist/esm/plugins/collab-edit/ui/styles.js +2 -2
  42. package/dist/esm/plugins/date/nodeviews/date.js +6 -1
  43. package/dist/esm/plugins/extension/index.js +35 -9
  44. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +8 -15
  45. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +7 -18
  46. package/dist/esm/plugins/media/styles.js +1 -1
  47. package/dist/esm/plugins/media/toolbar/commands.js +37 -1
  48. package/dist/esm/plugins/media/toolbar/index.js +14 -19
  49. package/dist/esm/plugins/media/ui/ImageBorder/index.js +1 -3
  50. package/dist/esm/plugins/media/ui/PixelEntry/index.js +6 -5
  51. package/dist/esm/plugins/media/utils/analytics.js +1 -1
  52. package/dist/esm/plugins/paste/handlers.js +2 -1
  53. package/dist/esm/plugins/text-color/index.js +2 -6
  54. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +2 -5
  55. package/dist/esm/ui/ColorPickerButton/index.js +3 -4
  56. package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +1 -11
  57. package/dist/esm/ui/ConfigPanel/Fields/Expand.js +1 -1
  58. package/dist/esm/version-wrapper.js +1 -1
  59. package/dist/types/labs/next/presets/default.d.ts +44 -2
  60. package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  61. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  62. package/dist/types/plugins/media/toolbar/commands.d.ts +3 -1
  63. package/dist/types/plugins/media/ui/ImageBorder/index.d.ts +3 -4
  64. package/dist/types/plugins/media/ui/PixelEntry/types.d.ts +2 -0
  65. package/dist/types/plugins/text-color/index.d.ts +1 -2
  66. package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +0 -2
  67. package/dist/types/ui/ColorPickerButton/index.d.ts +1 -2
  68. package/dist/types/ui/ConfigPanel/Fields/Expand.d.ts +2 -2
  69. package/dist/types-ts4.5/labs/next/presets/default.d.ts +54 -0
  70. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  71. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  72. package/dist/types-ts4.5/plugins/media/toolbar/commands.d.ts +3 -1
  73. package/dist/types-ts4.5/plugins/media/ui/ImageBorder/index.d.ts +3 -4
  74. package/dist/types-ts4.5/plugins/media/ui/PixelEntry/types.d.ts +2 -0
  75. package/dist/types-ts4.5/plugins/text-color/index.d.ts +0 -2
  76. package/dist/types-ts4.5/plugins/text-color/ui/ToolbarTextColor/index.d.ts +0 -2
  77. package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +1 -2
  78. package/dist/types-ts4.5/ui/ConfigPanel/Fields/Expand.d.ts +2 -2
  79. package/package.json +6 -6
@@ -229,7 +229,6 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
229
229
  var _pluginInjectionApi$a2;
230
230
  (0, _commands.setBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(attrs)(state, dispatch);
231
231
  },
232
- showSomewhatSemanticTooltips: getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().useSomewhatSemanticTextColorNames,
233
232
  borderMark: borderMark,
234
233
  intl: intl
235
234
  });
@@ -312,15 +311,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
312
311
  }
313
312
  },
314
313
  onSubmit: function onSubmit(_ref2) {
315
- var width = _ref2.width;
316
- var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
317
- width: width,
318
- widthType: 'pixel',
319
- layout: (0, _utils2.calcNewLayout)(width, layout, contentWidth, options.fullWidthEnabled)
320
- }));
321
- tr.setMeta('scrollIntoView', false);
322
- tr.setSelection(_state2.NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
323
- dispatch(tr);
314
+ var _pluginInjectionApi$a4;
315
+ var width = _ref2.width,
316
+ validation = _ref2.validation;
317
+ var newLayout = (0, _utils2.calcNewLayout)(width, layout, contentWidth, options.fullWidthEnabled);
318
+ (0, _commands.updateMediaSingleWidth)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(width, validation, newLayout)(state, dispatch);
324
319
  },
325
320
  onMigrate: function onMigrate() {
326
321
  var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
@@ -375,10 +370,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
375
370
  };
376
371
  var openLink = function openLink() {
377
372
  if (editorView) {
378
- var _pluginInjectionApi$a4;
373
+ var _pluginInjectionApi$a5;
379
374
  var tr = editorView.state.tr,
380
375
  dispatch = editorView.dispatch;
381
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions.attachAnalyticsEvent({
376
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions.attachAnalyticsEvent({
382
377
  eventType: _analytics.EVENT_TYPE.TRACK,
383
378
  action: _analytics.ACTION.VISITED,
384
379
  actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
@@ -404,8 +399,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
404
399
  }
405
400
  }
406
401
  if (allowAltTextOnImages) {
407
- var _pluginInjectionApi$a5;
408
- toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions), {
402
+ var _pluginInjectionApi$a6;
403
+ toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a6 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a6 === void 0 ? void 0 : _pluginInjectionApi$a6.actions), {
409
404
  type: 'separator'
410
405
  });
411
406
  }
@@ -489,22 +484,22 @@ var floatingToolbar = function floatingToolbar(state, intl) {
489
484
  selectedNodeType = state.selection.node.type;
490
485
  }
491
486
  if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
492
- var _pluginInjectionApi$a6;
487
+ var _pluginInjectionApi$a7;
493
488
  var mediaOffset = state.selection.$from.parentOffset + 1;
494
489
  baseToolbar.getDomRef = function () {
495
490
  var _mediaPluginState$ele;
496
491
  var selector = (0, _mediaFilmstrip.mediaFilmstripItemDOMSelector)(mediaOffset);
497
492
  return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
498
493
  };
499
- items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a6 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a6 === void 0 ? void 0 : _pluginInjectionApi$a6.actions);
494
+ items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 ? void 0 : _pluginInjectionApi$a7.actions);
500
495
  } else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
501
- var _pluginInjectionApi$a7;
496
+ var _pluginInjectionApi$a8;
502
497
  baseToolbar.getDomRef = function () {
503
498
  var _mediaPluginState$ele2;
504
499
  var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(_styles.MediaInlineNodeSelector));
505
500
  return element || mediaPluginState.element;
506
501
  };
507
- items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 ? void 0 : _pluginInjectionApi$a7.actions);
502
+ items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a8 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a8 === void 0 ? void 0 : _pluginInjectionApi$a8.actions);
508
503
  } else {
509
504
  baseToolbar.getDomRef = function () {
510
505
  var _mediaPluginState$ele3;
@@ -24,7 +24,6 @@ var _messages = require("./messages");
24
24
  var ImageBorder = function ImageBorder(_ref) {
25
25
  var formatMessage = _ref.intl.formatMessage,
26
26
  toggleBorder = _ref.toggleBorder,
27
- showSomewhatSemanticTooltips = _ref.showSomewhatSemanticTooltips,
28
27
  borderMark = _ref.borderMark,
29
28
  setBorder = _ref.setBorder;
30
29
  var popupTarget = (0, _react2.useRef)(null);
@@ -85,8 +84,7 @@ var ImageBorder = function ImageBorder(_ref) {
85
84
  paletteOptions: {
86
85
  palette: _uiColor.borderColorPalette,
87
86
  paletteColorTooltipMessages: _uiColor.borderPaletteTooltipMessages,
88
- hexToPaletteColor: _editorPalette.hexToEditorBorderPaletteColor,
89
- showSomewhatSemanticTooltips: showSomewhatSemanticTooltips
87
+ hexToPaletteColor: _editorPalette.hexToEditorBorderPaletteColor
90
88
  }
91
89
  })))
92
90
  }, {
@@ -60,25 +60,26 @@ var PixelEntry = function PixelEntry(_ref) {
60
60
  }
61
61
  if (onSubmit) {
62
62
  var widthToBeSumitted = data.inputWidth;
63
- var isInvalidInput = false;
63
+ var validation = 'valid';
64
64
  if (data.inputWidth < minWidth) {
65
65
  widthToBeSumitted = minWidth;
66
- isInvalidInput = true;
66
+ validation = 'less-than-min';
67
67
  }
68
68
  if (data.inputWidth > maxWidth) {
69
69
  widthToBeSumitted = maxWidth;
70
- isInvalidInput = true;
70
+ validation = 'greater-than-max';
71
71
  }
72
72
 
73
73
  // If user keeps submitting an invalid input, node width attribute will be updated with the same value
74
74
  // and won't upadte the state in useEffect (since width is the same)
75
75
  // Thus, we set the state here to always display the correct dimension
76
- if (isInvalidInput) {
76
+ if (validation !== 'valid') {
77
77
  setComputedWidth(widthToBeSumitted);
78
78
  setComputedHeight(Math.round(ratioWidth * widthToBeSumitted));
79
79
  }
80
80
  onSubmit({
81
- width: widthToBeSumitted
81
+ width: widthToBeSumitted,
82
+ validation: validation
82
83
  });
83
84
  }
84
85
  };
@@ -42,7 +42,7 @@ var getMediaInputResizeAnalyticsEvent = function getMediaInputResizeAnalyticsEve
42
42
  return {
43
43
  action: _analytics.ACTION.EDITED,
44
44
  actionSubject: actionSubject,
45
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.INPUT_RESIZED,
45
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.RESIZED,
46
46
  attributes: {
47
47
  width: width,
48
48
  layout: layout,
@@ -645,7 +645,8 @@ function handleMarkdown(markdownSlice, queueCardsFromChangedTr, from, to) {
645
645
  } else {
646
646
  tr.replaceSelection(markdownSlice);
647
647
  }
648
- tr.setSelection(_state.TextSelection.near(tr.doc.resolve(pastesFrom + markdownSlice.size), -1));
648
+ var textPosition = tr.doc.resolve(Math.min(pastesFrom + markdownSlice.size, tr.doc.content.size));
649
+ tr.setSelection(_state.TextSelection.near(textPosition, -1));
649
650
  queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
650
651
  if (dispatch) {
651
652
  dispatch(tr.scrollIntoView());
@@ -23,10 +23,7 @@ var pluginConfig = function pluginConfig(textColorConfig) {
23
23
  return textColorConfig;
24
24
  };
25
25
  var textColorPlugin = function textColorPlugin(_ref) {
26
- var _api$featureFlags;
27
- var textColorConfig = _ref.config,
28
- api = _ref.api;
29
- var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
26
+ var textColorConfig = _ref.config;
30
27
  return {
31
28
  name: 'textColor',
32
29
  marks: function marks() {
@@ -66,8 +63,7 @@ var textColorPlugin = function textColorPlugin(_ref) {
66
63
  popupsBoundariesElement: popupsBoundariesElement,
67
64
  popupsScrollableElement: popupsScrollableElement,
68
65
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
69
- disabled: disabled,
70
- featureFlags: featureFlags
66
+ disabled: disabled
71
67
  });
72
68
  }
73
69
  });
@@ -168,11 +168,9 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
168
168
  isReducedSpacing = _this$props.isReducedSpacing,
169
169
  pluginState = _this$props.pluginState,
170
170
  formatMessage = _this$props.intl.formatMessage,
171
- disabled = _this$props.disabled,
172
- featureFlags = _this$props.featureFlags;
171
+ disabled = _this$props.disabled;
173
172
  var labelTextColor = formatMessage(messages.textColor);
174
173
  var palette = pluginState.palette;
175
- var useSomewhatSemanticTextColorNames = featureFlags.useSomewhatSemanticTextColorNames;
176
174
  var fitWidth;
177
175
  if (document.body.clientWidth <= 740) {
178
176
  // This was originally hard-coded, but moved here to a const
@@ -239,8 +237,7 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
239
237
  paletteOptions: {
240
238
  palette: palette,
241
239
  hexToPaletteColor: _editorPalette.hexToEditorTextPaletteColor,
242
- paletteColorTooltipMessages: _ColorPalette.textPaletteTooltipMessages,
243
- showSomewhatSemanticTooltips: useSomewhatSemanticTextColorNames
240
+ paletteColorTooltipMessages: _ColorPalette.textPaletteTooltipMessages
244
241
  }
245
242
  }))), (0, _react2.jsx)("span", {
246
243
  css: _styles2.separatorStyles
@@ -27,16 +27,16 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
27
27
  /** @jsx jsx */
28
28
  // helps adjusts position of popup
29
29
  var colorPickerButtonWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n"])));
30
- var colorPickerExpandContainer = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0px -4px;\n"])));
30
+ var colorPickerExpandContainer = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0px ", ";\n"])), "var(--ds-space-negative-050, -4px)");
31
31
 
32
32
  // Control the size of color picker buttons and preview
33
33
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4134
34
34
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
35
35
  var colorPickerWrapper = function colorPickerWrapper(theme) {
36
- return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", "px;\n background-color: ", ";\n box-shadow: 0 4px 8px -2px ", ", 0 0 1px ", ";\n padding: 8px 0px;\n"])), (0, _constants.borderRadius)(), (0, _components.themed)({
36
+ return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", "px;\n background-color: ", ";\n box-shadow: 0 4px 8px -2px ", ", 0 0 1px ", ";\n padding: ", " 0px;\n"])), (0, _constants.borderRadius)(), (0, _components.themed)({
37
37
  light: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
38
38
  dark: "var(--ds-surface-overlay, ".concat(_colors.DN50, ")")
39
- })(theme), _colors.N60A, _colors.N60A);
39
+ })(theme), _colors.N60A, _colors.N60A, "var(--ds-space-100, 8px)");
40
40
  };
41
41
  /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
42
42
 
@@ -160,7 +160,6 @@ var ColorPickerButton = function ColorPickerButton(props) {
160
160
  paletteOptions: {
161
161
  palette: props.colorPalette,
162
162
  hexToPaletteColor: props.hexToPaletteColor,
163
- showSomewhatSemanticTooltips: props.showSomewhatSemanticTooltips,
164
163
  paletteColorTooltipMessages: props.paletteColorTooltipMessages
165
164
  }
166
165
  }))));
@@ -348,25 +348,15 @@ var ColorPicker = function ColorPicker(props) {
348
348
  onFieldChange(name, currentColor !== colorValue);
349
349
  };
350
350
  var _ref = featureFlags !== null && featureFlags !== void 0 ? featureFlags : {
351
- useSomewhatSemanticTextColorNames: false,
352
351
  expandedChartColors: false
353
352
  },
354
- useSomewhatSemanticTextColorNames = _ref.useSomewhatSemanticTextColorNames,
355
353
  expandedChartColors = _ref.expandedChartColors;
356
354
  return expandedChartColors ? (0, _react.jsx)(_ColorPickerButton.default, {
357
355
  title: title,
358
356
  currentColor: currentColor,
359
357
  onChange: onColorChange,
360
358
  colorPalette: extendedColorPalette,
361
- paletteColorTooltipMessages: _ColorPalette.chartsColorPaletteTooltipMessages
362
- // We did not want to create new FF or update
363
- // useSomewhatSemanticTextColorNames name
364
- // because it is temporary and require extra work.
365
- // So even though it says text color names,
366
- // we are going to use for all color pickers
367
- // such as text, background and table charts.
368
- ,
369
- showSomewhatSemanticTooltips: useSomewhatSemanticTextColorNames,
359
+ paletteColorTooltipMessages: _ColorPalette.chartsColorPaletteTooltipMessages,
370
360
  cols: EXPANDED_COLOR_PICKER_COLUMNS,
371
361
  alignX: "right",
372
362
  placement: "ConfigPanel",
@@ -27,7 +27,7 @@ exports.expandControl = expandControl;
27
27
  var chevronContainer = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n\n & > button {\n width: ", ";\n height: ", ";\n }\n"])), "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)");
28
28
  var labelContainer = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n align-items: center;\n display: flex;\n font-weight: 500;\n"])));
29
29
  var expandContentContainer = function expandContentContainer(isHidden) {
30
- return (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: ", ";\n margin-top: calc(-1 * ", ");\n"])), isHidden ? 'none' : 'block', "var(--ds-space-100, 8px)");
30
+ return (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: ", ";\n margin-top: ", ";\n"])), isHidden ? 'none' : 'block', "var(--ds-space-negative-100, -8px)");
31
31
  };
32
32
  function Expand(_ref) {
33
33
  var field = _ref.field,
@@ -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.41.3";
9
+ var version = "187.41.5";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -21,7 +21,7 @@ function getSpellCheck(featureFlags) {
21
21
  * which is used by both current and archv3 editors.
22
22
  */
23
23
  export function createFeatureFlagsFromProps(props) {
24
- var _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$collabEdit, _props$collabEdit2, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29;
24
+ var _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$collabEdit, _props$collabEdit2, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27;
25
25
  const normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
26
26
  return {
27
27
  ...normalizedFeatureFlags,
@@ -53,8 +53,7 @@ export function createFeatureFlagsFromProps(props) {
53
53
  // Including fallback to props.featureFlags so that mobile feature flags
54
54
  // are included (they are not kebab cased)
55
55
  restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags25 = props.featureFlags) === null || _props$featureFlags25 === void 0 ? void 0 : _props$featureFlags25.restartNumberedLists) === true,
56
- useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.useSomewhatSemanticTextColorNames) : false)),
57
56
  lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
58
- preventPopupOverflow: Boolean(typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29['prevent-popup-overflow']) : false)
57
+ preventPopupOverflow: Boolean(typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27['prevent-popup-overflow']) : false)
59
58
  };
60
59
  }
@@ -5,7 +5,7 @@ export const inviteTeamWrapper = css`
5
5
  background: ${`var(--ds-background-neutral, ${N20})`};
6
6
  border-radius: 50%;
7
7
  min-width: ${"var(--ds-space-400, 32px)"};
8
- margin-left: calc(-1 * ${"var(--ds-space-050, 4px)"});
8
+ margin-left: ${"var(--ds-space-negative-050, -4px)"};
9
9
  `;
10
10
  export const avatarContainer = css`
11
11
  margin-right: ${"var(--ds-space-100, 8px)"};
@@ -23,7 +23,7 @@ export const avatarContainer = css`
23
23
  border-radius: 50%;
24
24
  height: 32px;
25
25
  width: 32px;
26
- padding: 2px;
26
+ padding: ${"var(--ds-space-025, 2px)"};
27
27
  }
28
28
  `;
29
29
  export const badge = color => css`
@@ -21,7 +21,12 @@ export function DateNodeView(props) {
21
21
  getPos
22
22
  } = props;
23
23
  const intl = useIntl();
24
- const pos = typeof getPos === 'function' ? getPos() : undefined;
24
+ let pos;
25
+ try {
26
+ pos = typeof getPos === 'function' ? getPos() : undefined;
27
+ } catch (e) {
28
+ pos = undefined;
29
+ }
25
30
 
26
31
  // We fall back to selection.$from even though it does not cover all use cases
27
32
  // eg. upon Editor init, selection is at the start, not at the Date node
@@ -1,4 +1,5 @@
1
1
  import { extension, bodiedExtension, inlineExtension } from '@atlaskit/adf-schema';
2
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
3
  import { createPlugin } from './pm-plugins/main';
3
4
  import keymapPlugin from './pm-plugins/keymap';
4
5
  import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
@@ -9,8 +10,13 @@ const extensionPlugin = ({
9
10
  config: options = {},
10
11
  api
11
12
  }) => {
12
- var _api$featureFlags, _api$contextPanel2, _api$contextPanel3;
13
+ var _api$featureFlags, _api$contextPanel3, _api$contextPanel4;
13
14
  const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
15
+ //Note: This is a hack to get the editor view reference in the plugin. Copied from table plugin.
16
+ //This is needed to get the current selection in the editor
17
+ const editorViewRef = {
18
+ current: null
19
+ };
14
20
  return {
15
21
  name: 'extension',
16
22
  nodes() {
@@ -48,18 +54,38 @@ const extensionPlugin = ({
48
54
  }, {
49
55
  name: 'extensionUniqueId',
50
56
  plugin: () => createUniqueIdPlugin()
57
+ }, {
58
+ name: 'extensionEditorViewRef',
59
+ plugin: () => {
60
+ return new SafePlugin({
61
+ view: editorView => {
62
+ editorViewRef.current = editorView;
63
+ return {
64
+ destroy: () => {
65
+ editorViewRef.current = null;
66
+ }
67
+ };
68
+ }
69
+ });
70
+ }
51
71
  }];
52
72
  },
53
73
  actions: {
54
- createExtensionAPI
74
+ api: () => {
75
+ var _api$contextPanel2;
76
+ return createExtensionAPI({
77
+ editorView: editorViewRef.current,
78
+ applyChange: api === null || api === void 0 ? void 0 : (_api$contextPanel2 = api.contextPanel) === null || _api$contextPanel2 === void 0 ? void 0 : _api$contextPanel2.actions.applyChange
79
+ });
80
+ }
55
81
  },
56
82
  pluginsOptions: {
57
83
  floatingToolbar: getToolbarConfig({
58
84
  breakoutEnabled: options.breakoutEnabled,
59
85
  hoverDecoration: api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration,
60
- applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel2 = api.contextPanel) === null || _api$contextPanel2 === void 0 ? void 0 : _api$contextPanel2.actions.applyChange
86
+ applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel3 = api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange
61
87
  }),
62
- contextPanel: getContextPanel(options.allowAutoSave, featureFlags, api === null || api === void 0 ? void 0 : (_api$contextPanel3 = api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange)
88
+ contextPanel: getContextPanel(options.allowAutoSave, featureFlags, api === null || api === void 0 ? void 0 : (_api$contextPanel4 = api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange)
63
89
  }
64
90
  };
65
91
  };
@@ -3,7 +3,6 @@ import Loadable from 'react-loadable';
3
3
  import { getContextualToolbarItemsFromModule } from '@atlaskit/editor-common/extensions';
4
4
  import ButtonGroup from '@atlaskit/button/button-group';
5
5
  import { nodeToJSON } from '../../../utils';
6
- import { createExtensionAPI } from '../../extension/extension-api';
7
6
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
8
7
  import Separator from './Separator';
9
8
  const noop = () => null;
@@ -21,8 +20,7 @@ const ExtensionButton = props => {
21
20
  const {
22
21
  item,
23
22
  node,
24
- editorView,
25
- applyChangeToContextPanel
23
+ extensionApi
26
24
  } = props;
27
25
  const ButtonIcon = React.useMemo(() => item.icon ? Loadable({
28
26
  loader: async () => resolveExtensionIcon(item.icon),
@@ -33,11 +31,7 @@ const ExtensionButton = props => {
33
31
  throw new Error(`'action' of context toolbar item '${item.key}' is not a function`);
34
32
  }
35
33
  const targetNodeAdf = nodeToJSON(node);
36
- const api = createExtensionAPI({
37
- editorView,
38
- applyChange: applyChangeToContextPanel
39
- });
40
- item.action(targetNodeAdf, api);
34
+ item.action(targetNodeAdf, extensionApi);
41
35
  };
42
36
  return /*#__PURE__*/React.createElement(Button, {
43
37
  title: item.label,
@@ -56,7 +50,8 @@ export const ExtensionsPlaceholder = props => {
56
50
  editorView,
57
51
  extensionProvider,
58
52
  separator,
59
- applyChangeToContextPanel
53
+ applyChangeToContextPanel,
54
+ extensionApi
60
55
  } = props;
61
56
  const [extensions, setExtensions] = useState([]);
62
57
  useEffect(() => {
@@ -72,11 +67,8 @@ export const ExtensionsPlaceholder = props => {
72
67
  }, []);
73
68
  const nodeAdf = React.useMemo(() => nodeToJSON(node), [node]);
74
69
  const extensionItems = React.useMemo(() => {
75
- return getContextualToolbarItemsFromModule(extensions, nodeAdf, createExtensionAPI({
76
- editorView,
77
- applyChange: applyChangeToContextPanel
78
- }));
79
- }, [extensions, nodeAdf, editorView, applyChangeToContextPanel]);
70
+ return getContextualToolbarItemsFromModule(extensions, nodeAdf, extensionApi);
71
+ }, [extensions, nodeAdf, extensionApi]);
80
72
  if (!extensionItems.length) {
81
73
  return null;
82
74
  }
@@ -92,7 +84,8 @@ export const ExtensionsPlaceholder = props => {
92
84
  node: node,
93
85
  item: item,
94
86
  editorView: editorView,
95
- applyChangeToContextPanel: applyChangeToContextPanel
87
+ applyChangeToContextPanel: applyChangeToContextPanel,
88
+ extensionApi: extensionApi
96
89
  }));
97
90
  if (index < extensionItems.length - 1) {
98
91
  children.push( /*#__PURE__*/React.createElement(Separator, null));
@@ -43,13 +43,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
43
43
  api
44
44
  }) => {
45
45
  const emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
46
- const {
47
- useSomewhatSemanticTextColorNames
48
- } = featureFlags || {
49
- useSomewhatSemanticTextColorNames: false
50
- };
51
46
  return jsx(ButtonGroup, null, items.filter(item => !item.hidden).map((item, idx) => {
52
- var _api$contextPanel;
47
+ var _api$contextPanel, _api$extension;
53
48
  switch (item.type) {
54
49
  case 'button':
55
50
  const ButtonIcon = item.icon;
@@ -167,14 +162,6 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
167
162
  ,
168
163
  hexToPaletteColor: hexToEditorBackgroundPaletteColor,
169
164
  paletteColorTooltipMessages: backgroundPaletteTooltipMessages
170
- // We did not want to create new FF or update
171
- // useSomewhatSemanticTextColorNames name
172
- // because it is temporary and require extra work.
173
- // So even though it says text color names,
174
- // we are going to use for all color pickers
175
- // such as text, background and table charts.
176
- ,
177
- showSomewhatSemanticTooltips: useSomewhatSemanticTextColorNames
178
165
  });
179
166
  }
180
167
  if (item.selectType === 'emoji') {
@@ -206,7 +193,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
206
193
  editorView: editorView,
207
194
  extensionProvider: extensionsProvider,
208
195
  separator: item.separator,
209
- applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange
196
+ applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange,
197
+ extensionApi: api === null || api === void 0 ? void 0 : (_api$extension = api.extension) === null || _api$extension === void 0 ? void 0 : _api$extension.actions.api()
210
198
  });
211
199
  case 'separator':
212
200
  return jsx(Separator, {
@@ -142,9 +142,8 @@ export const mediaStyles = css`
142
142
  ${`var(--ds-border-danger, ${akEditorDeleteIconColor})`} !important;
143
143
  }
144
144
  /* Media resize handlers */
145
- .richMedia-resize-handle-right::after,
146
- .richMedia-resize-handle-left::after {
147
- background: ${`var(--ds-icon-danger, ${akEditorDeleteIconColor})`};
145
+ .resizer-handle-thumb {
146
+ background: ${`var(--ds-icon-danger, ${akEditorDeleteIconColor})`} !important;
148
147
  }
149
148
 
150
149
  /* Smart cards */
@@ -173,8 +172,7 @@ export const mediaStyles = css`
173
172
  box-shadow: 0 0 0 1px ${`var(--ds-border-warning, ${Y500})`} !important;
174
173
  }
175
174
 
176
- .resizer-handle-left::after,
177
- .resizer-handle-right::after {
175
+ .resizer-handle-thumb {
178
176
  background: ${`var(--ds-icon-warning, ${Y500})`} !important;
179
177
  }
180
178
  }
@@ -1,8 +1,9 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { isNodeSelection, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
4
+ import { getMediaInputResizeAnalyticsEvent } from '../utils/analytics';
4
5
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
5
- import { removeMediaGroupNode } from './utils';
6
+ import { removeMediaGroupNode, getSelectedMediaSingle } from './utils';
6
7
  import { currentMediaNodeWithPos } from '../utils/current-media-node';
7
8
  export const DEFAULT_BORDER_COLOR = '#091e4224';
8
9
  export const DEFAULT_BORDER_SIZE = 2;
@@ -179,4 +180,33 @@ export const setBorderMark = editorAnalyticsAPI => attrs => (state, dispatch) =>
179
180
  dispatch(tr);
180
181
  }
181
182
  return true;
183
+ };
184
+ export const updateMediaSingleWidth = editorAnalyticsAPI => (width, validation, layout) => (state, dispatch) => {
185
+ const selectedMediaSingleNode = getSelectedMediaSingle(state);
186
+ if (!selectedMediaSingleNode) {
187
+ return false;
188
+ }
189
+ const tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, {
190
+ ...selectedMediaSingleNode.node.attrs,
191
+ width,
192
+ widthType: 'pixel',
193
+ layout
194
+ });
195
+ tr.setMeta('scrollIntoView', false);
196
+ tr.setSelection(NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
197
+ const $pos = state.doc.resolve(selectedMediaSingleNode.pos);
198
+ const parentNodeType = $pos ? $pos.parent.type.name : undefined;
199
+ const payload = getMediaInputResizeAnalyticsEvent('mediaSingle', {
200
+ width,
201
+ layout,
202
+ validation,
203
+ parentNode: parentNodeType
204
+ });
205
+ if (payload) {
206
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
207
+ }
208
+ if (dispatch) {
209
+ dispatch(tr);
210
+ }
211
+ return true;
182
212
  };