@atlaskit/editor-plugin-card 32.0.0 → 32.1.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 +31 -0
- package/dist/cjs/cardPlugin.js +5 -1
- package/dist/cjs/nodeviews/blockCard.js +5 -3
- package/dist/cjs/nodeviews/embedCard.js +5 -3
- package/dist/cjs/nodeviews/inlineCardBase.js +5 -5
- package/dist/cjs/nodeviews/isIntersectionObserverSupported.js +18 -0
- package/dist/es2019/cardPlugin.js +5 -1
- package/dist/es2019/nodeviews/blockCard.js +5 -3
- package/dist/es2019/nodeviews/embedCard.js +5 -3
- package/dist/es2019/nodeviews/inlineCardBase.js +3 -3
- package/dist/es2019/nodeviews/isIntersectionObserverSupported.js +10 -0
- package/dist/esm/cardPlugin.js +5 -1
- package/dist/esm/nodeviews/blockCard.js +5 -3
- package/dist/esm/nodeviews/embedCard.js +5 -3
- package/dist/esm/nodeviews/inlineCardBase.js +5 -5
- package/dist/esm/nodeviews/isIntersectionObserverSupported.js +12 -0
- package/dist/types/nodeviews/isIntersectionObserverSupported.d.ts +10 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 32.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`abb8145e77f80`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/abb8145e77f80) -
|
|
8
|
+
Behind `platform_editor_reduce_forced_layout_2`, the inline, block and embed card node views no
|
|
9
|
+
longer call `findOverflowScrollParent` on the editor DOM when `IntersectionObserver` is available.
|
|
10
|
+
That lookup walked every ancestor calling `getComputedStyle`, forcing a style recalculation once
|
|
11
|
+
per card, and its only consumer was Smart Card's `container` prop. `container` is read in exactly
|
|
12
|
+
one place — `LazyLazilyRenderCard`, which Smart Card only renders when `IntersectionObserver` is
|
|
13
|
+
unsupported — so on every supported browser the result was discarded. The lookup is still
|
|
14
|
+
performed when `IntersectionObserver` is unavailable, preserving the legacy behaviour.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 32.1.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [`dd269d6b8b56d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dd269d6b8b56d) -
|
|
22
|
+
Add optional `experimentalConfigurationOptions?: Record<string, boolean>` to `CardOptions` from
|
|
23
|
+
`@atlaskit/editor-common/card/cardOptions`, inherited by `@atlaskit/editor-plugin-card` options.
|
|
24
|
+
|
|
25
|
+
Setting `platform_sl_3p_preauth_value_modal_killswitch` to `false` in these options prevents the
|
|
26
|
+
editor from mounting the pre-auth modal listener. A value of `true`, an omitted key, or omitted
|
|
27
|
+
options preserve existing eligibility and rollout behavior; they do not override the kill switch
|
|
28
|
+
or experiment allocation. Unrelated keys are ignored by this feature.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
|
|
3
34
|
## 32.0.0
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/dist/cjs/cardPlugin.js
CHANGED
|
@@ -167,6 +167,7 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref2) {
|
|
|
167
167
|
return plugins;
|
|
168
168
|
},
|
|
169
169
|
contentComponent: function contentComponent(_ref5) {
|
|
170
|
+
var _options$experimental;
|
|
170
171
|
var editorView = _ref5.editorView,
|
|
171
172
|
popupsMountPoint = _ref5.popupsMountPoint,
|
|
172
173
|
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
@@ -176,7 +177,10 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref2) {
|
|
|
176
177
|
}
|
|
177
178
|
editorViewForPasteMenu = editorView;
|
|
178
179
|
var breakoutEnabled = options.editorAppearance === 'full-page';
|
|
179
|
-
|
|
180
|
+
var isPreAuthModalOptedOut = ((_options$experimental = options.experimentalConfigurationOptions) === null || _options$experimental === void 0 ? void 0 : _options$experimental.platform_sl_3p_preauth_value_modal_killswitch) === false;
|
|
181
|
+
var isPreAuthModalKillswitchEnabled = (0, _fg.fg)('platform_sl_3p_preauth_value_modal_killswitch');
|
|
182
|
+
var shouldRenderPreAuthValuePropositionModal = !isPreAuthModalOptedOut && isPreAuthModalKillswitchEnabled;
|
|
183
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldRenderPreAuthValuePropositionModal ? /*#__PURE__*/_react.default.createElement(_PreAuthValuePropositionModal.PreAuthValuePropositionModalListener, {
|
|
180
184
|
api: api,
|
|
181
185
|
cardPluginEvents: cardPluginEvents
|
|
182
186
|
}) : null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/_react.default.createElement(PasteMenuSmartCardClientSync, {
|
|
@@ -20,6 +20,7 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
|
|
|
20
20
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
21
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
22
22
|
var _editorSmartLinkDraggable = require("@atlaskit/editor-smart-link-draggable");
|
|
23
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
23
24
|
var _smartCard = require("@atlaskit/smart-card");
|
|
24
25
|
var _ssr = require("@atlaskit/smart-card/ssr");
|
|
25
26
|
var _datasource = require("../nodeviews/datasource");
|
|
@@ -27,6 +28,7 @@ var _actions = require("../pm-plugins/actions");
|
|
|
27
28
|
var _utils2 = require("../pm-plugins/utils");
|
|
28
29
|
var _SmartCardSSRReactContextsProvider = require("../ui/SmartCardSSRReactContextsProvider");
|
|
29
30
|
var _genericCard = require("./genericCard");
|
|
31
|
+
var _isIntersectionObserverSupported = require("./isIntersectionObserverSupported");
|
|
30
32
|
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; }
|
|
31
33
|
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)); }
|
|
32
34
|
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
|
|
@@ -36,8 +38,6 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
|
|
|
36
38
|
var _this;
|
|
37
39
|
(0, _classCallCheck2.default)(this, BlockCardComponent);
|
|
38
40
|
_this = _callSuper(this, BlockCardComponent, [props]);
|
|
39
|
-
// Ignored via go/ees005
|
|
40
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
41
41
|
(0, _defineProperty2.default)(_this, "onResolve", function (data) {
|
|
42
42
|
var _this$props = _this.props,
|
|
43
43
|
getPos = _this$props.getPos,
|
|
@@ -84,7 +84,9 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
|
|
|
84
84
|
throw err;
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
|
-
_this.scrollContainer = (0,
|
|
87
|
+
_this.scrollContainer = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_forced_layout_2') && (0, _isIntersectionObserverSupported.isIntersectionObserverSupported)() ? undefined :
|
|
88
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
89
|
+
(0, _ui.findOverflowScrollParent)(props.view.dom) || undefined;
|
|
88
90
|
return _this;
|
|
89
91
|
}
|
|
90
92
|
(0, _inherits2.default)(BlockCardComponent, _React$PureComponent);
|
|
@@ -25,6 +25,7 @@ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-
|
|
|
25
25
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
26
26
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
27
27
|
var _editorSmartLinkDraggable = require("@atlaskit/editor-smart-link-draggable");
|
|
28
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
28
29
|
var _componentWithCondition = require("@atlaskit/platform-feature-flags-react/component-with-condition");
|
|
29
30
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
30
31
|
var _smartCard = require("@atlaskit/smart-card");
|
|
@@ -36,6 +37,7 @@ var _ResizableEmbedCard = _interopRequireDefault(require("../ui/ResizableEmbedCa
|
|
|
36
37
|
var _SmartCardSSRReactContextsProvider = require("../ui/SmartCardSSRReactContextsProvider");
|
|
37
38
|
var _blockCard = require("./blockCard");
|
|
38
39
|
var _genericCard = require("./genericCard");
|
|
40
|
+
var _isIntersectionObserverSupported = require("./isIntersectionObserverSupported");
|
|
39
41
|
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; }
|
|
40
42
|
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; }
|
|
41
43
|
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; }
|
|
@@ -146,8 +148,6 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
|
|
|
146
148
|
var _this;
|
|
147
149
|
(0, _classCallCheck2.default)(this, EmbedCardComponent);
|
|
148
150
|
_this = _callSuper(this, EmbedCardComponent, [props]);
|
|
149
|
-
// Ignored via go/ees005
|
|
150
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
151
151
|
(0, _defineProperty2.default)(_this, "embedIframeRef", /*#__PURE__*/_react.default.createRef());
|
|
152
152
|
(0, _defineProperty2.default)(_this, "getPosSafely", function () {
|
|
153
153
|
var getPos = _this.props.getPos;
|
|
@@ -307,7 +307,9 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
|
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
(0, _defineProperty2.default)(_this, "removeCardDispatched", false);
|
|
310
|
-
_this.scrollContainer = (0,
|
|
310
|
+
_this.scrollContainer = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_forced_layout_2') && (0, _isIntersectionObserverSupported.isIntersectionObserverSupported)() ? undefined :
|
|
311
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
312
|
+
(0, _ui.findOverflowScrollParent)(props.view.dom) || undefined;
|
|
311
313
|
_this.state = {
|
|
312
314
|
hasPreview: true
|
|
313
315
|
};
|
|
@@ -17,6 +17,7 @@ var _ssr = require("@atlaskit/smart-card/ssr");
|
|
|
17
17
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
18
18
|
var _actions = require("../pm-plugins/actions");
|
|
19
19
|
var _toolbar = require("../ui/toolbar");
|
|
20
|
+
var _isIntersectionObserverSupported = require("./isIntersectionObserverSupported");
|
|
20
21
|
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); }
|
|
21
22
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
22
23
|
|
|
@@ -60,11 +61,10 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
60
61
|
view.dispatch(tr);
|
|
61
62
|
};
|
|
62
63
|
}, [getPos, view]);
|
|
63
|
-
var scrollContainer = (0, _react.useMemo)(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return (0, _ui.findOverflowScrollParent)(view.dom) || undefined;
|
|
64
|
+
var scrollContainer = (0, _react.useMemo)(function () {
|
|
65
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_forced_layout_2') && (0, _isIntersectionObserverSupported.isIntersectionObserverSupported)() ? undefined :
|
|
66
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
67
|
+
(0, _ui.findOverflowScrollParent)(view.dom) || undefined;
|
|
68
68
|
}, [view.dom]);
|
|
69
69
|
var onResolve = (0, _react.useCallback)(function (data) {
|
|
70
70
|
if (!getPos || typeof getPos === 'boolean') {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isIntersectionObserverSupported = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Mirrors the internal check in `@atlaskit/smart-card`
|
|
9
|
+
* (`src/utils/is-intersection-observer-supported.tsx`), which is not part of that package's
|
|
10
|
+
* public API and so cannot be imported here.
|
|
11
|
+
*
|
|
12
|
+
* Smart Card only forwards its `container` prop to `react-lazily-render` when
|
|
13
|
+
* `IntersectionObserver` is unavailable. When it is available the prop is never read, so the
|
|
14
|
+
* caller can skip resolving a scroll container entirely.
|
|
15
|
+
*/
|
|
16
|
+
var isIntersectionObserverSupported = exports.isIntersectionObserverSupported = function isIntersectionObserverSupported() {
|
|
17
|
+
return typeof IntersectionObserver !== 'undefined';
|
|
18
|
+
};
|
|
@@ -166,12 +166,16 @@ export const cardPlugin = ({
|
|
|
166
166
|
popupsScrollableElement,
|
|
167
167
|
popupsBoundariesElement
|
|
168
168
|
}) {
|
|
169
|
+
var _options$experimental;
|
|
169
170
|
if (!editorView) {
|
|
170
171
|
return null;
|
|
171
172
|
}
|
|
172
173
|
editorViewForPasteMenu = editorView;
|
|
173
174
|
const breakoutEnabled = options.editorAppearance === 'full-page';
|
|
174
|
-
|
|
175
|
+
const isPreAuthModalOptedOut = ((_options$experimental = options.experimentalConfigurationOptions) === null || _options$experimental === void 0 ? void 0 : _options$experimental.platform_sl_3p_preauth_value_modal_killswitch) === false;
|
|
176
|
+
const isPreAuthModalKillswitchEnabled = fg('platform_sl_3p_preauth_value_modal_killswitch');
|
|
177
|
+
const shouldRenderPreAuthValuePropositionModal = !isPreAuthModalOptedOut && isPreAuthModalKillswitchEnabled;
|
|
178
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, shouldRenderPreAuthValuePropositionModal ? /*#__PURE__*/React.createElement(PreAuthValuePropositionModalListener, {
|
|
175
179
|
api: api,
|
|
176
180
|
cardPluginEvents: cardPluginEvents
|
|
177
181
|
}) : null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/React.createElement(PasteMenuSmartCardClientSync, {
|
|
@@ -8,6 +8,7 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
|
8
8
|
import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from '@atlaskit/editor-smart-link-draggable';
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
12
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
12
13
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
13
14
|
import { Datasource } from '../nodeviews/datasource';
|
|
@@ -15,13 +16,12 @@ import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
|
15
16
|
import { isDatasourceNode } from '../pm-plugins/utils';
|
|
16
17
|
import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
|
|
17
18
|
import { Card } from './genericCard';
|
|
19
|
+
import { isIntersectionObserverSupported } from './isIntersectionObserverSupported';
|
|
18
20
|
|
|
19
21
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
20
22
|
export class BlockCardComponent extends React.PureComponent {
|
|
21
23
|
constructor(props) {
|
|
22
24
|
super(props);
|
|
23
|
-
// Ignored via go/ees005
|
|
24
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
25
25
|
_defineProperty(this, "onResolve", data => {
|
|
26
26
|
const {
|
|
27
27
|
getPos,
|
|
@@ -72,7 +72,9 @@ export class BlockCardComponent extends React.PureComponent {
|
|
|
72
72
|
throw err;
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
-
this.scrollContainer =
|
|
75
|
+
this.scrollContainer = isExperimentEnabled('platform_editor_reduce_forced_layout_2') && isIntersectionObserverSupported() ? undefined :
|
|
76
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
77
|
+
findOverflowScrollParent(props.view.dom) || undefined;
|
|
76
78
|
}
|
|
77
79
|
componentWillUnmount() {
|
|
78
80
|
this.removeCard();
|
|
@@ -13,6 +13,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
13
13
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
14
14
|
import { akEditorFullPageNarrowBreakout, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
15
15
|
import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from '@atlaskit/editor-smart-link-draggable';
|
|
16
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
16
17
|
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react/component-with-condition';
|
|
17
18
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
18
19
|
import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
|
|
@@ -24,6 +25,7 @@ import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
|
24
25
|
import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
|
|
25
26
|
import { BlockCardComponent } from './blockCard';
|
|
26
27
|
import { Card } from './genericCard';
|
|
28
|
+
import { isIntersectionObserverSupported } from './isIntersectionObserverSupported';
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
31
|
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
@@ -130,8 +132,6 @@ const CardInner = ({
|
|
|
130
132
|
export class EmbedCardComponent extends React.PureComponent {
|
|
131
133
|
constructor(props) {
|
|
132
134
|
super(props);
|
|
133
|
-
// Ignored via go/ees005
|
|
134
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
135
135
|
_defineProperty(this, "embedIframeRef", /*#__PURE__*/React.createRef());
|
|
136
136
|
_defineProperty(this, "getPosSafely", () => {
|
|
137
137
|
const {
|
|
@@ -303,7 +303,9 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
303
303
|
}
|
|
304
304
|
});
|
|
305
305
|
_defineProperty(this, "removeCardDispatched", false);
|
|
306
|
-
this.scrollContainer =
|
|
306
|
+
this.scrollContainer = isExperimentEnabled('platform_editor_reduce_forced_layout_2') && isIntersectionObserverSupported() ? undefined :
|
|
307
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
308
|
+
findOverflowScrollParent(props.view.dom) || undefined;
|
|
307
309
|
this.state = {
|
|
308
310
|
hasPreview: true
|
|
309
311
|
};
|
|
@@ -10,6 +10,7 @@ import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
|
10
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
11
11
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
12
12
|
import { visitCardLinkAnalytics } from '../ui/toolbar';
|
|
13
|
+
import { isIntersectionObserverSupported } from './isIntersectionObserverSupported';
|
|
13
14
|
export const InlineCard = /*#__PURE__*/memo(({
|
|
14
15
|
node,
|
|
15
16
|
cardContext,
|
|
@@ -55,10 +56,9 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
55
56
|
view.dispatch(tr);
|
|
56
57
|
};
|
|
57
58
|
}, [getPos, view]);
|
|
58
|
-
const scrollContainer = useMemo(
|
|
59
|
-
// Ignored via go/ees005
|
|
59
|
+
const scrollContainer = useMemo(() => isExperimentEnabled('platform_editor_reduce_forced_layout_2') && isIntersectionObserverSupported() ? undefined :
|
|
60
60
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
61
|
-
|
|
61
|
+
findOverflowScrollParent(view.dom) || undefined, [view.dom]);
|
|
62
62
|
const onResolve = useCallback(data => {
|
|
63
63
|
if (!getPos || typeof getPos === 'boolean') {
|
|
64
64
|
return;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors the internal check in `@atlaskit/smart-card`
|
|
3
|
+
* (`src/utils/is-intersection-observer-supported.tsx`), which is not part of that package's
|
|
4
|
+
* public API and so cannot be imported here.
|
|
5
|
+
*
|
|
6
|
+
* Smart Card only forwards its `container` prop to `react-lazily-render` when
|
|
7
|
+
* `IntersectionObserver` is unavailable. When it is available the prop is never read, so the
|
|
8
|
+
* caller can skip resolving a scroll container entirely.
|
|
9
|
+
*/
|
|
10
|
+
export const isIntersectionObserverSupported = () => typeof IntersectionObserver !== 'undefined';
|
package/dist/esm/cardPlugin.js
CHANGED
|
@@ -159,6 +159,7 @@ export var cardPlugin = function cardPlugin(_ref2) {
|
|
|
159
159
|
return plugins;
|
|
160
160
|
},
|
|
161
161
|
contentComponent: function contentComponent(_ref5) {
|
|
162
|
+
var _options$experimental;
|
|
162
163
|
var editorView = _ref5.editorView,
|
|
163
164
|
popupsMountPoint = _ref5.popupsMountPoint,
|
|
164
165
|
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
@@ -168,7 +169,10 @@ export var cardPlugin = function cardPlugin(_ref2) {
|
|
|
168
169
|
}
|
|
169
170
|
editorViewForPasteMenu = editorView;
|
|
170
171
|
var breakoutEnabled = options.editorAppearance === 'full-page';
|
|
171
|
-
|
|
172
|
+
var isPreAuthModalOptedOut = ((_options$experimental = options.experimentalConfigurationOptions) === null || _options$experimental === void 0 ? void 0 : _options$experimental.platform_sl_3p_preauth_value_modal_killswitch) === false;
|
|
173
|
+
var isPreAuthModalKillswitchEnabled = fg('platform_sl_3p_preauth_value_modal_killswitch');
|
|
174
|
+
var shouldRenderPreAuthValuePropositionModal = !isPreAuthModalOptedOut && isPreAuthModalKillswitchEnabled;
|
|
175
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, shouldRenderPreAuthValuePropositionModal ? /*#__PURE__*/React.createElement(PreAuthValuePropositionModalListener, {
|
|
172
176
|
api: api,
|
|
173
177
|
cardPluginEvents: cardPluginEvents
|
|
174
178
|
}) : null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/React.createElement(PasteMenuSmartCardClientSync, {
|
|
@@ -17,6 +17,7 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
|
17
17
|
import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
18
18
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
19
19
|
import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from '@atlaskit/editor-smart-link-draggable';
|
|
20
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
20
21
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
21
22
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
22
23
|
import { Datasource } from '../nodeviews/datasource';
|
|
@@ -24,6 +25,7 @@ import { registerCard, removeCard as _removeCard } from '../pm-plugins/actions';
|
|
|
24
25
|
import { isDatasourceNode } from '../pm-plugins/utils';
|
|
25
26
|
import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
|
|
26
27
|
import { Card } from './genericCard';
|
|
28
|
+
import { isIntersectionObserverSupported } from './isIntersectionObserverSupported';
|
|
27
29
|
|
|
28
30
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
29
31
|
export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -31,8 +33,6 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
31
33
|
var _this;
|
|
32
34
|
_classCallCheck(this, BlockCardComponent);
|
|
33
35
|
_this = _callSuper(this, BlockCardComponent, [props]);
|
|
34
|
-
// Ignored via go/ees005
|
|
35
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
36
36
|
_defineProperty(_this, "onResolve", function (data) {
|
|
37
37
|
var _this$props = _this.props,
|
|
38
38
|
getPos = _this$props.getPos,
|
|
@@ -79,7 +79,9 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
79
79
|
throw err;
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
_this.scrollContainer =
|
|
82
|
+
_this.scrollContainer = isExperimentEnabled('platform_editor_reduce_forced_layout_2') && isIntersectionObserverSupported() ? undefined :
|
|
83
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
84
|
+
findOverflowScrollParent(props.view.dom) || undefined;
|
|
83
85
|
return _this;
|
|
84
86
|
}
|
|
85
87
|
_inherits(BlockCardComponent, _React$PureComponent);
|
|
@@ -24,6 +24,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
24
24
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
25
25
|
import { akEditorFullPageNarrowBreakout, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
26
26
|
import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from '@atlaskit/editor-smart-link-draggable';
|
|
27
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
27
28
|
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react/component-with-condition';
|
|
28
29
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
29
30
|
import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
|
|
@@ -35,6 +36,7 @@ import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
|
35
36
|
import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
|
|
36
37
|
import { BlockCardComponent } from './blockCard';
|
|
37
38
|
import { Card } from './genericCard';
|
|
39
|
+
import { isIntersectionObserverSupported } from './isIntersectionObserverSupported';
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
@@ -141,8 +143,6 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
141
143
|
var _this;
|
|
142
144
|
_classCallCheck(this, EmbedCardComponent);
|
|
143
145
|
_this = _callSuper(this, EmbedCardComponent, [props]);
|
|
144
|
-
// Ignored via go/ees005
|
|
145
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
146
146
|
_defineProperty(_this, "embedIframeRef", /*#__PURE__*/React.createRef());
|
|
147
147
|
_defineProperty(_this, "getPosSafely", function () {
|
|
148
148
|
var getPos = _this.props.getPos;
|
|
@@ -302,7 +302,9 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
302
302
|
}
|
|
303
303
|
});
|
|
304
304
|
_defineProperty(_this, "removeCardDispatched", false);
|
|
305
|
-
_this.scrollContainer =
|
|
305
|
+
_this.scrollContainer = isExperimentEnabled('platform_editor_reduce_forced_layout_2') && isIntersectionObserverSupported() ? undefined :
|
|
306
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
307
|
+
findOverflowScrollParent(props.view.dom) || undefined;
|
|
306
308
|
_this.state = {
|
|
307
309
|
hasPreview: true
|
|
308
310
|
};
|
|
@@ -10,6 +10,7 @@ import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
|
10
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
11
11
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
12
12
|
import { visitCardLinkAnalytics } from '../ui/toolbar';
|
|
13
|
+
import { isIntersectionObserverSupported } from './isIntersectionObserverSupported';
|
|
13
14
|
export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
14
15
|
var _cardContext$value;
|
|
15
16
|
var node = _ref.node,
|
|
@@ -50,11 +51,10 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
50
51
|
view.dispatch(tr);
|
|
51
52
|
};
|
|
52
53
|
}, [getPos, view]);
|
|
53
|
-
var scrollContainer = useMemo(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return findOverflowScrollParent(view.dom) || undefined;
|
|
54
|
+
var scrollContainer = useMemo(function () {
|
|
55
|
+
return isExperimentEnabled('platform_editor_reduce_forced_layout_2') && isIntersectionObserverSupported() ? undefined :
|
|
56
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
57
|
+
findOverflowScrollParent(view.dom) || undefined;
|
|
58
58
|
}, [view.dom]);
|
|
59
59
|
var onResolve = useCallback(function (data) {
|
|
60
60
|
if (!getPos || typeof getPos === 'boolean') {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors the internal check in `@atlaskit/smart-card`
|
|
3
|
+
* (`src/utils/is-intersection-observer-supported.tsx`), which is not part of that package's
|
|
4
|
+
* public API and so cannot be imported here.
|
|
5
|
+
*
|
|
6
|
+
* Smart Card only forwards its `container` prop to `react-lazily-render` when
|
|
7
|
+
* `IntersectionObserver` is unavailable. When it is available the prop is never read, so the
|
|
8
|
+
* caller can skip resolving a scroll container entirely.
|
|
9
|
+
*/
|
|
10
|
+
export var isIntersectionObserverSupported = function isIntersectionObserverSupported() {
|
|
11
|
+
return typeof IntersectionObserver !== 'undefined';
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors the internal check in `@atlaskit/smart-card`
|
|
3
|
+
* (`src/utils/is-intersection-observer-supported.tsx`), which is not part of that package's
|
|
4
|
+
* public API and so cannot be imported here.
|
|
5
|
+
*
|
|
6
|
+
* Smart Card only forwards its `container` prop to `react-lazily-render` when
|
|
7
|
+
* `IntersectionObserver` is unavailable. When it is available the prop is never read, so the
|
|
8
|
+
* caller can skip resolving a scroll container entirely.
|
|
9
|
+
*/
|
|
10
|
+
export declare const isIntersectionObserverSupported: () => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.1.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/editor-plugin-user-intent": "^24.0.0",
|
|
44
44
|
"@atlaskit/editor-plugin-width": "^27.0.0",
|
|
45
45
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
46
|
-
"@atlaskit/editor-shared-styles": "^4.
|
|
46
|
+
"@atlaskit/editor-shared-styles": "^4.4.0",
|
|
47
47
|
"@atlaskit/editor-smart-link-draggable": "^1.2.0",
|
|
48
48
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
49
49
|
"@atlaskit/editor-ui-control-model": "^2.10.0",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
64
64
|
"@atlaskit/primitives": "^22.5.0",
|
|
65
65
|
"@atlaskit/prosemirror-history": "^1.3.0",
|
|
66
|
-
"@atlaskit/smart-card": "^46.
|
|
67
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
66
|
+
"@atlaskit/smart-card": "^46.6.0",
|
|
67
|
+
"@atlaskit/tmp-editor-statsig": "^229.0.0",
|
|
68
68
|
"@atlaskit/tokens": "^20.4.0",
|
|
69
69
|
"@babel/runtime": "^7.0.0",
|
|
70
70
|
"@emotion/react": "^11.7.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"uuid": "^11.1.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@atlaskit/editor-common": "^130.
|
|
77
|
+
"@atlaskit/editor-common": "^130.3.0",
|
|
78
78
|
"@atlaskit/link-provider": "^6.0.0",
|
|
79
79
|
"react": "^18.2.0 || ^19.2.0",
|
|
80
80
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|