@atlaskit/editor-plugin-card 17.0.0 → 17.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
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 17.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 17.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`9b4d6873a7ed0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9b4d6873a7ed0) -
|
|
14
|
+
Delegate the paste-display-as menu's single-link check to the paste-options-toolbar plugin's
|
|
15
|
+
shared `notSingleLinkRule` via its `actions.getPasteMenuRules()` API, reached through the existing
|
|
16
|
+
structural-cast pattern. Keeps the predicate in one place and avoids duplicating it across the
|
|
17
|
+
package cycle.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 17.0.0
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -32,12 +32,14 @@ var _pasteDisplayAsUtils = require("./pasteDisplayAsUtils");
|
|
|
32
32
|
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); }
|
|
33
33
|
var SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION_KEY = exports.SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION_KEY = 'smart-link-display-as-paste-menu-section';
|
|
34
34
|
|
|
35
|
+
// Subset of `PasteMenuRuleFactories` we structurally consume here — kept local
|
|
36
|
+
// to avoid importing the toolbar package (see cycle note below).
|
|
37
|
+
|
|
35
38
|
// `pasteOptionsToolbarPlugin` is intentionally NOT declared in `CardPluginDependencies`
|
|
36
39
|
// because doing so introduces a runtime package cycle
|
|
37
40
|
// (editor-plugin-card -> editor-plugin-paste-options-toolbar -> editor-plugin-paste
|
|
38
41
|
// -> editor-plugin-card) AND a TS2719 "two different types with this name exist" error
|
|
39
|
-
// at downstream consumers (e.g. Jira's `EditorAfterBanner.tsx`).
|
|
40
|
-
// `api` shape locally at the call sites that need to read the plugin's shared state.
|
|
42
|
+
// at downstream consumers (e.g. Jira's `EditorAfterBanner.tsx`). The `api` shape is augmented locally instead.
|
|
41
43
|
|
|
42
44
|
var styles = {
|
|
43
45
|
appearanceBox: "_2rko1qi0 _bfhkhfxm _19pku2gc _2hwxu2gc _otyru2gc _18u0u2gc _ca0q1b66 _u5f31b66 _n3td1b66 _19bv1b66",
|
|
@@ -341,21 +343,28 @@ var getPasteDisplayAsMenuComponents = exports.getPasteDisplayAsMenuComponents =
|
|
|
341
343
|
rank: 60
|
|
342
344
|
}],
|
|
343
345
|
isHidden: function isHidden() {
|
|
344
|
-
var _apiWithPasteOptionsT;
|
|
346
|
+
var _apiWithPasteOptionsT, _apiWithPasteOptionsT2;
|
|
345
347
|
var apiWithPasteOptionsToolbar = api;
|
|
346
348
|
var pasteRange = apiWithPasteOptionsToolbar === null || apiWithPasteOptionsToolbar === void 0 || (_apiWithPasteOptionsT = apiWithPasteOptionsToolbar.pasteOptionsToolbarPlugin) === null || _apiWithPasteOptionsT === void 0 ? void 0 : _apiWithPasteOptionsT.sharedState.currentState();
|
|
347
349
|
var editorView = getEditorView();
|
|
348
350
|
if (!editorView || !pasteRange) {
|
|
349
351
|
return true;
|
|
350
352
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
+
|
|
354
|
+
// Slice-shape check — delegated to the toolbar plugin's shared
|
|
355
|
+
// `notSingleLinkRule` via the structural cast (see note above).
|
|
356
|
+
var rules = apiWithPasteOptionsToolbar === null || apiWithPasteOptionsToolbar === void 0 || (_apiWithPasteOptionsT2 = apiWithPasteOptionsToolbar.pasteOptionsToolbarPlugin) === null || _apiWithPasteOptionsT2 === void 0 ? void 0 : _apiWithPasteOptionsT2.actions.getPasteMenuRules();
|
|
357
|
+
if (!rules || rules.notSingleLinkRule()) {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Fallback: plain-text URL paste that the card plugin already resolved into a card node in the doc.
|
|
353
362
|
var urlFromCard = getCardUrlAtPasteRange({
|
|
354
363
|
editorView: editorView,
|
|
355
364
|
pasteStartPos: pasteRange.pasteStartPos,
|
|
356
365
|
pasteEndPos: pasteRange.pasteEndPos
|
|
357
366
|
});
|
|
358
|
-
return !
|
|
367
|
+
return !urlFromCard;
|
|
359
368
|
},
|
|
360
369
|
component: function component() {
|
|
361
370
|
return /*#__PURE__*/_react.default.createElement(PasteDisplayAsMenuSection, {
|
|
@@ -23,12 +23,14 @@ import { getSingleSmartLinkUrlFromSlice } from './currentPastedSmartLink';
|
|
|
23
23
|
import { getCardAtPasteRange } from './pasteDisplayAsUtils';
|
|
24
24
|
export const SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION_KEY = 'smart-link-display-as-paste-menu-section';
|
|
25
25
|
|
|
26
|
+
// Subset of `PasteMenuRuleFactories` we structurally consume here — kept local
|
|
27
|
+
// to avoid importing the toolbar package (see cycle note below).
|
|
28
|
+
|
|
26
29
|
// `pasteOptionsToolbarPlugin` is intentionally NOT declared in `CardPluginDependencies`
|
|
27
30
|
// because doing so introduces a runtime package cycle
|
|
28
31
|
// (editor-plugin-card -> editor-plugin-paste-options-toolbar -> editor-plugin-paste
|
|
29
32
|
// -> editor-plugin-card) AND a TS2719 "two different types with this name exist" error
|
|
30
|
-
// at downstream consumers (e.g. Jira's `EditorAfterBanner.tsx`).
|
|
31
|
-
// `api` shape locally at the call sites that need to read the plugin's shared state.
|
|
33
|
+
// at downstream consumers (e.g. Jira's `EditorAfterBanner.tsx`). The `api` shape is augmented locally instead.
|
|
32
34
|
|
|
33
35
|
const styles = {
|
|
34
36
|
appearanceBox: "_2rko1qi0 _bfhkhfxm _19pku2gc _2hwxu2gc _otyru2gc _18u0u2gc _ca0q1b66 _u5f31b66 _n3td1b66 _19bv1b66",
|
|
@@ -342,21 +344,28 @@ export const getPasteDisplayAsMenuComponents = ({
|
|
|
342
344
|
rank: 60
|
|
343
345
|
}],
|
|
344
346
|
isHidden: () => {
|
|
345
|
-
var _apiWithPasteOptionsT;
|
|
347
|
+
var _apiWithPasteOptionsT, _apiWithPasteOptionsT2;
|
|
346
348
|
const apiWithPasteOptionsToolbar = api;
|
|
347
349
|
const pasteRange = apiWithPasteOptionsToolbar === null || apiWithPasteOptionsToolbar === void 0 ? void 0 : (_apiWithPasteOptionsT = apiWithPasteOptionsToolbar.pasteOptionsToolbarPlugin) === null || _apiWithPasteOptionsT === void 0 ? void 0 : _apiWithPasteOptionsT.sharedState.currentState();
|
|
348
350
|
const editorView = getEditorView();
|
|
349
351
|
if (!editorView || !pasteRange) {
|
|
350
352
|
return true;
|
|
351
353
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
+
|
|
355
|
+
// Slice-shape check — delegated to the toolbar plugin's shared
|
|
356
|
+
// `notSingleLinkRule` via the structural cast (see note above).
|
|
357
|
+
const rules = apiWithPasteOptionsToolbar === null || apiWithPasteOptionsToolbar === void 0 ? void 0 : (_apiWithPasteOptionsT2 = apiWithPasteOptionsToolbar.pasteOptionsToolbarPlugin) === null || _apiWithPasteOptionsT2 === void 0 ? void 0 : _apiWithPasteOptionsT2.actions.getPasteMenuRules();
|
|
358
|
+
if (!rules || rules.notSingleLinkRule()) {
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Fallback: plain-text URL paste that the card plugin already resolved into a card node in the doc.
|
|
354
363
|
const urlFromCard = getCardUrlAtPasteRange({
|
|
355
364
|
editorView,
|
|
356
365
|
pasteStartPos: pasteRange.pasteStartPos,
|
|
357
366
|
pasteEndPos: pasteRange.pasteEndPos
|
|
358
367
|
});
|
|
359
|
-
return !
|
|
368
|
+
return !urlFromCard;
|
|
360
369
|
},
|
|
361
370
|
component: () => /*#__PURE__*/React.createElement(PasteDisplayAsMenuSection, {
|
|
362
371
|
api: api,
|
|
@@ -23,12 +23,14 @@ import { getSingleSmartLinkUrlFromSlice } from './currentPastedSmartLink';
|
|
|
23
23
|
import { getCardAtPasteRange } from './pasteDisplayAsUtils';
|
|
24
24
|
export var SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION_KEY = 'smart-link-display-as-paste-menu-section';
|
|
25
25
|
|
|
26
|
+
// Subset of `PasteMenuRuleFactories` we structurally consume here — kept local
|
|
27
|
+
// to avoid importing the toolbar package (see cycle note below).
|
|
28
|
+
|
|
26
29
|
// `pasteOptionsToolbarPlugin` is intentionally NOT declared in `CardPluginDependencies`
|
|
27
30
|
// because doing so introduces a runtime package cycle
|
|
28
31
|
// (editor-plugin-card -> editor-plugin-paste-options-toolbar -> editor-plugin-paste
|
|
29
32
|
// -> editor-plugin-card) AND a TS2719 "two different types with this name exist" error
|
|
30
|
-
// at downstream consumers (e.g. Jira's `EditorAfterBanner.tsx`).
|
|
31
|
-
// `api` shape locally at the call sites that need to read the plugin's shared state.
|
|
33
|
+
// at downstream consumers (e.g. Jira's `EditorAfterBanner.tsx`). The `api` shape is augmented locally instead.
|
|
32
34
|
|
|
33
35
|
var styles = {
|
|
34
36
|
appearanceBox: "_2rko1qi0 _bfhkhfxm _19pku2gc _2hwxu2gc _otyru2gc _18u0u2gc _ca0q1b66 _u5f31b66 _n3td1b66 _19bv1b66",
|
|
@@ -332,21 +334,28 @@ export var getPasteDisplayAsMenuComponents = function getPasteDisplayAsMenuCompo
|
|
|
332
334
|
rank: 60
|
|
333
335
|
}],
|
|
334
336
|
isHidden: function isHidden() {
|
|
335
|
-
var _apiWithPasteOptionsT;
|
|
337
|
+
var _apiWithPasteOptionsT, _apiWithPasteOptionsT2;
|
|
336
338
|
var apiWithPasteOptionsToolbar = api;
|
|
337
339
|
var pasteRange = apiWithPasteOptionsToolbar === null || apiWithPasteOptionsToolbar === void 0 || (_apiWithPasteOptionsT = apiWithPasteOptionsToolbar.pasteOptionsToolbarPlugin) === null || _apiWithPasteOptionsT === void 0 ? void 0 : _apiWithPasteOptionsT.sharedState.currentState();
|
|
338
340
|
var editorView = getEditorView();
|
|
339
341
|
if (!editorView || !pasteRange) {
|
|
340
342
|
return true;
|
|
341
343
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
|
|
345
|
+
// Slice-shape check — delegated to the toolbar plugin's shared
|
|
346
|
+
// `notSingleLinkRule` via the structural cast (see note above).
|
|
347
|
+
var rules = apiWithPasteOptionsToolbar === null || apiWithPasteOptionsToolbar === void 0 || (_apiWithPasteOptionsT2 = apiWithPasteOptionsToolbar.pasteOptionsToolbarPlugin) === null || _apiWithPasteOptionsT2 === void 0 ? void 0 : _apiWithPasteOptionsT2.actions.getPasteMenuRules();
|
|
348
|
+
if (!rules || rules.notSingleLinkRule()) {
|
|
349
|
+
return true;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Fallback: plain-text URL paste that the card plugin already resolved into a card node in the doc.
|
|
344
353
|
var urlFromCard = getCardUrlAtPasteRange({
|
|
345
354
|
editorView: editorView,
|
|
346
355
|
pasteStartPos: pasteRange.pasteStartPos,
|
|
347
356
|
pasteEndPos: pasteRange.pasteEndPos
|
|
348
357
|
});
|
|
349
|
-
return !
|
|
358
|
+
return !urlFromCard;
|
|
350
359
|
},
|
|
351
360
|
component: function component() {
|
|
352
361
|
return /*#__PURE__*/React.createElement(PasteDisplayAsMenuSection, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.1.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^52.
|
|
33
|
-
"@atlaskit/analytics-next": "^11.
|
|
32
|
+
"@atlaskit/adf-schema": "^52.16.0",
|
|
33
|
+
"@atlaskit/analytics-next": "^11.3.0",
|
|
34
34
|
"@atlaskit/button": "^23.11.0",
|
|
35
35
|
"@atlaskit/css": "^0.19.0",
|
|
36
36
|
"@atlaskit/custom-steps": "^0.17.0",
|
|
@@ -50,23 +50,23 @@
|
|
|
50
50
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
51
51
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
52
52
|
"@atlaskit/editor-smart-link-draggable": "^0.5.0",
|
|
53
|
-
"@atlaskit/editor-toolbar": "^1.
|
|
54
|
-
"@atlaskit/frontend-utilities": "^3.
|
|
55
|
-
"@atlaskit/icon": "^35.
|
|
53
|
+
"@atlaskit/editor-toolbar": "^1.10.0",
|
|
54
|
+
"@atlaskit/frontend-utilities": "^3.4.0",
|
|
55
|
+
"@atlaskit/icon": "^35.4.0",
|
|
56
56
|
"@atlaskit/link": "^3.4.0",
|
|
57
57
|
"@atlaskit/link-analytics": "^11.1.0",
|
|
58
58
|
"@atlaskit/link-client-extension": "^6.1.0",
|
|
59
|
-
"@atlaskit/link-datasource": "^5.
|
|
59
|
+
"@atlaskit/link-datasource": "^5.6.0",
|
|
60
60
|
"@atlaskit/link-extractors": "^2.7.0",
|
|
61
|
-
"@atlaskit/linking-common": "^9.
|
|
61
|
+
"@atlaskit/linking-common": "^9.13.0",
|
|
62
62
|
"@atlaskit/linking-types": "^14.4.0",
|
|
63
63
|
"@atlaskit/menu": "^8.5.0",
|
|
64
64
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
65
65
|
"@atlaskit/platform-feature-flags-react": "^0.5.0",
|
|
66
66
|
"@atlaskit/primitives": "^19.0.0",
|
|
67
67
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
68
|
-
"@atlaskit/smart-card": "^44.
|
|
69
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
68
|
+
"@atlaskit/smart-card": "^44.22.0",
|
|
69
|
+
"@atlaskit/tmp-editor-statsig": "^89.0.0",
|
|
70
70
|
"@atlaskit/tokens": "^13.1.0",
|
|
71
71
|
"@babel/runtime": "^7.0.0",
|
|
72
72
|
"@emotion/react": "^11.7.1",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"uuid": "^3.1.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@atlaskit/editor-common": "^115.
|
|
80
|
-
"@atlaskit/link-provider": "^4.
|
|
79
|
+
"@atlaskit/editor-common": "^115.2.0",
|
|
80
|
+
"@atlaskit/link-provider": "^4.5.0",
|
|
81
81
|
"react": "^18.2.0",
|
|
82
82
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
83
83
|
},
|