@atlaskit/editor-plugin-card 16.0.2 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/cjs/nodeviews/embedCard.js +24 -2
- package/dist/es2019/nodeviews/embedCard.js +24 -1
- package/dist/esm/nodeviews/embedCard.js +24 -1
- package/dist/types/nodeviews/embedCard.d.ts +12 -0
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +12 -0
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 16.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`51d860f32cd31`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51d860f32cd31) -
|
|
8
|
+
Force 16:9 aspect ratio for Confluence Slides embeds.
|
|
9
|
+
- `editor-card-provider`: Added `isConfluenceSlideUrl()` URL checker and exported it via
|
|
10
|
+
`./url-checkers` subpath; slide URLs now always resolve to `'embed'` appearance via
|
|
11
|
+
`getHardCodedAppearance()`
|
|
12
|
+
- `editor-plugin-card`: In `onResolve()`, overrides the ORS-resolved aspect ratio with `16/9` when
|
|
13
|
+
the URL is a Confluence Slide
|
|
14
|
+
- `native-embeds-slide-experience`: Added `parameterDefaults: { width: 960, height: 540 }` to
|
|
15
|
+
`SlideExperienceManifest` so slides get a 16:9 aspect-ratio container
|
|
16
|
+
- `native-embeds-editor-extension`: Falls back to `manifest.parameterDefaults` for width/height
|
|
17
|
+
when the ADF node has no explicit dimensions
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
23
|
+
## 16.0.3
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 16.0.2
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.embedCardNodeView = exports.EmbedOrBlockCardComponent = exports.EmbedCardComponent = exports.EmbedCard = void 0;
|
|
7
|
+
exports.getAspectRatioForUrl = exports.embedCardNodeView = exports.EmbedOrBlockCardComponent = exports.EmbedCardComponent = exports.EmbedCard = void 0;
|
|
8
8
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -17,6 +17,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
17
17
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
18
18
|
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
19
19
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
20
|
+
var _urlCheckers = require("@atlaskit/editor-card-provider/url-checkers");
|
|
20
21
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
21
22
|
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
22
23
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
@@ -28,6 +29,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
28
29
|
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
29
30
|
var _smartCard = require("@atlaskit/smart-card");
|
|
30
31
|
var _ssr = require("@atlaskit/smart-card/ssr");
|
|
32
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
31
33
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
32
34
|
var _actions = require("../pm-plugins/actions");
|
|
33
35
|
var _ResizableEmbedCard = _interopRequireDefault(require("../ui/ResizableEmbedCard"));
|
|
@@ -38,6 +40,24 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
38
40
|
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; }
|
|
39
41
|
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)); }
|
|
40
42
|
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
|
|
43
|
+
/**
|
|
44
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
45
|
+
* overriding the generic value returned by the link resolver.
|
|
46
|
+
* Add new URL checks here as more content types get fixed aspect ratios.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
50
|
+
* or `undefined` to use the default resolver-provided ratio.
|
|
51
|
+
*
|
|
52
|
+
* @internal Exported for testing only.
|
|
53
|
+
*/
|
|
54
|
+
var getAspectRatioForUrl = exports.getAspectRatioForUrl = function getAspectRatioForUrl(url) {
|
|
55
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc-mui-slides-experiment', 'isEnabled', true) && url && (0, _urlCheckers.isConfluenceSlideUrl)(url)) {
|
|
56
|
+
// Slides have a 16:9 canvas
|
|
57
|
+
return 16 / 9;
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
};
|
|
41
61
|
var selector = function selector(states) {
|
|
42
62
|
var _states$widthState, _states$widthState2, _states$editorDisable;
|
|
43
63
|
return {
|
|
@@ -140,13 +160,15 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
|
|
|
140
160
|
}
|
|
141
161
|
});
|
|
142
162
|
(0, _defineProperty2.default)(_this, "onResolve", function (data) {
|
|
163
|
+
var _getAspectRatioForUrl;
|
|
143
164
|
var view = _this.props.view;
|
|
144
165
|
var title = data.title,
|
|
145
166
|
url = data.url,
|
|
146
|
-
|
|
167
|
+
resolvedAspectRatio = data.aspectRatio;
|
|
147
168
|
var _this$props$node$attr = _this.props.node.attrs,
|
|
148
169
|
originalHeight = _this$props$node$attr.originalHeight,
|
|
149
170
|
originalWidth = _this$props$node$attr.originalWidth;
|
|
171
|
+
var aspectRatio = (_getAspectRatioForUrl = getAspectRatioForUrl(url)) !== null && _getAspectRatioForUrl !== void 0 ? _getAspectRatioForUrl : resolvedAspectRatio;
|
|
150
172
|
if (aspectRatio && !originalHeight && !originalWidth) {
|
|
151
173
|
// Assumption here is if ADF already have both height and width set,
|
|
152
174
|
// we will going to use that later on in this class as aspectRatio
|
|
@@ -5,6 +5,7 @@ import rafSchedule from 'raf-schd';
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
6
6
|
import uuid from 'uuid/v4';
|
|
7
7
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
8
|
+
import { isConfluenceSlideUrl } from '@atlaskit/editor-card-provider/url-checkers';
|
|
8
9
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
10
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
10
11
|
import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
@@ -16,11 +17,31 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
16
17
|
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
17
18
|
import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
|
|
18
19
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
20
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
19
21
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
20
22
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
21
23
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
22
24
|
import { BlockCardComponent } from './blockCard';
|
|
23
25
|
import { Card } from './genericCard';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
29
|
+
* overriding the generic value returned by the link resolver.
|
|
30
|
+
* Add new URL checks here as more content types get fixed aspect ratios.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
34
|
+
* or `undefined` to use the default resolver-provided ratio.
|
|
35
|
+
*
|
|
36
|
+
* @internal Exported for testing only.
|
|
37
|
+
*/
|
|
38
|
+
export const getAspectRatioForUrl = url => {
|
|
39
|
+
if (expValEqualsNoExposure('cc-mui-slides-experiment', 'isEnabled', true) && url && isConfluenceSlideUrl(url)) {
|
|
40
|
+
// Slides have a 16:9 canvas
|
|
41
|
+
return 16 / 9;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
};
|
|
24
45
|
const selector = states => {
|
|
25
46
|
var _states$widthState, _states$widthState2, _states$editorDisable;
|
|
26
47
|
return {
|
|
@@ -125,18 +146,20 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
125
146
|
}
|
|
126
147
|
});
|
|
127
148
|
_defineProperty(this, "onResolve", data => {
|
|
149
|
+
var _getAspectRatioForUrl;
|
|
128
150
|
const {
|
|
129
151
|
view
|
|
130
152
|
} = this.props;
|
|
131
153
|
const {
|
|
132
154
|
title,
|
|
133
155
|
url,
|
|
134
|
-
aspectRatio
|
|
156
|
+
aspectRatio: resolvedAspectRatio
|
|
135
157
|
} = data;
|
|
136
158
|
const {
|
|
137
159
|
originalHeight,
|
|
138
160
|
originalWidth
|
|
139
161
|
} = this.props.node.attrs;
|
|
162
|
+
const aspectRatio = (_getAspectRatioForUrl = getAspectRatioForUrl(url)) !== null && _getAspectRatioForUrl !== void 0 ? _getAspectRatioForUrl : resolvedAspectRatio;
|
|
140
163
|
if (aspectRatio && !originalHeight && !originalWidth) {
|
|
141
164
|
// Assumption here is if ADF already have both height and width set,
|
|
142
165
|
// we will going to use that later on in this class as aspectRatio
|
|
@@ -16,6 +16,7 @@ import rafSchedule from 'raf-schd';
|
|
|
16
16
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
17
17
|
import uuid from 'uuid/v4';
|
|
18
18
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
19
|
+
import { isConfluenceSlideUrl } from '@atlaskit/editor-card-provider/url-checkers';
|
|
19
20
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
20
21
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
21
22
|
import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
@@ -27,11 +28,31 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
27
28
|
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
28
29
|
import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
|
|
29
30
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
31
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
30
32
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
31
33
|
import { registerCard, removeCard as _removeCard } from '../pm-plugins/actions';
|
|
32
34
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
33
35
|
import { BlockCardComponent } from './blockCard';
|
|
34
36
|
import { Card } from './genericCard';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
40
|
+
* overriding the generic value returned by the link resolver.
|
|
41
|
+
* Add new URL checks here as more content types get fixed aspect ratios.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
45
|
+
* or `undefined` to use the default resolver-provided ratio.
|
|
46
|
+
*
|
|
47
|
+
* @internal Exported for testing only.
|
|
48
|
+
*/
|
|
49
|
+
export var getAspectRatioForUrl = function getAspectRatioForUrl(url) {
|
|
50
|
+
if (expValEqualsNoExposure('cc-mui-slides-experiment', 'isEnabled', true) && url && isConfluenceSlideUrl(url)) {
|
|
51
|
+
// Slides have a 16:9 canvas
|
|
52
|
+
return 16 / 9;
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
};
|
|
35
56
|
var selector = function selector(states) {
|
|
36
57
|
var _states$widthState, _states$widthState2, _states$editorDisable;
|
|
37
58
|
return {
|
|
@@ -134,13 +155,15 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
134
155
|
}
|
|
135
156
|
});
|
|
136
157
|
_defineProperty(_this, "onResolve", function (data) {
|
|
158
|
+
var _getAspectRatioForUrl;
|
|
137
159
|
var view = _this.props.view;
|
|
138
160
|
var title = data.title,
|
|
139
161
|
url = data.url,
|
|
140
|
-
|
|
162
|
+
resolvedAspectRatio = data.aspectRatio;
|
|
141
163
|
var _this$props$node$attr = _this.props.node.attrs,
|
|
142
164
|
originalHeight = _this$props$node$attr.originalHeight,
|
|
143
165
|
originalWidth = _this$props$node$attr.originalWidth;
|
|
166
|
+
var aspectRatio = (_getAspectRatioForUrl = getAspectRatioForUrl(url)) !== null && _getAspectRatioForUrl !== void 0 ? _getAspectRatioForUrl : resolvedAspectRatio;
|
|
144
167
|
if (aspectRatio && !originalHeight && !originalWidth) {
|
|
145
168
|
// Assumption here is if ADF already have both height and width set,
|
|
146
169
|
// we will going to use that later on in this class as aspectRatio
|
|
@@ -7,6 +7,18 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import type { cardPlugin } from '../index';
|
|
9
9
|
import type { SmartCardProps } from './genericCard';
|
|
10
|
+
/**
|
|
11
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
12
|
+
* overriding the generic value returned by the link resolver.
|
|
13
|
+
* Add new URL checks here as more content types get fixed aspect ratios.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
17
|
+
* or `undefined` to use the default resolver-provided ratio.
|
|
18
|
+
*
|
|
19
|
+
* @internal Exported for testing only.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getAspectRatioForUrl: (url: string | undefined) => number | undefined;
|
|
10
22
|
export type EmbedCardState = {
|
|
11
23
|
hasPreview: boolean;
|
|
12
24
|
initialAspectRatio?: number;
|
|
@@ -7,6 +7,18 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import type { cardPlugin } from '../index';
|
|
9
9
|
import type { SmartCardProps } from './genericCard';
|
|
10
|
+
/**
|
|
11
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
12
|
+
* overriding the generic value returned by the link resolver.
|
|
13
|
+
* Add new URL checks here as more content types get fixed aspect ratios.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Returns a forced aspect ratio for URLs that have a known canvas shape,
|
|
17
|
+
* or `undefined` to use the default resolver-provided ratio.
|
|
18
|
+
*
|
|
19
|
+
* @internal Exported for testing only.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getAspectRatioForUrl: (url: string | undefined) => number | undefined;
|
|
10
22
|
export type EmbedCardState = {
|
|
11
23
|
hasPreview: boolean;
|
|
12
24
|
initialAspectRatio?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "16.0
|
|
3
|
+
"version": "16.1.0",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@atlaskit/adf-schema": "^52.5.0",
|
|
33
33
|
"@atlaskit/analytics-next": "^11.2.0",
|
|
34
34
|
"@atlaskit/custom-steps": "^0.16.0",
|
|
35
|
+
"@atlaskit/editor-card-provider": "^6.7.0",
|
|
35
36
|
"@atlaskit/editor-plugin-analytics": "^10.0.0",
|
|
36
37
|
"@atlaskit/editor-plugin-base": "^11.0.0",
|
|
37
38
|
"@atlaskit/editor-plugin-connectivity": "^10.0.0",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"@atlaskit/link": "^3.4.0",
|
|
52
53
|
"@atlaskit/link-analytics": "^11.0.0",
|
|
53
54
|
"@atlaskit/link-client-extension": "^6.0.0",
|
|
54
|
-
"@atlaskit/link-datasource": "^5.
|
|
55
|
+
"@atlaskit/link-datasource": "^5.1.0",
|
|
55
56
|
"@atlaskit/link-extractors": "^2.4.0",
|
|
56
57
|
"@atlaskit/linking-common": "^9.11.0",
|
|
57
58
|
"@atlaskit/linking-types": "^14.2.0",
|
|
@@ -60,8 +61,8 @@
|
|
|
60
61
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
61
62
|
"@atlaskit/primitives": "^19.0.0",
|
|
62
63
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
63
|
-
"@atlaskit/smart-card": "^44.
|
|
64
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
64
|
+
"@atlaskit/smart-card": "^44.3.0",
|
|
65
|
+
"@atlaskit/tmp-editor-statsig": "^64.0.0",
|
|
65
66
|
"@atlaskit/tokens": "^13.0.0",
|
|
66
67
|
"@babel/runtime": "^7.0.0",
|
|
67
68
|
"@emotion/react": "^11.7.1",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"uuid": "^3.1.0"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
|
-
"@atlaskit/editor-common": "^114.
|
|
75
|
+
"@atlaskit/editor-common": "^114.6.0",
|
|
75
76
|
"@atlaskit/link-provider": "^4.3.0",
|
|
76
77
|
"react": "^18.2.0",
|
|
77
78
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|