@atlaskit/renderer 109.10.4 → 109.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/react/index.js +6 -1
  3. package/dist/cjs/react/marks/annotation.js +4 -2
  4. package/dist/cjs/react/nodes/media/index.js +68 -26
  5. package/dist/cjs/ui/Renderer/index.js +1 -1
  6. package/dist/cjs/ui/annotations/element/index.js +4 -2
  7. package/dist/cjs/ui/annotations/element/mark.js +16 -18
  8. package/dist/es2019/react/index.js +4 -1
  9. package/dist/es2019/react/marks/annotation.js +4 -2
  10. package/dist/es2019/react/nodes/media/index.js +72 -24
  11. package/dist/es2019/ui/Renderer/index.js +1 -1
  12. package/dist/es2019/ui/annotations/element/index.js +4 -2
  13. package/dist/es2019/ui/annotations/element/mark.js +16 -18
  14. package/dist/esm/react/index.js +6 -1
  15. package/dist/esm/react/marks/annotation.js +4 -2
  16. package/dist/esm/react/nodes/media/index.js +69 -27
  17. package/dist/esm/ui/Renderer/index.js +1 -1
  18. package/dist/esm/ui/annotations/element/index.js +4 -2
  19. package/dist/esm/ui/annotations/element/mark.js +16 -15
  20. package/dist/types/react/marks/annotation.d.ts +3 -3
  21. package/dist/types/react/nodes/media/index.d.ts +5 -2
  22. package/dist/types/react/types.d.ts +1 -0
  23. package/dist/types/ui/annotations/element/index.d.ts +2 -1
  24. package/dist/types/ui/annotations/element/mark.d.ts +41 -3
  25. package/dist/types-ts4.5/react/marks/annotation.d.ts +3 -3
  26. package/dist/types-ts4.5/react/nodes/media/index.d.ts +5 -2
  27. package/dist/types-ts4.5/react/types.d.ts +1 -0
  28. package/dist/types-ts4.5/ui/annotations/element/index.d.ts +2 -1
  29. package/dist/types-ts4.5/ui/annotations/element/mark.d.ts +41 -3
  30. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 109.10.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#84179](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/84179) [`8bd86714a915`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8bd86714a915) - Fixed annotation highlight support for media elements by allow mark to be changed to a block level element
8
+
9
+ ## 109.10.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [#82755](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/82755) [`c204f74b46a5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c204f74b46a5) - The media renderer node will now correctly render annotation marks if/when they're applied to the node.
14
+ - Updated dependencies
15
+
3
16
  ## 109.10.4
4
17
 
5
18
  ### Patch Changes
@@ -85,7 +85,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
85
85
  var shouldSkipLinkMark = function shouldSkipLinkMark(mark) {
86
86
  return _this.allowMediaLinking !== true && isMedia && mark.type.name === 'link';
87
87
  };
88
- return marks.reverse().reduce(function (content, mark) {
88
+ return marks.reduceRight(function (content, mark) {
89
89
  if (shouldSkipLinkMark(mark) || shouldSkipBorderMark(mark)) {
90
90
  return content;
91
91
  }
@@ -389,12 +389,16 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
389
389
  _this$media;
390
390
  var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
391
391
  var _node$type$schema$mar = node.type.schema.marks,
392
+ annotation = _node$type$schema$mar.annotation,
392
393
  link = _node$type$schema$mar.link,
393
394
  border = _node$type$schema$mar.border;
394
395
  var isChildOfMediaSingle = path.some(function (n) {
395
396
  var _n$type2;
396
397
  return ((_n$type2 = n.type) === null || _n$type2 === void 0 ? void 0 : _n$type2.name) === 'mediaSingle';
397
398
  });
399
+ var isAnnotationMark = function isAnnotationMark(mark) {
400
+ return mark.type === annotation;
401
+ };
398
402
  var isLinkMark = function isLinkMark(mark) {
399
403
  return mark.type === link;
400
404
  };
@@ -407,6 +411,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
407
411
  }),
408
412
  isLinkMark: isLinkMark,
409
413
  isBorderMark: isBorderMark,
414
+ isAnnotationMark: isAnnotationMark,
410
415
  allowAltTextOnImages: this.allowAltTextOnImages,
411
416
  featureFlags: this.media && this.media.featureFlags,
412
417
  shouldOpenMediaViewer: this.shouldOpenMediaViewer,
@@ -22,7 +22,8 @@ var AnnotationComponent = function AnnotationComponent(_ref) {
22
22
  dataAttributes = _ref.dataAttributes,
23
23
  _ref$annotationParent = _ref.annotationParentIds,
24
24
  annotationParentIds = _ref$annotationParent === void 0 ? [] : _ref$annotationParent,
25
- allowAnnotations = _ref.allowAnnotations;
25
+ allowAnnotations = _ref.allowAnnotations,
26
+ useBlockLevel = _ref.useBlockLevel;
26
27
  var data = _objectSpread(_objectSpread({}, dataAttributes), (0, _adfSchema.buildAnnotationMarkDataAttributes)({
27
28
  id: id,
28
29
  annotationType: annotationType
@@ -32,7 +33,8 @@ var AnnotationComponent = function AnnotationComponent(_ref) {
32
33
  id: id,
33
34
  dataAttributes: data,
34
35
  annotationParentIds: annotationParentIds,
35
- annotationType: annotationType
36
+ annotationType: annotationType,
37
+ useBlockLevel: useBlockLevel
36
38
  }, children);
37
39
  }
38
40
  return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({
@@ -25,23 +25,74 @@ var _editorPalette = require("@atlaskit/editor-palette");
25
25
  var _utils = require("../../../utils");
26
26
  var _analytics = require("@atlaskit/editor-common/analytics");
27
27
  var _events = require("../../../analytics/events");
28
+ var _annotation = _interopRequireDefault(require("../../marks/annotation"));
28
29
  var _styles = require("./styles");
29
30
  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); }
30
31
  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; }
31
32
  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); }; }
32
33
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
34
+ var MediaBorder = function MediaBorder(_ref) {
35
+ var _mark$attrs$color, _mark$attrs$size;
36
+ var mark = _ref.mark,
37
+ children = _ref.children;
38
+ if (!mark) {
39
+ return (0, _react2.jsx)(_react.Fragment, null, children);
40
+ }
41
+ var borderColor = (_mark$attrs$color = mark === null || mark === void 0 ? void 0 : mark.attrs.color) !== null && _mark$attrs$color !== void 0 ? _mark$attrs$color : '';
42
+ var borderWidth = (_mark$attrs$size = mark === null || mark === void 0 ? void 0 : mark.attrs.size) !== null && _mark$attrs$size !== void 0 ? _mark$attrs$size : 0;
43
+ var paletteColorValue = (0, _editorPalette.hexToEditorBorderPaletteColor)(borderColor) || borderColor;
44
+ return (0, _react2.jsx)("div", {
45
+ "data-mark-type": "border",
46
+ "data-color": borderColor,
47
+ "data-size": borderWidth,
48
+ css: (0, _styles.borderStyle)(paletteColorValue, borderWidth)
49
+ }, (0, _react2.jsx)(_ui.MediaBorderGapFiller, {
50
+ borderColor: borderColor
51
+ }), children);
52
+ };
53
+ var MediaLink = function MediaLink(_ref2) {
54
+ var mark = _ref2.mark,
55
+ children = _ref2.children,
56
+ onClick = _ref2.onClick;
57
+ if (!mark) {
58
+ return (0, _react2.jsx)(_react.Fragment, null, children);
59
+ }
60
+ var linkHref = mark === null || mark === void 0 ? void 0 : mark.attrs.href;
61
+ return (0, _react2.jsx)("a", {
62
+ href: linkHref,
63
+ rel: "noreferrer noopener",
64
+ onClick: onClick,
65
+ "data-block-link": linkHref,
66
+ css: _styles.linkStyle
67
+ }, children);
68
+ };
69
+ var MediaAnnotation = function MediaAnnotation(_ref3) {
70
+ var mark = _ref3.mark,
71
+ children = _ref3.children;
72
+ if (!mark) {
73
+ return (0, _react2.jsx)(_react.Fragment, null, children);
74
+ }
75
+ return (0, _react2.jsx)(_annotation.default, {
76
+ id: mark.attrs.id,
77
+ annotationType: mark.attrs.annotationType,
78
+ dataAttributes: {
79
+ 'data-renderer-mark': true
80
+ }
81
+ // This should be fine being empty [] since the serializer serializeFragmentChild getMarkProps call always passes
82
+ ,
83
+ annotationParentIds: [],
84
+ allowAnnotations: true,
85
+ useBlockLevel: true
86
+ }, children);
87
+ };
33
88
  var Media = exports.default = /*#__PURE__*/function (_PureComponent) {
34
89
  (0, _inherits2.default)(Media, _PureComponent);
35
90
  var _super = _createSuper(Media);
36
- function Media() {
91
+ function Media(props) {
37
92
  var _this;
38
93
  (0, _classCallCheck2.default)(this, Media);
39
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
40
- args[_key] = arguments[_key];
41
- }
42
- _this = _super.call.apply(_super, [this].concat(args));
94
+ _this = _super.call(this, props);
43
95
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderCard", function () {
44
- var _borderMark$attrs$col, _borderMark$attrs$siz;
45
96
  var providers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
46
97
  var contextIdentifierProvider = providers.contextIdentifierProvider;
47
98
  var _this$props = _this.props,
@@ -51,14 +102,20 @@ var Media = exports.default = /*#__PURE__*/function (_PureComponent) {
51
102
  allowMediaViewer = _this$props.shouldOpenMediaViewer,
52
103
  enableDownloadButton = _this$props.enableDownloadButton,
53
104
  ssr = _this$props.ssr;
105
+ var annotationMark = _this.props.isAnnotationMark ? _this.props.marks.find(_this.props.isAnnotationMark) : undefined;
54
106
  var borderMark = _this.props.marks.find(_this.props.isBorderMark);
55
- var borderColor = (_borderMark$attrs$col = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color) !== null && _borderMark$attrs$col !== void 0 ? _borderMark$attrs$col : '';
56
- var borderWidth = (_borderMark$attrs$siz = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size) !== null && _borderMark$attrs$siz !== void 0 ? _borderMark$attrs$siz : 0;
57
107
  var linkMark = _this.props.marks.find(_this.props.isLinkMark);
58
108
  var linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
59
109
  var eventHandlers = linkHref ? undefined : _this.props.eventHandlers;
60
110
  var shouldOpenMediaViewer = !linkHref && allowMediaViewer;
61
- var mediaComponent = (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
111
+ return (0, _react2.jsx)(MediaLink, {
112
+ mark: linkMark,
113
+ onClick: _this.handleMediaLinkClickFn
114
+ }, (0, _react2.jsx)(MediaAnnotation, {
115
+ mark: annotationMark
116
+ }, (0, _react2.jsx)(MediaBorder, {
117
+ mark: borderMark
118
+ }, (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
62
119
  data: (0, _defineProperty2.default)({}, _analyticsNamespacedContext.MEDIA_CONTEXT, {
63
120
  border: !!borderMark
64
121
  })
@@ -71,23 +128,7 @@ var Media = exports.default = /*#__PURE__*/function (_PureComponent) {
71
128
  featureFlags: featureFlags,
72
129
  shouldEnableDownloadButton: enableDownloadButton,
73
130
  ssr: ssr
74
- })));
75
- var paletteColorValue = (0, _editorPalette.hexToEditorBorderPaletteColor)(borderColor) || borderColor;
76
- var mediaComponentWithBorder = borderMark ? (0, _react2.jsx)("div", {
77
- "data-mark-type": "border",
78
- "data-color": borderColor,
79
- "data-size": borderWidth,
80
- css: (0, _styles.borderStyle)(paletteColorValue, borderWidth)
81
- }, (0, _react2.jsx)(_ui.MediaBorderGapFiller, {
82
- borderColor: borderColor
83
- }), mediaComponent) : mediaComponent;
84
- return linkHref ? (0, _react2.jsx)("a", {
85
- href: linkHref,
86
- rel: "noreferrer noopener",
87
- onClick: _this.handleMediaLinkClick,
88
- "data-block-link": linkHref,
89
- css: _styles.linkStyle
90
- }, mediaComponentWithBorder) : mediaComponentWithBorder;
131
+ }))))));
91
132
  });
92
133
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMediaLinkClick", function (event) {
93
134
  var _this$props2 = _this.props,
@@ -114,6 +155,7 @@ var Media = exports.default = /*#__PURE__*/function (_PureComponent) {
114
155
  handler(event, _linkMark && linkHref);
115
156
  }
116
157
  });
158
+ _this.handleMediaLinkClickFn = _this.handleMediaLinkClick.bind((0, _assertThisInitialized2.default)(_this));
117
159
  return _this;
118
160
  }
119
161
  (0, _createClass2.default)(Media, [{
@@ -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.10.4";
58
+ var packageVersion = "109.10.6";
59
59
  var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
60
60
  (0, _inherits2.default)(Renderer, _PureComponent);
61
61
  var _super = _createSuper(Renderer);
@@ -17,7 +17,8 @@ var MarkElement = exports.MarkElement = function MarkElement(_ref) {
17
17
  var annotationParentIds = _ref.annotationParentIds,
18
18
  children = _ref.children,
19
19
  dataAttributes = _ref.dataAttributes,
20
- id = _ref.id;
20
+ id = _ref.id,
21
+ useBlockLevel = _ref.useBlockLevel;
21
22
  var updateSubscriber = (0, _hooks.useInlineCommentSubscriberContext)();
22
23
  var states = (0, _react.useContext)(_context.InlineCommentsStateContext);
23
24
  var hasFocus = (0, _hooks.useHasFocusEvent)({
@@ -50,6 +51,7 @@ var MarkElement = exports.MarkElement = function MarkElement(_ref) {
50
51
  annotationParentIds: activeParentIds,
51
52
  onClick: onClick,
52
53
  hasFocus: hasFocus,
53
- state: states[id]
54
+ state: states[id],
55
+ useBlockLevel: useBlockLevel
54
56
  }, children);
55
57
  };
@@ -1,29 +1,32 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.MarkComponent = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
- var _react = _interopRequireWildcard(require("react"));
11
+ var _react = require("react");
14
12
  var _react2 = require("@emotion/react");
15
13
  var _styles = require("@atlaskit/editor-common/styles");
16
14
  var _adfSchema = require("@atlaskit/adf-schema");
17
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
16
  var _templateObject;
19
17
  /** @jsx jsx */
20
- 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); }
21
- 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; }
22
18
  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; }
23
19
  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; }
24
20
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- `AnnotationSharedCSSByState` is not object-safe
25
21
  var markStyles = function markStyles() {
26
- return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color: transparent;\n\n &[data-mark-annotation-state='", "'] {\n ", ";\n\n &:focus,\n &[data-has-focus='true'] {\n ", ";\n }\n\n & div.rich-media-item {\n ", ";\n }\n }\n"])), _adfSchema.AnnotationMarkStates.ACTIVE, (0, _styles.AnnotationSharedCSSByState)().blur, (0, _styles.AnnotationSharedCSSByState)().focus, _styles.mediaAnnotationStyles);
22
+ return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color: transparent;\n\n &[data-mark-annotation-state='", "'] {\n ", ";\n\n &:focus,\n &[data-has-focus='true'] {\n ", ";\n }\n }\n"])), _adfSchema.AnnotationMarkStates.ACTIVE, (0, _styles.AnnotationSharedCSSByState)().blur, (0, _styles.AnnotationSharedCSSByState)().focus);
23
+ };
24
+ var blockStyles = function blockStyles() {
25
+ return (0, _react2.css)((0, _defineProperty2.default)({
26
+ color: 'inherit',
27
+ backgroundColor: 'unset',
28
+ WebkitTapHighlightColor: 'transparent'
29
+ }, "&[data-mark-annotation-state='".concat(_adfSchema.AnnotationMarkStates.ACTIVE, "']"), _styles.mediaAnnotationStyles));
27
30
  };
28
31
  var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
29
32
  var annotationParentIds = _ref.annotationParentIds,
@@ -32,7 +35,8 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
32
35
  id = _ref.id,
33
36
  state = _ref.state,
34
37
  hasFocus = _ref.hasFocus,
35
- onClick = _ref.onClick;
38
+ onClick = _ref.onClick,
39
+ useBlockLevel = _ref.useBlockLevel;
36
40
  var annotationIds = (0, _react.useMemo)(function () {
37
41
  return (0, _toConsumableArray2.default)(new Set([].concat((0, _toConsumableArray2.default)(annotationParentIds), [id])));
38
42
  }, [id, annotationParentIds]);
@@ -61,15 +65,9 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
61
65
  } : {
62
66
  'aria-details': annotationIds.join(', ')
63
67
  };
64
- return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes') ? (0, _react2.jsx)("mark", (0, _extends2.default)({
65
- id: id,
66
- onClickCapture: onMarkClick
67
- }, accessibility, overriddenData, {
68
- css: markStyles
69
- }), children) : (0, _react2.jsx)("mark", (0, _extends2.default)({
70
- id: id,
71
- onClick: onMarkClick
72
- }, accessibility, overriddenData, {
73
- css: markStyles
68
+ return (0, _react2.jsx)(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)({
69
+ id: id
70
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), {}, {
71
+ css: useBlockLevel ? blockStyles : markStyles
74
72
  }), children);
75
73
  };
@@ -66,7 +66,7 @@ export default class ReactSerializer {
66
66
  return ((_n$type = n.type) === null || _n$type === void 0 ? void 0 : _n$type.name) !== 'mediaSingle';
67
67
  }) && isMedia && mark.type.name === 'border';
68
68
  const shouldSkipLinkMark = mark => this.allowMediaLinking !== true && isMedia && mark.type.name === 'link';
69
- return marks.reverse().reduce((content, mark) => {
69
+ return marks.reduceRight((content, mark) => {
70
70
  if (shouldSkipLinkMark(mark) || shouldSkipBorderMark(mark)) {
71
71
  return content;
72
72
  }
@@ -342,6 +342,7 @@ export default class ReactSerializer {
342
342
  var _this$media;
343
343
  const {
344
344
  marks: {
345
+ annotation,
345
346
  link,
346
347
  border
347
348
  }
@@ -350,6 +351,7 @@ export default class ReactSerializer {
350
351
  var _n$type2;
351
352
  return ((_n$type2 = n.type) === null || _n$type2 === void 0 ? void 0 : _n$type2.name) === 'mediaSingle';
352
353
  });
354
+ const isAnnotationMark = mark => mark.type === annotation;
353
355
  const isLinkMark = mark => mark.type === link;
354
356
  const isBorderMark = mark => isChildOfMediaSingle && mark.type === border;
355
357
  return {
@@ -357,6 +359,7 @@ export default class ReactSerializer {
357
359
  marks: node.marks.filter(m => !isLinkMark(m) || this.allowMediaLinking === true),
358
360
  isLinkMark,
359
361
  isBorderMark,
362
+ isAnnotationMark,
360
363
  allowAltTextOnImages: this.allowAltTextOnImages,
361
364
  featureFlags: this.media && this.media.featureFlags,
362
365
  shouldOpenMediaViewer: this.shouldOpenMediaViewer,
@@ -11,7 +11,8 @@ const AnnotationComponent = ({
11
11
  children,
12
12
  dataAttributes,
13
13
  annotationParentIds = [],
14
- allowAnnotations
14
+ allowAnnotations,
15
+ useBlockLevel
15
16
  }) => {
16
17
  const data = {
17
18
  ...dataAttributes,
@@ -25,7 +26,8 @@ const AnnotationComponent = ({
25
26
  id: id,
26
27
  dataAttributes: data,
27
28
  annotationParentIds: annotationParentIds,
28
- annotationType: annotationType
29
+ annotationType: annotationType,
30
+ useBlockLevel: useBlockLevel
29
31
  }, children);
30
32
  }
31
33
  return /*#__PURE__*/React.createElement("span", _extends({
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  /** @jsx jsx */
4
4
 
5
- import React, { PureComponent } from 'react';
5
+ import React, { PureComponent, Fragment } from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import { AnalyticsContext } from '@atlaskit/analytics-next';
8
8
  import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
@@ -13,12 +13,69 @@ import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
13
13
  import { getEventHandler } from '../../../utils';
14
14
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
15
15
  import { MODE, PLATFORM } from '../../../analytics/events';
16
+ import AnnotationComponent from '../../marks/annotation';
16
17
  import { linkStyle, borderStyle } from './styles';
18
+ const MediaBorder = ({
19
+ mark,
20
+ children
21
+ }) => {
22
+ var _mark$attrs$color, _mark$attrs$size;
23
+ if (!mark) {
24
+ return jsx(Fragment, null, children);
25
+ }
26
+ const borderColor = (_mark$attrs$color = mark === null || mark === void 0 ? void 0 : mark.attrs.color) !== null && _mark$attrs$color !== void 0 ? _mark$attrs$color : '';
27
+ const borderWidth = (_mark$attrs$size = mark === null || mark === void 0 ? void 0 : mark.attrs.size) !== null && _mark$attrs$size !== void 0 ? _mark$attrs$size : 0;
28
+ const paletteColorValue = hexToEditorBorderPaletteColor(borderColor) || borderColor;
29
+ return jsx("div", {
30
+ "data-mark-type": "border",
31
+ "data-color": borderColor,
32
+ "data-size": borderWidth,
33
+ css: borderStyle(paletteColorValue, borderWidth)
34
+ }, jsx(MediaBorderGapFiller, {
35
+ borderColor: borderColor
36
+ }), children);
37
+ };
38
+ const MediaLink = ({
39
+ mark,
40
+ children,
41
+ onClick
42
+ }) => {
43
+ if (!mark) {
44
+ return jsx(Fragment, null, children);
45
+ }
46
+ const linkHref = mark === null || mark === void 0 ? void 0 : mark.attrs.href;
47
+ return jsx("a", {
48
+ href: linkHref,
49
+ rel: "noreferrer noopener",
50
+ onClick: onClick,
51
+ "data-block-link": linkHref,
52
+ css: linkStyle
53
+ }, children);
54
+ };
55
+ const MediaAnnotation = ({
56
+ mark,
57
+ children
58
+ }) => {
59
+ if (!mark) {
60
+ return jsx(Fragment, null, children);
61
+ }
62
+ return jsx(AnnotationComponent, {
63
+ id: mark.attrs.id,
64
+ annotationType: mark.attrs.annotationType,
65
+ dataAttributes: {
66
+ 'data-renderer-mark': true
67
+ }
68
+ // This should be fine being empty [] since the serializer serializeFragmentChild getMarkProps call always passes
69
+ ,
70
+ annotationParentIds: [],
71
+ allowAnnotations: true,
72
+ useBlockLevel: true
73
+ }, children);
74
+ };
17
75
  export default class Media extends PureComponent {
18
- constructor(...args) {
19
- super(...args);
76
+ constructor(props) {
77
+ super(props);
20
78
  _defineProperty(this, "renderCard", (providers = {}) => {
21
- var _borderMark$attrs$col, _borderMark$attrs$siz;
22
79
  const {
23
80
  contextIdentifierProvider
24
81
  } = providers;
@@ -30,14 +87,20 @@ export default class Media extends PureComponent {
30
87
  enableDownloadButton,
31
88
  ssr
32
89
  } = this.props;
90
+ const annotationMark = this.props.isAnnotationMark ? this.props.marks.find(this.props.isAnnotationMark) : undefined;
33
91
  const borderMark = this.props.marks.find(this.props.isBorderMark);
34
- const borderColor = (_borderMark$attrs$col = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color) !== null && _borderMark$attrs$col !== void 0 ? _borderMark$attrs$col : '';
35
- const borderWidth = (_borderMark$attrs$siz = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size) !== null && _borderMark$attrs$siz !== void 0 ? _borderMark$attrs$siz : 0;
36
92
  const linkMark = this.props.marks.find(this.props.isLinkMark);
37
93
  const linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
38
94
  const eventHandlers = linkHref ? undefined : this.props.eventHandlers;
39
95
  const shouldOpenMediaViewer = !linkHref && allowMediaViewer;
40
- const mediaComponent = jsx(AnalyticsContext, {
96
+ return jsx(MediaLink, {
97
+ mark: linkMark,
98
+ onClick: this.handleMediaLinkClickFn
99
+ }, jsx(MediaAnnotation, {
100
+ mark: annotationMark
101
+ }, jsx(MediaBorder, {
102
+ mark: borderMark
103
+ }, jsx(AnalyticsContext, {
41
104
  data: {
42
105
  [MEDIA_CONTEXT]: {
43
106
  border: !!borderMark
@@ -52,23 +115,7 @@ export default class Media extends PureComponent {
52
115
  featureFlags: featureFlags,
53
116
  shouldEnableDownloadButton: enableDownloadButton,
54
117
  ssr: ssr
55
- })));
56
- const paletteColorValue = hexToEditorBorderPaletteColor(borderColor) || borderColor;
57
- const mediaComponentWithBorder = borderMark ? jsx("div", {
58
- "data-mark-type": "border",
59
- "data-color": borderColor,
60
- "data-size": borderWidth,
61
- css: borderStyle(paletteColorValue, borderWidth)
62
- }, jsx(MediaBorderGapFiller, {
63
- borderColor: borderColor
64
- }), mediaComponent) : mediaComponent;
65
- return linkHref ? jsx("a", {
66
- href: linkHref,
67
- rel: "noreferrer noopener",
68
- onClick: this.handleMediaLinkClick,
69
- "data-block-link": linkHref,
70
- css: linkStyle
71
- }, mediaComponentWithBorder) : mediaComponentWithBorder;
118
+ }))))));
72
119
  });
73
120
  _defineProperty(this, "handleMediaLinkClick", event => {
74
121
  const {
@@ -96,6 +143,7 @@ export default class Media extends PureComponent {
96
143
  handler(event, linkMark && linkHref);
97
144
  }
98
145
  });
146
+ this.handleMediaLinkClickFn = this.handleMediaLinkClick.bind(this);
99
147
  }
100
148
  render() {
101
149
  const {
@@ -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.10.4";
39
+ const packageVersion = "109.10.6";
40
40
  export class Renderer extends PureComponent {
41
41
  constructor(props) {
42
42
  super(props);
@@ -8,7 +8,8 @@ const MarkElement = ({
8
8
  annotationParentIds,
9
9
  children,
10
10
  dataAttributes,
11
- id
11
+ id,
12
+ useBlockLevel
12
13
  }) => {
13
14
  const updateSubscriber = useInlineCommentSubscriberContext();
14
15
  const states = useContext(InlineCommentsStateContext);
@@ -42,7 +43,8 @@ const MarkElement = ({
42
43
  annotationParentIds: activeParentIds,
43
44
  onClick: onClick,
44
45
  hasFocus: hasFocus,
45
- state: states[id]
46
+ state: states[id],
47
+ useBlockLevel: useBlockLevel
46
48
  }, children);
47
49
  };
48
50
  export { MarkElement };
@@ -1,7 +1,6 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  /** @jsx jsx */
3
2
 
4
- import React, { useMemo, useCallback } from 'react';
3
+ import { useMemo, useCallback } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
6
5
  import { AnnotationSharedCSSByState, mediaAnnotationStyles } from '@atlaskit/editor-common/styles';
7
6
  import { AnnotationMarkStates } from '@atlaskit/adf-schema';
@@ -20,12 +19,14 @@ const markStyles = () => css`
20
19
  &[data-has-focus='true'] {
21
20
  ${AnnotationSharedCSSByState().focus};
22
21
  }
23
-
24
- & div.rich-media-item {
25
- ${mediaAnnotationStyles};
26
- }
27
22
  }
28
23
  `;
24
+ const blockStyles = () => css({
25
+ color: 'inherit',
26
+ backgroundColor: 'unset',
27
+ WebkitTapHighlightColor: 'transparent',
28
+ [`&[data-mark-annotation-state='${AnnotationMarkStates.ACTIVE}']`]: mediaAnnotationStyles
29
+ });
29
30
  export const MarkComponent = ({
30
31
  annotationParentIds,
31
32
  children,
@@ -33,7 +34,8 @@ export const MarkComponent = ({
33
34
  id,
34
35
  state,
35
36
  hasFocus,
36
- onClick
37
+ onClick,
38
+ useBlockLevel
37
39
  }) => {
38
40
  const annotationIds = useMemo(() => [...new Set([...annotationParentIds, id])], [id, annotationParentIds]);
39
41
  const onMarkClick = useCallback(event => {
@@ -62,15 +64,11 @@ export const MarkComponent = ({
62
64
  } : {
63
65
  'aria-details': annotationIds.join(', ')
64
66
  };
65
- return getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') ? jsx("mark", _extends({
66
- id: id,
67
- onClickCapture: onMarkClick
68
- }, accessibility, overriddenData, {
69
- css: markStyles
70
- }), children) : jsx("mark", _extends({
71
- id: id,
72
- onClick: onMarkClick
73
- }, accessibility, overriddenData, {
74
- css: markStyles
75
- }), children);
67
+ return jsx(useBlockLevel ? 'div' : 'mark', {
68
+ id,
69
+ [getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') ? 'onClickCapture' : 'onClick']: onMarkClick,
70
+ ...accessibility,
71
+ ...overriddenData,
72
+ css: useBlockLevel ? blockStyles : markStyles
73
+ }, children);
76
74
  };
@@ -78,7 +78,7 @@ var ReactSerializer = /*#__PURE__*/function () {
78
78
  var shouldSkipLinkMark = function shouldSkipLinkMark(mark) {
79
79
  return _this.allowMediaLinking !== true && isMedia && mark.type.name === 'link';
80
80
  };
81
- return marks.reverse().reduce(function (content, mark) {
81
+ return marks.reduceRight(function (content, mark) {
82
82
  if (shouldSkipLinkMark(mark) || shouldSkipBorderMark(mark)) {
83
83
  return content;
84
84
  }
@@ -382,12 +382,16 @@ var ReactSerializer = /*#__PURE__*/function () {
382
382
  _this$media;
383
383
  var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
384
384
  var _node$type$schema$mar = node.type.schema.marks,
385
+ annotation = _node$type$schema$mar.annotation,
385
386
  link = _node$type$schema$mar.link,
386
387
  border = _node$type$schema$mar.border;
387
388
  var isChildOfMediaSingle = path.some(function (n) {
388
389
  var _n$type2;
389
390
  return ((_n$type2 = n.type) === null || _n$type2 === void 0 ? void 0 : _n$type2.name) === 'mediaSingle';
390
391
  });
392
+ var isAnnotationMark = function isAnnotationMark(mark) {
393
+ return mark.type === annotation;
394
+ };
391
395
  var isLinkMark = function isLinkMark(mark) {
392
396
  return mark.type === link;
393
397
  };
@@ -400,6 +404,7 @@ var ReactSerializer = /*#__PURE__*/function () {
400
404
  }),
401
405
  isLinkMark: isLinkMark,
402
406
  isBorderMark: isBorderMark,
407
+ isAnnotationMark: isAnnotationMark,
403
408
  allowAltTextOnImages: this.allowAltTextOnImages,
404
409
  featureFlags: this.media && this.media.featureFlags,
405
410
  shouldOpenMediaViewer: this.shouldOpenMediaViewer,
@@ -15,7 +15,8 @@ var AnnotationComponent = function AnnotationComponent(_ref) {
15
15
  dataAttributes = _ref.dataAttributes,
16
16
  _ref$annotationParent = _ref.annotationParentIds,
17
17
  annotationParentIds = _ref$annotationParent === void 0 ? [] : _ref$annotationParent,
18
- allowAnnotations = _ref.allowAnnotations;
18
+ allowAnnotations = _ref.allowAnnotations,
19
+ useBlockLevel = _ref.useBlockLevel;
19
20
  var data = _objectSpread(_objectSpread({}, dataAttributes), buildAnnotationMarkDataAttributes({
20
21
  id: id,
21
22
  annotationType: annotationType
@@ -25,7 +26,8 @@ var AnnotationComponent = function AnnotationComponent(_ref) {
25
26
  id: id,
26
27
  dataAttributes: data,
27
28
  annotationParentIds: annotationParentIds,
28
- annotationType: annotationType
29
+ annotationType: annotationType,
30
+ useBlockLevel: useBlockLevel
29
31
  }, children);
30
32
  }
31
33
  return /*#__PURE__*/React.createElement("span", _extends({
@@ -10,7 +10,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  /** @jsx jsx */
12
12
 
13
- import React, { PureComponent } from 'react';
13
+ import React, { PureComponent, Fragment } from 'react';
14
14
  import { jsx } from '@emotion/react';
15
15
  import { AnalyticsContext } from '@atlaskit/analytics-next';
16
16
  import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
@@ -21,19 +21,70 @@ import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
21
21
  import { getEventHandler } from '../../../utils';
22
22
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
23
23
  import { MODE, PLATFORM } from '../../../analytics/events';
24
+ import AnnotationComponent from '../../marks/annotation';
24
25
  import { linkStyle, borderStyle } from './styles';
26
+ var MediaBorder = function MediaBorder(_ref) {
27
+ var _mark$attrs$color, _mark$attrs$size;
28
+ var mark = _ref.mark,
29
+ children = _ref.children;
30
+ if (!mark) {
31
+ return jsx(Fragment, null, children);
32
+ }
33
+ var borderColor = (_mark$attrs$color = mark === null || mark === void 0 ? void 0 : mark.attrs.color) !== null && _mark$attrs$color !== void 0 ? _mark$attrs$color : '';
34
+ var borderWidth = (_mark$attrs$size = mark === null || mark === void 0 ? void 0 : mark.attrs.size) !== null && _mark$attrs$size !== void 0 ? _mark$attrs$size : 0;
35
+ var paletteColorValue = hexToEditorBorderPaletteColor(borderColor) || borderColor;
36
+ return jsx("div", {
37
+ "data-mark-type": "border",
38
+ "data-color": borderColor,
39
+ "data-size": borderWidth,
40
+ css: borderStyle(paletteColorValue, borderWidth)
41
+ }, jsx(MediaBorderGapFiller, {
42
+ borderColor: borderColor
43
+ }), children);
44
+ };
45
+ var MediaLink = function MediaLink(_ref2) {
46
+ var mark = _ref2.mark,
47
+ children = _ref2.children,
48
+ onClick = _ref2.onClick;
49
+ if (!mark) {
50
+ return jsx(Fragment, null, children);
51
+ }
52
+ var linkHref = mark === null || mark === void 0 ? void 0 : mark.attrs.href;
53
+ return jsx("a", {
54
+ href: linkHref,
55
+ rel: "noreferrer noopener",
56
+ onClick: onClick,
57
+ "data-block-link": linkHref,
58
+ css: linkStyle
59
+ }, children);
60
+ };
61
+ var MediaAnnotation = function MediaAnnotation(_ref3) {
62
+ var mark = _ref3.mark,
63
+ children = _ref3.children;
64
+ if (!mark) {
65
+ return jsx(Fragment, null, children);
66
+ }
67
+ return jsx(AnnotationComponent, {
68
+ id: mark.attrs.id,
69
+ annotationType: mark.attrs.annotationType,
70
+ dataAttributes: {
71
+ 'data-renderer-mark': true
72
+ }
73
+ // This should be fine being empty [] since the serializer serializeFragmentChild getMarkProps call always passes
74
+ ,
75
+ annotationParentIds: [],
76
+ allowAnnotations: true,
77
+ useBlockLevel: true
78
+ }, children);
79
+ };
25
80
  var Media = /*#__PURE__*/function (_PureComponent) {
26
81
  _inherits(Media, _PureComponent);
27
82
  var _super = _createSuper(Media);
28
- function Media() {
83
+ function Media(props) {
29
84
  var _this;
30
85
  _classCallCheck(this, Media);
31
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
32
- args[_key] = arguments[_key];
33
- }
34
- _this = _super.call.apply(_super, [this].concat(args));
86
+ _this = _super.call(this, props);
35
87
  _defineProperty(_assertThisInitialized(_this), "renderCard", function () {
36
- var _borderMark$attrs$col, _borderMark$attrs$siz;
37
88
  var providers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
38
89
  var contextIdentifierProvider = providers.contextIdentifierProvider;
39
90
  var _this$props = _this.props,
@@ -43,14 +94,20 @@ var Media = /*#__PURE__*/function (_PureComponent) {
43
94
  allowMediaViewer = _this$props.shouldOpenMediaViewer,
44
95
  enableDownloadButton = _this$props.enableDownloadButton,
45
96
  ssr = _this$props.ssr;
97
+ var annotationMark = _this.props.isAnnotationMark ? _this.props.marks.find(_this.props.isAnnotationMark) : undefined;
46
98
  var borderMark = _this.props.marks.find(_this.props.isBorderMark);
47
- var borderColor = (_borderMark$attrs$col = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color) !== null && _borderMark$attrs$col !== void 0 ? _borderMark$attrs$col : '';
48
- var borderWidth = (_borderMark$attrs$siz = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size) !== null && _borderMark$attrs$siz !== void 0 ? _borderMark$attrs$siz : 0;
49
99
  var linkMark = _this.props.marks.find(_this.props.isLinkMark);
50
100
  var linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
51
101
  var eventHandlers = linkHref ? undefined : _this.props.eventHandlers;
52
102
  var shouldOpenMediaViewer = !linkHref && allowMediaViewer;
53
- var mediaComponent = jsx(AnalyticsContext, {
103
+ return jsx(MediaLink, {
104
+ mark: linkMark,
105
+ onClick: _this.handleMediaLinkClickFn
106
+ }, jsx(MediaAnnotation, {
107
+ mark: annotationMark
108
+ }, jsx(MediaBorder, {
109
+ mark: borderMark
110
+ }, jsx(AnalyticsContext, {
54
111
  data: _defineProperty({}, MEDIA_CONTEXT, {
55
112
  border: !!borderMark
56
113
  })
@@ -63,23 +120,7 @@ var Media = /*#__PURE__*/function (_PureComponent) {
63
120
  featureFlags: featureFlags,
64
121
  shouldEnableDownloadButton: enableDownloadButton,
65
122
  ssr: ssr
66
- })));
67
- var paletteColorValue = hexToEditorBorderPaletteColor(borderColor) || borderColor;
68
- var mediaComponentWithBorder = borderMark ? jsx("div", {
69
- "data-mark-type": "border",
70
- "data-color": borderColor,
71
- "data-size": borderWidth,
72
- css: borderStyle(paletteColorValue, borderWidth)
73
- }, jsx(MediaBorderGapFiller, {
74
- borderColor: borderColor
75
- }), mediaComponent) : mediaComponent;
76
- return linkHref ? jsx("a", {
77
- href: linkHref,
78
- rel: "noreferrer noopener",
79
- onClick: _this.handleMediaLinkClick,
80
- "data-block-link": linkHref,
81
- css: linkStyle
82
- }, mediaComponentWithBorder) : mediaComponentWithBorder;
123
+ }))))));
83
124
  });
84
125
  _defineProperty(_assertThisInitialized(_this), "handleMediaLinkClick", function (event) {
85
126
  var _this$props2 = _this.props,
@@ -106,6 +147,7 @@ var Media = /*#__PURE__*/function (_PureComponent) {
106
147
  handler(event, _linkMark && linkHref);
107
148
  }
108
149
  });
150
+ _this.handleMediaLinkClickFn = _this.handleMediaLinkClick.bind(_assertThisInitialized(_this));
109
151
  return _this;
110
152
  }
111
153
  _createClass(Media, [{
@@ -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.10.4";
49
+ var packageVersion = "109.10.6";
50
50
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
51
51
  _inherits(Renderer, _PureComponent);
52
52
  var _super = _createSuper(Renderer);
@@ -8,7 +8,8 @@ var MarkElement = function MarkElement(_ref) {
8
8
  var annotationParentIds = _ref.annotationParentIds,
9
9
  children = _ref.children,
10
10
  dataAttributes = _ref.dataAttributes,
11
- id = _ref.id;
11
+ id = _ref.id,
12
+ useBlockLevel = _ref.useBlockLevel;
12
13
  var updateSubscriber = useInlineCommentSubscriberContext();
13
14
  var states = useContext(InlineCommentsStateContext);
14
15
  var hasFocus = useHasFocusEvent({
@@ -41,7 +42,8 @@ var MarkElement = function MarkElement(_ref) {
41
42
  annotationParentIds: activeParentIds,
42
43
  onClick: onClick,
43
44
  hasFocus: hasFocus,
44
- state: states[id]
45
+ state: states[id],
46
+ useBlockLevel: useBlockLevel
45
47
  }, children);
46
48
  };
47
49
  export { MarkElement };
@@ -1,13 +1,12 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
5
4
  var _templateObject;
6
5
  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; }
7
6
  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; }
8
7
  /** @jsx jsx */
9
8
 
10
- import React, { useMemo, useCallback } from 'react';
9
+ import { useMemo, useCallback } from 'react';
11
10
  import { css, jsx } from '@emotion/react';
12
11
  import { AnnotationSharedCSSByState, mediaAnnotationStyles } from '@atlaskit/editor-common/styles';
13
12
  import { AnnotationMarkStates } from '@atlaskit/adf-schema';
@@ -15,7 +14,14 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
15
14
 
16
15
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- `AnnotationSharedCSSByState` is not object-safe
17
16
  var markStyles = function markStyles() {
18
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color: transparent;\n\n &[data-mark-annotation-state='", "'] {\n ", ";\n\n &:focus,\n &[data-has-focus='true'] {\n ", ";\n }\n\n & div.rich-media-item {\n ", ";\n }\n }\n"])), AnnotationMarkStates.ACTIVE, AnnotationSharedCSSByState().blur, AnnotationSharedCSSByState().focus, mediaAnnotationStyles);
17
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: inherit;\n background-color: unset;\n -webkit-tap-highlight-color: transparent;\n\n &[data-mark-annotation-state='", "'] {\n ", ";\n\n &:focus,\n &[data-has-focus='true'] {\n ", ";\n }\n }\n"])), AnnotationMarkStates.ACTIVE, AnnotationSharedCSSByState().blur, AnnotationSharedCSSByState().focus);
18
+ };
19
+ var blockStyles = function blockStyles() {
20
+ return css(_defineProperty({
21
+ color: 'inherit',
22
+ backgroundColor: 'unset',
23
+ WebkitTapHighlightColor: 'transparent'
24
+ }, "&[data-mark-annotation-state='".concat(AnnotationMarkStates.ACTIVE, "']"), mediaAnnotationStyles));
19
25
  };
20
26
  export var MarkComponent = function MarkComponent(_ref) {
21
27
  var annotationParentIds = _ref.annotationParentIds,
@@ -24,7 +30,8 @@ export var MarkComponent = function MarkComponent(_ref) {
24
30
  id = _ref.id,
25
31
  state = _ref.state,
26
32
  hasFocus = _ref.hasFocus,
27
- onClick = _ref.onClick;
33
+ onClick = _ref.onClick,
34
+ useBlockLevel = _ref.useBlockLevel;
28
35
  var annotationIds = useMemo(function () {
29
36
  return _toConsumableArray(new Set([].concat(_toConsumableArray(annotationParentIds), [id])));
30
37
  }, [id, annotationParentIds]);
@@ -53,15 +60,9 @@ export var MarkComponent = function MarkComponent(_ref) {
53
60
  } : {
54
61
  'aria-details': annotationIds.join(', ')
55
62
  };
56
- return getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') ? jsx("mark", _extends({
57
- id: id,
58
- onClickCapture: onMarkClick
59
- }, accessibility, overriddenData, {
60
- css: markStyles
61
- }), children) : jsx("mark", _extends({
62
- id: id,
63
- onClick: onMarkClick
64
- }, accessibility, overriddenData, {
65
- css: markStyles
63
+ return jsx(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread(_defineProperty({
64
+ id: id
65
+ }, getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), {}, {
66
+ css: useBlockLevel ? blockStyles : markStyles
66
67
  }), children);
67
68
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { MarkProps, AnnotationMarkMeta } from '../types';
3
- import { Mark } from '@atlaskit/editor-prosemirror/model';
2
+ import type { MarkProps, AnnotationMarkMeta } from '../types';
3
+ import type { Mark } from '@atlaskit/editor-prosemirror/model';
4
4
  export declare const isAnnotationMark: (mark: Mark) => boolean;
5
- declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, }: MarkProps<AnnotationMarkMeta>) => JSX.Element;
5
+ declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, }: MarkProps<AnnotationMarkMeta>) => JSX.Element;
6
6
  export default AnnotationComponent;
@@ -3,7 +3,7 @@ import { jsx } from '@emotion/react';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
4
  import type { EventHandlers } from '@atlaskit/editor-common/ui';
5
5
  import type { MediaCardProps } from '../../../ui/MediaCard';
6
- import type { LinkDefinition, BorderMarkDefinition } from '@atlaskit/adf-schema';
6
+ import type { LinkDefinition, BorderMarkDefinition, AnnotationMarkDefinition } from '@atlaskit/adf-schema';
7
7
  import type { MediaFeatureFlags } from '@atlaskit/media-common';
8
8
  import type { AnalyticsEventPayload } from '../../../analytics/events';
9
9
  export type MediaProps = MediaCardProps & {
@@ -11,15 +11,18 @@ export type MediaProps = MediaCardProps & {
11
11
  allowAltTextOnImages?: boolean;
12
12
  children?: React.ReactNode;
13
13
  isInsideOfBlockNode?: boolean;
14
- marks: Array<LinkDefinition | BorderMarkDefinition>;
14
+ marks: Array<LinkDefinition | BorderMarkDefinition | AnnotationMarkDefinition>;
15
15
  isBorderMark: () => boolean;
16
16
  isLinkMark: () => boolean;
17
+ isAnnotationMark?: () => boolean;
17
18
  fireAnalyticsEvent?: (event: AnalyticsEventPayload) => void;
18
19
  featureFlags?: MediaFeatureFlags;
19
20
  eventHandlers?: EventHandlers;
20
21
  enableDownloadButton?: boolean;
21
22
  };
22
23
  export default class Media extends PureComponent<MediaProps, {}> {
24
+ constructor(props: MediaProps);
25
+ private handleMediaLinkClickFn;
23
26
  private renderCard;
24
27
  private handleMediaLinkClick;
25
28
  render(): jsx.JSX.Element;
@@ -53,6 +53,7 @@ export interface AnnotationMarkMeta extends MarkMeta {
53
53
  annotationType: AnnotationTypes;
54
54
  annotationParentIds: string[];
55
55
  allowAnnotations: boolean;
56
+ useBlockLevel?: boolean;
56
57
  }
57
58
  export type NodeProps<NodeAttrs = {}> = NodeAttrs & PropsWithChildren<NodeMeta>;
58
59
  export type MarkProps<MarkAttrs = {}> = MarkAttrs & PropsWithChildren<MarkMeta>;
@@ -5,6 +5,7 @@ type MarkElementProps = React.PropsWithChildren<{
5
5
  annotationParentIds: AnnotationId[];
6
6
  dataAttributes: AnnotationDataAttributes;
7
7
  annotationType: AnnotationTypes;
8
+ useBlockLevel?: boolean;
8
9
  }>;
9
- declare const MarkElement: ({ annotationParentIds, children, dataAttributes, id, }: MarkElementProps) => JSX.Element;
10
+ declare const MarkElement: ({ annotationParentIds, children, dataAttributes, id, useBlockLevel, }: MarkElementProps) => JSX.Element;
10
11
  export { MarkElement };
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { jsx } from '@emotion/react';
1
+ import type React from 'react';
3
2
  import type { OnAnnotationClickPayload } from '@atlaskit/editor-common/types';
4
3
  import type { AnnotationId, AnnotationDataAttributes } from '@atlaskit/adf-schema';
5
4
  import { AnnotationMarkStates } from '@atlaskit/adf-schema';
@@ -10,6 +9,45 @@ type MarkComponentProps = {
10
9
  state: AnnotationMarkStates | null;
11
10
  hasFocus: boolean;
12
11
  onClick: (props: OnAnnotationClickPayload) => void;
12
+ useBlockLevel?: boolean;
13
13
  };
14
- export declare const MarkComponent: ({ annotationParentIds, children, dataAttributes, id, state, hasFocus, onClick, }: React.PropsWithChildren<MarkComponentProps>) => jsx.JSX.Element;
14
+ export declare const MarkComponent: ({ annotationParentIds, children, dataAttributes, id, state, hasFocus, onClick, useBlockLevel, }: React.PropsWithChildren<MarkComponentProps>) => React.DetailedReactHTMLElement<{
15
+ css: () => import("@emotion/react").SerializedStyles;
16
+ 'data-mark-type': string;
17
+ 'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
18
+ 'data-id': string;
19
+ 'data-mark-annotation-state'?: AnnotationMarkStates | undefined;
20
+ 'aria-disabled': boolean;
21
+ 'aria-details'?: undefined;
22
+ id: string;
23
+ } | {
24
+ css: () => import("@emotion/react").SerializedStyles;
25
+ 'data-mark-annotation-state': AnnotationMarkStates;
26
+ 'data-has-focus': boolean;
27
+ 'data-mark-type': string;
28
+ 'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
29
+ 'data-id': string;
30
+ 'aria-disabled': boolean;
31
+ 'aria-details'?: undefined;
32
+ id: string;
33
+ } | {
34
+ css: () => import("@emotion/react").SerializedStyles;
35
+ 'data-mark-type': string;
36
+ 'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
37
+ 'data-id': string;
38
+ 'data-mark-annotation-state'?: AnnotationMarkStates | undefined;
39
+ 'aria-details': string;
40
+ 'aria-disabled'?: undefined;
41
+ id: string;
42
+ } | {
43
+ css: () => import("@emotion/react").SerializedStyles;
44
+ 'data-mark-annotation-state': AnnotationMarkStates;
45
+ 'data-has-focus': boolean;
46
+ 'data-mark-type': string;
47
+ 'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
48
+ 'data-id': string;
49
+ 'aria-details': string;
50
+ 'aria-disabled'?: undefined;
51
+ id: string;
52
+ }, HTMLElement>;
15
53
  export {};
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { MarkProps, AnnotationMarkMeta } from '../types';
3
- import { Mark } from '@atlaskit/editor-prosemirror/model';
2
+ import type { MarkProps, AnnotationMarkMeta } from '../types';
3
+ import type { Mark } from '@atlaskit/editor-prosemirror/model';
4
4
  export declare const isAnnotationMark: (mark: Mark) => boolean;
5
- declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, }: MarkProps<AnnotationMarkMeta>) => JSX.Element;
5
+ declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, }: MarkProps<AnnotationMarkMeta>) => JSX.Element;
6
6
  export default AnnotationComponent;
@@ -3,7 +3,7 @@ import { jsx } from '@emotion/react';
3
3
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
4
4
  import type { EventHandlers } from '@atlaskit/editor-common/ui';
5
5
  import type { MediaCardProps } from '../../../ui/MediaCard';
6
- import type { LinkDefinition, BorderMarkDefinition } from '@atlaskit/adf-schema';
6
+ import type { LinkDefinition, BorderMarkDefinition, AnnotationMarkDefinition } from '@atlaskit/adf-schema';
7
7
  import type { MediaFeatureFlags } from '@atlaskit/media-common';
8
8
  import type { AnalyticsEventPayload } from '../../../analytics/events';
9
9
  export type MediaProps = MediaCardProps & {
@@ -11,15 +11,18 @@ export type MediaProps = MediaCardProps & {
11
11
  allowAltTextOnImages?: boolean;
12
12
  children?: React.ReactNode;
13
13
  isInsideOfBlockNode?: boolean;
14
- marks: Array<LinkDefinition | BorderMarkDefinition>;
14
+ marks: Array<LinkDefinition | BorderMarkDefinition | AnnotationMarkDefinition>;
15
15
  isBorderMark: () => boolean;
16
16
  isLinkMark: () => boolean;
17
+ isAnnotationMark?: () => boolean;
17
18
  fireAnalyticsEvent?: (event: AnalyticsEventPayload) => void;
18
19
  featureFlags?: MediaFeatureFlags;
19
20
  eventHandlers?: EventHandlers;
20
21
  enableDownloadButton?: boolean;
21
22
  };
22
23
  export default class Media extends PureComponent<MediaProps, {}> {
24
+ constructor(props: MediaProps);
25
+ private handleMediaLinkClickFn;
23
26
  private renderCard;
24
27
  private handleMediaLinkClick;
25
28
  render(): jsx.JSX.Element;
@@ -53,6 +53,7 @@ export interface AnnotationMarkMeta extends MarkMeta {
53
53
  annotationType: AnnotationTypes;
54
54
  annotationParentIds: string[];
55
55
  allowAnnotations: boolean;
56
+ useBlockLevel?: boolean;
56
57
  }
57
58
  export type NodeProps<NodeAttrs = {}> = NodeAttrs & PropsWithChildren<NodeMeta>;
58
59
  export type MarkProps<MarkAttrs = {}> = MarkAttrs & PropsWithChildren<MarkMeta>;
@@ -5,6 +5,7 @@ type MarkElementProps = React.PropsWithChildren<{
5
5
  annotationParentIds: AnnotationId[];
6
6
  dataAttributes: AnnotationDataAttributes;
7
7
  annotationType: AnnotationTypes;
8
+ useBlockLevel?: boolean;
8
9
  }>;
9
- declare const MarkElement: ({ annotationParentIds, children, dataAttributes, id, }: MarkElementProps) => JSX.Element;
10
+ declare const MarkElement: ({ annotationParentIds, children, dataAttributes, id, useBlockLevel, }: MarkElementProps) => JSX.Element;
10
11
  export { MarkElement };
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { jsx } from '@emotion/react';
1
+ import type React from 'react';
3
2
  import type { OnAnnotationClickPayload } from '@atlaskit/editor-common/types';
4
3
  import type { AnnotationId, AnnotationDataAttributes } from '@atlaskit/adf-schema';
5
4
  import { AnnotationMarkStates } from '@atlaskit/adf-schema';
@@ -10,6 +9,45 @@ type MarkComponentProps = {
10
9
  state: AnnotationMarkStates | null;
11
10
  hasFocus: boolean;
12
11
  onClick: (props: OnAnnotationClickPayload) => void;
12
+ useBlockLevel?: boolean;
13
13
  };
14
- export declare const MarkComponent: ({ annotationParentIds, children, dataAttributes, id, state, hasFocus, onClick, }: React.PropsWithChildren<MarkComponentProps>) => jsx.JSX.Element;
14
+ export declare const MarkComponent: ({ annotationParentIds, children, dataAttributes, id, state, hasFocus, onClick, useBlockLevel, }: React.PropsWithChildren<MarkComponentProps>) => React.DetailedReactHTMLElement<{
15
+ css: () => import("@emotion/react").SerializedStyles;
16
+ 'data-mark-type': string;
17
+ 'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
18
+ 'data-id': string;
19
+ 'data-mark-annotation-state'?: AnnotationMarkStates | undefined;
20
+ 'aria-disabled': boolean;
21
+ 'aria-details'?: undefined;
22
+ id: string;
23
+ } | {
24
+ css: () => import("@emotion/react").SerializedStyles;
25
+ 'data-mark-annotation-state': AnnotationMarkStates;
26
+ 'data-has-focus': boolean;
27
+ 'data-mark-type': string;
28
+ 'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
29
+ 'data-id': string;
30
+ 'aria-disabled': boolean;
31
+ 'aria-details'?: undefined;
32
+ id: string;
33
+ } | {
34
+ css: () => import("@emotion/react").SerializedStyles;
35
+ 'data-mark-type': string;
36
+ 'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
37
+ 'data-id': string;
38
+ 'data-mark-annotation-state'?: AnnotationMarkStates | undefined;
39
+ 'aria-details': string;
40
+ 'aria-disabled'?: undefined;
41
+ id: string;
42
+ } | {
43
+ css: () => import("@emotion/react").SerializedStyles;
44
+ 'data-mark-annotation-state': AnnotationMarkStates;
45
+ 'data-has-focus': boolean;
46
+ 'data-mark-type': string;
47
+ 'data-mark-annotation-type': import("@atlaskit/adf-schema").AnnotationTypes;
48
+ 'data-id': string;
49
+ 'aria-details': string;
50
+ 'aria-disabled'?: undefined;
51
+ id: string;
52
+ }, HTMLElement>;
15
53
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "109.10.4",
3
+ "version": "109.10.6",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/analytics-next": "^9.2.0",
32
32
  "@atlaskit/button": "^17.7.0",
33
33
  "@atlaskit/code": "^15.1.0",
34
- "@atlaskit/editor-common": "^78.18.0",
34
+ "@atlaskit/editor-common": "^78.20.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.10.0",
36
36
  "@atlaskit/editor-palette": "1.5.3",
37
37
  "@atlaskit/editor-prosemirror": "3.0.0",