@atlaskit/editor-plugin-insert-block 3.1.2 → 3.1.4

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/insertBlockPlugin.js +2 -54
  3. package/dist/cjs/ui/ElementBrowser/InsertMenu.js +14 -64
  4. package/dist/cjs/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -1
  5. package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu.js +1 -6
  6. package/dist/cjs/ui/ToolbarInsertBlock/index.js +28 -77
  7. package/dist/es2019/insertBlockPlugin.js +2 -52
  8. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +14 -64
  9. package/dist/es2019/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -1
  10. package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu.js +1 -7
  11. package/dist/es2019/ui/ToolbarInsertBlock/index.js +19 -72
  12. package/dist/esm/insertBlockPlugin.js +2 -54
  13. package/dist/esm/ui/ElementBrowser/InsertMenu.js +14 -64
  14. package/dist/esm/ui/ToolbarInsertBlock/block-insert-element-browser.js +1 -1
  15. package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu.js +1 -6
  16. package/dist/esm/ui/ToolbarInsertBlock/index.js +28 -77
  17. package/dist/types/types/index.d.ts +0 -1
  18. package/dist/types/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -1
  19. package/dist/types-ts4.5/types/index.d.ts +0 -1
  20. package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -1
  21. package/package.json +4 -4
  22. package/dist/cjs/pm-plugins/commands.js +0 -16
  23. package/dist/cjs/pm-plugins/elementBrowser.js +0 -39
  24. package/dist/cjs/ui/ElementRail/index.js +0 -236
  25. package/dist/cjs/ui/assets/expand.js +0 -40
  26. package/dist/cjs/ui/assets/switch.js +0 -26
  27. package/dist/cjs/ui/transformOptions.js +0 -36
  28. package/dist/es2019/pm-plugins/commands.js +0 -11
  29. package/dist/es2019/pm-plugins/elementBrowser.js +0 -31
  30. package/dist/es2019/ui/ElementRail/index.js +0 -233
  31. package/dist/es2019/ui/assets/expand.js +0 -34
  32. package/dist/es2019/ui/assets/switch.js +0 -18
  33. package/dist/es2019/ui/transformOptions.js +0 -29
  34. package/dist/esm/pm-plugins/commands.js +0 -11
  35. package/dist/esm/pm-plugins/elementBrowser.js +0 -33
  36. package/dist/esm/ui/ElementRail/index.js +0 -225
  37. package/dist/esm/ui/assets/expand.js +0 -33
  38. package/dist/esm/ui/assets/switch.js +0 -18
  39. package/dist/esm/ui/transformOptions.js +0 -29
  40. package/dist/types/pm-plugins/commands.d.ts +0 -6
  41. package/dist/types/pm-plugins/elementBrowser.d.ts +0 -16
  42. package/dist/types/ui/ElementRail/index.d.ts +0 -21
  43. package/dist/types/ui/assets/expand.d.ts +0 -8
  44. package/dist/types/ui/assets/switch.d.ts +0 -6
  45. package/dist/types/ui/transformOptions.d.ts +0 -27
  46. package/dist/types-ts4.5/pm-plugins/commands.d.ts +0 -6
  47. package/dist/types-ts4.5/pm-plugins/elementBrowser.d.ts +0 -16
  48. package/dist/types-ts4.5/ui/ElementRail/index.d.ts +0 -21
  49. package/dist/types-ts4.5/ui/assets/expand.d.ts +0 -8
  50. package/dist/types-ts4.5/ui/assets/switch.d.ts +0 -6
  51. package/dist/types-ts4.5/ui/transformOptions.d.ts +0 -27
@@ -37,8 +37,6 @@ import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
37
37
  // eslint-disable-next-line import/no-namespace
38
38
  import { fg } from '@atlaskit/platform-feature-flags';
39
39
  import { N20A, N30A } from '@atlaskit/theme/colors';
40
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
41
- import { toggleInsertMenuRightRail } from '../../pm-plugins/commands';
42
40
  import { BlockInsertMenu } from './block-insert-menu';
43
41
  import { createItems } from './create-items';
44
42
  // Ignored via go/ees005
@@ -242,57 +240,10 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
242
240
  }
243
241
  });
244
242
  _defineProperty(_this, "handleClick", function () {
245
- var _this$props$editorApp;
246
- /**
247
- * For insert menu in right rail experiment
248
- * - Clean up ticket ED-24801
249
- */
250
- if (['full-page', 'full-width'].includes((_this$props$editorApp = _this.props.editorAppearance) !== null && _this$props$editorApp !== void 0 ? _this$props$editorApp : '') && editorExperiment('insert-menu-in-right-rail', true, {
251
- exposure: true
252
- })) {
253
- var pluginInjectionApi = _this.props.pluginInjectionApi;
254
- if (!pluginInjectionApi) {
255
- return;
256
- }
257
- pluginInjectionApi.core.actions.execute(function (_ref4) {
258
- var _pluginInjectionApi$c, _pluginInjectionApi$a;
259
- var tr = _ref4.tr;
260
- toggleInsertMenuRightRail(tr);
261
- (_pluginInjectionApi$c = pluginInjectionApi.contextPanel) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.applyChange(tr);
262
- (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 || _pluginInjectionApi$a.actions.attachAnalyticsEvent({
263
- action: ACTION.CLICKED,
264
- // @ts-expect-error
265
- actionSubject: ACTION_SUBJECT.TOOLBAR_BUTTON,
266
- // @ts-expect-error
267
- actionSubjectId: INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
268
- eventType: EVENT_TYPE.UI
269
- })(tr);
270
- return tr;
271
- });
272
- return;
273
- }
274
243
  _this.togglePlusMenuVisibility();
275
244
  });
276
245
  _defineProperty(_this, "handleOpenByKeyboard", function (event) {
277
246
  if (event.key === 'Enter' || event.key === ' ') {
278
- var _this$props$editorApp2;
279
- /**
280
- * For insert menu in right rail experiment
281
- * - Clean up ticket ED-24801
282
- */
283
- if (['full-page', 'full-width'].includes((_this$props$editorApp2 = _this.props.editorAppearance) !== null && _this$props$editorApp2 !== void 0 ? _this$props$editorApp2 : '') && editorExperiment('insert-menu-in-right-rail', true, {
284
- exposure: true
285
- })) {
286
- var _this$props$pluginInj;
287
- (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || _this$props$pluginInj.core.actions.execute(function (_ref5) {
288
- var _this$props$pluginInj2;
289
- var tr = _ref5.tr;
290
- toggleInsertMenuRightRail(tr);
291
- (_this$props$pluginInj2 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj2 === void 0 || (_this$props$pluginInj2 = _this$props$pluginInj2.contextPanel) === null || _this$props$pluginInj2 === void 0 || _this$props$pluginInj2.actions.applyChange(tr);
292
- return tr;
293
- });
294
- return;
295
- }
296
247
  _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
297
248
  isOpenedByKeyboard: true
298
249
  }));
@@ -308,9 +259,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
308
259
  }
309
260
  });
310
261
  _defineProperty(_this, "toggleLinkPanel", function (inputMethod) {
311
- var _pluginInjectionApi$c2, _pluginInjectionApi$c3, _pluginInjectionApi$h;
262
+ var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$h;
312
263
  var pluginInjectionApi = _this.props.pluginInjectionApi;
313
- return (_pluginInjectionApi$c2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 ? void 0 : _pluginInjectionApi$h.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$c2 !== void 0 ? _pluginInjectionApi$c2 : false;
264
+ return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 ? void 0 : _pluginInjectionApi$h.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
314
265
  });
315
266
  _defineProperty(_this, "insertMention", function (inputMethod) {
316
267
  var _pluginInjectionApi$m3, _pluginInjectionApi$m4;
@@ -353,15 +304,15 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
353
304
 
354
305
  // workaround to solve race condition where cursor is not placed correctly inside table
355
306
  queueMicrotask(function () {
356
- var _pluginInjectionApi$c4, _pluginInjectionApi$t4;
357
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 || _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t4 = pluginInjectionApi.table) === null || _pluginInjectionApi$t4 === void 0 ? void 0 : _pluginInjectionApi$t4.commands.insertTableWithSize(rowsCount, colsCount, INPUT_METHOD.PICKER));
307
+ var _pluginInjectionApi$c3, _pluginInjectionApi$t4;
308
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 || _pluginInjectionApi$c3.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t4 = pluginInjectionApi.table) === null || _pluginInjectionApi$t4 === void 0 ? void 0 : _pluginInjectionApi$t4.commands.insertTableWithSize(rowsCount, colsCount, INPUT_METHOD.PICKER));
358
309
  });
359
310
  };
360
311
  });
361
312
  _defineProperty(_this, "createDate", function (inputMethod) {
362
- var _pluginInjectionApi$c5, _pluginInjectionApi$d;
313
+ var _pluginInjectionApi$c4, _pluginInjectionApi$d;
363
314
  var pluginInjectionApi = _this.props.pluginInjectionApi;
364
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 || _pluginInjectionApi$c5.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.date) === null || _pluginInjectionApi$d === void 0 || (_pluginInjectionApi$d = _pluginInjectionApi$d.commands) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.insertDate({
315
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 || _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.date) === null || _pluginInjectionApi$d === void 0 || (_pluginInjectionApi$d = _pluginInjectionApi$d.commands) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.insertDate({
365
316
  inputMethod: inputMethod
366
317
  }));
367
318
  return true;
@@ -383,9 +334,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
383
334
  return true;
384
335
  });
385
336
  _defineProperty(_this, "createStatus", function (inputMethod) {
386
- var _pluginInjectionApi$c6, _pluginInjectionApi$s;
337
+ var _pluginInjectionApi$c5, _pluginInjectionApi$s;
387
338
  var pluginInjectionApi = _this.props.pluginInjectionApi;
388
- return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.status) === null || _pluginInjectionApi$s === void 0 || (_pluginInjectionApi$s = _pluginInjectionApi$s.commands) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.insertStatus(inputMethod)));
339
+ return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : _pluginInjectionApi$c5.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.status) === null || _pluginInjectionApi$s === void 0 || (_pluginInjectionApi$s = _pluginInjectionApi$s.commands) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.insertStatus(inputMethod)));
389
340
  });
390
341
  _defineProperty(_this, "openMediaPicker", function (inputMethod) {
391
342
  var _this$props5 = _this.props,
@@ -458,21 +409,21 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
458
409
  };
459
410
  });
460
411
  _defineProperty(_this, "handleSelectedEmoji", function (emojiId) {
461
- var _pluginInjectionApi$c7, _pluginInjectionApi$e3;
412
+ var _pluginInjectionApi$c6, _pluginInjectionApi$e3;
462
413
  var pluginInjectionApi = _this.props.pluginInjectionApi;
463
414
  _this.props.editorView.focus();
464
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c7 = pluginInjectionApi.core) === null || _pluginInjectionApi$c7 === void 0 || _pluginInjectionApi$c7.actions.execute((_pluginInjectionApi$e3 = pluginInjectionApi.emoji) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
415
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 || _pluginInjectionApi$c6.actions.execute((_pluginInjectionApi$e3 = pluginInjectionApi.emoji) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
465
416
  _this.toggleEmojiPicker();
466
417
  return true;
467
418
  });
468
419
  _defineProperty(_this, "openElementBrowser", function () {
469
- var _pluginInjectionApi$c8, _pluginInjectionApi$q;
420
+ var _pluginInjectionApi$c7, _pluginInjectionApi$q;
470
421
  var pluginInjectionApi = _this.props.pluginInjectionApi;
471
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 || _pluginInjectionApi$c8.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
422
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c7 = pluginInjectionApi.core) === null || _pluginInjectionApi$c7 === void 0 || _pluginInjectionApi$c7.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
472
423
  });
473
- _defineProperty(_this, "onItemActivated", function (_ref6) {
474
- var item = _ref6.item,
475
- inputMethod = _ref6.inputMethod;
424
+ _defineProperty(_this, "onItemActivated", function (_ref4) {
425
+ var item = _ref4.item,
426
+ inputMethod = _ref4.inputMethod;
476
427
  var _this$props10 = _this.props,
477
428
  editorView = _this$props10.editorView,
478
429
  handleImageUpload = _this$props10.handleImageUpload,
@@ -561,8 +512,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
561
512
  inputMethod: INPUT_METHOD.TOOLBAR
562
513
  });
563
514
  });
564
- _defineProperty(_this, "insertInsertMenuItem", function (_ref7) {
565
- var item = _ref7.item;
515
+ _defineProperty(_this, "insertInsertMenuItem", function (_ref5) {
516
+ var item = _ref5.item;
566
517
  return _this.onItemActivated({
567
518
  item: item,
568
519
  inputMethod: INPUT_METHOD.INSERT_MENU
@@ -614,8 +565,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
614
565
  popupsBoundariesElement = _this$props11.popupsBoundariesElement,
615
566
  popupsScrollableElement = _this$props11.popupsScrollableElement,
616
567
  emojiProvider = _this$props11.emojiProvider;
617
- var dropdownEmoji = this.state.dropdownItems.some(function (_ref8) {
618
- var name = _ref8.value.name;
568
+ var dropdownEmoji = this.state.dropdownItems.some(function (_ref6) {
569
+ var name = _ref6.value.name;
619
570
  return name === 'emoji';
620
571
  });
621
572
  var dropDownButtonRef = this.plusButtonRef;
@@ -670,8 +621,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
670
621
  // Popup will be unmounted to ensure that the new table has a selection with a blinking cursor.
671
622
  // So we can start typing right away.
672
623
  var onUnmount = function onUnmount() {
673
- var _pluginInjectionApi$c9;
674
- return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c9 = pluginInjectionApi.core) === null || _pluginInjectionApi$c9 === void 0 || (_pluginInjectionApi$c9 = _pluginInjectionApi$c9.actions) === null || _pluginInjectionApi$c9 === void 0 ? void 0 : _pluginInjectionApi$c9.focus();
624
+ var _pluginInjectionApi$c8;
625
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 || (_pluginInjectionApi$c8 = _pluginInjectionApi$c8.actions) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : _pluginInjectionApi$c8.focus();
675
626
  };
676
627
  return jsx(TableSelectorPopup, {
677
628
  target: ref,
@@ -704,7 +655,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
704
655
  _tableSelectorButton6,
705
656
  _this$props$isDisable,
706
657
  _this$plusButtonRef,
707
- _this$props$pluginInj3;
658
+ _this$props$pluginInj;
708
659
  var _this$state2 = this.state,
709
660
  buttons = _this$state2.buttons,
710
661
  dropdownItems = _this$state2.dropdownItems,
@@ -714,12 +665,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
714
665
  isDisabled = _this$props13.isDisabled,
715
666
  isReducedSpacing = _this$props13.isReducedSpacing,
716
667
  editorAppearance = _this$props13.editorAppearance;
717
- var isTableButtonVisible = buttons.some(function (_ref9) {
718
- var value = _ref9.value;
668
+ var isTableButtonVisible = buttons.some(function (_ref7) {
669
+ var value = _ref7.value;
719
670
  return value.name === 'table';
720
671
  });
721
- var isTableSizeVisible = buttons.some(function (_ref10) {
722
- var value = _ref10.value;
672
+ var isTableSizeVisible = buttons.some(function (_ref8) {
673
+ var value = _ref8.value;
723
674
  return value.name === 'table selector';
724
675
  });
725
676
  if (buttons.length === 0 && dropdownItems.length === 0) {
@@ -824,7 +775,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
824
775
  editorView: this.props.editorView,
825
776
  spacing: this.props.isReducedSpacing ? 'none' : 'default',
826
777
  label: this.props.intl.formatMessage(messages.insertMenu),
827
- open: editorExperiment('insert-menu-in-right-rail', true) ? !isFullPageAppearance && this.state.isPlusMenuOpen : this.state.isPlusMenuOpen,
778
+ open: this.state.isPlusMenuOpen,
828
779
  plusButtonRef: (_this$plusButtonRef = this.plusButtonRef) === null || _this$plusButtonRef === void 0 ? void 0 : _this$plusButtonRef.deref(),
829
780
  items: this.state.dropdownItems,
830
781
  onRef: this.handleDropDownButtonRef,
@@ -838,7 +789,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
838
789
  showElementBrowserLink: this.props.showElementBrowserLink || false,
839
790
  pluginInjectionApi: this.props.pluginInjectionApi,
840
791
  isFullPageAppearance: isFullPageAppearance
841
- })), !((_this$props$pluginInj3 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj3 !== void 0 && _this$props$pluginInj3.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
792
+ })), !((_this$props$pluginInj = this.props.pluginInjectionApi) !== null && _this$props$pluginInj !== void 0 && _this$props$pluginInj.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
842
793
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
843
794
  jsx("span", {
844
795
  css: separatorStyles
@@ -65,5 +65,4 @@ export interface InsertBlockOptions {
65
65
  }
66
66
  export interface InsertBlockPluginState {
67
67
  showElementBrowser: boolean;
68
- menuBrowserOpen?: boolean;
69
68
  }
@@ -24,7 +24,6 @@ export interface BlockInsertElementBrowserProps {
24
24
  togglePlusMenuVisibility: SimpleEventHandler<MouseEvent | KeyboardEvent>;
25
25
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
26
26
  isFullPageAppearance?: boolean;
27
- isActive: boolean;
28
27
  }
29
28
  export declare const BlockInsertElementBrowser: (props: BlockInsertElementBrowserProps) => React.JSX.Element;
30
29
  export {};
@@ -65,5 +65,4 @@ export interface InsertBlockOptions {
65
65
  }
66
66
  export interface InsertBlockPluginState {
67
67
  showElementBrowser: boolean;
68
- menuBrowserOpen?: boolean;
69
68
  }
@@ -24,7 +24,6 @@ export interface BlockInsertElementBrowserProps {
24
24
  togglePlusMenuVisibility: SimpleEventHandler<MouseEvent | KeyboardEvent>;
25
25
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
26
26
  isFullPageAppearance?: boolean;
27
- isActive: boolean;
28
27
  }
29
28
  export declare const BlockInsertElementBrowser: (props: BlockInsertElementBrowserProps) => React.JSX.Element;
30
29
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,8 +33,8 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/button": "^21.1.0",
37
- "@atlaskit/editor-common": "^102.13.0",
36
+ "@atlaskit/button": "^22.0.0",
37
+ "@atlaskit/editor-common": "^102.14.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
39
39
  "@atlaskit/editor-plugin-block-type": "^5.1.0",
40
40
  "@atlaskit/editor-plugin-code-block": "^4.2.0",
@@ -46,7 +46,7 @@
46
46
  "@atlaskit/editor-plugin-feature-flags": "^1.3.0",
47
47
  "@atlaskit/editor-plugin-hyperlink": "^4.3.0",
48
48
  "@atlaskit/editor-plugin-image-upload": "^2.0.0",
49
- "@atlaskit/editor-plugin-layout": "^2.3.0",
49
+ "@atlaskit/editor-plugin-layout": "^2.4.0",
50
50
  "@atlaskit/editor-plugin-media": "^2.3.0",
51
51
  "@atlaskit/editor-plugin-media-insert": "^6.2.0",
52
52
  "@atlaskit/editor-plugin-mentions": "^4.1.0",
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.toggleInsertMenuRightRail = void 0;
7
- var _elementBrowser = require("./elementBrowser");
8
- /**
9
- * For insert menu in right rail experiment
10
- * - Clean up ticket ED-24801
11
- */
12
- var toggleInsertMenuRightRail = exports.toggleInsertMenuRightRail = function toggleInsertMenuRightRail(tr) {
13
- return tr.setMeta(_elementBrowser.elementBrowserPmKey, {
14
- update: true
15
- });
16
- };
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.elementBrowserPmPlugin = exports.elementBrowserPmKey = void 0;
7
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
- var _state = require("@atlaskit/editor-prosemirror/state");
9
- /**
10
- * For insert menu in right rail experiment
11
- * - Clean up ticket ED-24801
12
- */
13
- var elementBrowserPmKey = exports.elementBrowserPmKey = new _state.PluginKey('elementBrowserPmPlugin');
14
-
15
- /**
16
- * For insert menu in right rail experiment
17
- * - Clean up ticket ED-24801
18
- */
19
- var elementBrowserPmPlugin = exports.elementBrowserPmPlugin = function elementBrowserPmPlugin() {
20
- return new _safePlugin.SafePlugin({
21
- key: elementBrowserPmKey,
22
- state: {
23
- init: function init() {
24
- return {
25
- menuBrowserOpen: false
26
- };
27
- },
28
- apply: function apply(tr, pluginState) {
29
- var meta = tr.getMeta(elementBrowserPmKey);
30
- if (!meta) {
31
- return pluginState;
32
- }
33
- return {
34
- menuBrowserOpen: !pluginState.menuBrowserOpen
35
- };
36
- }
37
- }
38
- });
39
- };
@@ -1,236 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.InsertMenuRail = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _reactIntlNext = require("react-intl-next");
11
- var _new = require("@atlaskit/button/new");
12
- var _analytics = require("@atlaskit/editor-common/analytics");
13
- var _messages = require("@atlaskit/editor-common/messages");
14
- var _heading = _interopRequireDefault(require("@atlaskit/heading"));
15
- var _closeCross = _interopRequireDefault(require("@atlaskit/icon/core/migration/close--cross"));
16
- var _primitives = require("@atlaskit/primitives");
17
- var _commands = require("../../pm-plugins/commands");
18
- var _InsertMenu = _interopRequireDefault(require("../ElementBrowser/InsertMenu"));
19
- var _useInsertMenuRailItems = require("./useInsertMenuRailItems");
20
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
-
24
- var panelWrapper = (0, _primitives.xcss)({
25
- height: '100%'
26
- });
27
- var panelContentHeader = (0, _primitives.xcss)({
28
- height: '32px',
29
- display: 'flex',
30
- justifyContent: 'space-between',
31
- alignItems: 'center'
32
- });
33
-
34
- /**
35
- * For insert menu in right rail experiment
36
- * - Clean up ticket ED-24801
37
- */
38
- var InsertMenuRail = exports.InsertMenuRail = function InsertMenuRail(_ref) {
39
- var editorView = _ref.editorView,
40
- options = _ref.options,
41
- api = _ref.api;
42
- var dropdownItems = (0, _useInsertMenuRailItems.useInsertMenuRailItems)(editorView, options, api);
43
- var _useIntl = (0, _reactIntlNext.useIntl)(),
44
- formatMessage = _useIntl.formatMessage;
45
- var onInsert = function onInsert(_ref2) {
46
- var _api$core, _api$hyperlink, _api$imageUpload, _api$media, _api$mention, _api$emoji, _api$codeBlock, _api$blockType, _api$panel, _api$taskDecision, _api$taskDecision2, _api$rule, _api$core2, _api$quickInsert, _api$core3, _api$date, _api$placeholderText, _api$layout, _api$core4, _api$status;
47
- var item = _ref2.item;
48
- var state = editorView.state,
49
- dispatch = editorView.dispatch;
50
- var inputMethod = _analytics.INPUT_METHOD.INSERT_MENU_RIGHT_RAIL;
51
- if (!api) {
52
- return;
53
- }
54
- if (!editorView.hasFocus()) {
55
- editorView.focus();
56
- }
57
-
58
- // Below is duplicated from ToolbarInsertBlock/index.tsx - this function is only called
59
- // for BlockMenuItem items, which are rendered in the insert menu when no search has been performed.
60
- // When a search is performed, the list will be filled by QuickInsertItems, which handle their own insertion.
61
- switch (item.value.name) {
62
- case 'link':
63
- // @ts-expect-error
64
- (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$hyperlink = api.hyperlink) === null || _api$hyperlink === void 0 ? void 0 : _api$hyperlink.commands.showLinkToolbar(inputMethod));
65
- break;
66
- case 'table':
67
- // workaround to solve race condition where cursor is not placed correctly inside table
68
- queueMicrotask(function () {
69
- var _api$table, _api$table$actions$in, _api$table$actions;
70
- // @ts-expect-error
71
- (_api$table = api.table) === null || _api$table === void 0 || (_api$table$actions$in = (_api$table$actions = _api$table.actions).insertTable) === null || _api$table$actions$in === void 0 || _api$table$actions$in.call(_api$table$actions, {
72
- action: _analytics.ACTION.INSERTED,
73
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
74
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.TABLE,
75
- attributes: {
76
- inputMethod: inputMethod
77
- },
78
- eventType: _analytics.EVENT_TYPE.TRACK
79
- })(state, dispatch);
80
- });
81
- break;
82
- case 'image upload':
83
- (_api$imageUpload = api.imageUpload) === null || _api$imageUpload === void 0 || _api$imageUpload.actions.startUpload()(state, dispatch);
84
- break;
85
- case 'media':
86
- var mediaState = (_api$media = api.media) === null || _api$media === void 0 ? void 0 : _api$media.sharedState.currentState();
87
- if (mediaState) {
88
- var _api$analytics;
89
- mediaState.showMediaPicker();
90
- // @ts-expect-error
91
- (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
92
- action: _analytics.ACTION.OPENED,
93
- actionSubject: _analytics.ACTION_SUBJECT.PICKER,
94
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
95
- attributes: {
96
- inputMethod: inputMethod
97
- },
98
- eventType: _analytics.EVENT_TYPE.UI
99
- });
100
- }
101
- break;
102
- case 'mention':
103
- var pluginState = (_api$mention = api.mention) === null || _api$mention === void 0 ? void 0 : _api$mention.sharedState.currentState();
104
- if (pluginState && pluginState.canInsertMention) {
105
- var _api$mention2;
106
- // @ts-expect-error
107
- (_api$mention2 = api.mention) === null || _api$mention2 === void 0 || (_api$mention2 = _api$mention2.actions) === null || _api$mention2 === void 0 || _api$mention2.openTypeAhead(inputMethod);
108
- }
109
- break;
110
- case 'emoji':
111
- // @ts-expect-error
112
- (_api$emoji = api.emoji) === null || _api$emoji === void 0 || _api$emoji.actions.openTypeAhead(inputMethod);
113
- break;
114
- case 'codeblock':
115
- (_api$codeBlock = api.codeBlock) === null || _api$codeBlock === void 0 || _api$codeBlock.actions.insertCodeBlock(inputMethod)(state, dispatch);
116
- break;
117
- case 'blockquote':
118
- // @ts-expect-error
119
- (_api$blockType = api.blockType) === null || _api$blockType === void 0 || _api$blockType.actions.insertBlockQuote(inputMethod)(state, dispatch);
120
- break;
121
- case 'panel':
122
- (_api$panel = api.panel) === null || _api$panel === void 0 || _api$panel.actions.insertPanel(inputMethod)(state, dispatch);
123
- break;
124
- case 'action':
125
- // @ts-expect-error
126
- (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 || _api$taskDecision.actions.insertTaskDecision('taskList', inputMethod)(state, dispatch);
127
- break;
128
- case 'decision':
129
- // @ts-expect-error
130
- (_api$taskDecision2 = api.taskDecision) === null || _api$taskDecision2 === void 0 || _api$taskDecision2.actions.insertTaskDecision('decisionList', inputMethod)(state, dispatch);
131
- break;
132
- case 'horizontalrule':
133
- // @ts-expect-error
134
- (_api$rule = api.rule) === null || _api$rule === void 0 || _api$rule.actions.insertHorizontalRule(inputMethod)(state, dispatch);
135
- break;
136
- case 'macro':
137
- (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute((_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.commands.openElementBrowserModal);
138
- break;
139
- case 'date':
140
- (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute((_api$date = api.date) === null || _api$date === void 0 || (_api$date = _api$date.commands) === null || _api$date === void 0 ? void 0 : _api$date.insertDate({
141
- // @ts-expect-error
142
- inputMethod: inputMethod
143
- }));
144
- break;
145
- case 'placeholder text':
146
- (_api$placeholderText = api.placeholderText) === null || _api$placeholderText === void 0 || _api$placeholderText.actions.showPlaceholderFloatingToolbar(editorView.state, editorView.dispatch);
147
- break;
148
- case 'layout':
149
- // @ts-expect-error
150
- (_api$layout = api.layout) === null || _api$layout === void 0 || _api$layout.actions.insertLayoutColumns(inputMethod)(editorView.state, editorView.dispatch);
151
- break;
152
- case 'status':
153
- // @ts-expect-error
154
- (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.execute((_api$status = api.status) === null || _api$status === void 0 || (_api$status = _api$status.commands) === null || _api$status === void 0 ? void 0 : _api$status.insertStatus(inputMethod));
155
- break;
156
-
157
- // https://product-fabric.atlassian.net/browse/ED-8053
158
- // @ts-ignore: OK to fallthrough to default
159
- case 'expand':
160
- if (options.allowExpand) {
161
- var _api$expand;
162
- (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.actions.insertExpand(state, dispatch);
163
- break;
164
- }
165
-
166
- // eslint-disable-next-line no-fallthrough
167
- default:
168
- // leaving this blank for now
169
- }
170
- };
171
- (0, _react.useEffect)(function () {
172
- if (!api) {
173
- return;
174
- }
175
- api.core.actions.execute(function (_ref3) {
176
- var _api$analytics2;
177
- var tr = _ref3.tr;
178
- (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
179
- action: _analytics.ACTION.OPENED,
180
- // @ts-expect-error
181
- actionSubject: _analytics.INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
182
- eventType: _analytics.EVENT_TYPE.UI
183
- })(tr);
184
- return tr;
185
- });
186
- return function () {
187
- if (!api) {
188
- return;
189
- }
190
- api.core.actions.execute(function (_ref4) {
191
- var _api$analytics3;
192
- var tr = _ref4.tr;
193
- (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.attachAnalyticsEvent({
194
- action: _analytics.ACTION.CLOSED,
195
- // @ts-expect-error
196
- actionSubject: _analytics.INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
197
- eventType: _analytics.EVENT_TYPE.UI
198
- })(tr);
199
- return tr;
200
- });
201
- };
202
- }, [api]);
203
- return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
204
- xcss: panelWrapper
205
- }, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
206
- xcss: panelContentHeader
207
- }, /*#__PURE__*/_react.default.createElement(_heading.default, {
208
- size: "small",
209
- as: "h2"
210
- }, formatMessage(_messages.toolbarInsertBlockMessages.insertRightRailTitle)), /*#__PURE__*/_react.default.createElement(_new.IconButton, {
211
- appearance: "subtle",
212
- testId: "right-rail-insert-menu-close-button",
213
- label: formatMessage(_messages.toolbarInsertBlockMessages.closeInsertRightRail),
214
- icon: _closeCross.default,
215
- onClick: function onClick() {
216
- if (!api) {
217
- return;
218
- }
219
- api.core.actions.execute(function (_ref5) {
220
- var _api$contextPanel;
221
- var tr = _ref5.tr;
222
- (0, _commands.toggleInsertMenuRightRail)(tr);
223
- (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 || _api$contextPanel.actions.applyChange(tr);
224
- return tr;
225
- });
226
- }
227
- })), /*#__PURE__*/_react.default.createElement(_InsertMenu.default, {
228
- editorView: editorView,
229
- dropdownItems: dropdownItems,
230
- onInsert: onInsert,
231
- toggleVisiblity: function toggleVisiblity() {},
232
- showElementBrowserLink: true,
233
- pluginInjectionApi: api,
234
- isFullPageAppearance: true
235
- }));
236
- };
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = ExpandIcon;
7
- var _react = require("@emotion/react");
8
- /**
9
- * @jsxRuntime classic
10
- * @jsx jsx
11
- */
12
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
13
-
14
- var iconContainer = (0, _react.css)({
15
- display: 'inline-flex',
16
- justifyContent: 'center',
17
- alignItems: 'center',
18
- width: '24px',
19
- height: '24px'
20
- });
21
- function ExpandIcon(_ref) {
22
- var disabled = _ref.disabled;
23
- return (0, _react.jsx)("span", {
24
- css: iconContainer
25
- }, (0, _react.jsx)("svg", {
26
- xmlns: "http://www.w3.org/2000/svg",
27
- width: "18",
28
- height: "16",
29
- viewBox: "0 0 18 16",
30
- fill: "none"
31
- }, (0, _react.jsx)("path", {
32
- d: "M2 2V14H16V2H2ZM2 0H16C16.5304 0 17.0391 0.210714 17.4142 0.585786C17.7893 0.960859 18 1.46957 18 2V14C18 14.5304 17.7893 15.0391 17.4142 15.4142C17.0391 15.7893 16.5304 16 16 16H2C1.46957 16 0.960859 15.7893 0.585786 15.4142C0.210714 15.0391 0 14.5304 0 14V2C0 1.46957 0.210714 0.960859 0.585786 0.585786C0.960859 0.210714 1.46957 0 2 0Z",
33
- fill: disabled ? "var(--ds-icon-disabled, #B3B9C4)" : "var(--ds-icon, #44546F)"
34
- }), (0, _react.jsx)("path", {
35
- fillRule: "evenodd",
36
- clipRule: "evenodd",
37
- d: "M5.29158 6.29294C5.10477 6.48183 5 6.73678 5 7.00244C5 7.2681 5.10477 7.52305 5.29158 7.71194L8.23058 10.6769C8.44858 10.8919 8.73058 10.9989 9.00958 10.9989C9.28858 10.9989 9.56558 10.8919 9.77858 10.6769L12.7086 7.72194C12.8951 7.53292 12.9998 7.27803 12.9998 7.01244C12.9998 6.74686 12.8951 6.49196 12.7086 6.30294C12.6167 6.20976 12.5073 6.13576 12.3866 6.08525C12.2659 6.03474 12.1364 6.00873 12.0056 6.00873C11.8748 6.00873 11.7452 6.03474 11.6245 6.08525C11.5039 6.13576 11.3944 6.20976 11.3026 6.30294L9.00458 8.61994L6.69758 6.29294C6.60554 6.20012 6.49604 6.12644 6.37538 6.07617C6.25472 6.02589 6.1253 6 5.99458 6C5.86386 6 5.73444 6.02589 5.61378 6.07617C5.49312 6.12644 5.38362 6.20012 5.29158 6.29294Z",
38
- fill: disabled ? "var(--ds-icon-disabled, #B3B9C4)" : "var(--ds-icon, #44546F)"
39
- })));
40
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = SwitchIcon;
8
- var _react = require("@emotion/react");
9
- var _refresh = _interopRequireDefault(require("@atlaskit/icon/core/migration/refresh"));
10
- /**
11
- * @jsxRuntime classic
12
- * @jsx jsx
13
- */
14
-
15
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
16
-
17
- var iconStyle = (0, _react.css)({
18
- transform: 'rotate(-90deg)'
19
- });
20
- function SwitchIcon() {
21
- return (0, _react.jsx)("span", {
22
- css: iconStyle
23
- }, (0, _react.jsx)(_refresh.default, {
24
- label: ""
25
- }));
26
- }