@atlaskit/editor-plugin-card 5.4.23 → 5.4.24

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 5.4.24
4
+
5
+ ### Patch Changes
6
+
7
+ - [#148769](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148769)
8
+ [`4d875576ce223`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d875576ce223) -
9
+ [ux] Update link button to be an anchor
10
+ - Updated dependencies
11
+
3
12
  ## 5.4.23
4
13
 
5
14
  ### Patch Changes
@@ -81,12 +81,14 @@ var visitCardLink = exports.visitCardLink = function visitCardLink(editorAnalyti
81
81
  return false;
82
82
  }
83
83
  var type = state.selection.node.type;
84
- var _titleUrlPairFromNode = (0, _utils3.titleUrlPairFromNode)(state.selection.node),
85
- url = _titleUrlPairFromNode.url;
84
+ if (!(0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link')) {
85
+ var _titleUrlPairFromNode = (0, _utils3.titleUrlPairFromNode)(state.selection.node),
86
+ url = _titleUrlPairFromNode.url;
86
87
 
87
- // All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
88
- // We are in edit mode here, open the smart card URL in a new window.
89
- window.open(url);
88
+ // All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
89
+ // We are in edit mode here, open the smart card URL in a new window.
90
+ window.open(url);
91
+ }
90
92
  if (dispatch) {
91
93
  var tr = state.tr;
92
94
  editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.buildVisitedLinkPayload)(type.name))(tr);
@@ -303,7 +305,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
303
305
  }, {
304
306
  type: 'separator'
305
307
  }] : [];
306
- var toolbarItems = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [{
308
+ var toolbarItems = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [_objectSpread({
307
309
  id: 'editor.link.openLink',
308
310
  type: 'button',
309
311
  icon: _linkExternal.default,
@@ -312,7 +314,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
312
314
  className: 'hyperlink-open-link',
313
315
  title: intl.formatMessage(_messages.linkMessages.openLink),
314
316
  onClick: visitCardLink(editorAnalyticsApi)
315
- }, {
317
+ }, (0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link') && {
318
+ href: url,
319
+ target: '_blank'
320
+ }), {
316
321
  type: 'separator'
317
322
  }], (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
318
323
  type: 'copy-button',
@@ -349,7 +354,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
349
354
  onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
350
355
  }].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_6') ? [] : [{
351
356
  type: 'separator'
352
- }]), (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
357
+ }]), (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [_objectSpread({
353
358
  id: 'editor.link.openLink',
354
359
  type: 'button',
355
360
  icon: _linkExternal.default,
@@ -358,7 +363,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
358
363
  className: 'hyperlink-open-link',
359
364
  title: intl.formatMessage(_messages.linkMessages.openLink),
360
365
  onClick: visitCardLink(editorAnalyticsApi)
361
- }], (0, _toConsumableArray2.default)(commentItems.length > 1 ? [{
366
+ }, (0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link') && {
367
+ href: url,
368
+ target: '_blank'
369
+ })], (0, _toConsumableArray2.default)(commentItems.length > 1 ? [{
362
370
  type: 'separator',
363
371
  fullHeight: true
364
372
  }, commentItems[0]] : commentItems));
@@ -577,7 +585,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
577
585
  }
578
586
  });
579
587
  if (node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.url) {
580
- toolbarItems.push({
588
+ toolbarItems.push(_objectSpread({
581
589
  id: 'editor.link.openLink',
582
590
  type: 'button',
583
591
  icon: _linkExternal.default,
@@ -586,7 +594,10 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
586
594
  className: 'hyperlink-open-link',
587
595
  title: intl.formatMessage(_messages.linkMessages.openLink),
588
596
  onClick: visitCardLink(editorAnalyticsApi)
589
- });
597
+ }, (0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link') && {
598
+ href: node.attrs.url,
599
+ target: '_blank'
600
+ }));
590
601
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
591
602
  toolbarItems.push({
592
603
  type: 'separator'
@@ -68,13 +68,15 @@ export const visitCardLink = editorAnalyticsApi => (state, dispatch) => {
68
68
  const {
69
69
  type
70
70
  } = state.selection.node;
71
- const {
72
- url
73
- } = titleUrlPairFromNode(state.selection.node);
71
+ if (!fg('smart_link_editor_update_toolbar_open_link')) {
72
+ const {
73
+ url
74
+ } = titleUrlPairFromNode(state.selection.node);
74
75
 
75
- // All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
76
- // We are in edit mode here, open the smart card URL in a new window.
77
- window.open(url);
76
+ // All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
77
+ // We are in edit mode here, open the smart card URL in a new window.
78
+ window.open(url);
79
+ }
78
80
  if (dispatch) {
79
81
  const {
80
82
  tr
@@ -303,7 +305,11 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
303
305
  metadata: metadata,
304
306
  className: 'hyperlink-open-link',
305
307
  title: intl.formatMessage(linkMessages.openLink),
306
- onClick: visitCardLink(editorAnalyticsApi)
308
+ onClick: visitCardLink(editorAnalyticsApi),
309
+ ...(fg('smart_link_editor_update_toolbar_open_link') && {
310
+ href: url,
311
+ target: '_blank'
312
+ })
307
313
  }, {
308
314
  type: 'separator'
309
315
  }, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), {
@@ -349,7 +355,11 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
349
355
  metadata: metadata,
350
356
  className: 'hyperlink-open-link',
351
357
  title: intl.formatMessage(linkMessages.openLink),
352
- onClick: visitCardLink(editorAnalyticsApi)
358
+ onClick: visitCardLink(editorAnalyticsApi),
359
+ ...(fg('smart_link_editor_update_toolbar_open_link') && {
360
+ href: url,
361
+ target: '_blank'
362
+ })
353
363
  }, ...(commentItems.length > 1 ? [{
354
364
  type: 'separator',
355
365
  fullHeight: true
@@ -574,7 +584,11 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
574
584
  metadata: metadata,
575
585
  className: 'hyperlink-open-link',
576
586
  title: intl.formatMessage(linkMessages.openLink),
577
- onClick: visitCardLink(editorAnalyticsApi)
587
+ onClick: visitCardLink(editorAnalyticsApi),
588
+ ...(fg('smart_link_editor_update_toolbar_open_link') && {
589
+ href: node.attrs.url,
590
+ target: '_blank'
591
+ })
578
592
  });
579
593
  if (editorExperiment('platform_editor_controls', 'control')) {
580
594
  toolbarItems.push({
@@ -71,12 +71,14 @@ export var visitCardLink = function visitCardLink(editorAnalyticsApi) {
71
71
  return false;
72
72
  }
73
73
  var type = state.selection.node.type;
74
- var _titleUrlPairFromNode = titleUrlPairFromNode(state.selection.node),
75
- url = _titleUrlPairFromNode.url;
74
+ if (!fg('smart_link_editor_update_toolbar_open_link')) {
75
+ var _titleUrlPairFromNode = titleUrlPairFromNode(state.selection.node),
76
+ url = _titleUrlPairFromNode.url;
76
77
 
77
- // All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
78
- // We are in edit mode here, open the smart card URL in a new window.
79
- window.open(url);
78
+ // All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
79
+ // We are in edit mode here, open the smart card URL in a new window.
80
+ window.open(url);
81
+ }
80
82
  if (dispatch) {
81
83
  var tr = state.tr;
82
84
  editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(buildVisitedLinkPayload(type.name))(tr);
@@ -293,7 +295,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
293
295
  }, {
294
296
  type: 'separator'
295
297
  }] : [];
296
- var toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [{
298
+ var toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [_objectSpread({
297
299
  id: 'editor.link.openLink',
298
300
  type: 'button',
299
301
  icon: LinkExternalIcon,
@@ -302,7 +304,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
302
304
  className: 'hyperlink-open-link',
303
305
  title: intl.formatMessage(linkMessages.openLink),
304
306
  onClick: visitCardLink(editorAnalyticsApi)
305
- }, {
307
+ }, fg('smart_link_editor_update_toolbar_open_link') && {
308
+ href: url,
309
+ target: '_blank'
310
+ }), {
306
311
  type: 'separator'
307
312
  }], _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
308
313
  type: 'copy-button',
@@ -339,7 +344,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
339
344
  onClick: getEditLinkCallback(editorAnalyticsApi, true)
340
345
  }].concat(_toConsumableArray(fg('platform_editor_controls_patch_6') ? [] : [{
341
346
  type: 'separator'
342
- }]), _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
347
+ }]), _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [_objectSpread({
343
348
  id: 'editor.link.openLink',
344
349
  type: 'button',
345
350
  icon: LinkExternalIcon,
@@ -348,7 +353,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
348
353
  className: 'hyperlink-open-link',
349
354
  title: intl.formatMessage(linkMessages.openLink),
350
355
  onClick: visitCardLink(editorAnalyticsApi)
351
- }], _toConsumableArray(commentItems.length > 1 ? [{
356
+ }, fg('smart_link_editor_update_toolbar_open_link') && {
357
+ href: url,
358
+ target: '_blank'
359
+ })], _toConsumableArray(commentItems.length > 1 ? [{
352
360
  type: 'separator',
353
361
  fullHeight: true
354
362
  }, commentItems[0]] : commentItems));
@@ -567,7 +575,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
567
575
  }
568
576
  });
569
577
  if (node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.url) {
570
- toolbarItems.push({
578
+ toolbarItems.push(_objectSpread({
571
579
  id: 'editor.link.openLink',
572
580
  type: 'button',
573
581
  icon: LinkExternalIcon,
@@ -576,7 +584,10 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
576
584
  className: 'hyperlink-open-link',
577
585
  title: intl.formatMessage(linkMessages.openLink),
578
586
  onClick: visitCardLink(editorAnalyticsApi)
579
- });
587
+ }, fg('smart_link_editor_update_toolbar_open_link') && {
588
+ href: node.attrs.url,
589
+ target: '_blank'
590
+ }));
580
591
  if (editorExperiment('platform_editor_controls', 'control')) {
581
592
  toolbarItems.push({
582
593
  type: 'separator'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "5.4.23",
3
+ "version": "5.4.24",
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.0.0",
38
38
  "@atlaskit/button": "^23.0.0",
39
39
  "@atlaskit/custom-steps": "^0.11.0",
40
- "@atlaskit/editor-common": "^103.21.0",
40
+ "@atlaskit/editor-common": "^103.22.0",
41
41
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
42
42
  "@atlaskit/editor-plugin-base": "^2.3.0",
43
43
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
@@ -54,13 +54,13 @@
54
54
  "@atlaskit/icon": "^25.6.0",
55
55
  "@atlaskit/link-analytics": "^9.1.0",
56
56
  "@atlaskit/link-client-extension": "^4.0.0",
57
- "@atlaskit/link-datasource": "^4.8.0",
57
+ "@atlaskit/link-datasource": "^4.9.0",
58
58
  "@atlaskit/linking-common": "^8.0.0",
59
59
  "@atlaskit/linking-types": "^9.10.0",
60
60
  "@atlaskit/menu": "^5.0.0",
61
61
  "@atlaskit/platform-feature-flags": "^1.1.0",
62
- "@atlaskit/primitives": "^14.4.0",
63
- "@atlaskit/smart-card": "^36.12.0",
62
+ "@atlaskit/primitives": "^14.6.0",
63
+ "@atlaskit/smart-card": "^36.13.0",
64
64
  "@atlaskit/theme": "^18.0.0",
65
65
  "@atlaskit/tmp-editor-statsig": "^4.15.0",
66
66
  "@atlaskit/tokens": "^4.8.0",
@@ -142,6 +142,9 @@
142
142
  },
143
143
  "platform_editor_controls_patch_6": {
144
144
  "type": "boolean"
145
+ },
146
+ "smart_link_editor_update_toolbar_open_link": {
147
+ "type": "boolean"
145
148
  }
146
149
  },
147
150
  "stricter": {