@atlaskit/editor-plugin-media 1.34.8 → 1.34.9
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 +19 -0
- package/dist/cjs/nodeviews/mediaSingle.js +11 -3
- package/dist/cjs/ui/CaptionPlaceholder/index.js +42 -7
- package/dist/cjs/ui/PixelEntry/index.js +8 -3
- package/dist/cjs/ui/PixelEntry/styles.js +3 -6
- package/dist/es2019/nodeviews/mediaSingle.js +11 -3
- package/dist/es2019/ui/CaptionPlaceholder/index.js +39 -6
- package/dist/es2019/ui/PixelEntry/index.js +10 -5
- package/dist/es2019/ui/PixelEntry/styles.js +2 -5
- package/dist/esm/nodeviews/mediaSingle.js +11 -3
- package/dist/esm/ui/CaptionPlaceholder/index.js +38 -6
- package/dist/esm/ui/PixelEntry/index.js +10 -5
- package/dist/esm/ui/PixelEntry/styles.js +2 -5
- package/dist/types/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types/ui/CaptionPlaceholder/index.d.ts +4 -2
- package/dist/types/ui/PixelEntry/styles.d.ts +0 -1
- package/dist/types-ts4.5/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types-ts4.5/ui/CaptionPlaceholder/index.d.ts +4 -2
- package/dist/types-ts4.5/ui/PixelEntry/styles.d.ts +0 -1
- package/package.json +4 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 1.34.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#149558](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/149558)
|
|
8
|
+
[`5e8619ac0f6e4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5e8619ac0f6e4) -
|
|
9
|
+
[ux] [ED-25085] Migrate typography \
|
|
10
|
+
|
|
11
|
+
editor-plugin-media:
|
|
12
|
+
|
|
13
|
+
- replace caption placeholder span with button
|
|
14
|
+
- replace x between width and height pixel entry with symbol × \
|
|
15
|
+
|
|
16
|
+
tmp-editor-statsig:
|
|
17
|
+
|
|
18
|
+
- Add experiment `platform_editor_typography_migration_ugc`
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 1.34.8
|
|
4
23
|
|
|
5
24
|
### 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 =
|
|
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.
|
|
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.
|
|
8
|
+
exports.CaptionPlaceholderButton = exports.CaptionPlaceholder = void 0;
|
|
8
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
-
var _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
|
|
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 (
|
|
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
|
-
|
|
56
|
+
backgroundColor: "color.background.neutral.subtle",
|
|
28
57
|
onClick: onClick,
|
|
58
|
+
onMouseDown: handleMouseDown,
|
|
29
59
|
"data-id": _mediaSingle.CAPTION_PLACEHOLDER_ID,
|
|
30
|
-
|
|
31
|
-
|
|
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
|
});
|
|
@@ -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)(
|
|
164
|
-
|
|
165
|
-
|
|
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.
|
|
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
|
-
|
|
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 &&
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
53
|
+
backgroundColor: "color.background.neutral.subtle",
|
|
27
54
|
onClick: onClick,
|
|
55
|
+
onMouseDown: handleMouseDown,
|
|
28
56
|
"data-id": CAPTION_PLACEHOLDER_ID,
|
|
29
|
-
|
|
30
|
-
|
|
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
|
});
|
|
@@ -9,11 +9,15 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import Button from '@atlaskit/button';
|
|
10
10
|
import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
|
|
11
11
|
import Form, { Field } from '@atlaskit/form';
|
|
12
|
-
import { Text } from '@atlaskit/primitives';
|
|
12
|
+
import { Box, Text, xcss } from '@atlaskit/primitives';
|
|
13
13
|
import Textfield from '@atlaskit/textfield';
|
|
14
14
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
15
|
import { PIXELENTRY_MIGRATION_BUTTON_TESTID } from './constants';
|
|
16
|
-
import { pixelEntryForm, pixelEntryHiddenSubmit, pixelSizingFullWidthLabelStyles, pixelSizingHeightInput, pixelSizingInput,
|
|
16
|
+
import { pixelEntryForm, pixelEntryHiddenSubmit, pixelSizingFullWidthLabelStyles, pixelSizingHeightInput, pixelSizingInput, pixelSizingWidthInput, pixelSizingWrapper } from './styles';
|
|
17
|
+
const pixelSizingLabel = xcss({
|
|
18
|
+
gridArea: 'label',
|
|
19
|
+
lineHeight: "var(--ds-space-300, 24px)"
|
|
20
|
+
});
|
|
17
21
|
export const PixelEntry = ({
|
|
18
22
|
width,
|
|
19
23
|
mediaWidth,
|
|
@@ -142,9 +146,10 @@ export const PixelEntry = ({
|
|
|
142
146
|
"aria-label": formatMessage(messages.inputWidthAriaLabel, {
|
|
143
147
|
maxWidth
|
|
144
148
|
})
|
|
145
|
-
})))), jsx(
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
})))), jsx(Box, {
|
|
150
|
+
as: "span",
|
|
151
|
+
xcss: pixelSizingLabel
|
|
152
|
+
}, "\xD7"), jsx(Field, {
|
|
148
153
|
key: "inputHeight",
|
|
149
154
|
name: "inputHeight",
|
|
150
155
|
defaultValue: computedHeight
|
|
@@ -17,6 +17,7 @@ export const pixelSizingWrapper = css`
|
|
|
17
17
|
margin-top: 0 !important;
|
|
18
18
|
}
|
|
19
19
|
`;
|
|
20
|
+
|
|
20
21
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
21
22
|
export const pixelEntryForm = css({
|
|
22
23
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
@@ -34,11 +35,7 @@ export const pixelSizingInput = css({
|
|
|
34
35
|
textAlign: 'center'
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
|
-
|
|
38
|
-
export const pixelSizingLabel = css({
|
|
39
|
-
gridArea: 'label',
|
|
40
|
-
lineHeight: "var(--ds-space-300, 24px)"
|
|
41
|
-
});
|
|
38
|
+
|
|
42
39
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
43
40
|
export const pixelSizingWidthInput = css({
|
|
44
41
|
gridArea: 'widthinput'
|
|
@@ -37,7 +37,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
37
37
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
38
38
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
39
39
|
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
40
|
-
import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
40
|
+
import { CaptionPlaceholder, CaptionPlaceholderButton } from '../ui/CaptionPlaceholder';
|
|
41
41
|
import { CommentBadge, CommentBadgeNextWrapper } from '../ui/CommentBadge';
|
|
42
42
|
import ResizableMediaSingle from '../ui/ResizableMediaSingle';
|
|
43
43
|
import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
|
|
@@ -67,6 +67,8 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
67
67
|
isCopying: false
|
|
68
68
|
});
|
|
69
69
|
_defineProperty(_assertThisInitialized(_this), "mediaSingleWrapperRef", /*#__PURE__*/React.createRef());
|
|
70
|
+
// platform_editor_typography_migration_ugc clean up
|
|
71
|
+
// remove HTMLSpanElement type
|
|
70
72
|
_defineProperty(_assertThisInitialized(_this), "captionPlaceHolderRef", /*#__PURE__*/React.createRef());
|
|
71
73
|
_defineProperty(_assertThisInitialized(_this), "createOrUpdateMediaNodeUpdater", function (props) {
|
|
72
74
|
var node = _this.props.node.firstChild;
|
|
@@ -499,10 +501,16 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
499
501
|
isDrafting: isCurrentNodeDrafting
|
|
500
502
|
}), jsx("div", {
|
|
501
503
|
ref: this.props.forwardRef
|
|
502
|
-
}), shouldShowPlaceholder &&
|
|
504
|
+
}), shouldShowPlaceholder && (editorExperiment('typography_migration_ugc', true) ? jsx(CaptionPlaceholderButton
|
|
505
|
+
// platform_editor_typography_migration_ugc clean up
|
|
506
|
+
// remove typecasting
|
|
507
|
+
, {
|
|
503
508
|
ref: this.captionPlaceHolderRef,
|
|
504
509
|
onClick: this.clickPlaceholder
|
|
505
|
-
})
|
|
510
|
+
}) : jsx(CaptionPlaceholder, {
|
|
511
|
+
ref: this.captionPlaceHolderRef,
|
|
512
|
+
onClick: this.clickPlaceholder
|
|
513
|
+
})));
|
|
506
514
|
return jsx(Fragment, null, canResize ? fg('platform.editor.media.extended-resize-experience') ? jsx(ResizableMediaSingleNext, _extends({}, resizableMediaSingleProps, {
|
|
507
515
|
showLegacyNotification: widthType !== 'pixel'
|
|
508
516
|
}), MediaChildren) : jsx(ResizableMediaSingle, _extends({}, resizableMediaSingleProps, {
|
|
@@ -4,23 +4,55 @@ var _templateObject;
|
|
|
4
4
|
* @jsxRuntime classic
|
|
5
5
|
* @jsx jsx
|
|
6
6
|
*/
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { useCallback } from 'react';
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
12
12
|
import { captionMessages as messages } from '@atlaskit/editor-common/media';
|
|
13
13
|
import { CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
|
|
14
|
+
import { Pressable, Text, xcss } from '@atlaskit/primitives';
|
|
14
15
|
import { N200 } from '@atlaskit/theme/colors';
|
|
15
16
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
16
17
|
var placeholder = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tcolor: ", ";\n\twidth: 100%;\n\ttext-align: center;\n\tmargin-top: ", " !important;\n\tdisplay: block;\n"])), "var(--ds-text-subtlest, ".concat(N200, ")"), "var(--ds-space-100, 8px)");
|
|
17
|
-
|
|
18
|
+
var placeholderButton = xcss({
|
|
19
|
+
width: '100%',
|
|
20
|
+
marginTop: 'space.100'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// platform_editor_typography_migration_ugc clean up
|
|
24
|
+
// Remove this component
|
|
25
|
+
export var CaptionPlaceholder = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
18
26
|
var onClick = _ref.onClick;
|
|
19
|
-
return
|
|
27
|
+
return (
|
|
28
|
+
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text
|
|
29
|
+
jsx("span", {
|
|
30
|
+
ref: ref,
|
|
31
|
+
css: placeholder,
|
|
32
|
+
onClick: onClick,
|
|
33
|
+
"data-id": CAPTION_PLACEHOLDER_ID,
|
|
34
|
+
"data-testid": "caption-placeholder"
|
|
35
|
+
}, jsx(FormattedMessage, messages.placeholder))
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
export var CaptionPlaceholderButton = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
39
|
+
var onClick = _ref2.onClick;
|
|
40
|
+
var handleMouseDown = useCallback(function (e) {
|
|
41
|
+
// In firefox, button is focused when mouse down, which make editor lose focus
|
|
42
|
+
// Hence we want to disabled it so that user can type in caption directly after click
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
}, []);
|
|
45
|
+
return jsx(Pressable, {
|
|
20
46
|
ref: ref,
|
|
21
|
-
|
|
47
|
+
backgroundColor: "color.background.neutral.subtle",
|
|
22
48
|
onClick: onClick,
|
|
49
|
+
onMouseDown: handleMouseDown,
|
|
23
50
|
"data-id": CAPTION_PLACEHOLDER_ID,
|
|
24
|
-
|
|
25
|
-
|
|
51
|
+
testId: "caption-placeholder",
|
|
52
|
+
padding: "space.0",
|
|
53
|
+
xcss: placeholderButton
|
|
54
|
+
}, jsx(Text, {
|
|
55
|
+
color: "color.text.subtlest",
|
|
56
|
+
size: "large"
|
|
57
|
+
}, jsx(FormattedMessage, messages.placeholder)));
|
|
26
58
|
});
|
|
@@ -10,11 +10,15 @@ import { jsx } from '@emotion/react';
|
|
|
10
10
|
import Button from '@atlaskit/button';
|
|
11
11
|
import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
|
|
12
12
|
import Form, { Field } from '@atlaskit/form';
|
|
13
|
-
import { Text } from '@atlaskit/primitives';
|
|
13
|
+
import { Box, Text, xcss } from '@atlaskit/primitives';
|
|
14
14
|
import Textfield from '@atlaskit/textfield';
|
|
15
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
16
16
|
import { PIXELENTRY_MIGRATION_BUTTON_TESTID } from './constants';
|
|
17
|
-
import { pixelEntryForm, pixelEntryHiddenSubmit, pixelSizingFullWidthLabelStyles, pixelSizingHeightInput, pixelSizingInput,
|
|
17
|
+
import { pixelEntryForm, pixelEntryHiddenSubmit, pixelSizingFullWidthLabelStyles, pixelSizingHeightInput, pixelSizingInput, pixelSizingWidthInput, pixelSizingWrapper } from './styles';
|
|
18
|
+
var pixelSizingLabel = xcss({
|
|
19
|
+
gridArea: 'label',
|
|
20
|
+
lineHeight: "var(--ds-space-300, 24px)"
|
|
21
|
+
});
|
|
18
22
|
export var PixelEntry = function PixelEntry(_ref) {
|
|
19
23
|
var width = _ref.width,
|
|
20
24
|
mediaWidth = _ref.mediaWidth,
|
|
@@ -148,9 +152,10 @@ export var PixelEntry = function PixelEntry(_ref) {
|
|
|
148
152
|
maxWidth: maxWidth
|
|
149
153
|
})
|
|
150
154
|
})));
|
|
151
|
-
}), jsx(
|
|
152
|
-
|
|
153
|
-
|
|
155
|
+
}), jsx(Box, {
|
|
156
|
+
as: "span",
|
|
157
|
+
xcss: pixelSizingLabel
|
|
158
|
+
}, "\xD7"), jsx(Field, {
|
|
154
159
|
key: "inputHeight",
|
|
155
160
|
name: "inputHeight",
|
|
156
161
|
defaultValue: computedHeight
|
|
@@ -6,6 +6,7 @@ var PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH = 120;
|
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
8
8
|
export var pixelSizingWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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)");
|
|
9
|
+
|
|
9
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
10
11
|
export var pixelEntryForm = css({
|
|
11
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
@@ -23,11 +24,7 @@ export var pixelSizingInput = css({
|
|
|
23
24
|
textAlign: 'center'
|
|
24
25
|
}
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
-
export var pixelSizingLabel = css({
|
|
28
|
-
gridArea: 'label',
|
|
29
|
-
lineHeight: "var(--ds-space-300, 24px)"
|
|
30
|
-
});
|
|
27
|
+
|
|
31
28
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
32
29
|
export var pixelSizingWidthInput = css({
|
|
33
30
|
gridArea: 'widthinput'
|
|
@@ -34,7 +34,7 @@ export default class MediaSingleNode extends Component<MediaSingleNodeProps, Med
|
|
|
34
34
|
mediaNodeUpdater: MediaNodeUpdater | null;
|
|
35
35
|
state: MediaSingleNodeState;
|
|
36
36
|
mediaSingleWrapperRef: React.RefObject<HTMLDivElement>;
|
|
37
|
-
captionPlaceHolderRef: React.RefObject<HTMLSpanElement>;
|
|
37
|
+
captionPlaceHolderRef: React.RefObject<HTMLButtonElement | HTMLSpanElement>;
|
|
38
38
|
createOrUpdateMediaNodeUpdater: (props: MediaSingleNodeProps) => void;
|
|
39
39
|
UNSAFE_componentWillReceiveProps(nextProps: MediaSingleNodeProps): void;
|
|
40
40
|
setViewMediaClientConfig: (props: MediaSingleNodeProps) => Promise<void>;
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
declare const
|
|
6
|
+
export declare const CaptionPlaceholder: React.ForwardRefExoticComponent<{
|
|
7
7
|
onClick: () => void;
|
|
8
8
|
} & React.RefAttributes<HTMLSpanElement>>;
|
|
9
|
-
export
|
|
9
|
+
export declare const CaptionPlaceholderButton: React.ForwardRefExoticComponent<{
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const pixelSizingWrapper: import("@emotion/react").SerializedStyles;
|
|
2
2
|
export declare const pixelEntryForm: import("@emotion/react").SerializedStyles;
|
|
3
3
|
export declare const pixelSizingInput: import("@emotion/react").SerializedStyles;
|
|
4
|
-
export declare const pixelSizingLabel: import("@emotion/react").SerializedStyles;
|
|
5
4
|
export declare const pixelSizingWidthInput: import("@emotion/react").SerializedStyles;
|
|
6
5
|
export declare const pixelSizingHeightInput: import("@emotion/react").SerializedStyles;
|
|
7
6
|
export declare const pixelEntryHiddenSubmit: import("@emotion/react").SerializedStyles;
|
|
@@ -34,7 +34,7 @@ export default class MediaSingleNode extends Component<MediaSingleNodeProps, Med
|
|
|
34
34
|
mediaNodeUpdater: MediaNodeUpdater | null;
|
|
35
35
|
state: MediaSingleNodeState;
|
|
36
36
|
mediaSingleWrapperRef: React.RefObject<HTMLDivElement>;
|
|
37
|
-
captionPlaceHolderRef: React.RefObject<HTMLSpanElement>;
|
|
37
|
+
captionPlaceHolderRef: React.RefObject<HTMLButtonElement | HTMLSpanElement>;
|
|
38
38
|
createOrUpdateMediaNodeUpdater: (props: MediaSingleNodeProps) => void;
|
|
39
39
|
UNSAFE_componentWillReceiveProps(nextProps: MediaSingleNodeProps): void;
|
|
40
40
|
setViewMediaClientConfig: (props: MediaSingleNodeProps) => Promise<void>;
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
declare const
|
|
6
|
+
export declare const CaptionPlaceholder: React.ForwardRefExoticComponent<{
|
|
7
7
|
onClick: () => void;
|
|
8
8
|
} & React.RefAttributes<HTMLSpanElement>>;
|
|
9
|
-
export
|
|
9
|
+
export declare const CaptionPlaceholderButton: React.ForwardRefExoticComponent<{
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const pixelSizingWrapper: import("@emotion/react").SerializedStyles;
|
|
2
2
|
export declare const pixelEntryForm: import("@emotion/react").SerializedStyles;
|
|
3
3
|
export declare const pixelSizingInput: import("@emotion/react").SerializedStyles;
|
|
4
|
-
export declare const pixelSizingLabel: import("@emotion/react").SerializedStyles;
|
|
5
4
|
export declare const pixelSizingWidthInput: import("@emotion/react").SerializedStyles;
|
|
6
5
|
export declare const pixelSizingHeightInput: import("@emotion/react").SerializedStyles;
|
|
7
6
|
export declare const pixelEntryHiddenSubmit: import("@emotion/react").SerializedStyles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.9",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/editor-shared-styles": "^3.0.0",
|
|
54
54
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
55
55
|
"@atlaskit/form": "^10.5.0",
|
|
56
|
-
"@atlaskit/icon": "^22.
|
|
56
|
+
"@atlaskit/icon": "^22.21.0",
|
|
57
57
|
"@atlaskit/media-card": "^78.5.0",
|
|
58
58
|
"@atlaskit/media-client": "^28.0.0",
|
|
59
59
|
"@atlaskit/media-client-react": "^2.2.0",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"@atlaskit/media-filmstrip": "^47.4.0",
|
|
62
62
|
"@atlaskit/media-picker": "^66.7.0",
|
|
63
63
|
"@atlaskit/media-ui": "^25.15.0",
|
|
64
|
-
"@atlaskit/media-viewer": "^
|
|
64
|
+
"@atlaskit/media-viewer": "^49.0.0",
|
|
65
65
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
66
66
|
"@atlaskit/primitives": "^12.2.0",
|
|
67
67
|
"@atlaskit/textfield": "^6.5.0",
|
|
68
68
|
"@atlaskit/theme": "^13.0.0",
|
|
69
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
69
|
+
"@atlaskit/tmp-editor-statsig": "^2.3.0",
|
|
70
70
|
"@atlaskit/tokens": "^2.0.0",
|
|
71
71
|
"@atlaskit/tooltip": "^18.8.0",
|
|
72
72
|
"@babel/runtime": "^7.0.0",
|
|
@@ -128,10 +128,6 @@
|
|
|
128
128
|
"type": "boolean",
|
|
129
129
|
"referenceOnly": "true"
|
|
130
130
|
},
|
|
131
|
-
"platform.media-experience.media-viewer-v2_hgsii": {
|
|
132
|
-
"type": "boolean",
|
|
133
|
-
"referenceOnly": "true"
|
|
134
|
-
},
|
|
135
131
|
"platform-editor-a11y-image-border-options-dropdown": {
|
|
136
132
|
"type": "boolean"
|
|
137
133
|
},
|