@atlaskit/renderer 109.19.0 → 109.19.2
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 +12 -0
- package/dist/cjs/react/nodes/media/index.js +23 -10
- package/dist/cjs/react/nodes/mediaSingle/index.js +6 -4
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/element/mark.js +5 -0
- package/dist/es2019/react/nodes/media/index.js +30 -7
- package/dist/es2019/react/nodes/mediaSingle/index.js +6 -4
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/element/mark.js +5 -0
- package/dist/esm/react/nodes/media/index.js +21 -8
- package/dist/esm/react/nodes/mediaSingle/index.js +6 -4
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/element/mark.js +5 -0
- package/dist/types/react/nodes/media/index.d.ts +3 -0
- package/dist/types/react/types.d.ts +1 -0
- package/dist/types-ts4.5/react/nodes/media/index.d.ts +3 -0
- package/dist/types-ts4.5/react/types.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/react/nodes/media/styles.js +0 -14
- package/dist/es2019/react/nodes/media/styles.js +0 -19
- package/dist/esm/react/nodes/media/styles.js +0 -7
- package/dist/types/react/nodes/media/styles.d.ts +0 -2
- package/dist/types-ts4.5/react/nodes/media/styles.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 109.19.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#91468](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91468) [`4ad8a0bc6051`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4ad8a0bc6051) - Fixes preview linking and annotation flow on media with annotation
|
|
8
|
+
|
|
9
|
+
## 109.19.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#91808](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91808) [`00e5dcfdf240`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/00e5dcfdf240) - [ux] Does not add comment button on hover on media that is inside comment or inline comment rendereres
|
|
14
|
+
|
|
3
15
|
## 109.19.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.linkStyle = exports.default = exports.borderStyle = void 0;
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
11
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -16,6 +16,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
17
17
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
18
18
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
19
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
19
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
20
21
|
var _react2 = require("@emotion/react");
|
|
21
22
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
@@ -30,12 +31,12 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
30
31
|
var _events = require("../../../analytics/events");
|
|
31
32
|
var _annotation = _interopRequireDefault(require("../../marks/annotation"));
|
|
32
33
|
var _context = require("../../../ui/annotations/context");
|
|
33
|
-
var _styles = require("./styles");
|
|
34
34
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
35
35
|
var _reactIntlNext = require("react-intl-next");
|
|
36
36
|
var _hooks = require("../../../ui/annotations/hooks");
|
|
37
37
|
var _types = require("@atlaskit/editor-common/types");
|
|
38
|
-
var _excluded = ["marks", "mediaElement"];
|
|
38
|
+
var _excluded = ["marks", "mediaElement", "isDrafting"];
|
|
39
|
+
var _templateObject, _templateObject2;
|
|
39
40
|
/** @jsx jsx */
|
|
40
41
|
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); }
|
|
41
42
|
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 && Object.prototype.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; }
|
|
@@ -43,6 +44,10 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
43
44
|
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; }
|
|
44
45
|
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); }; }
|
|
45
46
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
47
|
+
var linkStyle = exports.linkStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n background: transparent;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n cursor: pointer;\n width: 100% !important;\n height: 100% !important;\n"])));
|
|
48
|
+
var borderStyle = exports.borderStyle = function borderStyle(color, width) {
|
|
49
|
+
return (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n width: 100% !important;\n height: 100% !important;\n border-radius: ", "px;\n box-shadow: 0 0 0 ", "px ", ";\n"])), width, width, color);
|
|
50
|
+
};
|
|
46
51
|
var MediaBorder = function MediaBorder(_ref) {
|
|
47
52
|
var _mark$attrs$color, _mark$attrs$size;
|
|
48
53
|
var mark = _ref.mark,
|
|
@@ -57,7 +62,7 @@ var MediaBorder = function MediaBorder(_ref) {
|
|
|
57
62
|
"data-mark-type": "border",
|
|
58
63
|
"data-color": borderColor,
|
|
59
64
|
"data-size": borderWidth,
|
|
60
|
-
css:
|
|
65
|
+
css: borderStyle(paletteColorValue, borderWidth)
|
|
61
66
|
}, (0, _react2.jsx)(_ui.MediaBorderGapFiller, {
|
|
62
67
|
borderColor: borderColor
|
|
63
68
|
}), children);
|
|
@@ -75,7 +80,7 @@ var MediaLink = function MediaLink(_ref2) {
|
|
|
75
80
|
rel: "noreferrer noopener",
|
|
76
81
|
onClick: onClick,
|
|
77
82
|
"data-block-link": linkHref,
|
|
78
|
-
css:
|
|
83
|
+
css: linkStyle
|
|
79
84
|
}, children);
|
|
80
85
|
};
|
|
81
86
|
var MediaAnnotation = function MediaAnnotation(_ref3) {
|
|
@@ -88,7 +93,8 @@ var MediaAnnotation = function MediaAnnotation(_ref3) {
|
|
|
88
93
|
id: mark.attrs.id,
|
|
89
94
|
annotationType: mark.attrs.annotationType,
|
|
90
95
|
dataAttributes: {
|
|
91
|
-
'data-renderer-mark': true
|
|
96
|
+
'data-renderer-mark': true,
|
|
97
|
+
'data-block-mark': true
|
|
92
98
|
}
|
|
93
99
|
// This should be fine being empty [] since the serializer serializeFragmentChild getMarkProps call always passes
|
|
94
100
|
,
|
|
@@ -121,6 +127,8 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
121
127
|
var _marks$map;
|
|
122
128
|
var marks = _ref5.marks,
|
|
123
129
|
mediaElement = _ref5.mediaElement,
|
|
130
|
+
_ref5$isDrafting = _ref5.isDrafting,
|
|
131
|
+
isDrafting = _ref5$isDrafting === void 0 ? false : _ref5$isDrafting,
|
|
124
132
|
rest = (0, _objectWithoutProperties2.default)(_ref5, _excluded);
|
|
125
133
|
var _useState = (0, _react.useState)('default'),
|
|
126
134
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -160,10 +168,11 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
160
168
|
observer.disconnect();
|
|
161
169
|
};
|
|
162
170
|
}, [mediaElement, setStatus]);
|
|
163
|
-
if (!activeParentIds.length) {
|
|
171
|
+
if (!isDrafting && !activeParentIds.length) {
|
|
164
172
|
return null;
|
|
165
173
|
}
|
|
166
174
|
var onClick = function onClick(e) {
|
|
175
|
+
e.preventDefault();
|
|
167
176
|
if (updateSubscriber) {
|
|
168
177
|
updateSubscriber.emit(_types.AnnotationUpdateEvent.ON_ANNOTATION_CLICK, {
|
|
169
178
|
annotationIds: activeParentIds,
|
|
@@ -201,7 +210,9 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
201
210
|
ssr = _this$props.ssr,
|
|
202
211
|
width = _this$props.width,
|
|
203
212
|
height = _this$props.height,
|
|
204
|
-
mediaSingleElement = _this$props.mediaSingleElement
|
|
213
|
+
mediaSingleElement = _this$props.mediaSingleElement,
|
|
214
|
+
_this$props$isDraftin = _this$props.isDrafting,
|
|
215
|
+
isDrafting = _this$props$isDraftin === void 0 ? false : _this$props$isDraftin;
|
|
205
216
|
var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
|
|
206
217
|
var borderMark = _this.props.marks.find(_this.props.isBorderMark);
|
|
207
218
|
var linkMark = _this.props.marks.find(_this.props.isLinkMark);
|
|
@@ -223,7 +234,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
223
234
|
marks: annotationMarks,
|
|
224
235
|
mediaElement: mediaSingleElement,
|
|
225
236
|
width: width,
|
|
226
|
-
height: height
|
|
237
|
+
height: height,
|
|
238
|
+
isDrafting: isDrafting
|
|
227
239
|
}), (0, _react2.jsx)(_MediaCard.MediaCard, (0, _extends2.default)({
|
|
228
240
|
contextIdentifierProvider: contextIdentifierProvider
|
|
229
241
|
}, _this.props, {
|
|
@@ -311,7 +323,8 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
311
323
|
}) : dataAttributes;
|
|
312
324
|
}, [applyDraftAnnotation, dataAttributes]);
|
|
313
325
|
return (0, _react2.jsx)(Media, (0, _extends2.default)({}, props, {
|
|
314
|
-
dataAttributes: dataAttributesWithDraftAnnotation
|
|
326
|
+
dataAttributes: dataAttributesWithDraftAnnotation,
|
|
327
|
+
isDrafting: shouldApplyDraftAnnotation
|
|
315
328
|
}));
|
|
316
329
|
};
|
|
317
330
|
var _default = exports.default = MediaWithDraftAnnotation;
|
|
@@ -114,8 +114,9 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
114
114
|
|
|
115
115
|
// TODO: put appearance-based padding into theme instead
|
|
116
116
|
|
|
117
|
-
var
|
|
117
|
+
var isFullPage = rendererAppearance === 'full-page';
|
|
118
118
|
var isFullWidth = rendererAppearance === 'full-width';
|
|
119
|
+
var padding = isFullPage ? _style.FullPagePadding * 2 : 0;
|
|
119
120
|
var calcDimensions = (0, _react.useCallback)(function (mediaContainerWidth) {
|
|
120
121
|
var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
121
122
|
var maxWidth = containerWidth;
|
|
@@ -152,6 +153,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
152
153
|
cancelTimeout = _useAnnotationHoverDi.cancelTimeout,
|
|
153
154
|
initiateTimeout = _useAnnotationHoverDi.initiateTimeout,
|
|
154
155
|
setIsWithinRange = _useAnnotationHoverDi.setIsWithinRange;
|
|
156
|
+
var isFullPageRenderer = isFullPage || isFullWidth;
|
|
155
157
|
(0, _react.useEffect)(function () {
|
|
156
158
|
var mediaSingleElement = ref.current;
|
|
157
159
|
var handleMouseEnter = function handleMouseEnter(event) {
|
|
@@ -164,17 +166,17 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
164
166
|
var handleMouseLeave = function handleMouseLeave() {
|
|
165
167
|
initiateTimeout();
|
|
166
168
|
};
|
|
167
|
-
if (mediaSingleElement) {
|
|
169
|
+
if (mediaSingleElement && isFullPageRenderer) {
|
|
168
170
|
mediaSingleElement.addEventListener('mouseenter', handleMouseEnter);
|
|
169
171
|
mediaSingleElement.addEventListener('mouseleave', handleMouseLeave);
|
|
170
172
|
}
|
|
171
173
|
return function () {
|
|
172
|
-
if (mediaSingleElement) {
|
|
174
|
+
if (mediaSingleElement && isFullPageRenderer) {
|
|
173
175
|
mediaSingleElement.removeEventListener('mouseenter', handleMouseEnter);
|
|
174
176
|
mediaSingleElement.removeEventListener('mouseleave', handleMouseLeave);
|
|
175
177
|
}
|
|
176
178
|
};
|
|
177
|
-
}, [setHoverTarget, cancelTimeout, initiateTimeout, setIsWithinRange]);
|
|
179
|
+
}, [setHoverTarget, isFullPageRenderer, cancelTimeout, initiateTimeout, setIsWithinRange]);
|
|
178
180
|
|
|
179
181
|
// Note: in SSR mode the `window` object is not defined,
|
|
180
182
|
// therefore width here is 0, see:
|
|
@@ -55,7 +55,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
55
55
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
56
56
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
57
57
|
var packageName = "@atlaskit/renderer";
|
|
58
|
-
var packageVersion = "109.19.
|
|
58
|
+
var packageVersion = "109.19.2";
|
|
59
59
|
var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
60
60
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
61
61
|
var _super = _createSuper(Renderer);
|
|
@@ -34,6 +34,11 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
|
|
|
34
34
|
return (0, _toConsumableArray2.default)(new Set([].concat((0, _toConsumableArray2.default)(annotationParentIds), [id])));
|
|
35
35
|
}, [id, annotationParentIds]);
|
|
36
36
|
var onMarkClick = (0, _react.useCallback)(function (event) {
|
|
37
|
+
// prevent inline mark logic for media block marks
|
|
38
|
+
if (event.currentTarget.getAttribute('data-block-mark')) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
// prevents multiple callback on overlapping annotations
|
|
38
43
|
if (event.defaultPrevented || state !== _adfSchema.AnnotationMarkStates.ACTIVE) {
|
|
39
44
|
return;
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
|
|
5
5
|
import React, { PureComponent, Fragment, useEffect, useState, useMemo } from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
6
|
+
import { jsx, css } from '@emotion/react';
|
|
7
7
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
8
8
|
import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
|
|
9
9
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -16,11 +16,28 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
|
|
|
16
16
|
import { MODE, PLATFORM } from '../../../analytics/events';
|
|
17
17
|
import AnnotationComponent from '../../marks/annotation';
|
|
18
18
|
import { AnnotationsDraftContext } from '../../../ui/annotations/context';
|
|
19
|
-
import { linkStyle, borderStyle } from './styles';
|
|
20
19
|
import { CommentBadge as CommentBadgeComponent } from '@atlaskit/editor-common/media-single';
|
|
21
20
|
import { injectIntl } from 'react-intl-next';
|
|
22
21
|
import { useInlineCommentSubscriberContext, useInlineCommentsFilter } from '../../../ui/annotations/hooks';
|
|
23
22
|
import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
23
|
+
export const linkStyle = css`
|
|
24
|
+
position: absolute;
|
|
25
|
+
background: transparent;
|
|
26
|
+
top: 0;
|
|
27
|
+
right: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
width: 100% !important;
|
|
32
|
+
height: 100% !important;
|
|
33
|
+
`;
|
|
34
|
+
export const borderStyle = (color, width) => css`
|
|
35
|
+
position: absolute;
|
|
36
|
+
width: 100% !important;
|
|
37
|
+
height: 100% !important;
|
|
38
|
+
border-radius: ${width}px;
|
|
39
|
+
box-shadow: 0 0 0 ${width}px ${color};
|
|
40
|
+
`;
|
|
24
41
|
const MediaBorder = ({
|
|
25
42
|
mark,
|
|
26
43
|
children
|
|
@@ -69,7 +86,8 @@ const MediaAnnotation = ({
|
|
|
69
86
|
id: mark.attrs.id,
|
|
70
87
|
annotationType: mark.attrs.annotationType,
|
|
71
88
|
dataAttributes: {
|
|
72
|
-
'data-renderer-mark': true
|
|
89
|
+
'data-renderer-mark': true,
|
|
90
|
+
'data-block-mark': true
|
|
73
91
|
}
|
|
74
92
|
// This should be fine being empty [] since the serializer serializeFragmentChild getMarkProps call always passes
|
|
75
93
|
,
|
|
@@ -101,6 +119,7 @@ const CommentBadge = injectIntl(CommentBadgeComponent);
|
|
|
101
119
|
const CommentBadgeWrapper = ({
|
|
102
120
|
marks,
|
|
103
121
|
mediaElement,
|
|
122
|
+
isDrafting = false,
|
|
104
123
|
...rest
|
|
105
124
|
}) => {
|
|
106
125
|
var _marks$map;
|
|
@@ -134,10 +153,11 @@ const CommentBadgeWrapper = ({
|
|
|
134
153
|
observer.disconnect();
|
|
135
154
|
};
|
|
136
155
|
}, [mediaElement, setStatus]);
|
|
137
|
-
if (!activeParentIds.length) {
|
|
156
|
+
if (!isDrafting && !activeParentIds.length) {
|
|
138
157
|
return null;
|
|
139
158
|
}
|
|
140
159
|
const onClick = e => {
|
|
160
|
+
e.preventDefault();
|
|
141
161
|
if (updateSubscriber) {
|
|
142
162
|
updateSubscriber.emit(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, {
|
|
143
163
|
annotationIds: activeParentIds,
|
|
@@ -168,7 +188,8 @@ class Media extends PureComponent {
|
|
|
168
188
|
ssr,
|
|
169
189
|
width,
|
|
170
190
|
height,
|
|
171
|
-
mediaSingleElement
|
|
191
|
+
mediaSingleElement,
|
|
192
|
+
isDrafting = false
|
|
172
193
|
} = this.props;
|
|
173
194
|
const annotationMarks = this.props.isAnnotationMark ? this.props.marks.filter(this.props.isAnnotationMark) : undefined;
|
|
174
195
|
const borderMark = this.props.marks.find(this.props.isBorderMark);
|
|
@@ -193,7 +214,8 @@ class Media extends PureComponent {
|
|
|
193
214
|
marks: annotationMarks,
|
|
194
215
|
mediaElement: mediaSingleElement,
|
|
195
216
|
width: width,
|
|
196
|
-
height: height
|
|
217
|
+
height: height,
|
|
218
|
+
isDrafting: isDrafting
|
|
197
219
|
}), jsx(MediaCard, _extends({
|
|
198
220
|
contextIdentifierProvider: contextIdentifierProvider
|
|
199
221
|
}, this.props, {
|
|
@@ -274,7 +296,8 @@ const MediaWithDraftAnnotation = props => {
|
|
|
274
296
|
'data-renderer-mark': true
|
|
275
297
|
} : dataAttributes, [applyDraftAnnotation, dataAttributes]);
|
|
276
298
|
return jsx(Media, _extends({}, props, {
|
|
277
|
-
dataAttributes: dataAttributesWithDraftAnnotation
|
|
299
|
+
dataAttributes: dataAttributesWithDraftAnnotation,
|
|
300
|
+
isDrafting: shouldApplyDraftAnnotation
|
|
278
301
|
}));
|
|
279
302
|
};
|
|
280
303
|
export default MediaWithDraftAnnotation;
|
|
@@ -101,8 +101,9 @@ const MediaSingleWithChildren = props => {
|
|
|
101
101
|
|
|
102
102
|
// TODO: put appearance-based padding into theme instead
|
|
103
103
|
|
|
104
|
-
const
|
|
104
|
+
const isFullPage = rendererAppearance === 'full-page';
|
|
105
105
|
const isFullWidth = rendererAppearance === 'full-width';
|
|
106
|
+
const padding = isFullPage ? FullPagePadding * 2 : 0;
|
|
106
107
|
const calcDimensions = useCallback(mediaContainerWidth => {
|
|
107
108
|
const containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
108
109
|
const maxWidth = containerWidth;
|
|
@@ -139,6 +140,7 @@ const MediaSingleWithChildren = props => {
|
|
|
139
140
|
initiateTimeout,
|
|
140
141
|
setIsWithinRange
|
|
141
142
|
} = useAnnotationHoverDispatch();
|
|
143
|
+
const isFullPageRenderer = isFullPage || isFullWidth;
|
|
142
144
|
useEffect(() => {
|
|
143
145
|
const mediaSingleElement = ref.current;
|
|
144
146
|
const handleMouseEnter = event => {
|
|
@@ -151,17 +153,17 @@ const MediaSingleWithChildren = props => {
|
|
|
151
153
|
const handleMouseLeave = () => {
|
|
152
154
|
initiateTimeout();
|
|
153
155
|
};
|
|
154
|
-
if (mediaSingleElement) {
|
|
156
|
+
if (mediaSingleElement && isFullPageRenderer) {
|
|
155
157
|
mediaSingleElement.addEventListener('mouseenter', handleMouseEnter);
|
|
156
158
|
mediaSingleElement.addEventListener('mouseleave', handleMouseLeave);
|
|
157
159
|
}
|
|
158
160
|
return () => {
|
|
159
|
-
if (mediaSingleElement) {
|
|
161
|
+
if (mediaSingleElement && isFullPageRenderer) {
|
|
160
162
|
mediaSingleElement.removeEventListener('mouseenter', handleMouseEnter);
|
|
161
163
|
mediaSingleElement.removeEventListener('mouseleave', handleMouseLeave);
|
|
162
164
|
}
|
|
163
165
|
};
|
|
164
|
-
}, [setHoverTarget, cancelTimeout, initiateTimeout, setIsWithinRange]);
|
|
166
|
+
}, [setHoverTarget, isFullPageRenderer, cancelTimeout, initiateTimeout, setIsWithinRange]);
|
|
165
167
|
|
|
166
168
|
// Note: in SSR mode the `window` object is not defined,
|
|
167
169
|
// therefore width here is 0, see:
|
|
@@ -36,7 +36,7 @@ import { EditorMediaClientProvider } from '../../react/utils/EditorMediaClientPr
|
|
|
36
36
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
37
37
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
38
38
|
const packageName = "@atlaskit/renderer";
|
|
39
|
-
const packageVersion = "109.19.
|
|
39
|
+
const packageVersion = "109.19.2";
|
|
40
40
|
export class Renderer extends PureComponent {
|
|
41
41
|
constructor(props) {
|
|
42
42
|
super(props);
|
|
@@ -33,6 +33,11 @@ export const MarkComponent = ({
|
|
|
33
33
|
}) => {
|
|
34
34
|
const annotationIds = useMemo(() => [...new Set([...annotationParentIds, id])], [id, annotationParentIds]);
|
|
35
35
|
const onMarkClick = useCallback(event => {
|
|
36
|
+
// prevent inline mark logic for media block marks
|
|
37
|
+
if (event.currentTarget.getAttribute('data-block-mark')) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
// prevents multiple callback on overlapping annotations
|
|
37
42
|
if (event.defaultPrevented || state !== AnnotationMarkStates.ACTIVE) {
|
|
38
43
|
return;
|
|
@@ -8,7 +8,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
8
8
|
import _extends from "@babel/runtime/helpers/extends";
|
|
9
9
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
10
10
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
11
|
-
|
|
11
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
12
|
+
var _excluded = ["marks", "mediaElement", "isDrafting"];
|
|
13
|
+
var _templateObject, _templateObject2;
|
|
12
14
|
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; }
|
|
13
15
|
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) { _defineProperty(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; }
|
|
14
16
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -16,7 +18,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
16
18
|
/** @jsx jsx */
|
|
17
19
|
|
|
18
20
|
import React, { PureComponent, Fragment, useEffect, useState, useMemo } from 'react';
|
|
19
|
-
import { jsx } from '@emotion/react';
|
|
21
|
+
import { jsx, css } from '@emotion/react';
|
|
20
22
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
21
23
|
import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
|
|
22
24
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -29,11 +31,14 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
|
|
|
29
31
|
import { MODE, PLATFORM } from '../../../analytics/events';
|
|
30
32
|
import AnnotationComponent from '../../marks/annotation';
|
|
31
33
|
import { AnnotationsDraftContext } from '../../../ui/annotations/context';
|
|
32
|
-
import { linkStyle, borderStyle } from './styles';
|
|
33
34
|
import { CommentBadge as CommentBadgeComponent } from '@atlaskit/editor-common/media-single';
|
|
34
35
|
import { injectIntl } from 'react-intl-next';
|
|
35
36
|
import { useInlineCommentSubscriberContext, useInlineCommentsFilter } from '../../../ui/annotations/hooks';
|
|
36
37
|
import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
|
|
38
|
+
export var linkStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n background: transparent;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n cursor: pointer;\n width: 100% !important;\n height: 100% !important;\n"])));
|
|
39
|
+
export var borderStyle = function borderStyle(color, width) {
|
|
40
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n width: 100% !important;\n height: 100% !important;\n border-radius: ", "px;\n box-shadow: 0 0 0 ", "px ", ";\n"])), width, width, color);
|
|
41
|
+
};
|
|
37
42
|
var MediaBorder = function MediaBorder(_ref) {
|
|
38
43
|
var _mark$attrs$color, _mark$attrs$size;
|
|
39
44
|
var mark = _ref.mark,
|
|
@@ -79,7 +84,8 @@ var MediaAnnotation = function MediaAnnotation(_ref3) {
|
|
|
79
84
|
id: mark.attrs.id,
|
|
80
85
|
annotationType: mark.attrs.annotationType,
|
|
81
86
|
dataAttributes: {
|
|
82
|
-
'data-renderer-mark': true
|
|
87
|
+
'data-renderer-mark': true,
|
|
88
|
+
'data-block-mark': true
|
|
83
89
|
}
|
|
84
90
|
// This should be fine being empty [] since the serializer serializeFragmentChild getMarkProps call always passes
|
|
85
91
|
,
|
|
@@ -112,6 +118,8 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
112
118
|
var _marks$map;
|
|
113
119
|
var marks = _ref5.marks,
|
|
114
120
|
mediaElement = _ref5.mediaElement,
|
|
121
|
+
_ref5$isDrafting = _ref5.isDrafting,
|
|
122
|
+
isDrafting = _ref5$isDrafting === void 0 ? false : _ref5$isDrafting,
|
|
115
123
|
rest = _objectWithoutProperties(_ref5, _excluded);
|
|
116
124
|
var _useState = useState('default'),
|
|
117
125
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -151,10 +159,11 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
|
|
|
151
159
|
observer.disconnect();
|
|
152
160
|
};
|
|
153
161
|
}, [mediaElement, setStatus]);
|
|
154
|
-
if (!activeParentIds.length) {
|
|
162
|
+
if (!isDrafting && !activeParentIds.length) {
|
|
155
163
|
return null;
|
|
156
164
|
}
|
|
157
165
|
var onClick = function onClick(e) {
|
|
166
|
+
e.preventDefault();
|
|
158
167
|
if (updateSubscriber) {
|
|
159
168
|
updateSubscriber.emit(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, {
|
|
160
169
|
annotationIds: activeParentIds,
|
|
@@ -192,7 +201,9 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
192
201
|
ssr = _this$props.ssr,
|
|
193
202
|
width = _this$props.width,
|
|
194
203
|
height = _this$props.height,
|
|
195
|
-
mediaSingleElement = _this$props.mediaSingleElement
|
|
204
|
+
mediaSingleElement = _this$props.mediaSingleElement,
|
|
205
|
+
_this$props$isDraftin = _this$props.isDrafting,
|
|
206
|
+
isDrafting = _this$props$isDraftin === void 0 ? false : _this$props$isDraftin;
|
|
196
207
|
var annotationMarks = _this.props.isAnnotationMark ? _this.props.marks.filter(_this.props.isAnnotationMark) : undefined;
|
|
197
208
|
var borderMark = _this.props.marks.find(_this.props.isBorderMark);
|
|
198
209
|
var linkMark = _this.props.marks.find(_this.props.isLinkMark);
|
|
@@ -214,7 +225,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
214
225
|
marks: annotationMarks,
|
|
215
226
|
mediaElement: mediaSingleElement,
|
|
216
227
|
width: width,
|
|
217
|
-
height: height
|
|
228
|
+
height: height,
|
|
229
|
+
isDrafting: isDrafting
|
|
218
230
|
}), jsx(MediaCard, _extends({
|
|
219
231
|
contextIdentifierProvider: contextIdentifierProvider
|
|
220
232
|
}, _this.props, {
|
|
@@ -302,7 +314,8 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
302
314
|
}) : dataAttributes;
|
|
303
315
|
}, [applyDraftAnnotation, dataAttributes]);
|
|
304
316
|
return jsx(Media, _extends({}, props, {
|
|
305
|
-
dataAttributes: dataAttributesWithDraftAnnotation
|
|
317
|
+
dataAttributes: dataAttributesWithDraftAnnotation,
|
|
318
|
+
isDrafting: shouldApplyDraftAnnotation
|
|
306
319
|
}));
|
|
307
320
|
};
|
|
308
321
|
export default MediaWithDraftAnnotation;
|
|
@@ -104,8 +104,9 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
104
104
|
|
|
105
105
|
// TODO: put appearance-based padding into theme instead
|
|
106
106
|
|
|
107
|
-
var
|
|
107
|
+
var isFullPage = rendererAppearance === 'full-page';
|
|
108
108
|
var isFullWidth = rendererAppearance === 'full-width';
|
|
109
|
+
var padding = isFullPage ? FullPagePadding * 2 : 0;
|
|
109
110
|
var calcDimensions = useCallback(function (mediaContainerWidth) {
|
|
110
111
|
var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
111
112
|
var maxWidth = containerWidth;
|
|
@@ -142,6 +143,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
142
143
|
cancelTimeout = _useAnnotationHoverDi.cancelTimeout,
|
|
143
144
|
initiateTimeout = _useAnnotationHoverDi.initiateTimeout,
|
|
144
145
|
setIsWithinRange = _useAnnotationHoverDi.setIsWithinRange;
|
|
146
|
+
var isFullPageRenderer = isFullPage || isFullWidth;
|
|
145
147
|
useEffect(function () {
|
|
146
148
|
var mediaSingleElement = ref.current;
|
|
147
149
|
var handleMouseEnter = function handleMouseEnter(event) {
|
|
@@ -154,17 +156,17 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
154
156
|
var handleMouseLeave = function handleMouseLeave() {
|
|
155
157
|
initiateTimeout();
|
|
156
158
|
};
|
|
157
|
-
if (mediaSingleElement) {
|
|
159
|
+
if (mediaSingleElement && isFullPageRenderer) {
|
|
158
160
|
mediaSingleElement.addEventListener('mouseenter', handleMouseEnter);
|
|
159
161
|
mediaSingleElement.addEventListener('mouseleave', handleMouseLeave);
|
|
160
162
|
}
|
|
161
163
|
return function () {
|
|
162
|
-
if (mediaSingleElement) {
|
|
164
|
+
if (mediaSingleElement && isFullPageRenderer) {
|
|
163
165
|
mediaSingleElement.removeEventListener('mouseenter', handleMouseEnter);
|
|
164
166
|
mediaSingleElement.removeEventListener('mouseleave', handleMouseLeave);
|
|
165
167
|
}
|
|
166
168
|
};
|
|
167
|
-
}, [setHoverTarget, cancelTimeout, initiateTimeout, setIsWithinRange]);
|
|
169
|
+
}, [setHoverTarget, isFullPageRenderer, cancelTimeout, initiateTimeout, setIsWithinRange]);
|
|
168
170
|
|
|
169
171
|
// Note: in SSR mode the `window` object is not defined,
|
|
170
172
|
// therefore width here is 0, see:
|
|
@@ -46,7 +46,7 @@ import { EditorMediaClientProvider } from '../../react/utils/EditorMediaClientPr
|
|
|
46
46
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
47
47
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
48
48
|
var packageName = "@atlaskit/renderer";
|
|
49
|
-
var packageVersion = "109.19.
|
|
49
|
+
var packageVersion = "109.19.2";
|
|
50
50
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
51
51
|
_inherits(Renderer, _PureComponent);
|
|
52
52
|
var _super = _createSuper(Renderer);
|
|
@@ -29,6 +29,11 @@ export var MarkComponent = function MarkComponent(_ref) {
|
|
|
29
29
|
return _toConsumableArray(new Set([].concat(_toConsumableArray(annotationParentIds), [id])));
|
|
30
30
|
}, [id, annotationParentIds]);
|
|
31
31
|
var onMarkClick = useCallback(function (event) {
|
|
32
|
+
// prevent inline mark logic for media block marks
|
|
33
|
+
if (event.currentTarget.getAttribute('data-block-mark')) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
// prevents multiple callback on overlapping annotations
|
|
33
38
|
if (event.defaultPrevented || state !== AnnotationMarkStates.ACTIVE) {
|
|
34
39
|
return;
|
|
@@ -25,6 +25,9 @@ export type MediaProps = MediaCardProps & {
|
|
|
25
25
|
mediaSingleElement?: HTMLElement | null;
|
|
26
26
|
width?: number;
|
|
27
27
|
height?: number;
|
|
28
|
+
isDrafting: boolean;
|
|
28
29
|
};
|
|
30
|
+
export declare const linkStyle: import("@emotion/react").SerializedStyles;
|
|
31
|
+
export declare const borderStyle: (color: string, width: number) => import("@emotion/react").SerializedStyles;
|
|
29
32
|
declare const MediaWithDraftAnnotation: (props: PropsWithChildren<MediaProps>) => jsx.JSX.Element;
|
|
30
33
|
export default MediaWithDraftAnnotation;
|
|
@@ -25,6 +25,9 @@ export type MediaProps = MediaCardProps & {
|
|
|
25
25
|
mediaSingleElement?: HTMLElement | null;
|
|
26
26
|
width?: number;
|
|
27
27
|
height?: number;
|
|
28
|
+
isDrafting: boolean;
|
|
28
29
|
};
|
|
30
|
+
export declare const linkStyle: import("@emotion/react").SerializedStyles;
|
|
31
|
+
export declare const borderStyle: (color: string, width: number) => import("@emotion/react").SerializedStyles;
|
|
29
32
|
declare const MediaWithDraftAnnotation: (props: PropsWithChildren<MediaProps>) => jsx.JSX.Element;
|
|
30
33
|
export default MediaWithDraftAnnotation;
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.linkStyle = exports.borderStyle = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
-
var _react = require("@emotion/react");
|
|
10
|
-
var _templateObject, _templateObject2;
|
|
11
|
-
var linkStyle = exports.linkStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n background: transparent;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n cursor: pointer;\n width: 100% !important;\n height: 100% !important;\n"])));
|
|
12
|
-
var borderStyle = exports.borderStyle = function borderStyle(color, width) {
|
|
13
|
-
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n width: 100% !important;\n height: 100% !important;\n border-radius: ", "px;\n box-shadow: 0 0 0 ", "px ", ";\n"])), width, width, color);
|
|
14
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { css } from '@emotion/react';
|
|
2
|
-
export const linkStyle = css`
|
|
3
|
-
position: absolute;
|
|
4
|
-
background: transparent;
|
|
5
|
-
top: 0;
|
|
6
|
-
right: 0;
|
|
7
|
-
bottom: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
width: 100% !important;
|
|
11
|
-
height: 100% !important;
|
|
12
|
-
`;
|
|
13
|
-
export const borderStyle = (color, width) => css`
|
|
14
|
-
position: absolute;
|
|
15
|
-
width: 100% !important;
|
|
16
|
-
height: 100% !important;
|
|
17
|
-
border-radius: ${width}px;
|
|
18
|
-
box-shadow: 0 0 0 ${width}px ${color};
|
|
19
|
-
`;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
export var linkStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n background: transparent;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n cursor: pointer;\n width: 100% !important;\n height: 100% !important;\n"])));
|
|
5
|
-
export var borderStyle = function borderStyle(color, width) {
|
|
6
|
-
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n width: 100% !important;\n height: 100% !important;\n border-radius: ", "px;\n box-shadow: 0 0 0 ", "px ", ";\n"])), width, width, color);
|
|
7
|
-
};
|