@atlaskit/editor-plugin-block-type 3.2.2 → 3.4.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,28 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 3.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#101406](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101406)
8
+ [`6daffd65aec4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6daffd65aec4) -
9
+ [ED-23298] Extract primary toolbar components to editor plugin to allow for custom ordering
10
+
11
+ ### Patch Changes
12
+
13
+ - [#102478](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102478)
14
+ [`3378951608b0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3378951608b0) -
15
+ [ED-23332] Update adf-schema package to 36.10.1
16
+ - Updated dependencies
17
+
18
+ ## 3.3.0
19
+
20
+ ### Minor Changes
21
+
22
+ - [#102243](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102243)
23
+ [`cfc95dac3d82`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cfc95dac3d82) -
24
+ Use new paragraph and heading NodeSpecs
25
+
3
26
  ## 3.2.2
4
27
 
5
28
  ### Patch Changes
@@ -104,13 +104,33 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed,
104
104
  var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3) {
105
105
  var options = _ref3.config,
106
106
  api = _ref3.api;
107
+ var primaryToolbarComponent = function primaryToolbarComponent(_ref4) {
108
+ var popupsMountPoint = _ref4.popupsMountPoint,
109
+ popupsBoundariesElement = _ref4.popupsBoundariesElement,
110
+ popupsScrollableElement = _ref4.popupsScrollableElement,
111
+ toolbarSize = _ref4.toolbarSize,
112
+ disabled = _ref4.disabled,
113
+ isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
114
+ var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < _types.ToolbarSize.XXL : toolbarSize < _types.ToolbarSize.XL;
115
+ return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
116
+ isSmall: isSmall,
117
+ disabled: disabled,
118
+ isToolbarReducedSpacing: isToolbarReducedSpacing,
119
+ api: api,
120
+ popupsMountPoint: popupsMountPoint,
121
+ popupsBoundariesElement: popupsBoundariesElement,
122
+ popupsScrollableElement: popupsScrollableElement,
123
+ shouldUseDefaultRole: false
124
+ });
125
+ };
107
126
  return {
108
127
  name: 'blockType',
109
128
  nodes: function nodes() {
110
129
  var blockquoteNode = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-list-in-blockquote') ? _adfSchema.blockquoteWithList : _adfSchema.blockquote;
130
+ var headingNode = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.enable-localid-for-paragraph-in-stage-0_cby7g') ? _adfSchema.headingStage0 : _adfSchema.heading;
111
131
  var nodes = [{
112
132
  name: 'heading',
113
- node: _adfSchema.heading
133
+ node: headingNode
114
134
  }, {
115
135
  name: 'blockquote',
116
136
  node: blockquoteNode
@@ -129,16 +149,16 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
129
149
  pmPlugins: function pmPlugins() {
130
150
  return [{
131
151
  name: 'blockType',
132
- plugin: function plugin(_ref4) {
133
- var dispatch = _ref4.dispatch;
152
+ plugin: function plugin(_ref5) {
153
+ var dispatch = _ref5.dispatch;
134
154
  return (0, _main.createPlugin)(api, dispatch, options && options.lastNodeMustBeParagraph);
135
155
  }
136
156
  }, {
137
157
  name: 'blockTypeInputRule',
138
- plugin: function plugin(_ref5) {
158
+ plugin: function plugin(_ref6) {
139
159
  var _api$analytics;
140
- var schema = _ref5.schema,
141
- featureFlags = _ref5.featureFlags;
160
+ var schema = _ref6.schema,
161
+ featureFlags = _ref6.featureFlags;
142
162
  return (0, _inputRule.default)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, schema, featureFlags);
143
163
  }
144
164
  },
@@ -146,10 +166,10 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
146
166
  // plugin as it is currently swallowing right/down arrow events inside tables
147
167
  {
148
168
  name: 'blockTypeKeyMap',
149
- plugin: function plugin(_ref6) {
169
+ plugin: function plugin(_ref7) {
150
170
  var _api$analytics2;
151
- var schema = _ref6.schema,
152
- featureFlags = _ref6.featureFlags;
171
+ var schema = _ref7.schema,
172
+ featureFlags = _ref7.featureFlags;
153
173
  return (0, _keymap.default)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
154
174
  }
155
175
  }];
@@ -172,25 +192,14 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
172
192
  }
173
193
  return _main.pluginKey.getState(editorState);
174
194
  },
175
- primaryToolbarComponent: function primaryToolbarComponent(_ref7) {
176
- var popupsMountPoint = _ref7.popupsMountPoint,
177
- popupsBoundariesElement = _ref7.popupsBoundariesElement,
178
- popupsScrollableElement = _ref7.popupsScrollableElement,
179
- toolbarSize = _ref7.toolbarSize,
180
- disabled = _ref7.disabled,
181
- isToolbarReducedSpacing = _ref7.isToolbarReducedSpacing;
182
- var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < _types.ToolbarSize.XXL : toolbarSize < _types.ToolbarSize.XL;
183
- return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
184
- isSmall: isSmall,
185
- disabled: disabled,
186
- isToolbarReducedSpacing: isToolbarReducedSpacing,
187
- api: api,
188
- popupsMountPoint: popupsMountPoint,
189
- popupsBoundariesElement: popupsBoundariesElement,
190
- popupsScrollableElement: popupsScrollableElement,
191
- shouldUseDefaultRole: false
192
- });
195
+ usePluginHook: function usePluginHook() {
196
+ var _api$core, _api$primaryToolbar;
197
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
198
+ name: 'blockType',
199
+ component: primaryToolbarComponent
200
+ }));
193
201
  },
202
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
194
203
  pluginsOptions: {
195
204
  quickInsert: function quickInsert(intl) {
196
205
  var _api$analytics5, _api$analytics6;
@@ -33,6 +33,7 @@ function PrimaryToolbarComponent(_ref) {
33
33
  popupsMountPoint: popupsMountPoint,
34
34
  popupsBoundariesElement: popupsBoundariesElement,
35
35
  popupsScrollableElement: popupsScrollableElement,
36
- shouldUseDefaultRole: shouldUseDefaultRole
36
+ shouldUseDefaultRole: shouldUseDefaultRole,
37
+ api: api
37
38
  });
38
39
  }
@@ -127,7 +127,8 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
127
127
  blockTypesDisabled = _this$props$pluginSta2.blockTypesDisabled,
128
128
  availableBlockTypes = _this$props$pluginSta2.availableBlockTypes,
129
129
  shouldUseDefaultRole = _this$props.shouldUseDefaultRole,
130
- formatMessage = _this$props.intl.formatMessage;
130
+ formatMessage = _this$props.intl.formatMessage,
131
+ api = _this$props.api;
131
132
  var isHeadingDisabled = !availableBlockTypes.some(function (blockType) {
132
133
  return blockType.nodeName === 'heading';
133
134
  });
@@ -177,7 +178,7 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
177
178
  formatMessage: formatMessage,
178
179
  "aria-expanded": active,
179
180
  blockTypeName: currentBlockType.name
180
- })), (0, _react2.jsx)("span", {
181
+ })), !(api !== null && api !== void 0 && api.primaryToolbar) && (0, _react2.jsx)("span", {
181
182
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
182
183
  css: _styles.separatorStyles
183
184
  }))
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { blockquote, blockquoteWithList, hardBreak, heading } from '@atlaskit/adf-schema';
2
+ import { blockquote, blockquoteWithList, hardBreak, heading, headingStage0 } 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, toggleBlockQuote, tooltip } from '@atlaskit/editor-common/keymaps';
5
5
  import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
@@ -88,81 +88,15 @@ const blockquotePluginOptions = ({
88
88
  const blockTypePlugin = ({
89
89
  config: options,
90
90
  api
91
- }) => ({
92
- name: 'blockType',
93
- nodes() {
94
- const blockquoteNode = getBooleanFF('platform.editor.allow-list-in-blockquote') ? blockquoteWithList : blockquote;
95
- const nodes = [{
96
- name: 'heading',
97
- node: heading
98
- }, {
99
- name: 'blockquote',
100
- node: blockquoteNode
101
- }, {
102
- name: 'hardBreak',
103
- node: hardBreak
104
- }];
105
- if (options && options.allowBlockType) {
106
- const exclude = options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
107
- return nodes.filter(node => exclude.indexOf(node.name) === -1);
108
- }
109
- return nodes;
110
- },
111
- pmPlugins() {
112
- return [{
113
- name: 'blockType',
114
- plugin: ({
115
- dispatch
116
- }) => createPlugin(api, dispatch, options && options.lastNodeMustBeParagraph)
117
- }, {
118
- name: 'blockTypeInputRule',
119
- plugin: ({
120
- schema,
121
- featureFlags
122
- }) => {
123
- var _api$analytics;
124
- return inputRulePlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, schema, featureFlags);
125
- }
126
- },
127
- // Needs to be lower priority than editor-tables.tableEditing
128
- // plugin as it is currently swallowing right/down arrow events inside tables
129
- {
130
- name: 'blockTypeKeyMap',
131
- plugin: ({
132
- schema,
133
- featureFlags
134
- }) => {
135
- var _api$analytics2;
136
- return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
137
- }
138
- }];
139
- },
140
- actions: {
141
- insertBlockQuote(inputMethod) {
142
- var _api$analytics3;
143
- return insertBlockQuoteWithAnalytics(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
144
- }
145
- },
146
- commands: {
147
- setTextLevel(level, inputMethod) {
148
- var _api$analytics4;
149
- return setBlockTypeWithAnalytics(level, inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
150
- }
151
- },
152
- getSharedState(editorState) {
153
- if (!editorState) {
154
- return;
155
- }
156
- return pluginKey.getState(editorState);
157
- },
158
- primaryToolbarComponent({
91
+ }) => {
92
+ const primaryToolbarComponent = ({
159
93
  popupsMountPoint,
160
94
  popupsBoundariesElement,
161
95
  popupsScrollableElement,
162
96
  toolbarSize,
163
97
  disabled,
164
98
  isToolbarReducedSpacing
165
- }) {
99
+ }) => {
166
100
  const isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < ToolbarSize.XXL : toolbarSize < ToolbarSize.XL;
167
101
  return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
168
102
  isSmall: isSmall,
@@ -174,14 +108,91 @@ const blockTypePlugin = ({
174
108
  popupsScrollableElement: popupsScrollableElement,
175
109
  shouldUseDefaultRole: false
176
110
  });
177
- },
178
- pluginsOptions: {
179
- quickInsert: intl => {
180
- var _api$analytics5, _api$analytics6;
181
- const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
182
- return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)];
111
+ };
112
+ return {
113
+ name: 'blockType',
114
+ nodes() {
115
+ const blockquoteNode = getBooleanFF('platform.editor.allow-list-in-blockquote') ? blockquoteWithList : blockquote;
116
+ const headingNode = getBooleanFF('platform.editor.enable-localid-for-paragraph-in-stage-0_cby7g') ? headingStage0 : heading;
117
+ const nodes = [{
118
+ name: 'heading',
119
+ node: headingNode
120
+ }, {
121
+ name: 'blockquote',
122
+ node: blockquoteNode
123
+ }, {
124
+ name: 'hardBreak',
125
+ node: hardBreak
126
+ }];
127
+ if (options && options.allowBlockType) {
128
+ const exclude = options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
129
+ return nodes.filter(node => exclude.indexOf(node.name) === -1);
130
+ }
131
+ return nodes;
132
+ },
133
+ pmPlugins() {
134
+ return [{
135
+ name: 'blockType',
136
+ plugin: ({
137
+ dispatch
138
+ }) => createPlugin(api, dispatch, options && options.lastNodeMustBeParagraph)
139
+ }, {
140
+ name: 'blockTypeInputRule',
141
+ plugin: ({
142
+ schema,
143
+ featureFlags
144
+ }) => {
145
+ var _api$analytics;
146
+ return inputRulePlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, schema, featureFlags);
147
+ }
148
+ },
149
+ // Needs to be lower priority than editor-tables.tableEditing
150
+ // plugin as it is currently swallowing right/down arrow events inside tables
151
+ {
152
+ name: 'blockTypeKeyMap',
153
+ plugin: ({
154
+ schema,
155
+ featureFlags
156
+ }) => {
157
+ var _api$analytics2;
158
+ return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
159
+ }
160
+ }];
161
+ },
162
+ actions: {
163
+ insertBlockQuote(inputMethod) {
164
+ var _api$analytics3;
165
+ return insertBlockQuoteWithAnalytics(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
166
+ }
167
+ },
168
+ commands: {
169
+ setTextLevel(level, inputMethod) {
170
+ var _api$analytics4;
171
+ return setBlockTypeWithAnalytics(level, inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
172
+ }
173
+ },
174
+ getSharedState(editorState) {
175
+ if (!editorState) {
176
+ return;
177
+ }
178
+ return pluginKey.getState(editorState);
179
+ },
180
+ usePluginHook: () => {
181
+ var _api$core, _api$primaryToolbar;
182
+ api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
183
+ name: 'blockType',
184
+ component: primaryToolbarComponent
185
+ }));
186
+ },
187
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
188
+ pluginsOptions: {
189
+ quickInsert: intl => {
190
+ var _api$analytics5, _api$analytics6;
191
+ const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
192
+ return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)];
193
+ }
183
194
  }
184
- }
185
- });
195
+ };
196
+ };
186
197
  export { blockTypePlugin };
187
198
  export { pluginKey } from './pm-plugins/main';
@@ -28,6 +28,7 @@ export function PrimaryToolbarComponent({
28
28
  popupsMountPoint: popupsMountPoint,
29
29
  popupsBoundariesElement: popupsBoundariesElement,
30
30
  popupsScrollableElement: popupsScrollableElement,
31
- shouldUseDefaultRole: shouldUseDefaultRole
31
+ shouldUseDefaultRole: shouldUseDefaultRole,
32
+ api: api
32
33
  });
33
34
  }
@@ -111,7 +111,8 @@ class ToolbarBlockType extends React.PureComponent {
111
111
  shouldUseDefaultRole,
112
112
  intl: {
113
113
  formatMessage
114
- }
114
+ },
115
+ api
115
116
  } = this.props;
116
117
  const isHeadingDisabled = !availableBlockTypes.some(blockType => blockType.nodeName === 'heading');
117
118
  if (isHeadingDisabled) {
@@ -157,7 +158,7 @@ class ToolbarBlockType extends React.PureComponent {
157
158
  formatMessage: formatMessage,
158
159
  "aria-expanded": active,
159
160
  blockTypeName: currentBlockType.name
160
- })), jsx("span", {
161
+ })), !(api !== null && api !== void 0 && api.primaryToolbar) && jsx("span", {
161
162
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
162
163
  css: separatorStyles
163
164
  }))
@@ -1,6 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import React from 'react';
3
- import { blockquote, blockquoteWithList, hardBreak, heading } from '@atlaskit/adf-schema';
3
+ import { blockquote, blockquoteWithList, hardBreak, heading, headingStage0 } from '@atlaskit/adf-schema';
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { keymap, toggleBlockQuote, tooltip } from '@atlaskit/editor-common/keymaps';
6
6
  import { blockTypeMessages as messages } from '@atlaskit/editor-common/messages';
@@ -91,13 +91,33 @@ var blockquotePluginOptions = function blockquotePluginOptions(_ref2, isAllowed,
91
91
  var blockTypePlugin = function blockTypePlugin(_ref3) {
92
92
  var options = _ref3.config,
93
93
  api = _ref3.api;
94
+ var primaryToolbarComponent = function primaryToolbarComponent(_ref4) {
95
+ var popupsMountPoint = _ref4.popupsMountPoint,
96
+ popupsBoundariesElement = _ref4.popupsBoundariesElement,
97
+ popupsScrollableElement = _ref4.popupsScrollableElement,
98
+ toolbarSize = _ref4.toolbarSize,
99
+ disabled = _ref4.disabled,
100
+ isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
101
+ var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < ToolbarSize.XXL : toolbarSize < ToolbarSize.XL;
102
+ return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
103
+ isSmall: isSmall,
104
+ disabled: disabled,
105
+ isToolbarReducedSpacing: isToolbarReducedSpacing,
106
+ api: api,
107
+ popupsMountPoint: popupsMountPoint,
108
+ popupsBoundariesElement: popupsBoundariesElement,
109
+ popupsScrollableElement: popupsScrollableElement,
110
+ shouldUseDefaultRole: false
111
+ });
112
+ };
94
113
  return {
95
114
  name: 'blockType',
96
115
  nodes: function nodes() {
97
116
  var blockquoteNode = getBooleanFF('platform.editor.allow-list-in-blockquote') ? blockquoteWithList : blockquote;
117
+ var headingNode = getBooleanFF('platform.editor.enable-localid-for-paragraph-in-stage-0_cby7g') ? headingStage0 : heading;
98
118
  var nodes = [{
99
119
  name: 'heading',
100
- node: heading
120
+ node: headingNode
101
121
  }, {
102
122
  name: 'blockquote',
103
123
  node: blockquoteNode
@@ -116,16 +136,16 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
116
136
  pmPlugins: function pmPlugins() {
117
137
  return [{
118
138
  name: 'blockType',
119
- plugin: function plugin(_ref4) {
120
- var dispatch = _ref4.dispatch;
139
+ plugin: function plugin(_ref5) {
140
+ var dispatch = _ref5.dispatch;
121
141
  return createPlugin(api, dispatch, options && options.lastNodeMustBeParagraph);
122
142
  }
123
143
  }, {
124
144
  name: 'blockTypeInputRule',
125
- plugin: function plugin(_ref5) {
145
+ plugin: function plugin(_ref6) {
126
146
  var _api$analytics;
127
- var schema = _ref5.schema,
128
- featureFlags = _ref5.featureFlags;
147
+ var schema = _ref6.schema,
148
+ featureFlags = _ref6.featureFlags;
129
149
  return inputRulePlugin(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, schema, featureFlags);
130
150
  }
131
151
  },
@@ -133,10 +153,10 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
133
153
  // plugin as it is currently swallowing right/down arrow events inside tables
134
154
  {
135
155
  name: 'blockTypeKeyMap',
136
- plugin: function plugin(_ref6) {
156
+ plugin: function plugin(_ref7) {
137
157
  var _api$analytics2;
138
- var schema = _ref6.schema,
139
- featureFlags = _ref6.featureFlags;
158
+ var schema = _ref7.schema,
159
+ featureFlags = _ref7.featureFlags;
140
160
  return keymapPlugin(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, schema, featureFlags);
141
161
  }
142
162
  }];
@@ -159,25 +179,14 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
159
179
  }
160
180
  return pluginKey.getState(editorState);
161
181
  },
162
- primaryToolbarComponent: function primaryToolbarComponent(_ref7) {
163
- var popupsMountPoint = _ref7.popupsMountPoint,
164
- popupsBoundariesElement = _ref7.popupsBoundariesElement,
165
- popupsScrollableElement = _ref7.popupsScrollableElement,
166
- toolbarSize = _ref7.toolbarSize,
167
- disabled = _ref7.disabled,
168
- isToolbarReducedSpacing = _ref7.isToolbarReducedSpacing;
169
- var isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < ToolbarSize.XXL : toolbarSize < ToolbarSize.XL;
170
- return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
171
- isSmall: isSmall,
172
- disabled: disabled,
173
- isToolbarReducedSpacing: isToolbarReducedSpacing,
174
- api: api,
175
- popupsMountPoint: popupsMountPoint,
176
- popupsBoundariesElement: popupsBoundariesElement,
177
- popupsScrollableElement: popupsScrollableElement,
178
- shouldUseDefaultRole: false
179
- });
182
+ usePluginHook: function usePluginHook() {
183
+ var _api$core, _api$primaryToolbar;
184
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
185
+ name: 'blockType',
186
+ component: primaryToolbarComponent
187
+ }));
180
188
  },
189
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
181
190
  pluginsOptions: {
182
191
  quickInsert: function quickInsert(intl) {
183
192
  var _api$analytics5, _api$analytics6;
@@ -26,6 +26,7 @@ export function PrimaryToolbarComponent(_ref) {
26
26
  popupsMountPoint: popupsMountPoint,
27
27
  popupsBoundariesElement: popupsBoundariesElement,
28
28
  popupsScrollableElement: popupsScrollableElement,
29
- shouldUseDefaultRole: shouldUseDefaultRole
29
+ shouldUseDefaultRole: shouldUseDefaultRole,
30
+ api: api
30
31
  });
31
32
  }
@@ -121,7 +121,8 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
121
121
  blockTypesDisabled = _this$props$pluginSta2.blockTypesDisabled,
122
122
  availableBlockTypes = _this$props$pluginSta2.availableBlockTypes,
123
123
  shouldUseDefaultRole = _this$props.shouldUseDefaultRole,
124
- formatMessage = _this$props.intl.formatMessage;
124
+ formatMessage = _this$props.intl.formatMessage,
125
+ api = _this$props.api;
125
126
  var isHeadingDisabled = !availableBlockTypes.some(function (blockType) {
126
127
  return blockType.nodeName === 'heading';
127
128
  });
@@ -171,7 +172,7 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
171
172
  formatMessage: formatMessage,
172
173
  "aria-expanded": active,
173
174
  blockTypeName: currentBlockType.name
174
- })), jsx("span", {
175
+ })), !(api !== null && api !== void 0 && api.primaryToolbar) && jsx("span", {
175
176
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
176
177
  css: separatorStyles
177
178
  }))
@@ -1,12 +1,16 @@
1
1
  import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
+ import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
3
4
  import type { TextBlockTypes } from './block-types';
4
5
  import type { InputMethod } from './commands/block-type';
5
6
  import type { BlockTypeState } from './pm-plugins/main';
6
7
  import type { BlockTypePluginOptions } from './types';
7
8
  export type BlockTypePlugin = NextEditorPlugin<'blockType', {
8
9
  pluginConfiguration: BlockTypePluginOptions | undefined;
9
- dependencies: [OptionalPlugin<typeof analyticsPlugin>];
10
+ dependencies: [
11
+ OptionalPlugin<AnalyticsPlugin>,
12
+ OptionalPlugin<PrimaryToolbarPlugin>
13
+ ];
10
14
  sharedState: BlockTypeState | undefined;
11
15
  actions: {
12
16
  insertBlockQuote: (inputMethod: InputMethod) => Command;
@@ -1,9 +1,11 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import type { WrappedComponentProps } from 'react-intl-next';
4
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
5
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
5
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
7
  import type { TextBlockTypes } from '../../block-types';
8
+ import type { BlockTypePlugin } from '../../index';
7
9
  import type { BlockTypeState } from '../../pm-plugins/main';
8
10
  import type { BlockType } from '../../types';
9
11
  export type DropdownItem = MenuItem & {
@@ -20,6 +22,7 @@ export interface Props {
20
22
  editorView?: EditorView;
21
23
  setTextLevel: (type: TextBlockTypes) => void;
22
24
  shouldUseDefaultRole?: boolean;
25
+ api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
23
26
  }
24
27
  export interface State {
25
28
  active: boolean;
@@ -1,5 +1,6 @@
1
1
  import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
+ import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
3
4
  import type { TextBlockTypes } from './block-types';
4
5
  import type { InputMethod } from './commands/block-type';
5
6
  import type { BlockTypeState } from './pm-plugins/main';
@@ -7,7 +8,8 @@ import type { BlockTypePluginOptions } from './types';
7
8
  export type BlockTypePlugin = NextEditorPlugin<'blockType', {
8
9
  pluginConfiguration: BlockTypePluginOptions | undefined;
9
10
  dependencies: [
10
- OptionalPlugin<typeof analyticsPlugin>
11
+ OptionalPlugin<AnalyticsPlugin>,
12
+ OptionalPlugin<PrimaryToolbarPlugin>
11
13
  ];
12
14
  sharedState: BlockTypeState | undefined;
13
15
  actions: {
@@ -1,9 +1,11 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import type { WrappedComponentProps } from 'react-intl-next';
4
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
5
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
5
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
7
  import type { TextBlockTypes } from '../../block-types';
8
+ import type { BlockTypePlugin } from '../../index';
7
9
  import type { BlockTypeState } from '../../pm-plugins/main';
8
10
  import type { BlockType } from '../../types';
9
11
  export type DropdownItem = MenuItem & {
@@ -20,6 +22,7 @@ export interface Props {
20
22
  editorView?: EditorView;
21
23
  setTextLevel: (type: TextBlockTypes) => void;
22
24
  shouldUseDefaultRole?: boolean;
25
+ api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
23
26
  }
24
27
  export interface State {
25
28
  active: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "3.2.2",
3
+ "version": "3.4.0",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,17 +35,18 @@
35
35
  "./styles": "./src/styles.ts"
36
36
  },
37
37
  "dependencies": {
38
- "@atlaskit/adf-schema": "^36.8.0",
39
- "@atlaskit/editor-common": "^80.4.0",
38
+ "@atlaskit/adf-schema": "^36.10.7",
39
+ "@atlaskit/editor-common": "^81.0.0",
40
40
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
41
+ "@atlaskit/editor-plugin-primary-toolbar": "^1.1.0",
41
42
  "@atlaskit/editor-prosemirror": "4.0.1",
42
43
  "@atlaskit/editor-shared-styles": "^2.11.0",
43
44
  "@atlaskit/editor-tables": "^2.7.0",
44
- "@atlaskit/icon": "^22.2.0",
45
+ "@atlaskit/icon": "^22.3.0",
45
46
  "@atlaskit/platform-feature-flags": "^0.2.5",
46
47
  "@atlaskit/prosemirror-input-rules": "^3.1.0",
47
48
  "@atlaskit/theme": "^12.8.0",
48
- "@atlaskit/tokens": "^1.48.0",
49
+ "@atlaskit/tokens": "^1.49.0",
49
50
  "@babel/runtime": "^7.0.0",
50
51
  "@emotion/react": "^11.7.1"
51
52
  },
@@ -105,6 +106,9 @@
105
106
  "platform-feature-flags": {
106
107
  "platform.editor.allow-list-in-blockquote": {
107
108
  "type": "boolean"
109
+ },
110
+ "platform.editor.enable-localid-for-paragraph-in-stage-0_cby7g": {
111
+ "type": "boolean"
108
112
  }
109
113
  }
110
114
  }