dockview-react 4.3.1 → 4.4.0

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 4.3.1
3
+ * @version 4.4.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -3655,6 +3655,9 @@ class DockviewApi {
3655
3655
  get onDidPopoutGroupPositionChange() {
3656
3656
  return this.component.onDidPopoutGroupPositionChange;
3657
3657
  }
3658
+ get onDidOpenPopoutWindowFail() {
3659
+ return this.component.onDidOpenPopoutWindowFail;
3660
+ }
3658
3661
  /**
3659
3662
  * All panel objects.
3660
3663
  */
@@ -8234,6 +8237,8 @@ class DockviewComponent extends BaseGrid {
8234
8237
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8235
8238
  this._onDidPopoutGroupPositionChange = new Emitter();
8236
8239
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8240
+ this._onDidOpenPopoutWindowFail = new Emitter();
8241
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8237
8242
  this._onDidLayoutFromJSON = new Emitter();
8238
8243
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8239
8244
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8298,7 +8303,7 @@ class DockviewComponent extends BaseGrid {
8298
8303
  if (options.debug) {
8299
8304
  this.addDisposables(new StrictEventsSequencing(this));
8300
8305
  }
8301
- this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8306
+ this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8302
8307
  this.updateWatermark();
8303
8308
  }), this.onDidAdd((event) => {
8304
8309
  if (!this._moving) {
@@ -8444,13 +8449,6 @@ class DockviewComponent extends BaseGrid {
8444
8449
  if (_window.isDisposed) {
8445
8450
  return false;
8446
8451
  }
8447
- if (popoutContainer === null) {
8448
- popoutWindowDisposable.dispose();
8449
- return false;
8450
- }
8451
- const gready = document.createElement('div');
8452
- gready.className = 'dv-overlay-render-container';
8453
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8454
8452
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8455
8453
  ? options.referenceGroup
8456
8454
  : itemToPopout instanceof DockviewPanel
@@ -8458,7 +8456,7 @@ class DockviewComponent extends BaseGrid {
8458
8456
  : itemToPopout;
8459
8457
  const referenceLocation = itemToPopout.api.location.type;
8460
8458
  /**
8461
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8459
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8462
8460
  * of this case is when being called from the `fromJSON(...)` method
8463
8461
  */
8464
8462
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8471,8 +8469,28 @@ class DockviewComponent extends BaseGrid {
8471
8469
  }
8472
8470
  else {
8473
8471
  group = this.createGroup({ id: groupId });
8474
- this._onDidAddGroup.fire(group);
8472
+ if (popoutContainer) {
8473
+ this._onDidAddGroup.fire(group);
8474
+ }
8475
8475
  }
8476
+ if (popoutContainer === null) {
8477
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8478
+ popoutWindowDisposable.dispose();
8479
+ this._onDidOpenPopoutWindowFail.fire();
8480
+ // if the popout window was blocked, we need to move the group back to the reference group
8481
+ // and set it to visible
8482
+ this.movingLock(() => moveGroupWithoutDestroying({
8483
+ from: group,
8484
+ to: referenceGroup,
8485
+ }));
8486
+ if (!referenceGroup.api.isVisible) {
8487
+ referenceGroup.api.setVisible(true);
8488
+ }
8489
+ return false;
8490
+ }
8491
+ const gready = document.createElement('div');
8492
+ gready.className = 'dv-overlay-render-container';
8493
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8476
8494
  group.model.renderContainer = overlayRenderContainer;
8477
8495
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8478
8496
  let floatingBox;
@@ -8629,7 +8647,7 @@ class DockviewComponent extends BaseGrid {
8629
8647
  return true;
8630
8648
  })
8631
8649
  .catch((err) => {
8632
- console.error('dockview: failed to create popout window', err);
8650
+ console.error('dockview: failed to create popout.', err);
8633
8651
  return false;
8634
8652
  });
8635
8653
  }