@atlaskit/editor-plugin-card 0.13.2 → 0.13.4
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 +14 -0
- package/dist/cjs/common/hooks/useLinkUpgradeDiscoverability.js +1 -2
- package/dist/cjs/common/local-storage.js +1 -1
- package/dist/cjs/common/pulse/index.js +2 -3
- package/dist/cjs/nodeviews/inlineCard.js +5 -1
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +20 -19
- package/dist/cjs/ui/LinkToolbarAppearance.js +5 -9
- package/dist/es2019/common/hooks/useLinkUpgradeDiscoverability.js +2 -3
- package/dist/es2019/common/local-storage.js +1 -1
- package/dist/es2019/common/pulse/index.js +1 -2
- package/dist/es2019/nodeviews/inlineCard.js +5 -1
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +20 -15
- package/dist/es2019/ui/LinkToolbarAppearance.js +5 -9
- package/dist/esm/common/hooks/useLinkUpgradeDiscoverability.js +2 -3
- package/dist/esm/common/local-storage.js +1 -1
- package/dist/esm/common/pulse/index.js +1 -2
- package/dist/esm/nodeviews/inlineCard.js +5 -1
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +21 -20
- package/dist/esm/ui/LinkToolbarAppearance.js +5 -9
- package/dist/types/common/local-storage.d.ts +1 -1
- package/dist/types/common/pulse/index.d.ts +0 -2
- package/dist/types/nodeviews/genericCard.d.ts +1 -0
- package/dist/types/nodeviews/inlineCardWithAwareness.d.ts +1 -1
- package/dist/types-ts4.5/common/local-storage.d.ts +1 -1
- package/dist/types-ts4.5/common/pulse/index.d.ts +0 -2
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/inlineCardWithAwareness.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 0.13.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#43379](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43379) [`482c025520d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/482c025520d) - ED-20763 Upgrade ADF schema version to 33.2.3 for MBE nodes.
|
|
8
|
+
- [#43352](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43352) [`087515ab3ea`](https://bitbucket.org/atlassian/atlassian-frontend/commits/087515ab3ea) - [ux] Added on selection behaviour for inline link
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 0.13.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#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
|
|
16
|
+
|
|
3
17
|
## 0.13.2
|
|
4
18
|
|
|
5
19
|
### 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 () {
|
|
@@ -8,7 +8,7 @@ var _frontendUtilities = require("@atlaskit/frontend-utilities");
|
|
|
8
8
|
var LOCAL_STORAGE_CLIENT_KEY = exports.LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/editor-plugin-card';
|
|
9
9
|
var LOCAL_STORAGE_DISCOVERED_KEY = exports.LOCAL_STORAGE_DISCOVERED_KEY = 'discovered';
|
|
10
10
|
var LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = exports.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
|
|
11
|
-
var LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = exports.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = '
|
|
11
|
+
var LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = exports.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = 'toolbar-upgrade-pulse';
|
|
12
12
|
var ONE_DAY_IN_MILLISECONDS = exports.ONE_DAY_IN_MILLISECONDS = 86400000;
|
|
13
13
|
var storageClient = new _frontendUtilities.StorageClient(LOCAL_STORAGE_CLIENT_KEY);
|
|
14
14
|
var isLocalStorageKeyDiscovered = exports.isLocalStorageKeyDiscovered = function isLocalStorageKeyDiscovered(key) {
|
|
@@ -4,7 +4,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.DiscoveryPulse = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
10
10
|
var _localStorage = require("../local-storage");
|
|
@@ -29,5 +29,4 @@ var DiscoveryPulse = exports.DiscoveryPulse = function DiscoveryPulse(_ref) {
|
|
|
29
29
|
isDiscovered: discovered
|
|
30
30
|
};
|
|
31
31
|
return /*#__PURE__*/_react.default.createElement(_linkingCommon.Pulse, pulseProps, children);
|
|
32
|
-
};
|
|
33
|
-
var _default = exports.default = _linkingCommon.Pulse;
|
|
32
|
+
};
|
|
@@ -17,6 +17,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
17
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
18
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
19
19
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
20
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
20
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
22
|
var _smartCard = require("@atlaskit/smart-card");
|
|
22
23
|
var _actions = require("../pm-plugins/actions");
|
|
@@ -120,6 +121,7 @@ var InlineCardComponent = exports.InlineCardComponent = /*#__PURE__*/function (_
|
|
|
120
121
|
var WrappedInlineCard = (0, _genericCard.Card)(InlineCardComponent, _ui.UnsupportedInline);
|
|
121
122
|
var WrappedInlineCardWithAwareness = (0, _genericCard.Card)(_inlineCardWithAwareness.InlineCardWithAwareness, _ui.UnsupportedInline);
|
|
122
123
|
function InlineCardNodeView(props) {
|
|
124
|
+
var _view$state$selection, _view$state$selection2;
|
|
123
125
|
var useAlternativePreloader = props.useAlternativePreloader,
|
|
124
126
|
node = props.node,
|
|
125
127
|
view = props.view,
|
|
@@ -144,6 +146,7 @@ function InlineCardNodeView(props) {
|
|
|
144
146
|
var canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? (0, _utils.isBlockSupportedAtPosition)(linkPosition, editorState, 'inline') : false;
|
|
145
147
|
var isPulseEnabled = enableInlineUpgradeFeatures && canBeUpgradedToEmbed;
|
|
146
148
|
var isOverlayEnabled = enableInlineUpgradeFeatures && (canBeUpgradedToEmbed || canBeUpgradedToBlock);
|
|
149
|
+
var isSelected = view.state.selection instanceof _state.NodeSelection && ((_view$state$selection = view.state.selection) === null || _view$state$selection === void 0 || (_view$state$selection = _view$state$selection.node) === null || _view$state$selection === void 0 ? void 0 : _view$state$selection.type) === view.state.schema.nodes.inlineCard && ((_view$state$selection2 = view.state.selection) === null || _view$state$selection2 === void 0 ? void 0 : _view$state$selection2.from) === getPos();
|
|
147
150
|
return /*#__PURE__*/_react.default.createElement(WrappedInlineCardWithAwareness, {
|
|
148
151
|
node: node,
|
|
149
152
|
view: view,
|
|
@@ -152,6 +155,7 @@ function InlineCardNodeView(props) {
|
|
|
152
155
|
useAlternativePreloader: useAlternativePreloader,
|
|
153
156
|
isOverlayEnabled: isOverlayEnabled,
|
|
154
157
|
isPulseEnabled: isPulseEnabled,
|
|
155
|
-
pluginInjectionApi: pluginInjectionApi
|
|
158
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
159
|
+
isSelected: isSelected
|
|
156
160
|
});
|
|
157
161
|
}
|
|
@@ -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");
|
|
@@ -35,7 +36,8 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
35
36
|
getPos = _ref.getPos,
|
|
36
37
|
isOverlayEnabled = _ref.isOverlayEnabled,
|
|
37
38
|
isPulseEnabled = _ref.isPulseEnabled,
|
|
38
|
-
pluginInjectionApi = _ref.pluginInjectionApi
|
|
39
|
+
pluginInjectionApi = _ref.pluginInjectionApi,
|
|
40
|
+
isSelected = _ref.isSelected;
|
|
39
41
|
var _node$attrs = node.attrs,
|
|
40
42
|
url = _node$attrs.url,
|
|
41
43
|
data = _node$attrs.data;
|
|
@@ -61,7 +63,15 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
61
63
|
isOverlayEnabled: isOverlayEnabled,
|
|
62
64
|
isPulseEnabled: isPulseEnabled
|
|
63
65
|
}),
|
|
64
|
-
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse
|
|
66
|
+
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse,
|
|
67
|
+
shouldShowToolbarPulse = _useLinkUpgradeDiscov.shouldShowToolbarPulse,
|
|
68
|
+
shouldShowLinkOverlay = _useLinkUpgradeDiscov.shouldShowLinkOverlay;
|
|
69
|
+
|
|
70
|
+
// If the toolbar pulse has not yet been invalidated and this is a case where we will be showing it,
|
|
71
|
+
// we need to invalidate the link pulse too. Toolbar pulse will be invalidated in the corresponding component.
|
|
72
|
+
if (isSelected && shouldShowToolbarPulse && !(0, _localStorage.isLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR)) {
|
|
73
|
+
(0, _localStorage.markLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
74
|
+
}
|
|
65
75
|
var scrollContainer = (0, _react.useMemo)(function () {
|
|
66
76
|
return (0, _ui.findOverflowScrollParent)(view.dom) || undefined;
|
|
67
77
|
}, [view.dom]);
|
|
@@ -113,32 +123,23 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
113
123
|
showServerActions: showServerActions
|
|
114
124
|
}));
|
|
115
125
|
}, [data, isOverlayVisible, onError, onResolve, scrollContainer, showServerActions, url, useAlternativePreloader]);
|
|
116
|
-
|
|
117
|
-
// TODO: add proper show/hide conditions for overlay in EDM-8239
|
|
118
126
|
var card = (0, _react.useMemo)(function () {
|
|
119
|
-
return
|
|
127
|
+
return (0, _react2.jsx)("span", (0, _extends2.default)({
|
|
128
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
129
|
+
className: "card"
|
|
130
|
+
}, shouldShowLinkOverlay ? {
|
|
120
131
|
onMouseEnter: function onMouseEnter() {
|
|
121
132
|
return setIsOverlayVisible(true);
|
|
122
133
|
},
|
|
123
134
|
onMouseLeave: function onMouseLeave() {
|
|
124
135
|
return setIsOverlayVisible(false);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
className: "card"
|
|
128
|
-
}, (0, _react2.jsx)(_pulse.DiscoveryPulse, {
|
|
136
|
+
}
|
|
137
|
+
} : {}), shouldShowLinkPulse ? (0, _react2.jsx)(_pulse.DiscoveryPulse, {
|
|
129
138
|
localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
130
139
|
localStorageKeyExpirationInMs: _localStorage.ONE_DAY_IN_MILLISECONDS,
|
|
131
140
|
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]);
|
|
141
|
+
}, innerCard) : innerCard);
|
|
142
|
+
}, [shouldShowLinkPulse, shouldShowLinkOverlay, innerCard]);
|
|
142
143
|
|
|
143
144
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
144
145
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -54,7 +54,7 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
|
|
|
54
54
|
editorAnalyticsApi = _this$props.editorAnalyticsApi,
|
|
55
55
|
cardActions = _this$props.cardActions,
|
|
56
56
|
_this$props$showUpgra = _this$props.showUpgradeDiscoverability,
|
|
57
|
-
showUpgradeDiscoverability = _this$props$showUpgra === void 0 ?
|
|
57
|
+
showUpgradeDiscoverability = _this$props$showUpgra === void 0 ? true : _this$props$showUpgra;
|
|
58
58
|
var preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url, platform);
|
|
59
59
|
var defaultCommand = function defaultCommand() {
|
|
60
60
|
return false;
|
|
@@ -115,7 +115,7 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
|
|
|
115
115
|
options.push(embedOption);
|
|
116
116
|
}
|
|
117
117
|
var LinkToolbarButtons = /*#__PURE__*/_react.default.createElement(_card.LinkToolbarButtonGroup, {
|
|
118
|
-
key:
|
|
118
|
+
key: "link-toolbar-button-group",
|
|
119
119
|
options: options.map(function (option) {
|
|
120
120
|
return (0, _card.getButtonGroupOption)(intl, dispatchCommand, _objectSpread(_objectSpread({}, option), {}, {
|
|
121
121
|
onClick: (0, _card.commandWithMetadata)(option.onClick, {
|
|
@@ -127,13 +127,9 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
|
|
|
127
127
|
var status = url ? cardContext === null || cardContext === void 0 || (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 || (_cardContext$store2 = _cardContext$store2.getState()[url]) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.status : '';
|
|
128
128
|
var embedEnabled = embedOption ? !embedOption.disabled : false;
|
|
129
129
|
if ((0, _toolbar.shouldRenderToolbarPulse)(embedEnabled, currentAppearance !== null && currentAppearance !== void 0 ? currentAppearance : '', status !== null && status !== void 0 ? status : '', showUpgradeDiscoverability)) {
|
|
130
|
-
return (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_pulse.DiscoveryPulse, {
|
|
134
|
-
localStorageKey: "toolbar-upgrade-pulse"
|
|
135
|
-
}, LinkToolbarButtons))
|
|
136
|
-
);
|
|
130
|
+
return /*#__PURE__*/_react.default.createElement(_pulse.DiscoveryPulse, {
|
|
131
|
+
localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
|
|
132
|
+
}, LinkToolbarButtons);
|
|
137
133
|
}
|
|
138
134
|
return LinkToolbarButtons;
|
|
139
135
|
});
|
|
@@ -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]);
|
|
@@ -2,7 +2,7 @@ import { StorageClient } from '@atlaskit/frontend-utilities';
|
|
|
2
2
|
export const LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/editor-plugin-card';
|
|
3
3
|
export const LOCAL_STORAGE_DISCOVERED_KEY = 'discovered';
|
|
4
4
|
export const LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
|
|
5
|
-
export const LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = '
|
|
5
|
+
export const LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = 'toolbar-upgrade-pulse';
|
|
6
6
|
export const ONE_DAY_IN_MILLISECONDS = 86400000;
|
|
7
7
|
const storageClient = new StorageClient(LOCAL_STORAGE_CLIENT_KEY);
|
|
8
8
|
export const isLocalStorageKeyDiscovered = key => {
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
5
|
import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
6
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
8
9
|
import { registerCard } from '../pm-plugins/actions';
|
|
@@ -100,6 +101,7 @@ _defineProperty(InlineCardComponent, "contextTypes", {
|
|
|
100
101
|
const WrappedInlineCard = Card(InlineCardComponent, UnsupportedInline);
|
|
101
102
|
const WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
|
|
102
103
|
export function InlineCardNodeView(props) {
|
|
104
|
+
var _view$state$selection, _view$state$selection2, _view$state$selection3;
|
|
103
105
|
const {
|
|
104
106
|
useAlternativePreloader,
|
|
105
107
|
node,
|
|
@@ -126,6 +128,7 @@ export function InlineCardNodeView(props) {
|
|
|
126
128
|
const canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? isBlockSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
127
129
|
const isPulseEnabled = enableInlineUpgradeFeatures && canBeUpgradedToEmbed;
|
|
128
130
|
const isOverlayEnabled = enableInlineUpgradeFeatures && (canBeUpgradedToEmbed || canBeUpgradedToBlock);
|
|
131
|
+
const isSelected = view.state.selection instanceof NodeSelection && ((_view$state$selection = view.state.selection) === null || _view$state$selection === void 0 ? void 0 : (_view$state$selection2 = _view$state$selection.node) === null || _view$state$selection2 === void 0 ? void 0 : _view$state$selection2.type) === view.state.schema.nodes.inlineCard && ((_view$state$selection3 = view.state.selection) === null || _view$state$selection3 === void 0 ? void 0 : _view$state$selection3.from) === getPos();
|
|
129
132
|
return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, {
|
|
130
133
|
node: node,
|
|
131
134
|
view: view,
|
|
@@ -134,6 +137,7 @@ export function InlineCardNodeView(props) {
|
|
|
134
137
|
useAlternativePreloader: useAlternativePreloader,
|
|
135
138
|
isOverlayEnabled: isOverlayEnabled,
|
|
136
139
|
isPulseEnabled: isPulseEnabled,
|
|
137
|
-
pluginInjectionApi: pluginInjectionApi
|
|
140
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
141
|
+
isSelected: isSelected
|
|
138
142
|
});
|
|
139
143
|
}
|
|
@@ -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';
|
|
@@ -5,7 +6,7 @@ import rafSchedule from 'raf-schd';
|
|
|
5
6
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
6
7
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
7
8
|
import useLinkUpgradeDiscoverability from '../common/hooks/useLinkUpgradeDiscoverability';
|
|
8
|
-
import { LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, ONE_DAY_IN_MILLISECONDS } from '../common/local-storage';
|
|
9
|
+
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../common/local-storage';
|
|
9
10
|
import { DiscoveryPulse } from '../common/pulse';
|
|
10
11
|
import { registerCard } from '../pm-plugins/actions';
|
|
11
12
|
import InlineCardOverlay from '../ui/InlineCardOverlay';
|
|
@@ -26,7 +27,8 @@ const InlineCard = ({
|
|
|
26
27
|
getPos,
|
|
27
28
|
isOverlayEnabled,
|
|
28
29
|
isPulseEnabled,
|
|
29
|
-
pluginInjectionApi
|
|
30
|
+
pluginInjectionApi,
|
|
31
|
+
isSelected
|
|
30
32
|
}) => {
|
|
31
33
|
const {
|
|
32
34
|
url,
|
|
@@ -44,7 +46,9 @@ const InlineCard = ({
|
|
|
44
46
|
return typeof pos === 'number' ? pos : undefined;
|
|
45
47
|
}, [getPos]);
|
|
46
48
|
const {
|
|
47
|
-
shouldShowLinkPulse
|
|
49
|
+
shouldShowLinkPulse,
|
|
50
|
+
shouldShowToolbarPulse,
|
|
51
|
+
shouldShowLinkOverlay
|
|
48
52
|
} = useLinkUpgradeDiscoverability({
|
|
49
53
|
url,
|
|
50
54
|
linkPosition: linkPosition || -1,
|
|
@@ -53,6 +57,12 @@ const InlineCard = ({
|
|
|
53
57
|
isOverlayEnabled,
|
|
54
58
|
isPulseEnabled
|
|
55
59
|
});
|
|
60
|
+
|
|
61
|
+
// If the toolbar pulse has not yet been invalidated and this is a case where we will be showing it,
|
|
62
|
+
// we need to invalidate the link pulse too. Toolbar pulse will be invalidated in the corresponding component.
|
|
63
|
+
if (isSelected && shouldShowToolbarPulse && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR)) {
|
|
64
|
+
markLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
65
|
+
}
|
|
56
66
|
const scrollContainer = useMemo(() => findOverflowScrollParent(view.dom) || undefined, [view.dom]);
|
|
57
67
|
const onResolve = useCallback(data => {
|
|
58
68
|
if (!getPos || typeof getPos === 'boolean') {
|
|
@@ -104,22 +114,17 @@ const InlineCard = ({
|
|
|
104
114
|
inlinePreloaderStyle: useAlternativePreloader ? 'on-right-without-skeleton' : undefined,
|
|
105
115
|
showServerActions: showServerActions
|
|
106
116
|
})), [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,
|
|
117
|
+
const card = useMemo(() => jsx("span", _extends({
|
|
118
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
113
119
|
className: "card"
|
|
114
|
-
},
|
|
120
|
+
}, shouldShowLinkOverlay ? {
|
|
121
|
+
onMouseEnter: () => setIsOverlayVisible(true),
|
|
122
|
+
onMouseLeave: () => setIsOverlayVisible(false)
|
|
123
|
+
} : {}), shouldShowLinkPulse ? jsx(DiscoveryPulse, {
|
|
115
124
|
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
116
125
|
localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
|
|
117
126
|
discoveryMode: 'start'
|
|
118
|
-
}, innerCard)
|
|
119
|
-
onMouseEnter: () => setIsOverlayVisible(true),
|
|
120
|
-
onMouseLeave: () => setIsOverlayVisible(false),
|
|
121
|
-
className: "card"
|
|
122
|
-
}, innerCard), [innerCard, shouldShowLinkPulse]);
|
|
127
|
+
}, innerCard) : innerCard), [shouldShowLinkPulse, shouldShowLinkOverlay, innerCard]);
|
|
123
128
|
|
|
124
129
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
125
130
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -25,7 +25,7 @@ export class LinkToolbarAppearance extends React.Component {
|
|
|
25
25
|
platform,
|
|
26
26
|
editorAnalyticsApi,
|
|
27
27
|
cardActions,
|
|
28
|
-
showUpgradeDiscoverability =
|
|
28
|
+
showUpgradeDiscoverability = true
|
|
29
29
|
} = this.props;
|
|
30
30
|
const preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url, platform);
|
|
31
31
|
const defaultCommand = () => false;
|
|
@@ -85,7 +85,7 @@ export class LinkToolbarAppearance extends React.Component {
|
|
|
85
85
|
options.push(embedOption);
|
|
86
86
|
}
|
|
87
87
|
const LinkToolbarButtons = /*#__PURE__*/React.createElement(LinkToolbarButtonGroup, {
|
|
88
|
-
key:
|
|
88
|
+
key: "link-toolbar-button-group",
|
|
89
89
|
options: options.map(option => getButtonGroupOption(intl, dispatchCommand, {
|
|
90
90
|
...option,
|
|
91
91
|
onClick: commandWithMetadata(option.onClick, {
|
|
@@ -96,13 +96,9 @@ export class LinkToolbarAppearance extends React.Component {
|
|
|
96
96
|
const status = url ? cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 ? void 0 : (_cardContext$store2$g = _cardContext$store2.getState()[url]) === null || _cardContext$store2$g === void 0 ? void 0 : _cardContext$store2$g.status : '';
|
|
97
97
|
const embedEnabled = embedOption ? !embedOption.disabled : false;
|
|
98
98
|
if (shouldRenderToolbarPulse(embedEnabled, currentAppearance !== null && currentAppearance !== void 0 ? currentAppearance : '', status !== null && status !== void 0 ? status : '', showUpgradeDiscoverability)) {
|
|
99
|
-
return (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
React.createElement("div", null, /*#__PURE__*/React.createElement(DiscoveryPulse, {
|
|
103
|
-
localStorageKey: "toolbar-upgrade-pulse"
|
|
104
|
-
}, LinkToolbarButtons))
|
|
105
|
-
);
|
|
99
|
+
return /*#__PURE__*/React.createElement(DiscoveryPulse, {
|
|
100
|
+
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
|
|
101
|
+
}, LinkToolbarButtons);
|
|
106
102
|
}
|
|
107
103
|
return LinkToolbarButtons;
|
|
108
104
|
});
|
|
@@ -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 () {
|
|
@@ -2,7 +2,7 @@ import { StorageClient } from '@atlaskit/frontend-utilities';
|
|
|
2
2
|
export var LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/editor-plugin-card';
|
|
3
3
|
export var LOCAL_STORAGE_DISCOVERED_KEY = 'discovered';
|
|
4
4
|
export var LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
|
|
5
|
-
export var LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = '
|
|
5
|
+
export var LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = 'toolbar-upgrade-pulse';
|
|
6
6
|
export var ONE_DAY_IN_MILLISECONDS = 86400000;
|
|
7
7
|
var storageClient = new StorageClient(LOCAL_STORAGE_CLIENT_KEY);
|
|
8
8
|
export var isLocalStorageKeyDiscovered = function isLocalStorageKeyDiscovered(key) {
|
|
@@ -11,6 +11,7 @@ import React from 'react';
|
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import rafSchedule from 'raf-schd';
|
|
13
13
|
import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
14
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
14
15
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
15
16
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
16
17
|
import { registerCard } from '../pm-plugins/actions';
|
|
@@ -113,6 +114,7 @@ _defineProperty(InlineCardComponent, "contextTypes", {
|
|
|
113
114
|
var WrappedInlineCard = Card(InlineCardComponent, UnsupportedInline);
|
|
114
115
|
var WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
|
|
115
116
|
export function InlineCardNodeView(props) {
|
|
117
|
+
var _view$state$selection, _view$state$selection2;
|
|
116
118
|
var useAlternativePreloader = props.useAlternativePreloader,
|
|
117
119
|
node = props.node,
|
|
118
120
|
view = props.view,
|
|
@@ -137,6 +139,7 @@ export function InlineCardNodeView(props) {
|
|
|
137
139
|
var canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? isBlockSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
138
140
|
var isPulseEnabled = enableInlineUpgradeFeatures && canBeUpgradedToEmbed;
|
|
139
141
|
var isOverlayEnabled = enableInlineUpgradeFeatures && (canBeUpgradedToEmbed || canBeUpgradedToBlock);
|
|
142
|
+
var isSelected = view.state.selection instanceof NodeSelection && ((_view$state$selection = view.state.selection) === null || _view$state$selection === void 0 || (_view$state$selection = _view$state$selection.node) === null || _view$state$selection === void 0 ? void 0 : _view$state$selection.type) === view.state.schema.nodes.inlineCard && ((_view$state$selection2 = view.state.selection) === null || _view$state$selection2 === void 0 ? void 0 : _view$state$selection2.from) === getPos();
|
|
140
143
|
return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, {
|
|
141
144
|
node: node,
|
|
142
145
|
view: view,
|
|
@@ -145,6 +148,7 @@ export function InlineCardNodeView(props) {
|
|
|
145
148
|
useAlternativePreloader: useAlternativePreloader,
|
|
146
149
|
isOverlayEnabled: isOverlayEnabled,
|
|
147
150
|
isPulseEnabled: isPulseEnabled,
|
|
148
|
-
pluginInjectionApi: pluginInjectionApi
|
|
151
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
152
|
+
isSelected: isSelected
|
|
149
153
|
});
|
|
150
154
|
}
|
|
@@ -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';
|
|
@@ -6,7 +7,7 @@ import rafSchedule from 'raf-schd';
|
|
|
6
7
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
7
8
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
8
9
|
import useLinkUpgradeDiscoverability from '../common/hooks/useLinkUpgradeDiscoverability';
|
|
9
|
-
import { LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, ONE_DAY_IN_MILLISECONDS } from '../common/local-storage';
|
|
10
|
+
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../common/local-storage';
|
|
10
11
|
import { DiscoveryPulse } from '../common/pulse';
|
|
11
12
|
import { registerCard } from '../pm-plugins/actions';
|
|
12
13
|
import InlineCardOverlay from '../ui/InlineCardOverlay';
|
|
@@ -27,7 +28,8 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
27
28
|
getPos = _ref.getPos,
|
|
28
29
|
isOverlayEnabled = _ref.isOverlayEnabled,
|
|
29
30
|
isPulseEnabled = _ref.isPulseEnabled,
|
|
30
|
-
pluginInjectionApi = _ref.pluginInjectionApi
|
|
31
|
+
pluginInjectionApi = _ref.pluginInjectionApi,
|
|
32
|
+
isSelected = _ref.isSelected;
|
|
31
33
|
var _node$attrs = node.attrs,
|
|
32
34
|
url = _node$attrs.url,
|
|
33
35
|
data = _node$attrs.data;
|
|
@@ -53,7 +55,15 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
53
55
|
isOverlayEnabled: isOverlayEnabled,
|
|
54
56
|
isPulseEnabled: isPulseEnabled
|
|
55
57
|
}),
|
|
56
|
-
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse
|
|
58
|
+
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse,
|
|
59
|
+
shouldShowToolbarPulse = _useLinkUpgradeDiscov.shouldShowToolbarPulse,
|
|
60
|
+
shouldShowLinkOverlay = _useLinkUpgradeDiscov.shouldShowLinkOverlay;
|
|
61
|
+
|
|
62
|
+
// If the toolbar pulse has not yet been invalidated and this is a case where we will be showing it,
|
|
63
|
+
// we need to invalidate the link pulse too. Toolbar pulse will be invalidated in the corresponding component.
|
|
64
|
+
if (isSelected && shouldShowToolbarPulse && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR)) {
|
|
65
|
+
markLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
66
|
+
}
|
|
57
67
|
var scrollContainer = useMemo(function () {
|
|
58
68
|
return findOverflowScrollParent(view.dom) || undefined;
|
|
59
69
|
}, [view.dom]);
|
|
@@ -105,32 +115,23 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
105
115
|
showServerActions: showServerActions
|
|
106
116
|
}));
|
|
107
117
|
}, [data, isOverlayVisible, onError, onResolve, scrollContainer, showServerActions, url, useAlternativePreloader]);
|
|
108
|
-
|
|
109
|
-
// TODO: add proper show/hide conditions for overlay in EDM-8239
|
|
110
118
|
var card = useMemo(function () {
|
|
111
|
-
return
|
|
119
|
+
return jsx("span", _extends({
|
|
120
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
121
|
+
className: "card"
|
|
122
|
+
}, shouldShowLinkOverlay ? {
|
|
112
123
|
onMouseEnter: function onMouseEnter() {
|
|
113
124
|
return setIsOverlayVisible(true);
|
|
114
125
|
},
|
|
115
126
|
onMouseLeave: function onMouseLeave() {
|
|
116
127
|
return setIsOverlayVisible(false);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
className: "card"
|
|
120
|
-
}, jsx(DiscoveryPulse, {
|
|
128
|
+
}
|
|
129
|
+
} : {}), shouldShowLinkPulse ? jsx(DiscoveryPulse, {
|
|
121
130
|
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
122
131
|
localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
|
|
123
132
|
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]);
|
|
133
|
+
}, innerCard) : innerCard);
|
|
134
|
+
}, [shouldShowLinkPulse, shouldShowLinkOverlay, innerCard]);
|
|
134
135
|
|
|
135
136
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
136
137
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -44,7 +44,7 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
44
44
|
editorAnalyticsApi = _this$props.editorAnalyticsApi,
|
|
45
45
|
cardActions = _this$props.cardActions,
|
|
46
46
|
_this$props$showUpgra = _this$props.showUpgradeDiscoverability,
|
|
47
|
-
showUpgradeDiscoverability = _this$props$showUpgra === void 0 ?
|
|
47
|
+
showUpgradeDiscoverability = _this$props$showUpgra === void 0 ? true : _this$props$showUpgra;
|
|
48
48
|
var preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url, platform);
|
|
49
49
|
var defaultCommand = function defaultCommand() {
|
|
50
50
|
return false;
|
|
@@ -105,7 +105,7 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
105
105
|
options.push(embedOption);
|
|
106
106
|
}
|
|
107
107
|
var LinkToolbarButtons = /*#__PURE__*/React.createElement(LinkToolbarButtonGroup, {
|
|
108
|
-
key:
|
|
108
|
+
key: "link-toolbar-button-group",
|
|
109
109
|
options: options.map(function (option) {
|
|
110
110
|
return getButtonGroupOption(intl, dispatchCommand, _objectSpread(_objectSpread({}, option), {}, {
|
|
111
111
|
onClick: commandWithMetadata(option.onClick, {
|
|
@@ -117,13 +117,9 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
117
117
|
var status = url ? cardContext === null || cardContext === void 0 || (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 || (_cardContext$store2 = _cardContext$store2.getState()[url]) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.status : '';
|
|
118
118
|
var embedEnabled = embedOption ? !embedOption.disabled : false;
|
|
119
119
|
if (shouldRenderToolbarPulse(embedEnabled, currentAppearance !== null && currentAppearance !== void 0 ? currentAppearance : '', status !== null && status !== void 0 ? status : '', showUpgradeDiscoverability)) {
|
|
120
|
-
return (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
React.createElement("div", null, /*#__PURE__*/React.createElement(DiscoveryPulse, {
|
|
124
|
-
localStorageKey: "toolbar-upgrade-pulse"
|
|
125
|
-
}, LinkToolbarButtons))
|
|
126
|
-
);
|
|
120
|
+
return /*#__PURE__*/React.createElement(DiscoveryPulse, {
|
|
121
|
+
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
|
|
122
|
+
}, LinkToolbarButtons);
|
|
127
123
|
}
|
|
128
124
|
return LinkToolbarButtons;
|
|
129
125
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const LOCAL_STORAGE_CLIENT_KEY = "@atlaskit/editor-plugin-card";
|
|
2
2
|
export declare const LOCAL_STORAGE_DISCOVERED_KEY = "discovered";
|
|
3
3
|
export declare const LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = "smart-link-upgrade-pulse";
|
|
4
|
-
export declare const LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = "
|
|
4
|
+
export declare const LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = "toolbar-upgrade-pulse";
|
|
5
5
|
export declare const ONE_DAY_IN_MILLISECONDS = 86400000;
|
|
6
6
|
export declare const isLocalStorageKeyDiscovered: (key: string) => boolean;
|
|
7
7
|
export declare const markLocalStorageKeyDiscovered: (key: string, expiration?: number) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Pulse } from '@atlaskit/linking-common';
|
|
3
2
|
export type PulseDiscoveryMode = 'start' | 'iteration';
|
|
4
3
|
export interface PulseProps {
|
|
5
4
|
/**
|
|
@@ -25,4 +24,3 @@ export interface PulseProps {
|
|
|
25
24
|
discoveryMode?: PulseDiscoveryMode;
|
|
26
25
|
}
|
|
27
26
|
export declare const DiscoveryPulse: ({ children, localStorageKey, isDiscovered, localStorageKeyExpirationInMs, discoveryMode, }: PulseProps) => JSX.Element;
|
|
28
|
-
export default Pulse;
|
|
@@ -33,6 +33,7 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
33
33
|
isOverlayEnabled?: boolean;
|
|
34
34
|
isPulseEnabled?: boolean;
|
|
35
35
|
linkPosition?: number;
|
|
36
|
+
isSelected?: boolean;
|
|
36
37
|
}
|
|
37
38
|
export interface SmartCardProps extends CardProps {
|
|
38
39
|
cardContext?: EditorContext<CardContext | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import type { SmartCardProps } from './genericCard';
|
|
4
|
-
export declare const InlineCardWithAwareness: import("react").MemoExoticComponent<({ node, cardContext, showServerActions, useAlternativePreloader, view, getPos, isOverlayEnabled, isPulseEnabled, pluginInjectionApi, }: SmartCardProps) => jsx.JSX.Element | null>;
|
|
4
|
+
export declare const InlineCardWithAwareness: import("react").MemoExoticComponent<({ node, cardContext, showServerActions, useAlternativePreloader, view, getPos, isOverlayEnabled, isPulseEnabled, pluginInjectionApi, isSelected, }: SmartCardProps) => jsx.JSX.Element | null>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const LOCAL_STORAGE_CLIENT_KEY = "@atlaskit/editor-plugin-card";
|
|
2
2
|
export declare const LOCAL_STORAGE_DISCOVERED_KEY = "discovered";
|
|
3
3
|
export declare const LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = "smart-link-upgrade-pulse";
|
|
4
|
-
export declare const LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = "
|
|
4
|
+
export declare const LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = "toolbar-upgrade-pulse";
|
|
5
5
|
export declare const ONE_DAY_IN_MILLISECONDS = 86400000;
|
|
6
6
|
export declare const isLocalStorageKeyDiscovered: (key: string) => boolean;
|
|
7
7
|
export declare const markLocalStorageKeyDiscovered: (key: string, expiration?: number) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Pulse } from '@atlaskit/linking-common';
|
|
3
2
|
export type PulseDiscoveryMode = 'start' | 'iteration';
|
|
4
3
|
export interface PulseProps {
|
|
5
4
|
/**
|
|
@@ -25,4 +24,3 @@ export interface PulseProps {
|
|
|
25
24
|
discoveryMode?: PulseDiscoveryMode;
|
|
26
25
|
}
|
|
27
26
|
export declare const DiscoveryPulse: ({ children, localStorageKey, isDiscovered, localStorageKeyExpirationInMs, discoveryMode, }: PulseProps) => JSX.Element;
|
|
28
|
-
export default Pulse;
|
|
@@ -33,6 +33,7 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
33
33
|
isOverlayEnabled?: boolean;
|
|
34
34
|
isPulseEnabled?: boolean;
|
|
35
35
|
linkPosition?: number;
|
|
36
|
+
isSelected?: boolean;
|
|
36
37
|
}
|
|
37
38
|
export interface SmartCardProps extends CardProps {
|
|
38
39
|
cardContext?: EditorContext<CardContext | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import type { SmartCardProps } from './genericCard';
|
|
4
|
-
export declare const InlineCardWithAwareness: import("react").MemoExoticComponent<({ node, cardContext, showServerActions, useAlternativePreloader, view, getPos, isOverlayEnabled, isPulseEnabled, pluginInjectionApi, }: SmartCardProps) => jsx.JSX.Element | null>;
|
|
4
|
+
export declare const InlineCardWithAwareness: import("react").MemoExoticComponent<({ node, cardContext, showServerActions, useAlternativePreloader, view, getPos, isOverlayEnabled, isPulseEnabled, pluginInjectionApi, isSelected, }: SmartCardProps) => jsx.JSX.Element | null>;
|
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.4",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/adf-schema": "^
|
|
34
|
+
"@atlaskit/adf-schema": "^33.2.3",
|
|
35
35
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
|
-
"@atlaskit/custom-steps": "^0.0.
|
|
37
|
-
"@atlaskit/editor-common": "^76.
|
|
36
|
+
"@atlaskit/custom-steps": "^0.0.3",
|
|
37
|
+
"@atlaskit/editor-common": "^76.22.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",
|