@atlaskit/editor-plugin-media 1.34.8 → 1.34.10

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 1.34.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#150125](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/150125)
8
+ [`79a44707fe935`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/79a44707fe935) -
9
+ [ED-24001] This change is cleaning up the feature gate for the image border options dropdown a11y
10
+ fix.
11
+
12
+ ## 1.34.9
13
+
14
+ ### Patch Changes
15
+
16
+ - [#149558](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/149558)
17
+ [`5e8619ac0f6e4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5e8619ac0f6e4) -
18
+ [ux] [ED-25085] Migrate typography \
19
+
20
+ editor-plugin-media:
21
+
22
+ - replace caption placeholder span with button
23
+ - replace x between width and height pixel entry with symbol × \
24
+
25
+ tmp-editor-statsig:
26
+
27
+ - Add experiment `platform_editor_typography_migration_ugc`
28
+
29
+ - Updated dependencies
30
+
3
31
  ## 1.34.8
4
32
 
5
33
  ### Patch Changes
@@ -33,7 +33,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
33
33
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
34
34
  var _captions = require("../commands/captions");
35
35
  var _main = require("../pm-plugins/main");
36
- var _CaptionPlaceholder = _interopRequireDefault(require("../ui/CaptionPlaceholder"));
36
+ var _CaptionPlaceholder = require("../ui/CaptionPlaceholder");
37
37
  var _CommentBadge = require("../ui/CommentBadge");
38
38
  var _ResizableMediaSingle = _interopRequireDefault(require("../ui/ResizableMediaSingle"));
39
39
  var _ResizableMediaSingleNext = _interopRequireDefault(require("../ui/ResizableMediaSingle/ResizableMediaSingleNext"));
@@ -73,6 +73,8 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
73
73
  isCopying: false
74
74
  });
75
75
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaSingleWrapperRef", /*#__PURE__*/_react.default.createRef());
76
+ // platform_editor_typography_migration_ugc clean up
77
+ // remove HTMLSpanElement type
76
78
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "captionPlaceHolderRef", /*#__PURE__*/_react.default.createRef());
77
79
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createOrUpdateMediaNodeUpdater", function (props) {
78
80
  var node = _this.props.node.firstChild;
@@ -505,10 +507,16 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
505
507
  isDrafting: isCurrentNodeDrafting
506
508
  }), (0, _react2.jsx)("div", {
507
509
  ref: this.props.forwardRef
508
- }), shouldShowPlaceholder && (0, _react2.jsx)(_CaptionPlaceholder.default, {
510
+ }), shouldShowPlaceholder && ((0, _experiments.editorExperiment)('typography_migration_ugc', true) ? (0, _react2.jsx)(_CaptionPlaceholder.CaptionPlaceholderButton
511
+ // platform_editor_typography_migration_ugc clean up
512
+ // remove typecasting
513
+ , {
509
514
  ref: this.captionPlaceHolderRef,
510
515
  onClick: this.clickPlaceholder
511
- }));
516
+ }) : (0, _react2.jsx)(_CaptionPlaceholder.CaptionPlaceholder, {
517
+ ref: this.captionPlaceHolderRef,
518
+ onClick: this.clickPlaceholder
519
+ })));
512
520
  return (0, _react2.jsx)(_react.Fragment, null, canResize ? (0, _platformFeatureFlags.fg)('platform.editor.media.extended-resize-experience') ? (0, _react2.jsx)(_ResizableMediaSingleNext.default, (0, _extends2.default)({}, resizableMediaSingleProps, {
513
521
  showLegacyNotification: widthType !== 'pixel'
514
522
  }), MediaChildren) : (0, _react2.jsx)(_ResizableMediaSingle.default, (0, _extends2.default)({}, resizableMediaSingleProps, {
@@ -1,16 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
- exports.default = void 0;
8
+ exports.CaptionPlaceholderButton = exports.CaptionPlaceholder = void 0;
8
9
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
10
11
  var _react2 = require("@emotion/react");
11
12
  var _reactIntlNext = require("react-intl-next");
12
13
  var _media = require("@atlaskit/editor-common/media");
13
14
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
15
+ var _primitives = require("@atlaskit/primitives");
14
16
  var _colors = require("@atlaskit/theme/colors");
15
17
  var _templateObject;
16
18
  /**
@@ -18,15 +20,48 @@ var _templateObject;
18
20
  * @jsx jsx
19
21
  */
20
22
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
24
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
25
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
22
26
  var placeholder = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tcolor: ", ";\n\twidth: 100%;\n\ttext-align: center;\n\tmargin-top: ", " !important;\n\tdisplay: block;\n"])), "var(--ds-text-subtlest, ".concat(_colors.N200, ")"), "var(--ds-space-100, 8px)");
23
- var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
27
+ var placeholderButton = (0, _primitives.xcss)({
28
+ width: '100%',
29
+ marginTop: 'space.100'
30
+ });
31
+
32
+ // platform_editor_typography_migration_ugc clean up
33
+ // Remove this component
34
+ var CaptionPlaceholder = exports.CaptionPlaceholder = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
24
35
  var onClick = _ref.onClick;
25
- return (0, _react2.jsx)("span", {
36
+ return (
37
+ // eslint-disable-next-line @atlaskit/design-system/use-primitives-text
38
+ (0, _react2.jsx)("span", {
39
+ ref: ref,
40
+ css: placeholder,
41
+ onClick: onClick,
42
+ "data-id": _mediaSingle.CAPTION_PLACEHOLDER_ID,
43
+ "data-testid": "caption-placeholder"
44
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _media.captionMessages.placeholder))
45
+ );
46
+ });
47
+ var CaptionPlaceholderButton = exports.CaptionPlaceholderButton = /*#__PURE__*/_react.default.forwardRef(function (_ref2, ref) {
48
+ var onClick = _ref2.onClick;
49
+ var handleMouseDown = (0, _react.useCallback)(function (e) {
50
+ // In firefox, button is focused when mouse down, which make editor lose focus
51
+ // Hence we want to disabled it so that user can type in caption directly after click
52
+ e.preventDefault();
53
+ }, []);
54
+ return (0, _react2.jsx)(_primitives.Pressable, {
26
55
  ref: ref,
27
- css: placeholder,
56
+ backgroundColor: "color.background.neutral.subtle",
28
57
  onClick: onClick,
58
+ onMouseDown: handleMouseDown,
29
59
  "data-id": _mediaSingle.CAPTION_PLACEHOLDER_ID,
30
- "data-testid": "caption-placeholder"
31
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _media.captionMessages.placeholder));
60
+ testId: "caption-placeholder",
61
+ padding: "space.0",
62
+ xcss: placeholderButton
63
+ }, (0, _react2.jsx)(_primitives.Text, {
64
+ color: "color.text.subtlest",
65
+ size: "large"
66
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _media.captionMessages.placeholder)));
32
67
  });
@@ -16,7 +16,6 @@ var _uiColor = require("@atlaskit/editor-common/ui-color");
16
16
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
17
17
  var _editorPalette = require("@atlaskit/editor-palette");
18
18
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
19
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
19
  var _primitives = require("@atlaskit/primitives");
21
20
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
22
21
  var _styles2 = require("./styles");
@@ -79,36 +78,32 @@ var ImageBorder = function ImageBorder(_ref) {
79
78
  }
80
79
  };
81
80
  var handleTriggerByKeyboard = function handleTriggerByKeyboard(event, callback) {
82
- if ((0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown')) {
83
- if (event.key === 'Enter' || event.key === ' ') {
84
- event.preventDefault();
85
- callback();
86
- setIsOpenedByKeyboard(true);
87
- }
81
+ if (event.key === 'Enter' || event.key === ' ') {
82
+ event.preventDefault();
83
+ callback();
84
+ setIsOpenedByKeyboard(true);
88
85
  }
89
86
  };
90
87
  (0, _react.useEffect)(function () {
91
- if ((0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown')) {
92
- var focusFirstOption = function focusFirstOption(submenuRef, isOpen) {
93
- if (!isOpenByKeyboard) {
88
+ var focusFirstOption = function focusFirstOption(submenuRef, isOpen) {
89
+ if (!isOpenByKeyboard) {
90
+ return;
91
+ }
92
+ if (isOpen && submenuRef.current) {
93
+ var firstOption = submenuRef.current.querySelector('button');
94
+ if (!firstOption) {
94
95
  return;
95
96
  }
96
- if (isOpen && submenuRef.current) {
97
- var firstOption = submenuRef.current.querySelector('button');
98
- if (!firstOption) {
99
- return;
100
- }
101
- firstOption.focus();
102
- var keyboardEvent = new KeyboardEvent('keydown', {
103
- key: 'ArrowDown',
104
- bubbles: true
105
- });
106
- firstOption.dispatchEvent(keyboardEvent);
107
- }
108
- };
109
- focusFirstOption(colorSubmenuRef, isColorSubmenuOpen);
110
- focusFirstOption(sizeSubmenuRef, isSizeSubmenuOpen);
111
- }
97
+ firstOption.focus();
98
+ var keyboardEvent = new KeyboardEvent('keydown', {
99
+ key: 'ArrowDown',
100
+ bubbles: true
101
+ });
102
+ firstOption.dispatchEvent(keyboardEvent);
103
+ }
104
+ };
105
+ focusFirstOption(colorSubmenuRef, isColorSubmenuOpen);
106
+ focusFirstOption(sizeSubmenuRef, isSizeSubmenuOpen);
112
107
  }, [isColorSubmenuOpen, isSizeSubmenuOpen, isOpenByKeyboard]);
113
108
  var borderSizeOptions = [{
114
109
  name: formatMessage(_media.imageBorderMessages.borderSizeSubtle),
@@ -120,7 +115,7 @@ var ImageBorder = function ImageBorder(_ref) {
120
115
  name: formatMessage(_media.imageBorderMessages.borderSizeBold),
121
116
  value: 3
122
117
  }];
123
- var items = (0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown') ? [{
118
+ var items = [{
124
119
  content: (0, _react2.jsx)("div", null, (0, _react2.jsx)("button", {
125
120
  ref: dropDownColorOptionButton,
126
121
  type: "button",
@@ -266,83 +261,8 @@ var ImageBorder = function ImageBorder(_ref) {
266
261
  },
267
262
  'aria-label': '',
268
263
  wrapperTabIndex: null
269
- }] : [{
270
- content: formatMessage(_media.imageBorderMessages.borderColor),
271
- value: {
272
- name: 'color'
273
- },
274
- elemAfter:
275
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
276
- (0, _react2.jsx)("div", {
277
- className: _styles.DropdownMenuSharedCssClassName.SUBMENU
278
- }, (0, _react2.jsx)("div", {
279
- css: (0, _styles2.contextualMenuColorIcon)(color && (0, _editorPalette.hexToEditorBorderPaletteColor)(color))
280
- }), isColorSubmenuOpen &&
281
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
282
- (0, _react2.jsx)("div", {
283
- css: (0, _styles2.contextualSubMenu)(0),
284
- ref: handleSubMenuRef
285
- }, (0, _react2.jsx)(_uiColor.ColorPalette, {
286
- onClick: function onClick(color) {
287
- setBorder({
288
- color: color
289
- });
290
- setIsOpen(!isOpen);
291
- },
292
- selectedColor: color !== null && color !== void 0 ? color : null,
293
- paletteOptions: {
294
- palette: _uiColor.borderColorPalette,
295
- paletteColorTooltipMessages: _uiColor.borderPaletteTooltipMessages,
296
- hexToPaletteColor: _editorPalette.hexToEditorBorderPaletteColor
297
- }
298
- })))
299
- }, {
300
- content: formatMessage(_media.imageBorderMessages.borderSize),
301
- value: {
302
- name: 'size'
303
- },
304
- elemAfter:
305
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
306
- (0, _react2.jsx)("div", {
307
- className: _styles.DropdownMenuSharedCssClassName.SUBMENU
308
- }, (0, _react2.jsx)("div", {
309
- css: _styles2.contextualMenuArrow
310
- }), isSizeSubmenuOpen &&
311
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
312
- (0, _react2.jsx)("div", {
313
- css: (0, _styles2.contextualSubMenu)(1),
314
- ref: handleSubMenuRef
315
- }, borderSizeOptions.map(function (_ref3, idx) {
316
- var name = _ref3.name,
317
- value = _ref3.value;
318
- return (0, _react2.jsx)(_tooltip.default, {
319
- key: idx,
320
- content: name
321
- }, (0, _react2.jsx)("span", {
322
- css: _styles2.buttonWrapperStyle
323
- }, (0, _react2.jsx)("button", {
324
- type: "button"
325
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
326
- ,
327
- css: (0, _styles2.buttonStyle)(value === size),
328
- "aria-label": name,
329
- role: "radio",
330
- "aria-checked": value === size,
331
- onClick: function onClick() {
332
- setBorder({
333
- size: value
334
- });
335
- setIsOpen(false);
336
- },
337
- onMouseDown: function onMouseDown(e) {
338
- e.preventDefault();
339
- }
340
- }, (0, _react2.jsx)("div", {
341
- css: (0, _styles2.line)(value, value === size),
342
- role: "presentation"
343
- }))));
344
- })))
345
264
  }];
265
+
346
266
  /**
347
267
  * We want to change direction of our dropdowns a bit early,
348
268
  * not exactly when it hits the boundary.
@@ -377,7 +297,7 @@ var ImageBorder = function ImageBorder(_ref) {
377
297
  className: "image-border-toolbar-dropdown",
378
298
  ref: openDropdownButtonRef,
379
299
  selected: enabled || isOpen,
380
- "aria-expanded": (0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown') ? isOpen : undefined,
300
+ "aria-expanded": isOpen,
381
301
  "aria-label": formatMessage(_media.imageBorderMessages.borderOptions),
382
302
  title: formatMessage(_media.imageBorderMessages.borderOptions),
383
303
  spacing: "compact",
@@ -386,15 +306,13 @@ var ImageBorder = function ImageBorder(_ref) {
386
306
  }),
387
307
  onClick: function onClick() {
388
308
  setIsOpen(!isOpen);
389
- if ((0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown')) {
390
- setIsOpenedByKeyboard(false);
391
- }
309
+ setIsOpenedByKeyboard(false);
392
310
  },
393
- onKeyDown: (0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown') ? function (e) {
311
+ onKeyDown: function onKeyDown(e) {
394
312
  return handleTriggerByKeyboard(e, function () {
395
313
  return setIsOpen(!isOpen);
396
314
  });
397
- } : undefined
315
+ }
398
316
  }))), (0, _react2.jsx)(_ui.Popup, {
399
317
  target: popupTarget.current ? popupTarget.current : undefined,
400
318
  fitWidth: fitWidth + fitTolerance,
@@ -405,9 +323,9 @@ var ImageBorder = function ImageBorder(_ref) {
405
323
  onMouseLeave: function onMouseLeave() {
406
324
  setIsColorSubmenuOpen(false);
407
325
  setIsSizeSubmenuOpen(false);
408
- },
409
- css: (0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown') ? /* eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766 */
410
- _styles2.dropdownWrapper : undefined
326
+ }
327
+ /* eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766 */,
328
+ css: _styles2.dropdownWrapper
411
329
  }, (0, _react2.jsx)(_uiMenu.DropdownMenu
412
330
  //This needs be removed when the a11y is completely handled
413
331
  //Disabling key navigation now as it works only partially
@@ -415,32 +333,30 @@ var ImageBorder = function ImageBorder(_ref) {
415
333
  , {
416
334
  arrowKeyNavigationProviderOptions: {
417
335
  type: _uiMenu.ArrowKeyNavigationType.MENU,
418
- disableArrowKeyNavigation: (0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown') ? isAnySubMenuOpen ? true : false : true
336
+ disableArrowKeyNavigation: isAnySubMenuOpen
419
337
  },
420
- allowEnterDefaultBehavior: (0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown') ? isAnySubMenuOpen ? true : false : undefined,
421
- handleEscapeKeydown: (0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown') ? isAnySubMenuOpen ? function () {
338
+ allowEnterDefaultBehavior: isAnySubMenuOpen,
339
+ handleEscapeKeydown: isAnySubMenuOpen ? function () {
422
340
  return;
423
341
  } : function () {
424
342
  var _openDropdownButtonRe3;
425
343
  (_openDropdownButtonRe3 = openDropdownButtonRef.current) === null || _openDropdownButtonRe3 === void 0 || _openDropdownButtonRe3.focus();
426
- } : undefined,
344
+ },
427
345
  items: [{
428
346
  items: items
429
347
  }],
430
348
  isOpen: isOpen,
431
- shouldFocusFirstItem: (0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown') ? function () {
349
+ shouldFocusFirstItem: function shouldFocusFirstItem() {
432
350
  return isOpenByKeyboard;
433
- } : undefined,
351
+ },
434
352
  onOpenChange: function onOpenChange() {
435
353
  setIsOpen(false);
436
354
  setIsColorSubmenuOpen(false);
437
355
  setIsSizeSubmenuOpen(false);
438
- if ((0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown')) {
439
- setIsOpenedByKeyboard(false);
440
- }
356
+ setIsOpenedByKeyboard(false);
441
357
  },
442
- onItemActivated: function onItemActivated(_ref4) {
443
- var item = _ref4.item;
358
+ onItemActivated: function onItemActivated(_ref3) {
359
+ var item = _ref3.item;
444
360
  if (item.value.name === 'color') {
445
361
  setIsColorSubmenuOpen(!isColorSubmenuOpen);
446
362
  }
@@ -448,23 +364,19 @@ var ImageBorder = function ImageBorder(_ref) {
448
364
  setIsSizeSubmenuOpen(!isSizeSubmenuOpen);
449
365
  }
450
366
  },
451
- onMouseEnter: function onMouseEnter(_ref5) {
452
- var item = _ref5.item;
367
+ onMouseEnter: function onMouseEnter(_ref4) {
368
+ var item = _ref4.item;
453
369
  if (item.value.name === 'color') {
454
370
  setIsColorSubmenuOpen(true);
455
- if ((0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown')) {
456
- setIsOpenedByKeyboard(false);
457
- }
371
+ setIsOpenedByKeyboard(false);
458
372
  }
459
373
  if (item.value.name === 'size') {
460
374
  setIsSizeSubmenuOpen(true);
461
- if ((0, _platformFeatureFlags.fg)('platform-editor-a11y-image-border-options-dropdown')) {
462
- setIsOpenedByKeyboard(false);
463
- }
375
+ setIsOpenedByKeyboard(false);
464
376
  }
465
377
  },
466
- onMouseLeave: function onMouseLeave(_ref6) {
467
- var item = _ref6.item;
378
+ onMouseLeave: function onMouseLeave(_ref5) {
379
+ var item = _ref5.item;
468
380
  if (item.value.name === 'color') {
469
381
  setIsColorSubmenuOpen(false);
470
382
  }
@@ -27,6 +27,10 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
27
27
 
28
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
29
29
 
30
+ var pixelSizingLabel = (0, _primitives.xcss)({
31
+ gridArea: 'label',
32
+ lineHeight: "var(--ds-space-300, 24px)"
33
+ });
30
34
  var PixelEntry = exports.PixelEntry = function PixelEntry(_ref) {
31
35
  var width = _ref.width,
32
36
  mediaWidth = _ref.mediaWidth,
@@ -160,9 +164,10 @@ var PixelEntry = exports.PixelEntry = function PixelEntry(_ref) {
160
164
  maxWidth: maxWidth
161
165
  })
162
166
  })));
163
- }), (0, _react2.jsx)("span", {
164
- css: _styles.pixelSizingLabel
165
- }, "x"), (0, _react2.jsx)(_form.Field, {
167
+ }), (0, _react2.jsx)(_primitives.Box, {
168
+ as: "span",
169
+ xcss: pixelSizingLabel
170
+ }, "\xD7"), (0, _react2.jsx)(_form.Field, {
166
171
  key: "inputHeight",
167
172
  name: "inputHeight",
168
173
  defaultValue: computedHeight
@@ -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.pixelSizingWrapper = exports.pixelSizingWidthInput = exports.pixelSizingLabel = exports.pixelSizingInput = exports.pixelSizingHeightInput = exports.pixelSizingFullWidthLabelStyles = exports.pixelEntryHiddenSubmit = exports.pixelEntryForm = void 0;
7
+ exports.pixelSizingWrapper = exports.pixelSizingWidthInput = exports.pixelSizingInput = exports.pixelSizingHeightInput = exports.pixelSizingFullWidthLabelStyles = exports.pixelEntryHiddenSubmit = exports.pixelEntryForm = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
10
  var _templateObject; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -12,6 +12,7 @@ var PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH = 120;
12
12
 
13
13
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
14
14
  var pixelSizingWrapper = exports.pixelSizingWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 1em 1fr 0;\n\tgrid-template-rows: auto;\n\tgrid-template-areas: 'widthinput label heightinput submit';\n\twidth: ", "px;\n\ttext-align: center;\n\theight: ", ";\n\n\t// Atlaskit fieldset does not allow style override\n\t& > * {\n\t\tmargin-top: 0 !important;\n\t}\n"])), PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH, "var(--ds-space-300, 24px)");
15
+
15
16
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
16
17
  var pixelEntryForm = exports.pixelEntryForm = (0, _react.css)({
17
18
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
@@ -29,11 +30,7 @@ var pixelSizingInput = exports.pixelSizingInput = (0, _react.css)({
29
30
  textAlign: 'center'
30
31
  }
31
32
  });
32
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
33
- var pixelSizingLabel = exports.pixelSizingLabel = (0, _react.css)({
34
- gridArea: 'label',
35
- lineHeight: "var(--ds-space-300, 24px)"
36
- });
33
+
37
34
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
38
35
  var pixelSizingWidthInput = exports.pixelSizingWidthInput = (0, _react.css)({
39
36
  gridArea: 'widthinput'
@@ -24,7 +24,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
24
24
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
25
25
  import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
26
26
  import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
27
- import CaptionPlaceholder from '../ui/CaptionPlaceholder';
27
+ import { CaptionPlaceholder, CaptionPlaceholderButton } from '../ui/CaptionPlaceholder';
28
28
  import { CommentBadge, CommentBadgeNextWrapper } from '../ui/CommentBadge';
29
29
  import ResizableMediaSingle from '../ui/ResizableMediaSingle';
30
30
  import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
@@ -47,6 +47,8 @@ export default class MediaSingleNode extends Component {
47
47
  isCopying: false
48
48
  });
49
49
  _defineProperty(this, "mediaSingleWrapperRef", /*#__PURE__*/React.createRef());
50
+ // platform_editor_typography_migration_ugc clean up
51
+ // remove HTMLSpanElement type
50
52
  _defineProperty(this, "captionPlaceHolderRef", /*#__PURE__*/React.createRef());
51
53
  _defineProperty(this, "createOrUpdateMediaNodeUpdater", props => {
52
54
  const node = this.props.node.firstChild;
@@ -422,10 +424,16 @@ export default class MediaSingleNode extends Component {
422
424
  isDrafting: isCurrentNodeDrafting
423
425
  }), jsx("div", {
424
426
  ref: this.props.forwardRef
425
- }), shouldShowPlaceholder && jsx(CaptionPlaceholder, {
427
+ }), shouldShowPlaceholder && (editorExperiment('typography_migration_ugc', true) ? jsx(CaptionPlaceholderButton
428
+ // platform_editor_typography_migration_ugc clean up
429
+ // remove typecasting
430
+ , {
426
431
  ref: this.captionPlaceHolderRef,
427
432
  onClick: this.clickPlaceholder
428
- }));
433
+ }) : jsx(CaptionPlaceholder, {
434
+ ref: this.captionPlaceHolderRef,
435
+ onClick: this.clickPlaceholder
436
+ })));
429
437
  return jsx(Fragment, null, canResize ? fg('platform.editor.media.extended-resize-experience') ? jsx(ResizableMediaSingleNext, _extends({}, resizableMediaSingleProps, {
430
438
  showLegacyNotification: widthType !== 'pixel'
431
439
  }), MediaChildren) : jsx(ResizableMediaSingle, _extends({}, resizableMediaSingleProps, {
@@ -2,13 +2,14 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import React from 'react';
5
+ import React, { useCallback } from 'react';
6
6
 
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { FormattedMessage } from 'react-intl-next';
10
10
  import { captionMessages as messages } from '@atlaskit/editor-common/media';
11
11
  import { CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
12
+ import { Pressable, Text, xcss } from '@atlaskit/primitives';
12
13
  import { N200 } from '@atlaskit/theme/colors';
13
14
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
14
15
  const placeholder = css`
@@ -18,14 +19,46 @@ const placeholder = css`
18
19
  margin-top: ${"var(--ds-space-100, 8px)"} !important;
19
20
  display: block;
20
21
  `;
21
- export default /*#__PURE__*/React.forwardRef(({
22
+ const placeholderButton = xcss({
23
+ width: '100%',
24
+ marginTop: 'space.100'
25
+ });
26
+
27
+ // platform_editor_typography_migration_ugc clean up
28
+ // Remove this component
29
+ export const CaptionPlaceholder = /*#__PURE__*/React.forwardRef(({
30
+ onClick
31
+ }, ref) => {
32
+ return (
33
+ // eslint-disable-next-line @atlaskit/design-system/use-primitives-text
34
+ jsx("span", {
35
+ ref: ref,
36
+ css: placeholder,
37
+ onClick: onClick,
38
+ "data-id": CAPTION_PLACEHOLDER_ID,
39
+ "data-testid": "caption-placeholder"
40
+ }, jsx(FormattedMessage, messages.placeholder))
41
+ );
42
+ });
43
+ export const CaptionPlaceholderButton = /*#__PURE__*/React.forwardRef(({
22
44
  onClick
23
45
  }, ref) => {
24
- return jsx("span", {
46
+ const handleMouseDown = useCallback(e => {
47
+ // In firefox, button is focused when mouse down, which make editor lose focus
48
+ // Hence we want to disabled it so that user can type in caption directly after click
49
+ e.preventDefault();
50
+ }, []);
51
+ return jsx(Pressable, {
25
52
  ref: ref,
26
- css: placeholder,
53
+ backgroundColor: "color.background.neutral.subtle",
27
54
  onClick: onClick,
55
+ onMouseDown: handleMouseDown,
28
56
  "data-id": CAPTION_PLACEHOLDER_ID,
29
- "data-testid": "caption-placeholder"
30
- }, jsx(FormattedMessage, messages.placeholder));
57
+ testId: "caption-placeholder",
58
+ padding: "space.0",
59
+ xcss: placeholderButton
60
+ }, jsx(Text, {
61
+ color: "color.text.subtlest",
62
+ size: "large"
63
+ }, jsx(FormattedMessage, messages.placeholder)));
31
64
  });