@atlaskit/editor-plugin-block-type 4.1.1 → 4.1.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,13 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 4.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#99274](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99274)
8
+ [`b4dd134e0caaa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b4dd134e0caaa) -
9
+ ED-25961 Add analytics for clear formatting and adding blockquote from text styles menu
10
+
3
11
  ## 4.1.1
4
12
 
5
13
  ### Patch Changes
@@ -192,8 +192,9 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
192
192
  var _api$analytics5;
193
193
  return (0, _blockType.insertBlockQuoteWithAnalyticsCommand)(inputMethod, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
194
194
  },
195
- clearFormatting: function clearFormatting() {
196
- return (0, _blockType.clearFormatting)();
195
+ clearFormatting: function clearFormatting(inputMethod) {
196
+ var _api$analytics6;
197
+ return (0, _blockType.clearFormatting)(inputMethod, api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions);
197
198
  }
198
199
  },
199
200
  getSharedState: function getSharedState(editorState) {
@@ -230,9 +231,9 @@ var blockTypePlugin = exports.blockTypePlugin = function blockTypePlugin(_ref3)
230
231
  }
231
232
  },
232
233
  quickInsert: function quickInsert(intl) {
233
- var _api$analytics6, _api$analytics7;
234
+ var _api$analytics7, _api$analytics8;
234
235
  var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
235
- return [].concat((0, _toConsumableArray2.default)(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)), (0, _toConsumableArray2.default)(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)));
236
+ 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)));
236
237
  }
237
238
  }
238
239
  };
@@ -114,7 +114,7 @@ function setNormalText(fromBlockQuote) {
114
114
  return tr;
115
115
  };
116
116
  }
117
- function clearFormatting() {
117
+ function clearFormatting(inputMethod, editorAnalyticsApi) {
118
118
  return function (_ref7) {
119
119
  var tr = _ref7.tr;
120
120
  var formattingCleared = [];
@@ -156,6 +156,19 @@ function clearFormatting() {
156
156
  }
157
157
  });
158
158
  tr.setStoredMarks([]);
159
+ if (formattingCleared.length) {
160
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
161
+ action: _analytics.ACTION.FORMATTED,
162
+ eventType: _analytics.EVENT_TYPE.TRACK,
163
+ actionSubject: _analytics.ACTION_SUBJECT.TEXT,
164
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_CLEAR,
165
+ attributes: {
166
+ inputMethod: inputMethod,
167
+ formattingCleared: formattingCleared,
168
+ dropdownMenu: 'textStyle'
169
+ }
170
+ })(tr);
171
+ }
159
172
  return tr;
160
173
  };
161
174
  }
@@ -275,19 +288,15 @@ function insertBlockQuoteWithAnalyticsCommand(inputMethod, editorAnalyticsApi) {
275
288
  return function (_ref11) {
276
289
  var tr = _ref11.tr;
277
290
  var nodes = tr.doc.type.schema.nodes;
278
-
279
- // TODO: analytics event
280
-
281
- // editorAnalyticsApi?.attachAnalyticsEvent({
282
- // action: ACTION.FORMATTED,
283
- // actionSubject: ACTION_SUBJECT.TEXT,
284
- // eventType: EVENT_TYPE.TRACK,
285
- // actionSubjectId: ACTION_SUBJECT_ID.FORMAT_BLOCK_QUOTE,
286
- // attributes: {
287
- // inputMethod: inputMethod,
288
- // },
289
- // })(tr);
290
-
291
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
292
+ action: _analytics.ACTION.FORMATTED,
293
+ actionSubject: _analytics.ACTION_SUBJECT.TEXT,
294
+ eventType: _analytics.EVENT_TYPE.TRACK,
295
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_BLOCK_QUOTE,
296
+ attributes: {
297
+ inputMethod: inputMethod
298
+ }
299
+ })(tr);
291
300
  return (0, _wrapSelectionIn.wrapSelectionInBlockType)(nodes.blockquote)({
292
301
  tr: tr
293
302
  });
@@ -28,11 +28,11 @@ function FloatingToolbarComponent(_ref) {
28
28
  }, [api]);
29
29
  var wrapBlockQuote = (0, _react.useCallback)(function () {
30
30
  var _api$core2, _api$blockType2;
31
- return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 || (_api$blockType2 = api.blockType) === null || _api$blockType2 === void 0 || (_api$blockType2 = _api$blockType2.commands) === null || _api$blockType2 === void 0 ? void 0 : _api$blockType2.insertBlockQuote(_analytics.INPUT_METHOD.TOOLBAR));
31
+ return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 || (_api$blockType2 = api.blockType) === null || _api$blockType2 === void 0 || (_api$blockType2 = _api$blockType2.commands) === null || _api$blockType2 === void 0 ? void 0 : _api$blockType2.insertBlockQuote(_analytics.INPUT_METHOD.FLOATING_TB));
32
32
  }, [api]);
33
33
  var clearFormatting = (0, _react.useCallback)(function () {
34
34
  var _api$core3, _api$blockType3;
35
- return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting());
35
+ return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting(_analytics.INPUT_METHOD.FLOATING_TB));
36
36
  }, [api]);
37
37
  return /*#__PURE__*/_react.default.createElement(_ToolbarBlockType.default, {
38
38
  isSmall: FloatingToolbarSettings.isSmall,
@@ -30,7 +30,7 @@ function PrimaryToolbarComponent(_ref) {
30
30
  };
31
31
  var clearFormatting = function clearFormatting() {
32
32
  var _api$core3, _api$blockType3;
33
- return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting());
33
+ return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting(_analytics.INPUT_METHOD.TOOLBAR));
34
34
  };
35
35
  return /*#__PURE__*/_react.default.createElement(_ToolbarBlockType.default, {
36
36
  isSmall: isSmall,
@@ -182,8 +182,9 @@ const blockTypePlugin = ({
182
182
  var _api$analytics5;
183
183
  return insertBlockQuoteWithAnalyticsCommand(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
184
184
  },
185
- clearFormatting() {
186
- return clearFormatting();
185
+ clearFormatting(inputMethod) {
186
+ var _api$analytics6;
187
+ return clearFormatting(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions);
187
188
  }
188
189
  },
189
190
  getSharedState(editorState) {
@@ -220,9 +221,9 @@ const blockTypePlugin = ({
220
221
  }
221
222
  },
222
223
  quickInsert: intl => {
223
- var _api$analytics6, _api$analytics7;
224
+ var _api$analytics7, _api$analytics8;
224
225
  const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
225
- return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)];
226
+ 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)];
226
227
  }
227
228
  }
228
229
  };
@@ -118,7 +118,7 @@ export function setNormalText(fromBlockQuote) {
118
118
  return tr;
119
119
  };
120
120
  }
121
- export function clearFormatting() {
121
+ export function clearFormatting(inputMethod, editorAnalyticsApi) {
122
122
  return function ({
123
123
  tr
124
124
  }) {
@@ -163,6 +163,19 @@ export function clearFormatting() {
163
163
  }
164
164
  });
165
165
  tr.setStoredMarks([]);
166
+ if (formattingCleared.length) {
167
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
168
+ action: ACTION.FORMATTED,
169
+ eventType: EVENT_TYPE.TRACK,
170
+ actionSubject: ACTION_SUBJECT.TEXT,
171
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CLEAR,
172
+ attributes: {
173
+ inputMethod,
174
+ formattingCleared,
175
+ dropdownMenu: 'textStyle'
176
+ }
177
+ })(tr);
178
+ }
166
179
  return tr;
167
180
  };
168
181
  }
@@ -277,19 +290,15 @@ export function insertBlockQuoteWithAnalyticsCommand(inputMethod, editorAnalytic
277
290
  const {
278
291
  nodes
279
292
  } = tr.doc.type.schema;
280
-
281
- // TODO: analytics event
282
-
283
- // editorAnalyticsApi?.attachAnalyticsEvent({
284
- // action: ACTION.FORMATTED,
285
- // actionSubject: ACTION_SUBJECT.TEXT,
286
- // eventType: EVENT_TYPE.TRACK,
287
- // actionSubjectId: ACTION_SUBJECT_ID.FORMAT_BLOCK_QUOTE,
288
- // attributes: {
289
- // inputMethod: inputMethod,
290
- // },
291
- // })(tr);
292
-
293
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
294
+ action: ACTION.FORMATTED,
295
+ actionSubject: ACTION_SUBJECT.TEXT,
296
+ eventType: EVENT_TYPE.TRACK,
297
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_BLOCK_QUOTE,
298
+ attributes: {
299
+ inputMethod: inputMethod
300
+ }
301
+ })(tr);
293
302
  return wrapSelectionInBlockType(nodes.blockquote)({
294
303
  tr
295
304
  });
@@ -20,11 +20,11 @@ export function FloatingToolbarComponent({
20
20
  }, [api]);
21
21
  const wrapBlockQuote = useCallback(() => {
22
22
  var _api$core2, _api$blockType2, _api$blockType2$comma;
23
- return api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType2 = api.blockType) === null || _api$blockType2 === void 0 ? void 0 : (_api$blockType2$comma = _api$blockType2.commands) === null || _api$blockType2$comma === void 0 ? void 0 : _api$blockType2$comma.insertBlockQuote(INPUT_METHOD.TOOLBAR));
23
+ return api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType2 = api.blockType) === null || _api$blockType2 === void 0 ? void 0 : (_api$blockType2$comma = _api$blockType2.commands) === null || _api$blockType2$comma === void 0 ? void 0 : _api$blockType2$comma.insertBlockQuote(INPUT_METHOD.FLOATING_TB));
24
24
  }, [api]);
25
25
  const clearFormatting = useCallback(() => {
26
26
  var _api$core3, _api$blockType3, _api$blockType3$comma;
27
- return api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 ? void 0 : (_api$blockType3$comma = _api$blockType3.commands) === null || _api$blockType3$comma === void 0 ? void 0 : _api$blockType3$comma.clearFormatting());
27
+ return api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 ? void 0 : (_api$blockType3$comma = _api$blockType3.commands) === null || _api$blockType3$comma === void 0 ? void 0 : _api$blockType3$comma.clearFormatting(INPUT_METHOD.FLOATING_TB));
28
28
  }, [api]);
29
29
  return /*#__PURE__*/React.createElement(ToolbarBlockType, {
30
30
  isSmall: FloatingToolbarSettings.isSmall,
@@ -25,7 +25,7 @@ export function PrimaryToolbarComponent({
25
25
  };
26
26
  const clearFormatting = () => {
27
27
  var _api$core3, _api$blockType3, _api$blockType3$comma;
28
- return api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 ? void 0 : (_api$blockType3$comma = _api$blockType3.commands) === null || _api$blockType3$comma === void 0 ? void 0 : _api$blockType3$comma.clearFormatting());
28
+ return api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 ? void 0 : (_api$blockType3$comma = _api$blockType3.commands) === null || _api$blockType3$comma === void 0 ? void 0 : _api$blockType3$comma.clearFormatting(INPUT_METHOD.TOOLBAR));
29
29
  };
30
30
  return /*#__PURE__*/React.createElement(ToolbarBlockType, {
31
31
  isSmall: isSmall,
@@ -185,8 +185,9 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
185
185
  var _api$analytics5;
186
186
  return insertBlockQuoteWithAnalyticsCommand(inputMethod, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
187
187
  },
188
- clearFormatting: function clearFormatting() {
189
- return _clearFormatting();
188
+ clearFormatting: function clearFormatting(inputMethod) {
189
+ var _api$analytics6;
190
+ return _clearFormatting(inputMethod, api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions);
190
191
  }
191
192
  },
192
193
  getSharedState: function getSharedState(editorState) {
@@ -223,9 +224,9 @@ var blockTypePlugin = function blockTypePlugin(_ref3) {
223
224
  }
224
225
  },
225
226
  quickInsert: function quickInsert(intl) {
226
- var _api$analytics6, _api$analytics7;
227
+ var _api$analytics7, _api$analytics8;
227
228
  var exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
228
- return [].concat(_toConsumableArray(blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)), _toConsumableArray(headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : _api$analytics7.actions)));
229
+ 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)));
229
230
  }
230
231
  }
231
232
  };
@@ -99,7 +99,7 @@ export function setNormalText(fromBlockQuote) {
99
99
  return tr;
100
100
  };
101
101
  }
102
- export function clearFormatting() {
102
+ export function clearFormatting(inputMethod, editorAnalyticsApi) {
103
103
  return function (_ref7) {
104
104
  var tr = _ref7.tr;
105
105
  var formattingCleared = [];
@@ -141,6 +141,19 @@ export function clearFormatting() {
141
141
  }
142
142
  });
143
143
  tr.setStoredMarks([]);
144
+ if (formattingCleared.length) {
145
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
146
+ action: ACTION.FORMATTED,
147
+ eventType: EVENT_TYPE.TRACK,
148
+ actionSubject: ACTION_SUBJECT.TEXT,
149
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CLEAR,
150
+ attributes: {
151
+ inputMethod: inputMethod,
152
+ formattingCleared: formattingCleared,
153
+ dropdownMenu: 'textStyle'
154
+ }
155
+ })(tr);
156
+ }
144
157
  return tr;
145
158
  };
146
159
  }
@@ -260,19 +273,15 @@ export function insertBlockQuoteWithAnalyticsCommand(inputMethod, editorAnalytic
260
273
  return function (_ref11) {
261
274
  var tr = _ref11.tr;
262
275
  var nodes = tr.doc.type.schema.nodes;
263
-
264
- // TODO: analytics event
265
-
266
- // editorAnalyticsApi?.attachAnalyticsEvent({
267
- // action: ACTION.FORMATTED,
268
- // actionSubject: ACTION_SUBJECT.TEXT,
269
- // eventType: EVENT_TYPE.TRACK,
270
- // actionSubjectId: ACTION_SUBJECT_ID.FORMAT_BLOCK_QUOTE,
271
- // attributes: {
272
- // inputMethod: inputMethod,
273
- // },
274
- // })(tr);
275
-
276
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
277
+ action: ACTION.FORMATTED,
278
+ actionSubject: ACTION_SUBJECT.TEXT,
279
+ eventType: EVENT_TYPE.TRACK,
280
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_BLOCK_QUOTE,
281
+ attributes: {
282
+ inputMethod: inputMethod
283
+ }
284
+ })(tr);
276
285
  return wrapSelectionInBlockType(nodes.blockquote)({
277
286
  tr: tr
278
287
  });
@@ -18,11 +18,11 @@ export function FloatingToolbarComponent(_ref) {
18
18
  }, [api]);
19
19
  var wrapBlockQuote = useCallback(function () {
20
20
  var _api$core2, _api$blockType2;
21
- return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 || (_api$blockType2 = api.blockType) === null || _api$blockType2 === void 0 || (_api$blockType2 = _api$blockType2.commands) === null || _api$blockType2 === void 0 ? void 0 : _api$blockType2.insertBlockQuote(INPUT_METHOD.TOOLBAR));
21
+ return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 || (_api$blockType2 = api.blockType) === null || _api$blockType2 === void 0 || (_api$blockType2 = _api$blockType2.commands) === null || _api$blockType2 === void 0 ? void 0 : _api$blockType2.insertBlockQuote(INPUT_METHOD.FLOATING_TB));
22
22
  }, [api]);
23
23
  var clearFormatting = useCallback(function () {
24
24
  var _api$core3, _api$blockType3;
25
- return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting());
25
+ return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting(INPUT_METHOD.FLOATING_TB));
26
26
  }, [api]);
27
27
  return /*#__PURE__*/React.createElement(ToolbarBlockType, {
28
28
  isSmall: FloatingToolbarSettings.isSmall,
@@ -23,7 +23,7 @@ export function PrimaryToolbarComponent(_ref) {
23
23
  };
24
24
  var clearFormatting = function clearFormatting() {
25
25
  var _api$core3, _api$blockType3;
26
- return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting());
26
+ return api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 || (_api$blockType3 = api.blockType) === null || _api$blockType3 === void 0 || (_api$blockType3 = _api$blockType3.commands) === null || _api$blockType3 === void 0 ? void 0 : _api$blockType3.clearFormatting(INPUT_METHOD.TOOLBAR));
27
27
  };
28
28
  return /*#__PURE__*/React.createElement(ToolbarBlockType, {
29
29
  isSmall: isSmall,
@@ -2,7 +2,7 @@ import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
4
4
  import type { TextBlockTypes } from './pm-plugins/block-types';
5
- import type { InputMethod } from './pm-plugins/commands/block-type';
5
+ import type { InputMethod, ClearFormattingInputMethod } from './pm-plugins/commands/block-type';
6
6
  import type { BlockTypeState } from './pm-plugins/main';
7
7
  import type { BlockTypePluginOptions } from './pm-plugins/types';
8
8
  export type BlockTypePlugin = NextEditorPlugin<'blockType', {
@@ -15,6 +15,6 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
15
15
  commands: {
16
16
  setTextLevel: (level: TextBlockTypes, inputMethod: InputMethod, fromBlockQuote?: boolean) => EditorCommand;
17
17
  insertBlockQuote: (inputMethod: InputMethod) => EditorCommand;
18
- clearFormatting: () => EditorCommand;
18
+ clearFormatting: (inputMethod: ClearFormattingInputMethod) => EditorCommand;
19
19
  };
20
20
  }>;
@@ -2,11 +2,12 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
2
2
  import type { Command, EditorCommand, HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
3
3
  import type { TextBlockTypes } from '../block-types';
4
4
  export type InputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FORMATTING | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB;
5
+ export type ClearFormattingInputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB;
5
6
  export declare function setBlockType(name: TextBlockTypes): EditorCommand;
6
7
  export declare function setHeading(level: HeadingLevelsAndNormalText, fromBlockQuote?: boolean): EditorCommand;
7
8
  export declare function setBlockTypeWithAnalytics(name: TextBlockTypes, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined, fromBlockQuote?: boolean): EditorCommand;
8
9
  export declare function setNormalText(fromBlockQuote?: boolean): EditorCommand;
9
- export declare function clearFormatting(): EditorCommand;
10
+ export declare function clearFormatting(inputMethod: ClearFormattingInputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): EditorCommand;
10
11
  export declare function setNormalTextWithAnalytics(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined, fromBlockQuote?: boolean): EditorCommand;
11
12
  export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined, fromBlockQuote?: boolean) => EditorCommand;
12
13
  /**
@@ -2,7 +2,7 @@ import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
4
4
  import type { TextBlockTypes } from './pm-plugins/block-types';
5
- import type { InputMethod } from './pm-plugins/commands/block-type';
5
+ import type { InputMethod, ClearFormattingInputMethod } from './pm-plugins/commands/block-type';
6
6
  import type { BlockTypeState } from './pm-plugins/main';
7
7
  import type { BlockTypePluginOptions } from './pm-plugins/types';
8
8
  export type BlockTypePlugin = NextEditorPlugin<'blockType', {
@@ -18,6 +18,6 @@ export type BlockTypePlugin = NextEditorPlugin<'blockType', {
18
18
  commands: {
19
19
  setTextLevel: (level: TextBlockTypes, inputMethod: InputMethod, fromBlockQuote?: boolean) => EditorCommand;
20
20
  insertBlockQuote: (inputMethod: InputMethod) => EditorCommand;
21
- clearFormatting: () => EditorCommand;
21
+ clearFormatting: (inputMethod: ClearFormattingInputMethod) => EditorCommand;
22
22
  };
23
23
  }>;
@@ -2,11 +2,12 @@ import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/a
2
2
  import type { Command, EditorCommand, HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
3
3
  import type { TextBlockTypes } from '../block-types';
4
4
  export type InputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FORMATTING | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB;
5
+ export type ClearFormattingInputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB;
5
6
  export declare function setBlockType(name: TextBlockTypes): EditorCommand;
6
7
  export declare function setHeading(level: HeadingLevelsAndNormalText, fromBlockQuote?: boolean): EditorCommand;
7
8
  export declare function setBlockTypeWithAnalytics(name: TextBlockTypes, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined, fromBlockQuote?: boolean): EditorCommand;
8
9
  export declare function setNormalText(fromBlockQuote?: boolean): EditorCommand;
9
- export declare function clearFormatting(): EditorCommand;
10
+ export declare function clearFormatting(inputMethod: ClearFormattingInputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): EditorCommand;
10
11
  export declare function setNormalTextWithAnalytics(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined, fromBlockQuote?: boolean): EditorCommand;
11
12
  export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined, fromBlockQuote?: boolean) => EditorCommand;
12
13
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",