@atlaskit/editor-plugin-card 22.1.11 → 23.0.1
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 +32 -0
- package/dist/cjs/nodeviews/inlineCard.js +4 -8
- package/dist/cjs/nodeviews/inlineCardBase.js +2 -4
- package/dist/cjs/nodeviews/lazy-inline-card.js +1 -25
- package/dist/cjs/ui/InlineCardOverlay/index.js +1 -2
- package/dist/cjs/ui/OpenLinkToolbarButton/index.js +0 -1
- package/dist/cjs/ui/toolbar.js +4 -5
- package/dist/es2019/nodeviews/inlineCard.js +4 -8
- package/dist/es2019/nodeviews/inlineCardBase.js +2 -4
- package/dist/es2019/nodeviews/lazy-inline-card.js +1 -22
- package/dist/es2019/ui/InlineCardOverlay/index.js +1 -2
- package/dist/es2019/ui/OpenLinkToolbarButton/index.js +0 -1
- package/dist/es2019/ui/toolbar.js +4 -5
- package/dist/esm/nodeviews/inlineCard.js +4 -8
- package/dist/esm/nodeviews/inlineCardBase.js +2 -4
- package/dist/esm/nodeviews/lazy-inline-card.js +1 -20
- package/dist/esm/ui/InlineCardOverlay/index.js +1 -2
- package/dist/esm/ui/OpenLinkToolbarButton/index.js +0 -1
- package/dist/esm/ui/toolbar.js +4 -5
- package/dist/types/ui/OpenLinkToolbarButton/index.d.ts +0 -1
- package/package.json +20 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 23.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b94131fcee276`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b94131fcee276) -
|
|
8
|
+
Removes the `platform_smartlink_xpc_url_wrapping` feature gate and makes cross-product URL
|
|
9
|
+
wrapping for Smart Links permanent, on for all consumers.
|
|
10
|
+
|
|
11
|
+
What this behavior does: when a resolved Smart Link points to a first-party Atlassian destination
|
|
12
|
+
(e.g. a Jira issue, Confluence page), the URL used for navigation — via click, "Open link", or any
|
|
13
|
+
other destination-URL usage — now has a short-lived interaction-session query parameter (`xpis`)
|
|
14
|
+
appended automatically. This lets the destination product attribute the visit back to the product
|
|
15
|
+
and surface the link was opened from, powering cross-product usage analytics. It has no effect on:
|
|
16
|
+
- third-party (non-Atlassian) links,
|
|
17
|
+
- links that are not yet resolved,
|
|
18
|
+
- URLs that already contain the parameter.
|
|
19
|
+
|
|
20
|
+
No API shape changes: this only affects the resolved value returned by existing Smart Link
|
|
21
|
+
URL/navigation behavior (e.g. `Card`, `useSmartLinkDestinationUrl`, inline/block/embed card
|
|
22
|
+
click-through, and datasource table link cells). No new props, exports, or configuration are
|
|
23
|
+
introduced, and no action is required from consumers.
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
27
|
+
## 23.0.0
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [`3422261e7a40e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3422261e7a40e) -
|
|
32
|
+
Clean up experiment `platform_editor_smartlink_local_cache`.
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
|
|
3
35
|
## 22.1.11
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
|
@@ -12,7 +12,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
13
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
14
|
var _editorSmartLinkDraggable = require("@atlaskit/editor-smart-link-draggable");
|
|
15
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
15
|
var _utils = require("../pm-plugins/utils");
|
|
17
16
|
var _SmartCardSSRReactContextsProvider = require("../ui/SmartCardSSRReactContextsProvider");
|
|
18
17
|
var _genericCard = require("./genericCard");
|
|
@@ -59,13 +58,10 @@ function InlineCardNodeView(props) {
|
|
|
59
58
|
linkType: "inline"
|
|
60
59
|
}) : null;
|
|
61
60
|
(0, _react.useEffect)(function () {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(_refreshCache = (_ref = providerInstance).refreshCache) === null || _refreshCache === void 0 || _refreshCache.call(_ref, props.node);
|
|
67
|
-
});
|
|
68
|
-
}
|
|
61
|
+
provider === null || provider === void 0 || provider.then(function (providerInstance) {
|
|
62
|
+
var _refreshCache, _ref;
|
|
63
|
+
(_refreshCache = (_ref = providerInstance).refreshCache) === null || _refreshCache === void 0 || _refreshCache.call(_ref, props.node);
|
|
64
|
+
});
|
|
69
65
|
}, [provider, props.node]);
|
|
70
66
|
var linkPosition = (0, _react.useMemo)(function () {
|
|
71
67
|
if (!getPos || typeof getPos === 'boolean') {
|
|
@@ -12,10 +12,8 @@ var _uuid = require("uuid");
|
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
14
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
15
|
var _smartCard = require("@atlaskit/smart-card");
|
|
17
16
|
var _ssr = require("@atlaskit/smart-card/ssr");
|
|
18
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
17
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
20
18
|
var _actions = require("../pm-plugins/actions");
|
|
21
19
|
var _toolbar = require("../ui/toolbar");
|
|
@@ -109,7 +107,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
109
107
|
var _ref3 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
110
108
|
editorAnalyticsApi = _ref3.actions;
|
|
111
109
|
(0, _toolbar.visitCardLinkAnalytics)(editorAnalyticsApi, _analytics.INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
112
|
-
window.open((
|
|
110
|
+
window.open((_data$destinationUrl = data === null || data === void 0 ? void 0 : data.destinationUrl) !== null && _data$destinationUrl !== void 0 ? _data$destinationUrl : url, '_blank');
|
|
113
111
|
} else {
|
|
114
112
|
// only trigger the provided onClick callback if the meta key or ctrl key is not pressed
|
|
115
113
|
propsOnClick === null || propsOnClick === void 0 || propsOnClick(event);
|
|
@@ -117,7 +115,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
117
115
|
}, [propsOnClick, url, view, pluginInjectionApi]);
|
|
118
116
|
var onClick = (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? handleOnClick : propsOnClick;
|
|
119
117
|
var card = (0, _react.useMemo)(function () {
|
|
120
|
-
if ((isPageSSRed || cardState
|
|
118
|
+
if ((isPageSSRed || cardState) && url) {
|
|
121
119
|
return /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
|
|
122
120
|
key: url,
|
|
123
121
|
url: url,
|
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.lazyInlineCardView = void 0;
|
|
8
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
-
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
10
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
|
-
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
12
7
|
var _inlineCard = require("./inlineCard");
|
|
13
|
-
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" != (0, _typeof2.default)(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); }
|
|
14
8
|
var lazyInlineCardView = exports.lazyInlineCardView = function lazyInlineCardView(props) {
|
|
15
|
-
|
|
16
|
-
isPageSSRed = _props$isPageSSRed === void 0 ? false : _props$isPageSSRed;
|
|
17
|
-
if ((0, _editorExperiment.editorExperiment)('platform_editor_exp_lazy_node_views', false) || (0, _expValEquals.expValEquals)('platform_editor_smartlink_local_cache', 'isEnabled', true) || isPageSSRed) {
|
|
18
|
-
return (0, _inlineCard.inlineCardNodeView)(props);
|
|
19
|
-
}
|
|
20
|
-
return (0, _lazyNodeView.withLazyLoading)({
|
|
21
|
-
nodeName: 'inlineCard',
|
|
22
|
-
getNodeViewOptions: function getNodeViewOptions() {},
|
|
23
|
-
loader: function loader() {
|
|
24
|
-
var result = Promise.resolve().then(function () {
|
|
25
|
-
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-inline-card-item-nodeview" */
|
|
26
|
-
'./inlineCard'));
|
|
27
|
-
}).then(function (_ref) {
|
|
28
|
-
var inlineCardNodeView = _ref.inlineCardNodeView;
|
|
29
|
-
return inlineCardNodeView(props);
|
|
30
|
-
});
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
9
|
+
return (0, _inlineCard.inlineCardNodeView)(props);
|
|
34
10
|
};
|
|
@@ -17,7 +17,6 @@ var _reactIntl = require("react-intl");
|
|
|
17
17
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
18
18
|
var _whitespace = require("@atlaskit/editor-common/whitespace");
|
|
19
19
|
var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize"));
|
|
20
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
21
20
|
var _useSmartLinkDestinationUrl = require("@atlaskit/smart-card/hook/use-smart-link-destination-url");
|
|
22
21
|
var _utils = require("./utils");
|
|
23
22
|
var _excluded = ["children", "isSelected", "isVisible", "testId", "url"];
|
|
@@ -244,7 +243,7 @@ var InlineCardOverlay = function InlineCardOverlay(_ref) {
|
|
|
244
243
|
width: availableWidth
|
|
245
244
|
},
|
|
246
245
|
"data-testid": testId,
|
|
247
|
-
href:
|
|
246
|
+
href: destinationUrl,
|
|
248
247
|
onClick: function onClick(e) {
|
|
249
248
|
return e.preventDefault();
|
|
250
249
|
},
|
|
@@ -14,7 +14,6 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
14
14
|
/**
|
|
15
15
|
* Toolbar button that opens a Smart Link URL in a new tab, with the XPC-wrapped destination URL.
|
|
16
16
|
*
|
|
17
|
-
* This component is only rendered when `fg('platform_smartlink_xpc_url_wrapping')` is ON.
|
|
18
17
|
* It wraps `FloatingToolbarButton` and replaces `href` with the resolved destination URL
|
|
19
18
|
* (cross-product analytics parameters appended), falling back to the raw `url` when the
|
|
20
19
|
* link is unresolved or not a first-party Atlassian link.
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -28,7 +28,6 @@ var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
|
|
|
28
28
|
var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broken"));
|
|
29
29
|
var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
|
|
30
30
|
var _settings = _interopRequireDefault(require("@atlaskit/icon/core/settings"));
|
|
31
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
32
31
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
33
32
|
var _doc = require("../pm-plugins/doc");
|
|
34
33
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
@@ -378,7 +377,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
378
377
|
href: url,
|
|
379
378
|
target: '_blank'
|
|
380
379
|
};
|
|
381
|
-
var openLinkToolbarItem =
|
|
380
|
+
var openLinkToolbarItem = {
|
|
382
381
|
type: 'custom',
|
|
383
382
|
fallback: [openLinkToolbarItemFallback],
|
|
384
383
|
render: function render(editorView) {
|
|
@@ -390,7 +389,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
390
389
|
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
391
390
|
}) : null;
|
|
392
391
|
}
|
|
393
|
-
}
|
|
392
|
+
};
|
|
394
393
|
var toolbarItems = areAllNewToolbarFlagsDisabled ? [].concat(editItems, commentItems, openPreviewPanelItems, [openLinkToolbarItem, {
|
|
395
394
|
type: 'separator'
|
|
396
395
|
}], (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, !areAllNewToolbarFlagsDisabled)), [{
|
|
@@ -666,7 +665,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
666
665
|
href: node.attrs.url,
|
|
667
666
|
target: '_blank'
|
|
668
667
|
};
|
|
669
|
-
toolbarItems.push(
|
|
668
|
+
toolbarItems.push({
|
|
670
669
|
type: 'custom',
|
|
671
670
|
fallback: [openLinkToolbarItemFallback],
|
|
672
671
|
render: function render(editorView) {
|
|
@@ -679,7 +678,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
679
678
|
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
680
679
|
}) : null;
|
|
681
680
|
}
|
|
682
|
-
}
|
|
681
|
+
});
|
|
683
682
|
if (areAllNewToolbarFlagsDisabled) {
|
|
684
683
|
toolbarItems.push({
|
|
685
684
|
type: 'separator'
|
|
@@ -3,7 +3,6 @@ import React, { useEffect, useMemo } from 'react';
|
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from '@atlaskit/editor-smart-link-draggable';
|
|
6
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
6
|
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
8
7
|
import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
|
|
9
8
|
import { Card } from './genericCard';
|
|
@@ -52,13 +51,10 @@ export function InlineCardNodeView(props) {
|
|
|
52
51
|
linkType: "inline"
|
|
53
52
|
}) : null;
|
|
54
53
|
useEffect(() => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
(_refreshCache = (_ref = providerInstance).refreshCache) === null || _refreshCache === void 0 ? void 0 : _refreshCache.call(_ref, props.node);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
54
|
+
provider === null || provider === void 0 ? void 0 : provider.then(providerInstance => {
|
|
55
|
+
var _refreshCache, _ref;
|
|
56
|
+
(_refreshCache = (_ref = providerInstance).refreshCache) === null || _refreshCache === void 0 ? void 0 : _refreshCache.call(_ref, props.node);
|
|
57
|
+
});
|
|
62
58
|
}, [provider, props.node]);
|
|
63
59
|
const linkPosition = useMemo(() => {
|
|
64
60
|
if (!getPos || typeof getPos === 'boolean') {
|
|
@@ -5,10 +5,8 @@ import { v4 as uuid } from 'uuid';
|
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
7
7
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
8
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
10
9
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
11
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
13
11
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
14
12
|
import { visitCardLinkAnalytics } from '../ui/toolbar';
|
|
@@ -107,7 +105,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
107
105
|
actions: editorAnalyticsApi
|
|
108
106
|
} = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {};
|
|
109
107
|
visitCardLinkAnalytics(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
110
|
-
window.open(
|
|
108
|
+
window.open((_data$destinationUrl = data === null || data === void 0 ? void 0 : data.destinationUrl) !== null && _data$destinationUrl !== void 0 ? _data$destinationUrl : url, '_blank');
|
|
111
109
|
} else {
|
|
112
110
|
// only trigger the provided onClick callback if the meta key or ctrl key is not pressed
|
|
113
111
|
propsOnClick === null || propsOnClick === void 0 ? void 0 : propsOnClick(event);
|
|
@@ -115,7 +113,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
115
113
|
}, [propsOnClick, url, view, pluginInjectionApi]);
|
|
116
114
|
const onClick = editorExperiment('platform_editor_controls', 'variant1') ? handleOnClick : propsOnClick;
|
|
117
115
|
const card = useMemo(() => {
|
|
118
|
-
if ((isPageSSRed || cardState
|
|
116
|
+
if ((isPageSSRed || cardState) && url) {
|
|
119
117
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
120
118
|
key: url,
|
|
121
119
|
url: url,
|
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
4
1
|
import { inlineCardNodeView } from './inlineCard';
|
|
5
2
|
export const lazyInlineCardView = props => {
|
|
6
|
-
|
|
7
|
-
isPageSSRed = false
|
|
8
|
-
} = props;
|
|
9
|
-
if (editorExperiment('platform_editor_exp_lazy_node_views', false) || expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) || isPageSSRed) {
|
|
10
|
-
return inlineCardNodeView(props);
|
|
11
|
-
}
|
|
12
|
-
return withLazyLoading({
|
|
13
|
-
nodeName: 'inlineCard',
|
|
14
|
-
getNodeViewOptions: () => {},
|
|
15
|
-
loader: () => {
|
|
16
|
-
const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-inline-card-item-nodeview" */
|
|
17
|
-
'./inlineCard').then(({
|
|
18
|
-
inlineCardNodeView
|
|
19
|
-
}) => {
|
|
20
|
-
return inlineCardNodeView(props);
|
|
21
|
-
});
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
3
|
+
return inlineCardNodeView(props);
|
|
25
4
|
};
|
|
@@ -14,7 +14,6 @@ import { useIntl } from 'react-intl';
|
|
|
14
14
|
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/whitespace';
|
|
16
16
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
17
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
18
17
|
import { useSmartLinkDestinationUrl } from '@atlaskit/smart-card/hook/use-smart-link-destination-url';
|
|
19
18
|
import { getChildElement, getInlineCardAvailableWidth, getOverlayWidths, isOneLine } from './utils';
|
|
20
19
|
const DEBOUNCE_IN_MS = 5;
|
|
@@ -227,7 +226,7 @@ const InlineCardOverlay = ({
|
|
|
227
226
|
width: availableWidth
|
|
228
227
|
},
|
|
229
228
|
"data-testid": testId,
|
|
230
|
-
href:
|
|
229
|
+
href: destinationUrl,
|
|
231
230
|
onClick: e => e.preventDefault(),
|
|
232
231
|
tabIndex: -1
|
|
233
232
|
}, jsx("span", {
|
|
@@ -5,7 +5,6 @@ import { useSmartLinkDestinationUrl } from '@atlaskit/smart-card/hook/use-smart-
|
|
|
5
5
|
/**
|
|
6
6
|
* Toolbar button that opens a Smart Link URL in a new tab, with the XPC-wrapped destination URL.
|
|
7
7
|
*
|
|
8
|
-
* This component is only rendered when `fg('platform_smartlink_xpc_url_wrapping')` is ON.
|
|
9
8
|
* It wraps `FloatingToolbarButton` and replaces `href` with the resolved destination URL
|
|
10
9
|
* (cross-product analytics parameters appended), falling back to the raw `url` when the
|
|
11
10
|
* link is unresolved or not a first-party Atlassian link.
|
|
@@ -18,7 +18,6 @@ import EditIcon from '@atlaskit/icon/core/edit';
|
|
|
18
18
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
19
19
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
20
20
|
import CogIcon from '@atlaskit/icon/core/settings';
|
|
21
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
21
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
23
22
|
import { changeSelectedCardToText } from '../pm-plugins/doc';
|
|
24
23
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
@@ -363,7 +362,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
363
362
|
href: url,
|
|
364
363
|
target: '_blank'
|
|
365
364
|
};
|
|
366
|
-
const openLinkToolbarItem =
|
|
365
|
+
const openLinkToolbarItem = {
|
|
367
366
|
type: 'custom',
|
|
368
367
|
fallback: [openLinkToolbarItemFallback],
|
|
369
368
|
render: editorView => editorView && url ? /*#__PURE__*/React.createElement(OpenLinkToolbarButton, {
|
|
@@ -373,7 +372,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
373
372
|
onClick: fireOpenLinkToolbarAnalytics(editorAnalyticsApi, openLinkInputMethod, resolvedToolbarAttributes),
|
|
374
373
|
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
375
374
|
}) : null
|
|
376
|
-
}
|
|
375
|
+
};
|
|
377
376
|
const toolbarItems = areAllNewToolbarFlagsDisabled ? [...editItems, ...commentItems, ...openPreviewPanelItems, openLinkToolbarItem, {
|
|
378
377
|
type: 'separator'
|
|
379
378
|
}, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, !areAllNewToolbarFlagsDisabled), {
|
|
@@ -646,7 +645,7 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
646
645
|
href: node.attrs.url,
|
|
647
646
|
target: '_blank'
|
|
648
647
|
};
|
|
649
|
-
toolbarItems.push(
|
|
648
|
+
toolbarItems.push({
|
|
650
649
|
type: 'custom',
|
|
651
650
|
fallback: [openLinkToolbarItemFallback],
|
|
652
651
|
render: editorView => {
|
|
@@ -659,7 +658,7 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
659
658
|
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
660
659
|
}) : null;
|
|
661
660
|
}
|
|
662
|
-
}
|
|
661
|
+
});
|
|
663
662
|
if (areAllNewToolbarFlagsDisabled) {
|
|
664
663
|
toolbarItems.push({
|
|
665
664
|
type: 'separator'
|
|
@@ -3,7 +3,6 @@ import React, { useEffect, useMemo } from 'react';
|
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from '@atlaskit/editor-smart-link-draggable';
|
|
6
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
6
|
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
8
7
|
import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
|
|
9
8
|
import { Card } from './genericCard';
|
|
@@ -49,13 +48,10 @@ export function InlineCardNodeView(props) {
|
|
|
49
48
|
linkType: "inline"
|
|
50
49
|
}) : null;
|
|
51
50
|
useEffect(function () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
(_refreshCache = (_ref = providerInstance).refreshCache) === null || _refreshCache === void 0 || _refreshCache.call(_ref, props.node);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
51
|
+
provider === null || provider === void 0 || provider.then(function (providerInstance) {
|
|
52
|
+
var _refreshCache, _ref;
|
|
53
|
+
(_refreshCache = (_ref = providerInstance).refreshCache) === null || _refreshCache === void 0 || _refreshCache.call(_ref, props.node);
|
|
54
|
+
});
|
|
59
55
|
}, [provider, props.node]);
|
|
60
56
|
var linkPosition = useMemo(function () {
|
|
61
57
|
if (!getPos || typeof getPos === 'boolean') {
|
|
@@ -5,10 +5,8 @@ import { v4 as uuid } from 'uuid';
|
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
7
7
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
8
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
10
9
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
11
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
13
11
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
14
12
|
import { visitCardLinkAnalytics } from '../ui/toolbar';
|
|
@@ -99,7 +97,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
99
97
|
var _ref3 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
100
98
|
editorAnalyticsApi = _ref3.actions;
|
|
101
99
|
visitCardLinkAnalytics(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
102
|
-
window.open(
|
|
100
|
+
window.open((_data$destinationUrl = data === null || data === void 0 ? void 0 : data.destinationUrl) !== null && _data$destinationUrl !== void 0 ? _data$destinationUrl : url, '_blank');
|
|
103
101
|
} else {
|
|
104
102
|
// only trigger the provided onClick callback if the meta key or ctrl key is not pressed
|
|
105
103
|
propsOnClick === null || propsOnClick === void 0 || propsOnClick(event);
|
|
@@ -107,7 +105,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
107
105
|
}, [propsOnClick, url, view, pluginInjectionApi]);
|
|
108
106
|
var onClick = editorExperiment('platform_editor_controls', 'variant1') ? handleOnClick : propsOnClick;
|
|
109
107
|
var card = useMemo(function () {
|
|
110
|
-
if ((isPageSSRed || cardState
|
|
108
|
+
if ((isPageSSRed || cardState) && url) {
|
|
111
109
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
112
110
|
key: url,
|
|
113
111
|
url: url,
|
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
4
1
|
import { inlineCardNodeView } from './inlineCard';
|
|
5
2
|
export var lazyInlineCardView = function lazyInlineCardView(props) {
|
|
6
|
-
|
|
7
|
-
isPageSSRed = _props$isPageSSRed === void 0 ? false : _props$isPageSSRed;
|
|
8
|
-
if (editorExperiment('platform_editor_exp_lazy_node_views', false) || expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) || isPageSSRed) {
|
|
9
|
-
return inlineCardNodeView(props);
|
|
10
|
-
}
|
|
11
|
-
return withLazyLoading({
|
|
12
|
-
nodeName: 'inlineCard',
|
|
13
|
-
getNodeViewOptions: function getNodeViewOptions() {},
|
|
14
|
-
loader: function loader() {
|
|
15
|
-
var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-inline-card-item-nodeview" */
|
|
16
|
-
'./inlineCard').then(function (_ref) {
|
|
17
|
-
var inlineCardNodeView = _ref.inlineCardNodeView;
|
|
18
|
-
return inlineCardNodeView(props);
|
|
19
|
-
});
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
3
|
+
return inlineCardNodeView(props);
|
|
23
4
|
};
|
|
@@ -18,7 +18,6 @@ import { useIntl } from 'react-intl';
|
|
|
18
18
|
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
19
19
|
import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/whitespace';
|
|
20
20
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
21
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
21
|
import { useSmartLinkDestinationUrl } from '@atlaskit/smart-card/hook/use-smart-link-destination-url';
|
|
23
22
|
import { getChildElement, getInlineCardAvailableWidth, getOverlayWidths, isOneLine } from './utils';
|
|
24
23
|
var DEBOUNCE_IN_MS = 5;
|
|
@@ -236,7 +235,7 @@ var InlineCardOverlay = function InlineCardOverlay(_ref) {
|
|
|
236
235
|
width: availableWidth
|
|
237
236
|
},
|
|
238
237
|
"data-testid": testId,
|
|
239
|
-
href:
|
|
238
|
+
href: destinationUrl,
|
|
240
239
|
onClick: function onClick(e) {
|
|
241
240
|
return e.preventDefault();
|
|
242
241
|
},
|
|
@@ -5,7 +5,6 @@ import { useSmartLinkDestinationUrl } from '@atlaskit/smart-card/hook/use-smart-
|
|
|
5
5
|
/**
|
|
6
6
|
* Toolbar button that opens a Smart Link URL in a new tab, with the XPC-wrapped destination URL.
|
|
7
7
|
*
|
|
8
|
-
* This component is only rendered when `fg('platform_smartlink_xpc_url_wrapping')` is ON.
|
|
9
8
|
* It wraps `FloatingToolbarButton` and replaces `href` with the resolved destination URL
|
|
10
9
|
* (cross-product analytics parameters appended), falling back to the raw `url` when the
|
|
11
10
|
* link is unresolved or not a first-party Atlassian link.
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -22,7 +22,6 @@ import EditIcon from '@atlaskit/icon/core/edit';
|
|
|
22
22
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
23
23
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
24
24
|
import CogIcon from '@atlaskit/icon/core/settings';
|
|
25
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
26
25
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
27
26
|
import { changeSelectedCardToText } from '../pm-plugins/doc';
|
|
28
27
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
@@ -369,7 +368,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
369
368
|
href: url,
|
|
370
369
|
target: '_blank'
|
|
371
370
|
};
|
|
372
|
-
var openLinkToolbarItem =
|
|
371
|
+
var openLinkToolbarItem = {
|
|
373
372
|
type: 'custom',
|
|
374
373
|
fallback: [openLinkToolbarItemFallback],
|
|
375
374
|
render: function render(editorView) {
|
|
@@ -381,7 +380,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
381
380
|
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
382
381
|
}) : null;
|
|
383
382
|
}
|
|
384
|
-
}
|
|
383
|
+
};
|
|
385
384
|
var toolbarItems = areAllNewToolbarFlagsDisabled ? [].concat(editItems, commentItems, openPreviewPanelItems, [openLinkToolbarItem, {
|
|
386
385
|
type: 'separator'
|
|
387
386
|
}], _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi, !areAllNewToolbarFlagsDisabled)), [{
|
|
@@ -657,7 +656,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
657
656
|
href: node.attrs.url,
|
|
658
657
|
target: '_blank'
|
|
659
658
|
};
|
|
660
|
-
toolbarItems.push(
|
|
659
|
+
toolbarItems.push({
|
|
661
660
|
type: 'custom',
|
|
662
661
|
fallback: [openLinkToolbarItemFallback],
|
|
663
662
|
render: function render(editorView) {
|
|
@@ -670,7 +669,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
670
669
|
areAnyNewToolbarFlagsEnabled: !areAllNewToolbarFlagsDisabled
|
|
671
670
|
}) : null;
|
|
672
671
|
}
|
|
673
|
-
}
|
|
672
|
+
});
|
|
674
673
|
if (areAllNewToolbarFlagsDisabled) {
|
|
675
674
|
toolbarItems.push({
|
|
676
675
|
type: 'separator'
|
|
@@ -11,7 +11,6 @@ type OpenLinkToolbarButtonProps = {
|
|
|
11
11
|
/**
|
|
12
12
|
* Toolbar button that opens a Smart Link URL in a new tab, with the XPC-wrapped destination URL.
|
|
13
13
|
*
|
|
14
|
-
* This component is only rendered when `fg('platform_smartlink_xpc_url_wrapping')` is ON.
|
|
15
14
|
* It wraps `FloatingToolbarButton` and replaces `href` with the resolved destination URL
|
|
16
15
|
* (cross-product analytics parameters appended), falling back to the raw `url` when the
|
|
17
16
|
* link is unresolved or not a first-party Atlassian link.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,26 +21,26 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^57.
|
|
24
|
+
"@atlaskit/adf-schema": "^57.4.0",
|
|
25
25
|
"@atlaskit/analytics-next": "^12.5.0",
|
|
26
26
|
"@atlaskit/button": "^25.3.0",
|
|
27
27
|
"@atlaskit/css": "^1.1.0",
|
|
28
28
|
"@atlaskit/custom-steps": "^1.1.0",
|
|
29
29
|
"@atlaskit/editor-card-provider": "^7.3.0",
|
|
30
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
31
|
-
"@atlaskit/editor-plugin-annotation": "^
|
|
32
|
-
"@atlaskit/editor-plugin-base": "^
|
|
33
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
34
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
35
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
36
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
37
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
38
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^
|
|
39
|
-
"@atlaskit/editor-plugin-grid": "^
|
|
40
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
41
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
42
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
43
|
-
"@atlaskit/editor-plugin-width": "^
|
|
30
|
+
"@atlaskit/editor-plugin-analytics": "^17.0.0",
|
|
31
|
+
"@atlaskit/editor-plugin-annotation": "^17.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-base": "^18.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-connectivity": "^17.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-decorations": "^17.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-editor-disabled": "^17.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^19.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-feature-flags": "^16.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^19.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-grid": "^17.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-selection": "^17.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-toolbar": "^14.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^11.0.0",
|
|
43
|
+
"@atlaskit/editor-plugin-width": "^18.0.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^4.1.0",
|
|
46
46
|
"@atlaskit/editor-smart-link-draggable": "^1.2.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/link": "^5.1.0",
|
|
53
53
|
"@atlaskit/link-analytics": "^12.3.0",
|
|
54
54
|
"@atlaskit/link-client-extension": "^7.3.0",
|
|
55
|
-
"@atlaskit/link-datasource": "^6.
|
|
55
|
+
"@atlaskit/link-datasource": "^6.12.0",
|
|
56
56
|
"@atlaskit/link-extractors": "^4.2.0",
|
|
57
57
|
"@atlaskit/linking-common": "^12.1.0",
|
|
58
58
|
"@atlaskit/linking-types": "^15.2.0",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
63
63
|
"@atlaskit/primitives": "^22.5.0",
|
|
64
64
|
"@atlaskit/prosemirror-history": "^1.2.0",
|
|
65
|
-
"@atlaskit/smart-card": "^45.
|
|
66
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
65
|
+
"@atlaskit/smart-card": "^45.21.0",
|
|
66
|
+
"@atlaskit/tmp-editor-statsig": "^180.0.0",
|
|
67
67
|
"@atlaskit/tokens": "^16.11.0",
|
|
68
68
|
"@babel/runtime": "^7.0.0",
|
|
69
69
|
"@emotion/react": "^11.7.1",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"uuid": "^11.1.1"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/editor-common": "^
|
|
76
|
+
"@atlaskit/editor-common": "^121.1.0",
|
|
77
77
|
"@atlaskit/link-provider": "^5.5.0",
|
|
78
78
|
"react": "^18.2.0 || ^19.2.0",
|
|
79
79
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -91,10 +91,6 @@
|
|
|
91
91
|
"platform_editor_adf_with_localid": {
|
|
92
92
|
"type": "boolean"
|
|
93
93
|
},
|
|
94
|
-
"platform_smartlink_xpc_url_wrapping": {
|
|
95
|
-
"type": "boolean",
|
|
96
|
-
"referenceOnly": true
|
|
97
|
-
},
|
|
98
94
|
"platform_lp_sllv_table_settings_menu": {
|
|
99
95
|
"type": "boolean"
|
|
100
96
|
},
|