@atlaskit/editor-plugin-block-type 5.0.1 → 5.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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 5.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#120472](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120472)
8
+ [`4758d7dd443dd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4758d7dd443dd) -
9
+ [ux] ED-26766 update adf-schema from 47.2.1 to 47.6.0 and adf-schema-json from 1.27.0 to 1.31.0
10
+ and feature gated the usage of new prosemirror nodes in blockTypePlugin, expandPlugin, listPlugin
11
+ and panelPlugin as the new defaults of these nodes support nesting of extensions
12
+ - [#120472](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120472)
13
+ [`73c800ab5f2fc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/73c800ab5f2fc) -
14
+ ED-26766 update adf-schema from 47.2.1 to 47.6.0 and adf-schema-json from 1.27.0 to 1.31.0
15
+
16
+ ### Patch Changes
17
+
18
+ - [#120007](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120007)
19
+ [`e87df0a8c73c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e87df0a8c73c6) -
20
+ [ux] Do not add headings, lists, layouts, panels in the new QuickInsert menu
21
+ - Updated dependencies
22
+
23
+ ## 5.0.2
24
+
25
+ ### Patch Changes
26
+
27
+ - [#120931](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120931)
28
+ [`624b97c021fea`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/624b97c021fea) -
29
+ [ux] ED-26676 revert to existing primary toolbar components
30
+
3
31
  ## 5.0.1
4
32
 
5
33
  ### Patch Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.blockTypePlugin = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _react = _interopRequireDefault(require("react"));
10
11
  var _adfSchema = require("@atlaskit/adf-schema");
11
12
  var _analytics = require("@atlaskit/editor-common/analytics");
@@ -21,6 +22,8 @@ var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
21
22
  var _main = require("./pm-plugins/main");
22
23
  var _FloatingToolbarComponent = require("./pm-plugins/ui/FloatingToolbarComponent");
23
24
  var _PrimaryToolbarComponent = require("./pm-plugins/ui/PrimaryToolbarComponent");
25
+ 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; }
26
+ 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; }
24
27
  var headingPluginOptions = function headingPluginOptions(_ref, isAllowed, editorAnalyticsApi) {
25
28
  var formatMessage = _ref.formatMessage;
26
29
  if (!isAllowed) {
@@ -107,13 +110,6 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
107
110
  toolbarSize = _ref4.toolbarSize,
108
111
  disabled = _ref4.disabled,
109
112
  isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
110
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
111
- exposure: true
112
- })) {
113
- return /*#__PURE__*/_react.default.createElement(_FloatingToolbarComponent.FloatingToolbarComponent, {
114
- api: api
115
- });
116
- }
117
113
  var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < _types.ToolbarSize.XXL : toolbarSize < _types.ToolbarSize.XL;
118
114
  if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_responsive_fixes')) {
119
115
  isSmall = toolbarSize < _types.ToolbarSize.XXL;
@@ -136,12 +132,15 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
136
132
  return {
137
133
  name: 'blockType',
138
134
  nodes: function nodes() {
135
+ var blockquote = (0, _experiments.editorExperiment)('platform_editor_nested_non_bodied_macros', 'test', {
136
+ exposure: false
137
+ }) ? _adfSchema.extendedBlockquote : _adfSchema.blockquoteWithoutNonBodiedMacros;
139
138
  var nodes = [{
140
139
  name: 'heading',
141
140
  node: _adfSchema.heading
142
141
  }, {
143
142
  name: 'blockquote',
144
- node: _adfSchema.blockquoteWithNestedCodeblockOrMedia
143
+ node: blockquote
145
144
  }, {
146
145
  name: 'hardBreak',
147
146
  node: _adfSchema.hardBreak
@@ -210,7 +209,7 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
210
209
  return _main.pluginKey.getState(editorState);
211
210
  },
212
211
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
213
- pluginsOptions: {
212
+ pluginsOptions: _objectSpread({
214
213
  selectionToolbar: function selectionToolbar() {
215
214
  var _api$selectionToolbar;
216
215
  if ((api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
@@ -245,12 +244,13 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
245
244
  } else {
246
245
  return undefined;
247
246
  }
248
- },
247
+ }
248
+ }, (0, _experiments.editorExperiment)('platform_editor_insertion', 'control') && {
249
249
  quickInsert: function quickInsert(intl) {
250
250
  var _api$analytics7, _api$analytics8;
251
251
  var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
252
252
  return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)));
253
253
  }
254
- }
254
+ })
255
255
  };
256
256
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { blockquoteWithNestedCodeblockOrMedia, hardBreak, heading } from '@atlaskit/adf-schema';
2
+ import { extendedBlockquote, blockquoteWithoutNonBodiedMacros, hardBreak, heading } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { keymap, tooltip } from '@atlaskit/editor-common/keymaps';
5
5
  import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
@@ -99,13 +99,6 @@ const blockTypePlugin = ({
99
99
  disabled,
100
100
  isToolbarReducedSpacing
101
101
  }) => {
102
- if (editorExperiment('platform_editor_controls', 'variant1', {
103
- exposure: true
104
- })) {
105
- return /*#__PURE__*/React.createElement(FloatingToolbarComponent, {
106
- api: api
107
- });
108
- }
109
102
  let isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < ToolbarSize.XXL : toolbarSize < ToolbarSize.XL;
110
103
  if (fg('platform_editor_toolbar_responsive_fixes')) {
111
104
  isSmall = toolbarSize < ToolbarSize.XXL;
@@ -128,12 +121,15 @@ const blockTypePlugin = ({
128
121
  return {
129
122
  name: 'blockType',
130
123
  nodes() {
124
+ const blockquote = editorExperiment('platform_editor_nested_non_bodied_macros', 'test', {
125
+ exposure: false
126
+ }) ? extendedBlockquote : blockquoteWithoutNonBodiedMacros;
131
127
  const nodes = [{
132
128
  name: 'heading',
133
129
  node: heading
134
130
  }, {
135
131
  name: 'blockquote',
136
- node: blockquoteWithNestedCodeblockOrMedia
132
+ node: blockquote
137
133
  }, {
138
134
  name: 'hardBreak',
139
135
  node: hardBreak
@@ -236,11 +232,13 @@ const blockTypePlugin = ({
236
232
  return undefined;
237
233
  }
238
234
  },
239
- quickInsert: intl => {
240
- var _api$analytics7, _api$analytics8;
241
- const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
242
- return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)];
243
- }
235
+ ...(editorExperiment('platform_editor_insertion', 'control') && {
236
+ quickInsert: intl => {
237
+ var _api$analytics7, _api$analytics8;
238
+ const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
239
+ return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)];
240
+ }
241
+ })
244
242
  }
245
243
  };
246
244
  };
@@ -1,6 +1,9 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ 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; }
4
+ 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) { _defineProperty(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; }
2
5
  import React from 'react';
3
- import { blockquoteWithNestedCodeblockOrMedia, hardBreak, heading } from '@atlaskit/adf-schema';
6
+ import { extendedBlockquote, blockquoteWithoutNonBodiedMacros, hardBreak, heading } from '@atlaskit/adf-schema';
4
7
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
8
  import { keymap, tooltip } from '@atlaskit/editor-common/keymaps';
6
9
  import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
@@ -100,13 +103,6 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
100
103
  toolbarSize = _ref4.toolbarSize,
101
104
  disabled = _ref4.disabled,
102
105
  isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
103
- if (editorExperiment('platform_editor_controls', 'variant1', {
104
- exposure: true
105
- })) {
106
- return /*#__PURE__*/React.createElement(FloatingToolbarComponent, {
107
- api: api
108
- });
109
- }
110
106
  var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < ToolbarSize.XXL : toolbarSize < ToolbarSize.XL;
111
107
  if (fg('platform_editor_toolbar_responsive_fixes')) {
112
108
  isSmall = toolbarSize < ToolbarSize.XXL;
@@ -129,12 +125,15 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
129
125
  return {
130
126
  name: 'blockType',
131
127
  nodes: function nodes() {
128
+ var blockquote = editorExperiment('platform_editor_nested_non_bodied_macros', 'test', {
129
+ exposure: false
130
+ }) ? extendedBlockquote : blockquoteWithoutNonBodiedMacros;
132
131
  var nodes = [{
133
132
  name: 'heading',
134
133
  node: heading
135
134
  }, {
136
135
  name: 'blockquote',
137
- node: blockquoteWithNestedCodeblockOrMedia
136
+ node: blockquote
138
137
  }, {
139
138
  name: 'hardBreak',
140
139
  node: hardBreak
@@ -203,7 +202,7 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
203
202
  return pluginKey.getState(editorState);
204
203
  },
205
204
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
206
- pluginsOptions: {
205
+ pluginsOptions: _objectSpread({
207
206
  selectionToolbar: function selectionToolbar() {
208
207
  var _api$selectionToolbar;
209
208
  if ((api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top' && editorExperiment('platform_editor_controls', 'variant1', {
@@ -238,13 +237,14 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
238
237
  } else {
239
238
  return undefined;
240
239
  }
241
- },
240
+ }
241
+ }, editorExperiment('platform_editor_insertion', 'control') && {
242
242
  quickInsert: function quickInsert(intl) {
243
243
  var _api$analytics7, _api$analytics8;
244
244
  var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
245
245
  return [].concat(_toConsumableArray(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)), _toConsumableArray(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions)));
246
246
  }
247
- }
247
+ })
248
248
  };
249
249
  };
250
250
  export { blockTypePlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "5.0.1",
3
+ "version": "5.1.0",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,9 +35,9 @@
35
35
  "./styles": "./src/ui/styles.ts"
36
36
  },
37
37
  "dependencies": {
38
- "@atlaskit/adf-schema": "^47.2.1",
39
- "@atlaskit/editor-common": "^100.4.0",
40
- "@atlaskit/editor-plugin-analytics": "^2.0.0",
38
+ "@atlaskit/adf-schema": "^47.6.0",
39
+ "@atlaskit/editor-common": "^100.5.0",
40
+ "@atlaskit/editor-plugin-analytics": "^2.1.0",
41
41
  "@atlaskit/editor-plugin-primary-toolbar": "^3.0.0",
42
42
  "@atlaskit/editor-plugin-selection-toolbar": "^2.0.0",
43
43
  "@atlaskit/editor-prosemirror": "7.0.0",
@@ -48,8 +48,8 @@
48
48
  "@atlaskit/primitives": "^14.1.0",
49
49
  "@atlaskit/prosemirror-input-rules": "^3.3.0",
50
50
  "@atlaskit/theme": "^17.0.0",
51
- "@atlaskit/tmp-editor-statsig": "^3.3.0",
52
- "@atlaskit/tokens": "^4.2.0",
51
+ "@atlaskit/tmp-editor-statsig": "^3.4.0",
52
+ "@atlaskit/tokens": "^4.3.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "@emotion/react": "^11.7.1"
55
55
  },
@@ -62,7 +62,7 @@
62
62
  "@af/visual-regression": "*",
63
63
  "@atlaskit/analytics-next": "^11.0.0",
64
64
  "@atlaskit/editor-plugin-quick-insert": "^2.0.0",
65
- "@atlaskit/editor-plugin-type-ahead": "^2.0.0",
65
+ "@atlaskit/editor-plugin-type-ahead": "^2.1.0",
66
66
  "@atlaskit/ssr": "*",
67
67
  "@atlaskit/visual-regression": "*",
68
68
  "@testing-library/react": "^13.4.0",