@atlaskit/editor-plugin-card 6.4.3 → 6.4.5
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 +15 -0
- package/dist/cjs/nodeviews/inlineCard.js +27 -8
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +9 -8
- package/dist/cjs/ui/toolbar.js +1 -1
- package/dist/es2019/nodeviews/inlineCard.js +27 -7
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +26 -24
- package/dist/es2019/ui/toolbar.js +2 -2
- package/dist/esm/nodeviews/inlineCard.js +28 -9
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +9 -8
- package/dist/esm/ui/toolbar.js +2 -2
- package/dist/types/nodeviews/genericCard.d.ts +2 -2
- package/dist/types/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/ui/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/ui/toolbar.d.ts +1 -1
- package/package.json +5 -5
- package/compass.yml +0 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 6.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#163546](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/163546)
|
|
8
|
+
[`d3faab1b963ad`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d3faab1b963ad) -
|
|
9
|
+
[ux] ED-28147 smart link support for cmd/ctrl click to open in new tab
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 6.4.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 6.4.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -13,6 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
15
15
|
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
16
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
17
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
17
18
|
var _link = require("@atlaskit/editor-common/link");
|
|
18
19
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
@@ -21,9 +22,11 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
21
22
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
23
|
var _smartCard = require("@atlaskit/smart-card");
|
|
23
24
|
var _ssr = require("@atlaskit/smart-card/ssr");
|
|
25
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
24
26
|
var _actions = require("../pm-plugins/actions");
|
|
25
27
|
var _utils = require("../pm-plugins/utils");
|
|
26
28
|
var _ConfigureOverlay = _interopRequireDefault(require("../ui/ConfigureOverlay"));
|
|
29
|
+
var _toolbar = require("../ui/toolbar");
|
|
27
30
|
var _genericCard = require("./genericCard");
|
|
28
31
|
var _inlineCardWithAwareness = require("./inlineCardWithAwareness");
|
|
29
32
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -39,7 +42,8 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
39
42
|
isHovered = _ref.isHovered,
|
|
40
43
|
showHoverPreview = _ref.showHoverPreview,
|
|
41
44
|
hoverPreviewOptions = _ref.hoverPreviewOptions,
|
|
42
|
-
isPageSSRed = _ref.isPageSSRed
|
|
45
|
+
isPageSSRed = _ref.isPageSSRed,
|
|
46
|
+
pluginInjectionApi = _ref.pluginInjectionApi;
|
|
43
47
|
var _node$attrs = node.attrs,
|
|
44
48
|
url = _node$attrs.url,
|
|
45
49
|
data = _node$attrs.data;
|
|
@@ -95,13 +99,28 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
95
99
|
url: url
|
|
96
100
|
});
|
|
97
101
|
}, [onResolve]);
|
|
102
|
+
var handleOnClick = (0, _react.useCallback)(function (event) {
|
|
103
|
+
onClick === null || onClick === void 0 || onClick(event);
|
|
104
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _experiments.editorExperiment)('platform_editor_smart_link_cmd_ctrl_click', true, {
|
|
105
|
+
exposure: true
|
|
106
|
+
})) {
|
|
107
|
+
// open link in new tab when performing a cmd/ctrl + click
|
|
108
|
+
if (event.metaKey || event.ctrlKey) {
|
|
109
|
+
var _pluginInjectionApi$a;
|
|
110
|
+
var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
111
|
+
editorAnalyticsApi = _ref2.actions;
|
|
112
|
+
(0, _toolbar.visitCardLinkAnalyticsOnly)(editorAnalyticsApi, _analytics.INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
113
|
+
window.open(url, '_blank');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}, [onClick, url, view, pluginInjectionApi]);
|
|
98
117
|
var card = (0, _react.useMemo)(function () {
|
|
99
118
|
if (isPageSSRed && url && (0, _platformFeatureFlags.fg)('platform_ssr_smartlinks_editor')) {
|
|
100
119
|
return /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
|
|
101
120
|
key: url,
|
|
102
121
|
url: url,
|
|
103
122
|
appearance: "inline",
|
|
104
|
-
onClick:
|
|
123
|
+
onClick: handleOnClick,
|
|
105
124
|
container: scrollContainer,
|
|
106
125
|
onResolve: onResolve,
|
|
107
126
|
onError: onError,
|
|
@@ -116,7 +135,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
116
135
|
key: url,
|
|
117
136
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
118
137
|
appearance: "inline",
|
|
119
|
-
onClick:
|
|
138
|
+
onClick: handleOnClick,
|
|
120
139
|
container: scrollContainer,
|
|
121
140
|
onResolve: onResolve,
|
|
122
141
|
onError: onError,
|
|
@@ -126,7 +145,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
126
145
|
showHoverPreview: showHoverPreview,
|
|
127
146
|
hoverPreviewOptions: hoverPreviewOptions
|
|
128
147
|
});
|
|
129
|
-
}, [url, data,
|
|
148
|
+
}, [url, data, handleOnClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
|
|
130
149
|
|
|
131
150
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
132
151
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -206,9 +225,9 @@ function InlineCardNodeView(props) {
|
|
|
206
225
|
view: view,
|
|
207
226
|
isHoveredCallback: setIsOverlayHovered,
|
|
208
227
|
onOpenLinkClick: function onOpenLinkClick(event) {
|
|
209
|
-
var _pluginInjectionApi$
|
|
228
|
+
var _pluginInjectionApi$a2;
|
|
210
229
|
(0, _link.handleNavigation)({
|
|
211
|
-
fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
230
|
+
fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.fireAnalyticsEvent,
|
|
212
231
|
onClickCallback: onClickCallback,
|
|
213
232
|
url: url,
|
|
214
233
|
event: event
|
|
@@ -230,8 +249,8 @@ function InlineCardNodeView(props) {
|
|
|
230
249
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
231
250
|
}, enableInlineUpgradeFeatures && (0, _utils.getAwarenessProps)(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), (0, _platformFeatureFlags.fg)('prompt_whiteboard_competitor_link_gate') && CompetitorPromptComponent);
|
|
232
251
|
}
|
|
233
|
-
var inlineCardNodeView = exports.inlineCardNodeView = function inlineCardNodeView(
|
|
234
|
-
var inlineCardViewProducer =
|
|
252
|
+
var inlineCardNodeView = exports.inlineCardNodeView = function inlineCardNodeView(_ref3) {
|
|
253
|
+
var inlineCardViewProducer = _ref3.inlineCardViewProducer;
|
|
235
254
|
return function (node, view, getPos, decorations) {
|
|
236
255
|
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
237
256
|
};
|
|
@@ -31,7 +31,7 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
|
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
33
|
var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
34
|
-
var _pluginInjectionApi$c
|
|
34
|
+
var _pluginInjectionApi$c;
|
|
35
35
|
var node = _ref.node,
|
|
36
36
|
cardContext = _ref.cardContext,
|
|
37
37
|
actionOptions = _ref.actionOptions,
|
|
@@ -58,8 +58,6 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
58
58
|
isResolvedViewRendered = _useState6[0],
|
|
59
59
|
setIsResolvedViewRendered = _useState6[1];
|
|
60
60
|
var editorAppearance = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card.sharedState.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.editorAppearance;
|
|
61
|
-
var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
62
|
-
editorAnalyticsApi = _ref2.actions;
|
|
63
61
|
var onResolve = (0, _react.useCallback)(function (tr, title) {
|
|
64
62
|
var metadata = tr.getMeta(_pluginKey.pluginKey);
|
|
65
63
|
if (metadata && metadata.type === 'REGISTER') {
|
|
@@ -88,11 +86,12 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
88
86
|
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
89
87
|
mode = _useSharedState.mode;
|
|
90
88
|
var innerCardWithOpenButtonOverlay = (0, _react.useMemo)(function () {
|
|
89
|
+
var _pluginInjectionApi$a;
|
|
91
90
|
return /*#__PURE__*/_react.default.createElement(_OpenButtonOverlay.default, {
|
|
92
91
|
isVisible: isResolvedViewRendered,
|
|
93
92
|
url: node.attrs.url,
|
|
94
93
|
editorAppearance: editorAppearance,
|
|
95
|
-
editorAnalyticsApi:
|
|
94
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
96
95
|
view: view
|
|
97
96
|
}, /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
|
|
98
97
|
node: node,
|
|
@@ -104,9 +103,10 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
104
103
|
onClick: onClick,
|
|
105
104
|
cardContext: cardContext,
|
|
106
105
|
isHovered: isHovered,
|
|
107
|
-
isPageSSRed: isPageSSRed
|
|
106
|
+
isPageSSRed: isPageSSRed,
|
|
107
|
+
pluginInjectionApi: pluginInjectionApi
|
|
108
108
|
}));
|
|
109
|
-
}, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed,
|
|
109
|
+
}, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
|
|
110
110
|
var innerCardOriginal = (0, _react.useMemo)(function () {
|
|
111
111
|
return /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
|
|
112
112
|
node: node,
|
|
@@ -118,9 +118,10 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
118
118
|
onClick: onClick,
|
|
119
119
|
cardContext: cardContext,
|
|
120
120
|
isHovered: isHovered,
|
|
121
|
-
isPageSSRed: isPageSSRed
|
|
121
|
+
isPageSSRed: isPageSSRed,
|
|
122
|
+
pluginInjectionApi: pluginInjectionApi
|
|
122
123
|
});
|
|
123
|
-
}, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed]);
|
|
124
|
+
}, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
|
|
124
125
|
var shouldShowOpenButtonOverlay = (0, _react.useMemo)(function () {
|
|
125
126
|
var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless' && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8');
|
|
126
127
|
return (mode === 'edit' || editorAppearance === 'comment' && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_6') || shouldShowOpenButtonOverlayInChomeless) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -84,7 +84,7 @@ var visitCardLink = exports.visitCardLink = function visitCardLink(editorAnalyti
|
|
|
84
84
|
// EDM-12466:
|
|
85
85
|
// During smart_link_editor_update_toolbar_open_link clean up
|
|
86
86
|
// Consider updating the code to use visitCardLink or visitCardLinkAnalyticsOnly for all input methods:
|
|
87
|
-
// INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR |
|
|
87
|
+
// INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK || INPUT_METHOD.META_CLICK
|
|
88
88
|
if (!(0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link')) {
|
|
89
89
|
var _titleUrlPairFromNode = (0, _utils3.titleUrlPairFromNode)(state.selection.node),
|
|
90
90
|
url = _titleUrlPairFromNode.url;
|
|
@@ -2,17 +2,20 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
4
|
import uuid from 'uuid/v4';
|
|
5
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
7
|
import { handleNavigation } from '@atlaskit/editor-common/link';
|
|
7
|
-
import {
|
|
8
|
+
import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
8
9
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
9
10
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
12
13
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
14
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
15
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
14
16
|
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
15
17
|
import OverlayWrapper from '../ui/ConfigureOverlay';
|
|
18
|
+
import { visitCardLinkAnalyticsOnly } from '../ui/toolbar';
|
|
16
19
|
import { Card } from './genericCard';
|
|
17
20
|
import { InlineCardWithAwareness } from './inlineCardWithAwareness';
|
|
18
21
|
export const InlineCard = /*#__PURE__*/memo(({
|
|
@@ -27,7 +30,8 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
27
30
|
isHovered,
|
|
28
31
|
showHoverPreview,
|
|
29
32
|
hoverPreviewOptions,
|
|
30
|
-
isPageSSRed
|
|
33
|
+
isPageSSRed,
|
|
34
|
+
pluginInjectionApi
|
|
31
35
|
}) => {
|
|
32
36
|
const {
|
|
33
37
|
url,
|
|
@@ -89,13 +93,29 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
89
93
|
url
|
|
90
94
|
});
|
|
91
95
|
}, [onResolve]);
|
|
96
|
+
const handleOnClick = useCallback(event => {
|
|
97
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
98
|
+
if (editorExperiment('platform_editor_controls', 'variant1') && editorExperiment('platform_editor_smart_link_cmd_ctrl_click', true, {
|
|
99
|
+
exposure: true
|
|
100
|
+
})) {
|
|
101
|
+
// open link in new tab when performing a cmd/ctrl + click
|
|
102
|
+
if (event.metaKey || event.ctrlKey) {
|
|
103
|
+
var _pluginInjectionApi$a;
|
|
104
|
+
const {
|
|
105
|
+
actions: editorAnalyticsApi
|
|
106
|
+
} = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {};
|
|
107
|
+
visitCardLinkAnalyticsOnly(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
108
|
+
window.open(url, '_blank');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, [onClick, url, view, pluginInjectionApi]);
|
|
92
112
|
const card = useMemo(() => {
|
|
93
113
|
if (isPageSSRed && url && fg('platform_ssr_smartlinks_editor')) {
|
|
94
114
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
95
115
|
key: url,
|
|
96
116
|
url: url,
|
|
97
117
|
appearance: "inline",
|
|
98
|
-
onClick:
|
|
118
|
+
onClick: handleOnClick,
|
|
99
119
|
container: scrollContainer,
|
|
100
120
|
onResolve: onResolve,
|
|
101
121
|
onError: onError,
|
|
@@ -110,7 +130,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
110
130
|
key: url,
|
|
111
131
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
112
132
|
appearance: "inline",
|
|
113
|
-
onClick:
|
|
133
|
+
onClick: handleOnClick,
|
|
114
134
|
container: scrollContainer,
|
|
115
135
|
onResolve: onResolve,
|
|
116
136
|
onError: onError,
|
|
@@ -120,7 +140,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
120
140
|
showHoverPreview: showHoverPreview,
|
|
121
141
|
hoverPreviewOptions: hoverPreviewOptions
|
|
122
142
|
});
|
|
123
|
-
}, [url, data,
|
|
143
|
+
}, [url, data, handleOnClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
|
|
124
144
|
|
|
125
145
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
126
146
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -201,9 +221,9 @@ export function InlineCardNodeView(props) {
|
|
|
201
221
|
view: view,
|
|
202
222
|
isHoveredCallback: setIsOverlayHovered,
|
|
203
223
|
onOpenLinkClick: event => {
|
|
204
|
-
var _pluginInjectionApi$
|
|
224
|
+
var _pluginInjectionApi$a2;
|
|
205
225
|
handleNavigation({
|
|
206
|
-
fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
226
|
+
fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.fireAnalyticsEvent,
|
|
207
227
|
onClickCallback,
|
|
208
228
|
url,
|
|
209
229
|
event
|
|
@@ -36,14 +36,11 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
36
36
|
isPageSSRed,
|
|
37
37
|
appearance
|
|
38
38
|
}) => {
|
|
39
|
-
var _pluginInjectionApi$c
|
|
39
|
+
var _pluginInjectionApi$c;
|
|
40
40
|
const [isHovered, setIsHovered] = useState(false);
|
|
41
41
|
const [isInserted, setIsInserted] = useState(false);
|
|
42
42
|
const [isResolvedViewRendered, setIsResolvedViewRendered] = useState(false);
|
|
43
43
|
const editorAppearance = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card.sharedState.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.editorAppearance;
|
|
44
|
-
const {
|
|
45
|
-
actions: editorAnalyticsApi
|
|
46
|
-
} = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {};
|
|
47
44
|
const onResolve = useCallback((tr, title) => {
|
|
48
45
|
const metadata = tr.getMeta(pluginKey);
|
|
49
46
|
if (metadata && metadata.type === 'REGISTER') {
|
|
@@ -68,24 +65,28 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
68
65
|
const {
|
|
69
66
|
mode
|
|
70
67
|
} = useSharedState(pluginInjectionApi);
|
|
71
|
-
const innerCardWithOpenButtonOverlay = useMemo(() =>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
68
|
+
const innerCardWithOpenButtonOverlay = useMemo(() => {
|
|
69
|
+
var _pluginInjectionApi$a;
|
|
70
|
+
return /*#__PURE__*/React.createElement(OpenButtonOverlay, {
|
|
71
|
+
isVisible: isResolvedViewRendered,
|
|
72
|
+
url: node.attrs.url,
|
|
73
|
+
editorAppearance: editorAppearance,
|
|
74
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
75
|
+
view: view
|
|
76
|
+
}, /*#__PURE__*/React.createElement(InlineCard, {
|
|
77
|
+
node: node,
|
|
78
|
+
view: view,
|
|
79
|
+
getPos: getPos,
|
|
80
|
+
useAlternativePreloader: useAlternativePreloader,
|
|
81
|
+
actionOptions: actionOptions,
|
|
82
|
+
onResolve: onResolve,
|
|
83
|
+
onClick: onClick,
|
|
84
|
+
cardContext: cardContext,
|
|
85
|
+
isHovered: isHovered,
|
|
86
|
+
isPageSSRed: isPageSSRed,
|
|
87
|
+
pluginInjectionApi: pluginInjectionApi
|
|
88
|
+
}));
|
|
89
|
+
}, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
|
|
89
90
|
const innerCardOriginal = useMemo(() => /*#__PURE__*/React.createElement(InlineCard, {
|
|
90
91
|
node: node,
|
|
91
92
|
view: view,
|
|
@@ -96,8 +97,9 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
96
97
|
onClick: onClick,
|
|
97
98
|
cardContext: cardContext,
|
|
98
99
|
isHovered: isHovered,
|
|
99
|
-
isPageSSRed: isPageSSRed
|
|
100
|
-
|
|
100
|
+
isPageSSRed: isPageSSRed,
|
|
101
|
+
pluginInjectionApi: pluginInjectionApi
|
|
102
|
+
}), [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
|
|
101
103
|
const shouldShowOpenButtonOverlay = useMemo(() => {
|
|
102
104
|
const shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless' && fg('platform_editor_controls_patch_8');
|
|
103
105
|
return (mode === 'edit' || editorAppearance === 'comment' && fg('platform_editor_controls_patch_6') || shouldShowOpenButtonOverlayInChomeless) && editorExperiment('platform_editor_controls', 'variant1');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
3
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID as ACTION_SUBJECTID,
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID as ACTION_SUBJECTID, EVENT_TYPE, INPUT_METHOD, buildOpenedSettingsPayload, buildVisitedNonHyperLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { buildLayoutButtons, buildLayoutDropdown, commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
5
5
|
import { getLinkPreferencesURLFromENV } from '@atlaskit/editor-common/link';
|
|
6
6
|
import commonMessages, { annotationMessages, linkMessages, linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
@@ -72,7 +72,7 @@ export const visitCardLink = (editorAnalyticsApi, inputMethod) => (state, dispat
|
|
|
72
72
|
// EDM-12466:
|
|
73
73
|
// During smart_link_editor_update_toolbar_open_link clean up
|
|
74
74
|
// Consider updating the code to use visitCardLink or visitCardLinkAnalyticsOnly for all input methods:
|
|
75
|
-
// INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR |
|
|
75
|
+
// INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK || INPUT_METHOD.META_CLICK
|
|
76
76
|
if (!fg('smart_link_editor_update_toolbar_open_link')) {
|
|
77
77
|
const {
|
|
78
78
|
url
|
|
@@ -3,17 +3,20 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
5
|
import uuid from 'uuid/v4';
|
|
6
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
7
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
8
|
import { handleNavigation } from '@atlaskit/editor-common/link';
|
|
8
|
-
import {
|
|
9
|
+
import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
9
10
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
10
11
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
13
14
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
15
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
16
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
15
17
|
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
16
18
|
import OverlayWrapper from '../ui/ConfigureOverlay';
|
|
19
|
+
import { visitCardLinkAnalyticsOnly } from '../ui/toolbar';
|
|
17
20
|
import { Card } from './genericCard';
|
|
18
21
|
import { InlineCardWithAwareness } from './inlineCardWithAwareness';
|
|
19
22
|
export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -28,7 +31,8 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
28
31
|
isHovered = _ref.isHovered,
|
|
29
32
|
showHoverPreview = _ref.showHoverPreview,
|
|
30
33
|
hoverPreviewOptions = _ref.hoverPreviewOptions,
|
|
31
|
-
isPageSSRed = _ref.isPageSSRed
|
|
34
|
+
isPageSSRed = _ref.isPageSSRed,
|
|
35
|
+
pluginInjectionApi = _ref.pluginInjectionApi;
|
|
32
36
|
var _node$attrs = node.attrs,
|
|
33
37
|
url = _node$attrs.url,
|
|
34
38
|
data = _node$attrs.data;
|
|
@@ -84,13 +88,28 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
84
88
|
url: url
|
|
85
89
|
});
|
|
86
90
|
}, [onResolve]);
|
|
91
|
+
var handleOnClick = useCallback(function (event) {
|
|
92
|
+
onClick === null || onClick === void 0 || onClick(event);
|
|
93
|
+
if (editorExperiment('platform_editor_controls', 'variant1') && editorExperiment('platform_editor_smart_link_cmd_ctrl_click', true, {
|
|
94
|
+
exposure: true
|
|
95
|
+
})) {
|
|
96
|
+
// open link in new tab when performing a cmd/ctrl + click
|
|
97
|
+
if (event.metaKey || event.ctrlKey) {
|
|
98
|
+
var _pluginInjectionApi$a;
|
|
99
|
+
var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
100
|
+
editorAnalyticsApi = _ref2.actions;
|
|
101
|
+
visitCardLinkAnalyticsOnly(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
102
|
+
window.open(url, '_blank');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, [onClick, url, view, pluginInjectionApi]);
|
|
87
106
|
var card = useMemo(function () {
|
|
88
107
|
if (isPageSSRed && url && fg('platform_ssr_smartlinks_editor')) {
|
|
89
108
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
90
109
|
key: url,
|
|
91
110
|
url: url,
|
|
92
111
|
appearance: "inline",
|
|
93
|
-
onClick:
|
|
112
|
+
onClick: handleOnClick,
|
|
94
113
|
container: scrollContainer,
|
|
95
114
|
onResolve: onResolve,
|
|
96
115
|
onError: onError,
|
|
@@ -105,7 +124,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
105
124
|
key: url,
|
|
106
125
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
107
126
|
appearance: "inline",
|
|
108
|
-
onClick:
|
|
127
|
+
onClick: handleOnClick,
|
|
109
128
|
container: scrollContainer,
|
|
110
129
|
onResolve: onResolve,
|
|
111
130
|
onError: onError,
|
|
@@ -115,7 +134,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
115
134
|
showHoverPreview: showHoverPreview,
|
|
116
135
|
hoverPreviewOptions: hoverPreviewOptions
|
|
117
136
|
});
|
|
118
|
-
}, [url, data,
|
|
137
|
+
}, [url, data, handleOnClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
|
|
119
138
|
|
|
120
139
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
121
140
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -195,9 +214,9 @@ export function InlineCardNodeView(props) {
|
|
|
195
214
|
view: view,
|
|
196
215
|
isHoveredCallback: setIsOverlayHovered,
|
|
197
216
|
onOpenLinkClick: function onOpenLinkClick(event) {
|
|
198
|
-
var _pluginInjectionApi$
|
|
217
|
+
var _pluginInjectionApi$a2;
|
|
199
218
|
handleNavigation({
|
|
200
|
-
fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
219
|
+
fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.fireAnalyticsEvent,
|
|
201
220
|
onClickCallback: onClickCallback,
|
|
202
221
|
url: url,
|
|
203
222
|
event: event
|
|
@@ -219,8 +238,8 @@ export function InlineCardNodeView(props) {
|
|
|
219
238
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
220
239
|
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), fg('prompt_whiteboard_competitor_link_gate') && CompetitorPromptComponent);
|
|
221
240
|
}
|
|
222
|
-
export var inlineCardNodeView = function inlineCardNodeView(
|
|
223
|
-
var inlineCardViewProducer =
|
|
241
|
+
export var inlineCardNodeView = function inlineCardNodeView(_ref3) {
|
|
242
|
+
var inlineCardViewProducer = _ref3.inlineCardViewProducer;
|
|
224
243
|
return function (node, view, getPos, decorations) {
|
|
225
244
|
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
226
245
|
};
|
|
@@ -22,7 +22,7 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInject
|
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
24
|
export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
25
|
-
var _pluginInjectionApi$c
|
|
25
|
+
var _pluginInjectionApi$c;
|
|
26
26
|
var node = _ref.node,
|
|
27
27
|
cardContext = _ref.cardContext,
|
|
28
28
|
actionOptions = _ref.actionOptions,
|
|
@@ -49,8 +49,6 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
49
49
|
isResolvedViewRendered = _useState6[0],
|
|
50
50
|
setIsResolvedViewRendered = _useState6[1];
|
|
51
51
|
var editorAppearance = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card.sharedState.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.editorAppearance;
|
|
52
|
-
var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
53
|
-
editorAnalyticsApi = _ref2.actions;
|
|
54
52
|
var onResolve = useCallback(function (tr, title) {
|
|
55
53
|
var metadata = tr.getMeta(pluginKey);
|
|
56
54
|
if (metadata && metadata.type === 'REGISTER') {
|
|
@@ -79,11 +77,12 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
79
77
|
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
80
78
|
mode = _useSharedState.mode;
|
|
81
79
|
var innerCardWithOpenButtonOverlay = useMemo(function () {
|
|
80
|
+
var _pluginInjectionApi$a;
|
|
82
81
|
return /*#__PURE__*/React.createElement(OpenButtonOverlay, {
|
|
83
82
|
isVisible: isResolvedViewRendered,
|
|
84
83
|
url: node.attrs.url,
|
|
85
84
|
editorAppearance: editorAppearance,
|
|
86
|
-
editorAnalyticsApi:
|
|
85
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
87
86
|
view: view
|
|
88
87
|
}, /*#__PURE__*/React.createElement(InlineCard, {
|
|
89
88
|
node: node,
|
|
@@ -95,9 +94,10 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
95
94
|
onClick: onClick,
|
|
96
95
|
cardContext: cardContext,
|
|
97
96
|
isHovered: isHovered,
|
|
98
|
-
isPageSSRed: isPageSSRed
|
|
97
|
+
isPageSSRed: isPageSSRed,
|
|
98
|
+
pluginInjectionApi: pluginInjectionApi
|
|
99
99
|
}));
|
|
100
|
-
}, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed,
|
|
100
|
+
}, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
|
|
101
101
|
var innerCardOriginal = useMemo(function () {
|
|
102
102
|
return /*#__PURE__*/React.createElement(InlineCard, {
|
|
103
103
|
node: node,
|
|
@@ -109,9 +109,10 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
109
109
|
onClick: onClick,
|
|
110
110
|
cardContext: cardContext,
|
|
111
111
|
isHovered: isHovered,
|
|
112
|
-
isPageSSRed: isPageSSRed
|
|
112
|
+
isPageSSRed: isPageSSRed,
|
|
113
|
+
pluginInjectionApi: pluginInjectionApi
|
|
113
114
|
});
|
|
114
|
-
}, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed]);
|
|
115
|
+
}, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
|
|
115
116
|
var shouldShowOpenButtonOverlay = useMemo(function () {
|
|
116
117
|
var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless' && fg('platform_editor_controls_patch_8');
|
|
117
118
|
return (mode === 'edit' || editorAppearance === 'comment' && fg('platform_editor_controls_patch_6') || shouldShowOpenButtonOverlayInChomeless) && editorExperiment('platform_editor_controls', 'variant1');
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
7
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID as ACTION_SUBJECTID,
|
|
7
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID as ACTION_SUBJECTID, EVENT_TYPE, INPUT_METHOD, buildOpenedSettingsPayload, buildVisitedNonHyperLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { buildLayoutButtons, buildLayoutDropdown, commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
9
9
|
import { getLinkPreferencesURLFromENV } from '@atlaskit/editor-common/link';
|
|
10
10
|
import commonMessages, { annotationMessages, linkMessages, linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
@@ -75,7 +75,7 @@ export var visitCardLink = function visitCardLink(editorAnalyticsApi, inputMetho
|
|
|
75
75
|
// EDM-12466:
|
|
76
76
|
// During smart_link_editor_update_toolbar_open_link clean up
|
|
77
77
|
// Consider updating the code to use visitCardLink or visitCardLinkAnalyticsOnly for all input methods:
|
|
78
|
-
// INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR |
|
|
78
|
+
// INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK || INPUT_METHOD.META_CLICK
|
|
79
79
|
if (!fg('smart_link_editor_update_toolbar_open_link')) {
|
|
80
80
|
var _titleUrlPairFromNode = titleUrlPairFromNode(state.selection.node),
|
|
81
81
|
url = _titleUrlPairFromNode.url;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { EventHandler, KeyboardEvent, MouseEvent } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { OnClickCallback } from '@atlaskit/editor-common/card';
|
|
5
5
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
6
6
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
7
|
-
import type {
|
|
7
|
+
import type { ReactComponentProps, getPosHandler } from '@atlaskit/editor-common/react-node-view';
|
|
8
8
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
9
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
10
10
|
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -4,7 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
4
4
|
import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { SmartCardProps } from './genericCard';
|
|
6
6
|
import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
7
|
-
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, }: SmartCardProps) => React.JSX.Element | null>;
|
|
7
|
+
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, }: SmartCardProps) => React.JSX.Element | null>;
|
|
8
8
|
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | '__livePage' | 'isPageSSRed' | 'CompetitorPrompt'>;
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
@@ -8,7 +8,7 @@ import type { cardPlugin } from '../index';
|
|
|
8
8
|
import type { CardPluginOptions } from '../types';
|
|
9
9
|
export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
10
10
|
export declare const visitCardLink: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR) => Command;
|
|
11
|
-
export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK) => Command;
|
|
11
|
+
export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.META_CLICK) => Command;
|
|
12
12
|
export declare const openLinkSettings: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
13
13
|
export declare const floatingToolbar: (cardOptions: CardOptions, lpLinkPicker: boolean, linkPickerOptions?: LinkPickerOptions, pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>, disableFloatingToolbar?: boolean) => FloatingToolbarHandler;
|
|
14
14
|
export declare const getSettingsButton: (intl: IntlShape, editorAnalyticsApi: EditorAnalyticsAPI | undefined, userPreferencesLink?: string) => FloatingToolbarItem<Command>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { EventHandler, KeyboardEvent, MouseEvent } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { OnClickCallback } from '@atlaskit/editor-common/card';
|
|
5
5
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
6
6
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
7
|
-
import type {
|
|
7
|
+
import type { ReactComponentProps, getPosHandler } from '@atlaskit/editor-common/react-node-view';
|
|
8
8
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
9
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
10
10
|
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -4,7 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
4
4
|
import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { SmartCardProps } from './genericCard';
|
|
6
6
|
import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
7
|
-
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, }: SmartCardProps) => React.JSX.Element | null>;
|
|
7
|
+
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, }: SmartCardProps) => React.JSX.Element | null>;
|
|
8
8
|
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | '__livePage' | 'isPageSSRed' | 'CompetitorPrompt'>;
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
@@ -8,7 +8,7 @@ import type { cardPlugin } from '../index';
|
|
|
8
8
|
import type { CardPluginOptions } from '../types';
|
|
9
9
|
export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
10
10
|
export declare const visitCardLink: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR) => Command;
|
|
11
|
-
export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK) => Command;
|
|
11
|
+
export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.META_CLICK) => Command;
|
|
12
12
|
export declare const openLinkSettings: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
13
13
|
export declare const floatingToolbar: (cardOptions: CardOptions, lpLinkPicker: boolean, linkPickerOptions?: LinkPickerOptions, pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>, disableFloatingToolbar?: boolean) => FloatingToolbarHandler;
|
|
14
14
|
export declare const getSettingsButton: (intl: IntlShape, editorAnalyticsApi: EditorAnalyticsAPI | undefined, userPreferencesLink?: string) => FloatingToolbarItem<Command>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.5",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"@atlaskit/link-client-extension": "^5.0.0",
|
|
58
58
|
"@atlaskit/link-datasource": "^4.11.0",
|
|
59
59
|
"@atlaskit/linking-common": "^9.0.0",
|
|
60
|
-
"@atlaskit/linking-types": "^
|
|
60
|
+
"@atlaskit/linking-types": "^10.0.0",
|
|
61
61
|
"@atlaskit/menu": "^8.0.0",
|
|
62
62
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
63
63
|
"@atlaskit/primitives": "^14.8.0",
|
|
64
|
-
"@atlaskit/smart-card": "^38.
|
|
64
|
+
"@atlaskit/smart-card": "^38.6.0",
|
|
65
65
|
"@atlaskit/theme": "^18.0.0",
|
|
66
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
66
|
+
"@atlaskit/tmp-editor-statsig": "^5.10.0",
|
|
67
67
|
"@atlaskit/tokens": "^5.0.0",
|
|
68
68
|
"@babel/runtime": "^7.0.0",
|
|
69
69
|
"@emotion/react": "^11.7.1",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"uuid": "^3.1.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/link-provider": "^3.
|
|
76
|
+
"@atlaskit/link-provider": "^3.3.0",
|
|
77
77
|
"react": "^18.2.0",
|
|
78
78
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
79
79
|
},
|
package/compass.yml
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
id: 'ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/b3ffe2fd-7f29-4a07-81cd-67c57914ec9a'
|
|
2
|
-
name: '@atlaskit/editor-plugin-card'
|
|
3
|
-
description: |-
|
|
4
|
-
This is an editor plugin for Atlassian's rich text editor that enables support for "smart cards" and advanced linking features within the editor. It integrates with the Atlassian linking platform to allow users to insert, display, and interact with rich link previews (smart cards) directly in the editor surface.
|
|
5
|
-
This plugin is typically consumed via `@atlaskit/editor-core` as a plugin dependency and is essential for products that require embedding and managing smart links in their content.
|
|
6
|
-
configVersion: 1
|
|
7
|
-
typeId: LIBRARY
|
|
8
|
-
ownerId: 'ari:cloud:identity::team/9683a6ac-2d3f-44c8-a0fe-56128ca69e20'
|
|
9
|
-
fields:
|
|
10
|
-
tier: 4
|
|
11
|
-
lifecycle: Active
|
|
12
|
-
isMonorepoProject: true
|
|
13
|
-
labels:
|
|
14
|
-
- atlassian-platform
|
|
15
|
-
links:
|
|
16
|
-
- name: Bandicoots
|
|
17
|
-
type: PROJECT
|
|
18
|
-
url: 'https://product-fabric.atlassian.net/jira/software/c/projects/EDM/boards/5176'
|
|
19
|
-
- name: '#help-twg-linking-platform'
|
|
20
|
-
type: CHAT_CHANNEL
|
|
21
|
-
url: 'https://atlassian.enterprise.slack.com/archives/CFKGAQZRV'
|
|
22
|
-
- name: ''
|
|
23
|
-
type: ON_CALL
|
|
24
|
-
url: 'https://atlassian.app.opsgenie.com/settings/schedule/detail/b9c8b313-dd6d-4a41-8eeb-d7a9df55be9d'
|
|
25
|
-
- name: source code
|
|
26
|
-
type: REPOSITORY
|
|
27
|
-
url: 'https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/editor/editor-plugin-card'
|
|
28
|
-
customFields: []
|
|
29
|
-
relationships:
|
|
30
|
-
DEPENDS_ON:
|
|
31
|
-
- 'ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/27e8ffab-42db-4c16-9afb-9eefd72d02ec' # link-analytics
|
|
32
|
-
- 'ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/37dc08cd-d81c-4bbb-9b26-5d6d8a417ea3' # link-client-extension
|
|
33
|
-
- 'ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/2833bb40-a2e4-4b79-b74b-147d0d23fdb1' # link-datasource
|
|
34
|
-
- 'ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/18157dad-b7fb-4cde-8b74-e905b5757611' # link-provider
|
|
35
|
-
- 'ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/3d229125-4f9d-4091-a303-84ae4eb643fb' # linking-common
|
|
36
|
-
- 'ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/c9898540-33b1-4cd4-9399-16e575bcedae' # smart-card
|