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