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
  */
@@ -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
  */
@@ -8228,6 +8231,8 @@
8228
8231
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8229
8232
  this._onDidPopoutGroupPositionChange = new Emitter();
8230
8233
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8234
+ this._onDidOpenPopoutWindowFail = new Emitter();
8235
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8231
8236
  this._onDidLayoutFromJSON = new Emitter();
8232
8237
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8233
8238
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8292,7 +8297,7 @@
8292
8297
  if (options.debug) {
8293
8298
  this.addDisposables(new StrictEventsSequencing(this));
8294
8299
  }
8295
- 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(() => {
8300
+ 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(() => {
8296
8301
  this.updateWatermark();
8297
8302
  }), this.onDidAdd((event) => {
8298
8303
  if (!this._moving) {
@@ -8438,13 +8443,6 @@
8438
8443
  if (_window.isDisposed) {
8439
8444
  return false;
8440
8445
  }
8441
- if (popoutContainer === null) {
8442
- popoutWindowDisposable.dispose();
8443
- return false;
8444
- }
8445
- const gready = document.createElement('div');
8446
- gready.className = 'dv-overlay-render-container';
8447
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8448
8446
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8449
8447
  ? options.referenceGroup
8450
8448
  : itemToPopout instanceof DockviewPanel
@@ -8452,7 +8450,7 @@
8452
8450
  : itemToPopout;
8453
8451
  const referenceLocation = itemToPopout.api.location.type;
8454
8452
  /**
8455
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8453
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8456
8454
  * of this case is when being called from the `fromJSON(...)` method
8457
8455
  */
8458
8456
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8465,8 +8463,28 @@
8465
8463
  }
8466
8464
  else {
8467
8465
  group = this.createGroup({ id: groupId });
8468
- this._onDidAddGroup.fire(group);
8466
+ if (popoutContainer) {
8467
+ this._onDidAddGroup.fire(group);
8468
+ }
8469
8469
  }
8470
+ if (popoutContainer === null) {
8471
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8472
+ popoutWindowDisposable.dispose();
8473
+ this._onDidOpenPopoutWindowFail.fire();
8474
+ // if the popout window was blocked, we need to move the group back to the reference group
8475
+ // and set it to visible
8476
+ this.movingLock(() => moveGroupWithoutDestroying({
8477
+ from: group,
8478
+ to: referenceGroup,
8479
+ }));
8480
+ if (!referenceGroup.api.isVisible) {
8481
+ referenceGroup.api.setVisible(true);
8482
+ }
8483
+ return false;
8484
+ }
8485
+ const gready = document.createElement('div');
8486
+ gready.className = 'dv-overlay-render-container';
8487
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8470
8488
  group.model.renderContainer = overlayRenderContainer;
8471
8489
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8472
8490
  let floatingBox;
@@ -8623,7 +8641,7 @@
8623
8641
  return true;
8624
8642
  })
8625
8643
  .catch((err) => {
8626
- console.error('dockview: failed to create popout window', err);
8644
+ console.error('dockview: failed to create popout.', err);
8627
8645
  return false;
8628
8646
  });
8629
8647
  }