@atlaskit/editor-plugin-card 0.13.1 → 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 +13 -0
- package/dist/cjs/common/hooks/useLinkUpgradeDiscoverability.js +1 -2
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +11 -18
- package/dist/cjs/pm-plugins/mountHyperlink.js +12 -16
- package/dist/cjs/toolbar.js +12 -15
- package/dist/es2019/common/hooks/useLinkUpgradeDiscoverability.js +2 -3
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +10 -13
- package/dist/es2019/pm-plugins/mountHyperlink.js +10 -14
- package/dist/es2019/toolbar.js +10 -13
- package/dist/esm/common/hooks/useLinkUpgradeDiscoverability.js +2 -3
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +11 -18
- package/dist/esm/pm-plugins/mountHyperlink.js +12 -16
- package/dist/esm/toolbar.js +12 -15
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.13.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#42933](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42933) [`6a7848b6400`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6a7848b6400) - Cleansup feature flag. Floating toolbar now always fires a viewed event when activated for links when the card plugin is enabled.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 0.13.1
|
|
4
17
|
|
|
5
18
|
### 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
|
|
@@ -8,25 +8,21 @@ exports.mountHyperlinkPlugin = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _HyperlinkToolbarAppearance = require("../ui/HyperlinkToolbarAppearance");
|
|
13
12
|
var _ToolbarViewedEvent = require("../ui/ToolbarViewedEvent");
|
|
14
13
|
var getToolbarViewedItem = function getToolbarViewedItem(link) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}];
|
|
28
|
-
}
|
|
29
|
-
return [];
|
|
14
|
+
return [{
|
|
15
|
+
type: 'custom',
|
|
16
|
+
fallback: [],
|
|
17
|
+
render: function render(editorView) {
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_ToolbarViewedEvent.ToolbarViewedEvent, {
|
|
19
|
+
key: "edit.link.menu.viewed",
|
|
20
|
+
url: link,
|
|
21
|
+
display: "url",
|
|
22
|
+
editorView: editorView
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}];
|
|
30
26
|
};
|
|
31
27
|
var mountHyperlinkPlugin = exports.mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, options) {
|
|
32
28
|
return new _safePlugin.SafePlugin({
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -168,21 +168,18 @@ var getToolbarViewedItem = function getToolbarViewedItem(url, display) {
|
|
|
168
168
|
if (!url) {
|
|
169
169
|
return [];
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}];
|
|
184
|
-
}
|
|
185
|
-
return [];
|
|
171
|
+
return [{
|
|
172
|
+
type: 'custom',
|
|
173
|
+
fallback: [],
|
|
174
|
+
render: function render(editorView) {
|
|
175
|
+
return /*#__PURE__*/_react.default.createElement(_ToolbarViewedEvent.ToolbarViewedEvent, {
|
|
176
|
+
key: "edit.link.menu.viewed",
|
|
177
|
+
url: url,
|
|
178
|
+
display: display,
|
|
179
|
+
editorView: editorView
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}];
|
|
186
183
|
};
|
|
187
184
|
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
188
185
|
return function (node) {
|
|
@@ -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,22 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { HyperlinkToolbarAppearance } from '../ui/HyperlinkToolbarAppearance';
|
|
5
4
|
import { ToolbarViewedEvent } from '../ui/ToolbarViewedEvent';
|
|
6
5
|
const getToolbarViewedItem = link => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}];
|
|
18
|
-
}
|
|
19
|
-
return [];
|
|
6
|
+
return [{
|
|
7
|
+
type: 'custom',
|
|
8
|
+
fallback: [],
|
|
9
|
+
render: editorView => /*#__PURE__*/React.createElement(ToolbarViewedEvent, {
|
|
10
|
+
key: "edit.link.menu.viewed",
|
|
11
|
+
url: link,
|
|
12
|
+
display: "url",
|
|
13
|
+
editorView: editorView
|
|
14
|
+
})
|
|
15
|
+
}];
|
|
20
16
|
};
|
|
21
17
|
export const mountHyperlinkPlugin = (pluginInjectionApi, options) => {
|
|
22
18
|
return new SafePlugin({
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -161,19 +161,16 @@ const getToolbarViewedItem = (url, display) => {
|
|
|
161
161
|
if (!url) {
|
|
162
162
|
return [];
|
|
163
163
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}];
|
|
175
|
-
}
|
|
176
|
-
return [];
|
|
164
|
+
return [{
|
|
165
|
+
type: 'custom',
|
|
166
|
+
fallback: [],
|
|
167
|
+
render: editorView => /*#__PURE__*/React.createElement(ToolbarViewedEvent, {
|
|
168
|
+
key: "edit.link.menu.viewed",
|
|
169
|
+
url: url,
|
|
170
|
+
display: display,
|
|
171
|
+
editorView: editorView
|
|
172
|
+
})
|
|
173
|
+
}];
|
|
177
174
|
};
|
|
178
175
|
const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) => node => {
|
|
179
176
|
var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _node$attrs, _node$attrs2, _node$attrs2$datasour;
|
|
@@ -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
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { HyperlinkToolbarAppearance } from '../ui/HyperlinkToolbarAppearance';
|
|
6
5
|
import { ToolbarViewedEvent } from '../ui/ToolbarViewedEvent';
|
|
7
6
|
var getToolbarViewedItem = function getToolbarViewedItem(link) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}];
|
|
21
|
-
}
|
|
22
|
-
return [];
|
|
7
|
+
return [{
|
|
8
|
+
type: 'custom',
|
|
9
|
+
fallback: [],
|
|
10
|
+
render: function render(editorView) {
|
|
11
|
+
return /*#__PURE__*/React.createElement(ToolbarViewedEvent, {
|
|
12
|
+
key: "edit.link.menu.viewed",
|
|
13
|
+
url: link,
|
|
14
|
+
display: "url",
|
|
15
|
+
editorView: editorView
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}];
|
|
23
19
|
};
|
|
24
20
|
export var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, options) {
|
|
25
21
|
return new SafePlugin({
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -158,21 +158,18 @@ var getToolbarViewedItem = function getToolbarViewedItem(url, display) {
|
|
|
158
158
|
if (!url) {
|
|
159
159
|
return [];
|
|
160
160
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}];
|
|
174
|
-
}
|
|
175
|
-
return [];
|
|
161
|
+
return [{
|
|
162
|
+
type: 'custom',
|
|
163
|
+
fallback: [],
|
|
164
|
+
render: function render(editorView) {
|
|
165
|
+
return /*#__PURE__*/React.createElement(ToolbarViewedEvent, {
|
|
166
|
+
key: "edit.link.menu.viewed",
|
|
167
|
+
url: url,
|
|
168
|
+
display: display,
|
|
169
|
+
editorView: editorView
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}];
|
|
176
173
|
};
|
|
177
174
|
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
178
175
|
return function (node) {
|
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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
35
35
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
36
|
"@atlaskit/custom-steps": "^0.0.2",
|
|
37
|
-
"@atlaskit/editor-common": "^76.
|
|
37
|
+
"@atlaskit/editor-common": "^76.20.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^0.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^0.2.0",
|
|
40
40
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.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",
|
|
@@ -123,9 +123,6 @@
|
|
|
123
123
|
"platform.linking-platform.datasource-jira_issues": {
|
|
124
124
|
"type": "boolean"
|
|
125
125
|
},
|
|
126
|
-
"platform.linking-platform.editor.toolbar-viewed-event": {
|
|
127
|
-
"type": "boolean"
|
|
128
|
-
},
|
|
129
126
|
"platform.linking-platform.datasource.show-jlol-basic-filters": {
|
|
130
127
|
"type": "boolean",
|
|
131
128
|
"referenceOnly": "true"
|