@atlaskit/editor-plugin-card 11.4.5 → 11.5.1
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 +17 -0
- package/dist/cjs/nodeviews/blockCard.js +2 -1
- package/dist/cjs/nodeviews/embedCard.js +2 -1
- package/dist/cjs/nodeviews/inlineCard.js +3 -0
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +5 -1
- package/dist/cjs/ui/ConfigureOverlay/index.js +22 -25
- package/dist/es2019/nodeviews/blockCard.js +2 -0
- package/dist/es2019/nodeviews/embedCard.js +2 -0
- package/dist/es2019/nodeviews/inlineCard.js +2 -0
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +5 -1
- package/dist/es2019/ui/ConfigureOverlay/index.js +22 -25
- package/dist/esm/nodeviews/blockCard.js +2 -0
- package/dist/esm/nodeviews/embedCard.js +2 -0
- package/dist/esm/nodeviews/inlineCard.js +2 -0
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +5 -1
- package/dist/esm/ui/ConfigureOverlay/index.js +22 -25
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 11.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 11.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`e5c510a42227e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e5c510a42227e) -
|
|
14
|
+
[ux] Disable preview modals within preview panels
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 11.4.5
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -28,7 +28,7 @@ var _utils2 = require("../pm-plugins/utils");
|
|
|
28
28
|
var _genericCard = require("./genericCard");
|
|
29
29
|
function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
30
30
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
31
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
31
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
32
32
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
33
33
|
var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
34
34
|
function BlockCardComponent(props) {
|
|
@@ -159,6 +159,7 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
159
159
|
args[_key] = arguments[_key];
|
|
160
160
|
}
|
|
161
161
|
_this2 = _callSuper(this, BlockCard, [].concat(args));
|
|
162
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
162
163
|
(0, _defineProperty2.default)(_this2, "id", (0, _v.default)());
|
|
163
164
|
(0, _defineProperty2.default)(_this2, "updateContentEditable", function (editorViewModeState, divElement) {
|
|
164
165
|
divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
|
|
@@ -36,7 +36,7 @@ function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototyp
|
|
|
36
36
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
37
37
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
38
38
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
39
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
39
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
40
40
|
var selector = function selector(states) {
|
|
41
41
|
var _states$widthState, _states$widthState2, _states$editorDisable;
|
|
42
42
|
return {
|
|
@@ -440,6 +440,7 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
440
440
|
args[_key] = arguments[_key];
|
|
441
441
|
}
|
|
442
442
|
_this2 = _callSuper(this, EmbedCard, [].concat(args));
|
|
443
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
443
444
|
(0, _defineProperty2.default)(_this2, "id", (0, _v.default)());
|
|
444
445
|
(0, _defineProperty2.default)(_this2, "updateContentEditable", function (editorViewModeState, divElement) {
|
|
445
446
|
divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
|
|
@@ -26,6 +26,8 @@ var _toolbar = require("../ui/toolbar");
|
|
|
26
26
|
var _genericCard = require("./genericCard");
|
|
27
27
|
var _inlineCardWithAwareness = require("./inlineCardWithAwareness");
|
|
28
28
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
29
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
30
|
+
|
|
29
31
|
var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
30
32
|
var node = _ref.node,
|
|
31
33
|
cardContext = _ref.cardContext,
|
|
@@ -45,6 +47,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
45
47
|
var _node$attrs = node.attrs,
|
|
46
48
|
url = _node$attrs.url,
|
|
47
49
|
data = _node$attrs.data;
|
|
50
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
48
51
|
var refId = (0, _react.useRef)((0, _v.default)());
|
|
49
52
|
(0, _react.useEffect)(function () {
|
|
50
53
|
var id = refId.current;
|
|
@@ -13,6 +13,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
13
13
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
16
|
+
var _utils = require("@atlaskit/linking-common/utils");
|
|
16
17
|
var _smartCard = require("@atlaskit/smart-card");
|
|
17
18
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
19
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -185,6 +186,9 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
185
186
|
// In view mode we show HoverLinkOverlay only with if preview mode or panel is available
|
|
186
187
|
// otherwise a use can click on smartlink itself to open the link in a new tab.
|
|
187
188
|
var isPreviewAvailable = isPreviewPanelAvailable || isPreviewModalAvailable;
|
|
189
|
+
// When inside preview panel iframe, hide the overlay button
|
|
190
|
+
var isInPreviewPanel = (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel_modal', 'cohort', 'test') && (0, _utils.isWithinPreviewPanelIFrame)();
|
|
191
|
+
var showPanelButton = isInPreviewPanel ? isPreviewPanelAvailable : isPreviewAvailable;
|
|
188
192
|
if (isPreviewAvailable) {
|
|
189
193
|
var _pluginInjectionApi$a4;
|
|
190
194
|
return /*#__PURE__*/_react.default.createElement(_ui.HoverLinkOverlay, {
|
|
@@ -193,7 +197,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
193
197
|
compactPadding: editorAppearance === 'comment' || editorAppearance === 'chromeless',
|
|
194
198
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions,
|
|
195
199
|
view: view,
|
|
196
|
-
showPanelButton:
|
|
200
|
+
showPanelButton: showPanelButton,
|
|
197
201
|
showPanelButtonIcon: isPreviewAvailable && isPreviewPanelAvailable ? 'panel' : 'modal',
|
|
198
202
|
onClick: function onClick(event) {
|
|
199
203
|
if (isPreviewPanelAvailable) {
|
|
@@ -41,31 +41,28 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
|
|
|
41
41
|
setShowConfigureButton(false);
|
|
42
42
|
}
|
|
43
43
|
}, []);
|
|
44
|
-
return (
|
|
45
|
-
// eslint-disable-next-line @atlassian/a11y/
|
|
46
|
-
(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
return (0, _react2.jsx)("span", {
|
|
45
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
46
|
+
onMouseEnter: function onMouseEnter() {
|
|
47
|
+
setShowConfigureButton(true);
|
|
48
|
+
hoverCallback(true);
|
|
49
|
+
}
|
|
50
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
51
|
+
,
|
|
52
|
+
onMouseLeave: function onMouseLeave() {
|
|
53
|
+
if (!dropdownOpen) {
|
|
54
|
+
setShowConfigureButton(false);
|
|
55
|
+
hoverCallback(false);
|
|
51
56
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
css: ConfigureOverlayWrapperStyles
|
|
63
|
-
}, showConfigureButton && (0, _react2.jsx)(_link.OverlayButton, {
|
|
64
|
-
editorView: view,
|
|
65
|
-
targetElementPos: targetElementPos,
|
|
66
|
-
onDropdownChange: onDropdownChange,
|
|
67
|
-
onOpenLinkClick: onOpenLinkClick
|
|
68
|
-
})), children)
|
|
69
|
-
);
|
|
57
|
+
},
|
|
58
|
+
"data-testid": "inline-card-overlay-wrapper"
|
|
59
|
+
}, (0, _react2.jsx)("span", {
|
|
60
|
+
css: ConfigureOverlayWrapperStyles
|
|
61
|
+
}, showConfigureButton && (0, _react2.jsx)(_link.OverlayButton, {
|
|
62
|
+
editorView: view,
|
|
63
|
+
targetElementPos: targetElementPos,
|
|
64
|
+
onDropdownChange: onDropdownChange,
|
|
65
|
+
onOpenLinkClick: onOpenLinkClick
|
|
66
|
+
})), children);
|
|
70
67
|
};
|
|
71
68
|
var _default = exports.default = OverlayWrapper;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
5
|
import uuid from 'uuid/v4';
|
|
5
6
|
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
6
7
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
@@ -136,6 +137,7 @@ const WrappedBlockCard = Card(BlockCardComponent, UnsupportedBlock);
|
|
|
136
137
|
export class BlockCard extends ReactNodeView {
|
|
137
138
|
constructor(...args) {
|
|
138
139
|
super(...args);
|
|
140
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
139
141
|
_defineProperty(this, "id", uuid());
|
|
140
142
|
_defineProperty(this, "updateContentEditable", (editorViewModeState, divElement) => {
|
|
141
143
|
divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
|
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
5
6
|
import uuid from 'uuid/v4';
|
|
6
7
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
7
8
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
@@ -423,6 +424,7 @@ const WrappedEmbedCard = Card(WrappedEmbedCardWithCondition, UnsupportedBlock);
|
|
|
423
424
|
export class EmbedCard extends ReactNodeView {
|
|
424
425
|
constructor(...args) {
|
|
425
426
|
super(...args);
|
|
427
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
426
428
|
_defineProperty(this, "id", uuid());
|
|
427
429
|
_defineProperty(this, "updateContentEditable", (editorViewModeState, divElement) => {
|
|
428
430
|
divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
5
|
import uuid from 'uuid/v4';
|
|
5
6
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
7
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
@@ -36,6 +37,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
36
37
|
url,
|
|
37
38
|
data
|
|
38
39
|
} = node.attrs;
|
|
40
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
39
41
|
const refId = useRef(uuid());
|
|
40
42
|
useEffect(() => {
|
|
41
43
|
const id = refId.current;
|
|
@@ -4,6 +4,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
4
4
|
import { HoverLinkOverlay } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { extractSmartLinkEmbed } from '@atlaskit/link-extractors';
|
|
7
|
+
import { isWithinPreviewPanelIFrame } from '@atlaskit/linking-common/utils';
|
|
7
8
|
import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
|
|
8
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -164,6 +165,9 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
164
165
|
// In view mode we show HoverLinkOverlay only with if preview mode or panel is available
|
|
165
166
|
// otherwise a use can click on smartlink itself to open the link in a new tab.
|
|
166
167
|
const isPreviewAvailable = isPreviewPanelAvailable || isPreviewModalAvailable;
|
|
168
|
+
// When inside preview panel iframe, hide the overlay button
|
|
169
|
+
const isInPreviewPanel = expValEquals('platform_hover_card_preview_panel_modal', 'cohort', 'test') && isWithinPreviewPanelIFrame();
|
|
170
|
+
const showPanelButton = isInPreviewPanel ? isPreviewPanelAvailable : isPreviewAvailable;
|
|
167
171
|
if (isPreviewAvailable) {
|
|
168
172
|
var _pluginInjectionApi$a5;
|
|
169
173
|
return /*#__PURE__*/React.createElement(HoverLinkOverlay, {
|
|
@@ -172,7 +176,7 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
172
176
|
compactPadding: editorAppearance === 'comment' || editorAppearance === 'chromeless',
|
|
173
177
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions,
|
|
174
178
|
view: view,
|
|
175
|
-
showPanelButton:
|
|
179
|
+
showPanelButton: showPanelButton,
|
|
176
180
|
showPanelButtonIcon: isPreviewAvailable && isPreviewPanelAvailable ? 'panel' : 'modal',
|
|
177
181
|
onClick: event => {
|
|
178
182
|
if (isPreviewPanelAvailable) {
|
|
@@ -27,31 +27,28 @@ const OverlayWrapper = ({
|
|
|
27
27
|
setShowConfigureButton(false);
|
|
28
28
|
}
|
|
29
29
|
}, []);
|
|
30
|
-
return (
|
|
31
|
-
// eslint-disable-next-line @atlassian/a11y/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
return jsx("span", {
|
|
31
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
32
|
+
onMouseEnter: () => {
|
|
33
|
+
setShowConfigureButton(true);
|
|
34
|
+
hoverCallback(true);
|
|
35
|
+
}
|
|
36
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
37
|
+
,
|
|
38
|
+
onMouseLeave: () => {
|
|
39
|
+
if (!dropdownOpen) {
|
|
40
|
+
setShowConfigureButton(false);
|
|
41
|
+
hoverCallback(false);
|
|
37
42
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
css: ConfigureOverlayWrapperStyles
|
|
49
|
-
}, showConfigureButton && jsx(OverlayButton, {
|
|
50
|
-
editorView: view,
|
|
51
|
-
targetElementPos: targetElementPos,
|
|
52
|
-
onDropdownChange: onDropdownChange,
|
|
53
|
-
onOpenLinkClick: onOpenLinkClick
|
|
54
|
-
})), children)
|
|
55
|
-
);
|
|
43
|
+
},
|
|
44
|
+
"data-testid": "inline-card-overlay-wrapper"
|
|
45
|
+
}, jsx("span", {
|
|
46
|
+
css: ConfigureOverlayWrapperStyles
|
|
47
|
+
}, showConfigureButton && jsx(OverlayButton, {
|
|
48
|
+
editorView: view,
|
|
49
|
+
targetElementPos: targetElementPos,
|
|
50
|
+
onDropdownChange: onDropdownChange,
|
|
51
|
+
onOpenLinkClick: onOpenLinkClick
|
|
52
|
+
})), children);
|
|
56
53
|
};
|
|
57
54
|
export default OverlayWrapper;
|
|
@@ -10,6 +10,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import rafSchedule from 'raf-schd';
|
|
13
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
13
14
|
import uuid from 'uuid/v4';
|
|
14
15
|
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
15
16
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
@@ -153,6 +154,7 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
153
154
|
args[_key] = arguments[_key];
|
|
154
155
|
}
|
|
155
156
|
_this2 = _callSuper(this, BlockCard, [].concat(args));
|
|
157
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
156
158
|
_defineProperty(_this2, "id", uuid());
|
|
157
159
|
_defineProperty(_this2, "updateContentEditable", function (editorViewModeState, divElement) {
|
|
158
160
|
divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
|
|
@@ -13,6 +13,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
13
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import rafSchedule from 'raf-schd';
|
|
16
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
16
17
|
import uuid from 'uuid/v4';
|
|
17
18
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
18
19
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
@@ -433,6 +434,7 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
433
434
|
args[_key] = arguments[_key];
|
|
434
435
|
}
|
|
435
436
|
_this2 = _callSuper(this, EmbedCard, [].concat(args));
|
|
437
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
436
438
|
_defineProperty(_this2, "id", uuid());
|
|
437
439
|
_defineProperty(_this2, "updateContentEditable", function (editorViewModeState, divElement) {
|
|
438
440
|
divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
5
|
import uuid from 'uuid/v4';
|
|
5
6
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
7
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
@@ -34,6 +35,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
34
35
|
var _node$attrs = node.attrs,
|
|
35
36
|
url = _node$attrs.url,
|
|
36
37
|
data = _node$attrs.data;
|
|
38
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
37
39
|
var refId = useRef(uuid());
|
|
38
40
|
useEffect(function () {
|
|
39
41
|
var id = refId.current;
|
|
@@ -5,6 +5,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
import { HoverLinkOverlay } from '@atlaskit/editor-common/ui';
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { extractSmartLinkEmbed } from '@atlaskit/link-extractors';
|
|
8
|
+
import { isWithinPreviewPanelIFrame } from '@atlaskit/linking-common/utils';
|
|
8
9
|
import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
|
|
9
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -176,6 +177,9 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
176
177
|
// In view mode we show HoverLinkOverlay only with if preview mode or panel is available
|
|
177
178
|
// otherwise a use can click on smartlink itself to open the link in a new tab.
|
|
178
179
|
var isPreviewAvailable = isPreviewPanelAvailable || isPreviewModalAvailable;
|
|
180
|
+
// When inside preview panel iframe, hide the overlay button
|
|
181
|
+
var isInPreviewPanel = expValEquals('platform_hover_card_preview_panel_modal', 'cohort', 'test') && isWithinPreviewPanelIFrame();
|
|
182
|
+
var showPanelButton = isInPreviewPanel ? isPreviewPanelAvailable : isPreviewAvailable;
|
|
179
183
|
if (isPreviewAvailable) {
|
|
180
184
|
var _pluginInjectionApi$a4;
|
|
181
185
|
return /*#__PURE__*/React.createElement(HoverLinkOverlay, {
|
|
@@ -184,7 +188,7 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
184
188
|
compactPadding: editorAppearance === 'comment' || editorAppearance === 'chromeless',
|
|
185
189
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions,
|
|
186
190
|
view: view,
|
|
187
|
-
showPanelButton:
|
|
191
|
+
showPanelButton: showPanelButton,
|
|
188
192
|
showPanelButtonIcon: isPreviewAvailable && isPreviewPanelAvailable ? 'panel' : 'modal',
|
|
189
193
|
onClick: function onClick(event) {
|
|
190
194
|
if (isPreviewPanelAvailable) {
|
|
@@ -33,31 +33,28 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
|
|
|
33
33
|
setShowConfigureButton(false);
|
|
34
34
|
}
|
|
35
35
|
}, []);
|
|
36
|
-
return (
|
|
37
|
-
// eslint-disable-next-line @atlassian/a11y/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
return jsx("span", {
|
|
37
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
38
|
+
onMouseEnter: function onMouseEnter() {
|
|
39
|
+
setShowConfigureButton(true);
|
|
40
|
+
hoverCallback(true);
|
|
41
|
+
}
|
|
42
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
43
|
+
,
|
|
44
|
+
onMouseLeave: function onMouseLeave() {
|
|
45
|
+
if (!dropdownOpen) {
|
|
46
|
+
setShowConfigureButton(false);
|
|
47
|
+
hoverCallback(false);
|
|
43
48
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
css: ConfigureOverlayWrapperStyles
|
|
55
|
-
}, showConfigureButton && jsx(OverlayButton, {
|
|
56
|
-
editorView: view,
|
|
57
|
-
targetElementPos: targetElementPos,
|
|
58
|
-
onDropdownChange: onDropdownChange,
|
|
59
|
-
onOpenLinkClick: onOpenLinkClick
|
|
60
|
-
})), children)
|
|
61
|
-
);
|
|
49
|
+
},
|
|
50
|
+
"data-testid": "inline-card-overlay-wrapper"
|
|
51
|
+
}, jsx("span", {
|
|
52
|
+
css: ConfigureOverlayWrapperStyles
|
|
53
|
+
}, showConfigureButton && jsx(OverlayButton, {
|
|
54
|
+
editorView: view,
|
|
55
|
+
targetElementPos: targetElementPos,
|
|
56
|
+
onDropdownChange: onDropdownChange,
|
|
57
|
+
onOpenLinkClick: onOpenLinkClick
|
|
58
|
+
})), children);
|
|
62
59
|
};
|
|
63
60
|
export default OverlayWrapper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.5.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/adf-schema": "^51.3.2",
|
|
33
33
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
34
|
-
"@atlaskit/button": "^23.
|
|
34
|
+
"@atlaskit/button": "^23.6.0",
|
|
35
35
|
"@atlaskit/custom-steps": "^0.16.0",
|
|
36
36
|
"@atlaskit/editor-card-provider": "^6.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
"@atlaskit/link": "^3.2.0",
|
|
53
53
|
"@atlaskit/link-analytics": "^11.0.0",
|
|
54
54
|
"@atlaskit/link-client-extension": "^6.0.0",
|
|
55
|
-
"@atlaskit/link-datasource": "^4.
|
|
55
|
+
"@atlaskit/link-datasource": "^4.29.0",
|
|
56
56
|
"@atlaskit/link-extractors": "^2.4.0",
|
|
57
|
-
"@atlaskit/linking-common": "^9.
|
|
57
|
+
"@atlaskit/linking-common": "^9.8.0",
|
|
58
58
|
"@atlaskit/linking-types": "^14.1.0",
|
|
59
59
|
"@atlaskit/menu": "^8.4.0",
|
|
60
60
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
61
61
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
62
|
-
"@atlaskit/primitives": "^16.
|
|
62
|
+
"@atlaskit/primitives": "^16.1.0",
|
|
63
63
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
64
|
-
"@atlaskit/smart-card": "^43.
|
|
64
|
+
"@atlaskit/smart-card": "^43.6.0",
|
|
65
65
|
"@atlaskit/theme": "^21.0.0",
|
|
66
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
67
|
-
"@atlaskit/tokens": "^
|
|
66
|
+
"@atlaskit/tmp-editor-statsig": "^13.32.0",
|
|
67
|
+
"@atlaskit/tokens": "^8.0.0",
|
|
68
68
|
"@babel/runtime": "^7.0.0",
|
|
69
69
|
"@emotion/react": "^11.7.1",
|
|
70
70
|
"lodash": "^4.17.21",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"uuid": "^3.1.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/editor-common": "^110.
|
|
76
|
+
"@atlaskit/editor-common": "^110.24.0",
|
|
77
77
|
"@atlaskit/link-provider": "^4.0.0",
|
|
78
78
|
"react": "^18.2.0",
|
|
79
79
|
"react-intl-next": "npm:react-intl@^5.18.1"
|