@atlaskit/editor-plugin-card 3.0.1 → 3.0.2
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
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 3.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#139456](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139456)
|
|
8
|
+
[`a788f5ceac7a2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a788f5ceac7a2) -
|
|
9
|
+
[ux] When FF hardcoded-embeds-only-on-new-line is true pasting of some urls (like youtube or jira
|
|
10
|
+
dashboard or conny whiteboards) will only become embed right away if pasted on a new line in a
|
|
11
|
+
root of the document
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 3.0.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -5,21 +5,45 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.resolveWithProvider = exports.handleProvider = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var _actions = require("../actions");
|
|
9
10
|
var _doc = require("../doc");
|
|
11
|
+
var isFreshlyPastedOnNewLine = function isFreshlyPastedOnNewLine(view) {
|
|
12
|
+
var selection = view.state.selection;
|
|
13
|
+
var _ref = selection,
|
|
14
|
+
$cursor = _ref.$cursor,
|
|
15
|
+
$anchor = _ref.$anchor;
|
|
16
|
+
if (!$cursor) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (!(0, _utils.hasDocAsParent)($anchor)) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
var node = $cursor.node();
|
|
23
|
+
if (!node) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (node.type.name !== 'paragraph') {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return node.childCount === 1; // The pasted blue link itself
|
|
30
|
+
};
|
|
31
|
+
|
|
10
32
|
// ============================================================================ //
|
|
11
33
|
// ============================== PROVIDER UTILS ============================== //
|
|
12
34
|
// ============================================================================ //
|
|
13
35
|
// Used for all interactions with the EditorCardProvider.
|
|
14
36
|
// ============================================================================ //
|
|
15
37
|
var resolveWithProvider = exports.resolveWithProvider = function resolveWithProvider(view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent) {
|
|
38
|
+
var isEmbedFriendlyLocation = (0, _platformFeatureFlags.fg)('hardcoded-embeds-only-on-new-line') ? isFreshlyPastedOnNewLine(view) : true;
|
|
39
|
+
|
|
16
40
|
// When user manually changes appearance from blue link to smart link, we should respect that,
|
|
17
41
|
var shouldForceAppearance =
|
|
18
42
|
// This flag is set to true only in one place atm:
|
|
19
43
|
// packages/editor/editor-core/src/plugins/card/pm-plugins/doc.ts @ convertHyperlinkToSmartCard
|
|
20
44
|
// Which is used when user switching from URL to smart link appearance.
|
|
21
45
|
!!request.shouldReplaceLink;
|
|
22
|
-
var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
|
|
46
|
+
var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance, isEmbedFriendlyLocation).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
|
|
23
47
|
return handleResolve;
|
|
24
48
|
};
|
|
25
49
|
var updateCardType = function updateCardType(resolvedCard, options) {
|
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
1
|
+
import { canRenderDatasource, hasDocAsParent } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { setProvider } from '../actions';
|
|
3
4
|
import { handleFallbackWithAnalytics, replaceQueuedUrlWithCard } from '../doc';
|
|
5
|
+
const isFreshlyPastedOnNewLine = view => {
|
|
6
|
+
const {
|
|
7
|
+
selection
|
|
8
|
+
} = view.state;
|
|
9
|
+
const {
|
|
10
|
+
$cursor,
|
|
11
|
+
$anchor
|
|
12
|
+
} = selection;
|
|
13
|
+
if (!$cursor) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (!hasDocAsParent($anchor)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const node = $cursor.node();
|
|
20
|
+
if (!node) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (node.type.name !== 'paragraph') {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return node.childCount === 1; // The pasted blue link itself
|
|
27
|
+
};
|
|
4
28
|
|
|
5
29
|
// ============================================================================ //
|
|
6
30
|
// ============================== PROVIDER UTILS ============================== //
|
|
@@ -8,13 +32,15 @@ import { handleFallbackWithAnalytics, replaceQueuedUrlWithCard } from '../doc';
|
|
|
8
32
|
// Used for all interactions with the EditorCardProvider.
|
|
9
33
|
// ============================================================================ //
|
|
10
34
|
export const resolveWithProvider = (view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent) => {
|
|
35
|
+
const isEmbedFriendlyLocation = fg('hardcoded-embeds-only-on-new-line') ? isFreshlyPastedOnNewLine(view) : true;
|
|
36
|
+
|
|
11
37
|
// When user manually changes appearance from blue link to smart link, we should respect that,
|
|
12
38
|
let shouldForceAppearance =
|
|
13
39
|
// This flag is set to true only in one place atm:
|
|
14
40
|
// packages/editor/editor-core/src/plugins/card/pm-plugins/doc.ts @ convertHyperlinkToSmartCard
|
|
15
41
|
// Which is used when user switching from URL to smart link appearance.
|
|
16
42
|
!!request.shouldReplaceLink;
|
|
17
|
-
const handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
|
|
43
|
+
const handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance, isEmbedFriendlyLocation).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
|
|
18
44
|
return handleResolve;
|
|
19
45
|
};
|
|
20
46
|
const updateCardType = (resolvedCard, options) => {
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
-
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
1
|
+
import { canRenderDatasource, hasDocAsParent } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { setProvider } from '../actions';
|
|
3
4
|
import { handleFallbackWithAnalytics, replaceQueuedUrlWithCard } from '../doc';
|
|
5
|
+
var isFreshlyPastedOnNewLine = function isFreshlyPastedOnNewLine(view) {
|
|
6
|
+
var selection = view.state.selection;
|
|
7
|
+
var _ref = selection,
|
|
8
|
+
$cursor = _ref.$cursor,
|
|
9
|
+
$anchor = _ref.$anchor;
|
|
10
|
+
if (!$cursor) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (!hasDocAsParent($anchor)) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
var node = $cursor.node();
|
|
17
|
+
if (!node) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (node.type.name !== 'paragraph') {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return node.childCount === 1; // The pasted blue link itself
|
|
24
|
+
};
|
|
4
25
|
|
|
5
26
|
// ============================================================================ //
|
|
6
27
|
// ============================== PROVIDER UTILS ============================== //
|
|
@@ -8,13 +29,15 @@ import { handleFallbackWithAnalytics, replaceQueuedUrlWithCard } from '../doc';
|
|
|
8
29
|
// Used for all interactions with the EditorCardProvider.
|
|
9
30
|
// ============================================================================ //
|
|
10
31
|
export var resolveWithProvider = function resolveWithProvider(view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent) {
|
|
32
|
+
var isEmbedFriendlyLocation = fg('hardcoded-embeds-only-on-new-line') ? isFreshlyPastedOnNewLine(view) : true;
|
|
33
|
+
|
|
11
34
|
// When user manually changes appearance from blue link to smart link, we should respect that,
|
|
12
35
|
var shouldForceAppearance =
|
|
13
36
|
// This flag is set to true only in one place atm:
|
|
14
37
|
// packages/editor/editor-core/src/plugins/card/pm-plugins/doc.ts @ convertHyperlinkToSmartCard
|
|
15
38
|
// Which is used when user switching from URL to smart link appearance.
|
|
16
39
|
!!request.shouldReplaceLink;
|
|
17
|
-
var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
|
|
40
|
+
var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance, isEmbedFriendlyLocation).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
|
|
18
41
|
return handleResolve;
|
|
19
42
|
};
|
|
20
43
|
var updateCardType = function updateCardType(resolvedCard, options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,21 +34,21 @@
|
|
|
34
34
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
35
35
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
36
36
|
"@atlaskit/custom-steps": "^0.7.0",
|
|
37
|
-
"@atlaskit/editor-common": "^89.
|
|
37
|
+
"@atlaskit/editor-common": "^89.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^1.3.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
41
41
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
42
42
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
43
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^1.
|
|
43
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^1.13.0",
|
|
44
44
|
"@atlaskit/editor-plugin-grid": "^1.2.0",
|
|
45
45
|
"@atlaskit/editor-plugin-width": "^1.3.0",
|
|
46
46
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
47
47
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
48
48
|
"@atlaskit/frontend-utilities": "^2.7.0",
|
|
49
|
-
"@atlaskit/icon": "^22.
|
|
49
|
+
"@atlaskit/icon": "^22.18.0",
|
|
50
50
|
"@atlaskit/link-analytics": "^8.5.0",
|
|
51
|
-
"@atlaskit/link-client-extension": "^2.
|
|
51
|
+
"@atlaskit/link-client-extension": "^2.4.0",
|
|
52
52
|
"@atlaskit/link-datasource": "^3.0.0",
|
|
53
53
|
"@atlaskit/linking-common": "^5.11.0",
|
|
54
54
|
"@atlaskit/linking-types": "^9.0.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@atlaskit/smart-card": "^28.1.0",
|
|
59
59
|
"@atlaskit/theme": "^13.0.0",
|
|
60
60
|
"@atlaskit/tmp-editor-statsig": "^2.1.8",
|
|
61
|
-
"@atlaskit/tokens": "^1.
|
|
61
|
+
"@atlaskit/tokens": "^1.60.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
63
63
|
"@emotion/react": "^11.7.1",
|
|
64
64
|
"lodash": "^4.17.21",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"raf-schd": "^4.0.3"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@atlaskit/link-provider": "^1.
|
|
69
|
+
"@atlaskit/link-provider": "^1.16.0",
|
|
70
70
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
71
71
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
72
72
|
},
|
|
@@ -134,6 +134,9 @@
|
|
|
134
134
|
},
|
|
135
135
|
"editor_inline_comments_paste_insert_nodes": {
|
|
136
136
|
"type": "boolean"
|
|
137
|
+
},
|
|
138
|
+
"hardcoded-embeds-only-on-new-line": {
|
|
139
|
+
"type": "boolean"
|
|
137
140
|
}
|
|
138
141
|
},
|
|
139
142
|
"stricter": {
|