diff options
| author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-05-06 00:14:11 -0400 |
|---|---|---|
| committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-05-06 00:14:11 -0400 |
| commit | 153632276d9326eecfbcabb759aad142254381f0 (patch) | |
| tree | d46198e938b69a57c86ad7c20c1fca5bc4f62d05 /src/client/views/collections/CollectionDockingView.tsx | |
| parent | 1ccabe155cb4f23c0aa7e37f91cd4a303008b8c7 (diff) | |
| parent | 09a471ac693e8178598c0d953b83868db9e4c8b4 (diff) | |
Merge branch 'newDocs' of github-tsch-brown:browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/collections/CollectionDockingView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionDockingView.tsx | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index cfb1aef7d..278065479 100644 --- a/src/client/views/collections/CollectionDockingView.tsx +++ b/src/client/views/collections/CollectionDockingView.tsx @@ -231,6 +231,11 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp @undoBatch stateChanged = () => { + let docs = Cast(CollectionDockingView.Instance.props.Document.data, listSpec(Doc)); + CollectionDockingView.Instance._removedDocs.map(theDoc => + docs && docs.indexOf(theDoc) !== -1 && + docs.splice(docs.indexOf(theDoc), 1)); + CollectionDockingView.Instance._removedDocs.length = 0; var json = JSON.stringify(this._goldenLayout.toConfig()); this.props.Document.dockingConfig = json; if (this.undohack && !this.hack) { @@ -275,19 +280,19 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp }); } tab.closeElement.off('click') //unbind the current click handler - .click(function () { + .click(async function () { if (tab.reactionDisposer) { tab.reactionDisposer(); } - DocServer.GetRefField(tab.contentItem.config.props.documentId).then(async f => runInAction(() => { - if (f instanceof Doc) { - let docs = Cast(CollectionDockingView.Instance.props.Document.data, listSpec(Doc)); - docs && docs.indexOf(f) !== -1 && docs.splice(docs.indexOf(f), 1); - } - })); + let doc = await DocServer.GetRefField(tab.contentItem.config.props.documentId); + if (doc instanceof Doc) { + let theDoc = doc; + CollectionDockingView.Instance._removedDocs.push(theDoc); + } tab.contentItem.remove(); }); } + _removedDocs: Doc[] = []; stackCreated = (stack: any) => { //stack.header.controlsContainer.find('.lm_popout').hide(); @@ -304,6 +309,16 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp var url = DocServer.prepend("/doc/" + stack.contentItems[0].tab.contentItem.config.props.documentId); let win = window.open(url, stack.contentItems[0].tab.title, "width=300,height=400"); })); + stack.header.controlsContainer.find('.lm_close') //unbind the current click handler + .click(async function () { + stack.contentItems.map(async (contentItem: any) => { + let doc = await DocServer.GetRefField(contentItem.config.props.documentId); + if (doc instanceof Doc) { + let theDoc = doc; + CollectionDockingView.Instance._removedDocs.push(theDoc); + } + }); + }); } render() { @@ -368,6 +383,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> { parentActive={returnTrue} whenActiveChanged={emptyFunction} focus={emptyFunction} + bringToFront={emptyFunction} ContainingCollectionView={undefined} /> </div >); } |
