@atlaskit/editor-plugin-card 11.4.5 → 11.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 11.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e5c510a42227e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e5c510a42227e) -
8
+ [ux] Disable preview modals within preview panels
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 11.4.5
4
15
 
5
16
  ### Patch Changes
@@ -13,6 +13,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
13
13
  var _ui = require("@atlaskit/editor-common/ui");
14
14
  var _state = require("@atlaskit/editor-prosemirror/state");
15
15
  var _linkExtractors = require("@atlaskit/link-extractors");
16
+ var _utils = require("@atlaskit/linking-common/utils");
16
17
  var _smartCard = require("@atlaskit/smart-card");
17
18
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
18
19
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
@@ -185,6 +186,9 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
185
186
  // In view mode we show HoverLinkOverlay only with if preview mode or panel is available
186
187
  // otherwise a use can click on smartlink itself to open the link in a new tab.
187
188
  var isPreviewAvailable = isPreviewPanelAvailable || isPreviewModalAvailable;
189
+ // When inside preview panel iframe, hide the overlay button
190
+ var isInPreviewPanel = (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel_modal', 'cohort', 'test') && (0, _utils.isWithinPreviewPanelIFrame)();
191
+ var showPanelButton = isInPreviewPanel ? isPreviewPanelAvailable : isPreviewAvailable;
188
192
  if (isPreviewAvailable) {
189
193
  var _pluginInjectionApi$a4;
190
194
  return /*#__PURE__*/_react.default.createElement(_ui.HoverLinkOverlay, {
@@ -193,7 +197,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
193
197
  compactPadding: editorAppearance === 'comment' || editorAppearance === 'chromeless',
194
198
  editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions,
195
199
  view: view,
196
- showPanelButton: isPreviewAvailable,
200
+ showPanelButton: showPanelButton,
197
201
  showPanelButtonIcon: isPreviewAvailable && isPreviewPanelAvailable ? 'panel' : 'modal',
198
202
  onClick: function onClick(event) {
199
203
  if (isPreviewPanelAvailable) {
@@ -41,31 +41,28 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
41
41
  setShowConfigureButton(false);
42
42
  }
43
43
  }, []);
44
- return (
45
- // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
46
- (0, _react2.jsx)("span", {
47
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
48
- onMouseEnter: function onMouseEnter() {
49
- setShowConfigureButton(true);
50
- hoverCallback(true);
44
+ return (0, _react2.jsx)("span", {
45
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
46
+ onMouseEnter: function onMouseEnter() {
47
+ setShowConfigureButton(true);
48
+ hoverCallback(true);
49
+ }
50
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
51
+ ,
52
+ onMouseLeave: function onMouseLeave() {
53
+ if (!dropdownOpen) {
54
+ setShowConfigureButton(false);
55
+ hoverCallback(false);
51
56
  }
52
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
53
- ,
54
- onMouseLeave: function onMouseLeave() {
55
- if (!dropdownOpen) {
56
- setShowConfigureButton(false);
57
- hoverCallback(false);
58
- }
59
- },
60
- "data-testid": "inline-card-overlay-wrapper"
61
- }, (0, _react2.jsx)("span", {
62
- css: ConfigureOverlayWrapperStyles
63
- }, showConfigureButton && (0, _react2.jsx)(_link.OverlayButton, {
64
- editorView: view,
65
- targetElementPos: targetElementPos,
66
- onDropdownChange: onDropdownChange,
67
- onOpenLinkClick: onOpenLinkClick
68
- })), children)
69
- );
57
+ },
58
+ "data-testid": "inline-card-overlay-wrapper"
59
+ }, (0, _react2.jsx)("span", {
60
+ css: ConfigureOverlayWrapperStyles
61
+ }, showConfigureButton && (0, _react2.jsx)(_link.OverlayButton, {
62
+ editorView: view,
63
+ targetElementPos: targetElementPos,
64
+ onDropdownChange: onDropdownChange,
65
+ onOpenLinkClick: onOpenLinkClick
66
+ })), children);
70
67
  };
71
68
  var _default = exports.default = OverlayWrapper;
@@ -4,6 +4,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
4
4
  import { HoverLinkOverlay } from '@atlaskit/editor-common/ui';
5
5
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { extractSmartLinkEmbed } from '@atlaskit/link-extractors';
7
+ import { isWithinPreviewPanelIFrame } from '@atlaskit/linking-common/utils';
7
8
  import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
8
9
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -164,6 +165,9 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
164
165
  // In view mode we show HoverLinkOverlay only with if preview mode or panel is available
165
166
  // otherwise a use can click on smartlink itself to open the link in a new tab.
166
167
  const isPreviewAvailable = isPreviewPanelAvailable || isPreviewModalAvailable;
168
+ // When inside preview panel iframe, hide the overlay button
169
+ const isInPreviewPanel = expValEquals('platform_hover_card_preview_panel_modal', 'cohort', 'test') && isWithinPreviewPanelIFrame();
170
+ const showPanelButton = isInPreviewPanel ? isPreviewPanelAvailable : isPreviewAvailable;
167
171
  if (isPreviewAvailable) {
168
172
  var _pluginInjectionApi$a5;
169
173
  return /*#__PURE__*/React.createElement(HoverLinkOverlay, {
@@ -172,7 +176,7 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
172
176
  compactPadding: editorAppearance === 'comment' || editorAppearance === 'chromeless',
173
177
  editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions,
174
178
  view: view,
175
- showPanelButton: isPreviewAvailable,
179
+ showPanelButton: showPanelButton,
176
180
  showPanelButtonIcon: isPreviewAvailable && isPreviewPanelAvailable ? 'panel' : 'modal',
177
181
  onClick: event => {
178
182
  if (isPreviewPanelAvailable) {
@@ -27,31 +27,28 @@ const OverlayWrapper = ({
27
27
  setShowConfigureButton(false);
28
28
  }
29
29
  }, []);
30
- return (
31
- // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
32
- jsx("span", {
33
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
34
- onMouseEnter: () => {
35
- setShowConfigureButton(true);
36
- hoverCallback(true);
30
+ return jsx("span", {
31
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
32
+ onMouseEnter: () => {
33
+ setShowConfigureButton(true);
34
+ hoverCallback(true);
35
+ }
36
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
37
+ ,
38
+ onMouseLeave: () => {
39
+ if (!dropdownOpen) {
40
+ setShowConfigureButton(false);
41
+ hoverCallback(false);
37
42
  }
38
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
39
- ,
40
- onMouseLeave: () => {
41
- if (!dropdownOpen) {
42
- setShowConfigureButton(false);
43
- hoverCallback(false);
44
- }
45
- },
46
- "data-testid": "inline-card-overlay-wrapper"
47
- }, jsx("span", {
48
- css: ConfigureOverlayWrapperStyles
49
- }, showConfigureButton && jsx(OverlayButton, {
50
- editorView: view,
51
- targetElementPos: targetElementPos,
52
- onDropdownChange: onDropdownChange,
53
- onOpenLinkClick: onOpenLinkClick
54
- })), children)
55
- );
43
+ },
44
+ "data-testid": "inline-card-overlay-wrapper"
45
+ }, jsx("span", {
46
+ css: ConfigureOverlayWrapperStyles
47
+ }, showConfigureButton && jsx(OverlayButton, {
48
+ editorView: view,
49
+ targetElementPos: targetElementPos,
50
+ onDropdownChange: onDropdownChange,
51
+ onOpenLinkClick: onOpenLinkClick
52
+ })), children);
56
53
  };
57
54
  export default OverlayWrapper;
@@ -5,6 +5,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
5
5
  import { HoverLinkOverlay } from '@atlaskit/editor-common/ui';
6
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { extractSmartLinkEmbed } from '@atlaskit/link-extractors';
8
+ import { isWithinPreviewPanelIFrame } from '@atlaskit/linking-common/utils';
8
9
  import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
9
10
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
11
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -176,6 +177,9 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
176
177
  // In view mode we show HoverLinkOverlay only with if preview mode or panel is available
177
178
  // otherwise a use can click on smartlink itself to open the link in a new tab.
178
179
  var isPreviewAvailable = isPreviewPanelAvailable || isPreviewModalAvailable;
180
+ // When inside preview panel iframe, hide the overlay button
181
+ var isInPreviewPanel = expValEquals('platform_hover_card_preview_panel_modal', 'cohort', 'test') && isWithinPreviewPanelIFrame();
182
+ var showPanelButton = isInPreviewPanel ? isPreviewPanelAvailable : isPreviewAvailable;
179
183
  if (isPreviewAvailable) {
180
184
  var _pluginInjectionApi$a4;
181
185
  return /*#__PURE__*/React.createElement(HoverLinkOverlay, {
@@ -184,7 +188,7 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
184
188
  compactPadding: editorAppearance === 'comment' || editorAppearance === 'chromeless',
185
189
  editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions,
186
190
  view: view,
187
- showPanelButton: isPreviewAvailable,
191
+ showPanelButton: showPanelButton,
188
192
  showPanelButtonIcon: isPreviewAvailable && isPreviewPanelAvailable ? 'panel' : 'modal',
189
193
  onClick: function onClick(event) {
190
194
  if (isPreviewPanelAvailable) {
@@ -33,31 +33,28 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
33
33
  setShowConfigureButton(false);
34
34
  }
35
35
  }, []);
36
- return (
37
- // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
38
- jsx("span", {
39
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
40
- onMouseEnter: function onMouseEnter() {
41
- setShowConfigureButton(true);
42
- hoverCallback(true);
36
+ return jsx("span", {
37
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
38
+ onMouseEnter: function onMouseEnter() {
39
+ setShowConfigureButton(true);
40
+ hoverCallback(true);
41
+ }
42
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
43
+ ,
44
+ onMouseLeave: function onMouseLeave() {
45
+ if (!dropdownOpen) {
46
+ setShowConfigureButton(false);
47
+ hoverCallback(false);
43
48
  }
44
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
45
- ,
46
- onMouseLeave: function onMouseLeave() {
47
- if (!dropdownOpen) {
48
- setShowConfigureButton(false);
49
- hoverCallback(false);
50
- }
51
- },
52
- "data-testid": "inline-card-overlay-wrapper"
53
- }, jsx("span", {
54
- css: ConfigureOverlayWrapperStyles
55
- }, showConfigureButton && jsx(OverlayButton, {
56
- editorView: view,
57
- targetElementPos: targetElementPos,
58
- onDropdownChange: onDropdownChange,
59
- onOpenLinkClick: onOpenLinkClick
60
- })), children)
61
- );
49
+ },
50
+ "data-testid": "inline-card-overlay-wrapper"
51
+ }, jsx("span", {
52
+ css: ConfigureOverlayWrapperStyles
53
+ }, showConfigureButton && jsx(OverlayButton, {
54
+ editorView: view,
55
+ targetElementPos: targetElementPos,
56
+ onDropdownChange: onDropdownChange,
57
+ onOpenLinkClick: onOpenLinkClick
58
+ })), children);
62
59
  };
63
60
  export default OverlayWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "11.4.5",
3
+ "version": "11.5.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -52,19 +52,19 @@
52
52
  "@atlaskit/link": "^3.2.0",
53
53
  "@atlaskit/link-analytics": "^11.0.0",
54
54
  "@atlaskit/link-client-extension": "^6.0.0",
55
- "@atlaskit/link-datasource": "^4.27.0",
55
+ "@atlaskit/link-datasource": "^4.29.0",
56
56
  "@atlaskit/link-extractors": "^2.4.0",
57
- "@atlaskit/linking-common": "^9.7.0",
57
+ "@atlaskit/linking-common": "^9.8.0",
58
58
  "@atlaskit/linking-types": "^14.1.0",
59
59
  "@atlaskit/menu": "^8.4.0",
60
60
  "@atlaskit/platform-feature-flags": "^1.1.0",
61
61
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
62
- "@atlaskit/primitives": "^16.0.0",
62
+ "@atlaskit/primitives": "^16.1.0",
63
63
  "@atlaskit/prosemirror-history": "^0.2.0",
64
- "@atlaskit/smart-card": "^43.4.0",
64
+ "@atlaskit/smart-card": "^43.6.0",
65
65
  "@atlaskit/theme": "^21.0.0",
66
- "@atlaskit/tmp-editor-statsig": "^13.19.0",
67
- "@atlaskit/tokens": "^7.0.0",
66
+ "@atlaskit/tmp-editor-statsig": "^13.28.0",
67
+ "@atlaskit/tokens": "^7.1.0",
68
68
  "@babel/runtime": "^7.0.0",
69
69
  "@emotion/react": "^11.7.1",
70
70
  "lodash": "^4.17.21",
@@ -73,7 +73,7 @@
73
73
  "uuid": "^3.1.0"
74
74
  },
75
75
  "peerDependencies": {
76
- "@atlaskit/editor-common": "^110.18.0",
76
+ "@atlaskit/editor-common": "^110.22.0",
77
77
  "@atlaskit/link-provider": "^4.0.0",
78
78
  "react": "^18.2.0",
79
79
  "react-intl-next": "npm:react-intl@^5.18.1"