@atlaskit/editor-plugin-card 0.14.16 → 0.14.18
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/nodeviews/inlineCard.js +16 -18
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +38 -81
- package/dist/cjs/pm-plugins/main.js +4 -3
- package/dist/cjs/ui/AwarenessWrapper/index.js +107 -0
- package/dist/cjs/ui/LinkToolbarAppearance.js +2 -2
- package/dist/cjs/{common/pulse → ui/Pulse}/index.js +1 -1
- package/dist/es2019/nodeviews/inlineCard.js +17 -19
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +35 -75
- package/dist/es2019/pm-plugins/main.js +4 -3
- package/dist/es2019/ui/AwarenessWrapper/index.js +91 -0
- package/dist/es2019/ui/LinkToolbarAppearance.js +1 -1
- package/dist/es2019/{common/pulse → ui/Pulse}/index.js +1 -1
- package/dist/esm/nodeviews/inlineCard.js +16 -18
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +35 -80
- package/dist/esm/pm-plugins/main.js +4 -3
- package/dist/esm/ui/AwarenessWrapper/index.js +99 -0
- package/dist/esm/ui/LinkToolbarAppearance.js +1 -1
- package/dist/esm/{common/pulse → ui/Pulse}/index.js +1 -1
- package/dist/types/nodeviews/inlineCardWithAwareness.d.ts +2 -3
- package/dist/types/ui/AwarenessWrapper/index.d.ts +13 -0
- package/dist/types-ts4.5/nodeviews/inlineCardWithAwareness.d.ts +2 -3
- package/dist/types-ts4.5/ui/AwarenessWrapper/index.d.ts +13 -0
- package/package.json +5 -5
- /package/dist/types/{common/pulse → ui/Pulse}/index.d.ts +0 -0
- /package/dist/types-ts4.5/{common/pulse → ui/Pulse}/index.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 0.14.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#60441](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60441) [`13892b95e918`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/13892b95e918) - [ux] Refactoring of the inline card with awareness solution (behind a FF)
|
|
8
|
+
|
|
9
|
+
## 0.14.17
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#60808](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60808) [`f509a21be124`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f509a21be124) - ED-21506: @atlaskit/adf-schema upgraded to 35.1.1 to support renderer for MBE
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 0.14.16
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.InlineCardComponent = void 0;
|
|
8
8
|
exports.InlineCardNodeView = InlineCardNodeView;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
12
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -123,7 +124,6 @@ var InlineCardComponent = exports.InlineCardComponent = /*#__PURE__*/function (_
|
|
|
123
124
|
var WrappedInlineCard = (0, _genericCard.Card)(InlineCardComponent, _ui.UnsupportedInline);
|
|
124
125
|
var WrappedInlineCardWithAwareness = (0, _genericCard.Card)(_inlineCardWithAwareness.InlineCardWithAwareness, _ui.UnsupportedInline);
|
|
125
126
|
function InlineCardNodeView(props) {
|
|
126
|
-
var _view$state$selection, _view$state$selection2;
|
|
127
127
|
var useAlternativePreloader = props.useAlternativePreloader,
|
|
128
128
|
node = props.node,
|
|
129
129
|
view = props.view,
|
|
@@ -142,26 +142,24 @@ function InlineCardNodeView(props) {
|
|
|
142
142
|
useAlternativePreloader: useAlternativePreloader
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
// BEGIN: Awareness (To be revisited in EDM-8508)
|
|
147
|
-
var editorState = view.state;
|
|
148
|
-
var linkPosition = getPos && typeof getPos() === 'number' ? getPos() : undefined;
|
|
149
|
-
var canBeUpgradedToEmbed = !!linkPosition && allowEmbeds ? (0, _utils.isEmbedSupportedAtPosition)(linkPosition, editorState, 'inline') : false;
|
|
150
|
-
var canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? (0, _utils.isBlockSupportedAtPosition)(linkPosition, editorState, 'inline') : false;
|
|
151
|
-
var isPulseEnabled = enableInlineUpgradeFeatures && canBeUpgradedToEmbed;
|
|
152
|
-
var isOverlayEnabled = enableInlineUpgradeFeatures && (canBeUpgradedToEmbed || canBeUpgradedToBlock);
|
|
153
|
-
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();
|
|
154
|
-
// END: Awareness
|
|
155
|
-
|
|
156
|
-
return /*#__PURE__*/_react.default.createElement(WrappedInlineCardWithAwareness, {
|
|
145
|
+
return /*#__PURE__*/_react.default.createElement(WrappedInlineCardWithAwareness, (0, _extends2.default)({
|
|
157
146
|
node: node,
|
|
158
147
|
view: view,
|
|
159
148
|
getPos: getPos,
|
|
160
149
|
showServerActions: showServerActions,
|
|
161
150
|
useAlternativePreloader: useAlternativePreloader,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
151
|
+
pluginInjectionApi: pluginInjectionApi
|
|
152
|
+
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards)));
|
|
153
|
+
}
|
|
154
|
+
var getAwarenessProps = function getAwarenessProps(editorState, getPos, allowEmbeds, allowBlockCards) {
|
|
155
|
+
var _editorState$selectio, _editorState$selectio2;
|
|
156
|
+
var linkPosition = getPos && typeof getPos() === 'number' ? getPos() : undefined;
|
|
157
|
+
var canBeUpgradedToEmbed = !!linkPosition && allowEmbeds ? (0, _utils.isEmbedSupportedAtPosition)(linkPosition, editorState, 'inline') : false;
|
|
158
|
+
var canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? (0, _utils.isBlockSupportedAtPosition)(linkPosition, editorState, 'inline') : false;
|
|
159
|
+
var isSelected = editorState.selection instanceof _state.NodeSelection && ((_editorState$selectio = editorState.selection) === null || _editorState$selectio === void 0 || (_editorState$selectio = _editorState$selectio.node) === null || _editorState$selectio === void 0 ? void 0 : _editorState$selectio.type) === editorState.schema.nodes.inlineCard && ((_editorState$selectio2 = editorState.selection) === null || _editorState$selectio2 === void 0 ? void 0 : _editorState$selectio2.from) === getPos();
|
|
160
|
+
return {
|
|
161
|
+
isPulseEnabled: canBeUpgradedToEmbed,
|
|
162
|
+
isOverlayEnabled: canBeUpgradedToEmbed || canBeUpgradedToBlock,
|
|
165
163
|
isSelected: isSelected
|
|
166
|
-
}
|
|
167
|
-
}
|
|
164
|
+
};
|
|
165
|
+
};
|
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.InlineCardWithAwareness = void 0;
|
|
8
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _react2 = require("@emotion/react");
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
12
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
12
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
13
|
var _smartCard = require("@atlaskit/smart-card");
|
|
15
|
-
var _useLinkUpgradeDiscoverability = _interopRequireDefault(require("../common/hooks/useLinkUpgradeDiscoverability"));
|
|
16
|
-
var _localStorage = require("../common/local-storage");
|
|
17
|
-
var _pulse = require("../common/pulse");
|
|
18
14
|
var _actions = require("../pm-plugins/actions");
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// editor adds a standard line-height that is bigger than an inline smart link
|
|
24
|
-
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
25
|
-
var loaderWrapperStyles = (0, _react2.css)({
|
|
26
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
27
|
-
'.loader-wrapper': {
|
|
28
|
-
lineHeight: 'normal'
|
|
29
|
-
}
|
|
30
|
-
});
|
|
15
|
+
var _AwarenessWrapper = require("../ui/AwarenessWrapper");
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
18
|
var InlineCard = function InlineCard(_ref) {
|
|
32
|
-
var _cardContext$value2;
|
|
33
19
|
var node = _ref.node,
|
|
34
20
|
cardContext = _ref.cardContext,
|
|
35
21
|
showServerActions = _ref.showServerActions,
|
|
@@ -44,8 +30,6 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
44
30
|
var _node$attrs = node.attrs,
|
|
45
31
|
url = _node$attrs.url,
|
|
46
32
|
data = _node$attrs.data;
|
|
47
|
-
|
|
48
|
-
// BEGIN: Awareness (To be revisited in EDM-8508)
|
|
49
33
|
var _useState = (0, _react.useState)(false),
|
|
50
34
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
51
35
|
isHovered = _useState2[0],
|
|
@@ -58,33 +42,6 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
58
42
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
59
43
|
isResolvedViewRendered = _useState6[0],
|
|
60
44
|
setIsResolvedViewRendered = _useState6[1];
|
|
61
|
-
var linkPosition = (0, _react.useMemo)(function () {
|
|
62
|
-
if (!getPos || typeof getPos === 'boolean') {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
var pos = getPos();
|
|
66
|
-
return typeof pos === 'number' ? pos : undefined;
|
|
67
|
-
}, [getPos]);
|
|
68
|
-
var _useLinkUpgradeDiscov = (0, _useLinkUpgradeDiscoverability.default)({
|
|
69
|
-
url: url,
|
|
70
|
-
linkPosition: linkPosition || -1,
|
|
71
|
-
cardContext: cardContext === null || cardContext === void 0 ? void 0 : cardContext.value,
|
|
72
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
73
|
-
isOverlayEnabled: isOverlayEnabled,
|
|
74
|
-
isPulseEnabled: isPulseEnabled
|
|
75
|
-
}),
|
|
76
|
-
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse,
|
|
77
|
-
shouldShowToolbarPulse = _useLinkUpgradeDiscov.shouldShowToolbarPulse,
|
|
78
|
-
shouldShowLinkOverlay = _useLinkUpgradeDiscov.shouldShowLinkOverlay,
|
|
79
|
-
isLinkMostRecentlyInserted = _useLinkUpgradeDiscov.isLinkMostRecentlyInserted;
|
|
80
|
-
|
|
81
|
-
// If the toolbar pulse has not yet been invalidated and this is a case where we will be showing it,
|
|
82
|
-
// we need to invalidate the link pulse too. Toolbar pulse will be invalidated in the corresponding component.
|
|
83
|
-
if (isSelected && shouldShowToolbarPulse && !(0, _localStorage.isLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR)) {
|
|
84
|
-
(0, _localStorage.markLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
85
|
-
}
|
|
86
|
-
// END: Awareness
|
|
87
|
-
|
|
88
45
|
var scrollContainer = (0, _react.useMemo)(function () {
|
|
89
46
|
return (0, _ui.findOverflowScrollParent)(view.dom) || undefined;
|
|
90
47
|
}, [view.dom]);
|
|
@@ -116,8 +73,7 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
116
73
|
if (title) {
|
|
117
74
|
setIsResolvedViewRendered(true);
|
|
118
75
|
}
|
|
119
|
-
|
|
120
|
-
}, [view, getPos, isLinkMostRecentlyInserted]);
|
|
76
|
+
}, [view, getPos]);
|
|
121
77
|
var onError = (0, _react.useCallback)(function (data) {
|
|
122
78
|
var url = data.url,
|
|
123
79
|
err = data.err;
|
|
@@ -128,8 +84,22 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
128
84
|
url: url
|
|
129
85
|
});
|
|
130
86
|
}, [onResolve]);
|
|
87
|
+
|
|
88
|
+
// Begin Upgrade Awareness related code
|
|
89
|
+
var markMostRecentlyInsertedLink = (0, _react.useCallback)(function (isLinkMostRecentlyInserted) {
|
|
90
|
+
if (isOverlayEnabled) {
|
|
91
|
+
setIsInserted(isLinkMostRecentlyInserted);
|
|
92
|
+
}
|
|
93
|
+
}, [isOverlayEnabled]);
|
|
94
|
+
var setOverlayHoveredStyles = (0, _react.useCallback)(function (isHovered) {
|
|
95
|
+
if (isOverlayEnabled) {
|
|
96
|
+
setIsHovered(isHovered);
|
|
97
|
+
}
|
|
98
|
+
}, [isOverlayEnabled]);
|
|
99
|
+
// End Upgrade Awareness related code
|
|
100
|
+
|
|
131
101
|
var innerCard = (0, _react.useMemo)(function () {
|
|
132
|
-
return
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
|
|
133
103
|
key: url,
|
|
134
104
|
url: url,
|
|
135
105
|
data: data,
|
|
@@ -143,41 +113,28 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
143
113
|
isHovered: isHovered
|
|
144
114
|
});
|
|
145
115
|
}, [data, isHovered, onError, onResolve, scrollContainer, showServerActions, url, useAlternativePreloader]);
|
|
146
|
-
|
|
147
|
-
// BEGIN: Awareness (To be revisited in EDM-8508)
|
|
148
|
-
var cardWithOverlay = (0, _react.useMemo)(function () {
|
|
149
|
-
return shouldShowLinkOverlay ? (0, _react2.jsx)(_InlineCardOverlay.default, {
|
|
150
|
-
isSelected: isSelected,
|
|
151
|
-
isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
|
|
152
|
-
onMouseEnter: function onMouseEnter() {
|
|
153
|
-
return setIsHovered(true);
|
|
154
|
-
},
|
|
155
|
-
onMouseLeave: function onMouseLeave() {
|
|
156
|
-
return setIsHovered(false);
|
|
157
|
-
},
|
|
158
|
-
url: url
|
|
159
|
-
}, innerCard) : innerCard;
|
|
160
|
-
}, [innerCard, isHovered, isResolvedViewRendered, isSelected, isInserted, shouldShowLinkOverlay, url]);
|
|
161
116
|
var card = (0, _react.useMemo)(function () {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
117
|
+
return isOverlayEnabled || isPulseEnabled ? /*#__PURE__*/_react.default.createElement(_AwarenessWrapper.AwarenessWrapper, {
|
|
118
|
+
isOverlayEnabled: isOverlayEnabled,
|
|
119
|
+
isPulseEnabled: isPulseEnabled,
|
|
120
|
+
cardContext: cardContext,
|
|
121
|
+
getPos: getPos,
|
|
122
|
+
isHovered: isHovered,
|
|
123
|
+
isInserted: isInserted,
|
|
124
|
+
url: url,
|
|
125
|
+
isSelected: isSelected,
|
|
126
|
+
isResolvedViewRendered: isResolvedViewRendered,
|
|
127
|
+
markMostRecentlyInsertedLink: markMostRecentlyInsertedLink,
|
|
128
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
129
|
+
setOverlayHoveredStyles: setOverlayHoveredStyles
|
|
130
|
+
}, innerCard) : /*#__PURE__*/_react.default.createElement("span", {
|
|
165
131
|
className: "card"
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
attributes: (0, _utils.getResolvedAttributesFromStore)(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
|
|
169
|
-
}
|
|
170
|
-
}, (0, _react2.jsx)(_pulse.DiscoveryPulse, {
|
|
171
|
-
localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
172
|
-
localStorageKeyExpirationInMs: _localStorage.ONE_DAY_IN_MILLISECONDS,
|
|
173
|
-
discoveryMode: "start"
|
|
174
|
-
}, cardWithOverlay)) : cardWithOverlay);
|
|
175
|
-
}, [shouldShowLinkPulse, cardWithOverlay, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store]);
|
|
176
|
-
// END: Awareness
|
|
132
|
+
}, innerCard);
|
|
133
|
+
}, [cardContext, getPos, innerCard, isHovered, isInserted, isOverlayEnabled, isPulseEnabled, isResolvedViewRendered, isSelected, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url]);
|
|
177
134
|
|
|
178
135
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
179
136
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
180
|
-
return cardContext && cardContext.value ?
|
|
137
|
+
return cardContext && cardContext.value ? /*#__PURE__*/_react.default.createElement(cardContext.Provider, {
|
|
181
138
|
value: cardContext.value
|
|
182
139
|
}, card) : data ? card : null;
|
|
183
140
|
};
|
|
@@ -60,6 +60,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
60
60
|
allowEmbeds = options.allowEmbeds,
|
|
61
61
|
allowBlockCards = options.allowBlockCards;
|
|
62
62
|
var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability && platform !== 'mobile';
|
|
63
|
+
var shouldUseUpgradeFeatures = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.inline-switcher') && enableInlineUpgradeFeatures;
|
|
63
64
|
var inlineCardViewProducer = (0, _reactNodeView.getInlineNodeViewProducer)({
|
|
64
65
|
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
65
66
|
Component: _inlineCard.InlineCardNodeView,
|
|
@@ -103,7 +104,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
103
104
|
if (!meta) {
|
|
104
105
|
return pluginStateWithUpdatedPos;
|
|
105
106
|
}
|
|
106
|
-
if (!
|
|
107
|
+
if (!shouldUseUpgradeFeatures) {
|
|
107
108
|
return (0, _reducers.default)(pluginStateWithUpdatedPos, meta);
|
|
108
109
|
}
|
|
109
110
|
var newState = (0, _reducers.default)(pluginStateWithUpdatedPos, meta);
|
|
@@ -111,7 +112,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
111
112
|
// the code below is related to the "Inline Switcher" project, for more information pls see EDM-7984
|
|
112
113
|
var isSingleInlineLink = (pluginState === null || pluginState === void 0 || (_pluginState$requests = pluginState.requests) === null || _pluginState$requests === void 0 ? void 0 : _pluginState$requests.length) === 1 && pluginState.requests[0].appearance === 'inline';
|
|
113
114
|
var isSmartLinkPulseDiscovered = (0, _localStorage.isLocalStorageKeyDiscovered)(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
114
|
-
if (meta.type !== 'RESOLVE' || !
|
|
115
|
+
if (meta.type !== 'RESOLVE' || !isSingleInlineLink) {
|
|
115
116
|
return newState;
|
|
116
117
|
}
|
|
117
118
|
var linkPosition = pluginState.requests[0].pos;
|
|
@@ -253,7 +254,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
253
254
|
return new _embedCard.EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
|
-
},
|
|
257
|
+
}, shouldUseUpgradeFeatures && {
|
|
257
258
|
handleKeyDown: function handleKeyDown(view) {
|
|
258
259
|
handleAwarenessOverlay(view);
|
|
259
260
|
return false;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AwarenessWrapper = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
12
|
+
var _useLinkUpgradeDiscoverability = _interopRequireDefault(require("../../common/hooks/useLinkUpgradeDiscoverability"));
|
|
13
|
+
var _localStorage = require("../../common/local-storage");
|
|
14
|
+
var _utils = require("../../utils");
|
|
15
|
+
var _InlineCardOverlay = _interopRequireDefault(require("../InlineCardOverlay"));
|
|
16
|
+
var _Pulse = require("../Pulse");
|
|
17
|
+
/** @jsx jsx */
|
|
18
|
+
|
|
19
|
+
// editor adds a standard line-height that is bigger than an inline smart link
|
|
20
|
+
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
21
|
+
var loaderWrapperStyles = (0, _react2.css)({
|
|
22
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
23
|
+
'.loader-wrapper': {
|
|
24
|
+
lineHeight: 'normal'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref) {
|
|
28
|
+
var _cardContext$value2;
|
|
29
|
+
var cardContext = _ref.cardContext,
|
|
30
|
+
children = _ref.children,
|
|
31
|
+
getPos = _ref.getPos,
|
|
32
|
+
isInserted = _ref.isInserted,
|
|
33
|
+
isOverlayEnabled = _ref.isOverlayEnabled,
|
|
34
|
+
isSelected = _ref.isSelected,
|
|
35
|
+
isResolvedViewRendered = _ref.isResolvedViewRendered,
|
|
36
|
+
isPulseEnabled = _ref.isPulseEnabled,
|
|
37
|
+
markMostRecentlyInsertedLink = _ref.markMostRecentlyInsertedLink,
|
|
38
|
+
pluginInjectionApi = _ref.pluginInjectionApi,
|
|
39
|
+
setOverlayHoveredStyles = _ref.setOverlayHoveredStyles,
|
|
40
|
+
url = _ref.url;
|
|
41
|
+
var _useState = (0, _react.useState)(false),
|
|
42
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
43
|
+
isHovered = _useState2[0],
|
|
44
|
+
setIsHovered = _useState2[1];
|
|
45
|
+
var linkPosition = (0, _react.useMemo)(function () {
|
|
46
|
+
if (!getPos || typeof getPos === 'boolean') {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
var pos = getPos();
|
|
50
|
+
return typeof pos === 'number' ? pos : undefined;
|
|
51
|
+
}, [getPos]);
|
|
52
|
+
var _useLinkUpgradeDiscov = (0, _useLinkUpgradeDiscoverability.default)({
|
|
53
|
+
url: url,
|
|
54
|
+
linkPosition: linkPosition || -1,
|
|
55
|
+
cardContext: cardContext === null || cardContext === void 0 ? void 0 : cardContext.value,
|
|
56
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
57
|
+
isOverlayEnabled: isOverlayEnabled,
|
|
58
|
+
isPulseEnabled: isPulseEnabled
|
|
59
|
+
}),
|
|
60
|
+
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse,
|
|
61
|
+
shouldShowToolbarPulse = _useLinkUpgradeDiscov.shouldShowToolbarPulse,
|
|
62
|
+
shouldShowLinkOverlay = _useLinkUpgradeDiscov.shouldShowLinkOverlay,
|
|
63
|
+
isLinkMostRecentlyInserted = _useLinkUpgradeDiscov.isLinkMostRecentlyInserted;
|
|
64
|
+
|
|
65
|
+
// If the toolbar pulse has not yet been invalidated and this is a case where we will be showing it,
|
|
66
|
+
// we need to invalidate the link pulse too. Toolbar pulse will be invalidated in the corresponding component.
|
|
67
|
+
if (isSelected && shouldShowToolbarPulse && !(0, _localStorage.isLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR)) {
|
|
68
|
+
(0, _localStorage.markLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
69
|
+
}
|
|
70
|
+
(0, _react.useEffect)(function () {
|
|
71
|
+
if (shouldShowLinkOverlay && isLinkMostRecentlyInserted) {
|
|
72
|
+
markMostRecentlyInsertedLink(true);
|
|
73
|
+
}
|
|
74
|
+
}, [isLinkMostRecentlyInserted, markMostRecentlyInsertedLink, shouldShowLinkOverlay]);
|
|
75
|
+
var handleOverlayChange = (0, _react.useCallback)(function (isHovered) {
|
|
76
|
+
setIsHovered(isHovered);
|
|
77
|
+
setOverlayHoveredStyles(isHovered);
|
|
78
|
+
}, [setOverlayHoveredStyles]);
|
|
79
|
+
var cardWithOverlay = (0, _react.useMemo)(function () {
|
|
80
|
+
return shouldShowLinkOverlay ? (0, _react2.jsx)(_InlineCardOverlay.default, {
|
|
81
|
+
isSelected: isSelected,
|
|
82
|
+
isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
|
|
83
|
+
onMouseEnter: function onMouseEnter() {
|
|
84
|
+
return handleOverlayChange(true);
|
|
85
|
+
},
|
|
86
|
+
onMouseLeave: function onMouseLeave() {
|
|
87
|
+
return handleOverlayChange(false);
|
|
88
|
+
},
|
|
89
|
+
url: url
|
|
90
|
+
}, children) : children;
|
|
91
|
+
}, [shouldShowLinkOverlay, isSelected, isResolvedViewRendered, isInserted, isHovered, url, children, handleOverlayChange]);
|
|
92
|
+
return (0, _react.useMemo)(function () {
|
|
93
|
+
var _cardContext$value;
|
|
94
|
+
return (0, _react2.jsx)("span", {
|
|
95
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
96
|
+
className: "card"
|
|
97
|
+
}, shouldShowLinkPulse ? (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
|
|
98
|
+
data: {
|
|
99
|
+
attributes: (0, _utils.getResolvedAttributesFromStore)(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
|
|
100
|
+
}
|
|
101
|
+
}, (0, _react2.jsx)(_Pulse.DiscoveryPulse, {
|
|
102
|
+
localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
103
|
+
localStorageKeyExpirationInMs: _localStorage.ONE_DAY_IN_MILLISECONDS,
|
|
104
|
+
discoveryMode: "start"
|
|
105
|
+
}, cardWithOverlay)) : cardWithOverlay);
|
|
106
|
+
}, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, cardWithOverlay]);
|
|
107
|
+
};
|
|
@@ -22,9 +22,9 @@ var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/message
|
|
|
22
22
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
23
23
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
24
24
|
var _localStorage = require("../common/local-storage");
|
|
25
|
-
var _pulse = require("../common/pulse");
|
|
26
25
|
var _toolbar = require("../toolbar");
|
|
27
26
|
var _utils2 = require("../utils");
|
|
27
|
+
var _Pulse = require("./Pulse");
|
|
28
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
30
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -134,7 +134,7 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
|
|
|
134
134
|
data: {
|
|
135
135
|
attributes: _objectSpread({}, resolvedAnalyticsAttributes)
|
|
136
136
|
}
|
|
137
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
137
|
+
}, /*#__PURE__*/_react.default.createElement(_Pulse.DiscoveryPulse, {
|
|
138
138
|
localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
|
|
139
139
|
}, LinkToolbarButtons));
|
|
140
140
|
}
|
|
@@ -8,7 +8,7 @@ exports.DiscoveryPulse = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
10
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
11
|
-
var _localStorage = require("
|
|
11
|
+
var _localStorage = require("../../common/local-storage");
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
14
|
var DiscoveryPulse = exports.DiscoveryPulse = function DiscoveryPulse(_ref) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
@@ -103,7 +104,6 @@ _defineProperty(InlineCardComponent, "contextTypes", {
|
|
|
103
104
|
const WrappedInlineCard = Card(InlineCardComponent, UnsupportedInline);
|
|
104
105
|
const WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
|
|
105
106
|
export function InlineCardNodeView(props) {
|
|
106
|
-
var _view$state$selection, _view$state$selection2, _view$state$selection3;
|
|
107
107
|
const {
|
|
108
108
|
useAlternativePreloader,
|
|
109
109
|
node,
|
|
@@ -124,26 +124,24 @@ export function InlineCardNodeView(props) {
|
|
|
124
124
|
useAlternativePreloader: useAlternativePreloader
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
// BEGIN: Awareness (To be revisited in EDM-8508)
|
|
129
|
-
const editorState = view.state;
|
|
130
|
-
const linkPosition = getPos && typeof getPos() === 'number' ? getPos() : undefined;
|
|
131
|
-
const canBeUpgradedToEmbed = !!linkPosition && allowEmbeds ? isEmbedSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
132
|
-
const canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? isBlockSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
133
|
-
const isPulseEnabled = enableInlineUpgradeFeatures && canBeUpgradedToEmbed;
|
|
134
|
-
const isOverlayEnabled = enableInlineUpgradeFeatures && (canBeUpgradedToEmbed || canBeUpgradedToBlock);
|
|
135
|
-
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();
|
|
136
|
-
// END: Awareness
|
|
137
|
-
|
|
138
|
-
return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, {
|
|
127
|
+
return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, _extends({
|
|
139
128
|
node: node,
|
|
140
129
|
view: view,
|
|
141
130
|
getPos: getPos,
|
|
142
131
|
showServerActions: showServerActions,
|
|
143
132
|
useAlternativePreloader: useAlternativePreloader,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
133
|
+
pluginInjectionApi: pluginInjectionApi
|
|
134
|
+
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards)));
|
|
135
|
+
}
|
|
136
|
+
const getAwarenessProps = (editorState, getPos, allowEmbeds, allowBlockCards) => {
|
|
137
|
+
var _editorState$selectio, _editorState$selectio2, _editorState$selectio3;
|
|
138
|
+
const linkPosition = getPos && typeof getPos() === 'number' ? getPos() : undefined;
|
|
139
|
+
const canBeUpgradedToEmbed = !!linkPosition && allowEmbeds ? isEmbedSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
140
|
+
const canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? isBlockSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
141
|
+
const isSelected = editorState.selection instanceof NodeSelection && ((_editorState$selectio = editorState.selection) === null || _editorState$selectio === void 0 ? void 0 : (_editorState$selectio2 = _editorState$selectio.node) === null || _editorState$selectio2 === void 0 ? void 0 : _editorState$selectio2.type) === editorState.schema.nodes.inlineCard && ((_editorState$selectio3 = editorState.selection) === null || _editorState$selectio3 === void 0 ? void 0 : _editorState$selectio3.from) === getPos();
|
|
142
|
+
return {
|
|
143
|
+
isPulseEnabled: canBeUpgradedToEmbed,
|
|
144
|
+
isOverlayEnabled: canBeUpgradedToEmbed || canBeUpgradedToBlock,
|
|
145
|
+
isSelected
|
|
146
|
+
};
|
|
147
|
+
};
|
|
@@ -1,24 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { memo, useCallback, useMemo, useState } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
4
2
|
import rafSchedule from 'raf-schd';
|
|
5
|
-
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
3
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
7
4
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
8
|
-
import useLinkUpgradeDiscoverability from '../common/hooks/useLinkUpgradeDiscoverability';
|
|
9
|
-
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../common/local-storage';
|
|
10
|
-
import { DiscoveryPulse } from '../common/pulse';
|
|
11
5
|
import { registerCard, registerRemoveOverlay } from '../pm-plugins/actions';
|
|
12
|
-
import
|
|
13
|
-
import { getResolvedAttributesFromStore } from '../utils';
|
|
14
|
-
// editor adds a standard line-height that is bigger than an inline smart link
|
|
15
|
-
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
16
|
-
const loaderWrapperStyles = css({
|
|
17
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
18
|
-
'.loader-wrapper': {
|
|
19
|
-
lineHeight: 'normal'
|
|
20
|
-
}
|
|
21
|
-
});
|
|
6
|
+
import { AwarenessWrapper } from '../ui/AwarenessWrapper';
|
|
22
7
|
const InlineCard = ({
|
|
23
8
|
node,
|
|
24
9
|
cardContext,
|
|
@@ -31,44 +16,13 @@ const InlineCard = ({
|
|
|
31
16
|
pluginInjectionApi,
|
|
32
17
|
isSelected = false
|
|
33
18
|
}) => {
|
|
34
|
-
var _cardContext$value2;
|
|
35
19
|
const {
|
|
36
20
|
url,
|
|
37
21
|
data
|
|
38
22
|
} = node.attrs;
|
|
39
|
-
|
|
40
|
-
// BEGIN: Awareness (To be revisited in EDM-8508)
|
|
41
23
|
const [isHovered, setIsHovered] = useState(false);
|
|
42
24
|
const [isInserted, setIsInserted] = useState(false);
|
|
43
25
|
const [isResolvedViewRendered, setIsResolvedViewRendered] = useState(false);
|
|
44
|
-
const linkPosition = useMemo(() => {
|
|
45
|
-
if (!getPos || typeof getPos === 'boolean') {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
const pos = getPos();
|
|
49
|
-
return typeof pos === 'number' ? pos : undefined;
|
|
50
|
-
}, [getPos]);
|
|
51
|
-
const {
|
|
52
|
-
shouldShowLinkPulse,
|
|
53
|
-
shouldShowToolbarPulse,
|
|
54
|
-
shouldShowLinkOverlay,
|
|
55
|
-
isLinkMostRecentlyInserted
|
|
56
|
-
} = useLinkUpgradeDiscoverability({
|
|
57
|
-
url,
|
|
58
|
-
linkPosition: linkPosition || -1,
|
|
59
|
-
cardContext: cardContext === null || cardContext === void 0 ? void 0 : cardContext.value,
|
|
60
|
-
pluginInjectionApi,
|
|
61
|
-
isOverlayEnabled,
|
|
62
|
-
isPulseEnabled
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// If the toolbar pulse has not yet been invalidated and this is a case where we will be showing it,
|
|
66
|
-
// we need to invalidate the link pulse too. Toolbar pulse will be invalidated in the corresponding component.
|
|
67
|
-
if (isSelected && shouldShowToolbarPulse && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR)) {
|
|
68
|
-
markLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
69
|
-
}
|
|
70
|
-
// END: Awareness
|
|
71
|
-
|
|
72
26
|
const scrollContainer = useMemo(() => findOverflowScrollParent(view.dom) || undefined, [view.dom]);
|
|
73
27
|
const onResolve = useCallback(data => {
|
|
74
28
|
if (!getPos || typeof getPos === 'boolean') {
|
|
@@ -98,8 +52,7 @@ const InlineCard = ({
|
|
|
98
52
|
if (title) {
|
|
99
53
|
setIsResolvedViewRendered(true);
|
|
100
54
|
}
|
|
101
|
-
|
|
102
|
-
}, [view, getPos, isLinkMostRecentlyInserted]);
|
|
55
|
+
}, [view, getPos]);
|
|
103
56
|
const onError = useCallback(data => {
|
|
104
57
|
const {
|
|
105
58
|
url,
|
|
@@ -112,7 +65,21 @@ const InlineCard = ({
|
|
|
112
65
|
url
|
|
113
66
|
});
|
|
114
67
|
}, [onResolve]);
|
|
115
|
-
|
|
68
|
+
|
|
69
|
+
// Begin Upgrade Awareness related code
|
|
70
|
+
const markMostRecentlyInsertedLink = useCallback(isLinkMostRecentlyInserted => {
|
|
71
|
+
if (isOverlayEnabled) {
|
|
72
|
+
setIsInserted(isLinkMostRecentlyInserted);
|
|
73
|
+
}
|
|
74
|
+
}, [isOverlayEnabled]);
|
|
75
|
+
const setOverlayHoveredStyles = useCallback(isHovered => {
|
|
76
|
+
if (isOverlayEnabled) {
|
|
77
|
+
setIsHovered(isHovered);
|
|
78
|
+
}
|
|
79
|
+
}, [isOverlayEnabled]);
|
|
80
|
+
// End Upgrade Awareness related code
|
|
81
|
+
|
|
82
|
+
const innerCard = useMemo(() => /*#__PURE__*/React.createElement(SmartCard, {
|
|
116
83
|
key: url,
|
|
117
84
|
url: url,
|
|
118
85
|
data: data,
|
|
@@ -125,35 +92,28 @@ const InlineCard = ({
|
|
|
125
92
|
showServerActions: showServerActions,
|
|
126
93
|
isHovered: isHovered
|
|
127
94
|
}), [data, isHovered, onError, onResolve, scrollContainer, showServerActions, url, useAlternativePreloader]);
|
|
128
|
-
|
|
129
|
-
// BEGIN: Awareness (To be revisited in EDM-8508)
|
|
130
|
-
const cardWithOverlay = useMemo(() => shouldShowLinkOverlay ? jsx(InlineCardOverlay, {
|
|
131
|
-
isSelected: isSelected,
|
|
132
|
-
isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
|
|
133
|
-
onMouseEnter: () => setIsHovered(true),
|
|
134
|
-
onMouseLeave: () => setIsHovered(false),
|
|
135
|
-
url: url
|
|
136
|
-
}, innerCard) : innerCard, [innerCard, isHovered, isResolvedViewRendered, isSelected, isInserted, shouldShowLinkOverlay, url]);
|
|
137
95
|
const card = useMemo(() => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
96
|
+
return isOverlayEnabled || isPulseEnabled ? /*#__PURE__*/React.createElement(AwarenessWrapper, {
|
|
97
|
+
isOverlayEnabled: isOverlayEnabled,
|
|
98
|
+
isPulseEnabled: isPulseEnabled,
|
|
99
|
+
cardContext: cardContext,
|
|
100
|
+
getPos: getPos,
|
|
101
|
+
isHovered: isHovered,
|
|
102
|
+
isInserted: isInserted,
|
|
103
|
+
url: url,
|
|
104
|
+
isSelected: isSelected,
|
|
105
|
+
isResolvedViewRendered: isResolvedViewRendered,
|
|
106
|
+
markMostRecentlyInsertedLink: markMostRecentlyInsertedLink,
|
|
107
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
108
|
+
setOverlayHoveredStyles: setOverlayHoveredStyles
|
|
109
|
+
}, innerCard) : /*#__PURE__*/React.createElement("span", {
|
|
141
110
|
className: "card"
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
|
|
145
|
-
}
|
|
146
|
-
}, jsx(DiscoveryPulse, {
|
|
147
|
-
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
148
|
-
localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
|
|
149
|
-
discoveryMode: "start"
|
|
150
|
-
}, cardWithOverlay)) : cardWithOverlay);
|
|
151
|
-
}, [shouldShowLinkPulse, cardWithOverlay, url, cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store]);
|
|
152
|
-
// END: Awareness
|
|
111
|
+
}, innerCard);
|
|
112
|
+
}, [cardContext, getPos, innerCard, isHovered, isInserted, isOverlayEnabled, isPulseEnabled, isResolvedViewRendered, isSelected, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url]);
|
|
153
113
|
|
|
154
114
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
155
115
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
156
|
-
return cardContext && cardContext.value ?
|
|
116
|
+
return cardContext && cardContext.value ? /*#__PURE__*/React.createElement(cardContext.Provider, {
|
|
157
117
|
value: cardContext.value
|
|
158
118
|
}, card) : data ? card : null;
|
|
159
119
|
};
|
|
@@ -45,6 +45,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
45
45
|
allowBlockCards
|
|
46
46
|
} = options;
|
|
47
47
|
const enableInlineUpgradeFeatures = !!showUpgradeDiscoverability && platform !== 'mobile';
|
|
48
|
+
const shouldUseUpgradeFeatures = getBooleanFF('platform.linking-platform.smart-card.inline-switcher') && enableInlineUpgradeFeatures;
|
|
48
49
|
const inlineCardViewProducer = getInlineNodeViewProducer({
|
|
49
50
|
pmPluginFactoryParams,
|
|
50
51
|
Component: InlineCardNodeView,
|
|
@@ -88,7 +89,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
88
89
|
if (!meta) {
|
|
89
90
|
return pluginStateWithUpdatedPos;
|
|
90
91
|
}
|
|
91
|
-
if (!
|
|
92
|
+
if (!shouldUseUpgradeFeatures) {
|
|
92
93
|
return reducer(pluginStateWithUpdatedPos, meta);
|
|
93
94
|
}
|
|
94
95
|
const newState = reducer(pluginStateWithUpdatedPos, meta);
|
|
@@ -96,7 +97,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
96
97
|
// the code below is related to the "Inline Switcher" project, for more information pls see EDM-7984
|
|
97
98
|
const isSingleInlineLink = (pluginState === null || pluginState === void 0 ? void 0 : (_pluginState$requests = pluginState.requests) === null || _pluginState$requests === void 0 ? void 0 : _pluginState$requests.length) === 1 && pluginState.requests[0].appearance === 'inline';
|
|
98
99
|
const isSmartLinkPulseDiscovered = isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
99
|
-
if (meta.type !== 'RESOLVE' || !
|
|
100
|
+
if (meta.type !== 'RESOLVE' || !isSingleInlineLink) {
|
|
100
101
|
return newState;
|
|
101
102
|
}
|
|
102
103
|
const linkPosition = pluginState.requests[0].pos;
|
|
@@ -246,7 +247,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
246
247
|
return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
247
248
|
}
|
|
248
249
|
},
|
|
249
|
-
...(
|
|
250
|
+
...(shouldUseUpgradeFeatures && {
|
|
250
251
|
handleKeyDown: view => {
|
|
251
252
|
handleAwarenessOverlay(view);
|
|
252
253
|
return false;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
5
|
+
import useLinkUpgradeDiscoverability from '../../common/hooks/useLinkUpgradeDiscoverability';
|
|
6
|
+
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../../common/local-storage';
|
|
7
|
+
import { getResolvedAttributesFromStore } from '../../utils';
|
|
8
|
+
import InlineCardOverlay from '../InlineCardOverlay';
|
|
9
|
+
import { DiscoveryPulse } from '../Pulse';
|
|
10
|
+
// editor adds a standard line-height that is bigger than an inline smart link
|
|
11
|
+
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
12
|
+
const loaderWrapperStyles = css({
|
|
13
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
14
|
+
'.loader-wrapper': {
|
|
15
|
+
lineHeight: 'normal'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export const AwarenessWrapper = ({
|
|
19
|
+
cardContext,
|
|
20
|
+
children,
|
|
21
|
+
getPos,
|
|
22
|
+
isInserted,
|
|
23
|
+
isOverlayEnabled,
|
|
24
|
+
isSelected,
|
|
25
|
+
isResolvedViewRendered,
|
|
26
|
+
isPulseEnabled,
|
|
27
|
+
markMostRecentlyInsertedLink,
|
|
28
|
+
pluginInjectionApi,
|
|
29
|
+
setOverlayHoveredStyles,
|
|
30
|
+
url
|
|
31
|
+
}) => {
|
|
32
|
+
var _cardContext$value2;
|
|
33
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
34
|
+
const linkPosition = useMemo(() => {
|
|
35
|
+
if (!getPos || typeof getPos === 'boolean') {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const pos = getPos();
|
|
39
|
+
return typeof pos === 'number' ? pos : undefined;
|
|
40
|
+
}, [getPos]);
|
|
41
|
+
const {
|
|
42
|
+
shouldShowLinkPulse,
|
|
43
|
+
shouldShowToolbarPulse,
|
|
44
|
+
shouldShowLinkOverlay,
|
|
45
|
+
isLinkMostRecentlyInserted
|
|
46
|
+
} = useLinkUpgradeDiscoverability({
|
|
47
|
+
url,
|
|
48
|
+
linkPosition: linkPosition || -1,
|
|
49
|
+
cardContext: cardContext === null || cardContext === void 0 ? void 0 : cardContext.value,
|
|
50
|
+
pluginInjectionApi,
|
|
51
|
+
isOverlayEnabled,
|
|
52
|
+
isPulseEnabled
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// If the toolbar pulse has not yet been invalidated and this is a case where we will be showing it,
|
|
56
|
+
// we need to invalidate the link pulse too. Toolbar pulse will be invalidated in the corresponding component.
|
|
57
|
+
if (isSelected && shouldShowToolbarPulse && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR)) {
|
|
58
|
+
markLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
59
|
+
}
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (shouldShowLinkOverlay && isLinkMostRecentlyInserted) {
|
|
62
|
+
markMostRecentlyInsertedLink(true);
|
|
63
|
+
}
|
|
64
|
+
}, [isLinkMostRecentlyInserted, markMostRecentlyInsertedLink, shouldShowLinkOverlay]);
|
|
65
|
+
const handleOverlayChange = useCallback(isHovered => {
|
|
66
|
+
setIsHovered(isHovered);
|
|
67
|
+
setOverlayHoveredStyles(isHovered);
|
|
68
|
+
}, [setOverlayHoveredStyles]);
|
|
69
|
+
const cardWithOverlay = useMemo(() => shouldShowLinkOverlay ? jsx(InlineCardOverlay, {
|
|
70
|
+
isSelected: isSelected,
|
|
71
|
+
isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
|
|
72
|
+
onMouseEnter: () => handleOverlayChange(true),
|
|
73
|
+
onMouseLeave: () => handleOverlayChange(false),
|
|
74
|
+
url: url
|
|
75
|
+
}, children) : children, [shouldShowLinkOverlay, isSelected, isResolvedViewRendered, isInserted, isHovered, url, children, handleOverlayChange]);
|
|
76
|
+
return useMemo(() => {
|
|
77
|
+
var _cardContext$value;
|
|
78
|
+
return jsx("span", {
|
|
79
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
80
|
+
className: "card"
|
|
81
|
+
}, shouldShowLinkPulse ? jsx(AnalyticsContext, {
|
|
82
|
+
data: {
|
|
83
|
+
attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
|
|
84
|
+
}
|
|
85
|
+
}, jsx(DiscoveryPulse, {
|
|
86
|
+
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
87
|
+
localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
|
|
88
|
+
discoveryMode: "start"
|
|
89
|
+
}, cardWithOverlay)) : cardWithOverlay);
|
|
90
|
+
}, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, cardWithOverlay]);
|
|
91
|
+
};
|
|
@@ -8,9 +8,9 @@ import nodeNames, { cardMessages as messages } from '@atlaskit/editor-common/mes
|
|
|
8
8
|
import { isSupportedInParent } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
10
10
|
import { LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from '../common/local-storage';
|
|
11
|
-
import { DiscoveryPulse } from '../common/pulse';
|
|
12
11
|
import { shouldRenderToolbarPulse } from '../toolbar';
|
|
13
12
|
import { getResolvedAttributesFromStore } from '../utils';
|
|
13
|
+
import { DiscoveryPulse } from './Pulse';
|
|
14
14
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
15
15
|
export class LinkToolbarAppearance extends React.Component {
|
|
16
16
|
constructor(...args) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { Pulse } from '@atlaskit/linking-common';
|
|
4
|
-
import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '
|
|
4
|
+
import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '../../common/local-storage';
|
|
5
5
|
export const DiscoveryPulse = ({
|
|
6
6
|
children,
|
|
7
7
|
localStorageKey,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -116,7 +117,6 @@ _defineProperty(InlineCardComponent, "contextTypes", {
|
|
|
116
117
|
var WrappedInlineCard = Card(InlineCardComponent, UnsupportedInline);
|
|
117
118
|
var WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
|
|
118
119
|
export function InlineCardNodeView(props) {
|
|
119
|
-
var _view$state$selection, _view$state$selection2;
|
|
120
120
|
var useAlternativePreloader = props.useAlternativePreloader,
|
|
121
121
|
node = props.node,
|
|
122
122
|
view = props.view,
|
|
@@ -135,26 +135,24 @@ export function InlineCardNodeView(props) {
|
|
|
135
135
|
useAlternativePreloader: useAlternativePreloader
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
// BEGIN: Awareness (To be revisited in EDM-8508)
|
|
140
|
-
var editorState = view.state;
|
|
141
|
-
var linkPosition = getPos && typeof getPos() === 'number' ? getPos() : undefined;
|
|
142
|
-
var canBeUpgradedToEmbed = !!linkPosition && allowEmbeds ? isEmbedSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
143
|
-
var canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? isBlockSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
144
|
-
var isPulseEnabled = enableInlineUpgradeFeatures && canBeUpgradedToEmbed;
|
|
145
|
-
var isOverlayEnabled = enableInlineUpgradeFeatures && (canBeUpgradedToEmbed || canBeUpgradedToBlock);
|
|
146
|
-
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();
|
|
147
|
-
// END: Awareness
|
|
148
|
-
|
|
149
|
-
return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, {
|
|
138
|
+
return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, _extends({
|
|
150
139
|
node: node,
|
|
151
140
|
view: view,
|
|
152
141
|
getPos: getPos,
|
|
153
142
|
showServerActions: showServerActions,
|
|
154
143
|
useAlternativePreloader: useAlternativePreloader,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
144
|
+
pluginInjectionApi: pluginInjectionApi
|
|
145
|
+
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards)));
|
|
146
|
+
}
|
|
147
|
+
var getAwarenessProps = function getAwarenessProps(editorState, getPos, allowEmbeds, allowBlockCards) {
|
|
148
|
+
var _editorState$selectio, _editorState$selectio2;
|
|
149
|
+
var linkPosition = getPos && typeof getPos() === 'number' ? getPos() : undefined;
|
|
150
|
+
var canBeUpgradedToEmbed = !!linkPosition && allowEmbeds ? isEmbedSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
151
|
+
var canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? isBlockSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
152
|
+
var isSelected = editorState.selection instanceof NodeSelection && ((_editorState$selectio = editorState.selection) === null || _editorState$selectio === void 0 || (_editorState$selectio = _editorState$selectio.node) === null || _editorState$selectio === void 0 ? void 0 : _editorState$selectio.type) === editorState.schema.nodes.inlineCard && ((_editorState$selectio2 = editorState.selection) === null || _editorState$selectio2 === void 0 ? void 0 : _editorState$selectio2.from) === getPos();
|
|
153
|
+
return {
|
|
154
|
+
isPulseEnabled: canBeUpgradedToEmbed,
|
|
155
|
+
isOverlayEnabled: canBeUpgradedToEmbed || canBeUpgradedToBlock,
|
|
158
156
|
isSelected: isSelected
|
|
159
|
-
}
|
|
160
|
-
}
|
|
157
|
+
};
|
|
158
|
+
};
|
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
|
|
3
|
-
import { memo, useCallback, useMemo, useState } from 'react';
|
|
4
|
-
import { css, jsx } from '@emotion/react';
|
|
2
|
+
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
5
3
|
import rafSchedule from 'raf-schd';
|
|
6
|
-
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
7
4
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
8
5
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
9
|
-
import useLinkUpgradeDiscoverability from '../common/hooks/useLinkUpgradeDiscoverability';
|
|
10
|
-
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../common/local-storage';
|
|
11
|
-
import { DiscoveryPulse } from '../common/pulse';
|
|
12
6
|
import { registerCard, registerRemoveOverlay } from '../pm-plugins/actions';
|
|
13
|
-
import
|
|
14
|
-
import { getResolvedAttributesFromStore } from '../utils';
|
|
15
|
-
// editor adds a standard line-height that is bigger than an inline smart link
|
|
16
|
-
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
17
|
-
var loaderWrapperStyles = css({
|
|
18
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
19
|
-
'.loader-wrapper': {
|
|
20
|
-
lineHeight: 'normal'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
7
|
+
import { AwarenessWrapper } from '../ui/AwarenessWrapper';
|
|
23
8
|
var InlineCard = function InlineCard(_ref) {
|
|
24
|
-
var _cardContext$value2;
|
|
25
9
|
var node = _ref.node,
|
|
26
10
|
cardContext = _ref.cardContext,
|
|
27
11
|
showServerActions = _ref.showServerActions,
|
|
@@ -36,8 +20,6 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
36
20
|
var _node$attrs = node.attrs,
|
|
37
21
|
url = _node$attrs.url,
|
|
38
22
|
data = _node$attrs.data;
|
|
39
|
-
|
|
40
|
-
// BEGIN: Awareness (To be revisited in EDM-8508)
|
|
41
23
|
var _useState = useState(false),
|
|
42
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
43
25
|
isHovered = _useState2[0],
|
|
@@ -50,33 +32,6 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
50
32
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
51
33
|
isResolvedViewRendered = _useState6[0],
|
|
52
34
|
setIsResolvedViewRendered = _useState6[1];
|
|
53
|
-
var linkPosition = useMemo(function () {
|
|
54
|
-
if (!getPos || typeof getPos === 'boolean') {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
var pos = getPos();
|
|
58
|
-
return typeof pos === 'number' ? pos : undefined;
|
|
59
|
-
}, [getPos]);
|
|
60
|
-
var _useLinkUpgradeDiscov = useLinkUpgradeDiscoverability({
|
|
61
|
-
url: url,
|
|
62
|
-
linkPosition: linkPosition || -1,
|
|
63
|
-
cardContext: cardContext === null || cardContext === void 0 ? void 0 : cardContext.value,
|
|
64
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
65
|
-
isOverlayEnabled: isOverlayEnabled,
|
|
66
|
-
isPulseEnabled: isPulseEnabled
|
|
67
|
-
}),
|
|
68
|
-
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse,
|
|
69
|
-
shouldShowToolbarPulse = _useLinkUpgradeDiscov.shouldShowToolbarPulse,
|
|
70
|
-
shouldShowLinkOverlay = _useLinkUpgradeDiscov.shouldShowLinkOverlay,
|
|
71
|
-
isLinkMostRecentlyInserted = _useLinkUpgradeDiscov.isLinkMostRecentlyInserted;
|
|
72
|
-
|
|
73
|
-
// If the toolbar pulse has not yet been invalidated and this is a case where we will be showing it,
|
|
74
|
-
// we need to invalidate the link pulse too. Toolbar pulse will be invalidated in the corresponding component.
|
|
75
|
-
if (isSelected && shouldShowToolbarPulse && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR)) {
|
|
76
|
-
markLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
77
|
-
}
|
|
78
|
-
// END: Awareness
|
|
79
|
-
|
|
80
35
|
var scrollContainer = useMemo(function () {
|
|
81
36
|
return findOverflowScrollParent(view.dom) || undefined;
|
|
82
37
|
}, [view.dom]);
|
|
@@ -108,8 +63,7 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
108
63
|
if (title) {
|
|
109
64
|
setIsResolvedViewRendered(true);
|
|
110
65
|
}
|
|
111
|
-
|
|
112
|
-
}, [view, getPos, isLinkMostRecentlyInserted]);
|
|
66
|
+
}, [view, getPos]);
|
|
113
67
|
var onError = useCallback(function (data) {
|
|
114
68
|
var url = data.url,
|
|
115
69
|
err = data.err;
|
|
@@ -120,8 +74,22 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
120
74
|
url: url
|
|
121
75
|
});
|
|
122
76
|
}, [onResolve]);
|
|
77
|
+
|
|
78
|
+
// Begin Upgrade Awareness related code
|
|
79
|
+
var markMostRecentlyInsertedLink = useCallback(function (isLinkMostRecentlyInserted) {
|
|
80
|
+
if (isOverlayEnabled) {
|
|
81
|
+
setIsInserted(isLinkMostRecentlyInserted);
|
|
82
|
+
}
|
|
83
|
+
}, [isOverlayEnabled]);
|
|
84
|
+
var setOverlayHoveredStyles = useCallback(function (isHovered) {
|
|
85
|
+
if (isOverlayEnabled) {
|
|
86
|
+
setIsHovered(isHovered);
|
|
87
|
+
}
|
|
88
|
+
}, [isOverlayEnabled]);
|
|
89
|
+
// End Upgrade Awareness related code
|
|
90
|
+
|
|
123
91
|
var innerCard = useMemo(function () {
|
|
124
|
-
return
|
|
92
|
+
return /*#__PURE__*/React.createElement(SmartCard, {
|
|
125
93
|
key: url,
|
|
126
94
|
url: url,
|
|
127
95
|
data: data,
|
|
@@ -135,41 +103,28 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
135
103
|
isHovered: isHovered
|
|
136
104
|
});
|
|
137
105
|
}, [data, isHovered, onError, onResolve, scrollContainer, showServerActions, url, useAlternativePreloader]);
|
|
138
|
-
|
|
139
|
-
// BEGIN: Awareness (To be revisited in EDM-8508)
|
|
140
|
-
var cardWithOverlay = useMemo(function () {
|
|
141
|
-
return shouldShowLinkOverlay ? jsx(InlineCardOverlay, {
|
|
142
|
-
isSelected: isSelected,
|
|
143
|
-
isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
|
|
144
|
-
onMouseEnter: function onMouseEnter() {
|
|
145
|
-
return setIsHovered(true);
|
|
146
|
-
},
|
|
147
|
-
onMouseLeave: function onMouseLeave() {
|
|
148
|
-
return setIsHovered(false);
|
|
149
|
-
},
|
|
150
|
-
url: url
|
|
151
|
-
}, innerCard) : innerCard;
|
|
152
|
-
}, [innerCard, isHovered, isResolvedViewRendered, isSelected, isInserted, shouldShowLinkOverlay, url]);
|
|
153
106
|
var card = useMemo(function () {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
107
|
+
return isOverlayEnabled || isPulseEnabled ? /*#__PURE__*/React.createElement(AwarenessWrapper, {
|
|
108
|
+
isOverlayEnabled: isOverlayEnabled,
|
|
109
|
+
isPulseEnabled: isPulseEnabled,
|
|
110
|
+
cardContext: cardContext,
|
|
111
|
+
getPos: getPos,
|
|
112
|
+
isHovered: isHovered,
|
|
113
|
+
isInserted: isInserted,
|
|
114
|
+
url: url,
|
|
115
|
+
isSelected: isSelected,
|
|
116
|
+
isResolvedViewRendered: isResolvedViewRendered,
|
|
117
|
+
markMostRecentlyInsertedLink: markMostRecentlyInsertedLink,
|
|
118
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
119
|
+
setOverlayHoveredStyles: setOverlayHoveredStyles
|
|
120
|
+
}, innerCard) : /*#__PURE__*/React.createElement("span", {
|
|
157
121
|
className: "card"
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
|
|
161
|
-
}
|
|
162
|
-
}, jsx(DiscoveryPulse, {
|
|
163
|
-
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
164
|
-
localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
|
|
165
|
-
discoveryMode: "start"
|
|
166
|
-
}, cardWithOverlay)) : cardWithOverlay);
|
|
167
|
-
}, [shouldShowLinkPulse, cardWithOverlay, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store]);
|
|
168
|
-
// END: Awareness
|
|
122
|
+
}, innerCard);
|
|
123
|
+
}, [cardContext, getPos, innerCard, isHovered, isInserted, isOverlayEnabled, isPulseEnabled, isResolvedViewRendered, isSelected, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url]);
|
|
169
124
|
|
|
170
125
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
171
126
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
172
|
-
return cardContext && cardContext.value ?
|
|
127
|
+
return cardContext && cardContext.value ? /*#__PURE__*/React.createElement(cardContext.Provider, {
|
|
173
128
|
value: cardContext.value
|
|
174
129
|
}, card) : data ? card : null;
|
|
175
130
|
};
|
|
@@ -48,6 +48,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
48
48
|
allowEmbeds = options.allowEmbeds,
|
|
49
49
|
allowBlockCards = options.allowBlockCards;
|
|
50
50
|
var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability && platform !== 'mobile';
|
|
51
|
+
var shouldUseUpgradeFeatures = getBooleanFF('platform.linking-platform.smart-card.inline-switcher') && enableInlineUpgradeFeatures;
|
|
51
52
|
var inlineCardViewProducer = getInlineNodeViewProducer({
|
|
52
53
|
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
53
54
|
Component: InlineCardNodeView,
|
|
@@ -91,7 +92,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
91
92
|
if (!meta) {
|
|
92
93
|
return pluginStateWithUpdatedPos;
|
|
93
94
|
}
|
|
94
|
-
if (!
|
|
95
|
+
if (!shouldUseUpgradeFeatures) {
|
|
95
96
|
return reducer(pluginStateWithUpdatedPos, meta);
|
|
96
97
|
}
|
|
97
98
|
var newState = reducer(pluginStateWithUpdatedPos, meta);
|
|
@@ -99,7 +100,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
99
100
|
// the code below is related to the "Inline Switcher" project, for more information pls see EDM-7984
|
|
100
101
|
var isSingleInlineLink = (pluginState === null || pluginState === void 0 || (_pluginState$requests = pluginState.requests) === null || _pluginState$requests === void 0 ? void 0 : _pluginState$requests.length) === 1 && pluginState.requests[0].appearance === 'inline';
|
|
101
102
|
var isSmartLinkPulseDiscovered = isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
102
|
-
if (meta.type !== 'RESOLVE' || !
|
|
103
|
+
if (meta.type !== 'RESOLVE' || !isSingleInlineLink) {
|
|
103
104
|
return newState;
|
|
104
105
|
}
|
|
105
106
|
var linkPosition = pluginState.requests[0].pos;
|
|
@@ -241,7 +242,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
241
242
|
return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
242
243
|
}
|
|
243
244
|
}
|
|
244
|
-
},
|
|
245
|
+
}, shouldUseUpgradeFeatures && {
|
|
245
246
|
handleKeyDown: function handleKeyDown(view) {
|
|
246
247
|
handleAwarenessOverlay(view);
|
|
247
248
|
return false;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
|
+
import useLinkUpgradeDiscoverability from '../../common/hooks/useLinkUpgradeDiscoverability';
|
|
7
|
+
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../../common/local-storage';
|
|
8
|
+
import { getResolvedAttributesFromStore } from '../../utils';
|
|
9
|
+
import InlineCardOverlay from '../InlineCardOverlay';
|
|
10
|
+
import { DiscoveryPulse } from '../Pulse';
|
|
11
|
+
// editor adds a standard line-height that is bigger than an inline smart link
|
|
12
|
+
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
13
|
+
var loaderWrapperStyles = css({
|
|
14
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
15
|
+
'.loader-wrapper': {
|
|
16
|
+
lineHeight: 'normal'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export var AwarenessWrapper = function AwarenessWrapper(_ref) {
|
|
20
|
+
var _cardContext$value2;
|
|
21
|
+
var cardContext = _ref.cardContext,
|
|
22
|
+
children = _ref.children,
|
|
23
|
+
getPos = _ref.getPos,
|
|
24
|
+
isInserted = _ref.isInserted,
|
|
25
|
+
isOverlayEnabled = _ref.isOverlayEnabled,
|
|
26
|
+
isSelected = _ref.isSelected,
|
|
27
|
+
isResolvedViewRendered = _ref.isResolvedViewRendered,
|
|
28
|
+
isPulseEnabled = _ref.isPulseEnabled,
|
|
29
|
+
markMostRecentlyInsertedLink = _ref.markMostRecentlyInsertedLink,
|
|
30
|
+
pluginInjectionApi = _ref.pluginInjectionApi,
|
|
31
|
+
setOverlayHoveredStyles = _ref.setOverlayHoveredStyles,
|
|
32
|
+
url = _ref.url;
|
|
33
|
+
var _useState = useState(false),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
isHovered = _useState2[0],
|
|
36
|
+
setIsHovered = _useState2[1];
|
|
37
|
+
var linkPosition = useMemo(function () {
|
|
38
|
+
if (!getPos || typeof getPos === 'boolean') {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
var pos = getPos();
|
|
42
|
+
return typeof pos === 'number' ? pos : undefined;
|
|
43
|
+
}, [getPos]);
|
|
44
|
+
var _useLinkUpgradeDiscov = useLinkUpgradeDiscoverability({
|
|
45
|
+
url: url,
|
|
46
|
+
linkPosition: linkPosition || -1,
|
|
47
|
+
cardContext: cardContext === null || cardContext === void 0 ? void 0 : cardContext.value,
|
|
48
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
49
|
+
isOverlayEnabled: isOverlayEnabled,
|
|
50
|
+
isPulseEnabled: isPulseEnabled
|
|
51
|
+
}),
|
|
52
|
+
shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse,
|
|
53
|
+
shouldShowToolbarPulse = _useLinkUpgradeDiscov.shouldShowToolbarPulse,
|
|
54
|
+
shouldShowLinkOverlay = _useLinkUpgradeDiscov.shouldShowLinkOverlay,
|
|
55
|
+
isLinkMostRecentlyInserted = _useLinkUpgradeDiscov.isLinkMostRecentlyInserted;
|
|
56
|
+
|
|
57
|
+
// If the toolbar pulse has not yet been invalidated and this is a case where we will be showing it,
|
|
58
|
+
// we need to invalidate the link pulse too. Toolbar pulse will be invalidated in the corresponding component.
|
|
59
|
+
if (isSelected && shouldShowToolbarPulse && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR)) {
|
|
60
|
+
markLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
|
|
61
|
+
}
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
if (shouldShowLinkOverlay && isLinkMostRecentlyInserted) {
|
|
64
|
+
markMostRecentlyInsertedLink(true);
|
|
65
|
+
}
|
|
66
|
+
}, [isLinkMostRecentlyInserted, markMostRecentlyInsertedLink, shouldShowLinkOverlay]);
|
|
67
|
+
var handleOverlayChange = useCallback(function (isHovered) {
|
|
68
|
+
setIsHovered(isHovered);
|
|
69
|
+
setOverlayHoveredStyles(isHovered);
|
|
70
|
+
}, [setOverlayHoveredStyles]);
|
|
71
|
+
var cardWithOverlay = useMemo(function () {
|
|
72
|
+
return shouldShowLinkOverlay ? jsx(InlineCardOverlay, {
|
|
73
|
+
isSelected: isSelected,
|
|
74
|
+
isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
|
|
75
|
+
onMouseEnter: function onMouseEnter() {
|
|
76
|
+
return handleOverlayChange(true);
|
|
77
|
+
},
|
|
78
|
+
onMouseLeave: function onMouseLeave() {
|
|
79
|
+
return handleOverlayChange(false);
|
|
80
|
+
},
|
|
81
|
+
url: url
|
|
82
|
+
}, children) : children;
|
|
83
|
+
}, [shouldShowLinkOverlay, isSelected, isResolvedViewRendered, isInserted, isHovered, url, children, handleOverlayChange]);
|
|
84
|
+
return useMemo(function () {
|
|
85
|
+
var _cardContext$value;
|
|
86
|
+
return jsx("span", {
|
|
87
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
88
|
+
className: "card"
|
|
89
|
+
}, shouldShowLinkPulse ? jsx(AnalyticsContext, {
|
|
90
|
+
data: {
|
|
91
|
+
attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
|
|
92
|
+
}
|
|
93
|
+
}, jsx(DiscoveryPulse, {
|
|
94
|
+
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
95
|
+
localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
|
|
96
|
+
discoveryMode: "start"
|
|
97
|
+
}, cardWithOverlay)) : cardWithOverlay);
|
|
98
|
+
}, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, cardWithOverlay]);
|
|
99
|
+
};
|
|
@@ -18,9 +18,9 @@ import nodeNames, { cardMessages as messages } from '@atlaskit/editor-common/mes
|
|
|
18
18
|
import { isSupportedInParent } from '@atlaskit/editor-common/utils';
|
|
19
19
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
20
20
|
import { LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from '../common/local-storage';
|
|
21
|
-
import { DiscoveryPulse } from '../common/pulse';
|
|
22
21
|
import { shouldRenderToolbarPulse } from '../toolbar';
|
|
23
22
|
import { getResolvedAttributesFromStore } from '../utils';
|
|
23
|
+
import { DiscoveryPulse } from './Pulse';
|
|
24
24
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
25
25
|
export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
26
26
|
_inherits(LinkToolbarAppearance, _React$Component);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { Pulse } from '@atlaskit/linking-common';
|
|
4
|
-
import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '
|
|
4
|
+
import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '../../common/local-storage';
|
|
5
5
|
export var DiscoveryPulse = function DiscoveryPulse(_ref) {
|
|
6
6
|
var children = _ref.children,
|
|
7
7
|
localStorageKey = _ref.localStorageKey,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import type { SmartCardProps } from './genericCard';
|
|
4
|
-
export declare const InlineCardWithAwareness:
|
|
3
|
+
export declare const InlineCardWithAwareness: React.MemoExoticComponent<({ node, cardContext, showServerActions, useAlternativePreloader, view, getPos, isOverlayEnabled, isPulseEnabled, pluginInjectionApi, isSelected, }: SmartCardProps) => JSX.Element | null>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import type { SmartCardProps } from '../../nodeviews/genericCard';
|
|
4
|
+
type AwarenessWrapperProps = {
|
|
5
|
+
isInserted?: boolean;
|
|
6
|
+
isResolvedViewRendered?: boolean;
|
|
7
|
+
children: JSX.Element;
|
|
8
|
+
markMostRecentlyInsertedLink: (isLinkMostRecentlyInserted: boolean) => void;
|
|
9
|
+
setOverlayHoveredStyles: (isHovered: boolean) => void;
|
|
10
|
+
url: string;
|
|
11
|
+
} & Partial<SmartCardProps>;
|
|
12
|
+
export declare const AwarenessWrapper: ({ cardContext, children, getPos, isInserted, isOverlayEnabled, isSelected, isResolvedViewRendered, isPulseEnabled, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url, }: AwarenessWrapperProps) => jsx.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import type { SmartCardProps } from './genericCard';
|
|
4
|
-
export declare const InlineCardWithAwareness:
|
|
3
|
+
export declare const InlineCardWithAwareness: React.MemoExoticComponent<({ node, cardContext, showServerActions, useAlternativePreloader, view, getPos, isOverlayEnabled, isPulseEnabled, pluginInjectionApi, isSelected, }: SmartCardProps) => JSX.Element | null>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import type { SmartCardProps } from '../../nodeviews/genericCard';
|
|
4
|
+
type AwarenessWrapperProps = {
|
|
5
|
+
isInserted?: boolean;
|
|
6
|
+
isResolvedViewRendered?: boolean;
|
|
7
|
+
children: JSX.Element;
|
|
8
|
+
markMostRecentlyInsertedLink: (isLinkMostRecentlyInserted: boolean) => void;
|
|
9
|
+
setOverlayHoveredStyles: (isHovered: boolean) => void;
|
|
10
|
+
url: string;
|
|
11
|
+
} & Partial<SmartCardProps>;
|
|
12
|
+
export declare const AwarenessWrapper: ({ cardContext, children, getPos, isInserted, isOverlayEnabled, isSelected, isResolvedViewRendered, isPulseEnabled, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url, }: AwarenessWrapperProps) => jsx.JSX.Element;
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.18",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/adf-schema": "^35.1.
|
|
34
|
+
"@atlaskit/adf-schema": "^35.1.1",
|
|
35
35
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
|
-
"@atlaskit/custom-steps": "^0.0.
|
|
36
|
+
"@atlaskit/custom-steps": "^0.0.9",
|
|
37
37
|
"@atlaskit/editor-common": "^76.26.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^0.2.0",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"@atlaskit/linking-common": "^4.21.0",
|
|
53
53
|
"@atlaskit/linking-types": "^8.5.0",
|
|
54
54
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
55
|
-
"@atlaskit/primitives": "^1.
|
|
55
|
+
"@atlaskit/primitives": "^1.15.0",
|
|
56
56
|
"@atlaskit/smart-card": "^26.43.0",
|
|
57
57
|
"@atlaskit/theme": "^12.6.0",
|
|
58
|
-
"@atlaskit/tokens": "^1.
|
|
58
|
+
"@atlaskit/tokens": "^1.30.0",
|
|
59
59
|
"@babel/runtime": "^7.0.0",
|
|
60
60
|
"@emotion/react": "^11.7.1",
|
|
61
61
|
"lodash": "^4.17.21",
|
|
File without changes
|
|
File without changes
|