@atlaskit/editor-plugin-card 0.13.2 → 0.13.3
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 +6 -0
- package/dist/cjs/common/hooks/useLinkUpgradeDiscoverability.js +1 -2
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +11 -18
- package/dist/es2019/common/hooks/useLinkUpgradeDiscoverability.js +2 -3
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +10 -13
- package/dist/esm/common/hooks/useLinkUpgradeDiscoverability.js +2 -3
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +11 -18
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 0.13.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#43175](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43175) [`a72cac2bc28`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a72cac2bc28) - [ux] Added a check for showLinkOverlay for hover/unhover scenarios
|
|
8
|
+
|
|
3
9
|
## 0.13.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -39,9 +39,8 @@ var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref)
|
|
|
39
39
|
}, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.extractors, url, urlState === null || urlState === void 0 ? void 0 : urlState.status]);
|
|
40
40
|
var shouldShowLinkPulse = (0, _react.useMemo)(function () {
|
|
41
41
|
var _pluginInjectionApi$c;
|
|
42
|
-
var isKeyDiscovered = (0, _localStorage.isLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
43
42
|
var awarenessCandidatePosition = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.inlineCardAwarenessCandidatePosition;
|
|
44
|
-
return isPulseEnabled &&
|
|
43
|
+
return isPulseEnabled && linkPosition === awarenessCandidatePosition && canBeUpgradedToEmbed;
|
|
45
44
|
}, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.sharedState]);
|
|
46
45
|
var shouldShowLinkOverlay = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved' && isOverlayEnabled;
|
|
47
46
|
var shouldShowToolbarPulse = (0, _react.useMemo)(function () {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.InlineCardWithAwareness = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _react = require("react");
|
|
10
11
|
var _react2 = require("@emotion/react");
|
|
@@ -61,7 +62,8 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
61
62
|
isOverlayEnabled: isOverlayEnabled,
|
|
62
63
|
isPulseEnabled: isPulseEnabled
|
|
63
64
|
}),
|
|
64
|
-
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse
|
|
65
|
+
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse,
|
|
66
|
+
shouldShowLinkOverlay = _useLinkUpgradeDiscov.shouldShowLinkOverlay;
|
|
65
67
|
var scrollContainer = (0, _react.useMemo)(function () {
|
|
66
68
|
return (0, _ui.findOverflowScrollParent)(view.dom) || undefined;
|
|
67
69
|
}, [view.dom]);
|
|
@@ -113,32 +115,23 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
113
115
|
showServerActions: showServerActions
|
|
114
116
|
}));
|
|
115
117
|
}, [data, isOverlayVisible, onError, onResolve, scrollContainer, showServerActions, url, useAlternativePreloader]);
|
|
116
|
-
|
|
117
|
-
// TODO: add proper show/hide conditions for overlay in EDM-8239
|
|
118
118
|
var card = (0, _react.useMemo)(function () {
|
|
119
|
-
return
|
|
119
|
+
return (0, _react2.jsx)("span", (0, _extends2.default)({
|
|
120
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
121
|
+
className: "card"
|
|
122
|
+
}, shouldShowLinkOverlay ? {
|
|
120
123
|
onMouseEnter: function onMouseEnter() {
|
|
121
124
|
return setIsOverlayVisible(true);
|
|
122
125
|
},
|
|
123
126
|
onMouseLeave: function onMouseLeave() {
|
|
124
127
|
return setIsOverlayVisible(false);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
className: "card"
|
|
128
|
-
}, (0, _react2.jsx)(_pulse.DiscoveryPulse, {
|
|
128
|
+
}
|
|
129
|
+
} : {}), shouldShowLinkPulse ? (0, _react2.jsx)(_pulse.DiscoveryPulse, {
|
|
129
130
|
localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
130
131
|
localStorageKeyExpirationInMs: _localStorage.ONE_DAY_IN_MILLISECONDS,
|
|
131
132
|
discoveryMode: 'start'
|
|
132
|
-
}, innerCard)
|
|
133
|
-
|
|
134
|
-
return setIsOverlayVisible(true);
|
|
135
|
-
},
|
|
136
|
-
onMouseLeave: function onMouseLeave() {
|
|
137
|
-
return setIsOverlayVisible(false);
|
|
138
|
-
},
|
|
139
|
-
className: "card"
|
|
140
|
-
}, innerCard);
|
|
141
|
-
}, [innerCard, shouldShowLinkPulse]);
|
|
133
|
+
}, innerCard) : innerCard);
|
|
134
|
+
}, [shouldShowLinkPulse, shouldShowLinkOverlay, innerCard]);
|
|
142
135
|
|
|
143
136
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
144
137
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { isLocalStorageKeyDiscovered,
|
|
2
|
+
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from '../local-storage';
|
|
3
3
|
const useLinkUpgradeDiscoverability = ({
|
|
4
4
|
url,
|
|
5
5
|
linkPosition,
|
|
@@ -29,9 +29,8 @@ const useLinkUpgradeDiscoverability = ({
|
|
|
29
29
|
}, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.extractors, url, urlState === null || urlState === void 0 ? void 0 : urlState.status]);
|
|
30
30
|
const shouldShowLinkPulse = useMemo(() => {
|
|
31
31
|
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$c3;
|
|
32
|
-
const isKeyDiscovered = isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
33
32
|
const awarenessCandidatePosition = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : (_pluginInjectionApi$c3 = _pluginInjectionApi$c2.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.inlineCardAwarenessCandidatePosition;
|
|
34
|
-
return isPulseEnabled &&
|
|
33
|
+
return isPulseEnabled && linkPosition === awarenessCandidatePosition && canBeUpgradedToEmbed;
|
|
35
34
|
}, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.card) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.sharedState]);
|
|
36
35
|
const shouldShowLinkOverlay = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved' && isOverlayEnabled;
|
|
37
36
|
const shouldShowToolbarPulse = useMemo(() => isPulseEnabled && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR) && canBeUpgradedToEmbed, [canBeUpgradedToEmbed, isPulseEnabled]);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
/** @jsx jsx */
|
|
2
3
|
import { memo, useCallback, useMemo, useState } from 'react';
|
|
3
4
|
import { css, jsx } from '@emotion/react';
|
|
@@ -44,7 +45,8 @@ const InlineCard = ({
|
|
|
44
45
|
return typeof pos === 'number' ? pos : undefined;
|
|
45
46
|
}, [getPos]);
|
|
46
47
|
const {
|
|
47
|
-
shouldShowLinkPulse
|
|
48
|
+
shouldShowLinkPulse,
|
|
49
|
+
shouldShowLinkOverlay
|
|
48
50
|
} = useLinkUpgradeDiscoverability({
|
|
49
51
|
url,
|
|
50
52
|
linkPosition: linkPosition || -1,
|
|
@@ -104,22 +106,17 @@ const InlineCard = ({
|
|
|
104
106
|
inlinePreloaderStyle: useAlternativePreloader ? 'on-right-without-skeleton' : undefined,
|
|
105
107
|
showServerActions: showServerActions
|
|
106
108
|
})), [data, isOverlayVisible, onError, onResolve, scrollContainer, showServerActions, url, useAlternativePreloader]);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const card = useMemo(() => shouldShowLinkPulse ? jsx("span", {
|
|
110
|
-
onMouseEnter: () => setIsOverlayVisible(true),
|
|
111
|
-
onMouseLeave: () => setIsOverlayVisible(false),
|
|
112
|
-
css: loaderWrapperStyles,
|
|
109
|
+
const card = useMemo(() => jsx("span", _extends({
|
|
110
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
113
111
|
className: "card"
|
|
114
|
-
},
|
|
112
|
+
}, shouldShowLinkOverlay ? {
|
|
113
|
+
onMouseEnter: () => setIsOverlayVisible(true),
|
|
114
|
+
onMouseLeave: () => setIsOverlayVisible(false)
|
|
115
|
+
} : {}), shouldShowLinkPulse ? jsx(DiscoveryPulse, {
|
|
115
116
|
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
116
117
|
localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
|
|
117
118
|
discoveryMode: 'start'
|
|
118
|
-
}, innerCard)
|
|
119
|
-
onMouseEnter: () => setIsOverlayVisible(true),
|
|
120
|
-
onMouseLeave: () => setIsOverlayVisible(false),
|
|
121
|
-
className: "card"
|
|
122
|
-
}, innerCard), [innerCard, shouldShowLinkPulse]);
|
|
119
|
+
}, innerCard) : innerCard), [shouldShowLinkPulse, shouldShowLinkOverlay, innerCard]);
|
|
123
120
|
|
|
124
121
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
125
122
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { isLocalStorageKeyDiscovered,
|
|
3
|
+
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from '../local-storage';
|
|
4
4
|
var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref) {
|
|
5
5
|
var _cardContext$store, _pluginInjectionApi$c2;
|
|
6
6
|
var url = _ref.url,
|
|
@@ -32,9 +32,8 @@ var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref)
|
|
|
32
32
|
}, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.extractors, url, urlState === null || urlState === void 0 ? void 0 : urlState.status]);
|
|
33
33
|
var shouldShowLinkPulse = useMemo(function () {
|
|
34
34
|
var _pluginInjectionApi$c;
|
|
35
|
-
var isKeyDiscovered = isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
36
35
|
var awarenessCandidatePosition = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.inlineCardAwarenessCandidatePosition;
|
|
37
|
-
return isPulseEnabled &&
|
|
36
|
+
return isPulseEnabled && linkPosition === awarenessCandidatePosition && canBeUpgradedToEmbed;
|
|
38
37
|
}, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.sharedState]);
|
|
39
38
|
var shouldShowLinkOverlay = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved' && isOverlayEnabled;
|
|
40
39
|
var shouldShowToolbarPulse = useMemo(function () {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
import { memo, useCallback, useMemo, useState } from 'react';
|
|
@@ -53,7 +54,8 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
53
54
|
isOverlayEnabled: isOverlayEnabled,
|
|
54
55
|
isPulseEnabled: isPulseEnabled
|
|
55
56
|
}),
|
|
56
|
-
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse
|
|
57
|
+
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse,
|
|
58
|
+
shouldShowLinkOverlay = _useLinkUpgradeDiscov.shouldShowLinkOverlay;
|
|
57
59
|
var scrollContainer = useMemo(function () {
|
|
58
60
|
return findOverflowScrollParent(view.dom) || undefined;
|
|
59
61
|
}, [view.dom]);
|
|
@@ -105,32 +107,23 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
105
107
|
showServerActions: showServerActions
|
|
106
108
|
}));
|
|
107
109
|
}, [data, isOverlayVisible, onError, onResolve, scrollContainer, showServerActions, url, useAlternativePreloader]);
|
|
108
|
-
|
|
109
|
-
// TODO: add proper show/hide conditions for overlay in EDM-8239
|
|
110
110
|
var card = useMemo(function () {
|
|
111
|
-
return
|
|
111
|
+
return jsx("span", _extends({
|
|
112
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
113
|
+
className: "card"
|
|
114
|
+
}, shouldShowLinkOverlay ? {
|
|
112
115
|
onMouseEnter: function onMouseEnter() {
|
|
113
116
|
return setIsOverlayVisible(true);
|
|
114
117
|
},
|
|
115
118
|
onMouseLeave: function onMouseLeave() {
|
|
116
119
|
return setIsOverlayVisible(false);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
className: "card"
|
|
120
|
-
}, jsx(DiscoveryPulse, {
|
|
120
|
+
}
|
|
121
|
+
} : {}), shouldShowLinkPulse ? jsx(DiscoveryPulse, {
|
|
121
122
|
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
122
123
|
localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
|
|
123
124
|
discoveryMode: 'start'
|
|
124
|
-
}, innerCard)
|
|
125
|
-
|
|
126
|
-
return setIsOverlayVisible(true);
|
|
127
|
-
},
|
|
128
|
-
onMouseLeave: function onMouseLeave() {
|
|
129
|
-
return setIsOverlayVisible(false);
|
|
130
|
-
},
|
|
131
|
-
className: "card"
|
|
132
|
-
}, innerCard);
|
|
133
|
-
}, [innerCard, shouldShowLinkPulse]);
|
|
125
|
+
}, innerCard) : innerCard);
|
|
126
|
+
}, [shouldShowLinkPulse, shouldShowLinkOverlay, innerCard]);
|
|
134
127
|
|
|
135
128
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
136
129
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@atlaskit/icon": "^21.12.0",
|
|
49
49
|
"@atlaskit/link-analytics": "^8.3.0",
|
|
50
50
|
"@atlaskit/link-client-extension": "^1.8.0",
|
|
51
|
-
"@atlaskit/link-datasource": "^1.
|
|
51
|
+
"@atlaskit/link-datasource": "^1.17.0",
|
|
52
52
|
"@atlaskit/linking-common": "^4.18.0",
|
|
53
|
-
"@atlaskit/linking-types": "^8.
|
|
53
|
+
"@atlaskit/linking-types": "^8.5.0",
|
|
54
54
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
55
55
|
"@atlaskit/primitives": "^1.9.0",
|
|
56
56
|
"@atlaskit/smart-card": "^26.42.0",
|