11/**
22 * dockview-core
3- * @version 4.3.1
3+ * @version 4.4.0
44 * @link https://github.com/mathuo/dockview
55 * @license MIT
66 */
@@ -3619,6 +3619,9 @@ class DockviewApi {
36193619 get onDidPopoutGroupPositionChange ( ) {
36203620 return this . component . onDidPopoutGroupPositionChange ;
36213621 }
3622+ get onDidOpenPopoutWindowFail ( ) {
3623+ return this . component . onDidOpenPopoutWindowFail ;
3624+ }
36223625 /**
36233626 * All panel objects.
36243627 */
@@ -8351,6 +8354,8 @@ class DockviewComponent extends BaseGrid {
83518354 this . onDidPopoutGroupSizeChange = this . _onDidPopoutGroupSizeChange . event ;
83528355 this . _onDidPopoutGroupPositionChange = new Emitter ( ) ;
83538356 this . onDidPopoutGroupPositionChange = this . _onDidPopoutGroupPositionChange . event ;
8357+ this . _onDidOpenPopoutWindowFail = new Emitter ( ) ;
8358+ this . onDidOpenPopoutWindowFail = this . _onDidOpenPopoutWindowFail . event ;
83548359 this . _onDidLayoutFromJSON = new Emitter ( ) ;
83558360 this . onDidLayoutFromJSON = this . _onDidLayoutFromJSON . event ;
83568361 this . _onDidActivePanelChange = new Emitter ( { replay : true } ) ;
@@ -8415,7 +8420,7 @@ class DockviewComponent extends BaseGrid {
84158420 if ( options . debug ) {
84168421 this . addDisposables ( new StrictEventsSequencing ( this ) ) ;
84178422 }
8418- 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 ( ( ) => {
8423+ 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 ( ( ) => {
84198424 this . updateWatermark ( ) ;
84208425 } ) , this . onDidAdd ( ( event ) => {
84218426 if ( ! this . _moving ) {
@@ -8565,21 +8570,14 @@ class DockviewComponent extends BaseGrid {
85658570 if ( _window . isDisposed ) {
85668571 return false ;
85678572 }
8568- if ( popoutContainer === null ) {
8569- popoutWindowDisposable . dispose ( ) ;
8570- return false ;
8571- }
8572- const gready = document . createElement ( 'div' ) ;
8573- gready . className = 'dv-overlay-render-container' ;
8574- const overlayRenderContainer = new OverlayRenderContainer ( gready , this ) ;
85758573 const referenceGroup = ( options === null || options === void 0 ? void 0 : options . referenceGroup )
85768574 ? options . referenceGroup
85778575 : itemToPopout instanceof DockviewPanel
85788576 ? itemToPopout . group
85798577 : itemToPopout ;
85808578 const referenceLocation = itemToPopout . api . location . type ;
85818579 /**
8582- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8580+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
85838581 * of this case is when being called from the `fromJSON(...)` method
85848582 */
85858583 const isGroupAddedToDom = referenceGroup . element . parentElement !== null ;
@@ -8592,8 +8590,28 @@ class DockviewComponent extends BaseGrid {
85928590 }
85938591 else {
85948592 group = this . createGroup ( { id : groupId } ) ;
8595- this . _onDidAddGroup . fire ( group ) ;
8593+ if ( popoutContainer ) {
8594+ this . _onDidAddGroup . fire ( group ) ;
8595+ }
85968596 }
8597+ if ( popoutContainer === null ) {
8598+ console . error ( 'dockview: failed to create popout. perhaps you need to allow pop-ups for this website' ) ;
8599+ popoutWindowDisposable . dispose ( ) ;
8600+ this . _onDidOpenPopoutWindowFail . fire ( ) ;
8601+ // if the popout window was blocked, we need to move the group back to the reference group
8602+ // and set it to visible
8603+ this . movingLock ( ( ) => moveGroupWithoutDestroying ( {
8604+ from : group ,
8605+ to : referenceGroup ,
8606+ } ) ) ;
8607+ if ( ! referenceGroup . api . isVisible ) {
8608+ referenceGroup . api . setVisible ( true ) ;
8609+ }
8610+ return false ;
8611+ }
8612+ const gready = document . createElement ( 'div' ) ;
8613+ gready . className = 'dv-overlay-render-container' ;
8614+ const overlayRenderContainer = new OverlayRenderContainer ( gready , this ) ;
85978615 group . model . renderContainer = overlayRenderContainer ;
85988616 group . layout ( _window . window . innerWidth , _window . window . innerHeight ) ;
85998617 let floatingBox ;
@@ -8750,7 +8768,7 @@ class DockviewComponent extends BaseGrid {
87508768 return true ;
87518769 } )
87528770 . catch ( ( err ) => {
8753- console . error ( 'dockview: failed to create popout window ' , err ) ;
8771+ console . error ( 'dockview: failed to create popout. ' , err ) ;
87548772 return false ;
87558773 } ) ;
87568774 }
0 commit comments