@atlaskit/renderer 124.16.8 → 124.17.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,21 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 124.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`9679f0410e434`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9679f0410e434) -
8
+ [ux] Add support for onSetLinkTarget prop for Renderer, allowing consumers of Renderer like Rovo
9
+ chat to instruct which links should render as external links.
10
+
11
+ ## 124.16.9
12
+
13
+ ### Patch Changes
14
+
15
+ - [`55920a92e882a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55920a92e882a) -
16
+ tsignores added for help-center local consumpton removed
17
+ - Updated dependencies
18
+
3
19
  ## 124.16.8
4
20
 
5
21
  ### Patch Changes
@@ -161,11 +161,16 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
161
161
  // the rendering in the mobile Native Renderer.
162
162
  codeBidiWarningTooltipEnabled: false
163
163
  } : {};
164
- var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
164
+
165
+ // Add deepLinkTarget for link marks
166
+ var linkSpecificProps = mark.type.name === 'link' ? {
167
+ onSetLinkTarget: _this.onSetLinkTarget
168
+ } : {};
169
+ var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
165
170
  eventHandlers: _this.eventHandlers,
166
171
  fireAnalyticsEvent: _this.fireAnalyticsEvent,
167
172
  markKey: key
168
- }, otherAttrs), extraProps), markSpecificProps), {}, {
173
+ }, otherAttrs), extraProps), markSpecificProps), linkSpecificProps), {}, {
169
174
  dataAttributes: {
170
175
  'data-renderer-mark': true
171
176
  }
@@ -215,6 +220,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
215
220
  this.allowTableResizing = init.allowTableResizing;
216
221
  this.isPresentational = init.isPresentational;
217
222
  this.disableTableOverflowShadow = init.disableTableOverflowShadow;
223
+ this.onSetLinkTarget = init.onSetLinkTarget;
218
224
  }
219
225
  return (0, _createClass2.default)(ReactSerializer, [{
220
226
  key: "resetState",
@@ -10,6 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _react2 = require("@emotion/react");
12
12
  var _colors = require("@atlaskit/theme/colors");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _utils = require("../../utils");
14
15
  var _events = require("../../analytics/events");
15
16
  var _analytics = require("@atlaskit/editor-common/analytics");
@@ -36,16 +37,26 @@ var anchorStyles = (0, _react2.css)({
36
37
  function Link(props) {
37
38
  var href = props.href,
38
39
  target = props.target,
40
+ onSetLinkTarget = props.onSetLinkTarget,
39
41
  eventHandlers = props.eventHandlers,
40
42
  fireAnalyticsEvent = props.fireAnalyticsEvent,
41
43
  isMediaLink = props.isMediaLink,
42
44
  dataAttributes = props.dataAttributes;
45
+ var actualTarget = target;
46
+ if (onSetLinkTarget && href && (0, _platformFeatureFlags.fg)('rovo_chat_deep_linking_enabled')) {
47
+ try {
48
+ var _onSetLinkTarget;
49
+ actualTarget = (_onSetLinkTarget = onSetLinkTarget(href)) !== null && _onSetLinkTarget !== void 0 ? _onSetLinkTarget : actualTarget;
50
+ } catch (error) {
51
+ // If URL parsing fails, use the original target
52
+ }
53
+ }
43
54
  var anchorProps = {
44
55
  href: href,
45
- target: target,
56
+ target: actualTarget,
46
57
  title: href
47
58
  };
48
- if (target === '_blank') {
59
+ if (actualTarget === '_blank') {
49
60
  anchorProps.rel = 'noreferrer noopener';
50
61
  }
51
62
  var handler = (0, _utils.getEventHandler)(eventHandlers, 'link');
@@ -152,35 +152,31 @@ var getWithCellProps = function getWithCellProps(WrapperComponent) {
152
152
  // This is used to set the background color of the cell
153
153
  // to a dark mode color in mobile dark mode
154
154
  var colorName = background ? _adfSchema.tableBackgroundColorPalette.get(background) : '';
155
- return (
156
- /*#__PURE__*/
157
- // @ts-ignore - Workaround for help-center local consumption
158
- _react.default.createElement(WrapperComponent, (0, _extends2.default)({
159
- rowSpan: rowspan,
160
- colSpan: colspan
161
- // Note: When content from a renderer is pasted into an editor
162
- // the background color is not taken from the inline style.
163
- // Instead it is taken from the data-cell-background attribute
164
- // (added via getDataAttributes below).
165
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
166
- ,
167
- style: getStyle({
168
- background: background,
169
- colGroupWidth: colGroupWidth,
170
- offsetTop: offsetTop,
171
- colorMode: colorMode
172
- }),
173
- colorname: colorName,
174
- onClick: onClick
175
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
176
- ,
177
- className: className
178
- // Ignored via go/ees005
179
- // eslint-disable-next-line react/jsx-props-no-spreading
180
- }, getDataAttributes(colwidth, background), {
181
- "aria-sort": ariaSort
182
- }), children)
183
- );
155
+ return /*#__PURE__*/_react.default.createElement(WrapperComponent, (0, _extends2.default)({
156
+ rowSpan: rowspan,
157
+ colSpan: colspan
158
+ // Note: When content from a renderer is pasted into an editor
159
+ // the background color is not taken from the inline style.
160
+ // Instead it is taken from the data-cell-background attribute
161
+ // (added via getDataAttributes below).
162
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
163
+ ,
164
+ style: getStyle({
165
+ background: background,
166
+ colGroupWidth: colGroupWidth,
167
+ offsetTop: offsetTop,
168
+ colorMode: colorMode
169
+ }),
170
+ colorname: colorName,
171
+ onClick: onClick
172
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
173
+ ,
174
+ className: className
175
+ // Ignored via go/ees005
176
+ // eslint-disable-next-line react/jsx-props-no-spreading
177
+ }, getDataAttributes(colwidth, background), {
178
+ "aria-sort": ariaSort
179
+ }), children);
184
180
  };
185
181
  };
186
182
  var TH = getWithCellProps('th');
@@ -195,32 +191,27 @@ var withSortableColumn = exports.withSortableColumn = function withSortableColum
195
191
  var sortOrderedClassName = sortOrdered === _types.SortOrder.NO_ORDER ? _consts.RendererCssClassName.SORTABLE_COLUMN_NO_ORDER : '';
196
192
  if (!allowColumnSorting || !isHeaderRow) {
197
193
  // Ignored via go/ees005
198
- // @ts-ignore - Workaround for help-center local consumption
199
194
  // eslint-disable-next-line react/jsx-props-no-spreading
200
195
  return /*#__PURE__*/_react.default.createElement(WrapperComponent, props);
201
196
  }
202
- return (
203
- /*#__PURE__*/
204
- // @ts-ignore - Workaround for help-center local consumption
205
- _react.default.createElement(WrapperComponent
206
- // Ignored via go/ees005
207
- // eslint-disable-next-line react/jsx-props-no-spreading
208
- , (0, _extends2.default)({}, props, {
209
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
210
- className: _consts.RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
211
- ariaSort: getSortOrderLabel(intl, sortOrdered)
212
- }), /*#__PURE__*/_react.default.createElement("div", {
213
- className: _consts.RendererCssClassName.SORTABLE_COLUMN
214
- }, children, /*#__PURE__*/_react.default.createElement("figure", {
215
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
216
- className: "".concat(_consts.RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER, " ").concat(sortOrderedClassName)
217
- }, /*#__PURE__*/_react.default.createElement(_table.SortingIcon, {
218
- isSortingAllowed: !!onSorting,
219
- sortOrdered: sortOrdered,
220
- onClick: sort,
221
- onKeyDown: onKeyPress
222
- }))))
223
- );
197
+ return /*#__PURE__*/_react.default.createElement(WrapperComponent
198
+ // Ignored via go/ees005
199
+ // eslint-disable-next-line react/jsx-props-no-spreading
200
+ , (0, _extends2.default)({}, props, {
201
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
202
+ className: _consts.RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
203
+ ariaSort: getSortOrderLabel(intl, sortOrdered)
204
+ }), /*#__PURE__*/_react.default.createElement("div", {
205
+ className: _consts.RendererCssClassName.SORTABLE_COLUMN
206
+ }, children, /*#__PURE__*/_react.default.createElement("figure", {
207
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
208
+ className: "".concat(_consts.RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER, " ").concat(sortOrderedClassName)
209
+ }, /*#__PURE__*/_react.default.createElement(_table.SortingIcon, {
210
+ isSortingAllowed: !!onSorting,
211
+ sortOrdered: sortOrdered,
212
+ onClick: sort,
213
+ onKeyDown: onKeyPress
214
+ }))));
224
215
  function onKeyPress(event) {
225
216
  var keys = [' ', 'Enter', 'Spacebar'];
226
217
  // Ignored via go/ees005
@@ -69,7 +69,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
69
69
  // we want to calculate all the table widths (which causes reflows) after the renderer has finished loading to mitigate performance impact
70
70
  var TABLE_INFO_TIMEOUT = 10000;
71
71
  var packageName = "@atlaskit/renderer";
72
- var packageVersion = "124.16.7";
72
+ var packageVersion = "0.0.0-development";
73
73
  var setAsQueryContainerStyles = (0, _react2.css)({
74
74
  containerName: 'ak-renderer-wrapper',
75
75
  containerType: 'inline-size'
@@ -238,6 +238,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
238
238
  }, props.rendererContext),
239
239
  appearance: props.appearance,
240
240
  contentMode: props.contentMode,
241
+ onSetLinkTarget: props.onSetLinkTarget,
241
242
  disableHeadingIDs: props.disableHeadingIDs,
242
243
  disableActions: props.disableActions,
243
244
  allowHeadingAnchorLinks: props.allowHeadingAnchorLinks,
@@ -145,6 +145,11 @@ export default class ReactSerializer {
145
145
  // the rendering in the mobile Native Renderer.
146
146
  codeBidiWarningTooltipEnabled: false
147
147
  } : {};
148
+
149
+ // Add deepLinkTarget for link marks
150
+ const linkSpecificProps = mark.type.name === 'link' ? {
151
+ onSetLinkTarget: this.onSetLinkTarget
152
+ } : {};
148
153
  const props = {
149
154
  eventHandlers: this.eventHandlers,
150
155
  fireAnalyticsEvent: this.fireAnalyticsEvent,
@@ -152,6 +157,7 @@ export default class ReactSerializer {
152
157
  ...otherAttrs,
153
158
  ...extraProps,
154
159
  ...markSpecificProps,
160
+ ...linkSpecificProps,
155
161
  dataAttributes: {
156
162
  'data-renderer-mark': true
157
163
  }
@@ -201,6 +207,7 @@ export default class ReactSerializer {
201
207
  this.allowTableResizing = init.allowTableResizing;
202
208
  this.isPresentational = init.isPresentational;
203
209
  this.disableTableOverflowShadow = init.disableTableOverflowShadow;
210
+ this.onSetLinkTarget = init.onSetLinkTarget;
204
211
  }
205
212
  resetState() {
206
213
  this.headingIds = [];
@@ -7,6 +7,7 @@ import React, { Fragment } from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { B400, B300, B500 } from '@atlaskit/theme/colors';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { getEventHandler } from '../../utils';
11
12
  import { PLATFORM, MODE } from '../../analytics/events';
12
13
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
@@ -26,17 +27,27 @@ export default function Link(props) {
26
27
  const {
27
28
  href,
28
29
  target,
30
+ onSetLinkTarget,
29
31
  eventHandlers,
30
32
  fireAnalyticsEvent,
31
33
  isMediaLink,
32
34
  dataAttributes
33
35
  } = props;
36
+ let actualTarget = target;
37
+ if (onSetLinkTarget && href && fg('rovo_chat_deep_linking_enabled')) {
38
+ try {
39
+ var _onSetLinkTarget;
40
+ actualTarget = (_onSetLinkTarget = onSetLinkTarget(href)) !== null && _onSetLinkTarget !== void 0 ? _onSetLinkTarget : actualTarget;
41
+ } catch (error) {
42
+ // If URL parsing fails, use the original target
43
+ }
44
+ }
34
45
  const anchorProps = {
35
46
  href,
36
- target,
47
+ target: actualTarget,
37
48
  title: href
38
49
  };
39
- if (target === '_blank') {
50
+ if (actualTarget === '_blank') {
40
51
  anchorProps.rel = 'noreferrer noopener';
41
52
  }
42
53
  const handler = getEventHandler(eventHandlers, 'link');
@@ -151,35 +151,31 @@ const getWithCellProps = WrapperComponent => {
151
151
  // This is used to set the background color of the cell
152
152
  // to a dark mode color in mobile dark mode
153
153
  const colorName = background ? tableBackgroundColorPalette.get(background) : '';
154
- return (
155
- /*#__PURE__*/
156
- // @ts-ignore - Workaround for help-center local consumption
157
- React.createElement(WrapperComponent, _extends({
158
- rowSpan: rowspan,
159
- colSpan: colspan
160
- // Note: When content from a renderer is pasted into an editor
161
- // the background color is not taken from the inline style.
162
- // Instead it is taken from the data-cell-background attribute
163
- // (added via getDataAttributes below).
164
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
165
- ,
166
- style: getStyle({
167
- background,
168
- colGroupWidth,
169
- offsetTop,
170
- colorMode
171
- }),
172
- colorname: colorName,
173
- onClick: onClick
174
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
175
- ,
176
- className: className
177
- // Ignored via go/ees005
178
- // eslint-disable-next-line react/jsx-props-no-spreading
179
- }, getDataAttributes(colwidth, background), {
180
- "aria-sort": ariaSort
181
- }), children)
182
- );
154
+ return /*#__PURE__*/React.createElement(WrapperComponent, _extends({
155
+ rowSpan: rowspan,
156
+ colSpan: colspan
157
+ // Note: When content from a renderer is pasted into an editor
158
+ // the background color is not taken from the inline style.
159
+ // Instead it is taken from the data-cell-background attribute
160
+ // (added via getDataAttributes below).
161
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
162
+ ,
163
+ style: getStyle({
164
+ background,
165
+ colGroupWidth,
166
+ offsetTop,
167
+ colorMode
168
+ }),
169
+ colorname: colorName,
170
+ onClick: onClick
171
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
172
+ ,
173
+ className: className
174
+ // Ignored via go/ees005
175
+ // eslint-disable-next-line react/jsx-props-no-spreading
176
+ }, getDataAttributes(colwidth, background), {
177
+ "aria-sort": ariaSort
178
+ }), children);
183
179
  };
184
180
  };
185
181
  const TH = getWithCellProps('th');
@@ -196,32 +192,27 @@ export const withSortableColumn = WrapperComponent => {
196
192
  const sortOrderedClassName = sortOrdered === SortOrder.NO_ORDER ? RendererCssClassName.SORTABLE_COLUMN_NO_ORDER : '';
197
193
  if (!allowColumnSorting || !isHeaderRow) {
198
194
  // Ignored via go/ees005
199
- // @ts-ignore - Workaround for help-center local consumption
200
195
  // eslint-disable-next-line react/jsx-props-no-spreading
201
196
  return /*#__PURE__*/React.createElement(WrapperComponent, props);
202
197
  }
203
- return (
204
- /*#__PURE__*/
205
- // @ts-ignore - Workaround for help-center local consumption
206
- React.createElement(WrapperComponent
207
- // Ignored via go/ees005
208
- // eslint-disable-next-line react/jsx-props-no-spreading
209
- , _extends({}, props, {
210
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
211
- className: RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
212
- ariaSort: getSortOrderLabel(intl, sortOrdered)
213
- }), /*#__PURE__*/React.createElement("div", {
214
- className: RendererCssClassName.SORTABLE_COLUMN
215
- }, children, /*#__PURE__*/React.createElement("figure", {
216
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
217
- className: `${RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER} ${sortOrderedClassName}`
218
- }, /*#__PURE__*/React.createElement(SortingIcon, {
219
- isSortingAllowed: !!onSorting,
220
- sortOrdered: sortOrdered,
221
- onClick: sort,
222
- onKeyDown: onKeyPress
223
- }))))
224
- );
198
+ return /*#__PURE__*/React.createElement(WrapperComponent
199
+ // Ignored via go/ees005
200
+ // eslint-disable-next-line react/jsx-props-no-spreading
201
+ , _extends({}, props, {
202
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
203
+ className: RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
204
+ ariaSort: getSortOrderLabel(intl, sortOrdered)
205
+ }), /*#__PURE__*/React.createElement("div", {
206
+ className: RendererCssClassName.SORTABLE_COLUMN
207
+ }, children, /*#__PURE__*/React.createElement("figure", {
208
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
209
+ className: `${RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER} ${sortOrderedClassName}`
210
+ }, /*#__PURE__*/React.createElement(SortingIcon, {
211
+ isSortingAllowed: !!onSorting,
212
+ sortOrdered: sortOrdered,
213
+ onClick: sort,
214
+ onKeyDown: onKeyPress
215
+ }))));
225
216
  function onKeyPress(event) {
226
217
  const keys = [' ', 'Enter', 'Spacebar'];
227
218
  // Ignored via go/ees005
@@ -55,7 +55,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
55
55
  // we want to calculate all the table widths (which causes reflows) after the renderer has finished loading to mitigate performance impact
56
56
  const TABLE_INFO_TIMEOUT = 10000;
57
57
  const packageName = "@atlaskit/renderer";
58
- const packageVersion = "124.16.7";
58
+ const packageVersion = "0.0.0-development";
59
59
  const setAsQueryContainerStyles = css({
60
60
  containerName: 'ak-renderer-wrapper',
61
61
  containerType: 'inline-size'
@@ -232,6 +232,7 @@ export const RendererFunctionalComponent = props => {
232
232
  },
233
233
  appearance: props.appearance,
234
234
  contentMode: props.contentMode,
235
+ onSetLinkTarget: props.onSetLinkTarget,
235
236
  disableHeadingIDs: props.disableHeadingIDs,
236
237
  disableActions: props.disableActions,
237
238
  allowHeadingAnchorLinks: props.allowHeadingAnchorLinks,
@@ -154,11 +154,16 @@ var ReactSerializer = /*#__PURE__*/function () {
154
154
  // the rendering in the mobile Native Renderer.
155
155
  codeBidiWarningTooltipEnabled: false
156
156
  } : {};
157
- var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
157
+
158
+ // Add deepLinkTarget for link marks
159
+ var linkSpecificProps = mark.type.name === 'link' ? {
160
+ onSetLinkTarget: _this.onSetLinkTarget
161
+ } : {};
162
+ var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
158
163
  eventHandlers: _this.eventHandlers,
159
164
  fireAnalyticsEvent: _this.fireAnalyticsEvent,
160
165
  markKey: key
161
- }, otherAttrs), extraProps), markSpecificProps), {}, {
166
+ }, otherAttrs), extraProps), markSpecificProps), linkSpecificProps), {}, {
162
167
  dataAttributes: {
163
168
  'data-renderer-mark': true
164
169
  }
@@ -208,6 +213,7 @@ var ReactSerializer = /*#__PURE__*/function () {
208
213
  this.allowTableResizing = init.allowTableResizing;
209
214
  this.isPresentational = init.isPresentational;
210
215
  this.disableTableOverflowShadow = init.disableTableOverflowShadow;
216
+ this.onSetLinkTarget = init.onSetLinkTarget;
211
217
  }
212
218
  return _createClass(ReactSerializer, [{
213
219
  key: "resetState",
@@ -7,6 +7,7 @@ import React, { Fragment } from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { B400, B300, B500 } from '@atlaskit/theme/colors';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { getEventHandler } from '../../utils';
11
12
  import { PLATFORM, MODE } from '../../analytics/events';
12
13
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
@@ -25,16 +26,26 @@ var anchorStyles = css({
25
26
  export default function Link(props) {
26
27
  var href = props.href,
27
28
  target = props.target,
29
+ onSetLinkTarget = props.onSetLinkTarget,
28
30
  eventHandlers = props.eventHandlers,
29
31
  fireAnalyticsEvent = props.fireAnalyticsEvent,
30
32
  isMediaLink = props.isMediaLink,
31
33
  dataAttributes = props.dataAttributes;
34
+ var actualTarget = target;
35
+ if (onSetLinkTarget && href && fg('rovo_chat_deep_linking_enabled')) {
36
+ try {
37
+ var _onSetLinkTarget;
38
+ actualTarget = (_onSetLinkTarget = onSetLinkTarget(href)) !== null && _onSetLinkTarget !== void 0 ? _onSetLinkTarget : actualTarget;
39
+ } catch (error) {
40
+ // If URL parsing fails, use the original target
41
+ }
42
+ }
32
43
  var anchorProps = {
33
44
  href: href,
34
- target: target,
45
+ target: actualTarget,
35
46
  title: href
36
47
  };
37
- if (target === '_blank') {
48
+ if (actualTarget === '_blank') {
38
49
  anchorProps.rel = 'noreferrer noopener';
39
50
  }
40
51
  var handler = getEventHandler(eventHandlers, 'link');
@@ -145,35 +145,31 @@ var getWithCellProps = function getWithCellProps(WrapperComponent) {
145
145
  // This is used to set the background color of the cell
146
146
  // to a dark mode color in mobile dark mode
147
147
  var colorName = background ? tableBackgroundColorPalette.get(background) : '';
148
- return (
149
- /*#__PURE__*/
150
- // @ts-ignore - Workaround for help-center local consumption
151
- React.createElement(WrapperComponent, _extends({
152
- rowSpan: rowspan,
153
- colSpan: colspan
154
- // Note: When content from a renderer is pasted into an editor
155
- // the background color is not taken from the inline style.
156
- // Instead it is taken from the data-cell-background attribute
157
- // (added via getDataAttributes below).
158
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
159
- ,
160
- style: getStyle({
161
- background: background,
162
- colGroupWidth: colGroupWidth,
163
- offsetTop: offsetTop,
164
- colorMode: colorMode
165
- }),
166
- colorname: colorName,
167
- onClick: onClick
168
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
169
- ,
170
- className: className
171
- // Ignored via go/ees005
172
- // eslint-disable-next-line react/jsx-props-no-spreading
173
- }, getDataAttributes(colwidth, background), {
174
- "aria-sort": ariaSort
175
- }), children)
176
- );
148
+ return /*#__PURE__*/React.createElement(WrapperComponent, _extends({
149
+ rowSpan: rowspan,
150
+ colSpan: colspan
151
+ // Note: When content from a renderer is pasted into an editor
152
+ // the background color is not taken from the inline style.
153
+ // Instead it is taken from the data-cell-background attribute
154
+ // (added via getDataAttributes below).
155
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
156
+ ,
157
+ style: getStyle({
158
+ background: background,
159
+ colGroupWidth: colGroupWidth,
160
+ offsetTop: offsetTop,
161
+ colorMode: colorMode
162
+ }),
163
+ colorname: colorName,
164
+ onClick: onClick
165
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
166
+ ,
167
+ className: className
168
+ // Ignored via go/ees005
169
+ // eslint-disable-next-line react/jsx-props-no-spreading
170
+ }, getDataAttributes(colwidth, background), {
171
+ "aria-sort": ariaSort
172
+ }), children);
177
173
  };
178
174
  };
179
175
  var TH = getWithCellProps('th');
@@ -188,32 +184,27 @@ export var withSortableColumn = function withSortableColumn(WrapperComponent) {
188
184
  var sortOrderedClassName = sortOrdered === SortOrder.NO_ORDER ? RendererCssClassName.SORTABLE_COLUMN_NO_ORDER : '';
189
185
  if (!allowColumnSorting || !isHeaderRow) {
190
186
  // Ignored via go/ees005
191
- // @ts-ignore - Workaround for help-center local consumption
192
187
  // eslint-disable-next-line react/jsx-props-no-spreading
193
188
  return /*#__PURE__*/React.createElement(WrapperComponent, props);
194
189
  }
195
- return (
196
- /*#__PURE__*/
197
- // @ts-ignore - Workaround for help-center local consumption
198
- React.createElement(WrapperComponent
199
- // Ignored via go/ees005
200
- // eslint-disable-next-line react/jsx-props-no-spreading
201
- , _extends({}, props, {
202
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
203
- className: RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
204
- ariaSort: getSortOrderLabel(intl, sortOrdered)
205
- }), /*#__PURE__*/React.createElement("div", {
206
- className: RendererCssClassName.SORTABLE_COLUMN
207
- }, children, /*#__PURE__*/React.createElement("figure", {
208
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
209
- className: "".concat(RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER, " ").concat(sortOrderedClassName)
210
- }, /*#__PURE__*/React.createElement(SortingIcon, {
211
- isSortingAllowed: !!onSorting,
212
- sortOrdered: sortOrdered,
213
- onClick: sort,
214
- onKeyDown: onKeyPress
215
- }))))
216
- );
190
+ return /*#__PURE__*/React.createElement(WrapperComponent
191
+ // Ignored via go/ees005
192
+ // eslint-disable-next-line react/jsx-props-no-spreading
193
+ , _extends({}, props, {
194
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
195
+ className: RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
196
+ ariaSort: getSortOrderLabel(intl, sortOrdered)
197
+ }), /*#__PURE__*/React.createElement("div", {
198
+ className: RendererCssClassName.SORTABLE_COLUMN
199
+ }, children, /*#__PURE__*/React.createElement("figure", {
200
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
201
+ className: "".concat(RendererCssClassName.SORTABLE_COLUMN_ICON_WRAPPER, " ").concat(sortOrderedClassName)
202
+ }, /*#__PURE__*/React.createElement(SortingIcon, {
203
+ isSortingAllowed: !!onSorting,
204
+ sortOrdered: sortOrdered,
205
+ onClick: sort,
206
+ onKeyDown: onKeyPress
207
+ }))));
217
208
  function onKeyPress(event) {
218
209
  var keys = [' ', 'Enter', 'Spacebar'];
219
210
  // Ignored via go/ees005
@@ -60,7 +60,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
60
60
  // we want to calculate all the table widths (which causes reflows) after the renderer has finished loading to mitigate performance impact
61
61
  var TABLE_INFO_TIMEOUT = 10000;
62
62
  var packageName = "@atlaskit/renderer";
63
- var packageVersion = "124.16.7";
63
+ var packageVersion = "0.0.0-development";
64
64
  var setAsQueryContainerStyles = css({
65
65
  containerName: 'ak-renderer-wrapper',
66
66
  containerType: 'inline-size'
@@ -229,6 +229,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
229
229
  }, props.rendererContext),
230
230
  appearance: props.appearance,
231
231
  contentMode: props.contentMode,
232
+ onSetLinkTarget: props.onSetLinkTarget,
232
233
  disableHeadingIDs: props.disableHeadingIDs,
233
234
  disableActions: props.disableActions,
234
235
  allowHeadingAnchorLinks: props.allowHeadingAnchorLinks,
@@ -41,6 +41,7 @@ export interface ReactSerializerInit {
41
41
  media?: MediaOptions;
42
42
  nodeComponents?: NodeComponentsProps;
43
43
  objectContext?: RendererContext;
44
+ onSetLinkTarget?: (url: string) => '_blank' | undefined;
44
45
  portal?: HTMLElement;
45
46
  providers?: ProviderFactory;
46
47
  shouldOpenMediaViewer?: boolean;
@@ -110,6 +111,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
110
111
  private isPresentational?;
111
112
  private disableTableOverflowShadow?;
112
113
  private standaloneBackgroundColorMarks;
114
+ private onSetLinkTarget?;
113
115
  constructor(init: ReactSerializerInit);
114
116
  private resetState;
115
117
  private getNodeProps;
@@ -3,6 +3,7 @@ import type { LinkAttributes } from '@atlaskit/adf-schema';
3
3
  import type { MarkProps } from '../types';
4
4
  interface LinkProps extends LinkAttributes {
5
5
  isMediaLink?: boolean;
6
+ onSetLinkTarget?: (url: string) => '_blank' | undefined;
6
7
  target?: string;
7
8
  }
8
9
  export default function Link(props: MarkProps<LinkProps>): jsx.JSX.Element;
@@ -123,6 +123,15 @@ export interface RendererProps {
123
123
  noOpSSRInlineScript?: boolean;
124
124
  onComplete?: (stat: RenderOutputStat) => void;
125
125
  onError?: (error: any) => void;
126
+ /**
127
+ * Optional callback to programatically determine the link target for rendered links. Controls whether a link should render as external or not.
128
+ * Return _blank if the url should render as an external link.
129
+ * Return undefined to use the links default behavior and target.
130
+ *
131
+ * @param url - The URL of the link being rendered
132
+ * @returns '_blank' to render as an external link or undefined to not change the link
133
+ */
134
+ onSetLinkTarget?: (url: string) => '_blank' | undefined;
126
135
  portal?: HTMLElement;
127
136
  rendererContext?: RendererContext;
128
137
  schema?: Schema;
@@ -41,6 +41,7 @@ export interface ReactSerializerInit {
41
41
  media?: MediaOptions;
42
42
  nodeComponents?: NodeComponentsProps;
43
43
  objectContext?: RendererContext;
44
+ onSetLinkTarget?: (url: string) => '_blank' | undefined;
44
45
  portal?: HTMLElement;
45
46
  providers?: ProviderFactory;
46
47
  shouldOpenMediaViewer?: boolean;
@@ -110,6 +111,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
110
111
  private isPresentational?;
111
112
  private disableTableOverflowShadow?;
112
113
  private standaloneBackgroundColorMarks;
114
+ private onSetLinkTarget?;
113
115
  constructor(init: ReactSerializerInit);
114
116
  private resetState;
115
117
  private getNodeProps;
@@ -3,6 +3,7 @@ import type { LinkAttributes } from '@atlaskit/adf-schema';
3
3
  import type { MarkProps } from '../types';
4
4
  interface LinkProps extends LinkAttributes {
5
5
  isMediaLink?: boolean;
6
+ onSetLinkTarget?: (url: string) => '_blank' | undefined;
6
7
  target?: string;
7
8
  }
8
9
  export default function Link(props: MarkProps<LinkProps>): jsx.JSX.Element;
@@ -123,6 +123,15 @@ export interface RendererProps {
123
123
  noOpSSRInlineScript?: boolean;
124
124
  onComplete?: (stat: RenderOutputStat) => void;
125
125
  onError?: (error: any) => void;
126
+ /**
127
+ * Optional callback to programatically determine the link target for rendered links. Controls whether a link should render as external or not.
128
+ * Return _blank if the url should render as an external link.
129
+ * Return undefined to use the links default behavior and target.
130
+ *
131
+ * @param url - The URL of the link being rendered
132
+ * @returns '_blank' to render as an external link or undefined to not change the link
133
+ */
134
+ onSetLinkTarget?: (url: string) => '_blank' | undefined;
126
135
  portal?: HTMLElement;
127
136
  rendererContext?: RendererContext;
128
137
  schema?: Schema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "124.16.8",
3
+ "version": "124.17.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -49,15 +49,15 @@
49
49
  "@atlaskit/media-common": "^12.3.0",
50
50
  "@atlaskit/media-filmstrip": "^51.1.0",
51
51
  "@atlaskit/media-ui": "^28.7.0",
52
- "@atlaskit/media-viewer": "^52.4.0",
52
+ "@atlaskit/media-viewer": "^52.5.0",
53
53
  "@atlaskit/platform-feature-flags": "^1.1.0",
54
54
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
55
55
  "@atlaskit/react-ufo": "^4.15.0",
56
- "@atlaskit/smart-card": "^43.11.0",
56
+ "@atlaskit/smart-card": "^43.12.0",
57
57
  "@atlaskit/status": "^3.0.0",
58
58
  "@atlaskit/task-decision": "^19.2.0",
59
59
  "@atlaskit/theme": "^21.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^14.1.0",
60
+ "@atlaskit/tmp-editor-statsig": "^14.4.0",
61
61
  "@atlaskit/tokens": "^8.4.0",
62
62
  "@atlaskit/tooltip": "^20.10.0",
63
63
  "@atlaskit/visually-hidden": "^3.0.0",
@@ -71,7 +71,7 @@
71
71
  "uuid": "^3.1.0"
72
72
  },
73
73
  "peerDependencies": {
74
- "@atlaskit/editor-common": "^110.36.0",
74
+ "@atlaskit/editor-common": "^110.37.0",
75
75
  "@atlaskit/link-provider": "^4.0.0",
76
76
  "@atlaskit/media-core": "^37.0.0",
77
77
  "react": "^18.2.0",
@@ -90,7 +90,7 @@
90
90
  "@atlaskit/mention": "^24.4.0",
91
91
  "@atlaskit/modal-dialog": "^14.7.0",
92
92
  "@atlaskit/navigation-next": "patch:@atlaskit/navigation-next@npm%3A9.0.17#~/.yarn/patches/@atlaskit-navigation-next-npm-9.0.17-958ca0ab9d.patch",
93
- "@atlaskit/profilecard": "^24.22.0",
93
+ "@atlaskit/profilecard": "^24.23.0",
94
94
  "@atlaskit/util-data-test": "^18.3.0",
95
95
  "@atlassian/feature-flags-test-utils": "^1.0.0",
96
96
  "@testing-library/react": "^13.4.0",
@@ -243,6 +243,9 @@
243
243
  "platform_editor_ai_adf_prompts_in_all_products": {
244
244
  "type": "boolean"
245
245
  },
246
+ "rovo_chat_deep_linking_enabled": {
247
+ "type": "boolean"
248
+ },
246
249
  "jfp-magma-ssr-iv-editor-codeblock": {
247
250
  "type": "boolean"
248
251
  }