@atlaskit/editor-plugin-card 6.6.10 → 6.6.12
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 +17 -0
- package/dist/cjs/nodeviews/inlineCard.js +1 -1
- package/dist/cjs/ui/OpenButtonOverlay/index.js +1 -1
- package/dist/cjs/ui/toolbar.js +13 -43
- package/dist/es2019/nodeviews/inlineCard.js +2 -2
- package/dist/es2019/ui/OpenButtonOverlay/index.js +2 -2
- package/dist/es2019/ui/toolbar.js +10 -46
- package/dist/esm/nodeviews/inlineCard.js +2 -2
- package/dist/esm/ui/OpenButtonOverlay/index.js +2 -2
- package/dist/esm/ui/toolbar.js +12 -42
- package/dist/types/ui/toolbar.d.ts +1 -2
- package/dist/types-ts4.5/ui/toolbar.d.ts +1 -2
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 6.6.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#174371](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/174371)
|
|
8
|
+
[`05fc53f9168ae`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/05fc53f9168ae) -
|
|
9
|
+
Merge visitCardLink and visitCardLinkAnalyticsOnly functions
|
|
10
|
+
|
|
11
|
+
## 6.6.11
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#174579](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/174579)
|
|
16
|
+
[`523619ae64bbd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/523619ae64bbd) -
|
|
17
|
+
[ux] Clean up feature gate smart_link_editor_update_toolbar_open_link
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 6.6.10
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -104,7 +104,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
104
104
|
var _pluginInjectionApi$a;
|
|
105
105
|
var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
106
106
|
editorAnalyticsApi = _ref2.actions;
|
|
107
|
-
(0, _toolbar.
|
|
107
|
+
(0, _toolbar.visitCardLinkAnalytics)(editorAnalyticsApi, _analytics.INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
108
108
|
window.open(url, '_blank');
|
|
109
109
|
} else {
|
|
110
110
|
// only trigger the provided onClick callback if the meta key or ctrl key is not pressed
|
|
@@ -155,7 +155,7 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
|
|
|
155
155
|
};
|
|
156
156
|
var sendVisitLinkAnalytics = function sendVisitLinkAnalytics(inputMethod) {
|
|
157
157
|
if (editorAnalyticsApi && view) {
|
|
158
|
-
(0, _toolbar.
|
|
158
|
+
(0, _toolbar.visitCardLinkAnalytics)(editorAnalyticsApi, inputMethod)(view.state, view.dispatch);
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
161
|
var handleDoubleClick = function handleDoubleClick() {
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.visitCardLinkAnalytics = exports.shouldRenderToolbarPulse = exports.removeCard = exports.openLinkSettings = exports.getStartingToolbarItems = exports.getSettingsButton = exports.getEndingToolbarItems = exports.floatingToolbar = void 0;
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -75,34 +75,7 @@ var removeCard = exports.removeCard = function removeCard(editorAnalyticsApi) {
|
|
|
75
75
|
action: _analytics.ACTION.DELETED
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
|
-
var
|
|
79
|
-
return function (state, dispatch) {
|
|
80
|
-
if (!(state.selection instanceof _state.NodeSelection)) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
var type = state.selection.node.type;
|
|
84
|
-
|
|
85
|
-
// EDM-12466:
|
|
86
|
-
// During smart_link_editor_update_toolbar_open_link clean up
|
|
87
|
-
// Consider updating the code to use visitCardLink or visitCardLinkAnalyticsOnly for all input methods:
|
|
88
|
-
// INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK || INPUT_METHOD.META_CLICK
|
|
89
|
-
if (!(0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link')) {
|
|
90
|
-
var _titleUrlPairFromNode = (0, _utils3.titleUrlPairFromNode)(state.selection.node),
|
|
91
|
-
url = _titleUrlPairFromNode.url;
|
|
92
|
-
|
|
93
|
-
// All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
|
|
94
|
-
// We are in edit mode here, open the smart card URL in a new window.
|
|
95
|
-
window.open(url);
|
|
96
|
-
}
|
|
97
|
-
if (dispatch) {
|
|
98
|
-
var tr = state.tr;
|
|
99
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.buildVisitedNonHyperLinkPayload)(type.name, inputMethod))(tr);
|
|
100
|
-
dispatch(tr);
|
|
101
|
-
}
|
|
102
|
-
return true;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
var visitCardLinkAnalyticsOnly = exports.visitCardLinkAnalyticsOnly = function visitCardLinkAnalyticsOnly(editorAnalyticsApi, inputMethod) {
|
|
78
|
+
var visitCardLinkAnalytics = exports.visitCardLinkAnalytics = function visitCardLinkAnalytics(editorAnalyticsApi, inputMethod) {
|
|
106
79
|
return function (state, dispatch) {
|
|
107
80
|
if (!(state.selection instanceof _state.NodeSelection)) {
|
|
108
81
|
return false;
|
|
@@ -226,8 +199,8 @@ var getToolbarViewedItem = function getToolbarViewedItem(url, display) {
|
|
|
226
199
|
var generateToolbarItems = function generateToolbarItems(state, intl, providerFactory, cardOptions, lpLinkPicker, linkPicker, pluginInjectionApi) {
|
|
227
200
|
return function (node) {
|
|
228
201
|
var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$a2, _node$attrs;
|
|
229
|
-
var
|
|
230
|
-
url =
|
|
202
|
+
var _titleUrlPairFromNode = (0, _utils3.titleUrlPairFromNode)(node),
|
|
203
|
+
url = _titleUrlPairFromNode.url;
|
|
231
204
|
var _ref = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
232
205
|
editorAnalyticsApi = _ref.actions;
|
|
233
206
|
var metadata = {};
|
|
@@ -349,7 +322,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
349
322
|
testId: 'link-toolbar-edit-link-button',
|
|
350
323
|
onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
|
|
351
324
|
}];
|
|
352
|
-
var toolbarItems = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [
|
|
325
|
+
var toolbarItems = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [{
|
|
353
326
|
id: 'editor.link.openLink',
|
|
354
327
|
type: 'button',
|
|
355
328
|
icon: _linkExternal.default,
|
|
@@ -357,11 +330,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
357
330
|
metadata: metadata,
|
|
358
331
|
className: 'hyperlink-open-link',
|
|
359
332
|
title: intl.formatMessage(_messages.linkMessages.openLink),
|
|
360
|
-
onClick:
|
|
361
|
-
}, (0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link') && {
|
|
333
|
+
onClick: visitCardLinkAnalytics(editorAnalyticsApi, openLinkInputMethod),
|
|
362
334
|
href: url,
|
|
363
335
|
target: '_blank'
|
|
364
|
-
}
|
|
336
|
+
}, {
|
|
365
337
|
type: 'separator'
|
|
366
338
|
}], (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
|
|
367
339
|
type: 'copy-button',
|
|
@@ -387,7 +359,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
387
359
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
388
360
|
title: intl.formatMessage(_messages.default.remove),
|
|
389
361
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
390
|
-
}]) : [].concat(editButtonItems, (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [
|
|
362
|
+
}]) : [].concat(editButtonItems, (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
|
|
391
363
|
id: 'editor.link.openLink',
|
|
392
364
|
type: 'button',
|
|
393
365
|
icon: _linkExternal.default,
|
|
@@ -395,11 +367,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
395
367
|
metadata: metadata,
|
|
396
368
|
className: 'hyperlink-open-link',
|
|
397
369
|
title: intl.formatMessage(_messages.linkMessages.openLink),
|
|
398
|
-
onClick:
|
|
399
|
-
}, (0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link') && {
|
|
370
|
+
onClick: visitCardLinkAnalytics(editorAnalyticsApi, openLinkInputMethod),
|
|
400
371
|
href: url,
|
|
401
372
|
target: '_blank'
|
|
402
|
-
}
|
|
373
|
+
}], (0, _toConsumableArray2.default)(commentItems.length > 1 ? [{
|
|
403
374
|
type: 'separator',
|
|
404
375
|
fullHeight: true
|
|
405
376
|
}, commentItems[0]] : commentItems));
|
|
@@ -623,7 +594,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
623
594
|
}
|
|
624
595
|
});
|
|
625
596
|
if (node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.url) {
|
|
626
|
-
toolbarItems.push(
|
|
597
|
+
toolbarItems.push({
|
|
627
598
|
id: 'editor.link.openLink',
|
|
628
599
|
type: 'button',
|
|
629
600
|
icon: _linkExternal.default,
|
|
@@ -631,11 +602,10 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
631
602
|
metadata: metadata,
|
|
632
603
|
className: 'hyperlink-open-link',
|
|
633
604
|
title: intl.formatMessage(_messages.linkMessages.openLink),
|
|
634
|
-
onClick:
|
|
635
|
-
}, (0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link') && {
|
|
605
|
+
onClick: visitCardLinkAnalytics(editorAnalyticsApi, openLinkInputMethod),
|
|
636
606
|
href: node.attrs.url,
|
|
637
607
|
target: '_blank'
|
|
638
|
-
})
|
|
608
|
+
});
|
|
639
609
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
|
|
640
610
|
toolbarItems.push({
|
|
641
611
|
type: 'separator'
|
|
@@ -15,7 +15,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
15
15
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
16
16
|
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
17
17
|
import OverlayWrapper from '../ui/ConfigureOverlay';
|
|
18
|
-
import {
|
|
18
|
+
import { visitCardLinkAnalytics } from '../ui/toolbar';
|
|
19
19
|
import { Card } from './genericCard';
|
|
20
20
|
import { InlineCardWithAwareness } from './inlineCardWithAwareness';
|
|
21
21
|
export const InlineCard = /*#__PURE__*/memo(({
|
|
@@ -99,7 +99,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
99
99
|
const {
|
|
100
100
|
actions: editorAnalyticsApi
|
|
101
101
|
} = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {};
|
|
102
|
-
|
|
102
|
+
visitCardLinkAnalytics(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
103
103
|
window.open(url, '_blank');
|
|
104
104
|
} else {
|
|
105
105
|
// only trigger the provided onClick callback if the meta key or ctrl key is not pressed
|
|
@@ -13,7 +13,7 @@ import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
|
13
13
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
14
14
|
import { Anchor, Box, Text, xcss } from '@atlaskit/primitives';
|
|
15
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
|
-
import {
|
|
16
|
+
import { visitCardLinkAnalytics } from '../toolbar';
|
|
17
17
|
const containerStyles = css({
|
|
18
18
|
position: 'relative'
|
|
19
19
|
});
|
|
@@ -136,7 +136,7 @@ const OpenButtonOverlay = ({
|
|
|
136
136
|
};
|
|
137
137
|
const sendVisitLinkAnalytics = inputMethod => {
|
|
138
138
|
if (editorAnalyticsApi && view) {
|
|
139
|
-
|
|
139
|
+
visitCardLinkAnalytics(editorAnalyticsApi, inputMethod)(view.state, view.dispatch);
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
const handleDoubleClick = () => {
|
|
@@ -62,37 +62,7 @@ export const removeCard = editorAnalyticsApi => commandWithMetadata((state, disp
|
|
|
62
62
|
}, {
|
|
63
63
|
action: ACTION.DELETED
|
|
64
64
|
});
|
|
65
|
-
export const
|
|
66
|
-
if (!(state.selection instanceof NodeSelection)) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
const {
|
|
70
|
-
type
|
|
71
|
-
} = state.selection.node;
|
|
72
|
-
|
|
73
|
-
// EDM-12466:
|
|
74
|
-
// During smart_link_editor_update_toolbar_open_link clean up
|
|
75
|
-
// Consider updating the code to use visitCardLink or visitCardLinkAnalyticsOnly for all input methods:
|
|
76
|
-
// INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK || INPUT_METHOD.META_CLICK
|
|
77
|
-
if (!fg('smart_link_editor_update_toolbar_open_link')) {
|
|
78
|
-
const {
|
|
79
|
-
url
|
|
80
|
-
} = titleUrlPairFromNode(state.selection.node);
|
|
81
|
-
|
|
82
|
-
// All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
|
|
83
|
-
// We are in edit mode here, open the smart card URL in a new window.
|
|
84
|
-
window.open(url);
|
|
85
|
-
}
|
|
86
|
-
if (dispatch) {
|
|
87
|
-
const {
|
|
88
|
-
tr
|
|
89
|
-
} = state;
|
|
90
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(buildVisitedNonHyperLinkPayload(type.name, inputMethod))(tr);
|
|
91
|
-
dispatch(tr);
|
|
92
|
-
}
|
|
93
|
-
return true;
|
|
94
|
-
};
|
|
95
|
-
export const visitCardLinkAnalyticsOnly = (editorAnalyticsApi, inputMethod) => (state, dispatch) => {
|
|
65
|
+
export const visitCardLinkAnalytics = (editorAnalyticsApi, inputMethod) => (state, dispatch) => {
|
|
96
66
|
if (!(state.selection instanceof NodeSelection)) {
|
|
97
67
|
return false;
|
|
98
68
|
}
|
|
@@ -350,11 +320,9 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
350
320
|
metadata: metadata,
|
|
351
321
|
className: 'hyperlink-open-link',
|
|
352
322
|
title: intl.formatMessage(linkMessages.openLink),
|
|
353
|
-
onClick:
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
target: '_blank'
|
|
357
|
-
})
|
|
323
|
+
onClick: visitCardLinkAnalytics(editorAnalyticsApi, openLinkInputMethod),
|
|
324
|
+
href: url,
|
|
325
|
+
target: '_blank'
|
|
358
326
|
}, {
|
|
359
327
|
type: 'separator'
|
|
360
328
|
}, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), {
|
|
@@ -389,11 +357,9 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
389
357
|
metadata: metadata,
|
|
390
358
|
className: 'hyperlink-open-link',
|
|
391
359
|
title: intl.formatMessage(linkMessages.openLink),
|
|
392
|
-
onClick:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
target: '_blank'
|
|
396
|
-
})
|
|
360
|
+
onClick: visitCardLinkAnalytics(editorAnalyticsApi, openLinkInputMethod),
|
|
361
|
+
href: url,
|
|
362
|
+
target: '_blank'
|
|
397
363
|
}, ...(commentItems.length > 1 ? [{
|
|
398
364
|
type: 'separator',
|
|
399
365
|
fullHeight: true
|
|
@@ -623,11 +589,9 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
623
589
|
metadata: metadata,
|
|
624
590
|
className: 'hyperlink-open-link',
|
|
625
591
|
title: intl.formatMessage(linkMessages.openLink),
|
|
626
|
-
onClick:
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
target: '_blank'
|
|
630
|
-
})
|
|
592
|
+
onClick: visitCardLinkAnalytics(editorAnalyticsApi, openLinkInputMethod),
|
|
593
|
+
href: node.attrs.url,
|
|
594
|
+
target: '_blank'
|
|
631
595
|
});
|
|
632
596
|
if (editorExperiment('platform_editor_controls', 'control')) {
|
|
633
597
|
toolbarItems.push({
|
|
@@ -16,7 +16,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
16
16
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
17
17
|
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
18
18
|
import OverlayWrapper from '../ui/ConfigureOverlay';
|
|
19
|
-
import {
|
|
19
|
+
import { visitCardLinkAnalytics } from '../ui/toolbar';
|
|
20
20
|
import { Card } from './genericCard';
|
|
21
21
|
import { InlineCardWithAwareness } from './inlineCardWithAwareness';
|
|
22
22
|
export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -93,7 +93,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
93
93
|
var _pluginInjectionApi$a;
|
|
94
94
|
var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
95
95
|
editorAnalyticsApi = _ref2.actions;
|
|
96
|
-
|
|
96
|
+
visitCardLinkAnalytics(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
97
97
|
window.open(url, '_blank');
|
|
98
98
|
} else {
|
|
99
99
|
// only trigger the provided onClick callback if the meta key or ctrl key is not pressed
|
|
@@ -14,7 +14,7 @@ import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
|
14
14
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
15
15
|
import { Anchor, Box, Text, xcss } from '@atlaskit/primitives';
|
|
16
16
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
17
|
-
import {
|
|
17
|
+
import { visitCardLinkAnalytics } from '../toolbar';
|
|
18
18
|
var containerStyles = css({
|
|
19
19
|
position: 'relative'
|
|
20
20
|
});
|
|
@@ -142,7 +142,7 @@ var OpenButtonOverlay = function OpenButtonOverlay(_ref) {
|
|
|
142
142
|
};
|
|
143
143
|
var sendVisitLinkAnalytics = function sendVisitLinkAnalytics(inputMethod) {
|
|
144
144
|
if (editorAnalyticsApi && view) {
|
|
145
|
-
|
|
145
|
+
visitCardLinkAnalytics(editorAnalyticsApi, inputMethod)(view.state, view.dispatch);
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
var handleDoubleClick = function handleDoubleClick() {
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -66,34 +66,7 @@ export var removeCard = function removeCard(editorAnalyticsApi) {
|
|
|
66
66
|
action: ACTION.DELETED
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
-
export var
|
|
70
|
-
return function (state, dispatch) {
|
|
71
|
-
if (!(state.selection instanceof NodeSelection)) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
var type = state.selection.node.type;
|
|
75
|
-
|
|
76
|
-
// EDM-12466:
|
|
77
|
-
// During smart_link_editor_update_toolbar_open_link clean up
|
|
78
|
-
// Consider updating the code to use visitCardLink or visitCardLinkAnalyticsOnly for all input methods:
|
|
79
|
-
// INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK || INPUT_METHOD.META_CLICK
|
|
80
|
-
if (!fg('smart_link_editor_update_toolbar_open_link')) {
|
|
81
|
-
var _titleUrlPairFromNode = titleUrlPairFromNode(state.selection.node),
|
|
82
|
-
url = _titleUrlPairFromNode.url;
|
|
83
|
-
|
|
84
|
-
// All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
|
|
85
|
-
// We are in edit mode here, open the smart card URL in a new window.
|
|
86
|
-
window.open(url);
|
|
87
|
-
}
|
|
88
|
-
if (dispatch) {
|
|
89
|
-
var tr = state.tr;
|
|
90
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(buildVisitedNonHyperLinkPayload(type.name, inputMethod))(tr);
|
|
91
|
-
dispatch(tr);
|
|
92
|
-
}
|
|
93
|
-
return true;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
export var visitCardLinkAnalyticsOnly = function visitCardLinkAnalyticsOnly(editorAnalyticsApi, inputMethod) {
|
|
69
|
+
export var visitCardLinkAnalytics = function visitCardLinkAnalytics(editorAnalyticsApi, inputMethod) {
|
|
97
70
|
return function (state, dispatch) {
|
|
98
71
|
if (!(state.selection instanceof NodeSelection)) {
|
|
99
72
|
return false;
|
|
@@ -217,8 +190,8 @@ var getToolbarViewedItem = function getToolbarViewedItem(url, display) {
|
|
|
217
190
|
var generateToolbarItems = function generateToolbarItems(state, intl, providerFactory, cardOptions, lpLinkPicker, linkPicker, pluginInjectionApi) {
|
|
218
191
|
return function (node) {
|
|
219
192
|
var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$a2, _node$attrs;
|
|
220
|
-
var
|
|
221
|
-
url =
|
|
193
|
+
var _titleUrlPairFromNode = titleUrlPairFromNode(node),
|
|
194
|
+
url = _titleUrlPairFromNode.url;
|
|
222
195
|
var _ref = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
223
196
|
editorAnalyticsApi = _ref.actions;
|
|
224
197
|
var metadata = {};
|
|
@@ -340,7 +313,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
340
313
|
testId: 'link-toolbar-edit-link-button',
|
|
341
314
|
onClick: getEditLinkCallback(editorAnalyticsApi, true)
|
|
342
315
|
}];
|
|
343
|
-
var toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [
|
|
316
|
+
var toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [{
|
|
344
317
|
id: 'editor.link.openLink',
|
|
345
318
|
type: 'button',
|
|
346
319
|
icon: LinkExternalIcon,
|
|
@@ -348,11 +321,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
348
321
|
metadata: metadata,
|
|
349
322
|
className: 'hyperlink-open-link',
|
|
350
323
|
title: intl.formatMessage(linkMessages.openLink),
|
|
351
|
-
onClick:
|
|
352
|
-
}, fg('smart_link_editor_update_toolbar_open_link') && {
|
|
324
|
+
onClick: visitCardLinkAnalytics(editorAnalyticsApi, openLinkInputMethod),
|
|
353
325
|
href: url,
|
|
354
326
|
target: '_blank'
|
|
355
|
-
}
|
|
327
|
+
}, {
|
|
356
328
|
type: 'separator'
|
|
357
329
|
}], _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
|
|
358
330
|
type: 'copy-button',
|
|
@@ -378,7 +350,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
378
350
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
379
351
|
title: intl.formatMessage(commonMessages.remove),
|
|
380
352
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
381
|
-
}]) : [].concat(editButtonItems, _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [
|
|
353
|
+
}]) : [].concat(editButtonItems, _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
|
|
382
354
|
id: 'editor.link.openLink',
|
|
383
355
|
type: 'button',
|
|
384
356
|
icon: LinkExternalIcon,
|
|
@@ -386,11 +358,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
386
358
|
metadata: metadata,
|
|
387
359
|
className: 'hyperlink-open-link',
|
|
388
360
|
title: intl.formatMessage(linkMessages.openLink),
|
|
389
|
-
onClick:
|
|
390
|
-
}, fg('smart_link_editor_update_toolbar_open_link') && {
|
|
361
|
+
onClick: visitCardLinkAnalytics(editorAnalyticsApi, openLinkInputMethod),
|
|
391
362
|
href: url,
|
|
392
363
|
target: '_blank'
|
|
393
|
-
}
|
|
364
|
+
}], _toConsumableArray(commentItems.length > 1 ? [{
|
|
394
365
|
type: 'separator',
|
|
395
366
|
fullHeight: true
|
|
396
367
|
}, commentItems[0]] : commentItems));
|
|
@@ -614,7 +585,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
614
585
|
}
|
|
615
586
|
});
|
|
616
587
|
if (node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.url) {
|
|
617
|
-
toolbarItems.push(
|
|
588
|
+
toolbarItems.push({
|
|
618
589
|
id: 'editor.link.openLink',
|
|
619
590
|
type: 'button',
|
|
620
591
|
icon: LinkExternalIcon,
|
|
@@ -622,11 +593,10 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
622
593
|
metadata: metadata,
|
|
623
594
|
className: 'hyperlink-open-link',
|
|
624
595
|
title: intl.formatMessage(linkMessages.openLink),
|
|
625
|
-
onClick:
|
|
626
|
-
}, fg('smart_link_editor_update_toolbar_open_link') && {
|
|
596
|
+
onClick: visitCardLinkAnalytics(editorAnalyticsApi, openLinkInputMethod),
|
|
627
597
|
href: node.attrs.url,
|
|
628
598
|
target: '_blank'
|
|
629
|
-
})
|
|
599
|
+
});
|
|
630
600
|
if (editorExperiment('platform_editor_controls', 'control')) {
|
|
631
601
|
toolbarItems.push({
|
|
632
602
|
type: 'separator'
|
|
@@ -7,8 +7,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
7
7
|
import type { cardPlugin } from '../index';
|
|
8
8
|
import type { CardPluginOptions } from '../types';
|
|
9
9
|
export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.META_CLICK) => Command;
|
|
10
|
+
export declare const visitCardLinkAnalytics: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.META_CLICK) => Command;
|
|
12
11
|
export declare const openLinkSettings: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
13
12
|
export declare const floatingToolbar: (cardOptions: CardOptions, lpLinkPicker: boolean, linkPickerOptions?: LinkPickerOptions, pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>, disableFloatingToolbar?: boolean) => FloatingToolbarHandler;
|
|
14
13
|
export declare const getSettingsButton: (intl: IntlShape, editorAnalyticsApi: EditorAnalyticsAPI | undefined, userPreferencesLink?: string) => FloatingToolbarItem<Command>;
|
|
@@ -7,8 +7,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
7
7
|
import type { cardPlugin } from '../index';
|
|
8
8
|
import type { CardPluginOptions } from '../types';
|
|
9
9
|
export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.META_CLICK) => Command;
|
|
10
|
+
export declare const visitCardLinkAnalytics: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.META_CLICK) => Command;
|
|
12
11
|
export declare const openLinkSettings: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
13
12
|
export declare const floatingToolbar: (cardOptions: CardOptions, lpLinkPicker: boolean, linkPickerOptions?: LinkPickerOptions, pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>, disableFloatingToolbar?: boolean) => FloatingToolbarHandler;
|
|
14
13
|
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.6.
|
|
3
|
+
"version": "6.6.12",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
38
38
|
"@atlaskit/button": "^23.2.0",
|
|
39
39
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
40
|
-
"@atlaskit/editor-common": "^107.
|
|
40
|
+
"@atlaskit/editor-common": "^107.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
42
42
|
"@atlaskit/editor-plugin-base": "^3.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
52
52
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
53
53
|
"@atlaskit/frontend-utilities": "^3.0.0",
|
|
54
|
-
"@atlaskit/icon": "^27.
|
|
54
|
+
"@atlaskit/icon": "^27.1.0",
|
|
55
55
|
"@atlaskit/link": "^3.2.0",
|
|
56
56
|
"@atlaskit/link-analytics": "^10.0.0",
|
|
57
57
|
"@atlaskit/link-client-extension": "^5.0.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@atlaskit/smart-card": "^38.13.0",
|
|
65
65
|
"@atlaskit/theme": "^18.0.0",
|
|
66
66
|
"@atlaskit/tmp-editor-statsig": "^8.0.0",
|
|
67
|
-
"@atlaskit/tokens": "^5.
|
|
67
|
+
"@atlaskit/tokens": "^5.4.0",
|
|
68
68
|
"@babel/runtime": "^7.0.0",
|
|
69
69
|
"@emotion/react": "^11.7.1",
|
|
70
70
|
"lodash": "^4.17.21",
|
|
@@ -132,9 +132,6 @@
|
|
|
132
132
|
"platform_editor_controls_patch_12": {
|
|
133
133
|
"type": "boolean"
|
|
134
134
|
},
|
|
135
|
-
"smart_link_editor_update_toolbar_open_link": {
|
|
136
|
-
"type": "boolean"
|
|
137
|
-
},
|
|
138
135
|
"platform_editor_fix_advanced_code_crash": {
|
|
139
136
|
"type": "boolean"
|
|
140
137
|
},
|