@atlaskit/editor-plugin-card 1.14.4 → 1.14.5
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 +8 -0
- package/dist/cjs/nodeviews/datasource.js +1 -0
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +4 -1
- package/dist/cjs/ui/AwarenessWrapper/index.js +20 -18
- package/dist/cjs/ui/DatasourceModal/index.js +4 -5
- package/dist/cjs/ui/InlineCardOverlay/index.js +9 -3
- package/dist/cjs/ui/{NewInlineCardOverlay → LeftIconOverlay}/index.js +60 -101
- package/dist/cjs/ui/ResizableEmbedCard.js +3 -0
- package/dist/es2019/nodeviews/datasource.js +1 -0
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +4 -1
- package/dist/es2019/ui/AwarenessWrapper/index.js +20 -18
- package/dist/es2019/ui/DatasourceModal/index.js +4 -5
- package/dist/es2019/ui/InlineCardOverlay/index.js +9 -3
- package/dist/es2019/ui/{NewInlineCardOverlay → LeftIconOverlay}/index.js +51 -94
- package/dist/es2019/ui/ResizableEmbedCard.js +4 -0
- package/dist/esm/nodeviews/datasource.js +1 -0
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +4 -1
- package/dist/esm/ui/AwarenessWrapper/index.js +20 -18
- package/dist/esm/ui/DatasourceModal/index.js +4 -5
- package/dist/esm/ui/InlineCardOverlay/index.js +9 -3
- package/dist/esm/ui/{NewInlineCardOverlay → LeftIconOverlay}/index.js +62 -103
- package/dist/esm/ui/ResizableEmbedCard.js +3 -0
- package/dist/types/ui/LeftIconOverlay/index.d.ts +10 -0
- package/dist/types-ts4.5/ui/LeftIconOverlay/index.d.ts +10 -0
- package/package.json +4 -3
- package/dist/types/ui/NewInlineCardOverlay/index.d.ts +0 -6
- package/dist/types-ts4.5/ui/NewInlineCardOverlay/index.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 1.14.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#102324](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102324)
|
|
8
|
+
[`e9618cb8df77`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e9618cb8df77) -
|
|
9
|
+
make columnCustomSizes passed down to config modal to be empty object instead of undefined
|
|
10
|
+
|
|
3
11
|
## 1.14.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -281,6 +281,7 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
281
281
|
url: attrs.url,
|
|
282
282
|
datasourceId: attrs === null || attrs === void 0 || (_attrs$datasource = attrs.datasource) === null || _attrs$datasource === void 0 ? void 0 : _attrs$datasource.id
|
|
283
283
|
}, (0, _react2.jsx)("div", {
|
|
284
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
284
285
|
className: _styles.DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
285
286
|
style: {
|
|
286
287
|
minWidth: this.isNodeNested ? '100%' : (0, _utils.calcBreakoutWidth)(attrs.layout || _linkingCommon.DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
|
|
@@ -130,7 +130,10 @@ var InlineCard = function InlineCard(_ref) {
|
|
|
130
130
|
markMostRecentlyInsertedLink: markMostRecentlyInsertedLink,
|
|
131
131
|
pluginInjectionApi: pluginInjectionApi,
|
|
132
132
|
setOverlayHoveredStyles: setOverlayHoveredStyles
|
|
133
|
-
}, innerCard) :
|
|
133
|
+
}, innerCard) :
|
|
134
|
+
/*#__PURE__*/
|
|
135
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
136
|
+
_react.default.createElement("span", {
|
|
134
137
|
className: "card"
|
|
135
138
|
}, innerCard);
|
|
136
139
|
}, [cardContext, getPos, innerCard, isHovered, isInserted, isOverlayEnabled, isPulseEnabled, isResolvedViewRendered, isSelected, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url]);
|
|
@@ -14,7 +14,7 @@ var _useLinkUpgradeDiscoverability = _interopRequireDefault(require("../../commo
|
|
|
14
14
|
var _localStorage = require("../../common/local-storage");
|
|
15
15
|
var _utils = require("../../utils");
|
|
16
16
|
var _InlineCardOverlay = _interopRequireDefault(require("../InlineCardOverlay"));
|
|
17
|
-
var
|
|
17
|
+
var _LeftIconOverlay = _interopRequireDefault(require("../LeftIconOverlay"));
|
|
18
18
|
var _Pulse = require("../Pulse");
|
|
19
19
|
/** @jsx jsx */
|
|
20
20
|
|
|
@@ -81,7 +81,7 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
|
|
|
81
81
|
var cardWithOverlay = (0, _react.useMemo)(function () {
|
|
82
82
|
if (shouldShowLinkOverlay) {
|
|
83
83
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-links-in-live-pages')) {
|
|
84
|
-
return (0, _react2.jsx)(
|
|
84
|
+
return (0, _react2.jsx)(_LeftIconOverlay.default, {
|
|
85
85
|
isSelected: isSelected,
|
|
86
86
|
isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
|
|
87
87
|
onMouseEnter: function onMouseEnter() {
|
|
@@ -89,8 +89,7 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
|
|
|
89
89
|
},
|
|
90
90
|
onMouseLeave: function onMouseLeave() {
|
|
91
91
|
return handleOverlayChange(false);
|
|
92
|
-
}
|
|
93
|
-
url: url
|
|
92
|
+
}
|
|
94
93
|
}, children);
|
|
95
94
|
}
|
|
96
95
|
return (0, _react2.jsx)(_InlineCardOverlay.default, {
|
|
@@ -109,19 +108,22 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
|
|
|
109
108
|
}, [shouldShowLinkOverlay, isSelected, isResolvedViewRendered, isInserted, isHovered, url, children, handleOverlayChange]);
|
|
110
109
|
return (0, _react.useMemo)(function () {
|
|
111
110
|
var _cardContext$value;
|
|
112
|
-
return (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
return (
|
|
112
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
113
|
+
(0, _react2.jsx)("span", {
|
|
114
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
115
|
+
className: "card"
|
|
116
|
+
}, (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
|
|
117
|
+
data: {
|
|
118
|
+
attributes: (0, _utils.getResolvedAttributesFromStore)(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
|
|
119
|
+
}
|
|
120
|
+
}, (0, _react2.jsx)(_Pulse.DiscoveryPulse, {
|
|
121
|
+
localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
122
|
+
localStorageKeyExpirationInMs: _localStorage.ONE_DAY_IN_MILLISECONDS,
|
|
123
|
+
discoveryMode: "start",
|
|
124
|
+
shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
|
|
125
|
+
testId: "link-discovery-pulse"
|
|
126
|
+
}, cardWithOverlay)))
|
|
127
|
+
);
|
|
126
128
|
}, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay]);
|
|
127
129
|
};
|
|
@@ -34,7 +34,7 @@ var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
|
|
|
34
34
|
var onClose = (0, _react.useCallback)(function () {
|
|
35
35
|
dispatch((0, _actions.hideDatasourceModal)(transaction));
|
|
36
36
|
}, [dispatch, transaction]);
|
|
37
|
-
var
|
|
37
|
+
var updateAdf = useUpdateAdf(view, existingNode);
|
|
38
38
|
var isRegularCardNode = !!(existingNode && !(existingNode !== null && existingNode !== void 0 && (_existingNode$attrs = existingNode.attrs) !== null && _existingNode$attrs !== void 0 && _existingNode$attrs.datasource));
|
|
39
39
|
var _ref2 = (existingNode === null || existingNode === void 0 || (_existingNode$attrs2 = existingNode.attrs) === null || _existingNode$attrs2 === void 0 ? void 0 : _existingNode$attrs2.datasource) || {},
|
|
40
40
|
_ref2$id = _ref2.id,
|
|
@@ -67,10 +67,10 @@ var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
|
|
|
67
67
|
columnCustomSizes: columnCustomSizes,
|
|
68
68
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
69
69
|
onCancel: onClose,
|
|
70
|
-
onInsert:
|
|
70
|
+
onInsert: updateAdf
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
|
-
var
|
|
73
|
+
var useUpdateAdf = function useUpdateAdf(view, existingNode) {
|
|
74
74
|
return (0, _react.useCallback)(function (newAdf, analyticEvent) {
|
|
75
75
|
if (analyticEvent) {
|
|
76
76
|
analyticEvent.update(function (payload) {
|
|
@@ -121,10 +121,9 @@ var resolveColumnsConfig = function resolveColumnsConfig(views) {
|
|
|
121
121
|
tableView = _views[0];
|
|
122
122
|
var visibleColumnKeys = [];
|
|
123
123
|
var wrappedColumnKeys = [];
|
|
124
|
-
var columnCustomSizes;
|
|
124
|
+
var columnCustomSizes = {};
|
|
125
125
|
var columns = tableView === null || tableView === void 0 || (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns;
|
|
126
126
|
if (columns) {
|
|
127
|
-
columnCustomSizes = {};
|
|
128
127
|
var _iterator = _createForOfIteratorHelper(columns),
|
|
129
128
|
_step;
|
|
130
129
|
try {
|
|
@@ -241,7 +241,9 @@ var InlineCardOverlay = function InlineCardOverlay(_ref) {
|
|
|
241
241
|
}, (0, _react2.jsx)("span", {
|
|
242
242
|
css: overflowingContainerStyles
|
|
243
243
|
}, (0, _react2.jsx)("span", {
|
|
244
|
-
css: iconAndLabelStyles
|
|
244
|
+
css: iconAndLabelStyles
|
|
245
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
246
|
+
,
|
|
245
247
|
className: ICON_AND_LABEL_CLASSNAME
|
|
246
248
|
}, (0, _react2.jsx)("span", {
|
|
247
249
|
css: iconStyles
|
|
@@ -250,11 +252,15 @@ var InlineCardOverlay = function InlineCardOverlay(_ref) {
|
|
|
250
252
|
size: iconSize.current,
|
|
251
253
|
testId: "".concat(testId, "-icon")
|
|
252
254
|
})), showLabel && (0, _react2.jsx)("span", {
|
|
253
|
-
css: labelStyles
|
|
255
|
+
css: labelStyles
|
|
256
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
257
|
+
,
|
|
254
258
|
className: OVERLAY_LABEL_CLASSNAME,
|
|
255
259
|
"data-testid": "".concat(testId, "-label")
|
|
256
260
|
}, label)), (0, _react2.jsx)("span", {
|
|
257
|
-
css: gradientStyles
|
|
261
|
+
css: gradientStyles
|
|
262
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
263
|
+
,
|
|
258
264
|
className: OVERLAY_GRADIENT_CLASSNAME,
|
|
259
265
|
"data-testid": "".concat(testId, "-gradient")
|
|
260
266
|
})))));
|
|
@@ -9,7 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
13
|
var _react2 = require("@emotion/react");
|
|
15
14
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
@@ -18,77 +17,74 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
18
17
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
19
18
|
var _preferences = _interopRequireDefault(require("@atlaskit/icon/glyph/preferences"));
|
|
20
19
|
var _colors = require("@atlaskit/theme/colors");
|
|
20
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
21
21
|
var _utils2 = require("../InlineCardOverlay/utils");
|
|
22
|
-
var _excluded = ["children", "isSelected", "isVisible", "testId"
|
|
22
|
+
var _excluded = ["children", "isSelected", "isVisible", "testId"];
|
|
23
23
|
/* eslint-disable @atlaskit/design-system/no-nested-styles */
|
|
24
24
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
25
25
|
/** @jsx jsx */
|
|
26
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
27
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
28
|
var DEBOUNCE_IN_MS = 5;
|
|
29
|
-
var ESTIMATED_MIN_WIDTH_IN_PX = 16;
|
|
30
29
|
var PADDING_IN_PX = 4;
|
|
31
|
-
var ICON_WIDTH_IN_PX =
|
|
30
|
+
var ICON_WIDTH_IN_PX = 16;
|
|
32
31
|
var ICON_AND_LABEL_CLASSNAME = 'ak-editor-card-overlay-icon-and-label';
|
|
33
|
-
var OVERLAY_LABEL_CLASSNAME = 'ak-editor-card-overlay-label';
|
|
34
32
|
var OVERLAY_MARKER_CLASSNAME = 'ak-editor-card-overlay-marker';
|
|
35
33
|
var TEXT_NODE_SELECTOR = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].join(',');
|
|
36
34
|
var SMART_LINK_BACKGROUND_COLOR = "var(--ds-surface-raised, ".concat(_colors.N0, ")");
|
|
37
|
-
|
|
38
|
-
var
|
|
35
|
+
var CONFIGURE_ICON_BACKGROUND_COLOR = "var(--ds-background-neutral, ".concat(_colors.N30A, ")");
|
|
36
|
+
var CONFIGURE_ICON_BACKGROUND_HOVERED_COLOR = "var(--ds-background-neutral-hovered, ".concat(_colors.N40A, ")");
|
|
37
|
+
var CONFIGURE_ICON_BACKGROUND_ACTIVE_COLOR = "var(--ds-background-neutral-pressed, ".concat(_colors.N60A, ")");
|
|
39
38
|
var containerStyles = (0, _react2.css)({
|
|
40
39
|
position: 'relative',
|
|
41
|
-
lineHeight: 'normal'
|
|
42
|
-
':active': (0, _defineProperty2.default)({}, ".".concat(ICON_AND_LABEL_CLASSNAME), {
|
|
43
|
-
background: SMART_LINK_ACTIVE_COLOR
|
|
44
|
-
})
|
|
40
|
+
lineHeight: 'normal'
|
|
45
41
|
});
|
|
46
42
|
var overlayStyles = (0, _react2.css)({
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
// Vertically align. Required for overlay to be centered inside the inline link (the inline lozenge is slightly larger than the designs)
|
|
45
|
+
transform: 'translate(0%, -50%)',
|
|
46
|
+
top: '50%',
|
|
47
47
|
// Set default styling to be invisible but available in dom for width calculation.
|
|
48
48
|
visibility: 'hidden',
|
|
49
|
-
marginTop: "var(--ds-space-050, 4px)",
|
|
50
|
-
position: 'absolute',
|
|
51
|
-
verticalAlign: 'text-top',
|
|
52
|
-
height: '1lh',
|
|
53
|
-
'@supports not (height: 1lh)': {
|
|
54
|
-
height: '1.2em'
|
|
55
|
-
},
|
|
56
49
|
overflow: 'hidden',
|
|
57
50
|
// EDM-1717: box-shadow Safari fix bring load wrapper zIndex to 1
|
|
58
|
-
zIndex: 2
|
|
59
|
-
pointerEvents: 'none'
|
|
51
|
+
zIndex: 2
|
|
60
52
|
});
|
|
61
53
|
var showOverlayStyles = (0, _react2.css)({
|
|
62
54
|
visibility: 'visible'
|
|
63
55
|
});
|
|
64
56
|
var iconStyles = (0, _react2.css)({
|
|
65
|
-
|
|
57
|
+
background: CONFIGURE_ICON_BACKGROUND_COLOR,
|
|
58
|
+
':hover': {
|
|
59
|
+
background: CONFIGURE_ICON_BACKGROUND_HOVERED_COLOR
|
|
60
|
+
},
|
|
61
|
+
':active': {
|
|
62
|
+
background: CONFIGURE_ICON_BACKGROUND_ACTIVE_COLOR
|
|
63
|
+
},
|
|
66
64
|
span: {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
// If PreferencesIcon left as inline-block (default), height is incorrect and border radius is clipped when parent element
|
|
66
|
+
// uses 1lh height (rather than 100%)
|
|
67
|
+
display: 'block'
|
|
68
|
+
},
|
|
69
|
+
// Note: The spec recomends 3px, but the icon doesn't fit left of the lozenge text if this size
|
|
70
|
+
padding: "var(--ds-space-025, 2px)",
|
|
71
|
+
borderRadius: '3px'
|
|
74
72
|
});
|
|
75
73
|
var iconAndLabelStyles = (0, _react2.css)({
|
|
76
74
|
display: 'flex',
|
|
77
75
|
alignItems: 'center',
|
|
78
76
|
height: '100%',
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-space
|
|
78
|
+
marginLeft: '2.5px',
|
|
79
|
+
// Margin from very left of entire card (inclusive of blue)
|
|
80
|
+
|
|
81
|
+
// This exists so if we set a semi-transparent background above, the provider icon doesn't show
|
|
81
82
|
background: SMART_LINK_BACKGROUND_COLOR,
|
|
83
|
+
// Ensure we don't have a white gap when the inline-card is in an active state
|
|
84
|
+
borderRadius: '3px',
|
|
82
85
|
color: "var(--ds-text-subtlest, ".concat(_colors.N700, ")")
|
|
83
86
|
});
|
|
84
|
-
var
|
|
85
|
-
display: 'flex',
|
|
86
|
-
flexDirection: 'row-reverse',
|
|
87
|
-
alignItems: 'center',
|
|
88
|
-
width: 'max-content',
|
|
89
|
-
height: '100%'
|
|
90
|
-
});
|
|
91
|
-
var NarrowInlineCardOverlay = function NarrowInlineCardOverlay(_ref) {
|
|
87
|
+
var LeftIconOverlay = function LeftIconOverlay(_ref) {
|
|
92
88
|
var children = _ref.children,
|
|
93
89
|
_ref$isSelected = _ref.isSelected,
|
|
94
90
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
@@ -96,7 +92,6 @@ var NarrowInlineCardOverlay = function NarrowInlineCardOverlay(_ref) {
|
|
|
96
92
|
isVisible = _ref$isVisible === void 0 ? false : _ref$isVisible,
|
|
97
93
|
_ref$testId = _ref.testId,
|
|
98
94
|
testId = _ref$testId === void 0 ? 'inline-card-overlay' : _ref$testId,
|
|
99
|
-
url = _ref.url,
|
|
100
95
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
101
96
|
var _useState = (0, _react.useState)(false),
|
|
102
97
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -106,16 +101,13 @@ var NarrowInlineCardOverlay = function NarrowInlineCardOverlay(_ref) {
|
|
|
106
101
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
107
102
|
availableWidth = _useState4[0],
|
|
108
103
|
setAvailableWidth = _useState4[1];
|
|
109
|
-
var maxOverlayWidth = (0, _react.useRef)(0);
|
|
110
|
-
var minOverlayWidth = (0, _react.useRef)(ESTIMATED_MIN_WIDTH_IN_PX);
|
|
111
|
-
var parentWidth = (0, _react.useRef)(0);
|
|
112
|
-
var iconSize = (0, _react.useRef)('small');
|
|
113
104
|
var containerRef = (0, _react.useRef)(null);
|
|
114
105
|
|
|
115
|
-
// TODO EDM-
|
|
106
|
+
// TODO EDM-9853: Use availableWidth for small link edge case
|
|
107
|
+
// Calculation logic will need to updated.
|
|
116
108
|
availableWidth;
|
|
117
109
|
var setVisibility = (0, _react.useCallback)(function () {
|
|
118
|
-
if (!containerRef.current
|
|
110
|
+
if (!containerRef.current) {
|
|
119
111
|
return;
|
|
120
112
|
}
|
|
121
113
|
var marker = (0, _utils2.getChildElement)(containerRef, ".".concat(OVERLAY_MARKER_CLASSNAME));
|
|
@@ -140,29 +132,9 @@ var NarrowInlineCardOverlay = function NarrowInlineCardOverlay(_ref) {
|
|
|
140
132
|
}
|
|
141
133
|
}, [isSelected]);
|
|
142
134
|
(0, _react.useLayoutEffect)(function () {
|
|
143
|
-
// Using useLayoutEffect here.
|
|
144
|
-
// 1) We want all to be able to determine whether to display label before
|
|
145
|
-
// the overlay becomes visible.
|
|
146
|
-
// 2) We need to wait for the refs to be assigned to be able to do determine
|
|
147
|
-
// the width of the overlay.
|
|
148
135
|
if (!containerRef.current) {
|
|
149
136
|
return;
|
|
150
137
|
}
|
|
151
|
-
|
|
152
|
-
// This should run only once
|
|
153
|
-
if (!maxOverlayWidth.current) {
|
|
154
|
-
var iconAndLabel = (0, _utils2.getChildElement)(containerRef, ".".concat(ICON_AND_LABEL_CLASSNAME));
|
|
155
|
-
var _label = (0, _utils2.getChildElement)(containerRef, ".".concat(OVERLAY_LABEL_CLASSNAME));
|
|
156
|
-
if (iconAndLabel && _label) {
|
|
157
|
-
// Set overlay max (label + icon) and min (icon only) width.
|
|
158
|
-
var _getOverlayWidths = (0, _utils2.getOverlayWidths)(iconAndLabel, _label),
|
|
159
|
-
max = _getOverlayWidths.max,
|
|
160
|
-
min = _getOverlayWidths.min;
|
|
161
|
-
maxOverlayWidth.current = max;
|
|
162
|
-
minOverlayWidth.current = min;
|
|
163
|
-
iconSize.current = (0, _utils2.getIconSize)(_label);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
138
|
if (isVisible) {
|
|
167
139
|
setVisibility();
|
|
168
140
|
}
|
|
@@ -183,13 +155,6 @@ var NarrowInlineCardOverlay = function NarrowInlineCardOverlay(_ref) {
|
|
|
183
155
|
if (!size) {
|
|
184
156
|
return;
|
|
185
157
|
}
|
|
186
|
-
if (!parentWidth.current) {
|
|
187
|
-
parentWidth.current = size;
|
|
188
|
-
}
|
|
189
|
-
if (parentWidth.current === size) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
parentWidth.current = size;
|
|
193
158
|
setVisibility();
|
|
194
159
|
}, DEBOUNCE_IN_MS);
|
|
195
160
|
var observer = new ResizeObserver(updateOverlay);
|
|
@@ -199,36 +164,30 @@ var NarrowInlineCardOverlay = function NarrowInlineCardOverlay(_ref) {
|
|
|
199
164
|
};
|
|
200
165
|
}, [isVisible, setVisibility]);
|
|
201
166
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
202
|
-
var
|
|
167
|
+
var configureLinkLabel = intl.formatMessage(_messages.cardMessages.inlineConfigureLink);
|
|
203
168
|
return (0, _react2.jsx)("span", (0, _extends2.default)({}, props, {
|
|
204
169
|
css: containerStyles,
|
|
205
170
|
ref: containerRef
|
|
206
|
-
}), isVisible && (0, _react2.jsx)(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
testId: "".concat(testId, "-icon")
|
|
228
|
-
})), (0, _react2.jsx)("span", {
|
|
229
|
-
css: labelStyles,
|
|
230
|
-
className: OVERLAY_LABEL_CLASSNAME,
|
|
231
|
-
"data-testid": "".concat(testId, "-label")
|
|
232
|
-
}))))), children);
|
|
171
|
+
}), isVisible && (0, _react2.jsx)(_tooltip.default, {
|
|
172
|
+
content: configureLinkLabel
|
|
173
|
+
}, function (tooltipProps) {
|
|
174
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("span", {
|
|
175
|
+
"aria-hidden": "true",
|
|
176
|
+
className: OVERLAY_MARKER_CLASSNAME
|
|
177
|
+
}, _utils.ZERO_WIDTH_JOINER), (0, _react2.jsx)("span", {
|
|
178
|
+
css: [overlayStyles, showOverlay && showOverlayStyles],
|
|
179
|
+
tabIndex: -1,
|
|
180
|
+
"data-testid": testId
|
|
181
|
+
}, (0, _react2.jsx)("span", (0, _extends2.default)({}, tooltipProps, {
|
|
182
|
+
css: iconAndLabelStyles,
|
|
183
|
+
className: ICON_AND_LABEL_CLASSNAME
|
|
184
|
+
}), (0, _react2.jsx)("span", {
|
|
185
|
+
css: iconStyles
|
|
186
|
+
}, (0, _react2.jsx)(_preferences.default, {
|
|
187
|
+
label: configureLinkLabel,
|
|
188
|
+
size: 'small',
|
|
189
|
+
testId: "".concat(testId, "-icon")
|
|
190
|
+
})))));
|
|
191
|
+
}), children);
|
|
233
192
|
};
|
|
234
|
-
var _default = exports.default =
|
|
193
|
+
var _default = exports.default = LeftIconOverlay;
|
|
@@ -314,9 +314,12 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
|
|
|
314
314
|
return (0, _react2.jsx)("span", {
|
|
315
315
|
"data-testid": 'resizable-embed-card-height-definer',
|
|
316
316
|
style: _objectSpread({
|
|
317
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
317
318
|
display: 'block',
|
|
318
319
|
/* Fixes extra padding problem in Firefox */
|
|
320
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
319
321
|
fontSize: 0,
|
|
322
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
320
323
|
lineHeight: 0
|
|
321
324
|
}, heightDefiningStyles)
|
|
322
325
|
});
|
|
@@ -229,6 +229,7 @@ export class Datasource extends ReactNodeView {
|
|
|
229
229
|
url: attrs.url,
|
|
230
230
|
datasourceId: attrs === null || attrs === void 0 ? void 0 : (_attrs$datasource = attrs.datasource) === null || _attrs$datasource === void 0 ? void 0 : _attrs$datasource.id
|
|
231
231
|
}, jsx("div", {
|
|
232
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
232
233
|
className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
233
234
|
style: {
|
|
234
235
|
minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout || DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
|
|
@@ -109,7 +109,10 @@ const InlineCard = ({
|
|
|
109
109
|
markMostRecentlyInsertedLink: markMostRecentlyInsertedLink,
|
|
110
110
|
pluginInjectionApi: pluginInjectionApi,
|
|
111
111
|
setOverlayHoveredStyles: setOverlayHoveredStyles
|
|
112
|
-
}, innerCard) :
|
|
112
|
+
}, innerCard) :
|
|
113
|
+
/*#__PURE__*/
|
|
114
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
115
|
+
React.createElement("span", {
|
|
113
116
|
className: "card"
|
|
114
117
|
}, innerCard);
|
|
115
118
|
}, [cardContext, getPos, innerCard, isHovered, isInserted, isOverlayEnabled, isPulseEnabled, isResolvedViewRendered, isSelected, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url]);
|
|
@@ -7,7 +7,7 @@ import useLinkUpgradeDiscoverability from '../../common/hooks/useLinkUpgradeDisc
|
|
|
7
7
|
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../../common/local-storage';
|
|
8
8
|
import { getResolvedAttributesFromStore } from '../../utils';
|
|
9
9
|
import InlineCardOverlay from '../InlineCardOverlay';
|
|
10
|
-
import
|
|
10
|
+
import LeftIconOverlay from '../LeftIconOverlay';
|
|
11
11
|
import { DiscoveryPulse } from '../Pulse';
|
|
12
12
|
// editor adds a standard line-height that is bigger than an inline smart link
|
|
13
13
|
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
@@ -71,12 +71,11 @@ export const AwarenessWrapper = ({
|
|
|
71
71
|
const cardWithOverlay = useMemo(() => {
|
|
72
72
|
if (shouldShowLinkOverlay) {
|
|
73
73
|
if (getBooleanFF('platform.linking-platform.smart-links-in-live-pages')) {
|
|
74
|
-
return jsx(
|
|
74
|
+
return jsx(LeftIconOverlay, {
|
|
75
75
|
isSelected: isSelected,
|
|
76
76
|
isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
|
|
77
77
|
onMouseEnter: () => handleOverlayChange(true),
|
|
78
|
-
onMouseLeave: () => handleOverlayChange(false)
|
|
79
|
-
url: url
|
|
78
|
+
onMouseLeave: () => handleOverlayChange(false)
|
|
80
79
|
}, children);
|
|
81
80
|
}
|
|
82
81
|
return jsx(InlineCardOverlay, {
|
|
@@ -91,19 +90,22 @@ export const AwarenessWrapper = ({
|
|
|
91
90
|
}, [shouldShowLinkOverlay, isSelected, isResolvedViewRendered, isInserted, isHovered, url, children, handleOverlayChange]);
|
|
92
91
|
return useMemo(() => {
|
|
93
92
|
var _cardContext$value;
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
return (
|
|
94
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
95
|
+
jsx("span", {
|
|
96
|
+
css: shouldShowLinkPulse && loaderWrapperStyles,
|
|
97
|
+
className: "card"
|
|
98
|
+
}, jsx(AnalyticsContext, {
|
|
99
|
+
data: {
|
|
100
|
+
attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
|
|
101
|
+
}
|
|
102
|
+
}, jsx(DiscoveryPulse, {
|
|
103
|
+
localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
|
|
104
|
+
localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
|
|
105
|
+
discoveryMode: "start",
|
|
106
|
+
shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
|
|
107
|
+
testId: "link-discovery-pulse"
|
|
108
|
+
}, cardWithOverlay)))
|
|
109
|
+
);
|
|
108
110
|
}, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay]);
|
|
109
111
|
};
|
|
@@ -24,7 +24,7 @@ export const DatasourceModal = ({
|
|
|
24
24
|
const onClose = useCallback(() => {
|
|
25
25
|
dispatch(hideDatasourceModal(transaction));
|
|
26
26
|
}, [dispatch, transaction]);
|
|
27
|
-
const
|
|
27
|
+
const updateAdf = useUpdateAdf(view, existingNode);
|
|
28
28
|
const isRegularCardNode = !!(existingNode && !(existingNode !== null && existingNode !== void 0 && (_existingNode$attrs = existingNode.attrs) !== null && _existingNode$attrs !== void 0 && _existingNode$attrs.datasource));
|
|
29
29
|
const {
|
|
30
30
|
id: datasourceId = defaultDatasourceId,
|
|
@@ -58,10 +58,10 @@ export const DatasourceModal = ({
|
|
|
58
58
|
columnCustomSizes: columnCustomSizes,
|
|
59
59
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
60
60
|
onCancel: onClose,
|
|
61
|
-
onInsert:
|
|
61
|
+
onInsert: updateAdf
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
-
const
|
|
64
|
+
const useUpdateAdf = (view, existingNode) => {
|
|
65
65
|
return useCallback((newAdf, analyticEvent) => {
|
|
66
66
|
if (analyticEvent) {
|
|
67
67
|
analyticEvent.update(payload => ({
|
|
@@ -111,10 +111,9 @@ const resolveColumnsConfig = views => {
|
|
|
111
111
|
const [tableView] = views;
|
|
112
112
|
const visibleColumnKeys = [];
|
|
113
113
|
const wrappedColumnKeys = [];
|
|
114
|
-
|
|
114
|
+
const columnCustomSizes = {};
|
|
115
115
|
const columns = tableView === null || tableView === void 0 ? void 0 : (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns;
|
|
116
116
|
if (columns) {
|
|
117
|
-
columnCustomSizes = {};
|
|
118
117
|
for (const {
|
|
119
118
|
key,
|
|
120
119
|
width,
|
|
@@ -217,7 +217,9 @@ const InlineCardOverlay = ({
|
|
|
217
217
|
}, jsx("span", {
|
|
218
218
|
css: overflowingContainerStyles
|
|
219
219
|
}, jsx("span", {
|
|
220
|
-
css: iconAndLabelStyles
|
|
220
|
+
css: iconAndLabelStyles
|
|
221
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
222
|
+
,
|
|
221
223
|
className: ICON_AND_LABEL_CLASSNAME
|
|
222
224
|
}, jsx("span", {
|
|
223
225
|
css: iconStyles
|
|
@@ -226,11 +228,15 @@ const InlineCardOverlay = ({
|
|
|
226
228
|
size: iconSize.current,
|
|
227
229
|
testId: `${testId}-icon`
|
|
228
230
|
})), showLabel && jsx("span", {
|
|
229
|
-
css: labelStyles
|
|
231
|
+
css: labelStyles
|
|
232
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
233
|
+
,
|
|
230
234
|
className: OVERLAY_LABEL_CLASSNAME,
|
|
231
235
|
"data-testid": `${testId}-label`
|
|
232
236
|
}, label)), jsx("span", {
|
|
233
|
-
css: gradientStyles
|
|
237
|
+
css: gradientStyles
|
|
238
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
239
|
+
,
|
|
234
240
|
className: OVERLAY_GRADIENT_CLASSNAME,
|
|
235
241
|
"data-testid": `${testId}-gradient`
|
|
236
242
|
})))));
|