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