@atlaskit/editor-common 77.3.2 → 77.4.0
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 +11 -0
- package/afm-cc/tsconfig.json +12 -0
- package/dist/cjs/analytics/types/enums.js +1 -0
- package/dist/cjs/media-inline/inline-image-card.js +63 -0
- package/dist/cjs/media-inline/inline-image-wrapper.js +12 -1
- package/dist/cjs/media-inline/media-inline-image-card.js +57 -18
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/index.js +7 -0
- package/dist/cjs/ui-menu/DropdownMenu/index.js +2 -0
- package/dist/cjs/ui-menu/index.js +6 -0
- package/dist/es2019/analytics/types/enums.js +1 -0
- package/dist/es2019/media-inline/inline-image-card.js +56 -0
- package/dist/es2019/media-inline/inline-image-wrapper.js +14 -2
- package/dist/es2019/media-inline/media-inline-image-card.js +49 -19
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/index.js +2 -1
- package/dist/es2019/ui-menu/DropdownMenu/index.js +2 -1
- package/dist/es2019/ui-menu/index.js +1 -1
- package/dist/esm/analytics/types/enums.js +1 -0
- package/dist/esm/media-inline/inline-image-card.js +56 -0
- package/dist/esm/media-inline/inline-image-wrapper.js +14 -2
- package/dist/esm/media-inline/media-inline-image-card.js +58 -19
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/index.js +2 -1
- package/dist/esm/ui-menu/DropdownMenu/index.js +2 -1
- package/dist/esm/ui-menu/index.js +1 -1
- package/dist/types/analytics/types/enums.d.ts +1 -0
- package/dist/types/media-inline/inline-image-card.d.ts +16 -0
- package/dist/types/media-inline/types.d.ts +4 -0
- package/dist/types/ui/index.d.ts +1 -0
- package/dist/types/ui-menu/DropdownMenu/index.d.ts +4 -1
- package/dist/types/ui-menu/index.d.ts +1 -1
- package/dist/types-ts4.5/analytics/types/enums.d.ts +1 -0
- package/dist/types-ts4.5/media-inline/inline-image-card.d.ts +16 -0
- package/dist/types-ts4.5/media-inline/types.d.ts +4 -0
- package/dist/types-ts4.5/ui/index.d.ts +1 -0
- package/dist/types-ts4.5/ui-menu/DropdownMenu/index.d.ts +4 -1
- package/dist/types-ts4.5/ui-menu/index.d.ts +1 -1
- package/package.json +9 -5
- package/tsconfig.json +1042 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 77.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#71201](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/71201) [`1b48cdd3c074`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1b48cdd3c074) - ED-21767 fixed dom structure for inline images.
|
|
8
|
+
- [#69911](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69911) [`af0eee5ebf98`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/af0eee5ebf98) - Added DropdownMenuItem export from ui-menu, added DropList export from ui
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 77.3.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -81,9 +81,21 @@
|
|
|
81
81
|
{
|
|
82
82
|
"path": "../../../media/media-client/afm-cc/tsconfig.json"
|
|
83
83
|
},
|
|
84
|
+
{
|
|
85
|
+
"path": "../../../media/media-client-react/afm-cc/tsconfig.json"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"path": "../../../media/media-common/afm-cc/tsconfig.json"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"path": "../../../media/media-file-preview/afm-cc/tsconfig.json"
|
|
92
|
+
},
|
|
84
93
|
{
|
|
85
94
|
"path": "../../../media/media-picker/afm-cc/tsconfig.json"
|
|
86
95
|
},
|
|
96
|
+
{
|
|
97
|
+
"path": "../../../media/media-ui/afm-cc/tsconfig.json"
|
|
98
|
+
},
|
|
87
99
|
{
|
|
88
100
|
"path": "../../../elements/mention/afm-cc/tsconfig.json"
|
|
89
101
|
},
|
|
@@ -292,6 +292,7 @@ var ACTION_SUBJECT_ID = exports.ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTIO
|
|
|
292
292
|
ACTION_SUBJECT_ID["MEDIA"] = "media";
|
|
293
293
|
ACTION_SUBJECT_ID["MEDIA_GROUP"] = "mediaGroup";
|
|
294
294
|
ACTION_SUBJECT_ID["MEDIA_INLINE"] = "mediaInline";
|
|
295
|
+
ACTION_SUBJECT_ID["MEDIA_INLINE_IMAGE"] = "mediaInlineImage";
|
|
295
296
|
ACTION_SUBJECT_ID["MEDIA_LINK"] = "mediaLink";
|
|
296
297
|
ACTION_SUBJECT_ID["MEDIA_SINGLE"] = "mediaSingle";
|
|
297
298
|
ACTION_SUBJECT_ID["MENTION"] = "mention";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InlineImageCard = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _react2 = require("@emotion/react");
|
|
9
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
10
|
+
var _mediaFilePreview = require("@atlaskit/media-file-preview");
|
|
11
|
+
var _mediaUi = require("@atlaskit/media-ui");
|
|
12
|
+
var _loadingView = require("./views/loading-view");
|
|
13
|
+
/** @jsx jsx */
|
|
14
|
+
|
|
15
|
+
var InlineImageCard = exports.InlineImageCard = function InlineImageCard(_ref) {
|
|
16
|
+
var dimensions = _ref.dimensions,
|
|
17
|
+
identifier = _ref.identifier,
|
|
18
|
+
renderError = _ref.renderError,
|
|
19
|
+
alt = _ref.alt,
|
|
20
|
+
isLazy = _ref.isLazy,
|
|
21
|
+
ssr = _ref.ssr,
|
|
22
|
+
crop = _ref.crop,
|
|
23
|
+
stretch = _ref.stretch;
|
|
24
|
+
// Generate unique traceId for file
|
|
25
|
+
var traceContext = (0, _react.useMemo)(function () {
|
|
26
|
+
return {
|
|
27
|
+
traceId: (0, _mediaCommon.getRandomHex)(8)
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
// TODO do we need to handle nonCriticalError
|
|
32
|
+
var _useFilePreview = (0, _mediaFilePreview.useFilePreview)({
|
|
33
|
+
identifier: identifier,
|
|
34
|
+
ssr: ssr,
|
|
35
|
+
dimensions: dimensions,
|
|
36
|
+
traceContext: traceContext
|
|
37
|
+
}),
|
|
38
|
+
preview = _useFilePreview.preview,
|
|
39
|
+
previewError = _useFilePreview.error,
|
|
40
|
+
onImageError = _useFilePreview.onImageError,
|
|
41
|
+
_onImageLoad = _useFilePreview.onImageLoad;
|
|
42
|
+
if (previewError) {
|
|
43
|
+
return renderError({
|
|
44
|
+
error: previewError
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (!preview) {
|
|
48
|
+
return (0, _react2.jsx)(_loadingView.InlineImageCardLoadingView, null);
|
|
49
|
+
}
|
|
50
|
+
return (0, _react2.jsx)(_mediaUi.MediaImage, {
|
|
51
|
+
dataURI: preview.dataURI,
|
|
52
|
+
alt: alt,
|
|
53
|
+
previewOrientation: preview.orientation,
|
|
54
|
+
onImageLoad: function onImageLoad() {
|
|
55
|
+
_onImageLoad(preview);
|
|
56
|
+
},
|
|
57
|
+
onImageError: onImageError,
|
|
58
|
+
loading: isLazy ? 'lazy' : undefined,
|
|
59
|
+
forceSyncDisplay: !!ssr,
|
|
60
|
+
crop: crop,
|
|
61
|
+
stretch: stretch
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -12,6 +12,15 @@ var _editorPalette = require("@atlaskit/editor-palette");
|
|
|
12
12
|
var _styles = require("./styles");
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */
|
|
15
|
+
// The MediaImage component needs to obtain its parent's dimensions.
|
|
16
|
+
// To achieve this, we have added an additional wrapper that allows
|
|
17
|
+
// for better interaction with the parent element. This is necessary
|
|
18
|
+
// because the parent size changes its box-sizing with the node border.
|
|
19
|
+
var sizeWrapperStyle = (0, _react.css)({
|
|
20
|
+
display: 'inline-flex',
|
|
21
|
+
width: '100%',
|
|
22
|
+
height: '100%'
|
|
23
|
+
});
|
|
15
24
|
var InlineImageWrapper = exports.InlineImageWrapper = function InlineImageWrapper(_ref) {
|
|
16
25
|
var _ref2;
|
|
17
26
|
var children = _ref.children,
|
|
@@ -30,6 +39,8 @@ var InlineImageWrapper = exports.InlineImageWrapper = function InlineImageWrappe
|
|
|
30
39
|
className: _styles.INLINE_IMAGE_WRAPPER_CLASS_NAME,
|
|
31
40
|
css: [_styles.wrapperStyle, borderSize && borderColor && _styles.borderStyle, isSelected && _styles.selectedStyle],
|
|
32
41
|
"data-testid": "inline-image-wrapper"
|
|
33
|
-
}, htmlAttrs),
|
|
42
|
+
}, htmlAttrs), (0, _react.jsx)("span", {
|
|
43
|
+
css: sizeWrapperStyle
|
|
44
|
+
}, children))
|
|
34
45
|
);
|
|
35
46
|
};
|
|
@@ -10,9 +10,13 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _reactIntlNext = require("react-intl-next");
|
|
13
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
14
|
var _mediaCard = require("@atlaskit/media-card");
|
|
15
|
+
var _mediaClient = require("@atlaskit/media-client");
|
|
16
|
+
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
14
17
|
var _mediaInlineCard = require("../messages/media-inline-card");
|
|
15
18
|
var _constants = require("./constants");
|
|
19
|
+
var _inlineImageCard = require("./inline-image-card");
|
|
16
20
|
var _inlineImageWrapper = require("./inline-image-wrapper");
|
|
17
21
|
var _errorView = require("./views/error-view");
|
|
18
22
|
var _loadingView = require("./views/loading-view");
|
|
@@ -38,10 +42,34 @@ var MediaInlineImageCardInternal = exports.MediaInlineImageCardInternal = functi
|
|
|
38
42
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
39
43
|
subscribeError = _useState4[0],
|
|
40
44
|
setSubscribeError = _useState4[1];
|
|
45
|
+
var _useState5 = (0, _react.useState)(false),
|
|
46
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
47
|
+
isFailedEventSent = _useState6[0],
|
|
48
|
+
setIsFailedEventSent = _useState6[1];
|
|
49
|
+
var _useState7 = (0, _react.useState)(false),
|
|
50
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
51
|
+
isSucceededEventSent = _useState8[0],
|
|
52
|
+
setIsSucceededEventSent = _useState8[1];
|
|
41
53
|
var _ref2 = intl || (0, _reactIntlNext.createIntl)({
|
|
42
54
|
locale: 'en'
|
|
43
55
|
}),
|
|
44
56
|
formatMessage = _ref2.formatMessage;
|
|
57
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
58
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
59
|
+
var fireFailedOperationalEvent = function fireFailedOperationalEvent() {
|
|
60
|
+
var error = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new _mediaCard.MediaCardError('missing-error-data');
|
|
61
|
+
var failReason = arguments.length > 1 ? arguments[1] : undefined;
|
|
62
|
+
if (!isFailedEventSent && fileState) {
|
|
63
|
+
setIsFailedEventSent(true);
|
|
64
|
+
(0, _mediaCard.fireFailedMediaInlineEvent)(fileState, error, failReason, createAnalyticsEvent);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var fireSucceededOperationalEvent = function fireSucceededOperationalEvent() {
|
|
68
|
+
if (!isSucceededEventSent && fileState) {
|
|
69
|
+
setIsSucceededEventSent(true);
|
|
70
|
+
(0, _mediaCard.fireSucceededMediaInlineEvent)(fileState, createAnalyticsEvent);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
45
73
|
(0, _react.useEffect)(function () {
|
|
46
74
|
if (mediaClient) {
|
|
47
75
|
var subscription = mediaClient.file.getFileState(identifier.id, {
|
|
@@ -64,41 +92,52 @@ var MediaInlineImageCardInternal = exports.MediaInlineImageCardInternal = functi
|
|
|
64
92
|
if (subscribeError) {
|
|
65
93
|
var isUploading = (fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading';
|
|
66
94
|
var errorMessage = isUploading ? _mediaInlineCard.messages.failedToUpload : _mediaInlineCard.messages.unableToLoadContent;
|
|
95
|
+
var errorReason = (fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading' ? 'upload' : 'metadata-fetch';
|
|
96
|
+
fireFailedOperationalEvent(new _mediaCard.MediaCardError(errorReason, subscribeError));
|
|
67
97
|
return (0, _react2.jsx)(_errorView.InlineImageCardErrorView, {
|
|
68
98
|
message: formatMessage(errorMessage)
|
|
69
99
|
});
|
|
70
100
|
}
|
|
71
|
-
if ((fileState === null || fileState === void 0 ? void 0 : fileState.status) === '
|
|
101
|
+
if (!fileState || (fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading') {
|
|
102
|
+
return (0, _react2.jsx)(_loadingView.InlineImageCardLoadingView, null);
|
|
103
|
+
}
|
|
104
|
+
if (fileState.status === 'error') {
|
|
105
|
+
var error = new _mediaCard.MediaCardError('error-file-state', new Error(fileState.message));
|
|
106
|
+
!isFailedEventSent && fireFailedOperationalEvent(error);
|
|
72
107
|
return (0, _react2.jsx)(_errorView.InlineImageCardErrorView, {
|
|
73
108
|
message: formatMessage(_mediaInlineCard.messages.unableToLoadContent)
|
|
74
109
|
});
|
|
75
|
-
}
|
|
76
|
-
|
|
110
|
+
} else if (fileState.status === 'failed-processing') {
|
|
111
|
+
!isFailedEventSent && fireFailedOperationalEvent(undefined, 'failed-processing');
|
|
77
112
|
return (0, _react2.jsx)(_errorView.InlineImageCardErrorView, {
|
|
78
113
|
message: formatMessage(_mediaInlineCard.messages.unableToLoadContent)
|
|
79
114
|
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
115
|
+
} else if (!fileState.name) {
|
|
116
|
+
var _error = new _mediaCard.MediaCardError('metadata-fetch', new _mediaClient.FileFetcherError('emptyFileName', fileState.id));
|
|
117
|
+
!isFailedEventSent && fireFailedOperationalEvent(_error);
|
|
83
118
|
return (0, _react2.jsx)(_errorView.InlineImageCardErrorView, {
|
|
84
119
|
message: formatMessage(_mediaInlineCard.messages.unableToLoadContent)
|
|
85
120
|
});
|
|
86
121
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return (0, _react2.jsx)(_loadingView.InlineImageCardLoadingView, null);
|
|
122
|
+
if (fileState.status === 'processed') {
|
|
123
|
+
fireSucceededOperationalEvent();
|
|
90
124
|
}
|
|
91
|
-
return (0, _react2.jsx)(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
identifier: identifier,
|
|
125
|
+
return (0, _react2.jsx)(_mediaClientReact.MediaClientContext.Provider, {
|
|
126
|
+
value: mediaClient
|
|
127
|
+
}, (0, _react2.jsx)(_inlineImageCard.InlineImageCard, {
|
|
95
128
|
dimensions: dimensions,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
129
|
+
identifier: identifier,
|
|
130
|
+
renderError: function renderError() {
|
|
131
|
+
return (0, _react2.jsx)(_errorView.InlineImageCardErrorView, {
|
|
132
|
+
message: formatMessage(_mediaInlineCard.messages.unableToLoadContent)
|
|
133
|
+
});
|
|
134
|
+
},
|
|
99
135
|
alt: alt,
|
|
100
|
-
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
101
|
-
|
|
136
|
+
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode,
|
|
137
|
+
isLazy: isLazy,
|
|
138
|
+
crop: true,
|
|
139
|
+
stretch: false
|
|
140
|
+
}));
|
|
102
141
|
};
|
|
103
142
|
var aspectRatio = (0, _react.useMemo)(function () {
|
|
104
143
|
return width && height ? width / height : undefined;
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "77.
|
|
19
|
+
var packageVersion = "77.4.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -22,7 +22,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
22
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
23
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
24
24
|
var packageName = "@atlaskit/editor-common";
|
|
25
|
-
var packageVersion = "77.
|
|
25
|
+
var packageVersion = "77.4.0";
|
|
26
26
|
var halfFocusRing = 1;
|
|
27
27
|
var dropOffset = '0, 8';
|
|
28
28
|
var DropList = /*#__PURE__*/function (_Component) {
|
package/dist/cjs/ui/index.js
CHANGED
|
@@ -47,6 +47,12 @@ Object.defineProperty(exports, "ContextPanelWidthProvider", {
|
|
|
47
47
|
return _context.ContextPanelWidthProvider;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
+
Object.defineProperty(exports, "DropList", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function get() {
|
|
53
|
+
return _DropList.default;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
50
56
|
Object.defineProperty(exports, "EDIT_AREA_ID", {
|
|
51
57
|
enumerable: true,
|
|
52
58
|
get: function get() {
|
|
@@ -408,5 +414,6 @@ var _styles = require("./PanelTextInput/styles");
|
|
|
408
414
|
var _PanelTextInput = _interopRequireDefault(require("./PanelTextInput"));
|
|
409
415
|
var _announcer = _interopRequireDefault(require("./Announcer/announcer"));
|
|
410
416
|
var _Toolbar = require("./Toolbar");
|
|
417
|
+
var _DropList = _interopRequireDefault(require("./DropList"));
|
|
411
418
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
412
419
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -5,6 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.DropdownMenuItem = DropdownMenuItem;
|
|
8
9
|
exports.default = exports.DropdownMenuWithKeyboardNavigation = void 0;
|
|
9
10
|
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -334,6 +335,7 @@ function DropdownMenuItem(_ref) {
|
|
|
334
335
|
var DropdownMenuWithKeyboardNavigation = exports.DropdownMenuWithKeyboardNavigation = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
335
336
|
var props = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref2), _ref2));
|
|
336
337
|
var keyDownHandlerContext = (0, _react.useContext)(_ToolbarArrowKeyNavigationProvider.KeyDownHandlerContext);
|
|
338
|
+
|
|
337
339
|
// This context is to handle the tab, Arrow Right/Left key events for dropdown.
|
|
338
340
|
// Default context has the void callbacks for above key events
|
|
339
341
|
return (0, _react2.jsx)(DropdownMenuWrapper, (0, _extends2.default)({
|
|
@@ -47,6 +47,12 @@ Object.defineProperty(exports, "DropdownMenu", {
|
|
|
47
47
|
return _DropdownMenu.default;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
+
Object.defineProperty(exports, "DropdownMenuItem", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function get() {
|
|
53
|
+
return _DropdownMenu.DropdownMenuItem;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
50
56
|
Object.defineProperty(exports, "DropdownMenuWithKeyboardNavigation", {
|
|
51
57
|
enumerable: true,
|
|
52
58
|
get: function get() {
|
|
@@ -286,6 +286,7 @@ export let ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
286
286
|
ACTION_SUBJECT_ID["MEDIA"] = "media";
|
|
287
287
|
ACTION_SUBJECT_ID["MEDIA_GROUP"] = "mediaGroup";
|
|
288
288
|
ACTION_SUBJECT_ID["MEDIA_INLINE"] = "mediaInline";
|
|
289
|
+
ACTION_SUBJECT_ID["MEDIA_INLINE_IMAGE"] = "mediaInlineImage";
|
|
289
290
|
ACTION_SUBJECT_ID["MEDIA_LINK"] = "mediaLink";
|
|
290
291
|
ACTION_SUBJECT_ID["MEDIA_SINGLE"] = "mediaSingle";
|
|
291
292
|
ACTION_SUBJECT_ID["MENTION"] = "mention";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import { getRandomHex } from '@atlaskit/media-common';
|
|
5
|
+
import { useFilePreview } from '@atlaskit/media-file-preview';
|
|
6
|
+
import { MediaImage } from '@atlaskit/media-ui';
|
|
7
|
+
import { InlineImageCardLoadingView } from './views/loading-view';
|
|
8
|
+
export const InlineImageCard = ({
|
|
9
|
+
dimensions,
|
|
10
|
+
identifier,
|
|
11
|
+
renderError,
|
|
12
|
+
alt,
|
|
13
|
+
isLazy,
|
|
14
|
+
ssr,
|
|
15
|
+
crop,
|
|
16
|
+
stretch
|
|
17
|
+
}) => {
|
|
18
|
+
// Generate unique traceId for file
|
|
19
|
+
const traceContext = useMemo(() => ({
|
|
20
|
+
traceId: getRandomHex(8)
|
|
21
|
+
}), []);
|
|
22
|
+
|
|
23
|
+
// TODO do we need to handle nonCriticalError
|
|
24
|
+
const {
|
|
25
|
+
preview,
|
|
26
|
+
error: previewError,
|
|
27
|
+
onImageError,
|
|
28
|
+
onImageLoad
|
|
29
|
+
} = useFilePreview({
|
|
30
|
+
identifier,
|
|
31
|
+
ssr,
|
|
32
|
+
dimensions,
|
|
33
|
+
traceContext
|
|
34
|
+
});
|
|
35
|
+
if (previewError) {
|
|
36
|
+
return renderError({
|
|
37
|
+
error: previewError
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (!preview) {
|
|
41
|
+
return jsx(InlineImageCardLoadingView, null);
|
|
42
|
+
}
|
|
43
|
+
return jsx(MediaImage, {
|
|
44
|
+
dataURI: preview.dataURI,
|
|
45
|
+
alt: alt,
|
|
46
|
+
previewOrientation: preview.orientation,
|
|
47
|
+
onImageLoad: () => {
|
|
48
|
+
onImageLoad(preview);
|
|
49
|
+
},
|
|
50
|
+
onImageError: onImageError,
|
|
51
|
+
loading: isLazy ? 'lazy' : undefined,
|
|
52
|
+
forceSyncDisplay: !!ssr,
|
|
53
|
+
crop: crop,
|
|
54
|
+
stretch: stretch
|
|
55
|
+
});
|
|
56
|
+
};
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
|
|
4
|
-
import { jsx } from '@emotion/react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
|
|
6
6
|
import { borderStyle, INLINE_IMAGE_ASPECT_RATIO_CSS_VAR_KEY, INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY, INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY, INLINE_IMAGE_WRAPPER_CLASS_NAME, selectedStyle, wrapperStyle } from './styles';
|
|
7
|
+
|
|
8
|
+
// The MediaImage component needs to obtain its parent's dimensions.
|
|
9
|
+
// To achieve this, we have added an additional wrapper that allows
|
|
10
|
+
// for better interaction with the parent element. This is necessary
|
|
11
|
+
// because the parent size changes its box-sizing with the node border.
|
|
12
|
+
const sizeWrapperStyle = css({
|
|
13
|
+
display: 'inline-flex',
|
|
14
|
+
width: '100%',
|
|
15
|
+
height: '100%'
|
|
16
|
+
});
|
|
7
17
|
export const InlineImageWrapper = ({
|
|
8
18
|
children,
|
|
9
19
|
isSelected,
|
|
@@ -29,6 +39,8 @@ export const InlineImageWrapper = ({
|
|
|
29
39
|
className: INLINE_IMAGE_WRAPPER_CLASS_NAME,
|
|
30
40
|
css: [wrapperStyle, borderSize && borderColor && borderStyle, isSelected && selectedStyle],
|
|
31
41
|
"data-testid": "inline-image-wrapper"
|
|
32
|
-
}, htmlAttrs),
|
|
42
|
+
}, htmlAttrs), jsx("span", {
|
|
43
|
+
css: sizeWrapperStyle
|
|
44
|
+
}, children))
|
|
33
45
|
);
|
|
34
46
|
};
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
import { useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { createIntl, injectIntl } from 'react-intl-next';
|
|
6
|
-
import {
|
|
6
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
+
import { fireFailedMediaInlineEvent, fireSucceededMediaInlineEvent, MediaCardError } from '@atlaskit/media-card';
|
|
8
|
+
import { FileFetcherError } from '@atlaskit/media-client';
|
|
9
|
+
import { MediaClientContext } from '@atlaskit/media-client-react';
|
|
7
10
|
import { messages } from '../messages/media-inline-card';
|
|
8
11
|
import { referenceHeights } from './constants';
|
|
12
|
+
import { InlineImageCard } from './inline-image-card';
|
|
9
13
|
import { InlineImageWrapper } from './inline-image-wrapper';
|
|
10
14
|
import { InlineImageCardErrorView } from './views/error-view';
|
|
11
15
|
import { InlineImageCardLoadingView } from './views/loading-view';
|
|
@@ -24,11 +28,28 @@ export const MediaInlineImageCardInternal = ({
|
|
|
24
28
|
}) => {
|
|
25
29
|
const [fileState, setFileState] = useState();
|
|
26
30
|
const [subscribeError, setSubscribeError] = useState();
|
|
31
|
+
const [isFailedEventSent, setIsFailedEventSent] = useState(false);
|
|
32
|
+
const [isSucceededEventSent, setIsSucceededEventSent] = useState(false);
|
|
27
33
|
const {
|
|
28
34
|
formatMessage
|
|
29
35
|
} = intl || createIntl({
|
|
30
36
|
locale: 'en'
|
|
31
37
|
});
|
|
38
|
+
const {
|
|
39
|
+
createAnalyticsEvent
|
|
40
|
+
} = useAnalyticsEvents();
|
|
41
|
+
const fireFailedOperationalEvent = (error = new MediaCardError('missing-error-data'), failReason) => {
|
|
42
|
+
if (!isFailedEventSent && fileState) {
|
|
43
|
+
setIsFailedEventSent(true);
|
|
44
|
+
fireFailedMediaInlineEvent(fileState, error, failReason, createAnalyticsEvent);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const fireSucceededOperationalEvent = () => {
|
|
48
|
+
if (!isSucceededEventSent && fileState) {
|
|
49
|
+
setIsSucceededEventSent(true);
|
|
50
|
+
fireSucceededMediaInlineEvent(fileState, createAnalyticsEvent);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
32
53
|
useEffect(() => {
|
|
33
54
|
if (mediaClient) {
|
|
34
55
|
const subscription = mediaClient.file.getFileState(identifier.id, {
|
|
@@ -51,41 +72,50 @@ export const MediaInlineImageCardInternal = ({
|
|
|
51
72
|
if (subscribeError) {
|
|
52
73
|
const isUploading = (fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading';
|
|
53
74
|
const errorMessage = isUploading ? messages.failedToUpload : messages.unableToLoadContent;
|
|
75
|
+
const errorReason = (fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading' ? 'upload' : 'metadata-fetch';
|
|
76
|
+
fireFailedOperationalEvent(new MediaCardError(errorReason, subscribeError));
|
|
54
77
|
return jsx(InlineImageCardErrorView, {
|
|
55
78
|
message: formatMessage(errorMessage)
|
|
56
79
|
});
|
|
57
80
|
}
|
|
58
|
-
if ((fileState === null || fileState === void 0 ? void 0 : fileState.status) === '
|
|
81
|
+
if (!fileState || (fileState === null || fileState === void 0 ? void 0 : fileState.status) === 'uploading') {
|
|
82
|
+
return jsx(InlineImageCardLoadingView, null);
|
|
83
|
+
}
|
|
84
|
+
if (fileState.status === 'error') {
|
|
85
|
+
const error = new MediaCardError('error-file-state', new Error(fileState.message));
|
|
86
|
+
!isFailedEventSent && fireFailedOperationalEvent(error);
|
|
59
87
|
return jsx(InlineImageCardErrorView, {
|
|
60
88
|
message: formatMessage(messages.unableToLoadContent)
|
|
61
89
|
});
|
|
62
|
-
}
|
|
63
|
-
|
|
90
|
+
} else if (fileState.status === 'failed-processing') {
|
|
91
|
+
!isFailedEventSent && fireFailedOperationalEvent(undefined, 'failed-processing');
|
|
64
92
|
return jsx(InlineImageCardErrorView, {
|
|
65
93
|
message: formatMessage(messages.unableToLoadContent)
|
|
66
94
|
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
95
|
+
} else if (!fileState.name) {
|
|
96
|
+
const error = new MediaCardError('metadata-fetch', new FileFetcherError('emptyFileName', fileState.id));
|
|
97
|
+
!isFailedEventSent && fireFailedOperationalEvent(error);
|
|
70
98
|
return jsx(InlineImageCardErrorView, {
|
|
71
99
|
message: formatMessage(messages.unableToLoadContent)
|
|
72
100
|
});
|
|
73
101
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return jsx(InlineImageCardLoadingView, null);
|
|
102
|
+
if (fileState.status === 'processed') {
|
|
103
|
+
fireSucceededOperationalEvent();
|
|
77
104
|
}
|
|
78
|
-
return jsx(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
identifier: identifier,
|
|
105
|
+
return jsx(MediaClientContext.Provider, {
|
|
106
|
+
value: mediaClient
|
|
107
|
+
}, jsx(InlineImageCard, {
|
|
82
108
|
dimensions: dimensions,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
109
|
+
identifier: identifier,
|
|
110
|
+
renderError: () => jsx(InlineImageCardErrorView, {
|
|
111
|
+
message: formatMessage(messages.unableToLoadContent)
|
|
112
|
+
}),
|
|
86
113
|
alt: alt,
|
|
87
|
-
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
88
|
-
|
|
114
|
+
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode,
|
|
115
|
+
isLazy: isLazy,
|
|
116
|
+
crop: true,
|
|
117
|
+
stretch: false
|
|
118
|
+
}));
|
|
89
119
|
};
|
|
90
120
|
const aspectRatio = useMemo(() => width && height ? width / height : undefined, [width, height]);
|
|
91
121
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "77.
|
|
3
|
+
const packageVersion = "77.4.0";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
7
7
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
8
8
|
import Layer from '../Layer';
|
|
9
9
|
const packageName = "@atlaskit/editor-common";
|
|
10
|
-
const packageVersion = "77.
|
|
10
|
+
const packageVersion = "77.4.0";
|
|
11
11
|
const halfFocusRing = 1;
|
|
12
12
|
const dropOffset = '0, 8';
|
|
13
13
|
class DropList extends Component {
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -28,4 +28,5 @@ export { wrapperStyle } from './ResizerLegacy/styled';
|
|
|
28
28
|
export { panelTextInput } from './PanelTextInput/styles';
|
|
29
29
|
export { default as PanelTextInput } from './PanelTextInput';
|
|
30
30
|
export { default as Announcer } from './Announcer/announcer';
|
|
31
|
-
export { EDIT_AREA_ID } from './Toolbar';
|
|
31
|
+
export { EDIT_AREA_ID } from './Toolbar';
|
|
32
|
+
export { default as DropList } from './DropList';
|
|
@@ -264,7 +264,7 @@ const DropdownMenuItemCustomComponent = /*#__PURE__*/React.forwardRef((props, re
|
|
|
264
264
|
}
|
|
265
265
|
}), children);
|
|
266
266
|
});
|
|
267
|
-
function DropdownMenuItem({
|
|
267
|
+
export function DropdownMenuItem({
|
|
268
268
|
item,
|
|
269
269
|
onItemActivated,
|
|
270
270
|
shouldUseDefaultRole,
|
|
@@ -328,6 +328,7 @@ export const DropdownMenuWithKeyboardNavigation = /*#__PURE__*/React.memo(({
|
|
|
328
328
|
...props
|
|
329
329
|
}) => {
|
|
330
330
|
const keyDownHandlerContext = useContext(KeyDownHandlerContext);
|
|
331
|
+
|
|
331
332
|
// This context is to handle the tab, Arrow Right/Left key events for dropdown.
|
|
332
333
|
// Default context has the void callbacks for above key events
|
|
333
334
|
return jsx(DropdownMenuWrapper, _extends({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as DropdownMenu, DropdownMenuWithKeyboardNavigation } from './DropdownMenu';
|
|
1
|
+
export { default as DropdownMenu, DropdownMenuItem, DropdownMenuWithKeyboardNavigation } from './DropdownMenu';
|
|
2
2
|
export { default as ToolbarButton, TOOLBAR_BUTTON } from './ToolbarButton';
|
|
3
3
|
export { ArrowKeyNavigationProvider } from './ArrowKeyNavigationProvider';
|
|
4
4
|
export { ToolbarArrowKeyNavigationProvider, KeyDownHandlerContext } from './ToolbarArrowKeyNavigationProvider';
|
|
@@ -286,6 +286,7 @@ export var ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
286
286
|
ACTION_SUBJECT_ID["MEDIA"] = "media";
|
|
287
287
|
ACTION_SUBJECT_ID["MEDIA_GROUP"] = "mediaGroup";
|
|
288
288
|
ACTION_SUBJECT_ID["MEDIA_INLINE"] = "mediaInline";
|
|
289
|
+
ACTION_SUBJECT_ID["MEDIA_INLINE_IMAGE"] = "mediaInlineImage";
|
|
289
290
|
ACTION_SUBJECT_ID["MEDIA_LINK"] = "mediaLink";
|
|
290
291
|
ACTION_SUBJECT_ID["MEDIA_SINGLE"] = "mediaSingle";
|
|
291
292
|
ACTION_SUBJECT_ID["MENTION"] = "mention";
|