@atlaskit/editor-plugin-card 2.4.2 → 2.5.0

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,29 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 2.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#119135](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/119135)
8
+ [`a4a41c5e54071`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a4a41c5e54071) -
9
+ Allow smart links to navigate in live pages edit view
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 2.4.4
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
21
+ ## 2.4.3
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+
3
27
  ## 2.4.2
4
28
 
5
29
  ### Patch Changes
@@ -45,6 +45,19 @@ var WithClickHandler = function WithClickHandler(_ref) {
45
45
  } catch (_unused) {}
46
46
  }
47
47
  }, [url, onClickCallback]);
48
+ if ((0, _platformFeatureFlags.fg)('platform.linking-platform.smart-links-in-live-pages')) {
49
+ /**
50
+ * @todo: Add a check to determine if we're currently in a live page once ED-23920 and plugin
51
+ * is complete. The logic for which should allow navigation if we're in a live page and no callback
52
+ * has been provided. E.g.
53
+ *
54
+ * const allowNavigation = isLivePage && !onClickCallback;
55
+ */
56
+ var _allowNavigation = !onClickCallback;
57
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children({
58
+ onClick: _allowNavigation ? undefined : onClick
59
+ }));
60
+ }
48
61
 
49
62
  // Setting `onClick` to `undefined` ensures clicks on smartcards navigate to the URL.
50
63
  // If in view mode and not overriding with onClickCallback option, then allow smartlinks to navigate on click.
@@ -68,7 +81,6 @@ function Card(SmartCardComponent, UnsupportedComponent) {
68
81
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
69
82
  isError: false
70
83
  });
71
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClick", function () {});
72
84
  return _this;
73
85
  }
74
86
  (0, _createClass2.default)(_class, [{
@@ -107,7 +119,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
107
119
  // Below is added for the future implementation of Linking Platform namespaced analytics context
108
120
  location: analyticsEditorAppearance
109
121
  }
110
- }, (0, _platformFeatureFlags.fg)('platform.linking-platform.smart-card.on-click-callback') ? /*#__PURE__*/_react.default.createElement(WithClickHandler, {
122
+ }, /*#__PURE__*/_react.default.createElement(WithClickHandler, {
111
123
  pluginInjectionApi: pluginInjectionApi,
112
124
  onClickCallback: onClickCallback,
113
125
  url: url
@@ -119,12 +131,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
119
131
  }, _this2.props, {
120
132
  onClick: onClick
121
133
  }));
122
- }) : /*#__PURE__*/_react.default.createElement(SmartCardComponent, (0, _extends2.default)({
123
- key: url,
124
- cardContext: cardContext
125
- }, this.props, {
126
- onClick: this.onClick
127
- })));
134
+ }));
128
135
  }
129
136
  }, {
130
137
  key: "componentDidCatch",
@@ -29,6 +29,19 @@ const WithClickHandler = ({
29
29
  } catch {}
30
30
  }
31
31
  }, [url, onClickCallback]);
32
+ if (fg('platform.linking-platform.smart-links-in-live-pages')) {
33
+ /**
34
+ * @todo: Add a check to determine if we're currently in a live page once ED-23920 and plugin
35
+ * is complete. The logic for which should allow navigation if we're in a live page and no callback
36
+ * has been provided. E.g.
37
+ *
38
+ * const allowNavigation = isLivePage && !onClickCallback;
39
+ */
40
+ const allowNavigation = !onClickCallback;
41
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children({
42
+ onClick: allowNavigation ? undefined : onClick
43
+ }));
44
+ }
32
45
 
33
46
  // Setting `onClick` to `undefined` ensures clicks on smartcards navigate to the URL.
34
47
  // If in view mode and not overriding with onClickCallback option, then allow smartlinks to navigate on click.
@@ -45,7 +58,6 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
45
58
  _defineProperty(this, "state", {
46
59
  isError: false
47
60
  });
48
- _defineProperty(this, "onClick", () => {});
49
61
  }
50
62
  render() {
51
63
  var _getPluginState;
@@ -82,7 +94,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
82
94
  // Below is added for the future implementation of Linking Platform namespaced analytics context
83
95
  location: analyticsEditorAppearance
84
96
  }
85
- }, fg('platform.linking-platform.smart-card.on-click-callback') ? /*#__PURE__*/React.createElement(WithClickHandler, {
97
+ }, /*#__PURE__*/React.createElement(WithClickHandler, {
86
98
  pluginInjectionApi: pluginInjectionApi,
87
99
  onClickCallback: onClickCallback,
88
100
  url: url
@@ -93,12 +105,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
93
105
  cardContext: cardContext
94
106
  }, this.props, {
95
107
  onClick: onClick
96
- }))) : /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
97
- key: url,
98
- cardContext: cardContext
99
- }, this.props, {
100
- onClick: this.onClick
101
- })));
108
+ }))));
102
109
  }
103
110
  componentDidCatch(error) {
104
111
  const maybeAPIError = error;
@@ -35,6 +35,19 @@ var WithClickHandler = function WithClickHandler(_ref) {
35
35
  } catch (_unused) {}
36
36
  }
37
37
  }, [url, onClickCallback]);
38
+ if (fg('platform.linking-platform.smart-links-in-live-pages')) {
39
+ /**
40
+ * @todo: Add a check to determine if we're currently in a live page once ED-23920 and plugin
41
+ * is complete. The logic for which should allow navigation if we're in a live page and no callback
42
+ * has been provided. E.g.
43
+ *
44
+ * const allowNavigation = isLivePage && !onClickCallback;
45
+ */
46
+ var _allowNavigation = !onClickCallback;
47
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children({
48
+ onClick: _allowNavigation ? undefined : onClick
49
+ }));
50
+ }
38
51
 
39
52
  // Setting `onClick` to `undefined` ensures clicks on smartcards navigate to the URL.
40
53
  // If in view mode and not overriding with onClickCallback option, then allow smartlinks to navigate on click.
@@ -58,7 +71,6 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
58
71
  _defineProperty(_assertThisInitialized(_this), "state", {
59
72
  isError: false
60
73
  });
61
- _defineProperty(_assertThisInitialized(_this), "onClick", function () {});
62
74
  return _this;
63
75
  }
64
76
  _createClass(_class, [{
@@ -97,7 +109,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
97
109
  // Below is added for the future implementation of Linking Platform namespaced analytics context
98
110
  location: analyticsEditorAppearance
99
111
  }
100
- }, fg('platform.linking-platform.smart-card.on-click-callback') ? /*#__PURE__*/React.createElement(WithClickHandler, {
112
+ }, /*#__PURE__*/React.createElement(WithClickHandler, {
101
113
  pluginInjectionApi: pluginInjectionApi,
102
114
  onClickCallback: onClickCallback,
103
115
  url: url
@@ -109,12 +121,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
109
121
  }, _this2.props, {
110
122
  onClick: onClick
111
123
  }));
112
- }) : /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
113
- key: url,
114
- cardContext: cardContext
115
- }, this.props, {
116
- onClick: this.onClick
117
- })));
124
+ }));
118
125
  }
119
126
  }, {
120
127
  key: "componentDidCatch",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,10 +34,10 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^39.0.3",
36
36
  "@atlaskit/analytics-next": "^9.3.0",
37
- "@atlaskit/button": "^18.2.0",
37
+ "@atlaskit/button": "^18.3.0",
38
38
  "@atlaskit/custom-steps": "^0.4.0",
39
39
  "@atlaskit/dropdown-menu": "^12.14.0",
40
- "@atlaskit/editor-common": "^84.3.0",
40
+ "@atlaskit/editor-common": "^84.4.0",
41
41
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
42
42
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
43
43
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
@@ -47,7 +47,7 @@
47
47
  "@atlaskit/editor-plugin-grid": "^1.1.0",
48
48
  "@atlaskit/editor-plugin-width": "^1.1.0",
49
49
  "@atlaskit/editor-prosemirror": "4.0.1",
50
- "@atlaskit/editor-shared-styles": "^2.12.0",
50
+ "@atlaskit/editor-shared-styles": "^2.13.0",
51
51
  "@atlaskit/frontend-utilities": "^2.7.0",
52
52
  "@atlaskit/icon": "^22.6.0",
53
53
  "@atlaskit/link-analytics": "^8.3.0",
@@ -55,9 +55,9 @@
55
55
  "@atlaskit/link-datasource": "^2.5.0",
56
56
  "@atlaskit/linking-common": "^5.7.0",
57
57
  "@atlaskit/linking-types": "^8.9.0",
58
- "@atlaskit/menu": "2.7.1",
58
+ "@atlaskit/menu": "2.7.4",
59
59
  "@atlaskit/platform-feature-flags": "^0.3.0",
60
- "@atlaskit/primitives": "^10.1.0",
60
+ "@atlaskit/primitives": "^11.0.0",
61
61
  "@atlaskit/smart-card": "^27.9.0",
62
62
  "@atlaskit/theme": "^12.11.0",
63
63
  "@atlaskit/tokens": "^1.53.0",
@@ -131,9 +131,6 @@
131
131
  "platform.editor.card.inject-settings-button": {
132
132
  "type": "boolean"
133
133
  },
134
- "platform.linking-platform.smart-card.on-click-callback": {
135
- "type": "boolean"
136
- },
137
134
  "platform.linking-platform.editor-datasource-typeguards": {
138
135
  "type": "boolean"
139
136
  },