dockview-core 6.2.1 → 6.3.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.
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +10 -1
- package/dist/cjs/api/dockviewGroupPanelApi.js +16 -0
- package/dist/cjs/dnd/groupDragHandler.js +34 -12
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +2 -2
- package/dist/cjs/dockview/components/titlebar/tabs.js +9 -2
- package/dist/cjs/dockview/components/titlebar/voidContainer.js +6 -0
- package/dist/cjs/dockview/dockviewComponent.d.ts +1 -0
- package/dist/cjs/dockview/dockviewComponent.js +187 -125
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +1 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +9 -0
- package/dist/cjs/dockview/dockviewPanel.js +5 -0
- package/dist/cjs/dockview/dockviewPanelModel.d.ts +2 -0
- package/dist/cjs/dockview/dockviewPanelModel.js +8 -0
- package/dist/cjs/dockview/framework.d.ts +8 -0
- package/dist/cjs/dockview/options.d.ts +13 -2
- package/dist/cjs/dockview/options.js +2 -0
- package/dist/cjs/dom.d.ts +5 -1
- package/dist/cjs/dom.js +14 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/overlay/overlayRenderContainer.js +13 -3
- package/dist/cjs/popoutWindow.d.ts +2 -0
- package/dist/cjs/popoutWindow.js +3 -1
- package/dist/dockview-core.js +169 -30
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +169 -30
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +10 -1
- package/dist/esm/api/dockviewGroupPanelApi.js +12 -0
- package/dist/esm/dnd/groupDragHandler.js +34 -12
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +2 -2
- package/dist/esm/dockview/components/titlebar/tabs.js +12 -2
- package/dist/esm/dockview/components/titlebar/voidContainer.js +6 -0
- package/dist/esm/dockview/dockviewComponent.d.ts +1 -0
- package/dist/esm/dockview/dockviewComponent.js +49 -7
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +1 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +9 -0
- package/dist/esm/dockview/dockviewPanel.js +5 -0
- package/dist/esm/dockview/dockviewPanelModel.d.ts +2 -0
- package/dist/esm/dockview/dockviewPanelModel.js +8 -0
- package/dist/esm/dockview/framework.d.ts +8 -0
- package/dist/esm/dockview/options.d.ts +13 -2
- package/dist/esm/dockview/options.js +2 -0
- package/dist/esm/dom.d.ts +5 -1
- package/dist/esm/dom.js +13 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/overlay/overlayRenderContainer.js +13 -3
- package/dist/esm/popoutWindow.d.ts +2 -0
- package/dist/esm/popoutWindow.js +3 -1
- package/dist/package/main.cjs.js +169 -30
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +169 -30
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 6.
|
|
3
|
+
* @version 6.3.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -472,8 +472,10 @@ function quasiPreventDefault(event) {
|
|
|
472
472
|
function quasiDefaultPrevented(event) {
|
|
473
473
|
return event[QUASI_PREVENT_DEFAULT_KEY];
|
|
474
474
|
}
|
|
475
|
-
function addStyles(document, styleSheetList) {
|
|
475
|
+
function addStyles(document, styleSheetList, options = {}) {
|
|
476
476
|
const styleSheets = Array.from(styleSheetList);
|
|
477
|
+
const { nonce } = options;
|
|
478
|
+
const resolvedNonce = typeof nonce === 'function' ? nonce(document) : nonce;
|
|
477
479
|
for (const styleSheet of styleSheets) {
|
|
478
480
|
if (styleSheet.href) {
|
|
479
481
|
const link = document.createElement('link');
|
|
@@ -481,6 +483,10 @@ function addStyles(document, styleSheetList) {
|
|
|
481
483
|
link.type = styleSheet.type;
|
|
482
484
|
link.rel = 'stylesheet';
|
|
483
485
|
document.head.appendChild(link);
|
|
486
|
+
// The <link> will load and apply its rules in the target
|
|
487
|
+
// document. Reading cssRules here would duplicate them
|
|
488
|
+
// (and throws for cross-origin sheets).
|
|
489
|
+
continue;
|
|
484
490
|
}
|
|
485
491
|
let cssTexts = [];
|
|
486
492
|
try {
|
|
@@ -491,11 +497,16 @@ function addStyles(document, styleSheetList) {
|
|
|
491
497
|
catch (err) {
|
|
492
498
|
console.warn('dockview: failed to access stylesheet rules due to security restrictions', err);
|
|
493
499
|
}
|
|
500
|
+
const fragment = document.createDocumentFragment();
|
|
494
501
|
for (const rule of cssTexts) {
|
|
495
502
|
const style = document.createElement('style');
|
|
503
|
+
if (resolvedNonce) {
|
|
504
|
+
style.setAttribute('nonce', resolvedNonce);
|
|
505
|
+
}
|
|
496
506
|
style.appendChild(document.createTextNode(rule));
|
|
497
|
-
|
|
507
|
+
fragment.appendChild(style);
|
|
498
508
|
}
|
|
509
|
+
document.head.appendChild(fragment);
|
|
499
510
|
}
|
|
500
511
|
}
|
|
501
512
|
function getDomNodePagePosition(domNode) {
|
|
@@ -5487,19 +5498,41 @@ class GroupDragHandler extends DragHandler {
|
|
|
5487
5498
|
const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
|
|
5488
5499
|
const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
|
|
5489
5500
|
if (dataTransfer) {
|
|
5490
|
-
const
|
|
5491
|
-
ghostElement
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5501
|
+
const createGhost = this.accessor.options.createGroupDragGhostComponent;
|
|
5502
|
+
let ghostElement;
|
|
5503
|
+
let customRenderer;
|
|
5504
|
+
if (createGhost) {
|
|
5505
|
+
customRenderer = createGhost(this.group);
|
|
5506
|
+
customRenderer.init({
|
|
5507
|
+
group: this.group,
|
|
5508
|
+
api: this.accessor.api,
|
|
5509
|
+
});
|
|
5510
|
+
ghostElement = customRenderer.element;
|
|
5511
|
+
ghostElement.style.position = 'absolute';
|
|
5512
|
+
ghostElement.style.pointerEvents = 'none';
|
|
5513
|
+
ghostElement.style.top = '-9999px';
|
|
5514
|
+
}
|
|
5515
|
+
else {
|
|
5516
|
+
ghostElement = document.createElement('div');
|
|
5517
|
+
ghostElement.style.backgroundColor = bgColor;
|
|
5518
|
+
ghostElement.style.color = color;
|
|
5519
|
+
ghostElement.style.padding = '2px 8px';
|
|
5520
|
+
ghostElement.style.height = '24px';
|
|
5521
|
+
ghostElement.style.fontSize = '11px';
|
|
5522
|
+
ghostElement.style.lineHeight = '20px';
|
|
5523
|
+
ghostElement.style.borderRadius = '12px';
|
|
5524
|
+
ghostElement.style.position = 'absolute';
|
|
5525
|
+
ghostElement.style.pointerEvents = 'none';
|
|
5526
|
+
ghostElement.style.top = '-9999px';
|
|
5527
|
+
ghostElement.textContent = `Multiple Panels (${this.group.size})`;
|
|
5528
|
+
}
|
|
5502
5529
|
addGhostImage(dataTransfer, ghostElement, { y: -10, x: 30 });
|
|
5530
|
+
if (customRenderer === null || customRenderer === void 0 ? void 0 : customRenderer.dispose) {
|
|
5531
|
+
// addGhostImage removes the element from the DOM on the next
|
|
5532
|
+
// tick; dispose the framework renderer on the same schedule.
|
|
5533
|
+
const renderer = customRenderer;
|
|
5534
|
+
setTimeout(() => { var _a; return (_a = renderer.dispose) === null || _a === void 0 ? void 0 : _a.call(renderer); }, 0);
|
|
5535
|
+
}
|
|
5503
5536
|
}
|
|
5504
5537
|
return {
|
|
5505
5538
|
dispose: () => {
|
|
@@ -5532,6 +5565,12 @@ class VoidContainer extends CompositeDisposable {
|
|
|
5532
5565
|
this.dropTarget = new Droptarget(this._element, {
|
|
5533
5566
|
acceptedTargetZones: ['center'],
|
|
5534
5567
|
canDisplayOverlay: (event, position) => {
|
|
5568
|
+
if (this.group.api.locked) {
|
|
5569
|
+
// Dropping on the void/header space adds the panel
|
|
5570
|
+
// to this group, which `locked` is meant to prevent
|
|
5571
|
+
// (both `true` and `'no-drop-target'`).
|
|
5572
|
+
return false;
|
|
5573
|
+
}
|
|
5535
5574
|
const data = getPanelData();
|
|
5536
5575
|
if (data && this.accessor.id === data.viewId) {
|
|
5537
5576
|
return true;
|
|
@@ -6113,7 +6152,7 @@ class WrapTabGroupIndicator extends BaseTabGroupIndicator {
|
|
|
6113
6152
|
let svg = underline.firstElementChild;
|
|
6114
6153
|
let path;
|
|
6115
6154
|
if (!svg || svg.tagName !== 'svg') {
|
|
6116
|
-
underline.
|
|
6155
|
+
underline.replaceChildren();
|
|
6117
6156
|
svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
6118
6157
|
svg.style.display = 'block';
|
|
6119
6158
|
path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
@@ -6211,7 +6250,7 @@ class NoneTabGroupIndicator extends BaseTabGroupIndicator {
|
|
|
6211
6250
|
underline.style.display = '';
|
|
6212
6251
|
// Clear any SVG content left over from a mode switch
|
|
6213
6252
|
if (underline.firstElementChild) {
|
|
6214
|
-
underline.
|
|
6253
|
+
underline.replaceChildren();
|
|
6215
6254
|
}
|
|
6216
6255
|
underline.style.backgroundColor = color;
|
|
6217
6256
|
if (isVertical) {
|
|
@@ -7604,11 +7643,15 @@ class Tabs extends CompositeDisposable {
|
|
|
7604
7643
|
if (!isInsideRange && !isJustBeforeGroup) {
|
|
7605
7644
|
continue;
|
|
7606
7645
|
}
|
|
7607
|
-
if (isGroupDrag) {
|
|
7646
|
+
if (isGroupDrag && isInsideRange) {
|
|
7608
7647
|
// A group cannot be dropped inside another group.
|
|
7609
7648
|
// Snap the insertion index to just before or just
|
|
7610
7649
|
// after this group based on cursor position relative
|
|
7611
|
-
// to the group's midpoint.
|
|
7650
|
+
// to the group's midpoint. Only applies when the
|
|
7651
|
+
// insertion would land *inside* the group — for
|
|
7652
|
+
// `isJustBeforeGroup`, the index is already outside
|
|
7653
|
+
// (immediately left of the group) and is a valid
|
|
7654
|
+
// drop position, so leave it untouched (issue #1264).
|
|
7612
7655
|
const groupMid = (firstIdx + lastIdx + 1) / 2;
|
|
7613
7656
|
if (insertionIndex < groupMid) {
|
|
7614
7657
|
insertionIndex = firstIdx;
|
|
@@ -7619,6 +7662,12 @@ class Tabs extends CompositeDisposable {
|
|
|
7619
7662
|
// targetTabGroupId stays null
|
|
7620
7663
|
break;
|
|
7621
7664
|
}
|
|
7665
|
+
if (isGroupDrag && isJustBeforeGroup) {
|
|
7666
|
+
// Cursor is just before the group — accept this
|
|
7667
|
+
// index as-is. Groups can be dropped at the slot
|
|
7668
|
+
// immediately left of another group's first tab.
|
|
7669
|
+
break;
|
|
7670
|
+
}
|
|
7622
7671
|
if (isJustBeforeGroup) {
|
|
7623
7672
|
// Check whether only the source tab (or source group
|
|
7624
7673
|
// tabs) sits between insertionIndex and firstIdx.
|
|
@@ -8460,6 +8509,7 @@ const PROPERTY_KEYS_DOCKVIEW = (() => {
|
|
|
8460
8509
|
disableFloatingGroups: undefined,
|
|
8461
8510
|
floatingGroupBounds: undefined,
|
|
8462
8511
|
popoutUrl: undefined,
|
|
8512
|
+
nonce: undefined,
|
|
8463
8513
|
defaultRenderer: undefined,
|
|
8464
8514
|
defaultHeaderPosition: undefined,
|
|
8465
8515
|
debug: undefined,
|
|
@@ -8475,6 +8525,7 @@ const PROPERTY_KEYS_DOCKVIEW = (() => {
|
|
|
8475
8525
|
getTabContextMenuItems: undefined,
|
|
8476
8526
|
getTabGroupChipContextMenuItems: undefined,
|
|
8477
8527
|
createTabGroupChipComponent: undefined,
|
|
8528
|
+
createGroupDragGhostComponent: undefined,
|
|
8478
8529
|
tabGroupColors: undefined,
|
|
8479
8530
|
tabGroupAccent: undefined,
|
|
8480
8531
|
};
|
|
@@ -9167,6 +9218,15 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
9167
9218
|
refreshTabGroupAccent() {
|
|
9168
9219
|
this.tabsContainer.refreshTabGroupAccent();
|
|
9169
9220
|
}
|
|
9221
|
+
refreshWatermark() {
|
|
9222
|
+
var _a, _b;
|
|
9223
|
+
if (this.watermark) {
|
|
9224
|
+
this.watermark.element.remove();
|
|
9225
|
+
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
9226
|
+
this.watermark = undefined;
|
|
9227
|
+
}
|
|
9228
|
+
this.updateContainer();
|
|
9229
|
+
}
|
|
9170
9230
|
getTabGroupForPanel(panelId) {
|
|
9171
9231
|
return this._findTabGroupForPanel(panelId);
|
|
9172
9232
|
}
|
|
@@ -9997,6 +10057,18 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
9997
10057
|
}
|
|
9998
10058
|
return this._group.model.location;
|
|
9999
10059
|
}
|
|
10060
|
+
get locked() {
|
|
10061
|
+
if (!this._group) {
|
|
10062
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
10063
|
+
}
|
|
10064
|
+
return this._group.locked;
|
|
10065
|
+
}
|
|
10066
|
+
set locked(value) {
|
|
10067
|
+
if (!this._group) {
|
|
10068
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
10069
|
+
}
|
|
10070
|
+
this._group.locked = value;
|
|
10071
|
+
}
|
|
10000
10072
|
constructor(id, accessor) {
|
|
10001
10073
|
super(id, '__dockviewgroup__');
|
|
10002
10074
|
this.accessor = accessor;
|
|
@@ -10587,6 +10659,11 @@ class DockviewPanel extends CompositeDisposable {
|
|
|
10587
10659
|
const didTitleChange = title !== this.title;
|
|
10588
10660
|
if (didTitleChange) {
|
|
10589
10661
|
this._title = title;
|
|
10662
|
+
// keep the view-model's cached init params in sync so that tab
|
|
10663
|
+
// renderers constructed lazily (e.g. the header overflow
|
|
10664
|
+
// dropdown via createTabRenderer) see the updated title
|
|
10665
|
+
// (#914).
|
|
10666
|
+
this.view.setTitle(title);
|
|
10590
10667
|
this.api._onDidTitleChange.fire({ title });
|
|
10591
10668
|
}
|
|
10592
10669
|
}
|
|
@@ -10747,6 +10824,14 @@ class DockviewPanelModel {
|
|
|
10747
10824
|
this.content.init(params);
|
|
10748
10825
|
this.tab.init(Object.assign(Object.assign({}, params), { tabLocation: 'header' }));
|
|
10749
10826
|
}
|
|
10827
|
+
setTitle(title) {
|
|
10828
|
+
// keep the cached init params in sync so that tab renderers created
|
|
10829
|
+
// lazily after the title changes (e.g. for the header overflow
|
|
10830
|
+
// dropdown) see the current title rather than the stale original.
|
|
10831
|
+
if (this._params) {
|
|
10832
|
+
this._params.title = title;
|
|
10833
|
+
}
|
|
10834
|
+
}
|
|
10750
10835
|
layout(width, height) {
|
|
10751
10836
|
var _a, _b;
|
|
10752
10837
|
(_b = (_a = this.content).layout) === null || _b === void 0 ? void 0 : _b.call(_a, width, height);
|
|
@@ -11386,10 +11471,20 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
11386
11471
|
focusContainer.style.top = `${top}px`;
|
|
11387
11472
|
focusContainer.style.width = `${width}px`;
|
|
11388
11473
|
focusContainer.style.height = `${height}px`;
|
|
11389
|
-
//
|
|
11390
|
-
//
|
|
11391
|
-
|
|
11474
|
+
// Sync visibility/pointer-events with the panel's current
|
|
11475
|
+
// visibility at paint time. visibilityChanged() may have
|
|
11476
|
+
// flipped to hidden between scheduling this rAF and now;
|
|
11477
|
+
// unconditionally clearing `visibility:hidden` here would
|
|
11478
|
+
// leave a hidden panel visually visible at a stale position,
|
|
11479
|
+
// because onDidDimensionsChange skips non-visible panels and
|
|
11480
|
+
// never recomputes their box on subsequent resizes.
|
|
11481
|
+
if (panel.api.isVisible) {
|
|
11392
11482
|
focusContainer.style.visibility = '';
|
|
11483
|
+
focusContainer.style.pointerEvents = '';
|
|
11484
|
+
}
|
|
11485
|
+
else {
|
|
11486
|
+
focusContainer.style.visibility = 'hidden';
|
|
11487
|
+
focusContainer.style.pointerEvents = 'none';
|
|
11393
11488
|
}
|
|
11394
11489
|
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
|
|
11395
11490
|
});
|
|
@@ -11656,7 +11751,9 @@ class PopoutWindow extends CompositeDisposable {
|
|
|
11656
11751
|
const externalDocument = externalWindow.document;
|
|
11657
11752
|
externalDocument.title = document.title;
|
|
11658
11753
|
externalDocument.body.appendChild(container);
|
|
11659
|
-
addStyles(externalDocument, window.document.styleSheets
|
|
11754
|
+
addStyles(externalDocument, window.document.styleSheets, {
|
|
11755
|
+
nonce: this.options.nonce,
|
|
11756
|
+
});
|
|
11660
11757
|
/**
|
|
11661
11758
|
* beforeunload must be registered after load for reasons I could not determine
|
|
11662
11759
|
* otherwise the beforeunload event will not fire when the window is closed
|
|
@@ -12846,6 +12943,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
12846
12943
|
this._floatingGroups = [];
|
|
12847
12944
|
this._popoutGroups = [];
|
|
12848
12945
|
this._popoutRestorationPromise = Promise.resolve();
|
|
12946
|
+
this._popoutRestorationCleanups = new Set();
|
|
12849
12947
|
this._onDidRemoveGroup = new Emitter();
|
|
12850
12948
|
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
12851
12949
|
this._onDidAddGroup = new Emitter();
|
|
@@ -12951,6 +13049,14 @@ class DockviewComponent extends BaseGrid {
|
|
|
12951
13049
|
this._bufferOnDidLayoutChange.fire();
|
|
12952
13050
|
}), Disposable.from(() => {
|
|
12953
13051
|
var _a;
|
|
13052
|
+
// Cancel any pending popout-restoration timers scheduled by
|
|
13053
|
+
// fromJSON so they don't open new browser windows after
|
|
13054
|
+
// dispose, and resolve their promises so callers awaiting
|
|
13055
|
+
// popoutRestorationPromise don't hang. See issue #851.
|
|
13056
|
+
for (const cleanup of [...this._popoutRestorationCleanups]) {
|
|
13057
|
+
cleanup();
|
|
13058
|
+
}
|
|
13059
|
+
this._popoutRestorationCleanups.clear();
|
|
12954
13060
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
12955
13061
|
for (const group of [...this._floatingGroups]) {
|
|
12956
13062
|
group.dispose();
|
|
@@ -13047,7 +13153,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
13047
13153
|
return (_a = this._popoutPopupServices.get(group.id)) !== null && _a !== void 0 ? _a : this.popupService;
|
|
13048
13154
|
}
|
|
13049
13155
|
addPopoutGroup(itemToPopout, options) {
|
|
13050
|
-
var _a, _b, _c, _d, _e;
|
|
13156
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13051
13157
|
if (itemToPopout instanceof DockviewGroupPanel &&
|
|
13052
13158
|
itemToPopout.model.location.type === 'edge') {
|
|
13053
13159
|
// edge groups are permanent structural elements and cannot be popped out
|
|
@@ -13082,6 +13188,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
13082
13188
|
height: box.height,
|
|
13083
13189
|
onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
|
|
13084
13190
|
onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
|
|
13191
|
+
nonce: (_f = this.options) === null || _f === void 0 ? void 0 : _f.nonce,
|
|
13085
13192
|
});
|
|
13086
13193
|
const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
|
|
13087
13194
|
popoutWindowDisposable.dispose();
|
|
@@ -13499,7 +13606,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
13499
13606
|
}
|
|
13500
13607
|
}
|
|
13501
13608
|
updateOptions(options) {
|
|
13502
|
-
var _a, _b, _c;
|
|
13609
|
+
var _a, _b, _c, _d, _e;
|
|
13503
13610
|
super.updateOptions(options);
|
|
13504
13611
|
if ('floatingGroupBounds' in options) {
|
|
13505
13612
|
for (const group of this._floatingGroups) {
|
|
@@ -13540,8 +13647,19 @@ class DockviewComponent extends BaseGrid {
|
|
|
13540
13647
|
group.model.updateHeaderActions();
|
|
13541
13648
|
}
|
|
13542
13649
|
}
|
|
13650
|
+
if ('createWatermarkComponent' in options) {
|
|
13651
|
+
if (this._watermark) {
|
|
13652
|
+
this._watermark.element.parentElement.remove();
|
|
13653
|
+
(_d = (_c = this._watermark).dispose) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
13654
|
+
this._watermark = null;
|
|
13655
|
+
}
|
|
13656
|
+
this.updateWatermark();
|
|
13657
|
+
for (const group of this.groups) {
|
|
13658
|
+
group.model.refreshWatermark();
|
|
13659
|
+
}
|
|
13660
|
+
}
|
|
13543
13661
|
if ('tabGroupColors' in options || 'tabGroupAccent' in options) {
|
|
13544
|
-
this._tabGroupColorPalette.setEntries((
|
|
13662
|
+
this._tabGroupColorPalette.setEntries((_e = this._options.tabGroupColors) !== null && _e !== void 0 ? _e : DEFAULT_TAB_GROUP_COLORS);
|
|
13545
13663
|
this._tabGroupColorPalette.enabled =
|
|
13546
13664
|
this._options.tabGroupAccent !== 'off';
|
|
13547
13665
|
for (const group of this.groups) {
|
|
@@ -13967,7 +14085,23 @@ class DockviewComponent extends BaseGrid {
|
|
|
13967
14085
|
const group = createGroupFromSerializedState(data);
|
|
13968
14086
|
// Add a small delay for each popup after the first to avoid browser popup blocking
|
|
13969
14087
|
const popoutPromise = new Promise((resolve) => {
|
|
13970
|
-
|
|
14088
|
+
const cleanup = () => {
|
|
14089
|
+
this._popoutRestorationCleanups.delete(cleanup);
|
|
14090
|
+
clearTimeout(handle);
|
|
14091
|
+
resolve();
|
|
14092
|
+
};
|
|
14093
|
+
const handle = setTimeout(() => {
|
|
14094
|
+
this._popoutRestorationCleanups.delete(cleanup);
|
|
14095
|
+
// Guard against the component being disposed before
|
|
14096
|
+
// this timer fires. Under React StrictMode the
|
|
14097
|
+
// component is mounted -> disposed -> remounted, and
|
|
14098
|
+
// without this guard the first instance's queued
|
|
14099
|
+
// restoration would open a second popout window.
|
|
14100
|
+
// See issue #851.
|
|
14101
|
+
if (this.isDisposed) {
|
|
14102
|
+
resolve();
|
|
14103
|
+
return;
|
|
14104
|
+
}
|
|
13971
14105
|
this.addPopoutGroup(group, {
|
|
13972
14106
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
13973
14107
|
overridePopoutGroup: gridReferenceGroup
|
|
@@ -13980,6 +14114,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
13980
14114
|
});
|
|
13981
14115
|
resolve();
|
|
13982
14116
|
}, index * DESERIALIZATION_POPOUT_DELAY_MS); // 100ms delay between each popup
|
|
14117
|
+
this._popoutRestorationCleanups.add(cleanup);
|
|
13983
14118
|
});
|
|
13984
14119
|
popoutPromises.push(popoutPromise);
|
|
13985
14120
|
});
|
|
@@ -14510,8 +14645,11 @@ class DockviewComponent extends BaseGrid {
|
|
|
14510
14645
|
* the source group is a popout group with a single panel
|
|
14511
14646
|
*
|
|
14512
14647
|
* 1. remove the panel from the group without triggering any events
|
|
14513
|
-
* 2. remove the popout group
|
|
14514
|
-
*
|
|
14648
|
+
* 2. remove the popout group — this may cascade-remove the empty
|
|
14649
|
+
* reference group it left behind in the main grid (see
|
|
14650
|
+
* doRemoveGroup for popout groups), which can shift grid indices
|
|
14651
|
+
* 3. recompute the target location now that the grid is stable
|
|
14652
|
+
* 4. create a new group at the recomputed location and add that panel
|
|
14515
14653
|
*/
|
|
14516
14654
|
const popoutGroup = this._popoutGroups.find((group) => group.popoutGroup === sourceGroup);
|
|
14517
14655
|
const removedPanel = this.movingLock(() => popoutGroup.popoutGroup.model.removePanel(popoutGroup.popoutGroup.panels[0], {
|
|
@@ -14519,7 +14657,8 @@ class DockviewComponent extends BaseGrid {
|
|
|
14519
14657
|
skipSetActiveGroup: true,
|
|
14520
14658
|
}));
|
|
14521
14659
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
14522
|
-
const
|
|
14660
|
+
const updatedTargetLocation = getRelativeLocation(this.gridview.orientation, getGridLocation(destinationGroup.element), destinationTarget);
|
|
14661
|
+
const newGroup = this.createGroupAtLocation(updatedTargetLocation);
|
|
14523
14662
|
this.movingLock(() => newGroup.model.openPanel(removedPanel, {
|
|
14524
14663
|
skipSetActive: true,
|
|
14525
14664
|
}));
|