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
  */
@@ -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
  */
@@ -8258,6 +8261,8 @@
8258
8261
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8259
8262
  this._onDidPopoutGroupPositionChange = new Emitter();
8260
8263
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8264
+ this._onDidOpenPopoutWindowFail = new Emitter();
8265
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8261
8266
  this._onDidLayoutFromJSON = new Emitter();
8262
8267
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8263
8268
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8322,7 +8327,7 @@
8322
8327
  if (options.debug) {
8323
8328
  this.addDisposables(new StrictEventsSequencing(this));
8324
8329
  }
8325
- 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(() => {
8330
+ 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(() => {
8326
8331
  this.updateWatermark();
8327
8332
  }), this.onDidAdd((event) => {
8328
8333
  if (!this._moving) {
@@ -8468,13 +8473,6 @@
8468
8473
  if (_window.isDisposed) {
8469
8474
  return false;
8470
8475
  }
8471
- if (popoutContainer === null) {
8472
- popoutWindowDisposable.dispose();
8473
- return false;
8474
- }
8475
- const gready = document.createElement('div');
8476
- gready.className = 'dv-overlay-render-container';
8477
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8478
8476
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8479
8477
  ? options.referenceGroup
8480
8478
  : itemToPopout instanceof DockviewPanel
@@ -8482,7 +8480,7 @@
8482
8480
  : itemToPopout;
8483
8481
  const referenceLocation = itemToPopout.api.location.type;
8484
8482
  /**
8485
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8483
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8486
8484
  * of this case is when being called from the `fromJSON(...)` method
8487
8485
  */
8488
8486
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8495,8 +8493,28 @@
8495
8493
  }
8496
8494
  else {
8497
8495
  group = this.createGroup({ id: groupId });
8498
- this._onDidAddGroup.fire(group);
8496
+ if (popoutContainer) {
8497
+ this._onDidAddGroup.fire(group);
8498
+ }
8499
8499
  }
8500
+ if (popoutContainer === null) {
8501
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8502
+ popoutWindowDisposable.dispose();
8503
+ this._onDidOpenPopoutWindowFail.fire();
8504
+ // if the popout window was blocked, we need to move the group back to the reference group
8505
+ // and set it to visible
8506
+ this.movingLock(() => moveGroupWithoutDestroying({
8507
+ from: group,
8508
+ to: referenceGroup,
8509
+ }));
8510
+ if (!referenceGroup.api.isVisible) {
8511
+ referenceGroup.api.setVisible(true);
8512
+ }
8513
+ return false;
8514
+ }
8515
+ const gready = document.createElement('div');
8516
+ gready.className = 'dv-overlay-render-container';
8517
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8500
8518
  group.model.renderContainer = overlayRenderContainer;
8501
8519
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8502
8520
  let floatingBox;
@@ -8653,7 +8671,7 @@
8653
8671
  return true;
8654
8672
  })
8655
8673
  .catch((err) => {
8656
- console.error('dockview: failed to create popout window', err);
8674
+ console.error('dockview: failed to create popout.', err);
8657
8675
  return false;
8658
8676
  });
8659
8677
  }