@atlaskit/editor-plugin-card 16.8.1 → 16.9.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 CHANGED
@@ -1,5 +1,39 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 16.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2e9c8b4281869`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2e9c8b4281869) -
8
+ [EDITOR-6965] Add `onlyInlineCards` option to the card plugin and enable inline Smart Links in the
9
+ Confluence markdown preset.
10
+ - `@atlaskit/editor-common`: add optional `onlyInlineCards?: boolean` to `CardOptions`. Defaults
11
+ to `false` (back-compat). When `true`, the card plugin contributes only the `inlineCard` node to
12
+ the schema and forces `allowBlockCards` / `allowEmbeds` to `false` at runtime regardless of
13
+ their explicit values.
14
+ - `@atlaskit/editor-plugin-card`: honour `onlyInlineCards` in both `nodes()` (skip `blockCard` /
15
+ `embedCard` entirely) and `pmPlugins()` (force the runtime gates so schema and runtime stay in
16
+ sync).
17
+ - `@atlassian/confluence-presets`: `markdownPreset` now `.maybeAdd`s `cardPlugin` after the
18
+ annotation block when `pluginOptions.card` is supplied, hard-coding `onlyInlineCards: true` so
19
+ the preset itself guarantees the inline-only constraint. Adds `'card'` to
20
+ `MarkdownPluginOptionsKeys` and `CardPlugin` to `MarkdownPresetPluginsReversed`. `cardPlugin` is
21
+ removed from the "intentionally excluded" comment block.
22
+
23
+ Existing callers of `cardPlugin` and `markdownPreset` are unaffected: `onlyInlineCards` defaults
24
+ to `false`, and `cardPlugin` is only added to the markdown preset when callers supply
25
+ `pluginOptions.card`.
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+
31
+ ## 16.8.2
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies
36
+
3
37
  ## 16.8.1
4
38
 
5
39
  ### Patch Changes
@@ -66,10 +66,17 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
66
66
  var nodes = [{
67
67
  name: 'inlineCard',
68
68
  node: (0, _inlineCard.inlineCardSpecWithFixedToDOM)()
69
- }, {
69
+ }];
70
+
71
+ // `onlyInlineCards` is a hard gate: when set, blockCard/embedCard
72
+ // stay out of the schema regardless of allowBlockCards/allowEmbeds.
73
+ if (options.onlyInlineCards) {
74
+ return nodes;
75
+ }
76
+ nodes.push({
70
77
  name: 'blockCard',
71
78
  node: (0, _blockCard.blockCardSpecWithFixedToDOM)()
72
- }];
79
+ });
73
80
  if (options.allowEmbeds) {
74
81
  nodes.push({
75
82
  name: 'embedCard',
@@ -80,7 +87,10 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
80
87
  },
81
88
  pmPlugins: function pmPlugins() {
82
89
  var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme, _options$allowDatasou, _options$showUpgradeD;
83
- var allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
90
+ // onlyInlineCards forces block/embed off regardless of caller-passed flags,
91
+ // keeping the schema gate (in nodes()) and the runtime gate in sync.
92
+ var allowBlockCards = options.onlyInlineCards ? false : (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
93
+ var allowEmbeds = options.onlyInlineCards ? false : options.allowEmbeds;
84
94
  var allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
85
95
  var useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
86
96
  var allowWrapping = (_options$allowWrappin = options.allowWrapping) !== null && _options$allowWrappin !== void 0 ? _options$allowWrappin : true;
@@ -91,6 +101,7 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
91
101
  name: 'card',
92
102
  plugin: (0, _main.createPlugin)(_objectSpread(_objectSpread({}, options), {}, {
93
103
  allowBlockCards: allowBlockCards,
104
+ allowEmbeds: allowEmbeds,
94
105
  allowResizing: allowResizing,
95
106
  useAlternativePreloader: useAlternativePreloader,
96
107
  allowWrapping: allowWrapping,
@@ -61,10 +61,17 @@ export const cardPlugin = ({
61
61
  const nodes = [{
62
62
  name: 'inlineCard',
63
63
  node: inlineCardSpecWithFixedToDOM()
64
- }, {
64
+ }];
65
+
66
+ // `onlyInlineCards` is a hard gate: when set, blockCard/embedCard
67
+ // stay out of the schema regardless of allowBlockCards/allowEmbeds.
68
+ if (options.onlyInlineCards) {
69
+ return nodes;
70
+ }
71
+ nodes.push({
65
72
  name: 'blockCard',
66
73
  node: blockCardSpecWithFixedToDOM()
67
- }];
74
+ });
68
75
  if (options.allowEmbeds) {
69
76
  nodes.push({
70
77
  name: 'embedCard',
@@ -75,7 +82,10 @@ export const cardPlugin = ({
75
82
  },
76
83
  pmPlugins() {
77
84
  var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme, _options$allowDatasou, _options$showUpgradeD;
78
- const allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
85
+ // onlyInlineCards forces block/embed off regardless of caller-passed flags,
86
+ // keeping the schema gate (in nodes()) and the runtime gate in sync.
87
+ const allowBlockCards = options.onlyInlineCards ? false : (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
88
+ const allowEmbeds = options.onlyInlineCards ? false : options.allowEmbeds;
79
89
  const allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
80
90
  const useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
81
91
  const allowWrapping = (_options$allowWrappin = options.allowWrapping) !== null && _options$allowWrappin !== void 0 ? _options$allowWrappin : true;
@@ -87,6 +97,7 @@ export const cardPlugin = ({
87
97
  plugin: createPlugin({
88
98
  ...options,
89
99
  allowBlockCards,
100
+ allowEmbeds,
90
101
  allowResizing,
91
102
  useAlternativePreloader,
92
103
  allowWrapping,
@@ -60,10 +60,17 @@ export var cardPlugin = function cardPlugin(_ref) {
60
60
  var nodes = [{
61
61
  name: 'inlineCard',
62
62
  node: inlineCardSpecWithFixedToDOM()
63
- }, {
63
+ }];
64
+
65
+ // `onlyInlineCards` is a hard gate: when set, blockCard/embedCard
66
+ // stay out of the schema regardless of allowBlockCards/allowEmbeds.
67
+ if (options.onlyInlineCards) {
68
+ return nodes;
69
+ }
70
+ nodes.push({
64
71
  name: 'blockCard',
65
72
  node: blockCardSpecWithFixedToDOM()
66
- }];
73
+ });
67
74
  if (options.allowEmbeds) {
68
75
  nodes.push({
69
76
  name: 'embedCard',
@@ -74,7 +81,10 @@ export var cardPlugin = function cardPlugin(_ref) {
74
81
  },
75
82
  pmPlugins: function pmPlugins() {
76
83
  var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme, _options$allowDatasou, _options$showUpgradeD;
77
- var allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
84
+ // onlyInlineCards forces block/embed off regardless of caller-passed flags,
85
+ // keeping the schema gate (in nodes()) and the runtime gate in sync.
86
+ var allowBlockCards = options.onlyInlineCards ? false : (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
87
+ var allowEmbeds = options.onlyInlineCards ? false : options.allowEmbeds;
78
88
  var allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
79
89
  var useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
80
90
  var allowWrapping = (_options$allowWrappin = options.allowWrapping) !== null && _options$allowWrappin !== void 0 ? _options$allowWrappin : true;
@@ -85,6 +95,7 @@ export var cardPlugin = function cardPlugin(_ref) {
85
95
  name: 'card',
86
96
  plugin: createPlugin(_objectSpread(_objectSpread({}, options), {}, {
87
97
  allowBlockCards: allowBlockCards,
98
+ allowEmbeds: allowEmbeds,
88
99
  allowResizing: allowResizing,
89
100
  useAlternativePreloader: useAlternativePreloader,
90
101
  allowWrapping: allowWrapping,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "16.8.1",
3
+ "version": "16.9.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,9 +31,9 @@
31
31
  "dependencies": {
32
32
  "@atlaskit/adf-schema": "^52.11.0",
33
33
  "@atlaskit/analytics-next": "^11.2.0",
34
- "@atlaskit/custom-steps": "^0.16.0",
35
- "@atlaskit/editor-card-provider": "^6.7.0",
36
- "@atlaskit/editor-plugin-analytics": "^10.0.0",
34
+ "@atlaskit/custom-steps": "^0.17.0",
35
+ "@atlaskit/editor-card-provider": "^6.8.0",
36
+ "@atlaskit/editor-plugin-analytics": "^10.1.0",
37
37
  "@atlaskit/editor-plugin-base": "^11.1.0",
38
38
  "@atlaskit/editor-plugin-connectivity": "^10.1.0",
39
39
  "@atlaskit/editor-plugin-decorations": "^10.1.0",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/editor-shared-styles": "^3.11.0",
49
49
  "@atlaskit/editor-smart-link-draggable": "^0.5.0",
50
50
  "@atlaskit/frontend-utilities": "^3.3.0",
51
- "@atlaskit/icon": "^34.5.0",
51
+ "@atlaskit/icon": "^34.6.0",
52
52
  "@atlaskit/link": "^3.4.0",
53
53
  "@atlaskit/link-analytics": "^11.0.0",
54
54
  "@atlaskit/link-client-extension": "^6.0.0",
@@ -62,7 +62,7 @@
62
62
  "@atlaskit/primitives": "^19.0.0",
63
63
  "@atlaskit/prosemirror-history": "^0.2.0",
64
64
  "@atlaskit/smart-card": "^44.11.0",
65
- "@atlaskit/tmp-editor-statsig": "^80.3.0",
65
+ "@atlaskit/tmp-editor-statsig": "^81.0.0",
66
66
  "@atlaskit/tokens": "^13.0.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@emotion/react": "^11.7.1",
@@ -72,7 +72,7 @@
72
72
  "uuid": "^3.1.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^114.32.0",
75
+ "@atlaskit/editor-common": "^114.33.0",
76
76
  "@atlaskit/link-provider": "^4.4.0",
77
77
  "react": "^18.2.0",
78
78
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"