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