@atlaskit/renderer 85.0.0 → 89.0.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 +83 -0
- package/dist/cjs/analytics/enums.js +1 -0
- package/dist/cjs/messages.js +47 -1
- package/dist/cjs/react/hooks/use-observed-width.js +94 -0
- package/dist/cjs/react/index.js +2 -0
- package/dist/cjs/react/nodes/copy-text-provider.js +2 -1
- package/dist/cjs/react/nodes/heading-anchor.js +8 -2
- package/dist/cjs/react/nodes/inlineCard.js +12 -1
- package/dist/cjs/react/nodes/mediaSingle/index.js +145 -151
- package/dist/cjs/react/nodes/mention.js +0 -2
- package/dist/cjs/react/nodes/status.js +2 -1
- package/dist/cjs/react/nodes/tableCell.js +19 -8
- package/dist/cjs/react/nodes/task-item-with-providers.js +4 -2
- package/dist/cjs/react/nodes/taskItem.js +1 -0
- package/dist/cjs/render-document.js +17 -1
- package/dist/cjs/types/smartLinksOptions.js +5 -0
- package/dist/cjs/ui/Renderer/breakout-ssr.js +47 -4
- package/dist/cjs/ui/Renderer/index.js +1 -0
- package/dist/cjs/ui/SortingIcon.js +22 -9
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/enums.js +1 -0
- package/dist/es2019/messages.js +44 -0
- package/dist/es2019/react/hooks/use-observed-width.js +59 -0
- package/dist/es2019/react/index.js +2 -0
- package/dist/es2019/react/nodes/copy-text-provider.js +2 -1
- package/dist/es2019/react/nodes/heading-anchor.js +11 -2
- package/dist/es2019/react/nodes/inlineCard.js +11 -1
- package/dist/es2019/react/nodes/mediaSingle/index.js +132 -112
- package/dist/es2019/react/nodes/mention.js +0 -2
- package/dist/es2019/react/nodes/status.js +2 -1
- package/dist/es2019/react/nodes/tableCell.js +20 -9
- package/dist/es2019/react/nodes/task-item-with-providers.js +3 -1
- package/dist/es2019/react/nodes/taskItem.js +1 -0
- package/dist/es2019/render-document.js +17 -1
- package/dist/es2019/types/smartLinksOptions.js +1 -0
- package/dist/es2019/ui/Renderer/breakout-ssr.js +45 -4
- package/dist/es2019/ui/Renderer/index.js +1 -0
- package/dist/es2019/ui/SortingIcon.js +22 -10
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/enums.js +1 -0
- package/dist/esm/messages.js +44 -0
- package/dist/esm/react/hooks/use-observed-width.js +80 -0
- package/dist/esm/react/index.js +2 -0
- package/dist/esm/react/nodes/copy-text-provider.js +2 -1
- package/dist/esm/react/nodes/heading-anchor.js +9 -2
- package/dist/esm/react/nodes/inlineCard.js +11 -1
- package/dist/esm/react/nodes/mediaSingle/index.js +140 -141
- package/dist/esm/react/nodes/mention.js +0 -2
- package/dist/esm/react/nodes/status.js +2 -1
- package/dist/esm/react/nodes/tableCell.js +17 -8
- package/dist/esm/react/nodes/task-item-with-providers.js +4 -2
- package/dist/esm/react/nodes/taskItem.js +1 -0
- package/dist/esm/render-document.js +16 -1
- package/dist/esm/types/smartLinksOptions.js +1 -0
- package/dist/esm/ui/Renderer/breakout-ssr.js +47 -4
- package/dist/esm/ui/Renderer/index.js +1 -0
- package/dist/esm/ui/SortingIcon.js +20 -10
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/enums.d.ts +2 -1
- package/dist/types/analytics/events.d.ts +2 -1
- package/dist/types/messages.d.ts +44 -0
- package/dist/types/react/hooks/use-observed-width.d.ts +3 -0
- package/dist/types/react/index.d.ts +3 -0
- package/dist/types/react/nodes/index.d.ts +1 -1
- package/dist/types/react/nodes/inlineCard.d.ts +22 -20
- package/dist/types/react/nodes/mediaSingle/index.d.ts +3 -7
- package/dist/types/react/nodes/mediaSingle/styles.d.ts +1 -1
- package/dist/types/react/nodes/mention.d.ts +0 -1
- package/dist/types/react/nodes/tableCell.d.ts +6 -59
- package/dist/types/react/nodes/task-item-with-providers.d.ts +1 -0
- package/dist/types/types/smartLinksOptions.d.ts +3 -0
- package/dist/types/ui/SortingIcon.d.ts +6 -3
- package/dist/types/ui/renderer-props.d.ts +2 -0
- package/package.json +15 -15
|
@@ -35,6 +35,7 @@ export default class TaskItem extends PureComponent {
|
|
|
35
35
|
objectAri: objectAri,
|
|
36
36
|
taskId: localId,
|
|
37
37
|
isDone: state === 'DONE',
|
|
38
|
+
isRenderer: true,
|
|
38
39
|
disabled: disabled,
|
|
39
40
|
taskDecisionProvider: taskDecisionProvider,
|
|
40
41
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
@@ -4,6 +4,7 @@ import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaski
|
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from './analytics/enums';
|
|
5
5
|
import { PLATFORM } from './analytics/events';
|
|
6
6
|
import { trackUnsupportedContentLevels } from './analytics/unsupported-content';
|
|
7
|
+
import { transformMediaLinkMarks } from '@atlaskit/adf-utils';
|
|
7
8
|
const SUPPORTS_HIRES_TIMER_API = !!(window.performance && performance.now);
|
|
8
9
|
|
|
9
10
|
const withStopwatch = cb => {
|
|
@@ -26,7 +27,22 @@ export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage
|
|
|
26
27
|
time: sanitizeTime
|
|
27
28
|
} = withStopwatch(() => {
|
|
28
29
|
if (useSpecBasedValidator) {
|
|
29
|
-
|
|
30
|
+
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
31
|
+
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
32
|
+
const {
|
|
33
|
+
transformedAdf,
|
|
34
|
+
isTransformed
|
|
35
|
+
} = transformMediaLinkMarks(doc);
|
|
36
|
+
|
|
37
|
+
if (isTransformed && dispatchAnalyticsEvent) {
|
|
38
|
+
dispatchAnalyticsEvent({
|
|
39
|
+
action: ACTION.MEDIA_LINK_TRANSFORMED,
|
|
40
|
+
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
41
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent);
|
|
30
46
|
}
|
|
31
47
|
|
|
32
48
|
return getValidDocument(doc, schema, adfStage);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -45,13 +45,16 @@ export const breakoutInlineScriptContext = `
|
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
47
|
function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
|
|
48
|
-
|
|
48
|
+
const MEDIA_NODE_TYPE = 'mediaSingle';
|
|
49
|
+
const WIDE_LAYOUT_MODES = ['full-width', 'wide'];
|
|
50
|
+
|
|
51
|
+
function findUp(element, condition) {
|
|
49
52
|
if (!element) {
|
|
50
53
|
return;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
while (element.parentElement) {
|
|
54
|
-
if (element
|
|
57
|
+
if (condition(element)) {
|
|
55
58
|
return element.parentElement;
|
|
56
59
|
}
|
|
57
60
|
|
|
@@ -59,7 +62,11 @@ function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
|
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
const renderer = findUp(document.querySelector('[data-breakout-script-id="' + id + '"]'),
|
|
65
|
+
const renderer = findUp(document.querySelector('[data-breakout-script-id="' + id + '"]'), elem => {
|
|
66
|
+
var _elem$parentElement;
|
|
67
|
+
|
|
68
|
+
return !!((_elem$parentElement = elem.parentElement) !== null && _elem$parentElement !== void 0 && _elem$parentElement.classList.contains('ak-renderer-wrapper'));
|
|
69
|
+
});
|
|
63
70
|
|
|
64
71
|
if (!renderer) {
|
|
65
72
|
return;
|
|
@@ -76,7 +83,7 @@ function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
|
|
|
76
83
|
const node = maybeNode;
|
|
77
84
|
const mode = node.dataset.mode || node.dataset.layout || '';
|
|
78
85
|
|
|
79
|
-
if (!mode || !
|
|
86
|
+
if (!mode || !WIDE_LAYOUT_MODES.includes(mode)) {
|
|
80
87
|
return;
|
|
81
88
|
}
|
|
82
89
|
|
|
@@ -99,9 +106,43 @@ function applyBreakoutAfterSSR(id, allowDynamicTextSizing, breakoutConsts) {
|
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
108
|
});
|
|
109
|
+
} else if (
|
|
110
|
+
/**
|
|
111
|
+
* The mutation observer is only called once per added node.
|
|
112
|
+
* The above condition only deals with direct children of <div class="ak-renderer-document" />
|
|
113
|
+
* When it is initially called on the direct children, not all the sub children have loaded.
|
|
114
|
+
* So nested media elements which are not immediately loaded as sub children are not availabe in the above conditional.
|
|
115
|
+
* Thus adding this conditional to deal with all meida elements directly.
|
|
116
|
+
*/
|
|
117
|
+
item.target.dataset.nodeType === MEDIA_NODE_TYPE) {
|
|
118
|
+
applyMediaBreakout(item.target);
|
|
102
119
|
}
|
|
103
120
|
});
|
|
104
121
|
});
|
|
122
|
+
|
|
123
|
+
const applyMediaBreakout = card => {
|
|
124
|
+
// width was already set by another breakout script
|
|
125
|
+
if (card.style.width) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const tableParent = findUp(card, elem => elem instanceof HTMLTableCellElement); // only apply the breakout to media elements not nested inside table
|
|
130
|
+
// table sizing is not based on percentage width
|
|
131
|
+
|
|
132
|
+
if (tableParent) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const mode = card.dataset.mode || card.dataset.layout || '';
|
|
137
|
+
const width = card.dataset.width;
|
|
138
|
+
|
|
139
|
+
if (WIDE_LAYOUT_MODES.includes(mode)) {
|
|
140
|
+
card.style.width = '100%';
|
|
141
|
+
} else if (width) {
|
|
142
|
+
card.style.width = `${width}%`;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
105
146
|
observer.observe(renderer, {
|
|
106
147
|
childList: true,
|
|
107
148
|
subtree: true
|
|
@@ -183,6 +183,7 @@ export class Renderer extends PureComponent {
|
|
|
183
183
|
allowMediaLinking: props.media && props.media.allowLinking,
|
|
184
184
|
surroundTextNodesWithTextWrapper: allowAnnotationsDraftMode,
|
|
185
185
|
media: props.media,
|
|
186
|
+
smartLinks: props.smartLinks,
|
|
186
187
|
allowCopyToClipboard: props.allowCopyToClipboard,
|
|
187
188
|
allowCustomPanels: props.allowCustomPanels,
|
|
188
189
|
allowAnnotations: props.allowAnnotations,
|
|
@@ -3,7 +3,9 @@ import styled from 'styled-components';
|
|
|
3
3
|
import Tooltip from '@atlaskit/tooltip';
|
|
4
4
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
5
5
|
import { N20, N30 } from '@atlaskit/theme/colors';
|
|
6
|
-
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
6
|
+
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
7
|
+
import { sortingIconMessages } from '../messages';
|
|
8
|
+
import { injectIntl } from 'react-intl-next'; // We use data url here because of this issue:
|
|
7
9
|
// https://product-fabric.atlassian.net/browse/ED-8001
|
|
8
10
|
// Remove this workaround if Firefox has fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=1664350
|
|
9
11
|
|
|
@@ -69,30 +71,40 @@ const getClassName = status => {
|
|
|
69
71
|
}
|
|
70
72
|
};
|
|
71
73
|
|
|
72
|
-
const getTooltipTitle = status => {
|
|
74
|
+
const getTooltipTitle = (intl, isSortingAllowed, status) => {
|
|
75
|
+
const {
|
|
76
|
+
noOrderLabel,
|
|
77
|
+
ascOrderLabel,
|
|
78
|
+
descOrderLabel,
|
|
79
|
+
invalidLabel
|
|
80
|
+
} = sortingIconMessages;
|
|
81
|
+
|
|
82
|
+
if (!isSortingAllowed) {
|
|
83
|
+
return intl.formatMessage(invalidLabel);
|
|
84
|
+
}
|
|
85
|
+
|
|
73
86
|
switch (status) {
|
|
74
87
|
case SortOrder.NO_ORDER:
|
|
75
|
-
return
|
|
88
|
+
return intl.formatMessage(noOrderLabel);
|
|
76
89
|
|
|
77
90
|
case SortOrder.ASC:
|
|
78
|
-
return
|
|
91
|
+
return intl.formatMessage(ascOrderLabel);
|
|
79
92
|
|
|
80
93
|
case SortOrder.DESC:
|
|
81
|
-
return
|
|
94
|
+
return intl.formatMessage(descOrderLabel);
|
|
82
95
|
}
|
|
83
96
|
|
|
84
97
|
return '';
|
|
85
98
|
};
|
|
86
99
|
|
|
87
|
-
const notAllowedTooltip = `⚠️ You can't sort a table with merged cell`;
|
|
88
|
-
|
|
89
100
|
const SortingIcon = ({
|
|
90
101
|
isSortingAllowed,
|
|
91
|
-
sortOrdered
|
|
102
|
+
sortOrdered,
|
|
103
|
+
intl
|
|
92
104
|
}) => {
|
|
93
105
|
const activated = sortOrdered !== SortOrder.NO_ORDER;
|
|
94
106
|
const wrapperClassName = !isSortingAllowed ? StatusClassNames.SORTING_NOT_ALLOWED : '';
|
|
95
|
-
const content = isSortingAllowed
|
|
107
|
+
const content = getTooltipTitle(intl, isSortingAllowed, sortOrdered);
|
|
96
108
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
97
109
|
delay: 0,
|
|
98
110
|
content: content,
|
|
@@ -104,4 +116,4 @@ const SortingIcon = ({
|
|
|
104
116
|
})));
|
|
105
117
|
};
|
|
106
118
|
|
|
107
|
-
export default SortingIcon;
|
|
119
|
+
export default injectIntl(SortingIcon);
|
package/dist/es2019/version.json
CHANGED
|
@@ -31,6 +31,7 @@ export var ACTION;
|
|
|
31
31
|
ACTION["CREATE_NOT_ALLOWED"] = "createNotAllowed";
|
|
32
32
|
ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_SUCCEEDED"] = "unsupportedContentLevelsTrackingSucceeded";
|
|
33
33
|
ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_ERRORED"] = "unsupportedContentLevelsTrackingErrored";
|
|
34
|
+
ACTION["MEDIA_LINK_TRANSFORMED"] = "mediaLinkTransformed";
|
|
34
35
|
})(ACTION || (ACTION = {}));
|
|
35
36
|
|
|
36
37
|
export var ACTION_SUBJECT;
|
package/dist/esm/messages.js
CHANGED
|
@@ -14,6 +14,50 @@ export var headingAnchorLinkMessages = defineMessages({
|
|
|
14
14
|
id: 'fabric.editor.headingLink.failedToCopy',
|
|
15
15
|
defaultMessage: 'Copy failed',
|
|
16
16
|
description: 'failed to copy heading link to clipboard'
|
|
17
|
+
},
|
|
18
|
+
copyAriaLabel: {
|
|
19
|
+
id: 'fabric.editor.headingLink.copyAriaLabel',
|
|
20
|
+
defaultMessage: 'Copy',
|
|
21
|
+
description: 'copy aria label for link icon'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export var tableCellMessages = defineMessages({
|
|
25
|
+
noneSortingLabel: {
|
|
26
|
+
id: 'fabric.editor.headingLink.noneSortingLabel',
|
|
27
|
+
defaultMessage: 'none',
|
|
28
|
+
description: 'this table column is not sorted'
|
|
29
|
+
},
|
|
30
|
+
ascSortingLabel: {
|
|
31
|
+
id: 'fabric.editor.headingLink.ascSortingLabel',
|
|
32
|
+
defaultMessage: 'ascending',
|
|
33
|
+
description: 'this table column is sorted in ascending order'
|
|
34
|
+
},
|
|
35
|
+
descSortingLabel: {
|
|
36
|
+
id: 'fabric.editor.headingLink.noneSortingLabel',
|
|
37
|
+
defaultMessage: 'descending',
|
|
38
|
+
description: 'this table column is sorted in descending order'
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export var sortingIconMessages = defineMessages({
|
|
42
|
+
noOrderLabel: {
|
|
43
|
+
id: 'fabric.editor.headingLink.noOrderLabel',
|
|
44
|
+
defaultMessage: 'Sort column A to Z',
|
|
45
|
+
description: 'Sort the column in ascending order'
|
|
46
|
+
},
|
|
47
|
+
ascOrderLabel: {
|
|
48
|
+
id: 'fabric.editor.headingLink.ascOrderLabel',
|
|
49
|
+
defaultMessage: 'Sort column Z to A',
|
|
50
|
+
description: 'Sort the column in descending order'
|
|
51
|
+
},
|
|
52
|
+
descOrderLabel: {
|
|
53
|
+
id: 'fabric.editor.headingLink.descOrderLabel',
|
|
54
|
+
defaultMessage: 'Clear sorting',
|
|
55
|
+
description: 'clear the sorting from this column'
|
|
56
|
+
},
|
|
57
|
+
invalidLabel: {
|
|
58
|
+
id: 'fabric.editor.headingLink.descOrderLabel',
|
|
59
|
+
defaultMessage: "\u26A0\uFE0F You can't sort a table with merged cell",
|
|
60
|
+
description: 'this sort is invalid for merged cells'
|
|
17
61
|
}
|
|
18
62
|
});
|
|
19
63
|
export var codeBlockCopyButtonMessages = defineMessages({
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
|
|
3
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
var resizeObserver;
|
|
11
|
+
var nodeToCallback = new WeakMap();
|
|
12
|
+
export var useObservedWidth = function useObservedWidth(node, useObservedWidthFlag) {
|
|
13
|
+
var _React$useState = React.useState({
|
|
14
|
+
x: 0,
|
|
15
|
+
y: 0,
|
|
16
|
+
width: 0,
|
|
17
|
+
height: 0,
|
|
18
|
+
top: 0,
|
|
19
|
+
left: 0,
|
|
20
|
+
bottom: 0,
|
|
21
|
+
right: 0
|
|
22
|
+
}),
|
|
23
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
24
|
+
rect = _React$useState2[0],
|
|
25
|
+
setRect = _React$useState2[1];
|
|
26
|
+
|
|
27
|
+
React.useEffect(function () {
|
|
28
|
+
if (!node || !useObservedWidthFlag) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!resizeObserver) {
|
|
33
|
+
resizeObserver = new ResizeObserver(function (entries) {
|
|
34
|
+
var _iterator = _createForOfIteratorHelper(entries),
|
|
35
|
+
_step;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
39
|
+
var entry = _step.value;
|
|
40
|
+
|
|
41
|
+
if (nodeToCallback.has(entry.target)) {
|
|
42
|
+
nodeToCallback.get(entry.target)(entry.contentRect);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
_iterator.e(err);
|
|
47
|
+
} finally {
|
|
48
|
+
_iterator.f();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
nodeToCallback.set(node, function (rect) {
|
|
54
|
+
var x = rect.x,
|
|
55
|
+
y = rect.y,
|
|
56
|
+
width = rect.width,
|
|
57
|
+
height = rect.height,
|
|
58
|
+
top = rect.top,
|
|
59
|
+
left = rect.left,
|
|
60
|
+
bottom = rect.bottom,
|
|
61
|
+
right = rect.right;
|
|
62
|
+
return setRect({
|
|
63
|
+
x: x,
|
|
64
|
+
y: y,
|
|
65
|
+
width: width,
|
|
66
|
+
height: height,
|
|
67
|
+
top: top,
|
|
68
|
+
left: left,
|
|
69
|
+
bottom: bottom,
|
|
70
|
+
right: right
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
resizeObserver.observe(node);
|
|
74
|
+
return function () {
|
|
75
|
+
resizeObserver.unobserve(node);
|
|
76
|
+
nodeToCallback.delete(node);
|
|
77
|
+
};
|
|
78
|
+
}, [node, useObservedWidthFlag]);
|
|
79
|
+
return rect;
|
|
80
|
+
};
|
package/dist/esm/react/index.js
CHANGED
|
@@ -193,6 +193,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
193
193
|
this.allowAnnotations = Boolean(init.allowAnnotations);
|
|
194
194
|
this.surroundTextNodesWithTextWrapper = Boolean(init.surroundTextNodesWithTextWrapper);
|
|
195
195
|
this.media = init.media;
|
|
196
|
+
this.smartLinks = init.smartLinks;
|
|
196
197
|
this.allowSelectAllTrap = init.allowSelectAllTrap;
|
|
197
198
|
}
|
|
198
199
|
|
|
@@ -557,6 +558,7 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
557
558
|
fireAnalyticsEvent: this.fireAnalyticsEvent,
|
|
558
559
|
nodeType: node.type.name,
|
|
559
560
|
marks: node.marks,
|
|
561
|
+
smartLinks: this.smartLinks,
|
|
560
562
|
dataAttributes: {
|
|
561
563
|
// We need to account for depth (path.length gives up depth) here
|
|
562
564
|
// but depth doesnt increment the pos, only accounted for.
|
|
@@ -79,7 +79,8 @@ var Provider = CopyTextContext.Provider,
|
|
|
79
79
|
Consumer = CopyTextContext.Consumer;
|
|
80
80
|
export var CopyArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
81
81
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
82
|
-
ref: ref
|
|
82
|
+
ref: ref // eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
|
|
83
|
+
,
|
|
83
84
|
style: {
|
|
84
85
|
position: 'absolute',
|
|
85
86
|
left: '-9999px',
|
|
@@ -63,11 +63,17 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
63
63
|
var isClicked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
64
64
|
|
|
65
65
|
_this.setState({
|
|
66
|
+
// TODO: ED-14403 investigate why this does not translate
|
|
66
67
|
tooltipMessage: _this.props.intl.formatMessage(message),
|
|
67
68
|
isClicked: isClicked
|
|
68
69
|
});
|
|
69
70
|
});
|
|
70
71
|
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "getCopyAriaLabel", function () {
|
|
73
|
+
var copyAriaLabel = headingAnchorLinkMessages.copyAriaLabel;
|
|
74
|
+
return _this.props.intl.formatMessage(copyAriaLabel);
|
|
75
|
+
});
|
|
76
|
+
|
|
71
77
|
_defineProperty(_assertThisInitialized(_this), "copyToClipboard", /*#__PURE__*/function () {
|
|
72
78
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
73
79
|
var copiedHeadingLinkToClipboard, failedToCopyHeadingLink;
|
|
@@ -113,9 +119,10 @@ var HeadingAnchor = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
113
119
|
_defineProperty(_assertThisInitialized(_this), "renderAnchorButton", function () {
|
|
114
120
|
return /*#__PURE__*/React.createElement(CopyAnchorButton, {
|
|
115
121
|
onMouseLeave: _this.resetMessage,
|
|
116
|
-
onClick: _this.copyToClipboard
|
|
122
|
+
onClick: _this.copyToClipboard,
|
|
123
|
+
"aria-label": _this.state.tooltipMessage
|
|
117
124
|
}, /*#__PURE__*/React.createElement(LinkIcon, {
|
|
118
|
-
label:
|
|
125
|
+
label: _this.getCopyAriaLabel(),
|
|
119
126
|
size: _this.props.level > 3 ? 'small' : 'medium',
|
|
120
127
|
primaryColor: _this.state.isClicked ? B400 : N200
|
|
121
128
|
}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Card } from '@atlaskit/smart-card';
|
|
4
|
+
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
4
5
|
import { UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
5
6
|
import { CardErrorBoundary } from './fallback';
|
|
6
7
|
import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
@@ -10,7 +11,8 @@ var InlineCard = function InlineCard(props) {
|
|
|
10
11
|
var url = props.url,
|
|
11
12
|
data = props.data,
|
|
12
13
|
eventHandlers = props.eventHandlers,
|
|
13
|
-
portal = props.portal
|
|
14
|
+
portal = props.portal,
|
|
15
|
+
smartLinks = props.smartLinks;
|
|
14
16
|
var onClick = getCardClickHandler(eventHandlers, url);
|
|
15
17
|
var cardProps = {
|
|
16
18
|
url: url,
|
|
@@ -18,6 +20,14 @@ var InlineCard = function InlineCard(props) {
|
|
|
18
20
|
onClick: onClick,
|
|
19
21
|
container: portal
|
|
20
22
|
};
|
|
23
|
+
|
|
24
|
+
if (smartLinks !== null && smartLinks !== void 0 && smartLinks.ssr && url) {
|
|
25
|
+
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
26
|
+
appearance: "inline",
|
|
27
|
+
url: url
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
21
31
|
return /*#__PURE__*/React.createElement("span", {
|
|
22
32
|
"data-inline-card": true,
|
|
23
33
|
"data-card-data": data ? JSON.stringify(data) : undefined,
|