@atlaskit/editor-common 78.4.0 → 78.4.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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 78.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#74946](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74946) [`6a1fca4dee65`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6a1fca4dee65) - [ux] Media Inline Images now support previewer when clicked in renderer
8
+
9
+ ## 78.4.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#75400](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75400) [`6b582c433397`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b582c433397) - Fixed the margin for the action item inside the panel
14
+ Moved the panel test-cases from editor-plugin-context-panel-tests to editor-plugin-panel-tests
15
+
3
16
  ## 78.4.0
4
17
 
5
18
  ### Minor Changes
@@ -96,6 +96,9 @@
96
96
  {
97
97
  "path": "../../../media/media-ui/afm-cc/tsconfig.json"
98
98
  },
99
+ {
100
+ "path": "../../../media/media-viewer/afm-cc/tsconfig.json"
101
+ },
99
102
  {
100
103
  "path": "../../../elements/mention/afm-cc/tsconfig.json"
101
104
  },
@@ -25,11 +25,13 @@ var InlineImageWrapper = exports.InlineImageWrapper = function InlineImageWrappe
25
25
  var _ref2;
26
26
  var children = _ref.children,
27
27
  isSelected = _ref.isSelected,
28
+ isInteractive = _ref.isInteractive,
28
29
  aspectRatio = _ref.aspectRatio,
29
30
  borderSize = _ref.borderSize,
30
31
  borderColor = _ref.borderColor,
31
32
  _ref$htmlAttrs = _ref.htmlAttrs,
32
- htmlAttrs = _ref$htmlAttrs === void 0 ? {} : _ref$htmlAttrs;
33
+ htmlAttrs = _ref$htmlAttrs === void 0 ? {} : _ref$htmlAttrs,
34
+ onClick = _ref.onClick;
33
35
  var borderStyleVars = borderSize && borderColor ? (_ref2 = {}, (0, _defineProperty2.default)(_ref2, _styles.INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY, borderSize), (0, _defineProperty2.default)(_ref2, _styles.INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY, (0, _editorPalette.hexToEditorBorderPaletteColor)(borderColor) || borderColor), _ref2) : {};
34
36
  var aspectStyleVars = aspectRatio ? (0, _defineProperty2.default)({}, _styles.INLINE_IMAGE_ASPECT_RATIO_CSS_VAR_KEY, aspectRatio) : {};
35
37
  return (
@@ -37,8 +39,9 @@ var InlineImageWrapper = exports.InlineImageWrapper = function InlineImageWrappe
37
39
  (0, _react.jsx)("span", (0, _extends2.default)({
38
40
  style: _objectSpread(_objectSpread({}, borderStyleVars), aspectStyleVars),
39
41
  className: _styles.INLINE_IMAGE_WRAPPER_CLASS_NAME,
40
- css: [_styles.wrapperStyle, borderSize && borderColor && _styles.borderStyle, isSelected && _styles.selectedStyle],
41
- "data-testid": "inline-image-wrapper"
42
+ css: [_styles.wrapperStyle, borderSize && borderColor && _styles.borderStyle, isSelected && _styles.selectedStyle, isInteractive && _styles.interactiveStyle],
43
+ "data-testid": "inline-image-wrapper",
44
+ onClick: onClick
42
45
  }, htmlAttrs), (0, _react.jsx)("span", {
43
46
  css: sizeWrapperStyle
44
47
  }, children))
@@ -9,11 +9,14 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = require("react");
11
11
  var _react2 = require("@emotion/react");
12
+ var _reactDom = _interopRequireDefault(require("react-dom"));
12
13
  var _reactIntlNext = require("react-intl-next");
13
14
  var _analyticsNext = require("@atlaskit/analytics-next");
14
15
  var _mediaCard = require("@atlaskit/media-card");
15
16
  var _mediaClient = require("@atlaskit/media-client");
16
17
  var _mediaClientReact = require("@atlaskit/media-client-react");
18
+ var _mediaViewer = require("@atlaskit/media-viewer");
19
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
20
  var _mediaInlineCard = require("../messages/media-inline-card");
18
21
  var _constants = require("./constants");
19
22
  var _inlineImageCard = require("./inline-image-card");
@@ -33,7 +36,8 @@ var MediaInlineImageCardInternal = exports.MediaInlineImageCardInternal = functi
33
36
  height = _ref.height,
34
37
  border = _ref.border,
35
38
  ssr = _ref.ssr,
36
- serializeDataAttrs = _ref.serializeDataAttrs;
39
+ serializeDataAttrs = _ref.serializeDataAttrs,
40
+ shouldOpenMediaViewer = _ref.shouldOpenMediaViewer;
37
41
  var _useState = (0, _react.useState)(),
38
42
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
39
43
  fileState = _useState2[0],
@@ -50,6 +54,10 @@ var MediaInlineImageCardInternal = exports.MediaInlineImageCardInternal = functi
50
54
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
51
55
  isSucceededEventSent = _useState8[0],
52
56
  setIsSucceededEventSent = _useState8[1];
57
+ var _useState9 = (0, _react.useState)(false),
58
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
59
+ isMediaViewerVisible = _useState10[0],
60
+ setMediaViewerVisible = _useState10[1];
53
61
  var _ref2 = intl || (0, _reactIntlNext.createIntl)({
54
62
  locale: 'en'
55
63
  }),
@@ -182,13 +190,35 @@ var MediaInlineImageCardInternal = exports.MediaInlineImageCardInternal = functi
182
190
  }
183
191
  return {};
184
192
  }, [alt, fileState, height, identifier, width, serializeDataAttrs]);
185
- return (0, _react2.jsx)(_inlineImageWrapper.InlineImageWrapper, {
193
+ var onMediaInlineImageClick = (0, _react.useCallback)(function () {
194
+ if (shouldOpenMediaViewer && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.inline-image.renderer-preview-support_3w1ju')) {
195
+ setMediaViewerVisible(true);
196
+ }
197
+ }, [shouldOpenMediaViewer]);
198
+ var onMediaInlinePreviewClose = (0, _react.useCallback)(function () {
199
+ setMediaViewerVisible(false);
200
+ }, []);
201
+ var mediaViewer = (0, _react.useMemo)(function () {
202
+ if (isMediaViewerVisible && mediaClient !== null && mediaClient !== void 0 && mediaClient.mediaClientConfig) {
203
+ return /*#__PURE__*/_reactDom.default.createPortal((0, _react2.jsx)(_mediaViewer.MediaViewer, {
204
+ collectionName: identifier.collectionName || '',
205
+ items: [identifier],
206
+ mediaClientConfig: mediaClient === null || mediaClient === void 0 ? void 0 : mediaClient.mediaClientConfig,
207
+ selectedItem: identifier,
208
+ onClose: onMediaInlinePreviewClose
209
+ }), document.body);
210
+ }
211
+ return null;
212
+ }, [identifier, isMediaViewerVisible, mediaClient === null || mediaClient === void 0 ? void 0 : mediaClient.mediaClientConfig, onMediaInlinePreviewClose]);
213
+ return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_inlineImageWrapper.InlineImageWrapper, {
186
214
  isSelected: isSelected,
215
+ isInteractive: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.inline-image.renderer-preview-support_3w1ju') && shouldOpenMediaViewer,
187
216
  aspectRatio: aspectRatio,
188
217
  borderColor: border === null || border === void 0 ? void 0 : border.borderColor,
189
218
  borderSize: border === null || border === void 0 ? void 0 : border.borderSize,
190
- htmlAttrs: htmlAttributes
191
- }, content(scaledDimension));
219
+ htmlAttrs: htmlAttributes,
220
+ onClick: onMediaInlineImageClick
221
+ }, content(scaledDimension)), mediaViewer);
192
222
  };
193
223
  var MediaInlineImageCard = exports.MediaInlineImageCard = (0, _reactIntlNext.injectIntl)(MediaInlineImageCardInternal, {
194
224
  enforceContext: false
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.wrapperStyle = exports.selectedStyle = exports.mediaInlineImageStyles = exports.borderStyle = exports.INLINE_IMAGE_WRAPPER_CLASS_NAME = exports.INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY = exports.INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY = exports.INLINE_IMAGE_ASPECT_RATIO_CSS_VAR_KEY = void 0;
7
+ exports.wrapperStyle = exports.selectedStyle = exports.mediaInlineImageStyles = exports.interactiveStyle = exports.borderStyle = exports.INLINE_IMAGE_WRAPPER_CLASS_NAME = exports.INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY = exports.INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY = exports.INLINE_IMAGE_ASPECT_RATIO_CSS_VAR_KEY = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
10
  var _colors = require("@atlaskit/theme/colors");
@@ -43,6 +43,9 @@ var selectedStyle = exports.selectedStyle = (0, _react.css)({
43
43
  boxShadow: "0 0 0 1px ".concat("var(--ds-border-selected, ".concat(_colors.B300, ")")),
44
44
  outline: 'none'
45
45
  });
46
+ var interactiveStyle = exports.interactiveStyle = (0, _react.css)({
47
+ cursor: 'pointer'
48
+ });
46
49
  var borderStyle = exports.borderStyle = (0, _react.css)({
47
50
  borderColor: "var(".concat(INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY, ")"),
48
51
  borderStyle: 'solid',
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "78.4.0";
19
+ var packageVersion = "78.4.2";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -9,9 +9,10 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
9
9
  var _react = require("@emotion/react");
10
10
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
11
11
  var _templateObject;
12
+ /* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
12
13
  var TaskDecisionSharedCssClassName = exports.TaskDecisionSharedCssClassName = {
13
14
  DECISION_CONTAINER: 'decisionItemView-content-wrap',
14
15
  TASK_CONTAINER: 'taskItemView-content-wrap',
15
16
  TASK_ITEM: 'task-item'
16
17
  };
17
- var tasksAndDecisionsStyles = exports.tasksAndDecisionsStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n .taskItemView-content-wrap,\n .", " {\n position: relative;\n min-width: ", "px;\n }\n\n .", " {\n margin-top: 0;\n }\n\n .", " {\n span[contenteditable='false'] {\n height: ", "em;\n }\n }\n\n .", " {\n line-height: ", ";\n }\n }\n\n div[data-task-local-id] {\n span[contenteditable='false'] {\n height: ", "em;\n }\n span[contenteditable='false'] + div {\n line-height: ", "em;\n }\n }\n\n div[data-task-list-local-id] {\n margin: ", " 0 0 0;\n }\n\n div[data-task-list-local-id] {\n // If task item is not first in the list then set margin top to 4px.\n div + div {\n margin-top: ", ";\n }\n }\n\n // If task list is not first in the document then set margin top to 4px.\n div[data-task-list-local-id] div[data-task-list-local-id] {\n margin-top: ", ";\n margin-left: ", ";\n }\n"])), TaskDecisionSharedCssClassName.DECISION_CONTAINER, _editorSharedStyles.akEditorTableCellMinWidth, TaskDecisionSharedCssClassName.DECISION_CONTAINER, TaskDecisionSharedCssClassName.TASK_CONTAINER, _editorSharedStyles.akEditorLineHeight, TaskDecisionSharedCssClassName.TASK_ITEM, _editorSharedStyles.akEditorLineHeight, _editorSharedStyles.akEditorLineHeight, _editorSharedStyles.akEditorLineHeight, "var(--ds-space-150, 12px)", "var(--ds-space-050, 4px)", "var(--ds-space-050, 4px)", "var(--ds-space-300, 24px)");
18
+ var tasksAndDecisionsStyles = exports.tasksAndDecisionsStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n .taskItemView-content-wrap,\n .", " {\n position: relative;\n min-width: ", "px;\n }\n\n .", " {\n margin-top: 0;\n }\n\n .", " {\n span[contenteditable='false'] {\n height: ", "em;\n }\n }\n\n .", " {\n line-height: ", ";\n }\n }\n\n div[data-task-local-id] {\n span[contenteditable='false'] {\n height: ", "em;\n }\n span[contenteditable='false'] + div {\n line-height: ", "em;\n }\n }\n\n div[data-task-list-local-id] {\n margin: ", " 0 0 0;\n }\n\n div[data-task-list-local-id] {\n // If task item is not first in the list then set margin top to 4px.\n div + div {\n margin-top: ", ";\n }\n }\n\n // If task list is not first in the document then set margin top to 4px.\n div[data-task-list-local-id] div[data-task-list-local-id] {\n margin-top: ", ";\n margin-left: ", ";\n }\n\n /* When action list is inside panel */\n .ak-editor-panel__content {\n > div[data-task-list-local-id]:first-child {\n margin: 0 0 0 0 !important;\n }\n }\n"])), TaskDecisionSharedCssClassName.DECISION_CONTAINER, _editorSharedStyles.akEditorTableCellMinWidth, TaskDecisionSharedCssClassName.DECISION_CONTAINER, TaskDecisionSharedCssClassName.TASK_CONTAINER, _editorSharedStyles.akEditorLineHeight, TaskDecisionSharedCssClassName.TASK_ITEM, _editorSharedStyles.akEditorLineHeight, _editorSharedStyles.akEditorLineHeight, _editorSharedStyles.akEditorLineHeight, "var(--ds-space-150, 12px)", "var(--ds-space-050, 4px)", "var(--ds-space-050, 4px)", "var(--ds-space-300, 24px)");
@@ -22,7 +22,7 @@ var _templateObject, _templateObject2, _templateObject3;
22
22
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
23
23
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
24
24
  var packageName = "@atlaskit/editor-common";
25
- var packageVersion = "78.4.0";
25
+ var packageVersion = "78.4.2";
26
26
  var halfFocusRing = 1;
27
27
  var dropOffset = '0, 8';
28
28
  var DropList = /*#__PURE__*/function (_Component) {
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
 
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
6
- import { borderStyle, INLINE_IMAGE_ASPECT_RATIO_CSS_VAR_KEY, INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY, INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY, INLINE_IMAGE_WRAPPER_CLASS_NAME, selectedStyle, wrapperStyle } from './styles';
6
+ import { borderStyle, INLINE_IMAGE_ASPECT_RATIO_CSS_VAR_KEY, INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY, INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY, INLINE_IMAGE_WRAPPER_CLASS_NAME, interactiveStyle, selectedStyle, wrapperStyle } from './styles';
7
7
 
8
8
  // The MediaImage component needs to obtain its parent's dimensions.
9
9
  // To achieve this, we have added an additional wrapper that allows
@@ -17,10 +17,12 @@ const sizeWrapperStyle = css({
17
17
  export const InlineImageWrapper = ({
18
18
  children,
19
19
  isSelected,
20
+ isInteractive,
20
21
  aspectRatio,
21
22
  borderSize,
22
23
  borderColor,
23
- htmlAttrs = {}
24
+ htmlAttrs = {},
25
+ onClick
24
26
  }) => {
25
27
  const borderStyleVars = borderSize && borderColor ? {
26
28
  [INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY]: borderSize,
@@ -37,8 +39,9 @@ export const InlineImageWrapper = ({
37
39
  ...aspectStyleVars
38
40
  },
39
41
  className: INLINE_IMAGE_WRAPPER_CLASS_NAME,
40
- css: [wrapperStyle, borderSize && borderColor && borderStyle, isSelected && selectedStyle],
41
- "data-testid": "inline-image-wrapper"
42
+ css: [wrapperStyle, borderSize && borderColor && borderStyle, isSelected && selectedStyle, isInteractive && interactiveStyle],
43
+ "data-testid": "inline-image-wrapper",
44
+ onClick: onClick
42
45
  }, htmlAttrs), jsx("span", {
43
46
  css: sizeWrapperStyle
44
47
  }, children))
@@ -1,12 +1,15 @@
1
1
  /** @jsx jsx */
2
2
 
3
- import { useEffect, useMemo, useState } from 'react';
3
+ import { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
4
4
  import { jsx } from '@emotion/react';
5
+ import ReactDOM from 'react-dom';
5
6
  import { createIntl, injectIntl } from 'react-intl-next';
6
7
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
8
  import { fireFailedMediaInlineEvent, fireSucceededMediaInlineEvent, MediaCardError } from '@atlaskit/media-card';
8
9
  import { FileFetcherError } from '@atlaskit/media-client';
9
10
  import { MediaClientContext } from '@atlaskit/media-client-react';
11
+ import { MediaViewer } from '@atlaskit/media-viewer';
12
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
13
  import { messages } from '../messages/media-inline-card';
11
14
  import { referenceHeights } from './constants';
12
15
  import { InlineImageCard } from './inline-image-card';
@@ -24,12 +27,14 @@ export const MediaInlineImageCardInternal = ({
24
27
  height,
25
28
  border,
26
29
  ssr,
27
- serializeDataAttrs
30
+ serializeDataAttrs,
31
+ shouldOpenMediaViewer
28
32
  }) => {
29
33
  const [fileState, setFileState] = useState();
30
34
  const [subscribeError, setSubscribeError] = useState();
31
35
  const [isFailedEventSent, setIsFailedEventSent] = useState(false);
32
36
  const [isSucceededEventSent, setIsSucceededEventSent] = useState(false);
37
+ const [isMediaViewerVisible, setMediaViewerVisible] = useState(false);
33
38
  const {
34
39
  formatMessage
35
40
  } = intl || createIntl({
@@ -159,13 +164,35 @@ export const MediaInlineImageCardInternal = ({
159
164
  }
160
165
  return {};
161
166
  }, [alt, fileState, height, identifier, width, serializeDataAttrs]);
162
- return jsx(InlineImageWrapper, {
167
+ const onMediaInlineImageClick = useCallback(() => {
168
+ if (shouldOpenMediaViewer && getBooleanFF('platform.editor.media.inline-image.renderer-preview-support_3w1ju')) {
169
+ setMediaViewerVisible(true);
170
+ }
171
+ }, [shouldOpenMediaViewer]);
172
+ const onMediaInlinePreviewClose = useCallback(() => {
173
+ setMediaViewerVisible(false);
174
+ }, []);
175
+ const mediaViewer = useMemo(() => {
176
+ if (isMediaViewerVisible && mediaClient !== null && mediaClient !== void 0 && mediaClient.mediaClientConfig) {
177
+ return /*#__PURE__*/ReactDOM.createPortal(jsx(MediaViewer, {
178
+ collectionName: identifier.collectionName || '',
179
+ items: [identifier],
180
+ mediaClientConfig: mediaClient === null || mediaClient === void 0 ? void 0 : mediaClient.mediaClientConfig,
181
+ selectedItem: identifier,
182
+ onClose: onMediaInlinePreviewClose
183
+ }), document.body);
184
+ }
185
+ return null;
186
+ }, [identifier, isMediaViewerVisible, mediaClient === null || mediaClient === void 0 ? void 0 : mediaClient.mediaClientConfig, onMediaInlinePreviewClose]);
187
+ return jsx(Fragment, null, jsx(InlineImageWrapper, {
163
188
  isSelected: isSelected,
189
+ isInteractive: getBooleanFF('platform.editor.media.inline-image.renderer-preview-support_3w1ju') && shouldOpenMediaViewer,
164
190
  aspectRatio: aspectRatio,
165
191
  borderColor: border === null || border === void 0 ? void 0 : border.borderColor,
166
192
  borderSize: border === null || border === void 0 ? void 0 : border.borderSize,
167
- htmlAttrs: htmlAttributes
168
- }, content(scaledDimension));
193
+ htmlAttrs: htmlAttributes,
194
+ onClick: onMediaInlineImageClick
195
+ }, content(scaledDimension)), mediaViewer);
169
196
  };
170
197
  export const MediaInlineImageCard = injectIntl(MediaInlineImageCardInternal, {
171
198
  enforceContext: false
@@ -71,6 +71,9 @@ export const selectedStyle = css({
71
71
  boxShadow: `0 0 0 1px ${`var(--ds-border-selected, ${B300})`}`,
72
72
  outline: 'none'
73
73
  });
74
+ export const interactiveStyle = css({
75
+ cursor: 'pointer'
76
+ });
74
77
  export const borderStyle = css({
75
78
  borderColor: `var(${INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY})`,
76
79
  borderStyle: 'solid',
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "78.4.0";
3
+ const packageVersion = "78.4.2";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
1
2
  import { css } from '@emotion/react';
2
3
  import { akEditorLineHeight, akEditorTableCellMinWidth } from '@atlaskit/editor-shared-styles';
3
4
  export const TaskDecisionSharedCssClassName = {
@@ -53,4 +54,11 @@ export const tasksAndDecisionsStyles = css`
53
54
  margin-top: ${"var(--ds-space-050, 4px)"};
54
55
  margin-left: ${"var(--ds-space-300, 24px)"};
55
56
  }
57
+
58
+ /* When action list is inside panel */
59
+ .ak-editor-panel__content {
60
+ > div[data-task-list-local-id]:first-child {
61
+ margin: 0 0 0 0 !important;
62
+ }
63
+ }
56
64
  `;
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
7
7
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
8
8
  import Layer from '../Layer';
9
9
  const packageName = "@atlaskit/editor-common";
10
- const packageVersion = "78.4.0";
10
+ const packageVersion = "78.4.2";
11
11
  const halfFocusRing = 1;
12
12
  const dropOffset = '0, 8';
13
13
  class DropList extends Component {
@@ -6,7 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
6
 
7
7
  import { css, jsx } from '@emotion/react';
8
8
  import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
9
- import { borderStyle, INLINE_IMAGE_ASPECT_RATIO_CSS_VAR_KEY, INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY, INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY, INLINE_IMAGE_WRAPPER_CLASS_NAME, selectedStyle, wrapperStyle } from './styles';
9
+ import { borderStyle, INLINE_IMAGE_ASPECT_RATIO_CSS_VAR_KEY, INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY, INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY, INLINE_IMAGE_WRAPPER_CLASS_NAME, interactiveStyle, selectedStyle, wrapperStyle } from './styles';
10
10
 
11
11
  // The MediaImage component needs to obtain its parent's dimensions.
12
12
  // To achieve this, we have added an additional wrapper that allows
@@ -21,11 +21,13 @@ export var InlineImageWrapper = function InlineImageWrapper(_ref) {
21
21
  var _ref2;
22
22
  var children = _ref.children,
23
23
  isSelected = _ref.isSelected,
24
+ isInteractive = _ref.isInteractive,
24
25
  aspectRatio = _ref.aspectRatio,
25
26
  borderSize = _ref.borderSize,
26
27
  borderColor = _ref.borderColor,
27
28
  _ref$htmlAttrs = _ref.htmlAttrs,
28
- htmlAttrs = _ref$htmlAttrs === void 0 ? {} : _ref$htmlAttrs;
29
+ htmlAttrs = _ref$htmlAttrs === void 0 ? {} : _ref$htmlAttrs,
30
+ onClick = _ref.onClick;
29
31
  var borderStyleVars = borderSize && borderColor ? (_ref2 = {}, _defineProperty(_ref2, INLINE_IMAGE_BORDER_SIZE_CSS_VAR_KEY, borderSize), _defineProperty(_ref2, INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY, hexToEditorBorderPaletteColor(borderColor) || borderColor), _ref2) : {};
30
32
  var aspectStyleVars = aspectRatio ? _defineProperty({}, INLINE_IMAGE_ASPECT_RATIO_CSS_VAR_KEY, aspectRatio) : {};
31
33
  return (
@@ -33,8 +35,9 @@ export var InlineImageWrapper = function InlineImageWrapper(_ref) {
33
35
  jsx("span", _extends({
34
36
  style: _objectSpread(_objectSpread({}, borderStyleVars), aspectStyleVars),
35
37
  className: INLINE_IMAGE_WRAPPER_CLASS_NAME,
36
- css: [wrapperStyle, borderSize && borderColor && borderStyle, isSelected && selectedStyle],
37
- "data-testid": "inline-image-wrapper"
38
+ css: [wrapperStyle, borderSize && borderColor && borderStyle, isSelected && selectedStyle, isInteractive && interactiveStyle],
39
+ "data-testid": "inline-image-wrapper",
40
+ onClick: onClick
38
41
  }, htmlAttrs), jsx("span", {
39
42
  css: sizeWrapperStyle
40
43
  }, children))
@@ -4,13 +4,16 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  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; }
5
5
  /** @jsx jsx */
6
6
 
7
- import { useEffect, useMemo, useState } from 'react';
7
+ import { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
8
8
  import { jsx } from '@emotion/react';
9
+ import ReactDOM from 'react-dom';
9
10
  import { createIntl, injectIntl } from 'react-intl-next';
10
11
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
11
12
  import { fireFailedMediaInlineEvent, fireSucceededMediaInlineEvent, MediaCardError } from '@atlaskit/media-card';
12
13
  import { FileFetcherError } from '@atlaskit/media-client';
13
14
  import { MediaClientContext } from '@atlaskit/media-client-react';
15
+ import { MediaViewer } from '@atlaskit/media-viewer';
16
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
17
  import { messages } from '../messages/media-inline-card';
15
18
  import { referenceHeights } from './constants';
16
19
  import { InlineImageCard } from './inline-image-card';
@@ -28,7 +31,8 @@ export var MediaInlineImageCardInternal = function MediaInlineImageCardInternal(
28
31
  height = _ref.height,
29
32
  border = _ref.border,
30
33
  ssr = _ref.ssr,
31
- serializeDataAttrs = _ref.serializeDataAttrs;
34
+ serializeDataAttrs = _ref.serializeDataAttrs,
35
+ shouldOpenMediaViewer = _ref.shouldOpenMediaViewer;
32
36
  var _useState = useState(),
33
37
  _useState2 = _slicedToArray(_useState, 2),
34
38
  fileState = _useState2[0],
@@ -45,6 +49,10 @@ export var MediaInlineImageCardInternal = function MediaInlineImageCardInternal(
45
49
  _useState8 = _slicedToArray(_useState7, 2),
46
50
  isSucceededEventSent = _useState8[0],
47
51
  setIsSucceededEventSent = _useState8[1];
52
+ var _useState9 = useState(false),
53
+ _useState10 = _slicedToArray(_useState9, 2),
54
+ isMediaViewerVisible = _useState10[0],
55
+ setMediaViewerVisible = _useState10[1];
48
56
  var _ref2 = intl || createIntl({
49
57
  locale: 'en'
50
58
  }),
@@ -177,13 +185,35 @@ export var MediaInlineImageCardInternal = function MediaInlineImageCardInternal(
177
185
  }
178
186
  return {};
179
187
  }, [alt, fileState, height, identifier, width, serializeDataAttrs]);
180
- return jsx(InlineImageWrapper, {
188
+ var onMediaInlineImageClick = useCallback(function () {
189
+ if (shouldOpenMediaViewer && getBooleanFF('platform.editor.media.inline-image.renderer-preview-support_3w1ju')) {
190
+ setMediaViewerVisible(true);
191
+ }
192
+ }, [shouldOpenMediaViewer]);
193
+ var onMediaInlinePreviewClose = useCallback(function () {
194
+ setMediaViewerVisible(false);
195
+ }, []);
196
+ var mediaViewer = useMemo(function () {
197
+ if (isMediaViewerVisible && mediaClient !== null && mediaClient !== void 0 && mediaClient.mediaClientConfig) {
198
+ return /*#__PURE__*/ReactDOM.createPortal(jsx(MediaViewer, {
199
+ collectionName: identifier.collectionName || '',
200
+ items: [identifier],
201
+ mediaClientConfig: mediaClient === null || mediaClient === void 0 ? void 0 : mediaClient.mediaClientConfig,
202
+ selectedItem: identifier,
203
+ onClose: onMediaInlinePreviewClose
204
+ }), document.body);
205
+ }
206
+ return null;
207
+ }, [identifier, isMediaViewerVisible, mediaClient === null || mediaClient === void 0 ? void 0 : mediaClient.mediaClientConfig, onMediaInlinePreviewClose]);
208
+ return jsx(Fragment, null, jsx(InlineImageWrapper, {
181
209
  isSelected: isSelected,
210
+ isInteractive: getBooleanFF('platform.editor.media.inline-image.renderer-preview-support_3w1ju') && shouldOpenMediaViewer,
182
211
  aspectRatio: aspectRatio,
183
212
  borderColor: border === null || border === void 0 ? void 0 : border.borderColor,
184
213
  borderSize: border === null || border === void 0 ? void 0 : border.borderSize,
185
- htmlAttrs: htmlAttributes
186
- }, content(scaledDimension));
214
+ htmlAttrs: htmlAttributes,
215
+ onClick: onMediaInlineImageClick
216
+ }, content(scaledDimension)), mediaViewer);
187
217
  };
188
218
  export var MediaInlineImageCard = injectIntl(MediaInlineImageCardInternal, {
189
219
  enforceContext: false
@@ -36,6 +36,9 @@ export var selectedStyle = css({
36
36
  boxShadow: "0 0 0 1px ".concat("var(--ds-border-selected, ".concat(B300, ")")),
37
37
  outline: 'none'
38
38
  });
39
+ export var interactiveStyle = css({
40
+ cursor: 'pointer'
41
+ });
39
42
  export var borderStyle = css({
40
43
  borderColor: "var(".concat(INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY, ")"),
41
44
  borderStyle: 'solid',
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
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; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "78.4.0";
9
+ var packageVersion = "78.4.2";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -1,5 +1,6 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
  var _templateObject;
3
+ /* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
3
4
  import { css } from '@emotion/react';
4
5
  import { akEditorLineHeight, akEditorTableCellMinWidth } from '@atlaskit/editor-shared-styles';
5
6
  export var TaskDecisionSharedCssClassName = {
@@ -7,4 +8,4 @@ export var TaskDecisionSharedCssClassName = {
7
8
  TASK_CONTAINER: 'taskItemView-content-wrap',
8
9
  TASK_ITEM: 'task-item'
9
10
  };
10
- export var tasksAndDecisionsStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n .taskItemView-content-wrap,\n .", " {\n position: relative;\n min-width: ", "px;\n }\n\n .", " {\n margin-top: 0;\n }\n\n .", " {\n span[contenteditable='false'] {\n height: ", "em;\n }\n }\n\n .", " {\n line-height: ", ";\n }\n }\n\n div[data-task-local-id] {\n span[contenteditable='false'] {\n height: ", "em;\n }\n span[contenteditable='false'] + div {\n line-height: ", "em;\n }\n }\n\n div[data-task-list-local-id] {\n margin: ", " 0 0 0;\n }\n\n div[data-task-list-local-id] {\n // If task item is not first in the list then set margin top to 4px.\n div + div {\n margin-top: ", ";\n }\n }\n\n // If task list is not first in the document then set margin top to 4px.\n div[data-task-list-local-id] div[data-task-list-local-id] {\n margin-top: ", ";\n margin-left: ", ";\n }\n"])), TaskDecisionSharedCssClassName.DECISION_CONTAINER, akEditorTableCellMinWidth, TaskDecisionSharedCssClassName.DECISION_CONTAINER, TaskDecisionSharedCssClassName.TASK_CONTAINER, akEditorLineHeight, TaskDecisionSharedCssClassName.TASK_ITEM, akEditorLineHeight, akEditorLineHeight, akEditorLineHeight, "var(--ds-space-150, 12px)", "var(--ds-space-050, 4px)", "var(--ds-space-050, 4px)", "var(--ds-space-300, 24px)");
11
+ export var tasksAndDecisionsStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n .taskItemView-content-wrap,\n .", " {\n position: relative;\n min-width: ", "px;\n }\n\n .", " {\n margin-top: 0;\n }\n\n .", " {\n span[contenteditable='false'] {\n height: ", "em;\n }\n }\n\n .", " {\n line-height: ", ";\n }\n }\n\n div[data-task-local-id] {\n span[contenteditable='false'] {\n height: ", "em;\n }\n span[contenteditable='false'] + div {\n line-height: ", "em;\n }\n }\n\n div[data-task-list-local-id] {\n margin: ", " 0 0 0;\n }\n\n div[data-task-list-local-id] {\n // If task item is not first in the list then set margin top to 4px.\n div + div {\n margin-top: ", ";\n }\n }\n\n // If task list is not first in the document then set margin top to 4px.\n div[data-task-list-local-id] div[data-task-list-local-id] {\n margin-top: ", ";\n margin-left: ", ";\n }\n\n /* When action list is inside panel */\n .ak-editor-panel__content {\n > div[data-task-list-local-id]:first-child {\n margin: 0 0 0 0 !important;\n }\n }\n"])), TaskDecisionSharedCssClassName.DECISION_CONTAINER, akEditorTableCellMinWidth, TaskDecisionSharedCssClassName.DECISION_CONTAINER, TaskDecisionSharedCssClassName.TASK_CONTAINER, akEditorLineHeight, TaskDecisionSharedCssClassName.TASK_ITEM, akEditorLineHeight, akEditorLineHeight, akEditorLineHeight, "var(--ds-space-150, 12px)", "var(--ds-space-050, 4px)", "var(--ds-space-050, 4px)", "var(--ds-space-300, 24px)");
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
17
17
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
18
18
  import Layer from '../Layer';
19
19
  var packageName = "@atlaskit/editor-common";
20
- var packageVersion = "78.4.0";
20
+ var packageVersion = "78.4.2";
21
21
  var halfFocusRing = 1;
22
22
  var dropOffset = '0, 8';
23
23
  var DropList = /*#__PURE__*/function (_Component) {
@@ -3,12 +3,14 @@ import type { FC, ReactElement } from 'react';
3
3
  type Props = {
4
4
  children: ReactElement;
5
5
  isSelected?: boolean;
6
+ isInteractive?: boolean;
6
7
  aspectRatio?: number | string;
7
8
  borderSize?: number;
8
9
  borderColor?: string;
9
10
  htmlAttrs?: {
10
11
  [key: string]: string | number | undefined;
11
12
  };
13
+ onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
12
14
  };
13
15
  export declare const InlineImageWrapper: FC<Props>;
14
16
  export {};
@@ -14,6 +14,7 @@ export interface MediaInlineImageCardProps {
14
14
  borderColor?: string;
15
15
  };
16
16
  ssr?: MediaSSR;
17
+ shouldOpenMediaViewer?: boolean;
17
18
  }
18
19
  export declare const MediaInlineImageCardInternal: FC<MediaInlineImageCardProps & WrappedComponentProps & MediaInlineAttrs>;
19
20
  export declare const MediaInlineImageCard: FC<MediaInlineImageCardProps & MediaInlineAttrs>;
@@ -11,4 +11,5 @@ export declare const INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY = "--editor-media-inl
11
11
  export declare const mediaInlineImageStyles: import("@emotion/react").SerializedStyles;
12
12
  export declare const wrapperStyle: import("@emotion/react").SerializedStyles;
13
13
  export declare const selectedStyle: import("@emotion/react").SerializedStyles;
14
+ export declare const interactiveStyle: import("@emotion/react").SerializedStyles;
14
15
  export declare const borderStyle: import("@emotion/react").SerializedStyles;
@@ -3,12 +3,14 @@ import type { FC, ReactElement } from 'react';
3
3
  type Props = {
4
4
  children: ReactElement;
5
5
  isSelected?: boolean;
6
+ isInteractive?: boolean;
6
7
  aspectRatio?: number | string;
7
8
  borderSize?: number;
8
9
  borderColor?: string;
9
10
  htmlAttrs?: {
10
11
  [key: string]: string | number | undefined;
11
12
  };
13
+ onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
12
14
  };
13
15
  export declare const InlineImageWrapper: FC<Props>;
14
16
  export {};
@@ -14,6 +14,7 @@ export interface MediaInlineImageCardProps {
14
14
  borderColor?: string;
15
15
  };
16
16
  ssr?: MediaSSR;
17
+ shouldOpenMediaViewer?: boolean;
17
18
  }
18
19
  export declare const MediaInlineImageCardInternal: FC<MediaInlineImageCardProps & WrappedComponentProps & MediaInlineAttrs>;
19
20
  export declare const MediaInlineImageCard: FC<MediaInlineImageCardProps & MediaInlineAttrs>;
@@ -11,4 +11,5 @@ export declare const INLINE_IMAGE_BORDER_COLOR_CSS_VAR_KEY = "--editor-media-inl
11
11
  export declare const mediaInlineImageStyles: import("@emotion/react").SerializedStyles;
12
12
  export declare const wrapperStyle: import("@emotion/react").SerializedStyles;
13
13
  export declare const selectedStyle: import("@emotion/react").SerializedStyles;
14
+ export declare const interactiveStyle: import("@emotion/react").SerializedStyles;
14
15
  export declare const borderStyle: import("@emotion/react").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "78.4.0",
3
+ "version": "78.4.2",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -120,6 +120,7 @@
120
120
  "@atlaskit/media-file-preview": "^0.5.0",
121
121
  "@atlaskit/media-picker": "^66.3.0",
122
122
  "@atlaskit/media-ui": "^25.0.0",
123
+ "@atlaskit/media-viewer": "48.2.15",
123
124
  "@atlaskit/mention": "^23.0.0",
124
125
  "@atlaskit/menu": "^2.1.0",
125
126
  "@atlaskit/platform-feature-flags": "^0.2.0",
@@ -214,6 +215,9 @@
214
215
  "platform.editor.media.inline-image.base-support": {
215
216
  "type": "boolean"
216
217
  },
218
+ "platform.editor.media.inline-image.renderer-preview-support_3w1ju": {
219
+ "type": "boolean"
220
+ },
217
221
  "platform.linking-platform.datasource-assets_objects": {
218
222
  "type": "boolean"
219
223
  },