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
  */
@@ -3626,6 +3626,9 @@
3626
3626
  get onDidPopoutGroupPositionChange() {
3627
3627
  return this.component.onDidPopoutGroupPositionChange;
3628
3628
  }
3629
+ get onDidOpenPopoutWindowFail() {
3630
+ return this.component.onDidOpenPopoutWindowFail;
3631
+ }
3629
3632
  /**
3630
3633
  * All panel objects.
3631
3634
  */
@@ -8205,6 +8208,8 @@
8205
8208
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8206
8209
  this._onDidPopoutGroupPositionChange = new Emitter();
8207
8210
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8211
+ this._onDidOpenPopoutWindowFail = new Emitter();
8212
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8208
8213
  this._onDidLayoutFromJSON = new Emitter();
8209
8214
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8210
8215
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8269,7 +8274,7 @@
8269
8274
  if (options.debug) {
8270
8275
  this.addDisposables(new StrictEventsSequencing(this));
8271
8276
  }
8272
- 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(() => {
8277
+ 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(() => {
8273
8278
  this.updateWatermark();
8274
8279
  }), this.onDidAdd((event) => {
8275
8280
  if (!this._moving) {
@@ -8415,13 +8420,6 @@
8415
8420
  if (_window.isDisposed) {
8416
8421
  return false;
8417
8422
  }
8418
- if (popoutContainer === null) {
8419
- popoutWindowDisposable.dispose();
8420
- return false;
8421
- }
8422
- const gready = document.createElement('div');
8423
- gready.className = 'dv-overlay-render-container';
8424
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8425
8423
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8426
8424
  ? options.referenceGroup
8427
8425
  : itemToPopout instanceof DockviewPanel
@@ -8429,7 +8427,7 @@
8429
8427
  : itemToPopout;
8430
8428
  const referenceLocation = itemToPopout.api.location.type;
8431
8429
  /**
8432
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8430
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8433
8431
  * of this case is when being called from the `fromJSON(...)` method
8434
8432
  */
8435
8433
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8442,8 +8440,28 @@
8442
8440
  }
8443
8441
  else {
8444
8442
  group = this.createGroup({ id: groupId });
8445
- this._onDidAddGroup.fire(group);
8443
+ if (popoutContainer) {
8444
+ this._onDidAddGroup.fire(group);
8445
+ }
8446
8446
  }
8447
+ if (popoutContainer === null) {
8448
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8449
+ popoutWindowDisposable.dispose();
8450
+ this._onDidOpenPopoutWindowFail.fire();
8451
+ // if the popout window was blocked, we need to move the group back to the reference group
8452
+ // and set it to visible
8453
+ this.movingLock(() => moveGroupWithoutDestroying({
8454
+ from: group,
8455
+ to: referenceGroup,
8456
+ }));
8457
+ if (!referenceGroup.api.isVisible) {
8458
+ referenceGroup.api.setVisible(true);
8459
+ }
8460
+ return false;
8461
+ }
8462
+ const gready = document.createElement('div');
8463
+ gready.className = 'dv-overlay-render-container';
8464
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8447
8465
  group.model.renderContainer = overlayRenderContainer;
8448
8466
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8449
8467
  let floatingBox;
@@ -8600,7 +8618,7 @@
8600
8618
  return true;
8601
8619
  })
8602
8620
  .catch((err) => {
8603
- console.error('dockview: failed to create popout window', err);
8621
+ console.error('dockview: failed to create popout.', err);
8604
8622
  return false;
8605
8623
  });
8606
8624
  }