dockview-core 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-core
3
- * @version 4.3.1
3
+ * @version 4.4.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -3652,6 +3652,9 @@ class DockviewApi {
3652
3652
  get onDidPopoutGroupPositionChange() {
3653
3653
  return this.component.onDidPopoutGroupPositionChange;
3654
3654
  }
3655
+ get onDidOpenPopoutWindowFail() {
3656
+ return this.component.onDidOpenPopoutWindowFail;
3657
+ }
3655
3658
  /**
3656
3659
  * All panel objects.
3657
3660
  */
@@ -8254,6 +8257,8 @@ class DockviewComponent extends BaseGrid {
8254
8257
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8255
8258
  this._onDidPopoutGroupPositionChange = new Emitter();
8256
8259
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8260
+ this._onDidOpenPopoutWindowFail = new Emitter();
8261
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8257
8262
  this._onDidLayoutFromJSON = new Emitter();
8258
8263
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8259
8264
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8318,7 +8323,7 @@ class DockviewComponent extends BaseGrid {
8318
8323
  if (options.debug) {
8319
8324
  this.addDisposables(new StrictEventsSequencing(this));
8320
8325
  }
8321
- 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(() => {
8326
+ 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(() => {
8322
8327
  this.updateWatermark();
8323
8328
  }), this.onDidAdd((event) => {
8324
8329
  if (!this._moving) {
@@ -8464,13 +8469,6 @@ class DockviewComponent extends BaseGrid {
8464
8469
  if (_window.isDisposed) {
8465
8470
  return false;
8466
8471
  }
8467
- if (popoutContainer === null) {
8468
- popoutWindowDisposable.dispose();
8469
- return false;
8470
- }
8471
- const gready = document.createElement('div');
8472
- gready.className = 'dv-overlay-render-container';
8473
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8474
8472
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8475
8473
  ? options.referenceGroup
8476
8474
  : itemToPopout instanceof DockviewPanel
@@ -8478,7 +8476,7 @@ class DockviewComponent extends BaseGrid {
8478
8476
  : itemToPopout;
8479
8477
  const referenceLocation = itemToPopout.api.location.type;
8480
8478
  /**
8481
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8479
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8482
8480
  * of this case is when being called from the `fromJSON(...)` method
8483
8481
  */
8484
8482
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8491,8 +8489,28 @@ class DockviewComponent extends BaseGrid {
8491
8489
  }
8492
8490
  else {
8493
8491
  group = this.createGroup({ id: groupId });
8494
- this._onDidAddGroup.fire(group);
8492
+ if (popoutContainer) {
8493
+ this._onDidAddGroup.fire(group);
8494
+ }
8495
8495
  }
8496
+ if (popoutContainer === null) {
8497
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8498
+ popoutWindowDisposable.dispose();
8499
+ this._onDidOpenPopoutWindowFail.fire();
8500
+ // if the popout window was blocked, we need to move the group back to the reference group
8501
+ // and set it to visible
8502
+ this.movingLock(() => moveGroupWithoutDestroying({
8503
+ from: group,
8504
+ to: referenceGroup,
8505
+ }));
8506
+ if (!referenceGroup.api.isVisible) {
8507
+ referenceGroup.api.setVisible(true);
8508
+ }
8509
+ return false;
8510
+ }
8511
+ const gready = document.createElement('div');
8512
+ gready.className = 'dv-overlay-render-container';
8513
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8496
8514
  group.model.renderContainer = overlayRenderContainer;
8497
8515
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8498
8516
  let floatingBox;
@@ -8649,7 +8667,7 @@ class DockviewComponent extends BaseGrid {
8649
8667
  return true;
8650
8668
  })
8651
8669
  .catch((err) => {
8652
- console.error('dockview: failed to create popout window', err);
8670
+ console.error('dockview: failed to create popout.', err);
8653
8671
  return false;
8654
8672
  });
8655
8673
  }