aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-10-03 15:12:14 -0400
committerbobzel <zzzman@gmail.com>2022-10-03 15:12:14 -0400
commitaaef5f4693b5eb6aae429f5c8caaf82838e9c65e (patch)
treea822b08de929860df8e810d7d986ac20947a20b4 /src/client/views/collections
parent31ac3ec644547bd4a3450820f9a69ebcfd17661e (diff)
added a reset menu item for docking views in their context menu. fixed being able to edit dockingConfig in keyValue by quoting with ' instead of ". If there's no dockingConfig, make one.
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index c6ac5ee0c..40a5876e0 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -281,38 +281,36 @@ export class CollectionDockingView extends CollectionSubView() {
this.stateChanged();
return true;
}
-
setupGoldenLayout = async () => {
- const config = StrCast(this.props.Document.dockingConfig);
- if (config) {
- const matches = config.match(/\"documentId\":\"[a-z0-9-]+\"/g);
- const docids = matches?.map(m => m.replace('"documentId":"', '').replace('"', '')) ?? [];
- await Promise.all(docids.map(id => DocServer.GetRefField(id)));
-
- if (this._goldenLayout) {
- if (config === JSON.stringify(this._goldenLayout.toConfig())) {
- return;
- } else {
- try {
- this._goldenLayout.unbind('tabCreated', this.tabCreated);
- this._goldenLayout.unbind('tabDestroyed', this.tabDestroyed);
- this._goldenLayout.unbind('stackCreated', this.stackCreated);
- } catch (e) {}
- }
- this.tabMap.clear();
- this._goldenLayout.destroy();
+ const config = StrCast(this.props.Document.dockingConfig, JSON.stringify(DashboardView.resetDashboard(this.props.Document)));
+ const matches = config.match(/\"documentId\":\"[a-z0-9-]+\"/g);
+ const docids = matches?.map(m => m.replace('"documentId":"', '').replace('"', '')) ?? [];
+
+ await Promise.all(docids.map(id => DocServer.GetRefField(id)));
+
+ if (this._goldenLayout) {
+ if (config === JSON.stringify(this._goldenLayout.toConfig())) {
+ return;
+ } else {
+ try {
+ this._goldenLayout.unbind('tabCreated', this.tabCreated);
+ this._goldenLayout.unbind('tabDestroyed', this.tabDestroyed);
+ this._goldenLayout.unbind('stackCreated', this.stackCreated);
+ } catch (e) {}
}
- const glay = (this._goldenLayout = new GoldenLayout(JSON.parse(config)));
- glay.on('tabCreated', this.tabCreated);
- glay.on('tabDestroyed', this.tabDestroyed);
- glay.on('stackCreated', this.stackCreated);
- glay.registerComponent('DocumentFrameRenderer', TabDocView);
- glay.container = this._containerRef.current;
- glay.init();
- glay.root.layoutManager.on('itemDropped', this.tabItemDropped);
- glay.root.layoutManager.on('dragStart', this.tabDragStart);
- glay.root.layoutManager.on('activeContentItemChanged', this.stateChanged);
+ this.tabMap.clear();
+ this._goldenLayout.destroy();
}
+ const glay = (this._goldenLayout = new GoldenLayout(JSON.parse(config)));
+ glay.on('tabCreated', this.tabCreated);
+ glay.on('tabDestroyed', this.tabDestroyed);
+ glay.on('stackCreated', this.stackCreated);
+ glay.registerComponent('DocumentFrameRenderer', TabDocView);
+ glay.container = this._containerRef.current;
+ glay.init();
+ glay.root.layoutManager.on('itemDropped', this.tabItemDropped);
+ glay.root.layoutManager.on('dragStart', this.tabDragStart);
+ glay.root.layoutManager.on('activeContentItemChanged', this.stateChanged);
};
componentDidMount: () => void = () => {