@atlaskit/editor-plugin-insert-block 2.2.6 → 2.2.7

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
+ ## 2.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#147461](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147461)
8
+ [`acef010cdb706`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/acef010cdb706) -
9
+ [ux] [ED-25164] Pass mounting point to media insert plugin for correct toolbar popup positioning
10
+
3
11
  ## 2.2.6
4
12
 
5
13
  ### Patch Changes
@@ -336,13 +336,13 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
336
336
  }
337
337
  };
338
338
  var emojiProvider = getEmojiProvider();
339
- var onShowMediaPicker = function onShowMediaPicker(targetRef) {
339
+ var onShowMediaPicker = function onShowMediaPicker(mountInfo) {
340
340
  if (!mediaState) {
341
341
  return;
342
342
  }
343
343
  if ((0, _experiments.editorExperiment)('add-media-from-url', true)) {
344
344
  var _pluginInjectionApi$c, _pluginInjectionApi$m;
345
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(targetRef));
345
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
346
346
  } else {
347
347
  mediaState.showMediaPicker();
348
348
  }
@@ -75,10 +75,10 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
75
75
  function ToolbarInsertBlock() {
76
76
  var _this;
77
77
  (0, _classCallCheck2.default)(this, ToolbarInsertBlock);
78
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
79
- args[_key] = arguments[_key];
78
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
79
+ _args[_key] = arguments[_key];
80
80
  }
81
- _this = _super.call.apply(_super, [this].concat(args));
81
+ _this = _super.call.apply(_super, [this].concat(_args));
82
82
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tableButtonRef", /*#__PURE__*/_react.default.createRef());
83
83
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tableSelectorButtonRef", /*#__PURE__*/_react.default.createRef());
84
84
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unregisterToggleDropdownMenuOptions", null);
@@ -372,7 +372,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
372
372
  onShowMediaPicker = _this$props5.onShowMediaPicker,
373
373
  dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent;
374
374
  if (onShowMediaPicker) {
375
- onShowMediaPicker(_this.mediaButtonRef);
375
+ var _this$props$popupsMou;
376
+ var args = _this.mediaButtonRef ? {
377
+ ref: _this.mediaButtonRef,
378
+ mountPoint: (_this$props$popupsMou = _this.props.popupsMountPoint) !== null && _this$props$popupsMou !== void 0 ? _this$props$popupsMou : _this.mediaButtonRef
379
+ } : undefined;
380
+ onShowMediaPicker(args);
376
381
  if (dispatchAnalyticsEvent) {
377
382
  dispatchAnalyticsEvent({
378
383
  action: _analytics.ACTION.OPENED,
@@ -331,13 +331,13 @@ function ToolbarInsertBlockWithInjectionApi({
331
331
  }
332
332
  };
333
333
  const emojiProvider = getEmojiProvider();
334
- const onShowMediaPicker = targetRef => {
334
+ const onShowMediaPicker = mountInfo => {
335
335
  if (!mediaState) {
336
336
  return;
337
337
  }
338
338
  if (editorExperiment('add-media-from-url', true)) {
339
339
  var _pluginInjectionApi$c, _pluginInjectionApi$m;
340
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(targetRef));
340
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
341
341
  } else {
342
342
  mediaState.showMediaPicker();
343
343
  }
@@ -73,8 +73,8 @@ css`
73
73
  `;
74
74
  // eslint-disable-next-line @repo/internal/react/no-class-components
75
75
  export class ToolbarInsertBlock extends React.PureComponent {
76
- constructor(...args) {
77
- super(...args);
76
+ constructor(..._args) {
77
+ super(..._args);
78
78
  _defineProperty(this, "tableButtonRef", /*#__PURE__*/React.createRef());
79
79
  _defineProperty(this, "tableSelectorButtonRef", /*#__PURE__*/React.createRef());
80
80
  _defineProperty(this, "unregisterToggleDropdownMenuOptions", null);
@@ -386,7 +386,12 @@ export class ToolbarInsertBlock extends React.PureComponent {
386
386
  dispatchAnalyticsEvent
387
387
  } = this.props;
388
388
  if (onShowMediaPicker) {
389
- onShowMediaPicker(this.mediaButtonRef);
389
+ var _this$props$popupsMou;
390
+ const args = this.mediaButtonRef ? {
391
+ ref: this.mediaButtonRef,
392
+ mountPoint: (_this$props$popupsMou = this.props.popupsMountPoint) !== null && _this$props$popupsMou !== void 0 ? _this$props$popupsMou : this.mediaButtonRef
393
+ } : undefined;
394
+ onShowMediaPicker(args);
390
395
  if (dispatchAnalyticsEvent) {
391
396
  dispatchAnalyticsEvent({
392
397
  action: ACTION.OPENED,
@@ -326,13 +326,13 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
326
326
  }
327
327
  };
328
328
  var emojiProvider = getEmojiProvider();
329
- var onShowMediaPicker = function onShowMediaPicker(targetRef) {
329
+ var onShowMediaPicker = function onShowMediaPicker(mountInfo) {
330
330
  if (!mediaState) {
331
331
  return;
332
332
  }
333
333
  if (editorExperiment('add-media-from-url', true)) {
334
334
  var _pluginInjectionApi$c, _pluginInjectionApi$m;
335
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(targetRef));
335
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
336
336
  } else {
337
337
  mediaState.showMediaPicker();
338
338
  }
@@ -66,10 +66,10 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
66
66
  function ToolbarInsertBlock() {
67
67
  var _this;
68
68
  _classCallCheck(this, ToolbarInsertBlock);
69
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
70
- args[_key] = arguments[_key];
69
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
70
+ _args[_key] = arguments[_key];
71
71
  }
72
- _this = _super.call.apply(_super, [this].concat(args));
72
+ _this = _super.call.apply(_super, [this].concat(_args));
73
73
  _defineProperty(_assertThisInitialized(_this), "tableButtonRef", /*#__PURE__*/React.createRef());
74
74
  _defineProperty(_assertThisInitialized(_this), "tableSelectorButtonRef", /*#__PURE__*/React.createRef());
75
75
  _defineProperty(_assertThisInitialized(_this), "unregisterToggleDropdownMenuOptions", null);
@@ -363,7 +363,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
363
363
  onShowMediaPicker = _this$props5.onShowMediaPicker,
364
364
  dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent;
365
365
  if (onShowMediaPicker) {
366
- onShowMediaPicker(_this.mediaButtonRef);
366
+ var _this$props$popupsMou;
367
+ var args = _this.mediaButtonRef ? {
368
+ ref: _this.mediaButtonRef,
369
+ mountPoint: (_this$props$popupsMou = _this.props.popupsMountPoint) !== null && _this$props$popupsMou !== void 0 ? _this$props$popupsMou : _this.mediaButtonRef
370
+ } : undefined;
371
+ onShowMediaPicker(args);
367
372
  if (dispatchAnalyticsEvent) {
368
373
  dispatchAnalyticsEvent({
369
374
  action: ACTION.OPENED,
@@ -42,7 +42,10 @@ export interface Props {
42
42
  insertMenuItems?: MenuItem[];
43
43
  showElementBrowserLink?: boolean;
44
44
  showSeparator?: boolean;
45
- onShowMediaPicker?: (ref?: HTMLElement) => void;
45
+ onShowMediaPicker?: (mountInfo?: {
46
+ ref: HTMLElement;
47
+ mountPoint: HTMLElement;
48
+ }) => void;
46
49
  onInsertBlockType?: (name: string) => Command;
47
50
  onInsertMacroFromMacroBrowser?: (macroProvider: MacroProvider, node?: PMNode, isEditing?: boolean) => (view: EditorView) => void;
48
51
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
@@ -42,7 +42,10 @@ export interface Props {
42
42
  insertMenuItems?: MenuItem[];
43
43
  showElementBrowserLink?: boolean;
44
44
  showSeparator?: boolean;
45
- onShowMediaPicker?: (ref?: HTMLElement) => void;
45
+ onShowMediaPicker?: (mountInfo?: {
46
+ ref: HTMLElement;
47
+ mountPoint: HTMLElement;
48
+ }) => void;
46
49
  onInsertBlockType?: (name: string) => Command;
47
50
  onInsertMacroFromMacroBrowser?: (macroProvider: MacroProvider, node?: PMNode, isEditing?: boolean) => (view: EditorView) => void;
48
51
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",