@atlaskit/editor-plugin-card 2.8.2 → 2.9.1

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,22 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 2.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.9.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`aef5432662b58`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/aef5432662b58) -
14
+ [ux] EDM-10363 Implement opening links via configure overlay dropdown open link button
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 2.8.2
4
21
 
5
22
  ### Patch Changes
@@ -12,6 +12,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
14
14
  var _hooks = require("@atlaskit/editor-common/hooks");
15
+ var _link = require("@atlaskit/editor-common/link");
15
16
  var _ui = require("@atlaskit/editor-common/ui");
16
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _smartCard = require("@atlaskit/smart-card");
@@ -144,7 +145,16 @@ function InlineCardNodeView(props) {
144
145
  return (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? inlineCard : /*#__PURE__*/_react.default.createElement(_ConfigureOverlay.default, {
145
146
  targetElementPos: getPos(),
146
147
  view: view,
147
- isHoveredCallback: setIsOverlayHovered
148
+ isHoveredCallback: setIsOverlayHovered,
149
+ onOpenLinkClick: function onOpenLinkClick(event) {
150
+ var _pluginInjectionApi$a;
151
+ (0, _link.handleNavigation)({
152
+ fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.fireAnalyticsEvent,
153
+ onClickCallback: onClickCallback,
154
+ url: node.attrs.url,
155
+ event: event
156
+ });
157
+ }
148
158
  }, inlineCard);
149
159
  }
150
160
  return /*#__PURE__*/_react.default.createElement(WrappedInlineCardWithAwareness, (0, _extends2.default)({
@@ -25,7 +25,8 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
25
25
  var view = _ref.view,
26
26
  targetElementPos = _ref.targetElementPos,
27
27
  children = _ref.children,
28
- hoverCallback = _ref.isHoveredCallback;
28
+ hoverCallback = _ref.isHoveredCallback,
29
+ onOpenLinkClick = _ref.onOpenLinkClick;
29
30
  var _useState = (0, _react.useState)(false),
30
31
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
31
32
  showConfigureButton = _useState2[0],
@@ -57,7 +58,8 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
57
58
  }, showConfigureButton && (0, _react2.jsx)(_link.OverlayButton, {
58
59
  editorView: view,
59
60
  targetElementPos: targetElementPos,
60
- onDropdownChange: onDropdownChange
61
+ onDropdownChange: onDropdownChange,
62
+ onOpenLinkClick: onOpenLinkClick
61
63
  })), children);
62
64
  };
63
65
  var _default = exports.default = OverlayWrapper;
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { memo, useCallback, useMemo, useState } from 'react';
3
3
  import rafSchedule from 'raf-schd';
4
4
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
+ import { handleNavigation } from '@atlaskit/editor-common/link';
5
6
  import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
6
7
  import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { Card as SmartCard } from '@atlaskit/smart-card';
@@ -134,7 +135,16 @@ export function InlineCardNodeView(props) {
134
135
  return (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? inlineCard : /*#__PURE__*/React.createElement(OverlayWrapper, {
135
136
  targetElementPos: getPos(),
136
137
  view: view,
137
- isHoveredCallback: setIsOverlayHovered
138
+ isHoveredCallback: setIsOverlayHovered,
139
+ onOpenLinkClick: event => {
140
+ var _pluginInjectionApi$a;
141
+ handleNavigation({
142
+ fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.fireAnalyticsEvent,
143
+ onClickCallback,
144
+ url: node.attrs.url,
145
+ event
146
+ });
147
+ }
138
148
  }, inlineCard);
139
149
  }
140
150
  return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, _extends({
@@ -16,7 +16,8 @@ const OverlayWrapper = ({
16
16
  view,
17
17
  targetElementPos,
18
18
  children,
19
- isHoveredCallback: hoverCallback
19
+ isHoveredCallback: hoverCallback,
20
+ onOpenLinkClick
20
21
  }) => {
21
22
  const [showConfigureButton, setShowConfigureButton] = useState(false);
22
23
  const [dropdownOpen, setDropdownOpen] = useState(false);
@@ -43,7 +44,8 @@ const OverlayWrapper = ({
43
44
  }, showConfigureButton && jsx(OverlayButton, {
44
45
  editorView: view,
45
46
  targetElementPos: targetElementPos,
46
- onDropdownChange: onDropdownChange
47
+ onDropdownChange: onDropdownChange,
48
+ onOpenLinkClick: onOpenLinkClick
47
49
  })), children);
48
50
  };
49
51
  export default OverlayWrapper;
@@ -3,6 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import React, { memo, useCallback, useMemo, useState } from 'react';
4
4
  import rafSchedule from 'raf-schd';
5
5
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
+ import { handleNavigation } from '@atlaskit/editor-common/link';
6
7
  import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
7
8
  import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { Card as SmartCard } from '@atlaskit/smart-card';
@@ -133,7 +134,16 @@ export function InlineCardNodeView(props) {
133
134
  return (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? inlineCard : /*#__PURE__*/React.createElement(OverlayWrapper, {
134
135
  targetElementPos: getPos(),
135
136
  view: view,
136
- isHoveredCallback: setIsOverlayHovered
137
+ isHoveredCallback: setIsOverlayHovered,
138
+ onOpenLinkClick: function onOpenLinkClick(event) {
139
+ var _pluginInjectionApi$a;
140
+ handleNavigation({
141
+ fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.fireAnalyticsEvent,
142
+ onClickCallback: onClickCallback,
143
+ url: node.attrs.url,
144
+ event: event
145
+ });
146
+ }
137
147
  }, inlineCard);
138
148
  }
139
149
  return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, _extends({
@@ -17,7 +17,8 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
17
17
  var view = _ref.view,
18
18
  targetElementPos = _ref.targetElementPos,
19
19
  children = _ref.children,
20
- hoverCallback = _ref.isHoveredCallback;
20
+ hoverCallback = _ref.isHoveredCallback,
21
+ onOpenLinkClick = _ref.onOpenLinkClick;
21
22
  var _useState = useState(false),
22
23
  _useState2 = _slicedToArray(_useState, 2),
23
24
  showConfigureButton = _useState2[0],
@@ -49,7 +50,8 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
49
50
  }, showConfigureButton && jsx(OverlayButton, {
50
51
  editorView: view,
51
52
  targetElementPos: targetElementPos,
52
- onDropdownChange: onDropdownChange
53
+ onDropdownChange: onDropdownChange,
54
+ onOpenLinkClick: onOpenLinkClick
53
55
  })), children);
54
56
  };
55
57
  export default OverlayWrapper;
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { jsx } from '@emotion/react';
3
3
  import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
- declare const OverlayWrapper: ({ view, targetElementPos, children, isHoveredCallback: hoverCallback, }: {
4
+ declare const OverlayWrapper: ({ view, targetElementPos, children, isHoveredCallback: hoverCallback, onOpenLinkClick, }: {
5
5
  view: EditorView;
6
6
  targetElementPos: number | undefined;
7
7
  children: JSX.Element;
8
8
  /** Fired when the mouse enters or leaves the overlay button */
9
9
  isHoveredCallback: (isHovered: boolean) => void;
10
+ onOpenLinkClick: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
10
11
  }) => jsx.JSX.Element;
11
12
  export default OverlayWrapper;
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { jsx } from '@emotion/react';
3
3
  import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
- declare const OverlayWrapper: ({ view, targetElementPos, children, isHoveredCallback: hoverCallback, }: {
4
+ declare const OverlayWrapper: ({ view, targetElementPos, children, isHoveredCallback: hoverCallback, onOpenLinkClick, }: {
5
5
  view: EditorView;
6
6
  targetElementPos: number | undefined;
7
7
  children: JSX.Element;
8
8
  /** Fired when the mouse enters or leaves the overlay button */
9
9
  isHoveredCallback: (isHovered: boolean) => void;
10
+ onOpenLinkClick: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
10
11
  }) => jsx.JSX.Element;
11
12
  export default OverlayWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "2.8.2",
3
+ "version": "2.9.1",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/adf-schema": "^40.3.0",
36
36
  "@atlaskit/analytics-next": "^9.3.0",
37
37
  "@atlaskit/custom-steps": "^0.6.0",
38
- "@atlaskit/editor-common": "^87.0.0",
38
+ "@atlaskit/editor-common": "^87.2.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.6.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^1.2.0",
41
41
  "@atlaskit/editor-plugin-editor-disabled": "^1.2.0",
@@ -47,13 +47,13 @@
47
47
  "@atlaskit/editor-prosemirror": "5.0.1",
48
48
  "@atlaskit/editor-shared-styles": "^2.13.0",
49
49
  "@atlaskit/frontend-utilities": "^2.7.0",
50
- "@atlaskit/icon": "^22.7.0",
50
+ "@atlaskit/icon": "^22.8.0",
51
51
  "@atlaskit/link-analytics": "^8.3.0",
52
52
  "@atlaskit/link-client-extension": "^1.10.0",
53
53
  "@atlaskit/link-datasource": "^2.9.0",
54
- "@atlaskit/linking-common": "^5.7.0",
54
+ "@atlaskit/linking-common": "^5.8.0",
55
55
  "@atlaskit/linking-types": "^8.12.0",
56
- "@atlaskit/menu": "2.8.1",
56
+ "@atlaskit/menu": "2.9.0",
57
57
  "@atlaskit/platform-feature-flags": "^0.3.0",
58
58
  "@atlaskit/primitives": "^11.1.0",
59
59
  "@atlaskit/smart-card": "^27.11.0",
@@ -66,7 +66,7 @@
66
66
  "raf-schd": "^4.0.3"
67
67
  },
68
68
  "peerDependencies": {
69
- "@atlaskit/link-provider": "^1.13.0",
69
+ "@atlaskit/link-provider": "^1.14.0",
70
70
  "react": "^16.8.0",
71
71
  "react-intl-next": "npm:react-intl@^5.18.1"
72
72
  },