@atlaskit/editor-plugin-insert-block 1.11.0 → 1.11.1

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-insert-block
2
2
 
3
+ ## 1.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#136413](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136413)
8
+ [`934839fbec788`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/934839fbec788) -
9
+ Revert ED-24737-enable-right-rail due to HOT-111462
10
+
3
11
  ## 1.11.0
4
12
 
5
13
  ### Minor Changes
@@ -17,8 +17,6 @@ var _utils = require("@atlaskit/editor-common/utils");
17
17
  var _consts = require("@atlaskit/editor-plugin-block-type/consts");
18
18
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
19
19
  var _switch = _interopRequireDefault(require("./assets/switch"));
20
- var _elementBrowser = require("./pm-plugins/elementBrowser");
21
- var _ElementRail = require("./ui/ElementRail");
22
20
  var _templateOptions = require("./ui/templateOptions");
23
21
  var _ToolbarInsertBlock = _interopRequireDefault(require("./ui/ToolbarInsertBlock"));
24
22
  var _transformOptions = require("./ui/transformOptions");
@@ -123,17 +121,6 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
123
121
  toggle();
124
122
  }
125
123
  },
126
- pmPlugins: function pmPlugins() {
127
- if (!(0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
128
- [];
129
- }
130
- return [{
131
- name: 'elementBrowserPmPlugin',
132
- plugin: function plugin() {
133
- return (0, _elementBrowser.elementBrowserPmPlugin)();
134
- }
135
- }];
136
- },
137
124
  pluginsOptions: {
138
125
  // This is added for basic text transformations experiment.
139
126
  // This may not be the most ideal plugin to add this to, but it is suitable for experiment purpose
@@ -203,25 +190,6 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
203
190
  return _templateOptions.templateOptions;
204
191
  }
205
192
  return [];
206
- },
207
- contextPanel: function contextPanel(state) {
208
- /**
209
- * For insert menu in right rail experiment
210
- * - Clean up ticket ED-24801
211
- */
212
- if (!(0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
213
- return;
214
- }
215
-
216
- // api.getSharedState() will have an outdated reference to editorState on first mount of this component
217
- // so instead just rely on plugin key as we don't need to be reactive to changes here
218
- var pluginState = _elementBrowser.elementBrowserPmKey.getState(state);
219
- if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen) {
220
- return /*#__PURE__*/_react.default.createElement(_ElementRail.InsertMenuRail, {
221
- api: api
222
- });
223
- }
224
- return;
225
193
  }
226
194
  },
227
195
  usePluginHook: function usePluginHook() {
@@ -26,8 +26,6 @@ var _uiReact = require("@atlaskit/editor-common/ui-react");
26
26
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
27
27
  var _picker = require("@atlaskit/emoji/picker");
28
28
  var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
29
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
30
- var _commands = require("../../pm-plugins/commands");
31
29
  var _blockInsertMenu = require("./block-insert-menu");
32
30
  var _createItems3 = require("./create-items");
33
31
  var _messages = require("./messages");
@@ -212,44 +210,10 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
212
210
  (_this$unregisterToggl = (_this2 = _this).unregisterToggleDropdownMenuOptions) === null || _this$unregisterToggl === void 0 || _this$unregisterToggl.call(_this2);
213
211
  });
214
212
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
215
- /**
216
- * For insert menu in right rail experiment
217
- * - Clean up ticket ED-24801
218
- */
219
- if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true, {
220
- exposure: true
221
- })) {
222
- var _this$props$pluginInj;
223
- (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || _this$props$pluginInj.core.actions.execute(function (_ref3) {
224
- var _this$props$pluginInj2;
225
- var tr = _ref3.tr;
226
- (0, _commands.toggleInsertMenuRightRail)(tr);
227
- (_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);
228
- return tr;
229
- });
230
- return;
231
- }
232
213
  _this.togglePlusMenuVisibility();
233
214
  });
234
215
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOpenByKeyboard", function (event) {
235
216
  if (event.key === 'Enter' || event.key === ' ') {
236
- /**
237
- * For insert menu in right rail experiment
238
- * - Clean up ticket ED-24801
239
- */
240
- if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true, {
241
- exposure: true
242
- })) {
243
- var _this$props$pluginInj3;
244
- (_this$props$pluginInj3 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj3 === void 0 || _this$props$pluginInj3.core.actions.execute(function (_ref4) {
245
- var _this$props$pluginInj4;
246
- var tr = _ref4.tr;
247
- (0, _commands.toggleInsertMenuRightRail)(tr);
248
- (_this$props$pluginInj4 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj4 === void 0 || (_this$props$pluginInj4 = _this$props$pluginInj4.contextPanel) === null || _this$props$pluginInj4 === void 0 || _this$props$pluginInj4.actions.applyChange(tr);
249
- return tr;
250
- });
251
- return;
252
- }
253
217
  _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
254
218
  isOpenedByKeyboard: true
255
219
  }));
@@ -418,9 +382,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
418
382
  var pluginInjectionApi = _this.props.pluginInjectionApi;
419
383
  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);
420
384
  });
421
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref5) {
422
- var item = _ref5.item,
423
- inputMethod = _ref5.inputMethod;
385
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref3) {
386
+ var item = _ref3.item,
387
+ inputMethod = _ref3.inputMethod;
424
388
  var _this$props10 = _this.props,
425
389
  editorView = _this$props10.editorView,
426
390
  editorActions = _this$props10.editorActions,
@@ -510,8 +474,8 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
510
474
  inputMethod: _analytics.INPUT_METHOD.TOOLBAR
511
475
  });
512
476
  });
513
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertInsertMenuItem", function (_ref6) {
514
- var item = _ref6.item;
477
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertInsertMenuItem", function (_ref4) {
478
+ var item = _ref4.item;
515
479
  return _this.onItemActivated({
516
480
  item: item,
517
481
  inputMethod: _analytics.INPUT_METHOD.INSERT_MENU
@@ -557,8 +521,8 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
557
521
  popupsScrollableElement = _this$props11.popupsScrollableElement,
558
522
  emojiProvider = _this$props11.emojiProvider,
559
523
  replacePlusMenuWithElementBrowser = _this$props11.replacePlusMenuWithElementBrowser;
560
- var dropdownEmoji = this.state.dropdownItems.some(function (_ref7) {
561
- var name = _ref7.value.name;
524
+ var dropdownEmoji = this.state.dropdownItems.some(function (_ref5) {
525
+ var name = _ref5.value.name;
562
526
  return name === 'emoji';
563
527
  });
564
528
  var dropDownButtonRef = replacePlusMenuWithElementBrowser ? this.plusButtonRef : this.dropdownButtonRef;
@@ -647,7 +611,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
647
611
  _tableSelectorButton6,
648
612
  _this$props$isDisable,
649
613
  _this$props$replacePl,
650
- _this$props$pluginInj5;
614
+ _this$props$pluginInj;
651
615
  var _this$state2 = this.state,
652
616
  buttons = _this$state2.buttons,
653
617
  dropdownItems = _this$state2.dropdownItems,
@@ -656,12 +620,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
656
620
  var _this$props13 = this.props,
657
621
  isDisabled = _this$props13.isDisabled,
658
622
  isReducedSpacing = _this$props13.isReducedSpacing;
659
- var isTableButtonVisible = buttons.some(function (_ref8) {
660
- var value = _ref8.value;
623
+ var isTableButtonVisible = buttons.some(function (_ref6) {
624
+ var value = _ref6.value;
661
625
  return value.name === 'table';
662
626
  });
663
- var isTableSizeVisible = buttons.some(function (_ref9) {
664
- var value = _ref9.value;
627
+ var isTableSizeVisible = buttons.some(function (_ref7) {
628
+ var value = _ref7.value;
665
629
  return value.name === 'table selector';
666
630
  });
667
631
  if (buttons.length === 0 && dropdownItems.length === 0) {
@@ -775,7 +739,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
775
739
  replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
776
740
  showElementBrowserLink: this.props.showElementBrowserLink || false,
777
741
  pluginInjectionApi: this.props.pluginInjectionApi
778
- })), !((_this$props$pluginInj5 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj5 !== void 0 && _this$props$pluginInj5.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
742
+ })), !((_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 */
779
743
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
780
744
  (0, _react2.jsx)("span", {
781
745
  css: _styles.separatorStyles
@@ -9,8 +9,6 @@ import { getWrappingOptions } from '@atlaskit/editor-common/utils';
9
9
  import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
10
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
11
  import SwitchIcon from './assets/switch';
12
- import { elementBrowserPmKey, elementBrowserPmPlugin } from './pm-plugins/elementBrowser';
13
- import { InsertMenuRail } from './ui/ElementRail';
14
12
  import { templateOptions } from './ui/templateOptions';
15
13
  import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
16
14
  import { transformationOptions } from './ui/transformOptions';
@@ -112,15 +110,6 @@ export const insertBlockPlugin = ({
112
110
  toggle();
113
111
  }
114
112
  },
115
- pmPlugins: () => {
116
- if (!editorExperiment('insert-menu-in-right-rail', true)) {
117
- [];
118
- }
119
- return [{
120
- name: 'elementBrowserPmPlugin',
121
- plugin: () => elementBrowserPmPlugin()
122
- }];
123
- },
124
113
  pluginsOptions: {
125
114
  // This is added for basic text transformations experiment.
126
115
  // This may not be the most ideal plugin to add this to, but it is suitable for experiment purpose
@@ -194,25 +183,6 @@ export const insertBlockPlugin = ({
194
183
  return templateOptions;
195
184
  }
196
185
  return [];
197
- },
198
- contextPanel: state => {
199
- /**
200
- * For insert menu in right rail experiment
201
- * - Clean up ticket ED-24801
202
- */
203
- if (!editorExperiment('insert-menu-in-right-rail', true)) {
204
- return;
205
- }
206
-
207
- // api.getSharedState() will have an outdated reference to editorState on first mount of this component
208
- // so instead just rely on plugin key as we don't need to be reactive to changes here
209
- const pluginState = elementBrowserPmKey.getState(state);
210
- if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen) {
211
- return /*#__PURE__*/React.createElement(InsertMenuRail, {
212
- api: api
213
- });
214
- }
215
- return;
216
186
  }
217
187
  },
218
188
  usePluginHook: () => {
@@ -16,8 +16,6 @@ import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlask
16
16
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
17
17
  import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
18
18
  import * as colors from '@atlaskit/theme/colors';
19
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
20
- import { toggleInsertMenuRightRail } from '../../pm-plugins/commands';
21
19
  import { BlockInsertMenu } from './block-insert-menu';
22
20
  import { createItems } from './create-items';
23
21
  import { messages } from './messages';
@@ -210,46 +208,10 @@ export class ToolbarInsertBlock extends React.PureComponent {
210
208
  (_this$unregisterToggl = this.unregisterToggleDropdownMenuOptions) === null || _this$unregisterToggl === void 0 ? void 0 : _this$unregisterToggl.call(this);
211
209
  });
212
210
  _defineProperty(this, "handleClick", () => {
213
- /**
214
- * For insert menu in right rail experiment
215
- * - Clean up ticket ED-24801
216
- */
217
- if (editorExperiment('insert-menu-in-right-rail', true, {
218
- exposure: true
219
- })) {
220
- var _this$props$pluginInj;
221
- (_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.core.actions.execute(({
222
- tr
223
- }) => {
224
- var _this$props$pluginInj2, _this$props$pluginInj3;
225
- toggleInsertMenuRightRail(tr);
226
- (_this$props$pluginInj2 = this.props.pluginInjectionApi) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.contextPanel) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.actions.applyChange(tr);
227
- return tr;
228
- });
229
- return;
230
- }
231
211
  this.togglePlusMenuVisibility();
232
212
  });
233
213
  _defineProperty(this, "handleOpenByKeyboard", event => {
234
214
  if (event.key === 'Enter' || event.key === ' ') {
235
- /**
236
- * For insert menu in right rail experiment
237
- * - Clean up ticket ED-24801
238
- */
239
- if (editorExperiment('insert-menu-in-right-rail', true, {
240
- exposure: true
241
- })) {
242
- var _this$props$pluginInj4;
243
- (_this$props$pluginInj4 = this.props.pluginInjectionApi) === null || _this$props$pluginInj4 === void 0 ? void 0 : _this$props$pluginInj4.core.actions.execute(({
244
- tr
245
- }) => {
246
- var _this$props$pluginInj5, _this$props$pluginInj6;
247
- toggleInsertMenuRightRail(tr);
248
- (_this$props$pluginInj5 = this.props.pluginInjectionApi) === null || _this$props$pluginInj5 === void 0 ? void 0 : (_this$props$pluginInj6 = _this$props$pluginInj5.contextPanel) === null || _this$props$pluginInj6 === void 0 ? void 0 : _this$props$pluginInj6.actions.applyChange(tr);
249
- return tr;
250
- });
251
- return;
252
- }
253
215
  this.setState({
254
216
  ...this.state,
255
217
  isOpenedByKeyboard: true
@@ -628,8 +590,8 @@ export class ToolbarInsertBlock extends React.PureComponent {
628
590
  }
629
591
  const onUnmount = () => {
630
592
  requestAnimationFrame(() => {
631
- var _this$props$pluginInj7, _this$props$pluginInj8, _this$props$pluginInj9;
632
- return (_this$props$pluginInj7 = this.props.pluginInjectionApi) === null || _this$props$pluginInj7 === void 0 ? void 0 : (_this$props$pluginInj8 = _this$props$pluginInj7.core) === null || _this$props$pluginInj8 === void 0 ? void 0 : (_this$props$pluginInj9 = _this$props$pluginInj8.actions) === null || _this$props$pluginInj9 === void 0 ? void 0 : _this$props$pluginInj9.focus();
593
+ var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3;
594
+ return (_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.core) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.actions) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.focus();
633
595
  });
634
596
  };
635
597
  return jsx(Popup, {
@@ -689,7 +651,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
689
651
  });
690
652
  }
691
653
  render() {
692
- var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$replacePl, _this$props$pluginInj10;
654
+ var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$replacePl, _this$props$pluginInj4;
693
655
  const {
694
656
  buttons,
695
657
  dropdownItems,
@@ -808,7 +770,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
808
770
  replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
809
771
  showElementBrowserLink: this.props.showElementBrowserLink || false,
810
772
  pluginInjectionApi: this.props.pluginInjectionApi
811
- })), !((_this$props$pluginInj10 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj10 !== void 0 && _this$props$pluginInj10.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
773
+ })), !((_this$props$pluginInj4 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj4 !== void 0 && _this$props$pluginInj4.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
812
774
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
813
775
  jsx("span", {
814
776
  css: separatorStyles
@@ -9,8 +9,6 @@ import { getWrappingOptions } from '@atlaskit/editor-common/utils';
9
9
  import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
10
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
11
  import SwitchIcon from './assets/switch';
12
- import { elementBrowserPmKey, elementBrowserPmPlugin } from './pm-plugins/elementBrowser';
13
- import { InsertMenuRail } from './ui/ElementRail';
14
12
  import { templateOptions } from './ui/templateOptions';
15
13
  import ToolbarInsertBlock from './ui/ToolbarInsertBlock';
16
14
  import { transformationOptions } from './ui/transformOptions';
@@ -113,17 +111,6 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
113
111
  toggle();
114
112
  }
115
113
  },
116
- pmPlugins: function pmPlugins() {
117
- if (!editorExperiment('insert-menu-in-right-rail', true)) {
118
- [];
119
- }
120
- return [{
121
- name: 'elementBrowserPmPlugin',
122
- plugin: function plugin() {
123
- return elementBrowserPmPlugin();
124
- }
125
- }];
126
- },
127
114
  pluginsOptions: {
128
115
  // This is added for basic text transformations experiment.
129
116
  // This may not be the most ideal plugin to add this to, but it is suitable for experiment purpose
@@ -193,25 +180,6 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
193
180
  return templateOptions;
194
181
  }
195
182
  return [];
196
- },
197
- contextPanel: function contextPanel(state) {
198
- /**
199
- * For insert menu in right rail experiment
200
- * - Clean up ticket ED-24801
201
- */
202
- if (!editorExperiment('insert-menu-in-right-rail', true)) {
203
- return;
204
- }
205
-
206
- // api.getSharedState() will have an outdated reference to editorState on first mount of this component
207
- // so instead just rely on plugin key as we don't need to be reactive to changes here
208
- var pluginState = elementBrowserPmKey.getState(state);
209
- if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen) {
210
- return /*#__PURE__*/React.createElement(InsertMenuRail, {
211
- api: api
212
- });
213
- }
214
- return;
215
183
  }
216
184
  },
217
185
  usePluginHook: function usePluginHook() {
@@ -32,8 +32,6 @@ import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlask
32
32
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
33
33
  import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
34
34
  import * as colors from '@atlaskit/theme/colors';
35
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
36
- import { toggleInsertMenuRightRail } from '../../pm-plugins/commands';
37
35
  import { BlockInsertMenu } from './block-insert-menu';
38
36
  import { createItems } from './create-items';
39
37
  import { messages } from './messages';
@@ -203,44 +201,10 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
203
201
  (_this$unregisterToggl = (_this2 = _this).unregisterToggleDropdownMenuOptions) === null || _this$unregisterToggl === void 0 || _this$unregisterToggl.call(_this2);
204
202
  });
205
203
  _defineProperty(_assertThisInitialized(_this), "handleClick", function () {
206
- /**
207
- * For insert menu in right rail experiment
208
- * - Clean up ticket ED-24801
209
- */
210
- if (editorExperiment('insert-menu-in-right-rail', true, {
211
- exposure: true
212
- })) {
213
- var _this$props$pluginInj;
214
- (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || _this$props$pluginInj.core.actions.execute(function (_ref3) {
215
- var _this$props$pluginInj2;
216
- var tr = _ref3.tr;
217
- toggleInsertMenuRightRail(tr);
218
- (_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);
219
- return tr;
220
- });
221
- return;
222
- }
223
204
  _this.togglePlusMenuVisibility();
224
205
  });
225
206
  _defineProperty(_assertThisInitialized(_this), "handleOpenByKeyboard", function (event) {
226
207
  if (event.key === 'Enter' || event.key === ' ') {
227
- /**
228
- * For insert menu in right rail experiment
229
- * - Clean up ticket ED-24801
230
- */
231
- if (editorExperiment('insert-menu-in-right-rail', true, {
232
- exposure: true
233
- })) {
234
- var _this$props$pluginInj3;
235
- (_this$props$pluginInj3 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj3 === void 0 || _this$props$pluginInj3.core.actions.execute(function (_ref4) {
236
- var _this$props$pluginInj4;
237
- var tr = _ref4.tr;
238
- toggleInsertMenuRightRail(tr);
239
- (_this$props$pluginInj4 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj4 === void 0 || (_this$props$pluginInj4 = _this$props$pluginInj4.contextPanel) === null || _this$props$pluginInj4 === void 0 || _this$props$pluginInj4.actions.applyChange(tr);
240
- return tr;
241
- });
242
- return;
243
- }
244
208
  _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
245
209
  isOpenedByKeyboard: true
246
210
  }));
@@ -409,9 +373,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
409
373
  var pluginInjectionApi = _this.props.pluginInjectionApi;
410
374
  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);
411
375
  });
412
- _defineProperty(_assertThisInitialized(_this), "onItemActivated", function (_ref5) {
413
- var item = _ref5.item,
414
- inputMethod = _ref5.inputMethod;
376
+ _defineProperty(_assertThisInitialized(_this), "onItemActivated", function (_ref3) {
377
+ var item = _ref3.item,
378
+ inputMethod = _ref3.inputMethod;
415
379
  var _this$props10 = _this.props,
416
380
  editorView = _this$props10.editorView,
417
381
  editorActions = _this$props10.editorActions,
@@ -501,8 +465,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
501
465
  inputMethod: INPUT_METHOD.TOOLBAR
502
466
  });
503
467
  });
504
- _defineProperty(_assertThisInitialized(_this), "insertInsertMenuItem", function (_ref6) {
505
- var item = _ref6.item;
468
+ _defineProperty(_assertThisInitialized(_this), "insertInsertMenuItem", function (_ref4) {
469
+ var item = _ref4.item;
506
470
  return _this.onItemActivated({
507
471
  item: item,
508
472
  inputMethod: INPUT_METHOD.INSERT_MENU
@@ -548,8 +512,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
548
512
  popupsScrollableElement = _this$props11.popupsScrollableElement,
549
513
  emojiProvider = _this$props11.emojiProvider,
550
514
  replacePlusMenuWithElementBrowser = _this$props11.replacePlusMenuWithElementBrowser;
551
- var dropdownEmoji = this.state.dropdownItems.some(function (_ref7) {
552
- var name = _ref7.value.name;
515
+ var dropdownEmoji = this.state.dropdownItems.some(function (_ref5) {
516
+ var name = _ref5.value.name;
553
517
  return name === 'emoji';
554
518
  });
555
519
  var dropDownButtonRef = replacePlusMenuWithElementBrowser ? this.plusButtonRef : this.dropdownButtonRef;
@@ -638,7 +602,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
638
602
  _tableSelectorButton6,
639
603
  _this$props$isDisable,
640
604
  _this$props$replacePl,
641
- _this$props$pluginInj5;
605
+ _this$props$pluginInj;
642
606
  var _this$state2 = this.state,
643
607
  buttons = _this$state2.buttons,
644
608
  dropdownItems = _this$state2.dropdownItems,
@@ -647,12 +611,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
647
611
  var _this$props13 = this.props,
648
612
  isDisabled = _this$props13.isDisabled,
649
613
  isReducedSpacing = _this$props13.isReducedSpacing;
650
- var isTableButtonVisible = buttons.some(function (_ref8) {
651
- var value = _ref8.value;
614
+ var isTableButtonVisible = buttons.some(function (_ref6) {
615
+ var value = _ref6.value;
652
616
  return value.name === 'table';
653
617
  });
654
- var isTableSizeVisible = buttons.some(function (_ref9) {
655
- var value = _ref9.value;
618
+ var isTableSizeVisible = buttons.some(function (_ref7) {
619
+ var value = _ref7.value;
656
620
  return value.name === 'table selector';
657
621
  });
658
622
  if (buttons.length === 0 && dropdownItems.length === 0) {
@@ -766,7 +730,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
766
730
  replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
767
731
  showElementBrowserLink: this.props.showElementBrowserLink || false,
768
732
  pluginInjectionApi: this.props.pluginInjectionApi
769
- })), !((_this$props$pluginInj5 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj5 !== void 0 && _this$props$pluginInj5.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
733
+ })), !((_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 */
770
734
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
771
735
  jsx("span", {
772
736
  css: separatorStyles
@@ -2,7 +2,6 @@ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { BlockTypePlugin } from '@atlaskit/editor-plugin-block-type';
4
4
  import type { CodeBlockPlugin } from '@atlaskit/editor-plugin-code-block';
5
- import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
6
5
  import type { DatePlugin } from '@atlaskit/editor-plugin-date';
7
6
  import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
8
7
  import type { ExpandPlugin } from '@atlaskit/editor-plugin-expand';
@@ -44,6 +43,5 @@ export type InsertBlockPluginDependencies = [
44
43
  OptionalPlugin<ExtensionPlugin>,
45
44
  OptionalPlugin<TasksAndDecisionsPlugin>,
46
45
  OptionalPlugin<PrimaryToolbarPlugin>,
47
- OptionalPlugin<FeatureFlagsPlugin>,
48
- OptionalPlugin<ContextPanelPlugin>
46
+ OptionalPlugin<FeatureFlagsPlugin>
49
47
  ];
@@ -2,7 +2,6 @@ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { BlockTypePlugin } from '@atlaskit/editor-plugin-block-type';
4
4
  import type { CodeBlockPlugin } from '@atlaskit/editor-plugin-code-block';
5
- import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
6
5
  import type { DatePlugin } from '@atlaskit/editor-plugin-date';
7
6
  import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
8
7
  import type { ExpandPlugin } from '@atlaskit/editor-plugin-expand';
@@ -44,6 +43,5 @@ export type InsertBlockPluginDependencies = [
44
43
  OptionalPlugin<ExtensionPlugin>,
45
44
  OptionalPlugin<TasksAndDecisionsPlugin>,
46
45
  OptionalPlugin<PrimaryToolbarPlugin>,
47
- OptionalPlugin<FeatureFlagsPlugin>,
48
- OptionalPlugin<ContextPanelPlugin>
46
+ OptionalPlugin<FeatureFlagsPlugin>
49
47
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^88.7.0",
34
+ "@atlaskit/editor-common": "^88.8.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
36
36
  "@atlaskit/editor-plugin-block-type": "^3.14.0",
37
37
  "@atlaskit/editor-plugin-code-block": "^3.3.0",
@@ -60,7 +60,7 @@
60
60
  "@atlaskit/icon": "^22.15.0",
61
61
  "@atlaskit/primitives": "^12.1.0",
62
62
  "@atlaskit/theme": "^13.0.0",
63
- "@atlaskit/tmp-editor-statsig": "^2.0.0",
63
+ "@atlaskit/tmp-editor-statsig": "^2.1.0",
64
64
  "@atlaskit/tokens": "^1.59.0",
65
65
  "@babel/runtime": "^7.0.0",
66
66
  "@emotion/react": "^11.7.1",
@@ -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,16 +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.InsertMenuRail = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- /**
10
- * For insert menu in right rail experiment
11
- * - Clean up ticket ED-24801
12
- */
13
- var InsertMenuRail = exports.InsertMenuRail = function InsertMenuRail(_ref) {
14
- var api = _ref.api;
15
- return /*#__PURE__*/_react.default.createElement("div", null);
16
- };
@@ -1,11 +0,0 @@
1
- import { elementBrowserPmKey } from './elementBrowser';
2
-
3
- /**
4
- * For insert menu in right rail experiment
5
- * - Clean up ticket ED-24801
6
- */
7
- export const toggleInsertMenuRightRail = tr => {
8
- return tr.setMeta(elementBrowserPmKey, {
9
- update: true
10
- });
11
- };
@@ -1,31 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- /**
4
- * For insert menu in right rail experiment
5
- * - Clean up ticket ED-24801
6
- */
7
- export const elementBrowserPmKey = new PluginKey('elementBrowserPmPlugin');
8
-
9
- /**
10
- * For insert menu in right rail experiment
11
- * - Clean up ticket ED-24801
12
- */
13
- export const elementBrowserPmPlugin = () => new SafePlugin({
14
- key: elementBrowserPmKey,
15
- state: {
16
- init() {
17
- return {
18
- menuBrowserOpen: false
19
- };
20
- },
21
- apply(tr, pluginState) {
22
- const meta = tr.getMeta(elementBrowserPmKey);
23
- if (!meta) {
24
- return pluginState;
25
- }
26
- return {
27
- menuBrowserOpen: !pluginState.menuBrowserOpen
28
- };
29
- }
30
- }
31
- });
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * For insert menu in right rail experiment
4
- * - Clean up ticket ED-24801
5
- */
6
- export const InsertMenuRail = ({
7
- api
8
- }) => {
9
- return /*#__PURE__*/React.createElement("div", null);
10
- };
@@ -1,11 +0,0 @@
1
- import { elementBrowserPmKey } from './elementBrowser';
2
-
3
- /**
4
- * For insert menu in right rail experiment
5
- * - Clean up ticket ED-24801
6
- */
7
- export var toggleInsertMenuRightRail = function toggleInsertMenuRightRail(tr) {
8
- return tr.setMeta(elementBrowserPmKey, {
9
- update: true
10
- });
11
- };
@@ -1,33 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- /**
4
- * For insert menu in right rail experiment
5
- * - Clean up ticket ED-24801
6
- */
7
- export var elementBrowserPmKey = new PluginKey('elementBrowserPmPlugin');
8
-
9
- /**
10
- * For insert menu in right rail experiment
11
- * - Clean up ticket ED-24801
12
- */
13
- export var elementBrowserPmPlugin = function elementBrowserPmPlugin() {
14
- return new SafePlugin({
15
- key: elementBrowserPmKey,
16
- state: {
17
- init: function init() {
18
- return {
19
- menuBrowserOpen: false
20
- };
21
- },
22
- apply: function apply(tr, pluginState) {
23
- var meta = tr.getMeta(elementBrowserPmKey);
24
- if (!meta) {
25
- return pluginState;
26
- }
27
- return {
28
- menuBrowserOpen: !pluginState.menuBrowserOpen
29
- };
30
- }
31
- }
32
- });
33
- };
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * For insert menu in right rail experiment
4
- * - Clean up ticket ED-24801
5
- */
6
- export var InsertMenuRail = function InsertMenuRail(_ref) {
7
- var api = _ref.api;
8
- return /*#__PURE__*/React.createElement("div", null);
9
- };
@@ -1,6 +0,0 @@
1
- import { type Transaction } from '@atlaskit/editor-prosemirror/state';
2
- /**
3
- * For insert menu in right rail experiment
4
- * - Clean up ticket ED-24801
5
- */
6
- export declare const toggleInsertMenuRightRail: (tr: Transaction) => Transaction;
@@ -1,16 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- type ElementBrowserPmPluginState = {
4
- menuBrowserOpen: boolean;
5
- };
6
- /**
7
- * For insert menu in right rail experiment
8
- * - Clean up ticket ED-24801
9
- */
10
- export declare const elementBrowserPmKey: PluginKey<ElementBrowserPmPluginState>;
11
- /**
12
- * For insert menu in right rail experiment
13
- * - Clean up ticket ED-24801
14
- */
15
- export declare const elementBrowserPmPlugin: () => SafePlugin<ElementBrowserPmPluginState>;
16
- export {};
@@ -1,16 +0,0 @@
1
- /// <reference types="react" />
2
- import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import { type InsertBlockPlugin } from '../../plugin';
4
- /**
5
- * For insert menu in right rail experiment
6
- * - Clean up ticket ED-24801
7
- */
8
- export declare const InsertMenuRail: ({ api }: {
9
- api?: import("@atlaskit/editor-common/types").EditorInjectionAPI<"insertBlock", {
10
- pluginConfiguration: import("../../plugin").InsertBlockOptions | undefined;
11
- dependencies: import("../..").InsertBlockPluginDependencies;
12
- actions: {
13
- toggleAdditionalMenu: () => void;
14
- };
15
- }> | undefined;
16
- }) => JSX.Element;
@@ -1,6 +0,0 @@
1
- import { type Transaction } from '@atlaskit/editor-prosemirror/state';
2
- /**
3
- * For insert menu in right rail experiment
4
- * - Clean up ticket ED-24801
5
- */
6
- export declare const toggleInsertMenuRightRail: (tr: Transaction) => Transaction;
@@ -1,16 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- type ElementBrowserPmPluginState = {
4
- menuBrowserOpen: boolean;
5
- };
6
- /**
7
- * For insert menu in right rail experiment
8
- * - Clean up ticket ED-24801
9
- */
10
- export declare const elementBrowserPmKey: PluginKey<ElementBrowserPmPluginState>;
11
- /**
12
- * For insert menu in right rail experiment
13
- * - Clean up ticket ED-24801
14
- */
15
- export declare const elementBrowserPmPlugin: () => SafePlugin<ElementBrowserPmPluginState>;
16
- export {};
@@ -1,16 +0,0 @@
1
- /// <reference types="react" />
2
- import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import { type InsertBlockPlugin } from '../../plugin';
4
- /**
5
- * For insert menu in right rail experiment
6
- * - Clean up ticket ED-24801
7
- */
8
- export declare const InsertMenuRail: ({ api }: {
9
- api?: import("@atlaskit/editor-common/types").EditorInjectionAPI<"insertBlock", {
10
- pluginConfiguration: import("../../plugin").InsertBlockOptions | undefined;
11
- dependencies: import("../..").InsertBlockPluginDependencies;
12
- actions: {
13
- toggleAdditionalMenu: () => void;
14
- };
15
- }> | undefined;
16
- }) => JSX.Element;