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
  */
@@ -3622,6 +3622,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3622
3622
  get onDidPopoutGroupPositionChange() {
3623
3623
  return this.component.onDidPopoutGroupPositionChange;
3624
3624
  }
3625
+ get onDidOpenPopoutWindowFail() {
3626
+ return this.component.onDidOpenPopoutWindowFail;
3627
+ }
3625
3628
  /**
3626
3629
  * All panel objects.
3627
3630
  */
@@ -8201,6 +8204,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8201
8204
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8202
8205
  this._onDidPopoutGroupPositionChange = new Emitter();
8203
8206
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8207
+ this._onDidOpenPopoutWindowFail = new Emitter();
8208
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8204
8209
  this._onDidLayoutFromJSON = new Emitter();
8205
8210
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8206
8211
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8265,7 +8270,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8265
8270
  if (options.debug) {
8266
8271
  this.addDisposables(new StrictEventsSequencing(this));
8267
8272
  }
8268
- 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(() => {
8273
+ 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(() => {
8269
8274
  this.updateWatermark();
8270
8275
  }), this.onDidAdd((event) => {
8271
8276
  if (!this._moving) {
@@ -8411,13 +8416,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8411
8416
  if (_window.isDisposed) {
8412
8417
  return false;
8413
8418
  }
8414
- if (popoutContainer === null) {
8415
- popoutWindowDisposable.dispose();
8416
- return false;
8417
- }
8418
- const gready = document.createElement('div');
8419
- gready.className = 'dv-overlay-render-container';
8420
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8421
8419
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8422
8420
  ? options.referenceGroup
8423
8421
  : itemToPopout instanceof DockviewPanel
@@ -8425,7 +8423,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8425
8423
  : itemToPopout;
8426
8424
  const referenceLocation = itemToPopout.api.location.type;
8427
8425
  /**
8428
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8426
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8429
8427
  * of this case is when being called from the `fromJSON(...)` method
8430
8428
  */
8431
8429
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8438,8 +8436,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8438
8436
  }
8439
8437
  else {
8440
8438
  group = this.createGroup({ id: groupId });
8441
- this._onDidAddGroup.fire(group);
8439
+ if (popoutContainer) {
8440
+ this._onDidAddGroup.fire(group);
8441
+ }
8442
8442
  }
8443
+ if (popoutContainer === null) {
8444
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8445
+ popoutWindowDisposable.dispose();
8446
+ this._onDidOpenPopoutWindowFail.fire();
8447
+ // if the popout window was blocked, we need to move the group back to the reference group
8448
+ // and set it to visible
8449
+ this.movingLock(() => moveGroupWithoutDestroying({
8450
+ from: group,
8451
+ to: referenceGroup,
8452
+ }));
8453
+ if (!referenceGroup.api.isVisible) {
8454
+ referenceGroup.api.setVisible(true);
8455
+ }
8456
+ return false;
8457
+ }
8458
+ const gready = document.createElement('div');
8459
+ gready.className = 'dv-overlay-render-container';
8460
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8443
8461
  group.model.renderContainer = overlayRenderContainer;
8444
8462
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8445
8463
  let floatingBox;
@@ -8596,7 +8614,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8596
8614
  return true;
8597
8615
  })
8598
8616
  .catch((err) => {
8599
- console.error('dockview: failed to create popout window', err);
8617
+ console.error('dockview: failed to create popout.', err);
8600
8618
  return false;
8601
8619
  });
8602
8620
  }