@atlaskit/editor-plugin-insert-block 1.14.3 → 1.14.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 1.14.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#140550](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140550)
8
+ [`b4f8f21029b8f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b4f8f21029b8f) -
9
+ Update main toolbar icon for right rail experiment, add analytics
10
+ - Updated dependencies
11
+
3
12
  ## 1.14.3
4
13
 
5
14
  ### Patch Changes
@@ -329,5 +329,13 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
329
329
  showElementBrowserLink: options.showElementBrowserLink,
330
330
  showSeparator: !isLastItem && toolbarSize <= _types.ToolbarSize.S,
331
331
  registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
332
+ /**
333
+ * For insert menu in right rail experiment, ignore for now since editorAppearance has been kept
334
+ * internal due to temporary nature of experiment
335
+ * - Clean up ticket ED-24801
336
+ */
337
+ // @ts-expect-error
338
+ ,
339
+ editorAppearance: options.UNSAFE_editorAppearance
332
340
  });
333
341
  }
@@ -169,10 +169,10 @@ var insertMenuWrapper = function insertMenuWrapper(itemCount) {
169
169
  return (0, _react2.css)({
170
170
  display: 'flex',
171
171
  flexDirection: 'column',
172
- width: '310px',
172
+ width: '314px',
173
173
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
174
174
  height: 'calc(100% - 32px)',
175
- margin: "0 -10px",
175
+ margin: "0 -12px",
176
176
  backgroundColor: "".concat("var(--ds-surface-overlay, ".concat(_colors.N0, ")")),
177
177
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
178
178
  borderRadius: "".concat((0, _theme.borderRadius)(), "px")
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.RightRailIcon = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntlNext = require("react-intl-next");
10
+ var _keymaps = require("@atlaskit/editor-common/keymaps");
11
+ var _messages = require("@atlaskit/editor-common/messages");
12
+ var _add = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/add"));
13
+ var _primitives = require("@atlaskit/primitives");
14
+ var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
15
+ var wrapperStyles = (0, _primitives.xcss)({
16
+ width: '32px',
17
+ height: '32px',
18
+ display: 'flex',
19
+ flexDirection: 'column',
20
+ justifyContent: 'center',
21
+ alignItems: 'center'
22
+ });
23
+ var buttonStyles = (0, _primitives.xcss)({
24
+ boxSizing: 'border-box',
25
+ display: 'flex',
26
+ flexDirection: 'column',
27
+ justifyContent: 'center',
28
+ alignItems: 'center',
29
+ height: "var(--ds-space-300, 24px)",
30
+ width: "var(--ds-space-300, 24px)",
31
+ border: 'none',
32
+ backgroundColor: 'color.background.neutral',
33
+ borderRadius: 'border.radius.circle',
34
+ color: 'color.text',
35
+ zIndex: 'card',
36
+ outline: 'none',
37
+ ':hover': {
38
+ backgroundColor: 'color.background.neutral.hovered'
39
+ },
40
+ ':active': {
41
+ backgroundColor: 'color.background.neutral.pressed'
42
+ },
43
+ ':focus': {
44
+ outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
45
+ }
46
+ });
47
+ var RightRailIcon = exports.RightRailIcon = function RightRailIcon(_ref) {
48
+ var onClick = _ref.onClick;
49
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
50
+ formatMessage = _useIntl.formatMessage;
51
+ return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
52
+ xcss: [wrapperStyles]
53
+ }, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
54
+ content: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent
55
+ // Re-using insertRightRailTitle for tooltip, both messages are the same
56
+ , {
57
+ description: formatMessage(_messages.toolbarInsertBlockMessages.insertRightRailTitle),
58
+ shortcutOverride: "/"
59
+ })
60
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
61
+ type: "button",
62
+ "aria-label": formatMessage(_messages.toolbarInsertBlockMessages.insertMenu),
63
+ xcss: [buttonStyles],
64
+ onClick: onClick
65
+ }, /*#__PURE__*/_react.default.createElement(_add.default, {
66
+ label: formatMessage(_messages.toolbarInsertBlockMessages.insertMenu),
67
+ size: "medium"
68
+ }))));
69
+ };
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.InsertMenuRail = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
+ var _react = _interopRequireWildcard(require("react"));
9
10
  var _reactIntlNext = require("react-intl-next");
10
11
  var _new = require("@atlaskit/button/new");
11
12
  var _analytics = require("@atlaskit/editor-common/analytics");
@@ -16,6 +17,8 @@ var _primitives = require("@atlaskit/primitives");
16
17
  var _commands = require("../../pm-plugins/commands");
17
18
  var _InsertMenu = _interopRequireDefault(require("../ElementBrowser/InsertMenu"));
18
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; }
19
22
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
20
23
 
21
24
  var panelWrapper = (0, _primitives.xcss)({
@@ -165,6 +168,38 @@ var InsertMenuRail = exports.InsertMenuRail = function InsertMenuRail(_ref) {
165
168
  // leaving this blank for now
166
169
  }
167
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]);
168
203
  return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
169
204
  xcss: panelWrapper
170
205
  }, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
@@ -181,9 +216,9 @@ var InsertMenuRail = exports.InsertMenuRail = function InsertMenuRail(_ref) {
181
216
  if (!api) {
182
217
  return;
183
218
  }
184
- api.core.actions.execute(function (_ref3) {
219
+ api.core.actions.execute(function (_ref5) {
185
220
  var _api$contextPanel;
186
- var tr = _ref3.tr;
221
+ var tr = _ref5.tr;
187
222
  (0, _commands.toggleInsertMenuRightRail)(tr);
188
223
  (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 || _api$contextPanel.actions.applyChange(tr);
189
224
  return tr;
@@ -51,7 +51,9 @@ var useInsertMenuRailItems = exports.useInsertMenuRailItems = function useInsert
51
51
  availableWrapperBlockTypes: blockTypeState && blockTypeState.availableWrapperBlockTypes,
52
52
  insertMenuItems: options.insertMenuItems,
53
53
  schema: editorView.state.schema,
54
- numberOfButtons: 10,
54
+ // numberOfButtons controls what items are returned and eventually display in the insert menu - but it relies on the main toolbar width which
55
+ // is not easily available here. I've used 7 as it's the value used for most widths see toolbarSizeToButtons
56
+ numberOfButtons: 7,
55
57
  formatMessage: formatMessage,
56
58
  isNewMenuEnabled: true
57
59
  });
@@ -28,6 +28,7 @@ var _picker = require("@atlaskit/emoji/picker");
28
28
  var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
29
29
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
30
30
  var _commands = require("../../pm-plugins/commands");
31
+ var _MainToolBarIcon = require("../ElementRail/MainToolBarIcon");
31
32
  var _blockInsertMenu = require("./block-insert-menu");
32
33
  var _createItems3 = require("./create-items");
33
34
  var _messages = require("./messages");
@@ -219,12 +220,23 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
219
220
  if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true, {
220
221
  exposure: true
221
222
  })) {
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;
223
+ var pluginInjectionApi = _this.props.pluginInjectionApi;
224
+ if (!pluginInjectionApi) {
225
+ return;
226
+ }
227
+ pluginInjectionApi.core.actions.execute(function (_ref3) {
228
+ var _pluginInjectionApi$c, _pluginInjectionApi$a;
225
229
  var tr = _ref3.tr;
226
230
  (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);
231
+ (_pluginInjectionApi$c = pluginInjectionApi.contextPanel) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.applyChange(tr);
232
+ (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 || _pluginInjectionApi$a.actions.attachAnalyticsEvent({
233
+ action: _analytics.ACTION.CLICKED,
234
+ // @ts-expect-error
235
+ actionSubject: _analytics.ACTION_SUBJECT.TOOLBAR_BUTTON,
236
+ // @ts-expect-error
237
+ actionSubjectId: _analytics.INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
238
+ eventType: _analytics.EVENT_TYPE.UI
239
+ })(tr);
228
240
  return tr;
229
241
  });
230
242
  return;
@@ -240,12 +252,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
240
252
  if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true, {
241
253
  exposure: true
242
254
  })) {
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;
255
+ var _this$props$pluginInj;
256
+ (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || _this$props$pluginInj.core.actions.execute(function (_ref4) {
257
+ var _this$props$pluginInj2;
246
258
  var tr = _ref4.tr;
247
259
  (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);
260
+ (_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);
249
261
  return tr;
250
262
  });
251
263
  return;
@@ -265,9 +277,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
265
277
  }
266
278
  });
267
279
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleLinkPanel", function (inputMethod) {
268
- var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$h;
280
+ var _pluginInjectionApi$c2, _pluginInjectionApi$c3, _pluginInjectionApi$h;
269
281
  var pluginInjectionApi = _this.props.pluginInjectionApi;
270
- 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;
282
+ 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;
271
283
  });
272
284
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertMention", function (inputMethod) {
273
285
  var _pluginInjectionApi$m, _pluginInjectionApi$m2;
@@ -310,15 +322,15 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
310
322
 
311
323
  // workaround to solve race condition where cursor is not placed correctly inside table
312
324
  queueMicrotask(function () {
313
- var _pluginInjectionApi$c3, _pluginInjectionApi$t4;
314
- 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, _analytics.INPUT_METHOD.PICKER));
325
+ var _pluginInjectionApi$c4, _pluginInjectionApi$t4;
326
+ 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, _analytics.INPUT_METHOD.PICKER));
315
327
  });
316
328
  };
317
329
  });
318
330
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createDate", function (inputMethod) {
319
- var _pluginInjectionApi$c4, _pluginInjectionApi$d;
331
+ var _pluginInjectionApi$c5, _pluginInjectionApi$d;
320
332
  var pluginInjectionApi = _this.props.pluginInjectionApi;
321
- 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({
333
+ 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({
322
334
  inputMethod: inputMethod
323
335
  }));
324
336
  return true;
@@ -340,9 +352,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
340
352
  return true;
341
353
  });
342
354
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createStatus", function (inputMethod) {
343
- var _pluginInjectionApi$c5, _pluginInjectionApi$s;
355
+ var _pluginInjectionApi$c6, _pluginInjectionApi$s;
344
356
  var pluginInjectionApi = _this.props.pluginInjectionApi;
345
- 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)));
357
+ 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)));
346
358
  });
347
359
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openMediaPicker", function (inputMethod) {
348
360
  var _this$props5 = _this.props,
@@ -406,17 +418,17 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
406
418
  };
407
419
  });
408
420
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSelectedEmoji", function (emojiId) {
409
- var _pluginInjectionApi$c6, _pluginInjectionApi$e3;
421
+ var _pluginInjectionApi$c7, _pluginInjectionApi$e3;
410
422
  var pluginInjectionApi = _this.props.pluginInjectionApi;
411
423
  _this.props.editorView.focus();
412
- 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, _analytics.INPUT_METHOD.PICKER));
424
+ 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, _analytics.INPUT_METHOD.PICKER));
413
425
  _this.toggleEmojiPicker();
414
426
  return true;
415
427
  });
416
428
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openElementBrowser", function () {
417
- var _pluginInjectionApi$c7, _pluginInjectionApi$q;
429
+ var _pluginInjectionApi$c8, _pluginInjectionApi$q;
418
430
  var pluginInjectionApi = _this.props.pluginInjectionApi;
419
- 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);
431
+ 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);
420
432
  });
421
433
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref5) {
422
434
  var item = _ref5.item,
@@ -613,8 +625,8 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
613
625
  // Popup will be unmounted to ensure that the new table has a selection with a blinking cursor.
614
626
  // So we can start typing right away.
615
627
  var onUnmount = function onUnmount() {
616
- var _pluginInjectionApi$c8;
617
- 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();
628
+ var _pluginInjectionApi$c9;
629
+ 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();
618
630
  };
619
631
  return (0, _react2.jsx)(_tableSelectorPopupWithListeners.default, {
620
632
  target: ref,
@@ -647,7 +659,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
647
659
  _tableSelectorButton6,
648
660
  _this$props$isDisable,
649
661
  _this$props$replacePl,
650
- _this$props$pluginInj5;
662
+ _this$props$pluginInj3;
651
663
  var _this$state2 = this.state,
652
664
  buttons = _this$state2.buttons,
653
665
  dropdownItems = _this$state2.dropdownItems,
@@ -655,7 +667,8 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
655
667
  isTableSelectorOpen = _this$state2.isTableSelectorOpen;
656
668
  var _this$props13 = this.props,
657
669
  isDisabled = _this$props13.isDisabled,
658
- isReducedSpacing = _this$props13.isReducedSpacing;
670
+ isReducedSpacing = _this$props13.isReducedSpacing,
671
+ editorAppearance = _this$props13.editorAppearance;
659
672
  var isTableButtonVisible = buttons.some(function (_ref8) {
660
673
  var value = _ref8.value;
661
674
  return value.name === 'table';
@@ -753,7 +766,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
753
766
  onKeyDown: this.handleTableSelectorOpenByKeyboard
754
767
  })), (0, _react2.jsx)("span", {
755
768
  css: _styles.wrapperStyle
756
- }, this.renderPopup(), this.renderTableSelectorPopup(), (0, _react2.jsx)(_blockInsertMenu.BlockInsertMenu, {
769
+ }, this.renderPopup(), this.renderTableSelectorPopup(), (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true) && ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '') ? (0, _react2.jsx)(_MainToolBarIcon.RightRailIcon, {
770
+ onClick: this.handleClick
771
+ }) : (0, _react2.jsx)(_blockInsertMenu.BlockInsertMenu, {
757
772
  popupsMountPoint: this.props.popupsMountPoint,
758
773
  popupsBoundariesElement: this.props.popupsBoundariesElement,
759
774
  popupsScrollableElement: this.props.popupsScrollableElement,
@@ -775,7 +790,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
775
790
  replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
776
791
  showElementBrowserLink: this.props.showElementBrowserLink || false,
777
792
  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 */
793
+ })), !((_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 */
779
794
  // 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
795
  (0, _react2.jsx)("span", {
781
796
  css: _styles.separatorStyles
@@ -322,5 +322,13 @@ function ToolbarInsertBlockWithInjectionApi({
322
322
  showElementBrowserLink: options.showElementBrowserLink,
323
323
  showSeparator: !isLastItem && toolbarSize <= ToolbarSize.S,
324
324
  registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
325
+ /**
326
+ * For insert menu in right rail experiment, ignore for now since editorAppearance has been kept
327
+ * internal due to temporary nature of experiment
328
+ * - Clean up ticket ED-24801
329
+ */
330
+ // @ts-expect-error
331
+ ,
332
+ editorAppearance: options.UNSAFE_editorAppearance
325
333
  });
326
334
  }
@@ -154,10 +154,10 @@ const insertMenuWrapper = itemCount => {
154
154
  return css({
155
155
  display: 'flex',
156
156
  flexDirection: 'column',
157
- width: '310px',
157
+ width: '314px',
158
158
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
159
159
  height: 'calc(100% - 32px)',
160
- margin: `0 -10px`,
160
+ margin: `0 -12px`,
161
161
  backgroundColor: `${`var(--ds-surface-overlay, ${N0})`}`,
162
162
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
163
163
  borderRadius: `${borderRadius()}px`
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
4
+ import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
5
+ import EditorAddIcon from '@atlaskit/icon/glyph/editor/add';
6
+ import { Box, Pressable, xcss } from '@atlaskit/primitives';
7
+ import Tooltip from '@atlaskit/tooltip';
8
+ const wrapperStyles = xcss({
9
+ width: '32px',
10
+ height: '32px',
11
+ display: 'flex',
12
+ flexDirection: 'column',
13
+ justifyContent: 'center',
14
+ alignItems: 'center'
15
+ });
16
+ const buttonStyles = xcss({
17
+ boxSizing: 'border-box',
18
+ display: 'flex',
19
+ flexDirection: 'column',
20
+ justifyContent: 'center',
21
+ alignItems: 'center',
22
+ height: "var(--ds-space-300, 24px)",
23
+ width: "var(--ds-space-300, 24px)",
24
+ border: 'none',
25
+ backgroundColor: 'color.background.neutral',
26
+ borderRadius: 'border.radius.circle',
27
+ color: 'color.text',
28
+ zIndex: 'card',
29
+ outline: 'none',
30
+ ':hover': {
31
+ backgroundColor: 'color.background.neutral.hovered'
32
+ },
33
+ ':active': {
34
+ backgroundColor: 'color.background.neutral.pressed'
35
+ },
36
+ ':focus': {
37
+ outline: `2px solid ${"var(--ds-border-focused, #388BFF)"}`
38
+ }
39
+ });
40
+ export const RightRailIcon = ({
41
+ onClick
42
+ }) => {
43
+ const {
44
+ formatMessage
45
+ } = useIntl();
46
+ return /*#__PURE__*/React.createElement(Box, {
47
+ xcss: [wrapperStyles]
48
+ }, /*#__PURE__*/React.createElement(Tooltip, {
49
+ content: /*#__PURE__*/React.createElement(ToolTipContent
50
+ // Re-using insertRightRailTitle for tooltip, both messages are the same
51
+ , {
52
+ description: formatMessage(toolbarInsertBlockMessages.insertRightRailTitle),
53
+ shortcutOverride: "/"
54
+ })
55
+ }, /*#__PURE__*/React.createElement(Pressable, {
56
+ type: "button",
57
+ "aria-label": formatMessage(toolbarInsertBlockMessages.insertMenu),
58
+ xcss: [buttonStyles],
59
+ onClick: onClick
60
+ }, /*#__PURE__*/React.createElement(EditorAddIcon, {
61
+ label: formatMessage(toolbarInsertBlockMessages.insertMenu),
62
+ size: "medium"
63
+ }))));
64
+ };
@@ -1,5 +1,5 @@
1
1
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
- import React from 'react';
2
+ import React, { useEffect } from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
4
  import { IconButton } from '@atlaskit/button/new';
5
5
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
@@ -162,6 +162,40 @@ export const InsertMenuRail = ({
162
162
  // leaving this blank for now
163
163
  }
164
164
  };
165
+ useEffect(() => {
166
+ if (!api) {
167
+ return;
168
+ }
169
+ api.core.actions.execute(({
170
+ tr
171
+ }) => {
172
+ var _api$analytics2;
173
+ (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
174
+ action: ACTION.OPENED,
175
+ // @ts-expect-error
176
+ actionSubject: INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
177
+ eventType: EVENT_TYPE.UI
178
+ })(tr);
179
+ return tr;
180
+ });
181
+ return () => {
182
+ if (!api) {
183
+ return;
184
+ }
185
+ api.core.actions.execute(({
186
+ tr
187
+ }) => {
188
+ var _api$analytics3;
189
+ (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
190
+ action: ACTION.CLOSED,
191
+ // @ts-expect-error
192
+ actionSubject: INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
193
+ eventType: EVENT_TYPE.UI
194
+ })(tr);
195
+ return tr;
196
+ });
197
+ };
198
+ }, [api]);
165
199
  return /*#__PURE__*/React.createElement(Box, {
166
200
  xcss: panelWrapper
167
201
  }, /*#__PURE__*/React.createElement(Box, {
@@ -45,7 +45,9 @@ export const useInsertMenuRailItems = (editorView, options, api) => {
45
45
  availableWrapperBlockTypes: blockTypeState && blockTypeState.availableWrapperBlockTypes,
46
46
  insertMenuItems: options.insertMenuItems,
47
47
  schema: editorView.state.schema,
48
- numberOfButtons: 10,
48
+ // numberOfButtons controls what items are returned and eventually display in the insert menu - but it relies on the main toolbar width which
49
+ // is not easily available here. I've used 7 as it's the value used for most widths see toolbarSizeToButtons
50
+ numberOfButtons: 7,
49
51
  formatMessage,
50
52
  isNewMenuEnabled: true
51
53
  });
@@ -18,6 +18,7 @@ import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
18
18
  import * as colors from '@atlaskit/theme/colors';
19
19
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
20
20
  import { toggleInsertMenuRightRail } from '../../pm-plugins/commands';
21
+ import { RightRailIcon } from '../ElementRail/MainToolBarIcon';
21
22
  import { BlockInsertMenu } from './block-insert-menu';
22
23
  import { createItems } from './create-items';
23
24
  import { messages } from './messages';
@@ -217,13 +218,26 @@ export class ToolbarInsertBlock extends React.PureComponent {
217
218
  if (editorExperiment('insert-menu-in-right-rail', true, {
218
219
  exposure: true
219
220
  })) {
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(({
221
+ const {
222
+ pluginInjectionApi
223
+ } = this.props;
224
+ if (!pluginInjectionApi) {
225
+ return;
226
+ }
227
+ pluginInjectionApi.core.actions.execute(({
222
228
  tr
223
229
  }) => {
224
- var _this$props$pluginInj2, _this$props$pluginInj3;
230
+ var _pluginInjectionApi$c, _pluginInjectionApi$a;
225
231
  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);
232
+ (_pluginInjectionApi$c = pluginInjectionApi.contextPanel) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.applyChange(tr);
233
+ (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent({
234
+ action: ACTION.CLICKED,
235
+ // @ts-expect-error
236
+ actionSubject: ACTION_SUBJECT.TOOLBAR_BUTTON,
237
+ // @ts-expect-error
238
+ actionSubjectId: INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
239
+ eventType: EVENT_TYPE.UI
240
+ })(tr);
227
241
  return tr;
228
242
  });
229
243
  return;
@@ -239,13 +253,13 @@ export class ToolbarInsertBlock extends React.PureComponent {
239
253
  if (editorExperiment('insert-menu-in-right-rail', true, {
240
254
  exposure: true
241
255
  })) {
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(({
256
+ var _this$props$pluginInj;
257
+ (_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.core.actions.execute(({
244
258
  tr
245
259
  }) => {
246
- var _this$props$pluginInj5, _this$props$pluginInj6;
260
+ var _this$props$pluginInj2, _this$props$pluginInj3;
247
261
  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);
262
+ (_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);
249
263
  return tr;
250
264
  });
251
265
  return;
@@ -266,11 +280,11 @@ export class ToolbarInsertBlock extends React.PureComponent {
266
280
  }
267
281
  });
268
282
  _defineProperty(this, "toggleLinkPanel", inputMethod => {
269
- var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$h;
283
+ var _pluginInjectionApi$c2, _pluginInjectionApi$c3, _pluginInjectionApi$h;
270
284
  const {
271
285
  pluginInjectionApi
272
286
  } = this.props;
273
- return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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;
287
+ return (_pluginInjectionApi$c2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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;
274
288
  });
275
289
  _defineProperty(this, "insertMention", inputMethod => {
276
290
  var _pluginInjectionApi$m, _pluginInjectionApi$m2, _pluginInjectionApi$m3;
@@ -318,16 +332,16 @@ export class ToolbarInsertBlock extends React.PureComponent {
318
332
 
319
333
  // workaround to solve race condition where cursor is not placed correctly inside table
320
334
  queueMicrotask(() => {
321
- var _pluginInjectionApi$c3, _pluginInjectionApi$t4;
322
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t4 = pluginInjectionApi.table) === null || _pluginInjectionApi$t4 === void 0 ? void 0 : _pluginInjectionApi$t4.commands.insertTableWithSize(rowsCount, colsCount, INPUT_METHOD.PICKER));
335
+ var _pluginInjectionApi$c4, _pluginInjectionApi$t4;
336
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t4 = pluginInjectionApi.table) === null || _pluginInjectionApi$t4 === void 0 ? void 0 : _pluginInjectionApi$t4.commands.insertTableWithSize(rowsCount, colsCount, INPUT_METHOD.PICKER));
323
337
  });
324
338
  });
325
339
  _defineProperty(this, "createDate", inputMethod => {
326
- var _pluginInjectionApi$c4, _pluginInjectionApi$d, _pluginInjectionApi$d2;
340
+ var _pluginInjectionApi$c5, _pluginInjectionApi$d, _pluginInjectionApi$d2;
327
341
  const {
328
342
  pluginInjectionApi
329
343
  } = this.props;
330
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.core) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.date) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.commands) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.insertDate({
344
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : _pluginInjectionApi$c5.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.date) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.commands) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.insertDate({
331
345
  inputMethod
332
346
  }));
333
347
  return true;
@@ -351,11 +365,11 @@ export class ToolbarInsertBlock extends React.PureComponent {
351
365
  return true;
352
366
  });
353
367
  _defineProperty(this, "createStatus", inputMethod => {
354
- var _pluginInjectionApi$c5, _pluginInjectionApi$s, _pluginInjectionApi$s2;
368
+ var _pluginInjectionApi$c6, _pluginInjectionApi$s, _pluginInjectionApi$s2;
355
369
  const {
356
370
  pluginInjectionApi
357
371
  } = this.props;
358
- return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : _pluginInjectionApi$c5.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.status) === null || _pluginInjectionApi$s === void 0 ? void 0 : (_pluginInjectionApi$s2 = _pluginInjectionApi$s.commands) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.insertStatus(inputMethod)));
372
+ return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.status) === null || _pluginInjectionApi$s === void 0 ? void 0 : (_pluginInjectionApi$s2 = _pluginInjectionApi$s.commands) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.insertStatus(inputMethod)));
359
373
  });
360
374
  _defineProperty(this, "openMediaPicker", inputMethod => {
361
375
  const {
@@ -425,21 +439,21 @@ export class ToolbarInsertBlock extends React.PureComponent {
425
439
  return true;
426
440
  });
427
441
  _defineProperty(this, "handleSelectedEmoji", emojiId => {
428
- var _pluginInjectionApi$c6, _pluginInjectionApi$e3;
442
+ var _pluginInjectionApi$c7, _pluginInjectionApi$e3;
429
443
  const {
430
444
  pluginInjectionApi
431
445
  } = this.props;
432
446
  this.props.editorView.focus();
433
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 ? 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));
447
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c7 = pluginInjectionApi.core) === null || _pluginInjectionApi$c7 === void 0 ? 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));
434
448
  this.toggleEmojiPicker();
435
449
  return true;
436
450
  });
437
451
  _defineProperty(this, "openElementBrowser", () => {
438
- var _pluginInjectionApi$c7, _pluginInjectionApi$q;
452
+ var _pluginInjectionApi$c8, _pluginInjectionApi$q;
439
453
  const {
440
454
  pluginInjectionApi
441
455
  } = this.props;
442
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c7 = pluginInjectionApi.core) === null || _pluginInjectionApi$c7 === void 0 ? void 0 : _pluginInjectionApi$c7.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
456
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : _pluginInjectionApi$c8.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
443
457
  });
444
458
  _defineProperty(this, "onItemActivated", ({
445
459
  item,
@@ -628,8 +642,8 @@ export class ToolbarInsertBlock extends React.PureComponent {
628
642
  }
629
643
  const onUnmount = () => {
630
644
  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();
645
+ var _this$props$pluginInj4, _this$props$pluginInj5, _this$props$pluginInj6;
646
+ return (_this$props$pluginInj4 = this.props.pluginInjectionApi) === null || _this$props$pluginInj4 === void 0 ? void 0 : (_this$props$pluginInj5 = _this$props$pluginInj4.core) === null || _this$props$pluginInj5 === void 0 ? void 0 : (_this$props$pluginInj6 = _this$props$pluginInj5.actions) === null || _this$props$pluginInj6 === void 0 ? void 0 : _this$props$pluginInj6.focus();
633
647
  });
634
648
  };
635
649
  return jsx(Popup, {
@@ -673,8 +687,8 @@ export class ToolbarInsertBlock extends React.PureComponent {
673
687
  // Popup will be unmounted to ensure that the new table has a selection with a blinking cursor.
674
688
  // So we can start typing right away.
675
689
  const onUnmount = () => {
676
- var _pluginInjectionApi$c8, _pluginInjectionApi$c9;
677
- return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : (_pluginInjectionApi$c9 = _pluginInjectionApi$c8.actions) === null || _pluginInjectionApi$c9 === void 0 ? void 0 : _pluginInjectionApi$c9.focus();
690
+ var _pluginInjectionApi$c9, _pluginInjectionApi$c10;
691
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c9 = pluginInjectionApi.core) === null || _pluginInjectionApi$c9 === void 0 ? void 0 : (_pluginInjectionApi$c10 = _pluginInjectionApi$c9.actions) === null || _pluginInjectionApi$c10 === void 0 ? void 0 : _pluginInjectionApi$c10.focus();
678
692
  };
679
693
  return jsx(TableSelectorPopup, {
680
694
  target: ref,
@@ -689,7 +703,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
689
703
  });
690
704
  }
691
705
  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;
706
+ var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$replacePl, _this$props$pluginInj7;
693
707
  const {
694
708
  buttons,
695
709
  dropdownItems,
@@ -698,7 +712,8 @@ export class ToolbarInsertBlock extends React.PureComponent {
698
712
  } = this.state;
699
713
  const {
700
714
  isDisabled,
701
- isReducedSpacing
715
+ isReducedSpacing,
716
+ editorAppearance
702
717
  } = this.props;
703
718
  const isTableButtonVisible = buttons.some(({
704
719
  value
@@ -786,7 +801,9 @@ export class ToolbarInsertBlock extends React.PureComponent {
786
801
  onKeyDown: this.handleTableSelectorOpenByKeyboard
787
802
  })), jsx("span", {
788
803
  css: wrapperStyle
789
- }, this.renderPopup(), this.renderTableSelectorPopup(), jsx(BlockInsertMenu, {
804
+ }, this.renderPopup(), this.renderTableSelectorPopup(), editorExperiment('insert-menu-in-right-rail', true) && ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '') ? jsx(RightRailIcon, {
805
+ onClick: this.handleClick
806
+ }) : jsx(BlockInsertMenu, {
790
807
  popupsMountPoint: this.props.popupsMountPoint,
791
808
  popupsBoundariesElement: this.props.popupsBoundariesElement,
792
809
  popupsScrollableElement: this.props.popupsScrollableElement,
@@ -808,7 +825,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
808
825
  replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
809
826
  showElementBrowserLink: this.props.showElementBrowserLink || false,
810
827
  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 */
828
+ })), !((_this$props$pluginInj7 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj7 !== void 0 && _this$props$pluginInj7.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
812
829
  // 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
830
  jsx("span", {
814
831
  css: separatorStyles
@@ -319,5 +319,13 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
319
319
  showElementBrowserLink: options.showElementBrowserLink,
320
320
  showSeparator: !isLastItem && toolbarSize <= ToolbarSize.S,
321
321
  registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
322
+ /**
323
+ * For insert menu in right rail experiment, ignore for now since editorAppearance has been kept
324
+ * internal due to temporary nature of experiment
325
+ * - Clean up ticket ED-24801
326
+ */
327
+ // @ts-expect-error
328
+ ,
329
+ editorAppearance: options.UNSAFE_editorAppearance
322
330
  });
323
331
  }
@@ -164,10 +164,10 @@ var insertMenuWrapper = function insertMenuWrapper(itemCount) {
164
164
  return css({
165
165
  display: 'flex',
166
166
  flexDirection: 'column',
167
- width: '310px',
167
+ width: '314px',
168
168
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
169
169
  height: 'calc(100% - 32px)',
170
- margin: "0 -10px",
170
+ margin: "0 -12px",
171
171
  backgroundColor: "".concat("var(--ds-surface-overlay, ".concat(N0, ")")),
172
172
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
173
173
  borderRadius: "".concat(borderRadius(), "px")
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
4
+ import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
5
+ import EditorAddIcon from '@atlaskit/icon/glyph/editor/add';
6
+ import { Box, Pressable, xcss } from '@atlaskit/primitives';
7
+ import Tooltip from '@atlaskit/tooltip';
8
+ var wrapperStyles = xcss({
9
+ width: '32px',
10
+ height: '32px',
11
+ display: 'flex',
12
+ flexDirection: 'column',
13
+ justifyContent: 'center',
14
+ alignItems: 'center'
15
+ });
16
+ var buttonStyles = xcss({
17
+ boxSizing: 'border-box',
18
+ display: 'flex',
19
+ flexDirection: 'column',
20
+ justifyContent: 'center',
21
+ alignItems: 'center',
22
+ height: "var(--ds-space-300, 24px)",
23
+ width: "var(--ds-space-300, 24px)",
24
+ border: 'none',
25
+ backgroundColor: 'color.background.neutral',
26
+ borderRadius: 'border.radius.circle',
27
+ color: 'color.text',
28
+ zIndex: 'card',
29
+ outline: 'none',
30
+ ':hover': {
31
+ backgroundColor: 'color.background.neutral.hovered'
32
+ },
33
+ ':active': {
34
+ backgroundColor: 'color.background.neutral.pressed'
35
+ },
36
+ ':focus': {
37
+ outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
38
+ }
39
+ });
40
+ export var RightRailIcon = function RightRailIcon(_ref) {
41
+ var onClick = _ref.onClick;
42
+ var _useIntl = useIntl(),
43
+ formatMessage = _useIntl.formatMessage;
44
+ return /*#__PURE__*/React.createElement(Box, {
45
+ xcss: [wrapperStyles]
46
+ }, /*#__PURE__*/React.createElement(Tooltip, {
47
+ content: /*#__PURE__*/React.createElement(ToolTipContent
48
+ // Re-using insertRightRailTitle for tooltip, both messages are the same
49
+ , {
50
+ description: formatMessage(toolbarInsertBlockMessages.insertRightRailTitle),
51
+ shortcutOverride: "/"
52
+ })
53
+ }, /*#__PURE__*/React.createElement(Pressable, {
54
+ type: "button",
55
+ "aria-label": formatMessage(toolbarInsertBlockMessages.insertMenu),
56
+ xcss: [buttonStyles],
57
+ onClick: onClick
58
+ }, /*#__PURE__*/React.createElement(EditorAddIcon, {
59
+ label: formatMessage(toolbarInsertBlockMessages.insertMenu),
60
+ size: "medium"
61
+ }))));
62
+ };
@@ -1,5 +1,5 @@
1
1
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
- import React from 'react';
2
+ import React, { useEffect } from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
4
  import { IconButton } from '@atlaskit/button/new';
5
5
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
@@ -157,6 +157,38 @@ export var InsertMenuRail = function InsertMenuRail(_ref) {
157
157
  // leaving this blank for now
158
158
  }
159
159
  };
160
+ useEffect(function () {
161
+ if (!api) {
162
+ return;
163
+ }
164
+ api.core.actions.execute(function (_ref3) {
165
+ var _api$analytics2;
166
+ var tr = _ref3.tr;
167
+ (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
168
+ action: ACTION.OPENED,
169
+ // @ts-expect-error
170
+ actionSubject: INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
171
+ eventType: EVENT_TYPE.UI
172
+ })(tr);
173
+ return tr;
174
+ });
175
+ return function () {
176
+ if (!api) {
177
+ return;
178
+ }
179
+ api.core.actions.execute(function (_ref4) {
180
+ var _api$analytics3;
181
+ var tr = _ref4.tr;
182
+ (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.attachAnalyticsEvent({
183
+ action: ACTION.CLOSED,
184
+ // @ts-expect-error
185
+ actionSubject: INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
186
+ eventType: EVENT_TYPE.UI
187
+ })(tr);
188
+ return tr;
189
+ });
190
+ };
191
+ }, [api]);
160
192
  return /*#__PURE__*/React.createElement(Box, {
161
193
  xcss: panelWrapper
162
194
  }, /*#__PURE__*/React.createElement(Box, {
@@ -173,9 +205,9 @@ export var InsertMenuRail = function InsertMenuRail(_ref) {
173
205
  if (!api) {
174
206
  return;
175
207
  }
176
- api.core.actions.execute(function (_ref3) {
208
+ api.core.actions.execute(function (_ref5) {
177
209
  var _api$contextPanel;
178
- var tr = _ref3.tr;
210
+ var tr = _ref5.tr;
179
211
  toggleInsertMenuRightRail(tr);
180
212
  (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 || _api$contextPanel.actions.applyChange(tr);
181
213
  return tr;
@@ -44,7 +44,9 @@ export var useInsertMenuRailItems = function useInsertMenuRailItems(editorView,
44
44
  availableWrapperBlockTypes: blockTypeState && blockTypeState.availableWrapperBlockTypes,
45
45
  insertMenuItems: options.insertMenuItems,
46
46
  schema: editorView.state.schema,
47
- numberOfButtons: 10,
47
+ // numberOfButtons controls what items are returned and eventually display in the insert menu - but it relies on the main toolbar width which
48
+ // is not easily available here. I've used 7 as it's the value used for most widths see toolbarSizeToButtons
49
+ numberOfButtons: 7,
48
50
  formatMessage: formatMessage,
49
51
  isNewMenuEnabled: true
50
52
  });
@@ -34,6 +34,7 @@ import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
34
34
  import * as colors from '@atlaskit/theme/colors';
35
35
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
36
36
  import { toggleInsertMenuRightRail } from '../../pm-plugins/commands';
37
+ import { RightRailIcon } from '../ElementRail/MainToolBarIcon';
37
38
  import { BlockInsertMenu } from './block-insert-menu';
38
39
  import { createItems } from './create-items';
39
40
  import { messages } from './messages';
@@ -210,12 +211,23 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
210
211
  if (editorExperiment('insert-menu-in-right-rail', true, {
211
212
  exposure: true
212
213
  })) {
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;
214
+ var pluginInjectionApi = _this.props.pluginInjectionApi;
215
+ if (!pluginInjectionApi) {
216
+ return;
217
+ }
218
+ pluginInjectionApi.core.actions.execute(function (_ref3) {
219
+ var _pluginInjectionApi$c, _pluginInjectionApi$a;
216
220
  var tr = _ref3.tr;
217
221
  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);
222
+ (_pluginInjectionApi$c = pluginInjectionApi.contextPanel) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.applyChange(tr);
223
+ (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 || _pluginInjectionApi$a.actions.attachAnalyticsEvent({
224
+ action: ACTION.CLICKED,
225
+ // @ts-expect-error
226
+ actionSubject: ACTION_SUBJECT.TOOLBAR_BUTTON,
227
+ // @ts-expect-error
228
+ actionSubjectId: INPUT_METHOD.INSERT_MENU_RIGHT_RAIL,
229
+ eventType: EVENT_TYPE.UI
230
+ })(tr);
219
231
  return tr;
220
232
  });
221
233
  return;
@@ -231,12 +243,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
231
243
  if (editorExperiment('insert-menu-in-right-rail', true, {
232
244
  exposure: true
233
245
  })) {
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;
246
+ var _this$props$pluginInj;
247
+ (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || _this$props$pluginInj.core.actions.execute(function (_ref4) {
248
+ var _this$props$pluginInj2;
237
249
  var tr = _ref4.tr;
238
250
  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);
251
+ (_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);
240
252
  return tr;
241
253
  });
242
254
  return;
@@ -256,9 +268,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
256
268
  }
257
269
  });
258
270
  _defineProperty(_assertThisInitialized(_this), "toggleLinkPanel", function (inputMethod) {
259
- var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$h;
271
+ var _pluginInjectionApi$c2, _pluginInjectionApi$c3, _pluginInjectionApi$h;
260
272
  var pluginInjectionApi = _this.props.pluginInjectionApi;
261
- 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;
273
+ 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;
262
274
  });
263
275
  _defineProperty(_assertThisInitialized(_this), "insertMention", function (inputMethod) {
264
276
  var _pluginInjectionApi$m, _pluginInjectionApi$m2;
@@ -301,15 +313,15 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
301
313
 
302
314
  // workaround to solve race condition where cursor is not placed correctly inside table
303
315
  queueMicrotask(function () {
304
- var _pluginInjectionApi$c3, _pluginInjectionApi$t4;
305
- 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));
316
+ var _pluginInjectionApi$c4, _pluginInjectionApi$t4;
317
+ 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));
306
318
  });
307
319
  };
308
320
  });
309
321
  _defineProperty(_assertThisInitialized(_this), "createDate", function (inputMethod) {
310
- var _pluginInjectionApi$c4, _pluginInjectionApi$d;
322
+ var _pluginInjectionApi$c5, _pluginInjectionApi$d;
311
323
  var pluginInjectionApi = _this.props.pluginInjectionApi;
312
- 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({
324
+ 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({
313
325
  inputMethod: inputMethod
314
326
  }));
315
327
  return true;
@@ -331,9 +343,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
331
343
  return true;
332
344
  });
333
345
  _defineProperty(_assertThisInitialized(_this), "createStatus", function (inputMethod) {
334
- var _pluginInjectionApi$c5, _pluginInjectionApi$s;
346
+ var _pluginInjectionApi$c6, _pluginInjectionApi$s;
335
347
  var pluginInjectionApi = _this.props.pluginInjectionApi;
336
- 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)));
348
+ 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)));
337
349
  });
338
350
  _defineProperty(_assertThisInitialized(_this), "openMediaPicker", function (inputMethod) {
339
351
  var _this$props5 = _this.props,
@@ -397,17 +409,17 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
397
409
  };
398
410
  });
399
411
  _defineProperty(_assertThisInitialized(_this), "handleSelectedEmoji", function (emojiId) {
400
- var _pluginInjectionApi$c6, _pluginInjectionApi$e3;
412
+ var _pluginInjectionApi$c7, _pluginInjectionApi$e3;
401
413
  var pluginInjectionApi = _this.props.pluginInjectionApi;
402
414
  _this.props.editorView.focus();
403
- 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));
415
+ 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));
404
416
  _this.toggleEmojiPicker();
405
417
  return true;
406
418
  });
407
419
  _defineProperty(_assertThisInitialized(_this), "openElementBrowser", function () {
408
- var _pluginInjectionApi$c7, _pluginInjectionApi$q;
420
+ var _pluginInjectionApi$c8, _pluginInjectionApi$q;
409
421
  var pluginInjectionApi = _this.props.pluginInjectionApi;
410
- 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);
422
+ 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);
411
423
  });
412
424
  _defineProperty(_assertThisInitialized(_this), "onItemActivated", function (_ref5) {
413
425
  var item = _ref5.item,
@@ -604,8 +616,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
604
616
  // Popup will be unmounted to ensure that the new table has a selection with a blinking cursor.
605
617
  // So we can start typing right away.
606
618
  var onUnmount = function onUnmount() {
607
- var _pluginInjectionApi$c8;
608
- 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();
619
+ var _pluginInjectionApi$c9;
620
+ 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();
609
621
  };
610
622
  return jsx(TableSelectorPopup, {
611
623
  target: ref,
@@ -638,7 +650,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
638
650
  _tableSelectorButton6,
639
651
  _this$props$isDisable,
640
652
  _this$props$replacePl,
641
- _this$props$pluginInj5;
653
+ _this$props$pluginInj3;
642
654
  var _this$state2 = this.state,
643
655
  buttons = _this$state2.buttons,
644
656
  dropdownItems = _this$state2.dropdownItems,
@@ -646,7 +658,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
646
658
  isTableSelectorOpen = _this$state2.isTableSelectorOpen;
647
659
  var _this$props13 = this.props,
648
660
  isDisabled = _this$props13.isDisabled,
649
- isReducedSpacing = _this$props13.isReducedSpacing;
661
+ isReducedSpacing = _this$props13.isReducedSpacing,
662
+ editorAppearance = _this$props13.editorAppearance;
650
663
  var isTableButtonVisible = buttons.some(function (_ref8) {
651
664
  var value = _ref8.value;
652
665
  return value.name === 'table';
@@ -744,7 +757,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
744
757
  onKeyDown: this.handleTableSelectorOpenByKeyboard
745
758
  })), jsx("span", {
746
759
  css: wrapperStyle
747
- }, this.renderPopup(), this.renderTableSelectorPopup(), jsx(BlockInsertMenu, {
760
+ }, this.renderPopup(), this.renderTableSelectorPopup(), editorExperiment('insert-menu-in-right-rail', true) && ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '') ? jsx(RightRailIcon, {
761
+ onClick: this.handleClick
762
+ }) : jsx(BlockInsertMenu, {
748
763
  popupsMountPoint: this.props.popupsMountPoint,
749
764
  popupsBoundariesElement: this.props.popupsBoundariesElement,
750
765
  popupsScrollableElement: this.props.popupsScrollableElement,
@@ -766,7 +781,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
766
781
  replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
767
782
  showElementBrowserLink: this.props.showElementBrowserLink || false,
768
783
  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 */
784
+ })), !((_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 */
770
785
  // 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
786
  jsx("span", {
772
787
  css: separatorStyles
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ onClick: () => void;
4
+ };
5
+ export declare const RightRailIcon: ({ onClick }: Props) => JSX.Element;
6
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
2
  import type { MacroProvider } from '@atlaskit/editor-common/provider-factory';
3
- import type { Command, EditorActionsOptions as EditorActions, ExtractInjectionAPI, ImageUploadPluginReferenceEvent } from '@atlaskit/editor-common/types';
3
+ import type { Command, EditorActionsOptions as EditorActions, EditorAppearance, ExtractInjectionAPI, ImageUploadPluginReferenceEvent } from '@atlaskit/editor-common/types';
4
4
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
5
5
  import type { BlockType } from '@atlaskit/editor-plugin-block-type';
6
6
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
@@ -49,6 +49,7 @@ export interface Props {
49
49
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
50
50
  pluginInjectionApi?: ExtractInjectionAPI<InsertBlockPlugin>;
51
51
  mentionsDisabled?: boolean;
52
+ editorAppearance?: EditorAppearance;
52
53
  }
53
54
  export interface State {
54
55
  isPlusMenuOpen: boolean;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ onClick: () => void;
4
+ };
5
+ export declare const RightRailIcon: ({ onClick }: Props) => JSX.Element;
6
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
2
  import type { MacroProvider } from '@atlaskit/editor-common/provider-factory';
3
- import type { Command, EditorActionsOptions as EditorActions, ExtractInjectionAPI, ImageUploadPluginReferenceEvent } from '@atlaskit/editor-common/types';
3
+ import type { Command, EditorActionsOptions as EditorActions, EditorAppearance, ExtractInjectionAPI, ImageUploadPluginReferenceEvent } from '@atlaskit/editor-common/types';
4
4
  import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
5
5
  import type { BlockType } from '@atlaskit/editor-plugin-block-type';
6
6
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
@@ -49,6 +49,7 @@ export interface Props {
49
49
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
50
50
  pluginInjectionApi?: ExtractInjectionAPI<InsertBlockPlugin>;
51
51
  mentionsDisabled?: boolean;
52
+ editorAppearance?: EditorAppearance;
52
53
  }
53
54
  export interface State {
54
55
  isPlusMenuOpen: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "1.14.3",
3
+ "version": "1.14.4",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/button": "^20.1.0",
35
- "@atlaskit/editor-common": "^89.0.0",
35
+ "@atlaskit/editor-common": "^89.1.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
37
37
  "@atlaskit/editor-plugin-block-type": "^3.14.0",
38
38
  "@atlaskit/editor-plugin-code-block": "^3.3.0",
@@ -53,18 +53,19 @@
53
53
  "@atlaskit/editor-plugin-rule": "^1.8.0",
54
54
  "@atlaskit/editor-plugin-status": "^2.4.0",
55
55
  "@atlaskit/editor-plugin-table": "^7.25.0",
56
- "@atlaskit/editor-plugin-tasks-and-decisions": "^2.4.0",
56
+ "@atlaskit/editor-plugin-tasks-and-decisions": "^2.5.0",
57
57
  "@atlaskit/editor-plugin-type-ahead": "^1.8.0",
58
58
  "@atlaskit/editor-prosemirror": "6.0.0",
59
59
  "@atlaskit/editor-shared-styles": "^2.13.0",
60
60
  "@atlaskit/emoji": "^67.7.0",
61
61
  "@atlaskit/heading": "2.4.5",
62
- "@atlaskit/icon": "^22.16.0",
62
+ "@atlaskit/icon": "^22.18.0",
63
63
  "@atlaskit/platform-feature-flags": "^0.3.0",
64
64
  "@atlaskit/primitives": "^12.1.0",
65
65
  "@atlaskit/theme": "^13.0.0",
66
66
  "@atlaskit/tmp-editor-statsig": "^2.1.0",
67
67
  "@atlaskit/tokens": "^1.59.0",
68
+ "@atlaskit/tooltip": "18.7.2",
68
69
  "@babel/runtime": "^7.0.0",
69
70
  "@emotion/react": "^11.7.1",
70
71
  "bind-event-listener": "^3.0.0",